|
1 /* |
|
2 * Copyright (c) 2002-2006 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: Implementation of iapsettings |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef HSSIAPSETTINGSHANDLER_H |
|
20 #define HSSIAPSETTINGSHANDLER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include "hssiapsettings.h" |
|
25 #include <EapSettings.h> |
|
26 #include <commsdattypesv1_1.h> |
|
27 #include <commdb.h> |
|
28 #include <wdbifwlansettings.h> |
|
29 #include <cmpluginwlandef.h> |
|
30 #include <wlanmgmtclient.h> |
|
31 |
|
32 // CONSTANTS |
|
33 |
|
34 /** |
|
35 * Max attempts to reserve a trasnaction for secure key saving to IAP |
|
36 */ |
|
37 const TUint KHssMaxTransAttempts = 10; |
|
38 |
|
39 /** |
|
40 * Max wait time between secure key saving attempts |
|
41 */ |
|
42 const TUint KHssRetryAfter = 100000; |
|
43 |
|
44 _LIT( KGenericTable, "WLANServiceTable"); |
|
45 _LIT8(KEapPlus,"+0"); |
|
46 _LIT8(KDot,", "); |
|
47 |
|
48 _LIT8(KMark1, "[" ); |
|
49 _LIT8(KMark2, "]" ); |
|
50 |
|
51 _LIT8(KEapNone,"0"); |
|
52 _LIT8(KEapGtc,"6"); |
|
53 _LIT8(KEapTls,"13"); |
|
54 _LIT8(KEapLeap,"17"); |
|
55 _LIT8(KEapSim,"18"); |
|
56 _LIT8(KEapTtls,"21"); |
|
57 _LIT8(KEapAka,"23"); |
|
58 _LIT8(KEapPeap,"25"); |
|
59 _LIT8(KEapMschapv2,"26"); |
|
60 _LIT8(KEapSecurid,"32"); |
|
61 _LIT8(KEapPlainMschapv2,"99"); |
|
62 |
|
63 const TUint8 KEapNoneId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; |
|
64 const TUint8 KEapTlsId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d}; |
|
65 const TUint8 KEapGtcId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06}; |
|
66 const TUint8 KEapLeapId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11}; |
|
67 const TUint8 KEapSimId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12}; |
|
68 const TUint8 KEapTtlsId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15}; |
|
69 const TUint8 KEapAkaId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17}; |
|
70 const TUint8 KEapPeapId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19}; |
|
71 const TUint8 KEapMschapv2Id[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A}; |
|
72 const TUint8 KEapSecuridId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20}; |
|
73 const TUint8 KEapPlainMschapv2Id[] = {0xfe, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x63}; |
|
74 |
|
75 const TInt KEapLength = 2; |
|
76 const TUint KEapListMaxLength = 1024; |
|
77 const TUint KEapExpandedIdLength = 8; |
|
78 |
|
79 // WLAN Service Table |
|
80 const TMDBElementId KCDTIdWlanServiceId = 0x00030000; |
|
81 const TMDBElementId KCDTIdWlanConnMode = 0x00040000; |
|
82 |
|
83 const TMDBElementId KCDTIdWlanSSID = 0x00050000; |
|
84 const TMDBElementId KCDTIdWlanWepKey1 = 0x00060000; //EDesC8 |
|
85 const TMDBElementId KCDTIdWlanWepKey2 = 0x00070000; //EDesC8 |
|
86 const TMDBElementId KCDTIdWlanWepKey3 = 0x00080000; //EDesC8 |
|
87 const TMDBElementId KCDTIdWlanWepKey4 = 0x00090000; //EDesC8 |
|
88 const TMDBElementId KCDTIdWlanWepIndex = 0x000A0000; //EUint32 |
|
89 const TMDBElementId KCDTIdWlanSecMode = 0x000B0000; //EUint32 |
|
90 const TMDBElementId KCDTIdWlanAuthMode = 0x000C0000; //EUint32 |
|
91 const TMDBElementId KCDTIdWlanEnableWpaPsk = 0x000D0000; //EUint32 |
|
92 const TMDBElementId KCDTIdWlanWpaPreSharedKey = 0x000E0000; //EDesC8 |
|
93 |
|
94 const TMDBElementId KCDTIdWlanWpaKeyLength = 0x000F0000; //EUint32 |
|
95 const TMDBElementId KCDTIdWlanEaps = 0x00100000; //ELongText |
|
96 const TMDBElementId KCDTIdWlanScanSSID = 0x00110000; |
|
97 const TMDBElementId KCDTIdWlanChannelID = 0x00120000; |
|
98 const TMDBElementId KCDTIdWlanUsedSSID = 0x00130000; |
|
99 const TMDBElementId KCDTIdWlanFormatKey1 = 0x00140000; |
|
100 const TMDBElementId KCDTIdWlanFormatKey2 = 0x00150000; |
|
101 const TMDBElementId KCDTIdWlanFormatKey3 = 0x00160000; |
|
102 const TMDBElementId KCDTIdWlanFormatKey4 = 0x00170000; |
|
103 const TMDBElementId KCDTIdWlanEnabledEaps = 0x00190000; |
|
104 const TMDBElementId KCDTIdWlanDisabledEaps = 0x001A0000; |
|
105 |
|
106 // CLASS DECLARATION |
|
107 /** |
|
108 * @brief IAP creator and settings handler |
|
109 */ |
|
110 class CHssIapSettingsHandler : public CBase |
|
111 { |
|
112 public: // Methods |
|
113 |
|
114 // Constructors and destructor |
|
115 |
|
116 /** |
|
117 * Static constructor. |
|
118 * @return Pointer to the constructed object. |
|
119 */ |
|
120 static CHssIapSettingsHandler* NewL( ); |
|
121 |
|
122 /** |
|
123 * Destructor. |
|
124 */ |
|
125 virtual ~CHssIapSettingsHandler(); |
|
126 |
|
127 /** |
|
128 * Create new IAP for client application use |
|
129 * @param aIapName, Name of IAP |
|
130 * @param aUid, UID of the client |
|
131 * @return Iap ID, Otherwise aIapId will be null |
|
132 */ |
|
133 void CreateClientIapL( const TDesC& aIapName, TUint32& aIapId, const TUid aUid ); |
|
134 |
|
135 /** |
|
136 * Create new IAP to Internet SNAP. |
|
137 */ |
|
138 void CreateIapL(); |
|
139 |
|
140 /** |
|
141 * Deletes the IAP |
|
142 * @param aIapID, IAP id |
|
143 */ |
|
144 void DeleteIapL( const TUint aIapId ); |
|
145 |
|
146 /** |
|
147 * Finds client if found return its UID |
|
148 * @param aIapId, IAP id |
|
149 * @param aUid, UID id |
|
150 * @param aUidText, UID id as a descriptor. Without[]. |
|
151 * @return KErrNone, if successful, otherwise one of system wide errorcodes. |
|
152 */ |
|
153 TInt FindClientL( const TUint aIapId, TUid& aUid, TDes8& aUidText ); |
|
154 |
|
155 protected: |
|
156 |
|
157 /** |
|
158 * C++ default constructor. |
|
159 */ |
|
160 CHssIapSettingsHandler(); |
|
161 |
|
162 /** |
|
163 * By default Symbian 2nd phase constructor is private. |
|
164 */ |
|
165 void ConstructL(); |
|
166 |
|
167 private: |
|
168 |
|
169 /** |
|
170 * Saves WEP key to newly created IAP |
|
171 * @param aFrom, From which IAP |
|
172 * @param aTo, To what IAP |
|
173 */ |
|
174 void SaveWEPKeyL( const TUint32 aFrom, const TUint32 aTo ); |
|
175 |
|
176 /** |
|
177 * Saves WPA key to newly created IAP |
|
178 * @param aFrom, From which IAP |
|
179 * @param aTo, To what IAP |
|
180 */ |
|
181 void SaveWPAKeyL( const TUint32 aFrom, const TUint32 aTo ); |
|
182 |
|
183 /** |
|
184 * Rolls back CMDBSession |
|
185 * @param aDbSession, Session to CommsDat |
|
186 */ |
|
187 static void RollbackCommsDat( TAny* aDbSession ); |
|
188 |
|
189 /** |
|
190 * Convert security mode types |
|
191 * @param aSecurityMode, WLAN connection security mode |
|
192 */ |
|
193 CMManager::TWlanSecMode ConvertConnectionSecurityModeToSecModeL( |
|
194 TWlanConnectionSecurityMode aSecurityMode ); |
|
195 |
|
196 /** |
|
197 * Convert connection mode types |
|
198 * @param aConnMode, WLAN connection mode |
|
199 */ |
|
200 CMManager::TWlanNetMode ConvertConnectionModeToNetModeL( |
|
201 TWlanConnectionMode aConnMode ); |
|
202 |
|
203 }; |
|
204 |
|
205 |
|
206 #endif |