telephonyprotocols/rawipnif/inc/RawIPNifMain.h
changeset 0 3553901f7fa8
child 19 630d2f34d719
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     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 // Defines the CRawIPNifMain class, which provides a central point for the NIF
       
    15 // to communicate with NifMan and the BCA controller. This class creates an
       
    16 // interface to the IPv4 protocol when it is required.
       
    17 // 
       
    18 //
       
    19 
       
    20 /**
       
    21  @file
       
    22 */
       
    23 
       
    24 #ifndef RAWIPNIFMAIN_H
       
    25 #define RAWIPNIFMAIN_H
       
    26 
       
    27 #include <comms-infras/nifif.h>
       
    28 #include <networking/packetlogger.h>
       
    29 #include <in_sock.h>
       
    30 #include "ProtocolIfBase.h"
       
    31 #include "BcaIoController.h"
       
    32 #include "MControllerObserver.h"
       
    33 #include "bttlog.h"
       
    34 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    35 #include <comms-infras/nifprvar_internal.h>
       
    36 #endif
       
    37 
       
    38 class CBttLogger;
       
    39 class CPacketLogger;
       
    40 
       
    41 class CRawIPNifMain : public CNifIfLink, public MControllerObserver
       
    42 	{
       
    43 public:
       
    44  	CRawIPNifMain(CNifIfFactory& aFactory, MNifIfNotify* aNotify, CBttLogger* aTheLogger);
       
    45 	~CRawIPNifMain();
       
    46 	void ConstructL(const TDesC& aName);
       
    47 	// Used to be :Pure virtuals inherited from MContextSmObserver
       
    48 	CBcaIoController* GetBcaController();
       
    49 	void UpdateContextState(RPacketContext::TContextStatus aState,
       
    50 		TInt aError);
       
    51 	void UpdateContextConfig(
       
    52 		RPacketContext::TContextConfigGPRS aConfig);
       
    53 
       
    54 public: // Pure virtuals inherited from CNifIfBase
       
    55 	virtual void Info(TNifIfInfo&) const;
       
    56 	virtual TInt Send(RMBufChain& aPdu, TAny* aSource=0);
       
    57 	virtual TInt Notification(TAgentToNifEventType aEvent, void * aInfo); 
       
    58 
       
    59 public: // Virtuals inherited from CNifIfBase
       
    60 	virtual void BindL(TAny *aId);
       
    61 	virtual TInt Control(TUint aLevel, TUint aName, TDes8& aOption, 
       
    62 		TAny* aSource);
       
    63 	virtual TInt State();
       
    64 
       
    65 public: // Pure virtuals inherited from CNifIfLink 
       
    66 	virtual TInt Start();
       
    67 	virtual void Stop(TInt aReason,MNifIfNotify::TAction aAction);
       
    68     virtual CNifIfBase* GetBinderL(const TDesC& aName);
       
    69 	virtual void Restart(CNifIfBase* aIf);
       
    70 
       
    71 public: // Virtuals inherited from CNifIfLink
       
    72 	virtual void AuthenticateComplete(TInt aResult);
       
    73  
       
    74 public: // Pure virtuals inherited from MRawIPNifObserverBase
       
    75 	virtual void InitialiseL(TInitialisationState aState, TInt aError);
       
    76 	virtual void ShutDown(TInitialisationState aState, TInt aError);
       
    77 	virtual MNifIfNotify* GetAgent();
       
    78 	
       
    79 	virtual CProtocolIfBase* GetProtocolIf();
       
    80 
       
    81 public: // Pure virtuals inherited from MControllerObserver
       
    82 	// Data going upstack
       
    83 	virtual void Process(RMBufChain& aPdu, TUint16 aProtocolCode);
       
    84 	// Flow Control unblocked
       
    85 	virtual void ResumeSending();
       
    86 
       
    87 public:  // Inherited from MNifIfNotify
       
    88 	// Notify that link is Up/Down
       
    89 	virtual void LinkLayerUp();
       
    90 	virtual void LinkLayerDown(TInt aError);
       
    91 
       
    92 public:	// Send data to CBcaIoController
       
    93 	TInt SendPacket(RMBufChain& aPdu, TAny* /*aSource=0*/, 
       
    94 		TUint16 /*aType=KIp4FrameType*/);	
       
    95 
       
    96 public:	// Context status retrieval.
       
    97 	inline RPacketContext::TContextStatus GetContextStatus();
       
    98 	
       
    99 private:// Unowned
       
   100 	/** networking packet logger for debugging packets */
       
   101 	__PACKETLOG_DECLARATION_MEMBER;
       
   102 	CBttLogger* iTheLogger;
       
   103 
       
   104 	// Upstack bound protocol reference
       
   105 	CProtocolBase* iProtocol;
       
   106 
       
   107 	// The protocol to use (IPv4).Note: This is not owned by this class.
       
   108 	CProtocolIfBase* iProtocolIf;
       
   109 
       
   110 private:// Owned 
       
   111 	TInt iInitError; 
       
   112 	TIfStatus iState; // One of EIfPending, EIfUp, EIfBusy or EIfDown.
       
   113 
       
   114 	RPacketContext::TContextStatus iContextStatus;
       
   115 	RPacketContext::TContextConfigGPRS iContextConfig;
       
   116 
       
   117 	CBcaIoController* iBcaController;
       
   118 	};
       
   119 
       
   120 inline RPacketContext::TContextStatus CRawIPNifMain::GetContextStatus()
       
   121 /**
       
   122  * Returns Context status
       
   123  *
       
   124  * @return iContextStatus The context status
       
   125  */
       
   126 	{
       
   127 	return iContextStatus;
       
   128 	}
       
   129 
       
   130 #endif // RAWIPNIFMAIN_H