telephonyprotocols/rawipnif/src/IPv4Binder.cpp
changeset 23 6b1d113cdff3
parent 0 3553901f7fa8
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".
    23 #include <etelpckt.h>
    23 #include <etelpckt.h>
    24 #include <in_iface.h>
    24 #include <in_iface.h>
    25 #include "RawIPFlow.h"
    25 #include "RawIPFlow.h"
    26 #include "IPv4Binder.h"
    26 #include "IPv4Binder.h"
    27 #include <comms-infras/linkprovision.h>
    27 #include <comms-infras/linkprovision.h>
       
    28 #include <u32hal.h>
    28 
    29 
    29 using namespace ESock;
    30 using namespace ESock;
    30 #ifdef WCDMA_STUB
    31 #ifdef WCDMA_STUB
    31 #include <networking/umtsnifcontrolif.h>
    32 #include <networking/umtsnifcontrolif.h>
    32 #endif
    33 #endif
    33 
    34 
    34 #define LOG_IP_ADDRESS(desc,addr) _LOG_L1C5(_L8("    " desc " = %d.%d.%d.%d"), \
    35 #define LOG_IP_ADDRESS(desc,addr) _LOG_L1C5(_L8("    " desc " = %d.%d.%d.%d"), \
    35 			addr >> 24, (addr >> 16) & 0xFF, (addr >> 8) & 0xFF, addr & 0xFF);
    36 			addr >> 24, (addr >> 16) & 0xFF, (addr >> 8) & 0xFF, addr & 0xFF);
       
    37 
       
    38 #ifdef __EABI__
       
    39 // Patch data is used and KMtuIPv4 and KRMtuIPv4 can be modified to a different value in RawIpNif.iby file
       
    40 extern const TInt KMtuIPv4 = KDefaultMtu;
       
    41 extern const TInt KRMtuIPv4 = KDefaultMtu;
       
    42 #endif
    36 
    43 
    37 CIPv4Binder::CIPv4Binder(CRawIPFlow& aFlow, CBttLogger* aTheLogger)
    44 CIPv4Binder::CIPv4Binder(CRawIPFlow& aFlow, CBttLogger* aTheLogger)
    38 /**
    45 /**
    39  * Constructor
    46  * Constructor
    40  */ 
    47  */ 
   162    		}
   169    		}
   163 	
   170 	
   164 	config->iFamily = KAfInet;		/* KAfInet - selects TBinderConfig4 */
   171 	config->iFamily = KAfInet;		/* KAfInet - selects TBinderConfig4 */
   165 	
   172 	
   166 	config->iInfo.iFeatures = KIfCanBroadcast | KIfCanMulticast;		/* Feature flags */
   173 	config->iInfo.iFeatures = KIfCanBroadcast | KIfCanMulticast;		/* Feature flags */
   167 	config->iInfo.iMtu = KDefaultMtu;				/* Maximum transmission unit. */
   174 	
   168 	config->iInfo.iRMtu = KDefaultMtu;				/* Maximum transmission unit for receiving. */
   175 	
       
   176 #if defined __EABI__
       
   177     // Default value for Tx and Rx packet size
       
   178     config->iInfo.iMtu = KMtuIPv4;
       
   179     config->iInfo.iRMtu = KRMtuIPv4;
       
   180 #else // WINS
       
   181     // Set default values in case patch is not present in epoc.ini
       
   182     config->iInfo.iMtu = KDefaultMtu;
       
   183     config->iInfo.iRMtu = KDefaultMtu;
       
   184            
       
   185     // for the emulator process is patched via the epoc.ini file
       
   186     UserSvr::HalFunction(EHalGroupEmulator,EEmulatorHalIntProperty,(TAny*)"rawip_KMtuIPv4",&(config->iInfo.iMtu));
       
   187     UserSvr::HalFunction(EHalGroupEmulator,EEmulatorHalIntProperty,(TAny*)"rawip_KRMtuIPv4",&(config->iInfo.iRMtu));
       
   188 #endif
       
   189 	
   169 	config->iInfo.iSpeedMetric = iSpeedMetric;		/* approximation of the interface speed in Kbps. */
   190 	config->iInfo.iSpeedMetric = iSpeedMetric;		/* approximation of the interface speed in Kbps. */
   170 
   191 
   171     LOG_IP_ADDRESS("Local IP address from TBinderConfig", iSettings.iLocalAddr);
   192     LOG_IP_ADDRESS("Local IP address from TBinderConfig", iSettings.iLocalAddr);
   172 	
   193 	
   173 	config->iAddress.SetAddress(iSettings.iLocalAddr);		/* Interface IP address. */
   194 	config->iAddress.SetAddress(iSettings.iLocalAddr);		/* Interface IP address. */
   353 MLowerDataSender::TSendResult CIPv4Binder::Send(RMBufChain& aPdu)
   374 MLowerDataSender::TSendResult CIPv4Binder::Send(RMBufChain& aPdu)
   354 /**
   375 /**
   355  * Called by the protocol to send an outgoing IP packet to the network.
   376  * Called by the protocol to send an outgoing IP packet to the network.
   356  *
   377  *
   357  * @param aPdu The outgoing packet
   378  * @param aPdu The outgoing packet
   358  * @return Standard error codes
   379  * @return MLowerDataSender::ESendBlocked or ESendAccepted based on state of flow.
   359  */
   380  */
   360 	{
   381 	{
   361 	_LOG_L1C1(_L8("CIPv4Binder::Send"));
   382 	_LOG_L1C1(_L8("CIPv4Binder::Send"));
   362 
   383 
   363 #ifdef __BTT_LOGGING__
   384 #ifdef __BTT_LOGGING__
   364 	LogPacket(aPdu);
   385 	LogPacket(aPdu);
   365 #endif
   386 #endif
   366 
   387 
   367 	// Return <0: an error occurred
   388 	// Return ESendBlocked: flow cannot accept any more packets [blocked, queue full, etc]
   368 	// Return  0: no error, but don't send any more packets
   389 	// Return ESendAccepted: flow has accepted this packet and can accept another.
   369 
   390 
   370 	return static_cast<MLowerDataSender::TSendResult>(GetFlow().SendPacket(aPdu, NULL, KIp4FrameType));
   391 	return GetFlow().SendPacket(aPdu, NULL, KIp4FrameType);
   371 	}
   392 	}
   372 
   393 
   373 TInt CIPv4Binder::Notification(TAgentToNifEventType /*aEvent*/, 
   394 TInt CIPv4Binder::Notification(TAgentToNifEventType /*aEvent*/, 
   374 	void* /*aInfo*/)
   395 	void* /*aInfo*/)
   375 /**
   396 /**