networkcontrol/ipnetworklayer/inc/nif.h
changeset 0 af10295192d8
equal deleted inserted replaced
-1:000000000000 0:af10295192d8
       
     1 /**
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 * CNifIfBase and CProtocolBase shim layer functionality
       
    16 * 
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 /**
       
    23  @file nif.h
       
    24 */
       
    25 
       
    26 #if !defined(NIF_H_INCLUDED)
       
    27 #define NIF_H_INCLUDED
       
    28 
       
    29 #include <e32base.h>
       
    30 #include <comms-infras/ss_protflow.h>
       
    31 #include <comms-infras/nifif.h>
       
    32 #include <comms-infras/es_protbinder.h>
       
    33 #include <comms-infras/ss_flowbinders.h>
       
    34 #include "notify.h"
       
    35 #include "flow.h"
       
    36 #include <networking/ipaddrinfoparams.h>
       
    37 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    38 #include <comms-infras/nifif_internal.h>
       
    39 #include <comms-infras/nifprvar_internal.h>
       
    40 #endif
       
    41 
       
    42 class MNifIfUser;
       
    43 class CIPShimNotify;
       
    44 
       
    45 class CHookAddressInfo;
       
    46 class CIPProtoBinder;
       
    47 
       
    48 const TInt KMaxProtocolNameSize = 16;
       
    49 
       
    50 _LIT8(KProtocolIp, "ip");
       
    51 _LIT8(KProtocolIp6, "ip6");
       
    52 
       
    53 
       
    54 class CIPShimIfBase : public CNifIfBase,
       
    55 	//interfaces for the flow below
       
    56 	public ESock::MUpperControl, public ESock::MUpperDataReceiver
       
    57 	
       
    58 	{
       
    59 /**
       
    60 Class that represents a NIF to the TCP/IP stack and presents and presents an
       
    61 upperdatareceiver to the flows below
       
    62 
       
    63 
       
    64 @internalComponent
       
    65 */
       
    66 public:
       
    67     friend class CIPShimSubConnectionFlow;
       
    68 
       
    69 public:
       
    70 	static CIPShimIfBase* NewL(const TDesC8& aProtocol, CIPShimProtocolIntf *iProtIntf);
       
    71 	~CIPShimIfBase();
       
    72 	
       
    73 	void StartL();
       
    74 	void BindToL(CIPProtoBinder* aIPProtoBinder);
       
    75 	void UnbindFrom(CIPProtoBinder* aIPProtoBinder);
       
    76 
       
    77 	inline void SetProtocolIntf(CIPShimProtocolIntf *aIntf);
       
    78 	void CleanupInterface(TInt aError);
       
    79 	void Release(TInt aError);
       
    80 	
       
    81 	const TConnectionInfo& ConnectionInfo();
       
    82 	void SetConnectionInfo(const TConnectionInfo& aConnectionInfo);
       
    83 	const TDesC8& ProtocolName();
       
    84 
       
    85 	CIPShimNotify* const ShimNotify() const { return iShimNotify; };
       
    86 
       
    87 	// IP4/IP6 specific required derivations
       
    88 	virtual void GetConfigFirstTime() = 0;
       
    89 
       
    90     //-=========================================
       
    91     // MUpperDataReceiver methods
       
    92     //-=========================================        
       
    93  	void Process(RMBufChain& aData);
       
    94  
       
    95     //-=========================================
       
    96     // MUpperControl methods
       
    97     //-=========================================        
       
    98 	void StartSending();
       
    99 	void Error(TInt anError);
       
   100 
       
   101 
       
   102 	CProtocolBase* iUpperProtocol;
       
   103 	
       
   104 	CIPShimSubConnectionFlow& Flow();
       
   105 	CIPShimProtocolIntf* ProtcolIntf();
       
   106 	
       
   107 	void AddIpAddrInfoL(CIPProtoBinder* aBinder, CSubConIPAddressInfoParamSet::TSubConIPAddressInfo& aAddrInfo);
       
   108 	void RemoveIpAddrInfo(CIPProtoBinder* aBinder, CSubConIPAddressInfoParamSet::TSubConIPAddressInfo& aAddrInfo);
       
   109 	void RemoveIpAddrInfo(CIPProtoBinder* aBinder);
       
   110 	void RemoveInterfaceName(CIPProtoBinder* aBinder);
       
   111 protected:
       
   112 	CIPShimIfBase(const TDesC8& aProtocolName);
       
   113 	void ConstructL();
       
   114 
       
   115 	// from CNifIfBase
       
   116 	void BindL(TAny *aId);
       
   117 	TInt State();
       
   118 	TInt Control(TUint aLevel,TUint aName,TDes8& aOption, TAny* aSource=0);
       
   119 	void Info(TNifIfInfo& aInfo) const;
       
   120 	TInt Send(RMBufChain& aPdu, TAny* aSource=0);
       
   121 	TInt Notification(TAgentToNifEventType aEvent, void * aInfo);
       
   122 
       
   123 	// IP4/IP6 specific required derivations
       
   124 	virtual TInt ServiceInfoControl(TDes8& aOption, TUint aName) = 0;
       
   125 	virtual TInt ServiceConfigControl(TDes8& aOption) = 0;
       
   126 	
       
   127 	RPointerArray<CIPProtoBinder> iProtoBinders;
       
   128 	
       
   129 
       
   130 private:
       
   131 	TInt ServiceHwAddrControl(TDes8& aOption);
       
   132 	TInt ServiceConnInfo(TDes8& aOption);
       
   133 	
       
   134 private:
       
   135 	TBuf8<KMaxProtocolNameSize> iProtocolName;	// "ip" or "ip6"
       
   136 	TConnectionInfo iConnectionInfo;
       
   137 	
       
   138 	CIPShimNotify* iShimNotify;                 // note: CNifIfBase::iNotify is an alias of this
       
   139 	mutable TBool iInterfaceNameRecorded;		// Used by Info() which is inherited const from CNifIfBase
       
   140 	TBool iBinderReady;	
       
   141 	MNifIfUser* iNifUser;
       
   142 	
       
   143 	CHookAddressInfo* iHookAddressInfo;
       
   144 	CIPShimProtocolIntf *iProtIntf; // needed for cleanup
       
   145 	};
       
   146 
       
   147     
       
   148 
       
   149 void CIPShimIfBase::SetProtocolIntf(CIPShimProtocolIntf *aIntf)
       
   150 	{
       
   151 	iProtIntf = aIntf;
       
   152 	}
       
   153 	
       
   154 
       
   155 #endif
       
   156 //NIF_H_INCLUDED
       
   157