26
|
1 |
/*
|
|
2 |
* Copyright (c) 2009-2010 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: EAP-session inside EAP-server.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
/*
|
27
|
19 |
* %version: 29 %
|
26
|
20 |
*/
|
|
21 |
|
|
22 |
|
|
23 |
#define __REFERENCE_CAPABILITY_NAMES__
|
|
24 |
#define __INCLUDE_CAPABILITY_NAMES__
|
|
25 |
|
|
26 |
#include "EapSession.h"
|
|
27 |
#include "EapServerStrings.h"
|
|
28 |
#include "EapServer.h"
|
|
29 |
#include "EapServerProcessHandler.h"
|
|
30 |
#include "EapServerClientDef.h"
|
|
31 |
#include "abs_eap_am_tools.h"
|
|
32 |
#include "EapTraceSymbian.h"
|
|
33 |
|
|
34 |
#include "eap_automatic_variable.h"
|
|
35 |
|
|
36 |
/*
|
|
37 |
CEapSession
|
|
38 |
*/
|
|
39 |
|
|
40 |
const TInt KMaxMessageLength = 1000000;
|
|
41 |
|
|
42 |
// -----------------------------------------------------------------------------------------
|
|
43 |
|
|
44 |
// construct/destruct
|
|
45 |
|
|
46 |
CEapSession::CEapSession()
|
|
47 |
: iReceiveActive(EFalse)
|
|
48 |
, iEapProcessHandler(0)
|
|
49 |
, iTools(0)
|
|
50 |
{
|
|
51 |
EAP_TRACE_DEBUG_SYMBIAN((_L("CEapSession::CEapSession(): this=0x%08x"),
|
|
52 |
this));
|
|
53 |
|
|
54 |
EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapSession::CEapSession()"));
|
|
55 |
|
|
56 |
}
|
|
57 |
|
|
58 |
// -----------------------------------------------------------------------------------------
|
|
59 |
|
|
60 |
void CEapSession::ConstructL(CEapServer& aServer, abs_eap_am_tools_c * const tools)
|
|
61 |
{
|
|
62 |
EAP_TRACE_DEBUG(
|
|
63 |
tools,
|
|
64 |
TRACE_FLAGS_DEFAULT,
|
|
65 |
(EAPL("CEapSession::ConstructL(): this=0x%08x\n"),
|
|
66 |
this));
|
|
67 |
EAP_TRACE_RETURN_STRING(tools, "returns: CEapSession::ConstructL()");
|
|
68 |
|
|
69 |
iTools = tools;
|
|
70 |
|
|
71 |
iEapProcessHandler = CEapServerProcessHandler::NewL();
|
|
72 |
iEapProcessHandler->ConstructL(this, iTools);
|
|
73 |
CActiveScheduler::Add(iEapProcessHandler);
|
|
74 |
}
|
|
75 |
|
|
76 |
// -----------------------------------------------------------------------------------------
|
|
77 |
|
|
78 |
CEapSession::~CEapSession()
|
|
79 |
{
|
|
80 |
EAP_TRACE_DEBUG(
|
|
81 |
iTools,
|
|
82 |
TRACE_FLAGS_DEFAULT,
|
|
83 |
(EAPL("CEapSession::~CEapSession(): this=0x%08x\n"),
|
|
84 |
this));
|
|
85 |
EAP_TRACE_RETURN_STRING(iTools, "returns: CEapSession::~CEapSession()");
|
|
86 |
|
|
87 |
// cancel any receive
|
|
88 |
CancelReceive();
|
|
89 |
if (iEapProcessHandler != 0)
|
|
90 |
{
|
|
91 |
delete iEapProcessHandler;
|
|
92 |
iEapProcessHandler = 0;
|
|
93 |
}
|
|
94 |
// decrement session count, so server may terminate if no longer needed
|
|
95 |
Server()->DecrementSessions();
|
|
96 |
}
|
|
97 |
|
|
98 |
// -----------------------------------------------------------------------------------------
|
|
99 |
|
|
100 |
CEapServer* CEapSession::Server() const
|
|
101 |
/**
|
|
102 |
Return the EAP-server.
|
|
103 |
|
|
104 |
This deliberately hides the ugly casts around the code.
|
|
105 |
*/
|
|
106 |
{
|
|
107 |
EAP_TRACE_DEBUG(
|
|
108 |
iTools,
|
|
109 |
TRACE_FLAGS_DEFAULT,
|
|
110 |
(EAPL("CEapSession::Server(): this=0x%08x\n"),
|
|
111 |
this));
|
|
112 |
EAP_TRACE_RETURN_STRING(iTools, "returns: CEapSession::Server()");
|
|
113 |
|
|
114 |
return const_cast<CEapServer*>(static_cast<const CEapServer*>(CSession2::Server()));
|
|
115 |
}
|
|
116 |
|
|
117 |
// -----------------------------------------------------------------------------------------
|
|
118 |
|
|
119 |
void CEapSession::CheckCapabilityL(
|
|
120 |
const RMessage2& aMessage,
|
|
121 |
const TBool aMustHaveCapabilityWhenTrue,
|
|
122 |
const TCapability aCapability,
|
|
123 |
const char *aDiagnostic)
|
|
124 |
{
|
|
125 |
EAP_TRACE_DEBUG(
|
|
126 |
iTools,
|
|
127 |
TRACE_FLAGS_DEFAULT,
|
|
128 |
(EAPL("CEapSession::CheckCapabilityL(): this=0x%08x: aMessage.Function()=%d=%s\n"),
|
|
129 |
this,
|
|
130 |
aMessage.Function(),
|
|
131 |
EapServerStrings::GetEapRequestsString(aMessage.Function())));
|
|
132 |
|
|
133 |
EAP_TRACE_RETURN_STRING(iTools, "returns: CEapSession::CheckCapabilityL()");
|
|
134 |
|
|
135 |
if (aMustHaveCapabilityWhenTrue != aMessage.HasCapability(aCapability, aDiagnostic))
|
|
136 |
{
|
|
137 |
// Capability check failed.
|
|
138 |
EAP_TRACE_DEBUG(
|
|
139 |
iTools,
|
|
140 |
TRACE_FLAGS_DEFAULT,
|
|
141 |
(EAPL("ERROR: CEapSession::CheckCapability(): aMessage.Function()=%d=%s, failed capability check: %d=%s, %s\n"),
|
|
142 |
aMessage.Function(),
|
|
143 |
EapServerStrings::GetEapRequestsString(aMessage.Function()),
|
|
144 |
aCapability,
|
|
145 |
CapabilityNames[aCapability],
|
|
146 |
aDiagnostic));
|
|
147 |
Server()->PanicClient(EBadRequest);
|
|
148 |
User::Leave(EBadRequest);
|
|
149 |
}
|
|
150 |
else
|
|
151 |
{
|
|
152 |
EAP_TRACE_DEBUG(
|
|
153 |
iTools,
|
|
154 |
TRACE_FLAGS_DEFAULT,
|
|
155 |
(EAPL("CEapSession::CheckCapability(): aMessage.Function()=%d=%s, OK capability check: %d=%s\n"),
|
|
156 |
aMessage.Function(),
|
|
157 |
EapServerStrings::GetEapRequestsString(aMessage.Function()),
|
|
158 |
aCapability,
|
|
159 |
CapabilityNames[aCapability]));
|
|
160 |
}
|
|
161 |
}
|
|
162 |
|
|
163 |
// -----------------------------------------------------------------------------------------
|
|
164 |
|
|
165 |
// service dispatcher - from CSharableSession
|
|
166 |
|
|
167 |
void CEapSession::ServiceL(const RMessage2& aMessage)
|
|
168 |
{
|
|
169 |
|
|
170 |
EAP_TRACE_DEBUG(
|
|
171 |
iTools,
|
|
172 |
TRACE_FLAGS_DEFAULT,
|
|
173 |
(EAPL("-start--------------------------------------------------------------------\n")));
|
|
174 |
|
|
175 |
EAP_TRACE_DEBUG(
|
|
176 |
iTools,
|
|
177 |
TRACE_FLAGS_DEFAULT,
|
|
178 |
(EAPL("CEapSession::ServiceL(): this=0x%08x: starts, aMessage.Function()=%d=%s\n"),
|
|
179 |
this,
|
|
180 |
aMessage.Function(),
|
|
181 |
EapServerStrings::GetEapRequestsString(aMessage.Function())));
|
|
182 |
|
|
183 |
EAP_TRACE_RETURN_STRING(iTools, "returns: CEapSession::ServiceL()");
|
|
184 |
|
|
185 |
|
|
186 |
{
|
27
|
187 |
#if 0
|
|
188 |
// Add this later.
|
26
|
189 |
CheckCapabilityL(
|
|
190 |
aMessage,
|
|
191 |
ETrue,
|
|
192 |
ECapabilityNetworkControl,
|
|
193 |
"EAP-SERVER: Missing ECapabilityNetworkControl");
|
27
|
194 |
#endif
|
26
|
195 |
CheckCapabilityL(
|
|
196 |
aMessage,
|
|
197 |
ETrue,
|
|
198 |
ECapabilityNetworkServices,
|
|
199 |
"EAP-SERVER: Missing ECapabilityNetworkServices");
|
|
200 |
|
|
201 |
CheckCapabilityL(
|
|
202 |
aMessage,
|
|
203 |
ETrue,
|
|
204 |
ECapabilityReadDeviceData,
|
|
205 |
"EAP-SERVER: Missing ECapabilityReadDeviceData");
|
|
206 |
|
|
207 |
CheckCapabilityL(
|
|
208 |
aMessage,
|
|
209 |
ETrue,
|
|
210 |
ECapabilityReadUserData,
|
|
211 |
"EAP-SERVER: Missing ECapabilityReadUserData");
|
|
212 |
}
|
|
213 |
|
|
214 |
|
|
215 |
if (aMessage.Function() == EEapIfCancelReceive)
|
|
216 |
{
|
|
217 |
EAP_TRACE_DEBUG(
|
|
218 |
iTools,
|
|
219 |
TRACE_FLAGS_DEFAULT,
|
|
220 |
(EAPL("CEapSession::ServiceL(): aMessage.Function()=%d=%s, calls CancelReceive()\n"),
|
|
221 |
aMessage.Function(),
|
|
222 |
EapServerStrings::GetEapRequestsString(aMessage.Function())));
|
|
223 |
CancelReceive();
|
|
224 |
return;
|
|
225 |
}
|
|
226 |
|
|
227 |
// length of passed descriptor (1st parameter passed from client)
|
|
228 |
TInt deslen = aMessage.GetDesLength(0);
|
|
229 |
|
|
230 |
if (deslen > KMaxMessageLength)
|
|
231 |
{
|
|
232 |
Server()->PanicClient(EBadRequest);
|
|
233 |
return;
|
|
234 |
}
|
|
235 |
|
|
236 |
// Passed data will be saved in this descriptor.
|
|
237 |
RBuf8 buffer;
|
|
238 |
|
|
239 |
// Max length set to the value of "deslen", but current length is zero
|
|
240 |
buffer.CreateL(deslen);
|
|
241 |
|
|
242 |
// Do the right cleanup if anything subsequently goes wrong
|
|
243 |
buffer.CleanupClosePushL();
|
|
244 |
|
|
245 |
// Copy the client's descriptor data into our buffer.
|
|
246 |
aMessage.ReadL(0,buffer,0);
|
|
247 |
|
|
248 |
EAP_TRACE_DEBUG(
|
|
249 |
iTools,
|
|
250 |
TRACE_FLAGS_DEFAULT,
|
|
251 |
(EAPL("CEapSession::ServiceL(): calls buffer.Length()\n")));
|
|
252 |
|
|
253 |
TUint aLength = buffer.Length();
|
|
254 |
|
|
255 |
EAP_TRACE_DEBUG(
|
|
256 |
iTools,
|
|
257 |
TRACE_FLAGS_DEFAULT,
|
|
258 |
(EAPL("CEapSession::ServiceL(): calls buffer.Ptr(): aLength=%d\n"),
|
|
259 |
aLength));
|
|
260 |
|
|
261 |
const void * aData = buffer.Ptr();
|
|
262 |
|
|
263 |
EAP_TRACE_DEBUG(
|
|
264 |
iTools,
|
|
265 |
TRACE_FLAGS_DEFAULT,
|
|
266 |
(EAPL("CEapSession::ServiceL(): aData=0x%08x, aLength=%d\n"),
|
|
267 |
aData,
|
|
268 |
aLength));
|
|
269 |
|
|
270 |
EAP_TRACE_DATA_DEBUG(
|
|
271 |
iTools,
|
|
272 |
TRACE_FLAGS_DEFAULT,
|
|
273 |
(EAPL("CEapSession::ServiceL()"),
|
|
274 |
aData,
|
|
275 |
aLength));
|
|
276 |
|
|
277 |
EAP_TRACE_DEBUG(
|
|
278 |
iTools,
|
|
279 |
TRACE_FLAGS_DEFAULT,
|
|
280 |
(EAPL("CEapSession::ServiceL(): switch aMessage.Function()=%d=%s, iEapProcessHandler=0x%08x\n"),
|
|
281 |
aMessage.Function(),
|
|
282 |
EapServerStrings::GetEapRequestsString(aMessage.Function()),
|
|
283 |
iEapProcessHandler));
|
|
284 |
|
|
285 |
|
|
286 |
switch (aMessage.Function())
|
|
287 |
{
|
|
288 |
case EEapCoreIfNew:
|
|
289 |
EAP_TRACE_DEBUG(
|
|
290 |
iTools,
|
|
291 |
TRACE_FLAGS_DEFAULT,
|
|
292 |
(EAPL("CEapSession::ServiceL(): EEapCoreIfNew\n")));
|
|
293 |
ReceiveAll();
|
|
294 |
iEapProcessHandler->SaveMessage(EEapCoreIfNew, aData, aLength);
|
|
295 |
aMessage.Complete(KErrNone);
|
|
296 |
break;
|
|
297 |
case EEapPluginNew:
|
|
298 |
EAP_TRACE_DEBUG(
|
|
299 |
iTools,
|
|
300 |
TRACE_FLAGS_DEFAULT,
|
|
301 |
(EAPL("CEapSession::ServiceL(): EEapPluginNew\n")));
|
|
302 |
iEapProcessHandler->SaveMessage(EEapPluginNew, aData, aLength);
|
|
303 |
aMessage.Complete(KErrNone);
|
|
304 |
break;
|
|
305 |
case EEapSettingsNew:
|
|
306 |
EAP_TRACE_DEBUG(
|
|
307 |
iTools,
|
|
308 |
TRACE_FLAGS_DEFAULT,
|
|
309 |
(EAPL("CEapSession::ServiceL(): EEapSettingsNew\n")));
|
|
310 |
iEapProcessHandler->SaveMessage(EEapSettingsNew, aData, aLength);
|
|
311 |
aMessage.Complete(KErrNone);
|
|
312 |
break;
|
|
313 |
case EEapPacStoreNew:
|
|
314 |
EAP_TRACE_DEBUG(
|
|
315 |
iTools,
|
|
316 |
TRACE_FLAGS_DEFAULT,
|
|
317 |
(EAPL("CEapSession::ServiceL(): EEapPacStoreNew\n")));
|
|
318 |
iEapProcessHandler->SaveMessage(EEapPacStoreNew, aData, aLength);
|
|
319 |
aMessage.Complete(KErrNone);
|
|
320 |
break;
|
|
321 |
case EWapiCoreIfNew:
|
|
322 |
EAP_TRACE_DEBUG(
|
|
323 |
iTools,
|
|
324 |
TRACE_FLAGS_DEFAULT,
|
|
325 |
(EAPL("CEapSession::ServiceL(): EWapiCoreIfNew\n")));
|
|
326 |
ReceiveAll();
|
|
327 |
iEapProcessHandler->SaveMessage(EWapiCoreIfNew, aData, aLength);
|
|
328 |
aMessage.Complete(KErrNone);
|
|
329 |
break;
|
|
330 |
case EWapiSettingsNew:
|
|
331 |
EAP_TRACE_DEBUG(
|
|
332 |
iTools,
|
|
333 |
TRACE_FLAGS_DEFAULT,
|
|
334 |
(EAPL("CEapSession::ServiceL(): EWapiSettingsNew\n")));
|
|
335 |
ReceiveAll();
|
|
336 |
iEapProcessHandler->SaveMessage(EWapiSettingsNew, aData, aLength);
|
|
337 |
aMessage.Complete(KErrNone);
|
|
338 |
break;
|
|
339 |
case EEapCoreProcessData:
|
|
340 |
EAP_TRACE_DEBUG(
|
|
341 |
iTools,
|
|
342 |
TRACE_FLAGS_DEFAULT,
|
|
343 |
(EAPL("CEapSession::ServiceL(): EEapCoreProcessData\n")));
|
|
344 |
// Read message
|
|
345 |
iEapProcessHandler->SaveMessage(EEapCoreProcessData, aData, aLength);
|
|
346 |
aMessage.Complete(KErrNone);
|
|
347 |
break;
|
|
348 |
case EEapPluginProcessData:
|
|
349 |
EAP_TRACE_DEBUG(
|
|
350 |
iTools,
|
|
351 |
TRACE_FLAGS_DEFAULT,
|
|
352 |
(EAPL("CEapSession::ServiceL(): EEapPluginProcessData\n")));
|
|
353 |
iEapProcessHandler->SaveMessage(EEapPluginProcessData, aData, aLength);
|
|
354 |
aMessage.Complete(KErrNone);
|
|
355 |
break;
|
|
356 |
case EEapSettingsProcessData:
|
|
357 |
EAP_TRACE_DEBUG(
|
|
358 |
iTools,
|
|
359 |
TRACE_FLAGS_DEFAULT,
|
|
360 |
(EAPL("CEapSession::ServiceL(): EEapSettingsProcessData\n")));
|
|
361 |
iEapProcessHandler->SaveMessage(EEapSettingsProcessData, aData, aLength);
|
|
362 |
aMessage.Complete(KErrNone);
|
|
363 |
break;
|
|
364 |
case EEapPacStoreProcessData:
|
|
365 |
EAP_TRACE_DEBUG(
|
|
366 |
iTools,
|
|
367 |
TRACE_FLAGS_DEFAULT,
|
|
368 |
(EAPL("CEapSession::ServiceL(): EEapPacStoreProcessData\n")));
|
|
369 |
iEapProcessHandler->SaveMessage(EEapPacStoreProcessData, aData, aLength);
|
|
370 |
aMessage.Complete(KErrNone);
|
|
371 |
break;
|
|
372 |
case EWapiCoreProcessData:
|
|
373 |
EAP_TRACE_DEBUG(
|
|
374 |
iTools,
|
|
375 |
TRACE_FLAGS_DEFAULT,
|
|
376 |
(EAPL("CEapSession::ServiceL(): EWapiCoreProcessData\n")));
|
|
377 |
iEapProcessHandler->SaveMessage(EWapiCoreProcessData, aData, aLength);
|
|
378 |
aMessage.Complete(KErrNone);
|
|
379 |
break;
|
|
380 |
case EWapiSettingsProcessData:
|
|
381 |
EAP_TRACE_DEBUG(
|
|
382 |
iTools,
|
|
383 |
TRACE_FLAGS_DEFAULT,
|
|
384 |
(EAPL("CEapSession::ServiceL(): EWapiSettingsProcessData\n")));
|
|
385 |
iEapProcessHandler->SaveMessage(EWapiSettingsProcessData, aData, aLength);
|
|
386 |
aMessage.Complete(KErrNone);
|
|
387 |
break;
|
|
388 |
case EEapIfReqReceive: // TAny& aBuffer - async
|
|
389 |
EAP_TRACE_DEBUG(
|
|
390 |
iTools,
|
|
391 |
TRACE_FLAGS_DEFAULT,
|
|
392 |
(EAPL("CEapSession::ServiceL(): EEapIfReqReceive\n")));
|
|
393 |
__ASSERT_DEBUG(!iReceiveActive, Server()->PanicClient(EReceiveReceiveAlreadyActive));
|
|
394 |
// remember receive request
|
|
395 |
iReceiveMessage = aMessage;
|
|
396 |
iReceiveActive=ETrue;
|
|
397 |
iEapProcessHandler->Activate();
|
|
398 |
break;
|
|
399 |
case EEapIfCancelReceive:
|
|
400 |
EAP_TRACE_DEBUG(
|
|
401 |
iTools,
|
|
402 |
TRACE_FLAGS_DEFAULT,
|
|
403 |
(EAPL("CEapSession::ServiceL(): EEapIfCancelReceive\n")));
|
|
404 |
CancelReceive();
|
|
405 |
break;
|
|
406 |
default:
|
|
407 |
EAP_TRACE_DEBUG(
|
|
408 |
iTools,
|
|
409 |
TRACE_FLAGS_DEFAULT,
|
|
410 |
(EAPL("ERROR: CEapSession::ServiceL(): unknown aMessage.Function()=%d=%s, calls Server()->PanicClient()\n"),
|
|
411 |
aMessage.Function(),
|
|
412 |
EapServerStrings::GetEapRequestsString(aMessage.Function())));
|
|
413 |
|
|
414 |
Server()->PanicClient(EBadRequest);
|
|
415 |
};
|
|
416 |
|
|
417 |
CleanupStack::PopAndDestroy(&buffer);
|
|
418 |
|
|
419 |
EAP_TRACE_DEBUG(
|
|
420 |
iTools,
|
|
421 |
TRACE_FLAGS_DEFAULT,
|
|
422 |
(EAPL("CEapSession::ServiceL(): ends aMessage.Function()=%d=%s\n"),
|
|
423 |
aMessage.Function(),
|
|
424 |
EapServerStrings::GetEapRequestsString(aMessage.Function())));
|
|
425 |
|
|
426 |
EAP_TRACE_DEBUG(
|
|
427 |
iTools,
|
|
428 |
TRACE_FLAGS_DEFAULT,
|
|
429 |
(EAPL("-end----------------------------------------------------------------------\n")));
|
|
430 |
}
|
|
431 |
|
|
432 |
// -----------------------------------------------------------------------------------------
|
|
433 |
|
|
434 |
void CEapSession::ReceiveAll()
|
|
435 |
{
|
|
436 |
EAP_TRACE_DEBUG(
|
|
437 |
iTools,
|
|
438 |
TRACE_FLAGS_DEFAULT,
|
|
439 |
(EAPL("CEapSession::ReceiveAll(): this=0x%08x\n"),
|
|
440 |
this));
|
|
441 |
EAP_TRACE_RETURN_STRING(iTools, "returns: CEapSession::ReceiveAll()");
|
|
442 |
|
|
443 |
}
|
|
444 |
|
|
445 |
// -----------------------------------------------------------------------------------------
|
|
446 |
|
|
447 |
void CEapSession::Receive(RMessage2& aBuffer)
|
|
448 |
{
|
|
449 |
EAP_TRACE_DEBUG(
|
|
450 |
iTools,
|
|
451 |
TRACE_FLAGS_DEFAULT,
|
|
452 |
(EAPL("CEapSession::Receive(): this=0x%08x\n"),
|
|
453 |
this));
|
|
454 |
EAP_TRACE_RETURN_STRING(iTools, "returns: CEapSession::Receive()");
|
|
455 |
|
|
456 |
__ASSERT_DEBUG(!iReceiveActive,Server()->PanicClient(EReceiveReceiveAlreadyActive));
|
|
457 |
|
|
458 |
// remember receive request
|
|
459 |
iReceiveMessage = aBuffer;
|
|
460 |
iReceiveActive=ETrue;
|
|
461 |
}
|
|
462 |
|
|
463 |
// -----------------------------------------------------------------------------------------
|
|
464 |
|
|
465 |
void CEapSession::CancelReceive()
|
|
466 |
{
|
|
467 |
EAP_TRACE_DEBUG(
|
|
468 |
iTools,
|
|
469 |
TRACE_FLAGS_DEFAULT,
|
|
470 |
(EAPL("CEapSession::CancelReceive(): this=0x%08x\n"),
|
|
471 |
this));
|
|
472 |
EAP_TRACE_RETURN_STRING(iTools, "returns: CEapSession::CancelReceive()");
|
|
473 |
|
|
474 |
if (!iReceiveActive)
|
|
475 |
{
|
|
476 |
EAP_TRACE_DEBUG(
|
|
477 |
iTools,
|
|
478 |
TRACE_FLAGS_DEFAULT,
|
|
479 |
(EAPL("CEapSession::CancelReceive(): No receive active\n")));
|
|
480 |
return;
|
|
481 |
}
|
|
482 |
|
|
483 |
iReceiveMessage.Complete(KErrCancel);
|
|
484 |
iReceiveActive=EFalse;
|
|
485 |
}
|
|
486 |
|
|
487 |
// -----------------------------------------------------------------------------------------
|
|
488 |
|
|
489 |
TBool CEapSession::GetReceiveActive()
|
|
490 |
{
|
|
491 |
EAP_TRACE_DEBUG(
|
|
492 |
iTools,
|
|
493 |
TRACE_FLAGS_DEFAULT,
|
|
494 |
(EAPL("CEapSession::GetReceiveActive(): this=0x%08x: iReceiveActive=%d\n"),
|
|
495 |
this,
|
|
496 |
iReceiveActive));
|
|
497 |
EAP_TRACE_RETURN_STRING(iTools, "returns: CEapSession::GetReceiveActive()");
|
|
498 |
|
|
499 |
return iReceiveActive;
|
|
500 |
}
|
|
501 |
|
|
502 |
// -----------------------------------------------------------------------------------------
|
|
503 |
|
|
504 |
eap_status_e CEapSession::SendData(EapMessageBuffer * const message)
|
|
505 |
{
|
|
506 |
EAP_TRACE_DEBUG(
|
|
507 |
iTools,
|
|
508 |
TRACE_FLAGS_DEFAULT,
|
|
509 |
(EAPL("CEapSession::SendData(): this=0x%08x: message->GetRequestType()=%d=%s, message->GetData()->Length()=%d\n"),
|
|
510 |
this,
|
|
511 |
message->GetRequestType(),
|
|
512 |
EapServerStrings::GetEapRequestsString(message->GetRequestType()),
|
|
513 |
message->GetData()->Length()));
|
|
514 |
EAP_TRACE_RETURN_STRING(iTools, "returns: CEapSession::SendData()");
|
|
515 |
|
|
516 |
if (!iReceiveActive)
|
|
517 |
{
|
|
518 |
EAP_TRACE_DEBUG(
|
|
519 |
iTools,
|
|
520 |
TRACE_FLAGS_DEFAULT,
|
|
521 |
(EAPL("CEapSession::SendData(): No receive active\n")));
|
|
522 |
return EAP_STATUS_RETURN(iTools, iTools->convert_am_error_to_eapol_error(KErrCancel));
|
|
523 |
}
|
|
524 |
|
|
525 |
TInt error(KErrNone);
|
|
526 |
|
|
527 |
EAP_TRACE_DEBUG(
|
|
528 |
iTools,
|
|
529 |
TRACE_FLAGS_DEFAULT,
|
|
530 |
(EAPL("CEapSession::SendData(): calls iReceiveMessage.Write()\n")));
|
|
531 |
|
|
532 |
error = iReceiveMessage.Write(0, message->GetData()->Des());
|
|
533 |
|
|
534 |
EAP_TRACE_DEBUG(
|
|
535 |
iTools,
|
|
536 |
TRACE_FLAGS_DEFAULT,
|
|
537 |
(EAPL("CEapSession::SendData(): calls iReceiveMessage.Complete(): Write() error=%d\n"),
|
|
538 |
error));
|
|
539 |
|
|
540 |
iReceiveMessage.Complete(KErrNone);
|
|
541 |
iReceiveActive=EFalse;
|
|
542 |
|
|
543 |
return EAP_STATUS_RETURN(iTools, iTools->convert_am_error_to_eapol_error(error));
|
|
544 |
}
|
|
545 |
|
|
546 |
// -----------------------------------------------------------------------------------------
|
|
547 |
// end
|