telephonyprotocols/rawipnif/src/IPv6Binder.cpp
changeset 23 6b1d113cdff3
parent 19 1f776524b15c
child 24 6638e7f4bd8f
child 42 3adadc800673
equal deleted inserted replaced
20:244d7c5f118e 23:6b1d113cdff3
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    24 #include <in_iface.h>
    24 #include <in_iface.h>
    25 #include "RawIPFlow.h"
    25 #include "RawIPFlow.h"
    26 #include "IPv6Binder.h"
    26 #include "IPv6Binder.h"
    27 #include <comms-infras/linkprovision.h>
    27 #include <comms-infras/linkprovision.h>
    28 #include <e32hal.h>
    28 #include <e32hal.h>
    29 
    29 #include <u32hal.h>
    30 
    30 
    31 using namespace ESock;
    31 using namespace ESock;
    32 #ifdef WCDMA_STUB
    32 #ifdef WCDMA_STUB
    33 #include <networking/umtsnifcontrolif.h>
    33 #include <networking/umtsnifcontrolif.h>
    34 #endif
    34 #endif
    35 
    35 
    36 #define LOG_IP_ADDRESS(desc,addr) _LOG_L2C5(_L8("    " desc " = %d:%d:%d:%d from context"), \
    36 #define LOG_IP_ADDRESS(desc,addr) _LOG_L2C5(_L8("    " desc " = %d:%d:%d:%d from context"), \
    37 			addr.u.iAddr32[3], addr.u.iAddr32[2], addr.u.iAddr32[1], addr.u.iAddr32[0]);
    37 			addr.u.iAddr32[3], addr.u.iAddr32[2], addr.u.iAddr32[1], addr.u.iAddr32[0]);
       
    38 
       
    39 #ifdef __EABI__
       
    40 // Patch data is used and KMtuIPv6 and KRMtuIPv6 can be modified to a different value in RawIpNif.iby file
       
    41 extern const TInt KMtuIPv6 = KDefaultMtu;
       
    42 extern const TInt KRMtuIPv6 = KDefaultMtu;
       
    43 #endif
    38 
    44 
    39 CIPv6Binder::CIPv6Binder(CRawIPFlow& aFlow, CBttLogger* aTheLogger)
    45 CIPv6Binder::CIPv6Binder(CRawIPFlow& aFlow, CBttLogger* aTheLogger)
    40 /**
    46 /**
    41  * Constructor
    47  * Constructor
    42  */ 
    48  */ 
   162    		}
   168    		}
   163 	
   169 	
   164 	config->iFamily = KAfInet6;		/* KAfInet6 - selects TBinderConfig6 */
   170 	config->iFamily = KAfInet6;		/* KAfInet6 - selects TBinderConfig6 */
   165 
   171 
   166 	config->iInfo.iFeatures = KIfCanBroadcast | KIfCanMulticast;		/* Feature flags */
   172 	config->iInfo.iFeatures = KIfCanBroadcast | KIfCanMulticast;		/* Feature flags */
   167 	config->iInfo.iMtu = KDefaultMtu;				/* Maximum transmission unit. */
   173 	
   168 	config->iInfo.iRMtu = KDefaultMtu;				/* Maximum transmission unit for receiving. */
   174 #if defined __EABI__
       
   175     // Default value for Tx and Rx packet size
       
   176     config->iInfo.iMtu = KMtuIPv6;
       
   177     config->iInfo.iRMtu = KRMtuIPv6;
       
   178 #else // WINS
       
   179     // Set default values in case patch is not present in epoc.ini
       
   180     config->iInfo.iMtu = KDefaultMtu;
       
   181     config->iInfo.iRMtu = KDefaultMtu;
       
   182            
       
   183     // for the emulator process is patched via the epoc.ini file
       
   184     UserSvr::HalFunction(EHalGroupEmulator,EEmulatorHalIntProperty,(TAny*)"rawip_KMtuIPv6",&(config->iInfo.iMtu));
       
   185     UserSvr::HalFunction(EHalGroupEmulator,EEmulatorHalIntProperty,(TAny*)"rawip_KRMtuIPv6",&(config->iInfo.iRMtu));
       
   186 #endif
       
   187     
   169 	config->iInfo.iSpeedMetric = iSpeedMetric;		/* approximation of the interface speed in Kbps. */
   188 	config->iInfo.iSpeedMetric = iSpeedMetric;		/* approximation of the interface speed in Kbps. */
   170 	
   189 	
   171 	TEui64Addr& localId = TEui64Addr::Cast(config->iLocalId);
   190 	TEui64Addr& localId = TEui64Addr::Cast(config->iLocalId);
   172 	localId = iSettings.iLocalIfId;
   191 	localId = iSettings.iLocalIfId;
   173 	config->iNameSer1.SetAddress(iSettings.iPrimaryDns);		/* IP primary name server (if any). */
   192 	config->iNameSer1.SetAddress(iSettings.iPrimaryDns);		/* IP primary name server (if any). */
   327 MLowerDataSender::TSendResult CIPv6Binder::Send(RMBufChain& aPdu)
   346 MLowerDataSender::TSendResult CIPv6Binder::Send(RMBufChain& aPdu)
   328 /**
   347 /**
   329  * Called by the protocol to send an outgoing IP packet to the network.
   348  * Called by the protocol to send an outgoing IP packet to the network.
   330  *
   349  *
   331  * @param aPdu The outgoing packet
   350  * @param aPdu The outgoing packet
   332  * @return Standard error codes
   351  * @return MLowerDataSender::ESendBlocked or ESendAccepted based on state of flow.
   333  */
   352  */
   334 	{
   353 	{
   335 	_LOG_L1C1(_L8("CIPv6Binder::Send"));
   354 	_LOG_L1C1(_L8("CIPv6Binder::Send"));
   336 
   355 
   337 #ifdef __BTT_LOGGING__
   356 #ifdef __BTT_LOGGING__
   338 	LogPacket(aPdu);
   357 	LogPacket(aPdu);
   339 #endif
   358 #endif
   340 
   359 
   341 	// Return <0: an error occurred
   360     // Return ESendBlocked: flow cannot accept any more packets [blocked, queue full, etc]
   342 	// Return  0: no error, but don't send any more packets
   361     // Return ESendAccepted: flow has accepted this packet and can accept another.
   343 
   362 	
   344 	return static_cast<MLowerDataSender::TSendResult>(GetFlow().SendPacket(aPdu, NULL, KIp4FrameType));
   363 	return GetFlow().SendPacket(aPdu, NULL, KIp4FrameType);
   345 	}
   364 	}
   346 
   365 
   347 TInt CIPv6Binder::Notification(TAgentToNifEventType /*aEvent*/, 
   366 TInt CIPv6Binder::Notification(TAgentToNifEventType /*aEvent*/, 
   348 	void* /*aInfo*/)
   367 	void* /*aInfo*/)
   349 /**
   368 /**