|
1 // Copyright (c) 2006-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 CRawIPFlow class, which provides a central point for the Flow |
|
15 // to communicate with NifMan and the BCA controller. This class creates an |
|
16 // interface to the IPv4 binder when it is required. |
|
17 // |
|
18 // |
|
19 |
|
20 /** |
|
21 @file |
|
22 */ |
|
23 |
|
24 #ifndef RAWIP2FLOW_H |
|
25 #define RAWIP2FLOW_H |
|
26 |
|
27 #include <comms-infras/nifif.h> |
|
28 #include <networking/packetlogger.h> |
|
29 #include <in_sock.h> |
|
30 #include <comms-infras/ss_flowbinders.h> |
|
31 #include <comms-infras/ss_subconnflow.h> |
|
32 #include "BinderBase.h" |
|
33 #include "bttlog.h" |
|
34 #include <comms-infras/linkmessages.h> // for TLinkMessageId |
|
35 |
|
36 class CBcaController; |
|
37 class CBttLogger; |
|
38 class CPacketLogger; |
|
39 class CBCAProvision; |
|
40 |
|
41 class CRawIP2Flow : public ESock::CSubConnectionFlowBase, public ESock::MFlowBinderControl |
|
42 { |
|
43 friend class CRawIP2FlowFactory; |
|
44 |
|
45 public: |
|
46 |
|
47 //-========================================================= |
|
48 // Methods for handling incoming SCPR messages |
|
49 //-========================================================= |
|
50 void StartFlowL(); |
|
51 void StopFlow(TInt aError); |
|
52 void SubConnectionGoingDown(); |
|
53 void SubConnectionError(TInt aError); |
|
54 void Destroy(); |
|
55 |
|
56 //-========================================================= |
|
57 // CSubConnectionProviderBase methods |
|
58 //-========================================================= |
|
59 MFlowBinderControl* DoGetBinderControlL(); |
|
60 |
|
61 //-========================================================= |
|
62 // Messages::ANode methods |
|
63 //-========================================================= |
|
64 virtual void ReceivedL(const Messages::TRuntimeCtxId& aSender, const Messages::TNodeId& aRecipient, Messages::TSignatureBase& aMessage); |
|
65 |
|
66 //-========================================================= |
|
67 // MFlowBinderControl methods |
|
68 //-========================================================= |
|
69 virtual ESock::MLowerControl* GetControlL(const TDesC8& aProtocol); |
|
70 virtual ESock::MLowerDataSender* BindL(const TDesC8& aProtocol, ESock::MUpperDataReceiver* aReceiver, ESock::MUpperControl* aControl); |
|
71 virtual void Unbind(ESock::MUpperDataReceiver* aReceiver, ESock::MUpperControl* aControl); |
|
72 virtual CSubConnectionFlowBase* Flow(); //returns its own flow |
|
73 |
|
74 //-========================================================= |
|
75 // Custom methods |
|
76 //-========================================================= |
|
77 // provide compatability for classes using old CNifIfLink style API and PPP Internal Stop() calls |
|
78 void Stop(TInt aReason, MNifIfNotify::TAction aAction); |
|
79 // call from Binder - MLowerDataSender |
|
80 ESock::MLowerDataSender::TSendResult Send(RMBufChain& aPdu, TUint aProtocol); |
|
81 |
|
82 // Used to be :Pure virtuals inherited from MContextSmObserver |
|
83 CBcaController* GetBcaController(); |
|
84 void UpdateContextState(RPacketContext::TContextStatus aState, TInt aError); |
|
85 |
|
86 public: |
|
87 virtual void InitialiseL(); |
|
88 virtual void ShutDown( TInt aError); |
|
89 |
|
90 virtual CBinderBase* GetBinder(); |
|
91 |
|
92 public: |
|
93 // Notify that link is Up/Down |
|
94 void LinkLayerUp(); |
|
95 void LinkLayerDown(TInt aError); |
|
96 |
|
97 public: |
|
98 |
|
99 public: // Context status retrieval. |
|
100 inline RPacketContext::TContextStatus GetContextStatus(); |
|
101 |
|
102 protected: |
|
103 CRawIP2Flow(ESock::CSubConnectionFlowFactoryBase& aFactory, const Messages::TNodeId& aSubConnId, ESock::CProtocolIntfBase* aProtocolIntf, CBttLogger* aTheLogger); |
|
104 void ConstructL(); |
|
105 virtual ~CRawIP2Flow(); |
|
106 |
|
107 protected: |
|
108 class TBinderControlProxy : public ESock::MFlowBinderControl |
|
109 { |
|
110 public: |
|
111 virtual ESock::MLowerControl* GetControlL(const TDesC8& aProtocol); |
|
112 virtual ESock::MLowerDataSender* BindL(const TDesC8& aProtocol, ESock::MUpperDataReceiver* aReceiver, ESock::MUpperControl* aControl); |
|
113 virtual void Unbind(ESock::MUpperDataReceiver* aReceiver, ESock::MUpperControl* aControl); |
|
114 virtual CSubConnectionFlowBase* Flow(); //returns its own flow |
|
115 CRawIP2Flow& RawIP2Flow() |
|
116 { |
|
117 ASSERT(iFlow); |
|
118 return *iFlow; |
|
119 } |
|
120 |
|
121 TBinderControlProxy(CRawIP2Flow& aFlow) |
|
122 :iFlow(&aFlow) |
|
123 { |
|
124 } |
|
125 |
|
126 CRawIP2Flow* iFlow; |
|
127 }; |
|
128 TBinderControlProxy* iBinderControl; |
|
129 |
|
130 private: |
|
131 void ProvisionConfig(const ESock::RMetaExtensionContainerC& aConfigData); |
|
132 void DynamicProvisionConfigL(); |
|
133 |
|
134 // Utility functions |
|
135 void PostProgressMessage(TInt aStage, TInt aError); |
|
136 void SendDataClientIdleIfNoClients(); |
|
137 |
|
138 private:// Unowned |
|
139 /** networking packet logger for debugging packets */ |
|
140 __PACKETLOG_DECLARATION_MEMBER; |
|
141 CBttLogger* iTheLogger; |
|
142 |
|
143 // The protocol to use (IPv4).Note: This is not owned by this class. |
|
144 CBinderBase* iBinder; |
|
145 |
|
146 const CBCAProvision* iBCAProvisionConfig; // pointer to BCA provisioning structure in CAccessPointConfig |
|
147 const CRawIpAgentConfig* iAgentProvision; // pointer to Agent provisioning structure in CAccessPointConfig |
|
148 TInt iProvisionError; // error code saved during processing of ProvisionConfig message |
|
149 |
|
150 |
|
151 private:// Owned |
|
152 TInt iInitError; |
|
153 |
|
154 RPacketContext::TContextStatus iContextStatus; |
|
155 |
|
156 CBcaController* iBcaController; |
|
157 TBool iStarting:1; |
|
158 TBool iStarted:1; |
|
159 TBool iStopping:1; |
|
160 TBool iBlocked:1; |
|
161 }; |
|
162 |
|
163 inline RPacketContext::TContextStatus CRawIP2Flow::GetContextStatus() |
|
164 /** |
|
165 * Returns Context status |
|
166 * |
|
167 * @return iContextStatus The context status |
|
168 */ |
|
169 { |
|
170 return iContextStatus; |
|
171 } |
|
172 |
|
173 #endif // RAWIP2Flow_H |