diff -r 8ab6687fb94c -r 3adadc800673 telephonyprotocols/rawipnif/src/BcaIoController.cpp --- a/telephonyprotocols/rawipnif/src/BcaIoController.cpp Thu May 27 14:05:07 2010 +0300 +++ b/telephonyprotocols/rawipnif/src/BcaIoController.cpp Fri Jun 11 14:49:29 2010 +0300 @@ -19,6 +19,12 @@ @file BcaIoController.cpp */ + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "BcaIoControllerTraces.h" +#endif + #include #include #include @@ -38,16 +44,13 @@ extern const TInt KMaxRxIPPacketSize = KMaxIPPacket + KIPTagHeaderLength; #endif -CBcaIoController::CBcaIoController(MControllerObserver& aObserver, - CBttLogger* aTheLogger) +CBcaIoController::CBcaIoController(MControllerObserver& aObserver) /** * Constructor. * * @param aObserver Reference to the observer of this state machine - * @param aTheLogger The logging object */ - : iTheLogger(aTheLogger), - iSendState(EIdle), + : iSendState(EIdle), iFlowBlocked(EFalse), iNumPacketsInSendQueue(0), iObserver(aObserver), @@ -58,29 +61,28 @@ { } -CBcaIoController* CBcaIoController::NewL(MControllerObserver& aObserver, CBttLogger* aTheLogger) +CBcaIoController* CBcaIoController::NewL(MControllerObserver& aObserver) /** * Two-phase constructor. Creates a new CBcaIoController object, performs * second-phase construction, then returns it. * * @param aObserver The observer, to which events will be reported - * @param aTheLogger The logging object * @return A newly constructed CBcaIoController object */ - { - CBcaIoController* self = new (ELeave) CBcaIoController(aObserver, aTheLogger); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } + { + CBcaIoController* self = new (ELeave) CBcaIoController(aObserver); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } void CBcaIoController::ConstructL() /** * Second-phase constructor. Creates all the state objects it owns. */ { - _LOG_L1C1(_L8("CBcaIoController::ConstructL")); + OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCAIOCONTROLLER_CONSTRUCTL_1, "CBcaIoController::ConstructL"); #ifdef RAWIP_HEADER_APPENDED_TO_PACKETS iIPTagHeader = new (ELeave) CIPTagHeader(iTheLogger); @@ -106,10 +108,11 @@ // end note - iSender = CSender::NewL(*this, iTheLogger, iMaxTxPacketSize); - iReceiver = CReceiver::NewL(*this, iTheLogger, iMaxRxPacketSize); - iLoader = new (ELeave) CBcaControl(*this, iTheLogger); + iSender = CSender::NewL(*this, iMaxTxPacketSize); + iReceiver = CReceiver::NewL(*this, iMaxRxPacketSize); + iLoader = new (ELeave) CBcaControl(*this); } + CBcaIoController::~CBcaIoController() @@ -145,7 +148,7 @@ * Used to kick off the initialisation for this module */ { - _LOG_L1C1(_L8("CBcaIoController::StartL is called.")); + OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCAIOCONTROLLER_STARTL_1, "CBcaIoController::StartL is called."); iLoader->StartLoadL(); } @@ -157,7 +160,7 @@ * @param aError the passed in error code as to why Stop has been called */ { - _LOG_L1C1(_L8("CBcaIoController::Stop is called.")); + OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCAIOCONTROLLER_STOP_1, "CBcaIoController::Stop is called."); //Stop all the active objects iReceiver->Cancel(); @@ -182,12 +185,12 @@ * @param aPdu a data packet */ { - _LOG_L1C1(_L8(">>CBcaIoController::Send")); + OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCAIOCONTROLLER_SEND_1, "<Length()) > iMaxTxPacketSize) { - _LOG_L2C1(_L8("Packet is too large - discarding")); - _LOG_L1C1(_L8("< Error")); + OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCAIOCONTROLLER_SEND_3, "Packet is too large - discarding"); + OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCAIOCONTROLLER_SEND_4, "< Error"); // in debug panic - this should not happen, MTU on the uplink should // be strictly enforced @@ -212,7 +215,7 @@ // may be counter intuitive, however the only options here are either // send accepted or blocked (MLowerDataSender). - _LOG_L2C1(_L8("<Send(aPdu); @@ -275,7 +278,7 @@ // otherwise, block this flow until we have room for the next // packet - _LOG_L2C1(_L8("<>CBcaIoController::SendComplete")); + OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCAIOCONTROLLER_SENDCOMPLETE_1, ">>CBcaIoController::SendComplete"); // if we've been blocked while in the middle of a // send - don't continue sending, this will happen // when the flow is resumed. - + iSendState = EIdle; // are we available to transmit? @@ -321,11 +324,11 @@ iSendState = ESending; RMBufChain tmpPdu; - _LOG_L1C1(_L8(" Packet removed from queue to send")); + OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCAIOCONTROLLER_SENDCOMPLETE_2, " Packet removed from queue to send"); RemoveFromSendQueue(tmpPdu); // Update module state - _LOG_L2C1(_L8(" set State to ESending")); + OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCAIOCONTROLLER_SENDCOMPLETE_3, " set State to ESending"); iSender->Send(tmpPdu); @@ -340,7 +343,7 @@ } } - _LOG_L1C1(_L8("<>CBcaIoController::ResumeSending")); + OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCAIOCONTROLLER_RESUMESENDING_1, ">>CBcaIoController::ResumeSending"); // allows for normal SendComplete behaviour if there is // a packet outstanding with BCA @@ -378,11 +381,11 @@ if ((resumeSending) || (!IsSendQueueEmpty())) { RMBufChain tmpPdu; - _LOG_L1C1(_L8(" Packet removed from queue to send")); + OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCAIOCONTROLLER_RESUMESENDING_2, " Packet removed from queue to send"); RemoveFromSendQueue(tmpPdu); // Update module state - _LOG_L2C1(_L8(" set State to ESending")); + OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCAIOCONTROLLER_RESUMESENDING_3, " set State to ESending"); iSendState = ESending; iSender->Send(tmpPdu); @@ -398,7 +401,7 @@ } } - _LOG_L1C1(_L8("<SetType(aType); } @@ -417,7 +420,7 @@ * Used to add the IP header to the packet before sending to the BCA. */ { - _LOG_L1C1(_L8("CBcaController::AddHeader")); + OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCAIOCONTROLLER_ADDHEADER_1, "CBcaController::AddHeader"); iIPTagHeader->AddHeader(aDes); } @@ -429,23 +432,21 @@ * @return The IP header that has been removed from the packet */ { - _LOG_L1C1(_L8("CBcaController::RemoveHeader")); + OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCAIOCONTROLLER_REMOVEHEADER_1, "CBcaController::RemoveHeader"); return (iIPTagHeader->RemoveHeader(aPdu)); } #endif // RAWIP_HEADER_APPENDED_TO_PACKETS -CBcaControl::CBcaControl(CBcaIoController& aObserver, CBttLogger* aTheLogger) +CBcaControl::CBcaControl(CBcaIoController& aObserver) /** * Constructor. Performs standard active object initialisation. * * @param aObserver Reference to the observer of this state machine - * @param aTheLogger The logging object */ : CActive(EPriorityStandard), iObserver(aObserver), - iTheLogger(aTheLogger), iMBca(NULL), iState(EIdling), iError(KErrNone) @@ -479,7 +480,7 @@ * */ { - _LOG_L1C1(_L8("CBcaControl::RunL() called")); + OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROL_RUNL_1, "CBcaControl::RunL() called"); switch (iState) { //in this state, Ioctl is called to set IAP ID, check the result of @@ -491,11 +492,11 @@ { if(iStatus == KErrNotSupported) { - _LOG_L1C1(_L8("This BCA does not support IAPID set")); + OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROL_RUNL_2, "This BCA does not support IAPID set"); } else { - _LOG_L2C1(_L8("This BCA supports IAPID set")); + OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROL_RUNL_3, "This BCA supports IAPID set"); } TPtrC bcaStack = iObserver.BcaStack(); @@ -515,7 +516,7 @@ } else { - _LOG_L1C2(_L8("ERROR in BCA IAPID set = %d"), iStatus.Int()); + OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROL_RUNL_4, "ERROR in BCA IAPID set = %d", iStatus.Int()); iObserver.Stop(iStatus.Int()); } @@ -530,11 +531,11 @@ { if(iStatus == KErrNotSupported) { - _LOG_L1C1(_L8("This BCA does not support BCA stacking")); + OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROL_RUNL_5, "This BCA does not support BCA stacking"); } else { - _LOG_L2C1(_L8("This BCA supports BCA stacking")); + OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROL_RUNL_6, "This BCA supports BCA stacking"); } iMBca->Open(iStatus, iObserver.Port()); iState = EBcaStackSet; @@ -542,7 +543,7 @@ } else { - _LOG_L2C2(_L8("ERROR in BCA stack set = %d"), iStatus.Int()); + OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROL_RUNL_7, "ERROR in BCA stack set = %d", iStatus.Int()); iObserver.Stop(iStatus.Int()); } break; @@ -554,7 +555,7 @@ { if(iStatus != KErrNone && iStatus != KErrAlreadyExists) { - _LOG_L2C2(_L8("ERROR in BCA Open = %d"), iStatus.Int()); + OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROL_RUNL_8, "ERROR in BCA Open = %d", iStatus.Int()); iObserver.Stop(iStatus.Int()); } else @@ -562,11 +563,11 @@ iState = EBcaOpened; //Activate the receiver Active Object iObserver.Receiver().StartListening(); - _LOG_L1C1(_L8("CBcaIoController Is Initialised")); + OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROL_RUNL_9, "CBcaIoController Is Initialised"); TRAPD(err, iObserver.GetObserver().InitialiseL(MRawIPObserverBase::EBcaController,KErrNone)); if(err != KErrNone) { - _LOG_L2C2(_L8("ERROR in BCA Open Initialise observer = %d"), err); + OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROL_RUNL_10, "ERROR in BCA Open Initialise observer = %d", err); iObserver.Stop(err); } } @@ -584,8 +585,9 @@ // Wrong state. default: { - _LOG_L1C1(_L8("ERROR CBcaControl::RunL(): Unknown state")); - _BTT_PANIC(KNifName, KBcaUnkownState); + OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROL_RUNL_11, "ERROR CBcaControl::RunL(): Unknown state"); + OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROL_RUNL_12, "PANIC: %S %d", KNifName, KBcaUnkownState); + User::Panic(KNifName, KBcaUnkownState); break; } } @@ -597,8 +599,8 @@ * cancel active request. */ { - _LOG_L1C1(_L8("CBcaControl::DoCancel called.")); - _LOG_L2C2(_L8("iState value is %d"), iState); + OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROL_DOCANCEL_1, "CBcaControl::DoCancel called."); + OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROL_DOCANCEL_2, "iState value is %d", iState); switch (iState) { case EIdling: @@ -614,8 +616,9 @@ iState = EIdling; break; default: - _LOG_L2C1(_L8("ERROR CBcaControl::DoCancel(): Unknown state")); - _BTT_PANIC(KNifName, KBcaUnkownState); + OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROL_DOCANCEL_3, "ERROR CBcaControl::DoCancel(): Unknown state"); + OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROL_DOCANCEL_4, "PANIC: %S %d", KNifName, KBcaUnkownState); + User::Panic(KNifName, KBcaUnkownState); break; } } @@ -625,7 +628,7 @@ * This method loads the C32BCA library and uses Ioctl to set the Bca iIapId. */ { - _LOG_L1C1(_L8("CBcaControl::StartLoad")); + OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROL_STARTLOADL_1, "CBcaControl::StartLoad"); //iMBca should not be initialized at this point __ASSERT_DEBUG(!iMBca,Panic(KBcaAlreadyExists)); @@ -647,7 +650,7 @@ TNewBcaFactoryL newBcaFactoryProcL = (TNewBcaFactoryL)iBcaDll.iObj.Lookup(1); if (NULL == newBcaFactoryProcL) { - _LOG_L1C2(_L8("Library entry point found error %d"), KErrBadLibraryEntryPoint); + OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROL_STARTLOADL_2, "Library entry point found error %d", KErrBadLibraryEntryPoint); User::Leave(KErrBadLibraryEntryPoint); } @@ -655,7 +658,7 @@ if(!bcaFactory) { - _LOG_L1C2(_L8("BcaFactory creation error %d"), KErrCompletion); + OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROL_STARTLOADL_3, "BcaFactory creation error %d", KErrCompletion); User::Leave(KErrCompletion); } CleanupReleasePushL(*bcaFactory); @@ -688,7 +691,7 @@ { if(aError == KErrConnectionTerminated ) { - _LOG_L1C1(_L8("This is an emergency shutdown, it kills the NIF immediately.")); + OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROL_SHUTDOWNBCA_1, "This is an emergency shutdown, it kills the NIF immediately."); // It is a emergency shutdown, it kills the NIF immediately. iMBca->Close(); iState = EIdling; @@ -696,7 +699,7 @@ } else { - _LOG_L1C1(_L8("This is a graceful termination which takes a while.")); + OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROL_SHUTDOWNBCA_2, "This is a graceful termination which takes a while."); //It is a graceful termination which takes a while. iError = aError; iState = EClosing; @@ -706,7 +709,7 @@ } else //nothing to shutdown, just notify linklayer down. { - _LOG_L1C1(_L8("Bca is not initialized or opened, bring the linklayer down")); + OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROL_SHUTDOWNBCA_3, "Bca is not initialized or opened, bring the linklayer down"); iState = EIdling; iObserver.GetObserver().ShutDown(MControllerObserver::EBcaController, aError); }