35 #include "eap_type_mschapv2.h" |
35 #include "eap_type_mschapv2.h" |
36 #include "EapMsChapV2Global.h" |
36 #include "EapMsChapV2Global.h" |
37 #include <EapTypeInfo.h> |
37 #include <EapTypeInfo.h> |
38 #include "EapMsChapV2DbUtils.h" |
38 #include "EapMsChapV2DbUtils.h" |
39 |
39 |
|
40 #include "EapConversion.h" |
|
41 #include "EapTraceSymbian.h" |
40 |
42 |
41 // LOCAL CONSTANTS |
43 // LOCAL CONSTANTS |
42 |
44 |
43 // The version number of this interface. |
45 // The version number of this interface. |
44 const TUint KInterfaceVersion = 1; |
46 const TUint KInterfaceVersion = 1; |
45 |
47 |
46 |
48 |
47 // ================= MEMBER FUNCTIONS ======================= |
49 // ================= MEMBER FUNCTIONS ======================= |
48 |
50 |
49 |
51 |
50 CEapMsChapV2::CEapMsChapV2(const TIndexType aIndexType, |
52 CEapMsChapV2::CEapMsChapV2( |
51 const TInt aIndex, const eap_type_value_e aEapType /* =eap_type_mschapv2 */) |
53 const TIndexType aIndexType, |
|
54 const TInt aIndex, |
|
55 const eap_type_value_e aEapType) |
52 : iIndexType(aIndexType) |
56 : iIndexType(aIndexType) |
53 , iIndex(aIndex) |
57 , iIndex(aIndex) |
54 , iTunnelingType(eap_type_none) |
58 , iTunnelingType(eap_type_none) |
55 , iEapType(aEapType) |
59 , iEapType(aEapType) |
56 { |
60 { |
|
61 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapMsChapV2::CEapMsChapV2()\n"))); |
|
62 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapMsChapV2::CEapMsChapV2()\n")); |
|
63 |
57 } |
64 } |
58 |
65 |
59 // ---------------------------------------------------------- |
66 // ---------------------------------------------------------- |
60 |
67 |
61 CEapMsChapV2* CEapMsChapV2::NewL(SIapInfo *aIapInfo) |
68 CEapMsChapV2* CEapMsChapV2::NewL(SIapInfo *aIapInfo) |
62 { |
69 { |
63 return new (ELeave) CEapMsChapV2(aIapInfo->indexType, aIapInfo->index); |
70 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapMsChapV2::NewL()\n"))); |
|
71 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapMsChapV2::NewL()\n")); |
|
72 |
|
73 return new (ELeave) CEapMsChapV2(aIapInfo->indexType, aIapInfo->index, eap_type_mschapv2); |
64 } |
74 } |
65 |
75 |
66 // ---------------------------------------------------------- |
76 // ---------------------------------------------------------- |
67 |
77 |
68 CEapMsChapV2* CEapMsChapV2::NewPlainMSCHAPv2L(SIapInfo *aIapInfo) |
78 CEapMsChapV2* CEapMsChapV2::NewPlainMSCHAPv2L(SIapInfo *aIapInfo) |
69 { |
79 { |
|
80 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapMsChapV2::NewPlainMSCHAPv2L()\n"))); |
|
81 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapMsChapV2::NewPlainMSCHAPv2L()\n")); |
|
82 |
70 return new (ELeave) CEapMsChapV2( |
83 return new (ELeave) CEapMsChapV2( |
71 aIapInfo->indexType, |
84 aIapInfo->indexType, |
72 aIapInfo->index, |
85 aIapInfo->index, |
73 #if defined(USE_EAP_EXPANDED_TYPES) |
|
74 eap_expanded_type_ttls_plain_mschapv2.get_type() |
86 eap_expanded_type_ttls_plain_mschapv2.get_type() |
75 #else |
|
76 eap_type_plain_mschapv2 |
|
77 #endif //#if defined(USE_EAP_EXPANDED_TYPES) |
|
78 ); |
87 ); |
79 } |
88 } |
80 |
89 |
81 |
90 |
82 // ---------------------------------------------------------- |
91 // ---------------------------------------------------------- |
83 |
92 |
84 CEapMsChapV2::~CEapMsChapV2() |
93 CEapMsChapV2::~CEapMsChapV2() |
85 { |
94 { |
|
95 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapMsChapV2::~CEapMsChapV2()\n"))); |
|
96 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapMsChapV2::~CEapMsChapV2()\n")); |
|
97 |
86 } |
98 } |
87 |
99 |
88 // ---------------------------------------------------------- |
100 // ---------------------------------------------------------- |
89 |
101 |
90 #ifdef USE_EAP_SIMPLE_CONFIG |
102 #ifdef USE_EAP_SIMPLE_CONFIG |
149 |
164 |
150 // ---------------------------------------------------------- |
165 // ---------------------------------------------------------- |
151 |
166 |
152 TUint CEapMsChapV2::GetInterfaceVersion() |
167 TUint CEapMsChapV2::GetInterfaceVersion() |
153 { |
168 { |
|
169 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapMsChapV2::GetInterfaceVersion()\n"))); |
|
170 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapMsChapV2::GetInterfaceVersion()\n")); |
|
171 |
154 return KInterfaceVersion; |
172 return KInterfaceVersion; |
155 } |
173 } |
156 |
174 |
157 |
175 // ---------------------------------------------------------- |
158 // ---------------------------------------------------------- |
176 |
159 TInt CEapMsChapV2::InvokeUiL() |
177 CEapTypeInfo* CEapMsChapV2::GetInfoL() |
160 { |
178 { |
161 TInt buttonId(0); |
179 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapMsChapV2::GetInfoL()\n"))); |
162 |
180 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapMsChapV2::GetInfoL()\n")); |
163 return buttonId; |
181 |
164 } |
|
165 |
|
166 |
|
167 // ---------------------------------------------------------- |
|
168 CEapTypeInfo* CEapMsChapV2::GetInfoLC() |
|
169 { |
|
170 CEapTypeInfo* info = new(ELeave) CEapTypeInfo( |
182 CEapTypeInfo* info = new(ELeave) CEapTypeInfo( |
171 (TDesC&)KReleaseDate, |
183 (TDesC&)KReleaseDate, |
172 (TDesC&)KEapTypeVersion, |
184 (TDesC&)KEapTypeVersion, |
173 (TDesC&)KManufacturer); |
185 (TDesC&)KManufacturer); |
174 |
186 |
175 CleanupStack::PushL(info); |
|
176 return info; |
187 return info; |
177 } |
188 } |
178 |
189 |
179 // ---------------------------------------------------------- |
190 // ---------------------------------------------------------- |
180 |
191 |
181 void CEapMsChapV2::DeleteConfigurationL() |
192 void CEapMsChapV2::DeleteConfigurationL() |
182 { |
193 { |
|
194 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapMsChapV2::DeleteConfigurationL()\n"))); |
|
195 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapMsChapV2::DeleteConfigurationL()\n")); |
|
196 |
183 EapMsChapV2DbUtils::DeleteConfigurationL(iIndexType, iIndex, iTunnelingType); |
197 EapMsChapV2DbUtils::DeleteConfigurationL(iIndexType, iIndex, iTunnelingType); |
184 } |
198 } |
185 |
199 |
186 // ---------------------------------------------------------- |
200 // ---------------------------------------------------------- |
187 |
201 |
188 void CEapMsChapV2::SetTunnelingType(const TInt aTunnelingType) |
202 void CEapMsChapV2::SetTunnelingType(const TEapExpandedType aTunnelingType) |
189 { |
203 { |
190 #ifdef USE_EAP_EXPANDED_TYPES |
204 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapMsChapV2::SetTunnelingType()\n"))); |
191 |
205 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapMsChapV2::SetTunnelingType()\n")); |
192 // Vendor id is eap_type_vendor_id_ietf always in this plugin. |
206 |
193 iTunnelingType.set_eap_type_values(eap_type_vendor_id_ietf, aTunnelingType); |
207 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
194 |
208 (EAPL("CEapMsChapV2::SetTunnelingType - tunneling type"), |
195 #else |
209 aTunnelingType.GetValue().Ptr(), aTunnelingType.GetValue().Length())); |
196 |
210 |
197 iTunnelingType = static_cast<eap_type_value_e>(aTunnelingType); |
211 eap_type_value_e aInternalType; |
198 |
212 |
199 #endif //#ifdef USE_EAP_EXPANDED_TYPES |
213 TInt err = CEapConversion::ConvertExpandedEAPTypeToInternalType( |
200 } |
214 &aTunnelingType, |
201 |
215 &aInternalType); |
202 // ---------------------------------------------------------- |
216 |
|
217 iTunnelingType = aInternalType; |
|
218 |
|
219 } |
|
220 |
|
221 // ---------------------------------------------------------- |
|
222 |
203 void CEapMsChapV2::SetIndexL( |
223 void CEapMsChapV2::SetIndexL( |
204 const TIndexType aIndexType, |
224 const TIndexType aIndexType, |
205 const TInt aIndex) |
225 const TInt aIndex) |
206 { |
226 { |
|
227 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapMsChapV2::SetIndexL()\n"))); |
|
228 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapMsChapV2::SetIndexL()\n")); |
|
229 |
207 // First delete the target configuration |
230 // First delete the target configuration |
208 TIndexType tmpIndexType = iIndexType; |
231 TIndexType tmpIndexType = iIndexType; |
209 TInt tmpIndex = iIndex; |
232 TInt tmpIndex = iIndex; |
210 |
233 |
211 iIndexType = aIndexType; |
234 iIndexType = aIndexType; |
238 iTunnelingType); |
261 iTunnelingType); |
239 |
262 |
240 iIndexType = aIndexType; |
263 iIndexType = aIndexType; |
241 iIndex = aIndex; |
264 iIndex = aIndex; |
242 |
265 |
243 CleanupStack::PopAndDestroy(2); // db |
266 CleanupStack::PopAndDestroy(&db); |
|
267 CleanupStack::PopAndDestroy(&session); |
244 } |
268 } |
245 |
269 |
246 void CEapMsChapV2::SetConfigurationL(const EAPSettings& aSettings) |
270 void CEapMsChapV2::SetConfigurationL(const EAPSettings& aSettings) |
247 { |
271 { |
|
272 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapMsChapV2::SetConfigurationL()\n"))); |
|
273 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapMsChapV2::SetConfigurationL()\n")); |
|
274 |
248 RDbNamedDatabase db; |
275 RDbNamedDatabase db; |
249 |
276 |
250 RDbs session; |
277 RFs session; |
251 |
278 |
252 // This also creates the IAP entry if it doesn't exist |
279 // This also creates the IAP entry if it doesn't exist |
253 EapMsChapV2DbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType); |
280 EapMsChapV2DbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType); |
254 |
281 |
255 CleanupClosePushL(session); |
282 CleanupClosePushL(session); |
260 aSettings, |
287 aSettings, |
261 iIndexType, |
288 iIndexType, |
262 iIndex, |
289 iIndex, |
263 iTunnelingType); |
290 iTunnelingType); |
264 |
291 |
265 CleanupStack::PopAndDestroy(2); // db, session |
292 CleanupStack::PopAndDestroy(&db); |
|
293 CleanupStack::PopAndDestroy(&session); |
266 } |
294 } |
267 |
295 |
268 void CEapMsChapV2::GetConfigurationL(EAPSettings& aSettings) |
296 void CEapMsChapV2::GetConfigurationL(EAPSettings& aSettings) |
269 { |
297 { |
|
298 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapMsChapV2::GetConfigurationL()\n"))); |
|
299 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapMsChapV2::GetConfigurationL()\n")); |
|
300 |
270 RDbNamedDatabase db; |
301 RDbNamedDatabase db; |
271 |
302 |
272 RDbs session; |
303 RFs session; |
273 |
304 |
274 // This also creates the IAP entry if it doesn't exist |
305 // This also creates the IAP entry if it doesn't exist |
275 EapMsChapV2DbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType); |
306 EapMsChapV2DbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType); |
276 |
307 |
277 CleanupClosePushL(session); |
308 CleanupClosePushL(session); |
282 aSettings, |
313 aSettings, |
283 iIndexType, |
314 iIndexType, |
284 iIndex, |
315 iIndex, |
285 iTunnelingType); |
316 iTunnelingType); |
286 |
317 |
287 CleanupStack::PopAndDestroy(2); // db, session |
318 CleanupStack::PopAndDestroy(&db); |
|
319 CleanupStack::PopAndDestroy(&session); |
288 } |
320 } |
289 |
321 |
290 void CEapMsChapV2::CopySettingsL( |
322 void CEapMsChapV2::CopySettingsL( |
291 const TIndexType aDestinationIndexType, |
323 const TIndexType aDestinationIndexType, |
292 const TInt aDestinationIndex) |
324 const TInt aDestinationIndex) |
293 { |
325 { |
|
326 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapMsChapV2::CopySettingsL()\n"))); |
|
327 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapMsChapV2::CopySettingsL()\n")); |
|
328 |
294 // First delete the target configuration |
329 // First delete the target configuration |
295 TIndexType tmpIndexType = iIndexType; |
330 TIndexType tmpIndexType = iIndexType; |
296 TInt tmpIndex = iIndex; |
331 TInt tmpIndex = iIndex; |
297 |
332 |
298 iIndexType = aDestinationIndexType; |
333 iIndexType = aDestinationIndexType; |