telephonyprotocols/rawipnif/src/IPv6Binder.cpp
branchRCL_3
changeset 19 630d2f34d719
parent 9 2492a6e4aed7
child 20 07a122eea281
--- a/telephonyprotocols/rawipnif/src/IPv6Binder.cpp	Thu Aug 19 11:03:36 2010 +0300
+++ b/telephonyprotocols/rawipnif/src/IPv6Binder.cpp	Tue Aug 31 16:23:08 2010 +0300
@@ -20,6 +20,12 @@
  @file
 */
 
+
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "IPv6BinderTraces.h"
+#endif
+
 #include <etelpckt.h>
 #include <in_iface.h>
 #include "RawIPFlow.h"
@@ -33,8 +39,6 @@
 #include <networking/umtsnifcontrolif.h>
 #endif
 
-#define LOG_IP_ADDRESS(desc,addr) _LOG_L2C5(_L8("    " desc " = %d:%d:%d:%d from context"), \
-			addr.u.iAddr32[3], addr.u.iAddr32[2], addr.u.iAddr32[1], addr.u.iAddr32[0]);
 
 #ifdef __EABI__
 // Patch data is used and KMtuIPv6 and KRMtuIPv6 can be modified to a different value in RawIpNif.iby file
@@ -42,12 +46,11 @@
 extern const TInt KRMtuIPv6 = KDefaultMtu;
 #endif
 
-CIPv6Binder::CIPv6Binder(CRawIPFlow& aFlow, CBttLogger* aTheLogger)
+CIPv6Binder::CIPv6Binder(CRawIPFlow& aFlow)
 /**
  * Constructor
  */ 
-	: CBinderBase(aFlow,aTheLogger),
-	  iTheLogger(aTheLogger),
+	: CBinderBase(aFlow),
 	  iSpeedMetric(KDefaultSpeedMetric)
 	{
 	}
