|
1 /* |
|
2 * Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: VPN connection starter |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __VPN_CONN_STARTER_H__ |
|
19 #define __VPN_CONN_STARTER_H__ |
|
20 |
|
21 #include "sit.h" |
|
22 #include "taskhandler.h" |
|
23 #include "vpnapi.h" |
|
24 #include "kmdapi.h" |
|
25 #include "ipsecpolapi.h" |
|
26 #include "eventlogger.h" |
|
27 #include "spdb.h" // CSecPolBundleList |
|
28 #include "eventdefssit.h" |
|
29 |
|
30 class CIkeData; |
|
31 |
|
32 /** |
|
33 * VPN connection starter task handler |
|
34 * |
|
35 * @lib (internal) eventmedsit.lib |
|
36 * @since S60 3.0 |
|
37 */ |
|
38 NONSHARABLE_CLASS(CVpnConnStarter) : public CTaskHandler |
|
39 { |
|
40 public: |
|
41 static CVpnConnStarter* NewL(MTaskHandlerManager* aManager, |
|
42 const TTaskArrivedEventData& aTaskInfo); |
|
43 ~CVpnConnStarter(); |
|
44 |
|
45 private: // From CTaskHandler |
|
46 void StartTaskHandling(); |
|
47 void ChangeStateL(); |
|
48 void CancelOngoingOperation(); |
|
49 void ReportResult(TInt aStatus); |
|
50 |
|
51 private: // From CActive |
|
52 TInt RunError(TInt aError); |
|
53 |
|
54 private: |
|
55 CVpnConnStarter(MTaskHandlerManager* aManager, |
|
56 const TTaskArrivedEventData& aTaskInfo); |
|
57 void ConstructL(); |
|
58 |
|
59 void StateStartRealIap(); |
|
60 void StateRealIapConnectedL(); |
|
61 void StateGetVpnPolicyL(); |
|
62 void StateActivateKmdL(); |
|
63 void StateAfterActivateKmdL(); |
|
64 void StateLoadIpsecPolicy(); |
|
65 void StateAfterLoadIpsecPolicyL(); |
|
66 void StateActivateIpsecPolicy(); |
|
67 void StateAfterActivateIpsecPolicyL(); |
|
68 |
|
69 void RollbackProcess(); |
|
70 void ResolveIpsecFQDNL(CSecPolBundleList* aSecPolBundleList); |
|
71 void ResolveIkeFQDNL(CIkeData* aIkeData); |
|
72 TInetAddr ResolveFQDNL(const TDesC& aAddress); |
|
73 |
|
74 /** |
|
75 * FormCustomTrafficSelectorsL |
|
76 * Store custom traffic selectors for IPsec |
|
77 * if there's something in IKE policy that requires |
|
78 * them. Nokia specific NAT-T is one feature that |
|
79 * needs custom traffic selectors. |
|
80 * @param aIkeData CIkeData pointer |
|
81 */ |
|
82 void FormCustomTrafficSelectorsL(CIkeData *aIkeData); |
|
83 |
|
84 /** |
|
85 * InsertCustomTrafficSelectorsL |
|
86 * Insert custom traffic selectors to policy buffer |
|
87 * made by ipsecpolparser. Custom selector definitions |
|
88 * are inserted right after [POLICY]\n string. |
|
89 */ |
|
90 void InsertCustomTrafficSelectorsL(); |
|
91 |
|
92 void GetIkePolicyFromVpnPolicyL(const TDesC& aVpnPolicy); |
|
93 void GetIpsecPolicyFromVpnPolicyL(const TDesC& aVpnPolicy); |
|
94 void LoadIpsecPolicy(); |
|
95 |
|
96 void IsDhcpEnabledL(TBool& aDhcpEnabled); |
|
97 |
|
98 #if defined(__PFX_MIP4__) |
|
99 TBool IsMip4FeaturePresent(void); |
|
100 #endif |
|
101 |
|
102 private: // data |
|
103 TPckgBuf<TStartVpnConnEventSpec> iEventSpecDes; |
|
104 |
|
105 RVpnServ iVpnServ; |
|
106 RKMD iKmdServ; |
|
107 RIpsecPolicyServ iPolicyServ; |
|
108 |
|
109 HBufC8* iIkePolicyData; |
|
110 HBufC8* iIpsecPolicyData; |
|
111 |
|
112 // Custom IPsec traffic selectors |
|
113 HBufC8 *iCustomTs; |
|
114 |
|
115 TPolicyHandlePckg iIpsecPolicyHandleDes; |
|
116 |
|
117 TUint iProcessingFlags; |
|
118 |
|
119 TVPNAddress iVpnAddressInfo; |
|
120 TVPNAddressPckg iVpnAddressInfoDes; |
|
121 |
|
122 TUint32 iVpnIapId; |
|
123 |
|
124 TVpnRealConnectionParams iIfInfo; |
|
125 TPckg<TVpnRealConnectionParams> iIfInfoDes; |
|
126 |
|
127 TZoneInfoSetPckg iZoneInfoSetDes; |
|
128 |
|
129 DEFINE_EVENT_LOGGER |
|
130 }; |
|
131 |
|
132 #endif // __VPN_CONN_STARTER_H__ |