telephonyprotocols/rawipnif/version1/inc/IPv4ProtocolIf.h
changeset 68 d0d9cc530d21
parent 62 8ef833fbf5aa
child 75 f45cd1ad4667
equal deleted inserted replaced
62:8ef833fbf5aa 68:d0d9cc530d21
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // This file defines the CIPv4ProtocolIf class, which handles the transmission
       
    15 // of IPv4 data to and from the TCP/IP stack.
       
    16 // 
       
    17 //
       
    18 
       
    19 /**
       
    20  @file
       
    21 */
       
    22 
       
    23 #ifndef IPV4PROTOCOLIF_H__
       
    24 #define IPV4PROTOCOLIF_H__
       
    25 
       
    26 #include "ProtocolIfBase.h"
       
    27 
       
    28 class CBttLogger;
       
    29 
       
    30 class CIPv4ProtocolIf : public CProtocolIfBase
       
    31 {
       
    32 public:
       
    33 	CIPv4ProtocolIf(CRawIPNifMain& aNifMain, CBttLogger* aTheLogger);
       
    34 	~CIPv4ProtocolIf();
       
    35 
       
    36 public:	//NifIfBase support.
       
    37 	virtual void BindL(TAny *aId);
       
    38 	virtual TInt Control(TUint aLevel,TUint aName,TDes8& aOption, TAny* aSource);
       
    39 	virtual TInt Send(RMBufChain& aPdu, TAny* aSource);
       
    40 	virtual void Info(TNifIfInfo& aInfo) const;
       
    41 	virtual TInt Notification(TAgentToNifEventType aEvent, void * aInfo);
       
    42 	virtual void StartSending(CProtocolBase* aProtocol);
       
    43 
       
    44 	virtual TBool WantsProtocol(TUint16 aProtocolCode);
       
    45 	virtual void Process(RMBufChain& aPdu);
       
    46 
       
    47 	virtual void UpdateContextConfigL(const RPacketContext::TContextConfigGPRS&
       
    48 		aConfig);
       
    49 	virtual void UpdateConnectionSpeed(TUint aConnectionSpeed);
       
    50 
       
    51 	// Define the class that will hold the IPv4 setting required by the Nif.
       
    52 	class TIPv4Settings
       
    53 		{
       
    54 	public:
       
    55 		// As this is IPv4, all addresses are 32-bit.
       
    56 		TUint32	iLocalAddr;
       
    57 		TUint32	iNetMask;
       
    58 		TUint32	iBroadcastAddr;
       
    59 		TUint32	iDefGateway;
       
    60 		TUint32	iPrimaryDns;
       
    61 		TUint32	iSecondaryDns;
       
    62 		TBool iGetGatewayFromServer;
       
    63 		TBool iGetDnsFromServer;
       
    64 		};
       
    65 
       
    66 private:
       
    67 	void ReadCommDbGprsSettingsL();
       
    68 	void ReadIPv4SettingL(const TDesC& aFieldName, TUint32& aIpAddr);
       
    69 
       
    70 	TInt WriteIfConfig(TDes8& aIfConfig);
       
    71 	TInt WriteIfInfo(TDes8& aIfInfo);
       
    72 
       
    73 	TInt WriteConnectionInfo(TDes8& aConnectionInfo);
       
    74 
       
    75 #ifdef WCDMA_STUB
       
    76 	TInt DeleteContext(TDes8& aContextParameters);
       
    77 #endif
       
    78 
       
    79 	inline void WriteIfName(TDes& aName) const;
       
    80 
       
    81 #ifdef __BTT_LOGGING__
       
    82 	void LogPacket(const RMBufChain& aPacket);
       
    83 #endif // __BTT_LOGGING__
       
    84 
       
    85 private: //unowned
       
    86 	CBttLogger* iTheLogger;
       
    87 
       
    88 private: //owned
       
    89 	TIPv4Settings iSettings;
       
    90 	TUint iSpeedMetric;
       
    91 };
       
    92 
       
    93 void CIPv4ProtocolIf::WriteIfName(TDes& aName) const
       
    94 /**
       
    95  * Used to uniquely identify the current Nif instance
       
    96  *
       
    97  * @param aName Descriptor that will be initialised.
       
    98  */
       
    99 	{
       
   100 	aName.Format(_L("%S[0x%X]"), &KIPv4ProtocolIfName, this);
       
   101 	}
       
   102 
       
   103 #endif // IPV4PROTOCOLIF_H__