|
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 |
|
35 class CBttLogger; |
|
36 class CPacketLogger; |
|
37 |
|
38 class CRawIPNifMain : public CNifIfLink, public MControllerObserver |
|
39 { |
|
40 public: |
|
41 CRawIPNifMain(CNifIfFactory& aFactory, MNifIfNotify* aNotify, CBttLogger* aTheLogger); |
|
42 ~CRawIPNifMain(); |
|
43 void ConstructL(const TDesC& aName); |
|
44 // Used to be :Pure virtuals inherited from MContextSmObserver |
|
45 CBcaIoController* GetBcaController(); |
|
46 void UpdateContextState(RPacketContext::TContextStatus aState, |
|
47 TInt aError); |
|
48 void UpdateContextConfig( |
|
49 RPacketContext::TContextConfigGPRS aConfig); |
|
50 |
|
51 public: // Pure virtuals inherited from CNifIfBase |
|
52 virtual void Info(TNifIfInfo&) const; |
|
53 virtual TInt Send(RMBufChain& aPdu, TAny* aSource=0); |
|
54 virtual TInt Notification(TAgentToNifEventType aEvent, void * aInfo); |
|
55 |
|
56 public: // Virtuals inherited from CNifIfBase |
|
57 virtual void BindL(TAny *aId); |
|
58 virtual TInt Control(TUint aLevel, TUint aName, TDes8& aOption, |
|
59 TAny* aSource); |
|
60 virtual TInt State(); |
|
61 |
|
62 public: // Pure virtuals inherited from CNifIfLink |
|
63 virtual TInt Start(); |
|
64 virtual void Stop(TInt aReason,MNifIfNotify::TAction aAction); |
|
65 virtual CNifIfBase* GetBinderL(const TDesC& aName); |
|
66 virtual void Restart(CNifIfBase* aIf); |
|
67 |
|
68 public: // Virtuals inherited from CNifIfLink |
|
69 virtual void AuthenticateComplete(TInt aResult); |
|
70 |
|
71 public: // Pure virtuals inherited from MRawIPNifObserverBase |
|
72 virtual void InitialiseL(TInitialisationState aState, TInt aError); |
|
73 virtual void ShutDown(TInitialisationState aState, TInt aError); |
|
74 virtual MNifIfNotify* GetAgent(); |
|
75 |
|
76 virtual CProtocolIfBase* GetProtocolIf(); |
|
77 |
|
78 public: // Pure virtuals inherited from MControllerObserver |
|
79 // Data going upstack |
|
80 virtual void Process(RMBufChain& aPdu, TUint16 aProtocolCode); |
|
81 // Flow Control unblocked |
|
82 virtual void ResumeSending(); |
|
83 |
|
84 public: // Inherited from MNifIfNotify |
|
85 // Notify that link is Up/Down |
|
86 virtual void LinkLayerUp(); |
|
87 virtual void LinkLayerDown(TInt aError); |
|
88 |
|
89 public: // Send data to CBcaIoController |
|
90 TInt SendPacket(RMBufChain& aPdu, TAny* /*aSource=0*/, |
|
91 TUint16 /*aType=KIp4FrameType*/); |
|
92 |
|
93 public: // Context status retrieval. |
|
94 inline RPacketContext::TContextStatus GetContextStatus(); |
|
95 |
|
96 private:// Unowned |
|
97 /** networking packet logger for debugging packets */ |
|
98 __PACKETLOG_DECLARATION_MEMBER; |
|
99 CBttLogger* iTheLogger; |
|
100 |
|
101 // Upstack bound protocol reference |
|
102 CProtocolBase* iProtocol; |
|
103 |
|
104 // The protocol to use (IPv4).Note: This is not owned by this class. |
|
105 CProtocolIfBase* iProtocolIf; |
|
106 |
|
107 private:// Owned |
|
108 TInt iInitError; |
|
109 TIfStatus iState; // One of EIfPending, EIfUp, EIfBusy or EIfDown. |
|
110 |
|
111 RPacketContext::TContextStatus iContextStatus; |
|
112 RPacketContext::TContextConfigGPRS iContextConfig; |
|
113 |
|
114 CBcaIoController* iBcaController; |
|
115 }; |
|
116 |
|
117 inline RPacketContext::TContextStatus CRawIPNifMain::GetContextStatus() |
|
118 /** |
|
119 * Returns Context status |
|
120 * |
|
121 * @return iContextStatus The context status |
|
122 */ |
|
123 { |
|
124 return iContextStatus; |
|
125 } |
|
126 |
|
127 #endif // RAWIPNIFMAIN_H |