|
1 // Copyright (c) 2004-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 // SPUD event manager |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalComponent |
|
21 */ |
|
22 |
|
23 #ifndef SPUDMAN_H |
|
24 #define SPUDMAN_H |
|
25 |
|
26 #include <e32base.h> |
|
27 #include <comms-infras/nifif.h> |
|
28 #include <networking/umtsnifcontrolif.h> |
|
29 #include <comms-infras/commsdebugutility.h> |
|
30 #include <networking/mspudmaninterface.h> |
|
31 |
|
32 #include "rpdpfsminterface.h" |
|
33 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
34 #include <comms-infras/nifprvar_internal.h> |
|
35 #endif |
|
36 |
|
37 const TUint KSpudMajorVersionNumber=0; |
|
38 const TUint KSpudMinorVersionNumber=0; |
|
39 const TUint KSpudBuildVersionNumber=2; |
|
40 |
|
41 /** Longest protocol name supported */ |
|
42 const TUint KMaxProtocolName = 20; |
|
43 |
|
44 #ifdef __FLOG_ACTIVE |
|
45 // Logging tags |
|
46 _LIT8(KSpudFirstTag,"spud"); |
|
47 _LIT8(KSpudLog,"spudman.txt"); |
|
48 #endif |
|
49 |
|
50 class CBinderSweeperNotifierCb; |
|
51 class CBindMan; |
|
52 class CSpudBinderRef; |
|
53 class RPdpFsmInterface; |
|
54 |
|
55 /** |
|
56 SPUD Event Manager. |
|
57 It is responsible for routing events throughout the SPUD and between interface points. |
|
58 */ |
|
59 NONSHARABLE_CLASS(CSpudMan) : public CNifIfLink, public MSpudManInterface |
|
60 { |
|
61 public: |
|
62 __FLOG_DECLARATION_MEMBER_MUTABLE; |
|
63 |
|
64 CSpudMan(CNifIfFactory& aFactory, MNifIfNotify* aNotify); |
|
65 ~CSpudMan(); |
|
66 void ConstructL(CBindMan* aBindMan); |
|
67 void Panic(TInt aReason=0) const; |
|
68 |
|
69 TBool AreQoSEventsEnabled() const; |
|
70 |
|
71 // Getters |
|
72 CBindMan* BindMan() const; |
|
73 MNifIfNotify* Notify() const; |
|
74 |
|
75 // Events from elsewhere |
|
76 TInt GuqosInput(TUint aName, TDes8& aOption); |
|
77 void LinkLayerUp(TContextId aContextId); |
|
78 void LinkLayerDown(TContextId aContextId, TInt aReason, MNifIfNotify::TAction aAction); |
|
79 void StopSending(TContextId aContextId); |
|
80 void StartSending(TContextId aContextId); |
|
81 |
|
82 // from MSpudManInterface |
|
83 void Input (TContextId aPdpId, TInt aEvent, TInt aParam); |
|
84 void SetContextTerminationErrorAndStop(TContextId aContextId, TInt aErrorCode); |
|
85 |
|
86 // from CNifIfLink |
|
87 void AuthenticateComplete(TInt aResult); |
|
88 TInt Start(); |
|
89 void Stop(TInt aReason, MNifIfNotify::TAction aAction); |
|
90 CNifIfBase* GetBinderL(const TDesC& aName); |
|
91 void Restart(CNifIfBase* aIf); |
|
92 |
|
93 // from CNifIfBase |
|
94 TInt Send(RMBufChain& aPdu, TAny* aSource=0); |
|
95 void Info(TNifIfInfo& aInfo) const; |
|
96 TInt Notification(TAgentToNifEventType aEvent, void * aInfo); |
|
97 |
|
98 // SPUD methods |
|
99 void IfProgress(TContextId aContextId, TInt aStage, TInt aError); |
|
100 void IfProgress(TContextId aContextId, TSubConnectionUniqueId aSubConnectionUniqueId, TInt aStage, TInt aError); |
|
101 TInt Notification(TContextId aContextId, TNifToAgentEventType aEvent, void * aInfo); |
|
102 TInt ReadInt(TContextId aContextId, const TDesC& aField, TUint32& aValue); |
|
103 TInt ReadDes(TContextId aContextId, const TDesC& aField, TDes8& aValue); |
|
104 TInt ReadDes(TContextId aContextId, const TDesC& aField, TDes16& aValue); |
|
105 |
|
106 void DisposeOfBinder(CSpudBinderRef* aRef); |
|
107 void SweepBindersAndNotify(); |
|
108 |
|
109 protected: |
|
110 void ReadDefaultQoS(RPacketQoS::TQoSR99_R4Requested& aQos) const; |
|
111 |
|
112 |
|
113 #ifdef SYMBIAN_NETWORKING_UMTSR5 |
|
114 |
|
115 // IM CN signalling flag, Setter and Getter methods |
|
116 void SetIMCNSignallingFlagPcoL(RPacketContext::TProtocolConfigOptionV2& aPco); |
|
117 TBool GetIMCNSignallingFlagPcoL(RPacketContext::TProtocolConfigOptionV2& aPco); |
|
118 |
|
119 void ReadDefaultR5QoS(RPacketQoS::TQoSR5Requested& aQos) const; |
|
120 #endif |
|
121 // SYMBIAN_NETWORKING_UMTSR5 |
|
122 |
|
123 void ReadTsyName(TName& aTsyName) const; |
|
124 void SetTerminateError(TInt aError); |
|
125 void SetTerminateError(TContextId aContextId, TInt aError); |
|
126 void RetrieveGprsConfig(RPacketContext::TContextConfigGPRS& aConfigGprs) const; |
|
127 void RetrieveGprsCompression(TUint& aCompression) const; |
|
128 void RetrieveGprsAnonymousAccess(RPacketContext::TAnonymousAccess& aAnonymous) const; |
|
129 |
|
130 void FillInParameters(TContextParameters& aParams, TContextId aContextId, TInt aError=KErrNone) const; |
|
131 void FillInContextConfig(TContextConfig& aConfig, TContextId aContextId) const; |
|
132 void RaiseEvent(TUint aName, TDes8& aOption) const; |
|
133 |
|
134 virtual TInt Control(TUint aLevel,TUint aName,TDes8& aOption, TAny* aSource=0); |
|
135 |
|
136 // GUQoS event senders |
|
137 void SendPrimaryContextCreated(TContextId aContextId, TInt aError); |
|
138 void SendContextBlockedEvent(TContextId aContextId); |
|
139 void SendContextUnblockedEvent(TContextId aContextId); |
|
140 void SendSecondaryContextCreated(TContextId aContextId, TInt aError); |
|
141 void SendContextQoSSetEvent(TContextId aContextId, TInt aError); |
|
142 void SendContextTFTModifiedEvent(TContextId aContextId, TTFTOperationCode aTFTOperationCode, TInt aError); |
|
143 void HandleGetNegQoSEvent(TContextId aContextId, TInt aError); |
|
144 void SendContextModifyActiveEvent(TContextId aContextId, TContextConfig& aContextConfig, TInt aError); |
|
145 void SendContextDeleteEvent(TContextId aContextId); |
|
146 void SendNetworkStatusEvent(TNetworkEventCode aEventCode, RPacketService::TStatus aStatus); |
|
147 void SendContextActivateEvent(TContextId aContextId, TContextConfig& aContextConfig, TInt aError); |
|
148 void SendContextParametersChangeEvent(TContextId aContextId, TContextConfig& aContextConfig, TInt aError); |
|
149 |
|
150 private: |
|
151 void InitPdpFsmInterfaceL(); |
|
152 |
|
153 void HandlePrimaryContextCreatedEvent(TContextId aContextId, TInt aError); |
|
154 void HandleContextDeleteEvent(TContextId aContextId, TInt aError); |
|
155 void HandleSecondaryContextCreatedEvent(TContextId aContextId, TInt aError); |
|
156 void HandleContextActivateEvent(TContextId aContextId, TInt aError); |
|
157 void HandleContextQoSSetEvent(TContextId aContextId, TInt aError); |
|
158 void HandleContextTFTModifiedEvent(TContextId aContextId, TInt aError); |
|
159 void HandleContextModifyActiveEvent(TContextId aContextId, TInt aError); |
|
160 void HandleNetworkStatusEvent(); |
|
161 void HandleContextParametersChangeEvent(TContextId aContextId, TInt aError); |
|
162 void HandleContextBlockedEvent(TContextId aContextId); |
|
163 void HandleContextUnblockedEvent(TContextId aContextId); |
|
164 |
|
165 void SetupSipServerAddrRetrievalL(RPacketContext::TProtocolConfigOptionV2& aPco); |
|
166 void SetSipServerAddrL(const RPacketContext::TProtocolConfigOptionV2& aPco); |
|
167 |
|
168 void StopContext(TContextId aContextId, TInt aReason, MNifIfNotify::TAction aAction); |
|
169 |
|
170 private: |
|
171 CBindMan* iBindMan; |
|
172 |
|
173 /** GUQoS event notifier */ |
|
174 MNifEvent* iQosEventHandler; |
|
175 |
|
176 /** Protocol name */ |
|
177 TBuf<KMaxProtocolName> iName; |
|
178 |
|
179 /** Whether events should be sent to GUQoS or not */ |
|
180 TBool iQosEventsEnabled; |
|
181 |
|
182 /** Interface to ETEL */ |
|
183 RPdpFsmInterface iPdpFsmInterface; |
|
184 |
|
185 /** Temporary storage of context configuration, here to avoid stack overflow */ |
|
186 TContextConfig iTempContextConfig; |
|
187 |
|
188 /** Temporary storage of TFT, here to avoid stack overflow */ |
|
189 mutable TTFTInfo iTempTftInfo; |
|
190 |
|
191 /** Temporary storage of GPRS context configuration, here to avoid stack overflow */ |
|
192 mutable RPacketContext::TContextConfigGPRS iTempGprsContext; |
|
193 |
|
194 /** Temporary storage of channel configuration, here to avoid stack overflow */ |
|
195 RPacketContext::TDataChannelV2 iTempDataChannelV2; |
|
196 |
|
197 /** Error code which indicates the cause of the SPUD shutdown */ |
|
198 TInt iTerminateError; |
|
199 |
|
200 /** First Error code from ETel */ |
|
201 TInt iETelTerminateError; |
|
202 |
|
203 /** Asynchronous sweep of binders marked for deletion, with optional notification to Nifman */ |
|
204 CBinderSweeperNotifierCb* iBinderSweeperNotifierCb; |
|
205 |
|
206 /** Default QoS sent from GuQoS before this Nif was ready */ |
|
207 HBufC8* iParkedDefaultQoS; |
|
208 |
|
209 /** The address of the P-CSCF (Sip server) */ |
|
210 RArray<TInetAddr> iSipServerAddr; |
|
211 |
|
212 |
|
213 /** It may be necessary to report a context status to GUQoS, which is different to the formal |
|
214 context status at the very moment of reporting. */ |
|
215 RPacketContext::TContextStatus iContextStatusOverride; |
|
216 |
|
217 /** Store the Primary ContextId that might be changed over time */ |
|
218 TContextId iPrimaryContextId; |
|
219 |
|
220 }; |
|
221 |
|
222 |
|
223 /** Asynchronously calls into Nifman, to trigger sweeping of binders marked for deletion & |
|
224 if necessary, Nifman notification. |
|
225 |
|
226 When the lower NIF signals LinkLayerDown on SPUD, SPUD has to delete it. |
|
227 However, this deletion cannot be done from within CSpudMan::LinkLayerDown, because |
|
228 the lower NIF's may still access its members after CSpudMan::LinkLayerDown returns. |
|
229 That is, the lower NIF must be deleted asynchronousely. However, if this is the last |
|
230 lower NIF, SPUD must signal MNifIfNotify::LinkLayerDown on Nifman. This triggers asynchronous deletion |
|
231 of SPUD itself. So, there can be a race condition between asynchronous deletion of SPUD by Nifman, |
|
232 and deletion of the lower NIF by SPUD. */ |
|
233 NONSHARABLE_CLASS(CBinderSweeperNotifierCb): public CAsyncOneShot |
|
234 { |
|
235 public: |
|
236 CBinderSweeperNotifierCb(CSpudMan& aSpudMan); |
|
237 |
|
238 // CAsyncOneShot virtuals |
|
239 void Call(); |
|
240 void RunL(); |
|
241 |
|
242 private: |
|
243 /** We call into Spudman that actually performs the sweeping & notification */ |
|
244 CSpudMan& iSpudMan; |
|
245 }; |
|
246 |
|
247 |
|
248 #endif |