--- a/telephonyprotocols/rawipnif/src/BcaIoController.cpp Thu Aug 19 11:03:36 2010 +0300
+++ b/telephonyprotocols/rawipnif/src/BcaIoController.cpp Tue Aug 31 16:23:08 2010 +0300
@@ -19,6 +19,12 @@
@file BcaIoController.cpp
*/
+
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "BcaIoControllerTraces.h"
+#endif
+
#include <e32uid.h>
#include <nifmbuf.h>
#include <e32svr.h>
@@ -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, "<<CBcaIoController::Send");
// Check if flow is shutting down
if (iSendState == EShuttingDown)
{
- _LOG_L2C1(_L8(" ERROR: Nif is shutting down"));
+ OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCAIOCONTROLLER_SEND_2, " ERROR: Nif is shutting down");
// when the flow is destroyed the memory for this packet will be
// cleaned up - just tell the layers above to stop sending.
@@ -200,8 +203,8 @@
// add it to our queue
if ((aPdu.Length() - aPdu.First()->Length()) > iMaxTxPacketSize)
{
- _LOG_L2C1(_L8("Packet is too large - discarding"));
- _LOG_L1C1(_L8("<<CSender::Send -> 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, "<<CSender::Send -> 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("<<CBcaIoController::Send - return ContinueSending"));
+ OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCAIOCONTROLLER_SEND_5, "<<CBcaIoController::Send - return ContinueSending");
return ESock::MLowerDataSender::ESendAccepted;
}
@@ -222,7 +225,7 @@
// Transmit is off for this flow - we must have received a block
// message from our control. append this message to the queue
// and tell the layer above it to kindly stop sending.
- _LOG_L1C1(_L8(" Sender blocked, appending packet to queue"));
+ OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCAIOCONTROLLER_SEND_6, " Sender blocked, appending packet to queue");
AppendToSendQueue(aPdu);
@@ -232,12 +235,12 @@
if (IsSendQueueFull())
{
- _LOG_L2C1(_L8("<<CBcaIoController::Send - return StopSending"));
+ OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCAIOCONTROLLER_SEND_7, "<<CBcaIoController::Send - return StopSending");
return ESock::MLowerDataSender::ESendBlocked;
}
else
{
- _LOG_L2C1(_L8("<<CBcaIoController::Send - return ContinueSending"));
+ OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCAIOCONTROLLER_SEND_8, "<<CBcaIoController::Send - return ContinueSending");
return ESock::MLowerDataSender::ESendAccepted;
}
}
@@ -249,12 +252,12 @@
// If this happens, it means that TCP/IP has sent us an IP packet
// while we're still sending the previous one.
{
- _LOG_L1C1(_L8(" Sender busy, appending packet to queue"));
+ OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCAIOCONTROLLER_SEND_9, " Sender busy, appending packet to queue");
AppendToSendQueue(aPdu);
if (IsSendQueueFull())
{
- _LOG_L2C1(_L8("<<CBcaIoController::Send - return StopSending"));
+ OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCAIOCONTROLLER_SEND_10, "<<CBcaIoController::Send - return StopSending");
return ESock::MLowerDataSender::ESendBlocked;
}
}
@@ -265,7 +268,7 @@
// packets that might have been queued onto the send queue.
// Update module state
- _LOG_L2C1(_L8(" set State to ESending"));
+ OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCAIOCONTROLLER_SEND_11, " set State to ESending");
iSendState = ESending;
iSender->Send(aPdu);
@@ -275,7 +278,7 @@
// otherwise, block this flow until we have room for the next
// packet
- _LOG_L2C1(_L8("<<CBcaIoController::Send - return ContinueSending"));
+ OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCAIOCONTROLLER_SEND_12, "<<CBcaIoController::Send - return ContinueSending");
return ESock::MLowerDataSender::ESendAccepted;
}
@@ -286,12 +289,12 @@
* to process more packets.
*/
{
- _LOG_L1C1(_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::SendComplete"));
+ OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCAIOCONTROLLER_SENDCOMPLETE_4, "<<CBcaIoController::SendComplete");
}
@@ -349,7 +352,7 @@
* Flow is being unblocked this will resume sending.
*/
{
- _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("<<CBcaIoController::ResumeSending"));
+ OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCAIOCONTROLLER_RESUMESENDING_4, "<<CBcaIoController::ResumeSending");
}
#ifdef RAWIP_HEADER_APPENDED_TO_PACKETS
@@ -407,7 +410,7 @@
/**
* Used to specify the type of the IP header.
*/
- _LOG_L1C1(_L8("CBcaController::SetType"));
+ OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCAIOCONTROLLER_SETTYPE_1, "CBcaController::SetType");
iIPTagHeader->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);
}