author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:35:46 +0300 | |
branch | RCL_3 |
changeset 55 | 9c2aa05919d9 |
parent 46 | c74b3d9f6b9e |
permissions | -rw-r--r-- |
46 | 1 |
/* |
2 |
* Copyright (c) 2001-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 the License "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: Declaration of class CWPASecuritySettingsImpl. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
/* |
|
55
9c2aa05919d9
Revision: 201036
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
19 |
* %version: tr1cfwln#26 % |
46 | 20 |
*/ |
21 |
||
22 |
#ifndef WPASECURITYSETTINGSIMPL_H |
|
23 |
#define WPASECURITYSETTINGSIMPL_H |
|
24 |
||
25 |
// INCLUDES |
|
26 |
#include <e32base.h> |
|
27 |
#include <WlanCdbCols.h> |
|
28 |
||
29 |
#include <WPASecuritySettingsUI.h> |
|
30 |
||
31 |
#include <metadatabase.h> |
|
32 |
using namespace CommsDat; |
|
33 |
||
34 |
||
35 |
||
36 |
// CONST DECLARATIONS |
|
37 |
#define KWLANEAPLISTLENGTH 1024 // Max length of the EAP Plugin list |
|
38 |
||
39 |
||
40 |
// FORWARD DECLARATIONS |
|
41 |
class CCommsDatabase; |
|
42 |
class CEAPPluginConfigurationIf; |
|
43 |
||
44 |
// CLASS DECLARATION |
|
45 |
||
46 |
/** |
|
47 |
* WPA Security Settings. |
|
48 |
* Implementation behind proxy class CWPASecuritySettings. |
|
49 |
*/ |
|
50 |
NONSHARABLE_CLASS( CWPASecuritySettingsImpl ) : public CBase |
|
51 |
{ |
|
52 |
||
53 |
public: // Constructors and destructor |
|
54 |
||
55 |
/** |
|
56 |
* Two-phased constructor. Leaves on failure. |
|
57 |
* @param aSecurityMode The chosen security mode. It can be |
|
58 |
* ESecurityMode8021x or ESecurityModeWpa |
|
59 |
* @return The constructed CWPASecuritySettings object. |
|
60 |
*/ |
|
61 |
static CWPASecuritySettingsImpl* NewL( TSecurityMode aSecurityMode ); |
|
62 |
||
63 |
/** |
|
64 |
* Destructor. |
|
65 |
*/ |
|
66 |
virtual ~CWPASecuritySettingsImpl(); |
|
67 |
||
68 |
||
69 |
protected: // Constructors |
|
70 |
||
71 |
/** |
|
72 |
* Constructor. |
|
73 |
* @param aSecurityMode The chosen security mode. It can be |
|
74 |
* ESecurityMode8021x or ESecurityModeWpa |
|
75 |
*/ |
|
76 |
CWPASecuritySettingsImpl( TSecurityMode aSecurityMode ); |
|
77 |
||
78 |
/** |
|
79 |
* Second-phase constructor. |
|
80 |
*/ |
|
81 |
void ConstructL(); |
|
82 |
||
83 |
||
84 |
public: // New methods |
|
85 |
||
86 |
/** |
|
87 |
* Load from database. |
|
88 |
* @param aIapId Wlan Service Table Id of the IAP to be loaded |
|
89 |
* @param aCommsDb Comms database. |
|
90 |
*/ |
|
91 |
void LoadL( TUint32 aIapId, CCommsDatabase& aCommsDb ); |
|
92 |
||
93 |
||
94 |
/** |
|
95 |
* Save to database. |
|
96 |
* @param aIapId Wlan Service Table Id of the IAP to be saved |
|
97 |
* @param aCommsDb Comms database. |
|
98 |
* @param aTypeOfSaving Tells what kind of AP we are going to save: it |
|
99 |
* can be ESavingEditedAP, ESavingBrandNewAP, or |
|
100 |
* ESavingNewAPAsACopy |
|
101 |
* @param aOldIapId The old Id of the IAP; it is used to save the EAP |
|
102 |
* configuration, only when aIsNewAP is ETrue |
|
103 |
*/ |
|
104 |
void SaveL( TUint32 aIapId, CCommsDatabase& aCommsDb, |
|
105 |
TTypeOfSaving aTypeOfSaving, TUint32 aOldIapId ); |
|
106 |
||
107 |
||
108 |
/** |
|
109 |
* Delete from database. It actually just removes EAP Configuration. |
|
110 |
* @param aIapId Id of the IAP to be saved |
|
111 |
*/ |
|
112 |
void DeleteL( TUint32 aIapId ); |
|
113 |
||
114 |
||
115 |
/** |
|
116 |
* Tells if the settings are valid and can be saved |
|
117 |
* @return ETrue if all the compulsory settings have been entered |
|
118 |
*/ |
|
119 |
TBool IsValid(); |
|
120 |
||
121 |
||
122 |
/** |
|
123 |
* Sets the Pre-shared key |
|
124 |
* @param aPreSharedKey The key to be set |
|
125 |
* @return KErrNone if successful, or an error code |
|
126 |
*/ |
|
127 |
TInt SetWPAPreSharedKey( const TDesC& aPreSharedKey ); |
|
128 |
||
129 |
/** |
|
130 |
* Gets the type of Security set. |
|
131 |
* @return The security mode in use. It can be ESecurityMode8021x or |
|
132 |
* ESecurityModeWpa |
|
133 |
*/ |
|
134 |
inline TSecurityMode SecurityMode() const; |
|
135 |
||
136 |
||
137 |
/** |
|
138 |
* Tells if Pre-shared key is in use or not |
|
139 |
* @return ETrue if Pre-shared key is in use |
|
140 |
*/ |
|
141 |
inline TBool WPAMode() const; |
|
142 |
||
143 |
||
144 |
/** |
|
145 |
* Sets the use of Pre-shared key. |
|
146 |
* @param aWPAMode ETrue if pre-shared key is in use |
|
147 |
*/ |
|
148 |
inline void SetWPAMode( const TBool aWPAMode ); |
|
149 |
||
150 |
||
151 |
/** |
|
152 |
* Tells if it is WPA2 Only mode |
|
153 |
* @return ETrue if it is WPA2 Only mode |
|
154 |
*/ |
|
155 |
inline TBool Wpa2Only() const; |
|
156 |
||
157 |
||
158 |
/** |
|
159 |
* Sets the WPA2 Only mode enabling variable |
|
160 |
* @param aAllowed ETrue if WPA2 Only mode is enabled |
|
161 |
*/ |
|
162 |
inline void SetWpa2Only( const TBool aAllowed ); |
|
163 |
||
164 |
||
165 |
/** |
|
166 |
* Returns the Pre-shared key |
|
167 |
* @return The pre-shared key |
|
168 |
*/ |
|
169 |
inline TDes8* WPAPreSharedKey(); |
|
170 |
||
171 |
||
172 |
/** |
|
173 |
* Sets the Pre-shared key |
|
174 |
* @param aPreSharedKey The key to be set |
|
175 |
*/ |
|
176 |
inline void SetWPAPreSharedKey( const TDesC8& aPreSharedKey ); |
|
177 |
||
178 |
||
179 |
/** |
|
180 |
* Returns the content of the WlanEapList column of WLANServiceTable |
|
181 |
* @return The content string |
|
182 |
*/ |
|
183 |
inline TDes* WPAEAPPlugin(); |
|
184 |
||
185 |
/** |
|
186 |
* Returns the content of the WlanEnabledEapList column of |
|
187 |
* WLANServiceTable |
|
188 |
* @return The content string. Ownership not passed! |
|
189 |
*/ |
|
190 |
inline HBufC8* WPAEnabledEAPPlugin(); |
|
191 |
||
192 |
/** |
|
193 |
* Returns the content of the WlanDisabledEapList column of |
|
194 |
* WLANServiceTable |
|
195 |
* @return The content string. Ownership not passed! |
|
196 |
*/ |
|
197 |
inline HBufC8* WPADisabledEAPPlugin(); |
|
198 |
||
199 |
/** |
|
200 |
* Sets the content of the WlanEapList column of WLANServiceTable |
|
201 |
* @param aPluginList The content string to be set |
|
202 |
*/ |
|
203 |
inline void SetWPAEAPPlugin( const TDes& aPluginList ); |
|
204 |
||
205 |
/** |
|
206 |
* Sets the content of the WlanEnabledEapList column of WLANServiceTable |
|
207 |
* (for expanded EAP types) |
|
208 |
* @param aEnabledPluginList Enumeration of enabled plugins |
|
209 |
* @return KErrNone if successful, or an error code |
|
210 |
*/ |
|
211 |
TInt SetWPAEnabledEAPPlugin( const TDesC8& aEnabledPluginList ); |
|
212 |
||
213 |
/** |
|
214 |
* Sets the content of the WlanDisabledEapList column of WLANServiceTable |
|
215 |
* (for expanded EAP types) |
|
216 |
* @param aDisabledPluginList Enumeration of disabled plugins |
|
217 |
* @return KErrNone if successful, or an error code |
|
218 |
*/ |
|
219 |
TInt SetWPADisabledEAPPlugin( const TDesC8& aDisabledPluginList ); |
|
220 |
||
221 |
/** |
|
222 |
* Sets the Id of the AP |
|
223 |
* @param aIapId The Id to be set |
|
224 |
*/ |
|
225 |
inline void SetIapId( const TUint32 aIapId ); |
|
226 |
||
227 |
/** |
|
228 |
* Returns the Id of the AP |
|
229 |
* @return The Id |
|
230 |
*/ |
|
231 |
inline const TUint32 IapId(); |
|
232 |
||
233 |
/** |
|
234 |
* Returns the pointer to the EAP Configuration plugin |
|
235 |
* @return The EAP Configuration plugin |
|
236 |
*/ |
|
237 |
inline CEAPPluginConfigurationIf* Plugin(); |
|
238 |
||
239 |
/** |
|
240 |
* Load from database. |
|
241 |
* @param aIapId Wlan Service Table Id of the IAP to be loaded |
|
242 |
* @param aSession CommsDat session. |
|
243 |
*/ |
|
244 |
void LoadL( TUint32 aIapId, CMDBSession& aSession ); |
|
245 |
||
246 |
||
247 |
/** |
|
248 |
* Save to database. |
|
249 |
* @param aIapId Wlan Service Table Id of the IAP to be saved |
|
250 |
* @param aSession CommsDat session. |
|
251 |
* @param aTypeOfSaving Tells what kind of AP we are going to save: it |
|
252 |
* can be ESavingEditedAP, ESavingBrandNewAP, or |
|
253 |
* ESavingNewAPAsACopy |
|
254 |
* @param aOldIapId The old Id of the IAP; it is used to save the EAP |
|
255 |
* configuration, only when aIsNewAP is ETrue |
|
256 |
*/ |
|
257 |
void SaveL( TUint32 aIapId, CMDBSession& aSession, |
|
258 |
TTypeOfSaving aTypeOfSaving, TUint32 aOldIapId ); |
|
259 |
||
260 |
private: |
|
261 |
/** |
|
262 |
* Checks whether the given string is a valid PSK |
|
263 |
* @since S60 5.0 |
|
264 |
* @param aPsk The string to be checked |
|
265 |
* @return ETrue if the string is a valid PSK, EFalse otherwise. |
|
266 |
*/ |
|
267 |
TBool IsValidPsk( const TDesC8& aPsk ); |
|
268 |
||
269 |
private: // Data |
|
270 |
||
271 |
// Security mode in use |
|
272 |
TSecurityMode iSecurityMode; |
|
273 |
||
274 |
// Pre-shared key in use or not |
|
275 |
TBool iWPAMode; |
|
276 |
||
277 |
// The content of the WlanEapList column of WLANServiceTable |
|
278 |
TBuf<KWLANEAPLISTLENGTH> iWPAEAPPlugin; |
|
279 |
||
280 |
// The pre-shared key |
|
281 |
TBuf8<KWlanWpaPskLength> iWPAPreSharedKey; |
|
282 |
||
283 |
// The content of the WlanEnabledEapList column of WLANServiceTable. |
|
284 |
// Owned. |
|
285 |
HBufC8 *iWPAEnabledEAPPlugin; |
|
286 |
||
287 |
// The content of the WlanDisabledEapList column of WLANServiceTable. |
|
288 |
// Owned. |
|
289 |
HBufC8 *iWPADisabledEAPPlugin; |
|
290 |
||
291 |
// WPA2 Only mode enabled or not |
|
292 |
TBool iWpa2Only; |
|
293 |
||
294 |
// The Id of the AP. |
|
295 |
TUint32 iIapId; |
|
296 |
||
297 |
// The EAP Configuration plugin. Owned. |
|
298 |
CEAPPluginConfigurationIf* iPlugin; |
|
299 |
}; |
|
300 |
||
301 |
// Include inline functions |
|
302 |
#include "WPASecuritySettingsImpl.inl" |
|
303 |
||
304 |
||
305 |
#endif |