10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: VPN Connection Agent declaration. |
14 * Description: VPN Connection Agent declaration. |
15 |
|
16 * |
15 * |
17 */ |
16 */ |
18 |
17 |
19 |
|
20 |
|
21 |
|
22 |
|
23 /** |
18 /** |
24 |
|
25 * @file vpnconnagt.h |
19 * @file vpnconnagt.h |
26 |
|
27 * |
20 * |
28 |
|
29 * VPN Connection Agent declaration. |
21 * VPN Connection Agent declaration. |
30 |
|
31 * |
22 * |
32 |
|
33 */ |
23 */ |
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 #if !defined __VPN_CONN_AGT_H__ |
24 #if !defined __VPN_CONN_AGT_H__ |
40 |
|
41 #define __VPN_CONN_AGT_H__ |
25 #define __VPN_CONN_AGT_H__ |
42 |
26 |
43 |
|
44 |
|
45 // INCLUDES |
27 // INCLUDES |
46 |
|
47 #include <comms-infras/cagentbase.h> |
28 #include <comms-infras/cagentbase.h> |
48 |
29 |
49 |
|
50 |
|
51 #include "eventmediatorapi.h" |
30 #include "eventmediatorapi.h" |
52 |
|
53 |
|
54 |
|
55 #include "vpnconnagtprog.h" |
31 #include "vpnconnagtprog.h" |
56 |
|
57 #include "vpnconnagtdefs.h" |
32 #include "vpnconnagtdefs.h" |
58 |
|
59 #include "eventdefssit.h" |
33 #include "eventdefssit.h" |
60 |
|
61 #include "log_r6.h" |
34 #include "log_r6.h" |
62 |
35 |
63 |
|
64 |
|
65 // CONSTANTS |
36 // CONSTANTS |
66 |
|
67 const TInt KMajorVerNumber=1; |
37 const TInt KMajorVerNumber=1; |
68 |
|
69 const TInt KMinorVerNumber=0; |
38 const TInt KMinorVerNumber=0; |
70 |
|
71 const TInt KBuildVerNumber=0; |
39 const TInt KBuildVerNumber=0; |
72 |
40 |
73 |
|
74 |
|
75 _LIT(KVPNConnAgtName,"vpnconnagt"); |
41 _LIT(KVPNConnAgtName,"vpnconnagt"); |
76 |
42 |
77 |
|
78 |
|
79 class CAsyncDisconnecter; |
|
80 |
|
81 |
|
82 |
|
83 /** |
43 /** |
84 |
|
85 * A Factory for creating a VPNConnAgent. |
44 * A Factory for creating a VPNConnAgent. |
86 |
|
87 */ |
45 */ |
88 |
|
89 class CVPNConnAgtFactory : public CNifAgentFactory |
46 class CVPNConnAgtFactory : public CNifAgentFactory |
90 |
|
91 { |
47 { |
92 |
|
93 /** |
48 /** |
94 |
|
95 @internalComponent |
49 @internalComponent |
96 |
|
97 */ |
50 */ |
98 |
|
99 protected: // Methods |
51 protected: // Methods |
100 |
52 /** |
101 |
|
102 |
|
103 /** |
|
104 |
|
105 * "Installs" this factory to the system. From this Agent point of view |
53 * "Installs" this factory to the system. From this Agent point of view |
106 |
|
107 * it doesn't do anything... |
54 * it doesn't do anything... |
108 |
55 */ |
109 */ |
|
110 |
|
111 void InstallL(); |
56 void InstallL(); |
112 |
57 |
113 |
58 /** |
114 |
|
115 /** |
|
116 |
|
117 * Creates a new VPN Agent instance. |
59 * Creates a new VPN Agent instance. |
118 |
|
119 * @param aName Not used. |
60 * @param aName Not used. |
120 |
|
121 * @return Returns the pointer to the agent created if succeed. Otherwise it |
61 * @return Returns the pointer to the agent created if succeed. Otherwise it |
122 |
|
123 * leaves. |
62 * leaves. |
124 |
63 */ |
125 */ |
|
126 |
|
127 CNifAgentBase *NewAgentL(const TDesC& aName); |
64 CNifAgentBase *NewAgentL(const TDesC& aName); |
128 |
65 |
129 |
66 /** |
130 |
|
131 /** |
|
132 |
|
133 * Returns the information defined in TNifAgentInfo. |
67 * Returns the information defined in TNifAgentInfo. |
134 |
|
135 * @param aInfo The reference to the TNifAgentInfo object to be used to pass |
68 * @param aInfo The reference to the TNifAgentInfo object to be used to pass |
136 |
|
137 * the needed information. |
69 * the needed information. |
138 |
|
139 * @param aIndex Not used. |
70 * @param aIndex Not used. |
140 |
71 */ |
141 */ |
|
142 |
|
143 TInt Info(TNifAgentInfo& aInfo, TInt aIndex) const; |
72 TInt Info(TNifAgentInfo& aInfo, TInt aIndex) const; |
144 |
|
145 }; |
73 }; |
146 |
74 |
147 |
|
148 |
|
149 |
|
150 |
|
151 /** |
75 /** |
152 |
|
153 * Class declaration for VPN connection agent. Each agent reference |
76 * Class declaration for VPN connection agent. Each agent reference |
154 |
|
155 * has it's own instance of agent and nif. Nif sends it's name via |
77 * has it's own instance of agent and nif. Nif sends it's name via |
156 |
|
157 * agent reference to agent. This triggers agent to initialize the VPN connection |
78 * agent reference to agent. This triggers agent to initialize the VPN connection |
158 |
|
159 * through the VPN Manager Server. After VPN tunnel has been created |
79 * through the VPN Manager Server. After VPN tunnel has been created |
160 |
|
161 * agent sends the IP address and the DNS addresses to the nif which |
80 * agent sends the IP address and the DNS addresses to the nif which |
162 |
|
163 * in turn informs the Nifman and IP stack that the connection has |
81 * in turn informs the Nifman and IP stack that the connection has |
164 |
|
165 * been created. |
82 * been created. |
166 |
|
167 */ |
83 */ |
168 |
|
169 class CVPNConnAgt : public CAgentBase, public MEventObserver |
84 class CVPNConnAgt : public CAgentBase, public MEventObserver |
170 |
|
171 { |
85 { |
172 |
|
173 /** |
86 /** |
174 |
|
175 @internalComponent |
87 @internalComponent |
176 |
|
177 */ |
88 */ |
178 |
|
179 friend class CAsyncDisconnecter; |
89 friend class CAsyncDisconnecter; |
180 |
|
181 public: // Methods |
90 public: // Methods |
182 |
91 /** |
183 |
|
184 |
|
185 /** |
|
186 |
|
187 * Static constructor. |
92 * Static constructor. |
188 |
|
189 * @return The return value is the pointer to the CVPNConnAgt |
93 * @return The return value is the pointer to the CVPNConnAgt |
190 |
|
191 * if it succeed. Otherwise the fuction leaves. |
94 * if it succeed. Otherwise the fuction leaves. |
192 |
95 */ |
193 */ |
|
194 |
|
195 static CVPNConnAgt* NewL(); |
96 static CVPNConnAgt* NewL(); |
196 |
97 |
197 |
98 /** |
198 |
|
199 /** |
|
200 |
|
201 * Default C++ destructor. |
99 * Default C++ destructor. |
202 |
|
203 * Cancels all the Callbacks. |
100 * Cancels all the Callbacks. |
204 |
101 */ |
205 */ |
|
206 |
|
207 virtual ~CVPNConnAgt(); |
102 virtual ~CVPNConnAgt(); |
208 |
103 |
|
104 // from CNifAgentBase |
|
105 /** |
|
106 * Returns the information defined in TNifAgentInfo. |
|
107 * @param aInfo A reference to TNifAgentInfo object which is |
|
108 * used to pass the information to caller of this function. |
|
109 */ |
|
110 void Info(TNifAgentInfo& aInfo) const; |
|
111 |
|
112 /** |
|
113 * Starts the connection creation process. |
|
114 * @param aType Not used. |
|
115 */ |
|
116 void Connect(TAgentConnectType aType); |
|
117 |
|
118 /** |
|
119 * Starts the connection by calling Connect(TAgentConnectType aType). |
|
120 * @param aType Type of the connection e.g. EAgentReconnect. |
|
121 * @param aOverrideSettings Not used. |
|
122 */ |
|
123 void Connect(TAgentConnectType aType, CStoreableOverrideSettings* aOverrideSettings); |
|
124 |
|
125 /** |
|
126 * Starts the cancellation of the connect. |
|
127 */ |
|
128 void CancelConnect(); |
|
129 |
|
130 /** |
|
131 * Disconnects an ongoing connection. |
|
132 * @param aReason Not used. |
|
133 */ |
|
134 void Disconnect(TInt aReason); |
|
135 |
|
136 /** |
|
137 * Called after Connect() in connection creation phase. Connection configuration |
|
138 * parameters are read and request for the VPNManServer to open the connection |
|
139 * is done. During the execution of this function VPN Nif is created. |
|
140 * @param aError Not used. |
|
141 */ |
|
142 void ServiceStarted(TInt& aError); |
|
143 |
|
144 /** |
|
145 * The addresses got from the VPN Manager Server are send to VPN Nif. |
|
146 * Nifman is informed with the progress call (with parameter EVPNConnAgtConnected). |
|
147 * MNifAgentNotify interface's ConnectComplete() is called (this generates the Start() |
|
148 * call to VPN Nif. |
|
149 * @param aError Not used. |
|
150 */ |
|
151 void ConnectionComplete(TInt aError); |
|
152 |
|
153 /** |
|
154 * Causes the deactivationing/unloading of the VPN Policies. |
|
155 */ |
|
156 void DisconnectionComplete(); |
|
157 |
|
158 /** |
|
159 * Not Supported. |
|
160 * @param aBuffer Not used. |
|
161 * @return Always returns KErrNotSupported. |
|
162 */ |
|
163 TInt GetExcessData(TDes8& aBuffer); |
|
164 |
|
165 /** |
|
166 * Used to deliver the name of the VPN Nif to the VPN Agent. |
|
167 * @param aEvent If the value of this is ENifToVPNAgentEventTypeIfName the name of the |
|
168 * VPN Nif is copied from the aInfo parameter. |
|
169 * @param aInfo TName type pointer containing the name of the VPN NIf (if aEvent value is |
|
170 * ENifToVPNAgentEventTypeIfName). |
|
171 * @return Returns KErrNone if the fuction is used to deliver the name of the VPN Nif, |
|
172 * otherwise it returns KErrNotSupported. |
|
173 */ |
|
174 TInt Notification(TNifToAgentEventType aEvent, TAny* aInfo); |
|
175 |
|
176 /** |
|
177 * Passes the last error code to the caller. |
|
178 * @param aError Reference to the TInt type error code. |
|
179 */ |
|
180 void GetLastError(TInt& aError); |
|
181 |
|
182 /** |
|
183 * |
|
184 */ |
|
185 TBool IsReconnect() const {return (ETrue);}; |
|
186 |
|
187 /** |
|
188 * Not supported. |
|
189 */ |
|
190 TInt IncomingConnectionReceived(); |
|
191 |
|
192 /** |
|
193 * Is called when an event comes from real interface via event mediator. |
|
194 * @param aStatus Error code if the call fails. KErrNone if everything succees. |
|
195 * @param aType Type pf the event e.g. ESingleInterfaceEvent. |
|
196 * @param aData Pointer to the TInterfaceNotificationBuf type packaged buffer. Contains |
|
197 * the status of the real interface. |
|
198 */ |
|
199 void EventOccured(TInt aStatus, TEventType aType, TDesC8* aData); |
|
200 |
|
201 protected: // Methods |
|
202 |
|
203 /** |
|
204 * Overwrites the default implementation to catch the ip version reading from the |
|
205 * database. This value is retrieved from the VPN Manager Server. |
|
206 * @param aField Colum name in the CommDb. Ip version colum name is SERVICE_IF_NETWORKS. |
|
207 * @param aValue Value to be returned. In SERVICE_IF_NETWORKS case it's ip or ip6. |
|
208 * @param aMessage Message to validate capabilities |
|
209 * @return Returns KErrNone if the function succeed. Otherwise it returns system wide |
|
210 * error code. |
|
211 */ |
|
212 TInt DoReadDes(const TDesC& aField, TDes16& aValue, const RMessagePtr2* aMessage ); |
|
213 |
|
214 /** |
|
215 * Returns the pointer to the parameter object defined in vpnconnagtdefs.h. |
|
216 * @return The pointer to the connection parameter object. |
|
217 */ |
|
218 TVPNParameters* VPNParameters() { return &iVPNParameters; }; |
|
219 |
|
220 /** |
|
221 * Returns the pointer to the name of the VPN Nif sent by the nif itself. |
|
222 * @return The pointer to the TName type object containing the name of the |
|
223 * VPN Nif. |
|
224 */ |
|
225 TName* VPNNifName(void){ return iVPNParameters.GetVPNNifName();}; |
|
226 |
|
227 /** |
|
228 * Returns the pointer to the interface from the Agent to Nifman. This interface |
|
229 * is used to e.g. send progress notifications from Agent to Nifman. |
|
230 * @return The pointer to the interface from the Agent to Nifman. |
|
231 */ |
|
232 MNifAgentNotify* Notify() { return iNotify; }; |
209 |
233 |
210 |
234 /** |
211 // from CNifAgentBase |
235 * After deactivationing/unloading of the VPN Policies Nifman is informed with the |
212 |
236 * progress call (with EVPNConnAgtDisconnected). |
213 /** |
237 * MNifAgentNotify interface's DisconnectComplete() is called (this generates the deletion |
214 |
238 * of the VPN Nif and at the end deletion of the agent. |
215 * Returns the information defined in TNifAgentInfo. |
|
216 |
|
217 * @param aInfo A reference to TNifAgentInfo object which is |
|
218 |
|
219 * used to pass the information to caller of this function. |
|
220 |
|
221 */ |
|
222 |
|
223 void Info(TNifAgentInfo& aInfo) const; |
|
224 |
|
225 |
|
226 |
|
227 /** |
|
228 |
|
229 * Starts the connection creation process. |
|
230 |
|
231 * @param aType Not used. |
|
232 |
|
233 */ |
|
234 |
|
235 void Connect(TAgentConnectType aType); |
|
236 |
|
237 |
|
238 |
|
239 /** |
|
240 |
|
241 * Starts the connection by calling Connect(TAgentConnectType aType). |
|
242 |
|
243 * @param aType Type of the connection e.g. EAgentReconnect. |
|
244 |
|
245 * @param aOverrideSettings Not used. |
|
246 |
|
247 */ |
|
248 |
|
249 void Connect(TAgentConnectType aType, CStoreableOverrideSettings* aOverrideSettings); |
|
250 |
|
251 |
|
252 |
|
253 /** |
|
254 |
|
255 * Starts the cancellation of the connect. |
|
256 |
|
257 */ |
|
258 |
|
259 void CancelConnect(); |
|
260 |
|
261 |
|
262 |
|
263 /** |
|
264 |
|
265 * Disconnects an ongoing connection. |
|
266 |
|
267 * @param aReason Not used. |
|
268 |
|
269 */ |
|
270 |
|
271 void Disconnect(TInt aReason); |
|
272 |
|
273 |
|
274 |
|
275 /** |
|
276 |
|
277 * Called after Connect() in connection creation phase. Connection configuration |
|
278 |
|
279 * parameters are read and request for the VPNManServer to open the connection |
|
280 |
|
281 * is done. During the execution of this function VPN Nif is created. |
|
282 |
|
283 * @param aError Not used. |
|
284 |
|
285 */ |
|
286 |
|
287 void ServiceStarted(TInt& aError); |
|
288 |
|
289 |
|
290 |
|
291 /** |
|
292 |
|
293 * The addresses got from the VPN Manager Server are send to VPN Nif. |
|
294 |
|
295 * Nifman is informed with the progress call (with parameter EVPNConnAgtConnected). |
|
296 |
|
297 * MNifAgentNotify interface's ConnectComplete() is called (this generates the Start() |
|
298 |
|
299 * call to VPN Nif. |
|
300 |
|
301 * @param aError Not used. |
|
302 |
|
303 */ |
|
304 |
|
305 void ConnectionComplete(TInt aError); |
|
306 |
|
307 |
|
308 |
|
309 /** |
|
310 |
|
311 * Causes the deactivationing/unloading of the VPN Policies. |
|
312 |
|
313 */ |
|
314 |
|
315 void DisconnectionComplete(); |
|
316 |
|
317 |
|
318 |
|
319 /** |
|
320 |
|
321 * Not Supported. |
|
322 |
|
323 * @param aBuffer Not used. |
|
324 |
|
325 * @return Always returns KErrNotSupported. |
|
326 |
|
327 */ |
|
328 |
|
329 TInt GetExcessData(TDes8& aBuffer); |
|
330 |
|
331 |
|
332 |
|
333 /** |
|
334 |
|
335 * Used to deliver the name of the VPN Nif to the VPN Agent. |
|
336 |
|
337 * @param aEvent If the value of this is ENifToVPNAgentEventTypeIfName the name of the |
|
338 |
|
339 * VPN Nif is copied from the aInfo parameter. |
|
340 |
|
341 * @param aInfo TName type pointer containing the name of the VPN NIf (if aEvent value is |
|
342 |
|
343 * ENifToVPNAgentEventTypeIfName). |
|
344 |
|
345 * @return Returns KErrNone if the fuction is used to deliver the name of the VPN Nif, |
|
346 |
|
347 * otherwise it returns KErrNotSupported. |
|
348 |
|
349 */ |
|
350 |
|
351 TInt Notification(TNifToAgentEventType aEvent, TAny* aInfo); |
|
352 |
|
353 |
|
354 |
|
355 /** |
|
356 |
|
357 * Passes the last error code to the caller. |
|
358 |
|
359 * @param aError Reference to the TInt type error code. |
|
360 |
|
361 */ |
|
362 |
|
363 void GetLastError(TInt& aError); |
|
364 |
|
365 |
|
366 |
|
367 /** |
|
368 |
|
369 * |
239 * |
370 |
240 */ |
371 */ |
|
372 |
|
373 TBool IsReconnect() const {return (ETrue);}; |
|
374 |
|
375 |
|
376 |
|
377 /** |
|
378 |
|
379 * Not supported. |
|
380 |
|
381 */ |
|
382 |
|
383 TInt IncomingConnectionReceived(); |
|
384 |
|
385 |
|
386 |
|
387 /** |
|
388 |
|
389 * Is called when an event comes from real interface via event mediator. |
|
390 |
|
391 * @param aStatus Error code if the call fails. KErrNone if everything succees. |
|
392 |
|
393 * @param aType Type pf the event e.g. ESingleInterfaceEvent. |
|
394 |
|
395 * @param aData Pointer to the TInterfaceNotificationBuf type packaged buffer. Contains |
|
396 |
|
397 * the status of the real interface. |
|
398 |
|
399 */ |
|
400 |
|
401 void EventOccured(TInt aStatus, TEventType aType, TDesC8* aData); |
|
402 |
|
403 |
|
404 |
|
405 protected: // Methods |
|
406 |
|
407 |
|
408 |
|
409 /** |
|
410 |
|
411 * Overwrites the default implementation to catch the ip version reading from the |
|
412 |
|
413 * database. This value is retrieved from the VPN Manager Server. |
|
414 |
|
415 * @param aField Colum name in the CommDb. Ip version colum name is SERVICE_IF_NETWORKS. |
|
416 |
|
417 * @param aValue Value to be returned. In SERVICE_IF_NETWORKS case it's ip or ip6. |
|
418 |
|
419 * @param aMessage Message to validate capabilities |
|
420 |
|
421 * @return Returns KErrNone if the function succeed. Otherwise it returns system wide |
|
422 |
|
423 * error code. |
|
424 |
|
425 */ |
|
426 |
|
427 TInt DoReadDes(const TDesC& aField, TDes16& aValue, const RMessagePtr2* aMessage ); |
|
428 |
|
429 |
|
430 |
|
431 |
|
432 |
|
433 /** |
|
434 |
|
435 * Returns the pointer to the parameter object defined in vpnconnagtdefs.h. |
|
436 |
|
437 * @return The pointer to the connection parameter object. |
|
438 |
|
439 */ |
|
440 |
|
441 TVPNParameters* VPNParameters() { return &iVPNParameters; }; |
|
442 |
|
443 |
|
444 |
|
445 /** |
|
446 |
|
447 * Returns the pointer to the name of the VPN Nif sent by the nif itself. |
|
448 |
|
449 * @return The pointer to the TName type object containing the name of the |
|
450 |
|
451 * VPN Nif. |
|
452 |
|
453 */ |
|
454 |
|
455 TName* VPNNifName(void){ return iVPNParameters.GetVPNNifName();}; |
|
456 |
|
457 |
|
458 |
|
459 /** |
|
460 |
|
461 * Returns the pointer to the interface from the Agent to Nifman. This interface |
|
462 |
|
463 * is used to e.g. send progress notifications from Agent to Nifman. |
|
464 |
|
465 * @return The pointer to the interface from the Agent to Nifman. |
|
466 |
|
467 */ |
|
468 |
|
469 MNifAgentNotify* Notify() { return iNotify; }; |
|
470 |
|
471 |
|
472 |
|
473 /** |
|
474 |
|
475 * After deactivationing/unloading of the VPN Policies Nifman is informed with the |
|
476 |
|
477 * progress call (with EVPNConnAgtDisconnected). |
|
478 |
|
479 * MNifAgentNotify interface's DisconnectComplete() is called (this generates the deletion |
|
480 |
|
481 * of the VPN Nif and at the end deletion of the agent. |
|
482 |
|
483 * |
|
484 |
|
485 */ |
|
486 |
|
487 void VPNDisconnCompleted(TInt aError); |
241 void VPNDisconnCompleted(TInt aError); |
488 |
242 |
489 |
|
490 |
|
491 private: // Methods |
243 private: // Methods |
492 |
244 /** |
493 |
|
494 |
|
495 /** |
|
496 |
|
497 * Second phase constructor. |
245 * Second phase constructor. |
498 |
246 */ |
499 */ |
|
500 |
|
501 void ConstructL(); |
247 void ConstructL(); |
502 |
248 |
503 |
249 /** |
504 |
|
505 /** |
|
506 |
|
507 * Default constructor. |
250 * Default constructor. |
508 |
251 */ |
509 */ |
|
510 |
|
511 CVPNConnAgt(); |
252 CVPNConnAgt(); |
512 |
253 |
513 |
254 /** |
514 |
|
515 /** |
|
516 |
|
517 * CallBack to start the service (means the connection creation). |
255 * CallBack to start the service (means the connection creation). |
518 |
|
519 * @param aThisPtr Pointer to the CVPNConnAgt type object. |
256 * @param aThisPtr Pointer to the CVPNConnAgt type object. |
520 |
|
521 * @return Always returns KErrNone. |
257 * @return Always returns KErrNone. |
522 |
258 */ |
523 */ |
|
524 |
|
525 static TInt ServiceStartedCb(TAny* aThisPtr); |
259 static TInt ServiceStartedCb(TAny* aThisPtr); |
526 |
260 |
527 |
261 /** |
528 |
|
529 /** |
|
530 |
|
531 * CallBack to complete the connection. |
262 * CallBack to complete the connection. |
532 |
|
533 * @param aThisPtr Pointer to the CVPNConnAgt type object. |
263 * @param aThisPtr Pointer to the CVPNConnAgt type object. |
534 |
|
535 * @return Always returns KErrNone. |
264 * @return Always returns KErrNone. |
536 |
265 */ |
537 */ |
|
538 |
|
539 static TInt ConnectCompleteCb(TAny* aThisPtr); |
266 static TInt ConnectCompleteCb(TAny* aThisPtr); |
540 |
267 |
541 |
268 /** |
542 |
|
543 /** |
|
544 |
|
545 * CallBack to disconnect. |
269 * CallBack to disconnect. |
546 |
|
547 * @param aThisPtr Pointer to the CVPNConnAgt type object. |
270 * @param aThisPtr Pointer to the CVPNConnAgt type object. |
548 |
|
549 * @return Always returns KErrNone. |
271 * @return Always returns KErrNone. |
550 |
272 */ |
551 */ |
|
552 |
|
553 static TInt DisconnectCompleteCb(TAny* aThisPtr); |
273 static TInt DisconnectCompleteCb(TAny* aThisPtr); |
554 |
274 |
555 |
275 /** |
556 |
|
557 /** |
|
558 |
|
559 * Reads needed configuration settings from the CommDb database. |
276 * Reads needed configuration settings from the CommDb database. |
560 |
277 */ |
561 */ |
|
562 |
|
563 void ReadConfigurationL(); |
278 void ReadConfigurationL(); |
564 |
279 |
565 |
280 /** |
566 |
|
567 /** |
|
568 |
|
569 * Starts the listening of real interface events. |
281 * Starts the listening of real interface events. |
570 |
282 */ |
571 */ |
|
572 |
|
573 void ListenRealIAP(); |
283 void ListenRealIAP(); |
574 |
284 |
575 |
285 /** |
576 |
|
577 /** |
|
578 |
|
579 * Starts the listening of virtual nif address change event. |
286 * Starts the listening of virtual nif address change event. |
580 |
287 */ |
581 */ |
|
582 |
|
583 void ListenAddressChange(); |
288 void ListenAddressChange(); |
584 |
289 |
585 |
290 /** |
586 |
|
587 /** |
|
588 |
|
589 * Cancels the listening of the real interface events and the |
291 * Cancels the listening of the real interface events and the |
590 |
|
591 * listening of virtual nif address change event. |
292 * listening of virtual nif address change event. |
592 |
293 */ |
593 */ |
|
594 |
|
595 void CancelListeners(); |
294 void CancelListeners(); |
596 |
295 |
597 |
|
598 |
|
599 |
|
600 |
|
601 private: |
296 private: |
602 |
297 /** |
603 |
|
604 |
|
605 /** |
|
606 |
|
607 * Defines the internal states. |
298 * Defines the internal states. |
608 |
299 */ |
609 */ |
|
610 |
|
611 enum TRequestState |
300 enum TRequestState |
612 |
|
613 { |
301 { |
614 |
|
615 EGettingProtocolVersion, |
302 EGettingProtocolVersion, |
616 |
|
617 EConnecting, |
303 EConnecting, |
618 |
|
619 EConnected, |
304 EConnected, |
620 |
|
621 EClosingConnection, |
305 EClosingConnection, |
622 |
|
623 EConnectionClosed, |
306 EConnectionClosed, |
624 |
|
625 EStartingRealIf, |
307 EStartingRealIf, |
626 |
|
627 EListeningEvents, |
308 EListeningEvents, |
628 |
|
629 EIdle |
309 EIdle |
630 |
|
631 }; |
310 }; |
632 |
311 |
633 |
|
634 |
|
635 |
|
636 |
|
637 /** CallBack object to implement ServiceStarted asynchronously. */ |
312 /** CallBack object to implement ServiceStarted asynchronously. */ |
638 |
|
639 CAsyncCallBack iServiceStartedCallback; |
313 CAsyncCallBack iServiceStartedCallback; |
640 |
314 |
641 |
|
642 |
|
643 /** CallBack object to implement ConnectCompleted asynchronously. */ |
315 /** CallBack object to implement ConnectCompleted asynchronously. */ |
644 |
|
645 CAsyncCallBack iConnectCompleteCallback; |
316 CAsyncCallBack iConnectCompleteCallback; |
646 |
317 |
647 |
|
648 |
|
649 /** CallBack object to implement Disconnect asynchronously. */ |
318 /** CallBack object to implement Disconnect asynchronously. */ |
650 |
|
651 CAsyncCallBack iDisconnectCallback; |
319 CAsyncCallBack iDisconnectCallback; |
652 |
320 |
653 |
|
654 |
|
655 /** Defines wether Agent is connected (Connection completed successfully). */ |
321 /** Defines wether Agent is connected (Connection completed successfully). */ |
656 |
|
657 TBool iConnected; |
322 TBool iConnected; |
658 |
323 |
659 |
|
660 |
|
661 /** Connection configuration parameter member object. See vpnconnagtdefs.h. */ |
324 /** Connection configuration parameter member object. See vpnconnagtdefs.h. */ |
662 |
|
663 TVPNParameters iVPNParameters; |
325 TVPNParameters iVPNParameters; |
664 |
326 |
665 |
|
666 |
|
667 /** An integer to keep last error code in memory. */ |
327 /** An integer to keep last error code in memory. */ |
668 |
|
669 TInt iLastErrorCode; |
328 TInt iLastErrorCode; |
670 |
329 |
671 |
|
672 |
|
673 /** An API to EventMediator */ |
330 /** An API to EventMediator */ |
674 |
|
675 REventMediator iEventMediator; |
331 REventMediator iEventMediator; |
676 |
332 |
677 |
|
678 |
|
679 /** Tells if vpnconnagt must close tunnelnif */ |
333 /** Tells if vpnconnagt must close tunnelnif */ |
680 |
|
681 TBool iEventActivatedClose; |
334 TBool iEventActivatedClose; |
682 |
335 |
683 |
|
684 |
|
685 /** This defines the shutdown type to the kmd. Value 0 is normal and 1 is to |
336 /** This defines the shutdown type to the kmd. Value 0 is normal and 1 is to |
686 |
|
687 force it to shutdown without trying to send any packets anymore */ |
337 force it to shutdown without trying to send any packets anymore */ |
688 |
|
689 TDeactivateType iDisconnectType; |
338 TDeactivateType iDisconnectType; |
690 |
339 |
691 |
|
692 |
|
693 /* State of the agent object */ |
340 /* State of the agent object */ |
694 |
|
695 TRequestState iState; |
341 TRequestState iState; |
696 |
342 |
697 |
|
698 |
|
699 /** Boolean to define wether disconnecting operation is ongoing */ |
343 /** Boolean to define wether disconnecting operation is ongoing */ |
700 |
|
701 TBool iDisconnecting; |
344 TBool iDisconnecting; |
702 |
345 |
703 |
|
704 |
|
705 /** PckgBufs used when creating connection through eventmediator api */ |
346 /** PckgBufs used when creating connection through eventmediator api */ |
706 |
|
707 TPckgBuf<TGetProtocolVersionEventSpec> iProtocolVersionDes; |
347 TPckgBuf<TGetProtocolVersionEventSpec> iProtocolVersionDes; |
708 |
|
709 TPckgBuf<TStartVpnConnEventSpec> iStartVpnConnDes; |
348 TPckgBuf<TStartVpnConnEventSpec> iStartVpnConnDes; |
710 |
|
711 TPckgBuf<TCloseVpnConnEventSpec> iCloseVpnConnDes; |
349 TPckgBuf<TCloseVpnConnEventSpec> iCloseVpnConnDes; |
712 |
|
713 TPckgBuf<TObserveRealIapConnEventSpec> iObserveRealIapConnDes; |
350 TPckgBuf<TObserveRealIapConnEventSpec> iObserveRealIapConnDes; |
714 |
|
715 |
|
716 |
|
717 /** Poiter to an object which confirms disconnect operation to Nifman */ |
|
718 |
|
719 CAsyncDisconnecter* iAD; |
|
720 |
|
721 }; |
351 }; |
722 |
352 |
723 |
|
724 |
|
725 class CAsyncDisconnecter : public CAsyncOneShot |
|
726 |
|
727 { |
|
728 |
|
729 /** |
|
730 |
|
731 @internalComponent |
|
732 |
|
733 */ |
|
734 |
|
735 public: |
|
736 |
|
737 static CAsyncDisconnecter* NewL(CVPNConnAgt* aAgent); |
|
738 |
|
739 void ConfirmDisconnect(); |
|
740 |
|
741 |
|
742 |
|
743 private: |
|
744 |
|
745 CAsyncDisconnecter(CVPNConnAgt* aAgent); |
|
746 |
|
747 void RunL(); // From CAsyncOneShot |
|
748 |
|
749 |
|
750 |
|
751 private: |
|
752 |
|
753 CVPNConnAgt* iAgent; |
|
754 |
|
755 }; |
|
756 |
|
757 |
|
758 |
|
759 #endif // VPN_CONN_AGT_H |
353 #endif // VPN_CONN_AGT_H |
760 |
354 |