@@ -83,8 +86,7 @@
  * @return Standard error codes
  */
 	{
-	_LOG_L1C3(_L8("CIPv6Binder::Control [aLevel=%d, aName=%d]"),
-		aLevel, aName);
+	OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPV6BINDER_CONTROL_1, "CIPv6Binder::Control [aLevel=%u, aName=%u]",aLevel, aName);
 
 	if (aLevel == KSOLInterface)
 		{
@@ -205,7 +207,7 @@
  * @return KErrArgument if an incorrect structure is passed, otherwise KErrNone
  */
 	{
-	_LOG_L1C1(_L8("CIPv6Binder::DeleteContext"));
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPV6BINDER_DELETECONTEXT_1, "CIPv6Binder::DeleteContext");
 
 	if (aContextParameters.Length() != sizeof(TContextParameters))
 		{
@@ -239,7 +241,7 @@
  */
  void CIPv6Binder::UpdateContextConfigL(const TPacketDataConfigBase& aConfig)
 	{
-	_LOG_L1C1(_L8("CIPv6Binder::UpdateContextConfig"));
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPV6BINDER_UPDATECONTEXTCONFIGL_1, "CIPv6Binder::UpdateContextConfig");
 
 	// Get our IP address from the GPRS context config.
 	TInetAddr address;
@@ -268,12 +270,11 @@
 		
 		iSettings.iLocalIfId.SetAddr(addrTable, 8);		
 		
-		LOG_IP_ADDRESS("Got local IP address", address.Ip6Address());
+		OstTraceDefExt4(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPV6BINDER_UPDATECONTEXTCONFIGL_2, "Got local IP address = %u:%u:%u:%u from context", address.Ip6Address().u.iAddr32[3], address.Ip6Address().u.iAddr32[2], address.Ip6Address().u.iAddr32[1], address.Ip6Address().u.iAddr32[0]);
 		}
 	else
 		{
-		_LOG_L2C2(_L8("Couldn't get IP address from GPRS config (err: %d)"),
-			ret);
+		OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPV6BINDER_UPDATECONTEXTCONFIGL_3, "Couldn't get IP address from GPRS config (err: %d)",ret);
 
 		// Don't leave on this error: we may still be OK if we read some
 		// settings from CommDB.
@@ -295,12 +296,11 @@
 		if (ret == KErrNone)
 			{
 			iSettings.iPrimaryDns = address.Ip6Address();
-			LOG_IP_ADDRESS("Got primary DNS", iSettings.iPrimaryDns);
+			OstTraceDefExt4(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPV6BINDER_UPDATECONTEXTCONFIGL_4, "Got primary DNS = %u:%u:%u:%u from context", iSettings.iPrimaryDns.u.iAddr32[3], iSettings.iPrimaryDns.u.iAddr32[2], iSettings.iPrimaryDns.u.iAddr32[1], iSettings.iPrimaryDns.u.iAddr32[0]);
 			}
 		else
 			{
-			_LOG_L2C2(_L8("Couldn't get primary DNS address from GPRS config (err: %d)"),
-				ret);
+			OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPV6BINDER_UPDATECONTEXTCONFIGL_5, "Couldn't get primary DNS address from GPRS config (err: %d)",ret);
 
 			// Don't leave on this error: we may still be OK if we read some
 			// settings from CommDB.
@@ -312,12 +312,11 @@
 		if (ret == KErrNone)
 			{
 			iSettings.iSecondaryDns = address.Ip6Address();
-			LOG_IP_ADDRESS("Got secondary DNS", iSettings.iPrimaryDns);
+			OstTraceDefExt4(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPV6BINDER_UPDATECONTEXTCONFIGL_6, "Got secondary DNS = %u:%u:%u:%u from context", iSettings.iSecondaryDns.u.iAddr32[3], iSettings.iSecondaryDns.u.iAddr32[2], iSettings.iSecondaryDns.u.iAddr32[1], iSettings.iSecondaryDns.u.iAddr32[0]);
 			}
 		else
 			{
-			_LOG_L2C2(_L8("Couldn't get secondary DNS address from GPRS config (err: %d)"),
-				ret);
+			OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPV6BINDER_UPDATECONTEXTCONFIGL_7, "Couldn't get secondary DNS address from GPRS config (err: %d)",ret);
 
 			// Don't leave on this error: we may still be OK if we read some
 			// settings from CommDB.
@@ -325,8 +324,8 @@
 		}
 	else
 		{
-		LOG_IP_ADDRESS("Using CommDB DNS address - Primary ", iSettings.iPrimaryDns);
-		LOG_IP_ADDRESS("                         - Secondary ", iSettings.iSecondaryDns);
+        OstTraceDefExt4(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPV6BINDER_UPDATECONTEXTCONFIGL_8, "Using CommDB DNS address - Primary  = %u:%u:%u:%u", iSettings.iPrimaryDns.u.iAddr32[3], iSettings.iPrimaryDns.u.iAddr32[2], iSettings.iPrimaryDns.u.iAddr32[1], iSettings.iPrimaryDns.u.iAddr32[0]);
+        OstTraceDefExt4(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPV6BINDER_UPDATECONTEXTCONFIGL_9, "                         - Secondary = %u:%u:%u:%u", iSettings.iSecondaryDns.u.iAddr32[3], iSettings.iSecondaryDns.u.iAddr32[2], iSettings.iSecondaryDns.u.iAddr32[1], iSettings.iSecondaryDns.u.iAddr32[0]);
 		}
 	}
 
@@ -337,7 +336,7 @@
  * @param aConnectionSpeed Our connection speed
  */
 	{
-	_LOG_L1C1(_L8("CIPv6Binder::UpdateConnectionSpeed"));
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPV6BINDER_UPDATECONNECTIONSPEED_1, "CIPv6Binder::UpdateConnectionSpeed");
 
 	iSpeedMetric = aConnectionSpeed;
 	}
@@ -351,7 +350,7 @@
  * @return MLowerDataSender::ESendBlocked or ESendAccepted based on state of flow.
  */
 	{
-	_LOG_L1C1(_L8("CIPv6Binder::Send"));
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPV6BINDER_SEND_1, "CIPv6Binder::Send");
 
 #ifdef __BTT_LOGGING__
 	LogPacket(aPdu);
@@ -372,7 +371,7 @@
  * @param aInfo Not used 
  */
 	{
-	_LOG_L1C1(_L8("CIPv6Binder::Notification"));
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPV6BINDER_NOTIFICATION_1, "CIPv6Binder::Notification");
 
 	return KErrNone;
 	}
@@ -384,7 +383,7 @@
  * @param aProtocol A pointer to a protocol
  */
 	{
-	_LOG_L1C1(_L8("CIPv6Binder::StartSending()"));
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPV6BINDER_STARTSENDING_1, "CIPv6Binder::StartSending()");
 
 	CBinderBase::StartSending();
 	}
