--- a/telephonyprotocols/rawipnif/rawipnif2/src/RawIP2Flow.cpp Tue Aug 31 16:23:08 2010 +0300
+++ b/telephonyprotocols/rawipnif/rawipnif2/src/RawIP2Flow.cpp Wed Sep 01 12:40:21 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of "Eclipse Public License v1.0"
@@ -21,12 +21,6 @@
@file
*/
-
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "RawIP2FlowTraces.h"
-#endif
-
#include <f32file.h>
#include <nifman.h>
#include <nifmbuf.h>
@@ -46,16 +40,23 @@
using namespace Messages;
using namespace MeshMachine;
+#ifdef __FLOG_ACTIVE
+//These variables are used only if flog is active.
+_LIT8(KTcpDumpFirstTag,"TcpDump");
+static const TUint16 KTcpDumpLinkType = 12;
+#endif
-CRawIP2Flow::CRawIP2Flow(ESock::CSubConnectionFlowFactoryBase& aFactory, const Messages::TNodeId& aSubConnId, ESock::CProtocolIntfBase* aProtocolIntf)
+CRawIP2Flow::CRawIP2Flow(ESock::CSubConnectionFlowFactoryBase& aFactory, const Messages::TNodeId& aSubConnId, ESock::CProtocolIntfBase* aProtocolIntf, CBttLogger* aTheLogger)
/**
* Constructor.
*
* @param aFactory Reference to the factory which created this object.
* @param aSubConnId Reference to the node id for sub connection.
* @param aProtocolIntf pointer to the CProtocolIntfBase
+ * @param aTheLogger The logging object, ownership is passed to this object
*/
: CSubConnectionFlowBase(aFactory, aSubConnId, aProtocolIntf),
+ iTheLogger(aTheLogger),
iInitError(KErrNone),
iStarted(EFalse),
iStopping(EFalse)
@@ -71,10 +72,10 @@
* @param aName The name of the NIF (unused)
*/
{
- OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CRAWIP2FLOW_CONSTRUCTL_1, "CRawIP2Flow %08x:\tConstructL()", this);
+ _LOG_L1C2(_L8("CRawIP2Flow %08x:\tConstructL()"), this);
iBinderControl = new (ELeave) TBinderControlProxy(*this);
- iBcaController = CBcaController::NewL(*this);
+ iBcaController = CBcaController::NewL(*this, iTheLogger);
}
CRawIP2Flow::~CRawIP2Flow()
@@ -84,11 +85,15 @@
{
// Note that we don't delete iBinder because it's not owned by us.
delete iBcaController;
+ // This class also deletes the logging object
+ delete iTheLogger;
ASSERT(iBinder == NULL);
delete iBinderControl;
LOG_NODE_DESTROY(KNifSubDir, CRawIP2Flow);
+ // Cleanup when stop was not called - harmless as it null's the pointer
+ __PACKETLOG_DELETE;
}
void CRawIP2Flow::StartFlowL()
@@ -102,7 +107,7 @@
{
ASSERT(iStarting==EFalse);
iStarting = ETrue;
- OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CRAWIP2FLOW_STARTFLOWL_1, "CRawIP2Flow %08x:\tStartFlowL()", this);
+ _LOG_L1C2(_L8("CRawIP2Flow %08x:\tStartFlowL()"), this);
// If there were any errors during earlier processing of the ProvisionConfig message
// then send an Error message in response to the StartFlow (because ProvisionConfig
@@ -119,7 +124,7 @@
// associate the binder object with the lowersender
iBinder->SetSender(&(iBcaController->Bca()->GetSender()));
//the name calculation should be done only if logging is enabled
-#if (OST_TRACE_CATEGORY & OST_TRACE_CATEGORY_DEBUG)
+#ifdef __FLOG_ACTIVE
const TUint KModemNameLen = KCommsDbSvrMaxColumnNameLength + 10; // need enough for ppp-XXX.txt - e.g. ppp-comm-1.txt, ppp-btcomm-10.txt etc
TBuf8<KModemNameLen> modemName;
@@ -140,7 +145,12 @@
TUint32 counter = User::FastCounter();
logFileName.Format(KTimeFormat, counter);
-
+ TRAPD(err,__PACKETLOG_NEWL(KTcpDumpFirstTag, logFileName, CPacketLogger::ETcpDump, KTcpDumpLinkType));
+ if (err)
+ {
+ _LOG_L1C1(_L8("Trapped leave from __PACKETLOG_NEWL"));
+ }
+
const TUint KLogTextLen = KModemNameLen+KTimeStampLen+30;
TBuf8<KLogTextLen> logText;
_LIT8(KLogTimeText, "TcpDump log file time stamp:");
@@ -149,7 +159,7 @@
logText.Append(logFileName);
logText.Append(KLogModemText);
logText.Append(modemName);
- OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CRAWIP2FLOW_STARTFLOWL_3, logText);
+ _LOG_L1C1(logText);
#endif
}
@@ -161,7 +171,7 @@
* ready to go.
*/
{
- OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CRAWIP2FLOW_LINKLAYERUP_1, "CRawIP2Flow %08x:\tLinkLayerUp()", this);
+ _LOG_L1C2(_L8("CRawIP2Flow %08x:\tLinkLayerUp()"), this);
iLastRequestOriginator.ReplyTo(Id(), ESock::TCFDataClient::TStarted().CRef());
@@ -178,8 +188,8 @@
* @param aError An error code to propagate to NifMan
*/
{
- OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CRAWIP2FLOW_LINKLAYERDOWN_1, "CRawIP2Flow %08x:\tLinkLayerDown(aError %d)", (TUint)this, aError);
-
+ _LOG_L1C3(_L8("CRawIP2Flow %08x:\tLinkLayerDown(aError %d)"), this, aError);
+ __PACKETLOG_DELETE;
if (iStopping)
{
@@ -209,7 +219,8 @@
* @param aAction The action to take: disconnect or reconnect
*/
{
- OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CRAWIP2FLOW_STOPFLOW_1, "CRawIP2Flow %08x:\tStopFlow(aError %d)",(TUint) this, aError);
+ _LOG_L1C3(_L8("CRawIP2Flow %08x:\tStopFlow(aError %d)"), this, aError);
+ __PACKETLOG_DELETE;
iStopping = ETrue;
ShutDown(aError);
}
@@ -226,7 +237,7 @@
* @param aError A possible error
*/
{
- OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CRAWIP2FLOW_INITIALISEL_1, "CRawIPFlow %08x:\tInitialiseL",this);
+ _LOG_L1C2(_L8("CRawIPFlow %08x:\tInitialiseL"),this);
// Update local state from TSY information originally from Agent.
GetBinder()->UpdateContextConfigL(*iAgentProvision->iGprsConfig);
@@ -247,7 +258,7 @@
* @param aError A possible error (only during initialisation)
*/
{
- OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CRAWIP2FLOW_SHUTDOWN_1, "CRawIPFlow %08x:\tShutDown(aError %d)",(TUint)this, aError);
+ _LOG_L1C3(_L8("CRawIPFlow %08x:\tShutDown(aError %d)"),this, aError);
if (aError != KErrNone)
{
@@ -290,7 +301,7 @@
* @param aError A possible error
*/
{
- OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CRAWIP2FLOW_UPDATECONTEXTSTATE_1, "CRawIP2Flow %08x:\tUpdateContextState(aState %d)", (TUint)this, aState);
+ _LOG_L1C3(_L8("CRawIP2Flow %08x:\tUpdateContextState(aState %d)"), this, aState);
// Note that we do not need to close the Flow down if there's been an
// error, as the context state machine will do this for us.
@@ -315,22 +326,25 @@
ESock::MLowerControl* CRawIP2Flow::GetControlL(const TDesC8& aProtocol)
{
-
- OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CRAWIP2FLOW_GETCONTROLL_1, "CRawIP2Flow %08x:\tGetControlL(aProtocol %s)", (TUint) this, aProtocol);
+#ifdef __BTT_LOGGING__
+ //TBuf8<256> debugBuffer;
+ //debugBuffer.Copy(aProtocol);
+ _LOG_L1C3(_L8("CRawIP2Flow %08x:\tGetControlL(aProtocol %S)"), this, &aProtocol);
+#endif
// IPv4 and ICMP Protocols
if (aProtocol.CompareF(KDescIp()) == 0 || aProtocol.CompareF(KDescIcmp()) == 0)
{
if (!iBinder)
{
- iBinder = new (ELeave) CIPv4Binder(*this);
+ iBinder = new (ELeave) CIPv4Binder(*this, iTheLogger);
#ifdef RAWIP_HEADER_APPENDED_TO_PACKETS
iBinder->SetType(KIp4FrameType);
#endif // RAWIP_HEADER_APPENDED_TO_PACKETS
}
else
{
- OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CRAWIP2FLOW_GETCONTROLL_2, "CRawIP2Flow %08x:\tGetControlL(): IPv4 binder already exists", this);
+ _LOG_L1C2(_L8("CRawIP2Flow %08x:\tGetControlL(): IPv4 binder already exists"), this);
}
}
// IPv6 Protocol
@@ -338,14 +352,14 @@
{
if (!iBinder)
{
- iBinder = new (ELeave) CIPv6Binder(*this);
+ iBinder = new (ELeave) CIPv6Binder(*this, iTheLogger);
#ifdef RAWIP_HEADER_APPENDED_TO_PACKETS
iBinder->SetType(KIp6FrameType);
#endif // RAWIP_HEADER_APPENDED_TO_PACKETS
}
else
{
- OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CRAWIP2FLOW_GETCONTROLL_3, "CRawIP2Flow %08x:\tGetControlL(): IPv6 binder already exists", this);
+ _LOG_L1C2(_L8("CRawIP2Flow %08x:\tGetControlL(): IPv6 binder already exists"), this);
}
}
else
@@ -378,7 +392,7 @@
void CRawIP2Flow::Unbind(ESock::MUpperDataReceiver* aUpperReceiver, ESock::MUpperControl* aUpperControl)
{
- OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CRAWIP2FLOW_UNBIND_1, "CRawIP2Flow %08x:\tUnbind()", this);
+ _LOG_L1C2(_L8("CRawIP2Flow %08x:\tUnbind()"), this);
ASSERT(iBinder);
iBinder->Unbind(aUpperReceiver, aUpperControl);
@@ -491,6 +505,7 @@
//doesn't notice anything. It does that by swapping the
//flows below the binders.
CBinderBase* localBinder = iBinder;
+ CBttLogger* logger = localBinder->iTheLogger;
TBinderControlProxy* localBinderControl = iBinderControl;
iBinder = otherFlow->iBinder;
@@ -502,6 +517,7 @@
otherFlow->iBinderControl->iFlow = otherFlow;
iBinderControl->iFlow = this;
+ iBinder->iTheLogger = logger;
iSubConnectionProvider.Close();
iSubConnectionProvider.Open(address_cast<TNodeId>(rejoinMsg.iNodeId));
@@ -561,7 +577,7 @@
@param aData provisioning pointer from message
*/
{
- OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CRAWIP2FLOW_PROVISIONCONFIG_1, "CRawIP2Flow %08x:\tProvisionConfig()", this);
+ _LOG_L1C2(_L8("CRawIP2Flow %08x:\tProvisionConfig()"), this);
iProvisionError = KErrNone;
AccessPointConfig().Close();
@@ -572,7 +588,7 @@
if (iBCAProvisionConfig == NULL)
{
- OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CRAWIP2FLOW_PROVISIONCONFIG_2, "CRawIP2Flow:\tProvisionConfigL() - CBCAProvision config incomplete");
+ _LOG_L1C1(_L8("CRawIP2Flow:\tProvisionConfigL() - CBCAProvision config incomplete"));
iProvisionError = KErrCorrupt;
return;
}
@@ -594,7 +610,7 @@
const CIPConfig* wcdmaIpProvision = static_cast<const CIPConfig*>(AccessPointConfig().FindExtension(STypeId::CreateSTypeId(CIPConfig::EUid, CIPConfig::ETypeId)));
if (wcdmaIpProvision == NULL)
{
- OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CRAWIP2FLOW_DYNAMICPROVISIONCONFIGL_1, "CRawIP2Flow %08x:\tDynamicProvisionConfigL() - WCDMA config incomplete", this);
+ _LOG_L1C2(_L8("CRawIP2Flow %08x:\tDynamicProvisionConfigL() - WCDMA config incomplete"), this);
iProvisionError = KErrCorrupt;
return;
}