@@ -396,8 +395,7 @@
  * @param aProtocolCode The protocol type
  */
 	{
-	_LOG_L1C2(_L8("CIPv6Binder::WantsProtocol [aProtocolCode=%X]"),
-		aProtocolCode);
+	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPV6BINDER_WANTSPROTOCOL_1, "CIPv6Binder::WantsProtocol [aProtocolCode=%X]",aProtocolCode);
 
 #ifdef RAWIP_HEADER_APPENDED_TO_PACKETS
 	return ((aProtocolCode & 0x00FF) == KIp6FrameType);
@@ -415,7 +413,7 @@
  * @param aPdu The incoming packet
  */
 	{
-	_LOG_L1C1(_L8("CIPv6Binder::Process"));
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPV6BINDER_PROCESS_1, "CIPv6Binder::Process");
 
 #ifdef __BTT_LOGGING__
 	LogPacket(aPdu);
@@ -425,12 +423,12 @@
 	// been bound yet.
 	if (iUpperReceiver)						// ASSERT(iUpperReceiver) ?
 		{
-		_LOG_L1C1(_L8("CIPv6Binder: Packet Sent to TCP/IP Protocol!!!"));
+		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPV6BINDER_PROCESS_2, "CIPv6Binder: Packet Sent to TCP/IP Protocol!!!");
 		iUpperReceiver->Process(aPdu);
 		}
 	else 
 		{
-		_LOG_L2C1(_L8("WARNING: dumping incoming packet, no protocol bound"));
+		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPV6BINDER_PROCESS_3, "WARNING: dumping incoming packet, no protocol bound");
 		aPdu.Free();
 		}
 	}
@@ -508,19 +506,18 @@
 * @param aPacket The packet 
 */
 	{
-	_LOG_L1C1(_L8("CIPv6Binder::LogPacket"));
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPV6BINDER_LOGPACKET_1, "CIPv6Binder::LogPacket");
 
 	TInt mBufLength = aPacket.Length() - aPacket.First()->Length();
 
-	_LOG_L3C2(_L8("Analysis of %d byte packet:"), mBufLength);
+	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPV6BINDER_LOGPACKET_2, "Analysis of %d byte packet:", mBufLength);
 
 	//Note: All the constants used on this method are a pragmatic guess of the
 	//IP header fields. The only porpose of this method is logging.
 
 	if (mBufLength < 40)
 		{
-		_LOG_L3C2(_L8(" -doesn't appear to be a valid IPv6 packet (length=%d)")
-			, mBufLength);
+		OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPV6BINDER_LOGPACKET_3, " -doesn't appear to be a valid IPv6 packet (length=%d)", mBufLength);
 		return;
 		}
 
@@ -529,18 +526,14 @@
 
 	if ((payloadPtr[0] & 0xF0) != 0x60)
 		{
-		_LOG_L3C2(_L8(" - doesn't appear to be an IPv6 packet (version=0x%X)"),
-			(payloadPtr[0] & 0xF0) >> 4);
+		OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPV6BINDER_LOGPACKET_4, " - doesn't appear to be an IPv6 packet (version=0x%X)",(payloadPtr[0] & 0xF0) >> 4);
 		return;
 		}
 
-	_LOG_L3C2(_L8(" - traffic class: 0x%X"), 
-					((payloadPtr[0] & 0xF) << 4) | ((payloadPtr[1] & 0xF0) >> 4));
-	_LOG_L3C2(_L8(" - flow label: 0x%X"), 
-					((payloadPtr[1] & 0x0F) << 16) | (payloadPtr[2] << 8) | payloadPtr[3]);
-	_LOG_L3C2(_L8(" - payload length: 0x%X"), 
-					(payloadPtr[4] << 16) | payloadPtr[5]);
-	_LOG_L3C2(_L8(" - next header: 0x%08X"), payloadPtr[6]);
-	_LOG_L3C2(_L8(" - hop limit: 0x%08X"), payloadPtr[7]);
+	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPV6BINDER_LOGPACKET_5, " - traffic class: 0x%X", ((payloadPtr[0] & 0xF) << 4) | ((payloadPtr[1] & 0xF0) >> 4));
+	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPV6BINDER_LOGPACKET_6, " - flow label: 0x%X", ((payloadPtr[1] & 0x0F) << 16) | (payloadPtr[2] << 8) | payloadPtr[3]);
+	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPV6BINDER_LOGPACKET_7, " - payload length: 0x%X", (payloadPtr[4] << 16) | payloadPtr[5]);
+	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPV6BINDER_LOGPACKET_8, " - next header: 0x%08X", payloadPtr[6]);
+	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPV6BINDER_LOGPACKET_9, " - hop limit: 0x%08X", payloadPtr[7]);
 	}
 #endif // __BTT_LOGGING__