26
|
1 |
/*
|
|
2 |
* Copyright (c) 2001-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 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 and WLAN authentication protocols.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
/*
|
34
|
19 |
* %version: 22 %
|
26
|
20 |
*/
|
|
21 |
|
|
22 |
// INCLUDES
|
|
23 |
#include <e32std.h>
|
|
24 |
#include <implementationproxy.h>
|
|
25 |
#include "EapCoreInterfaceImplementation.h"
|
|
26 |
#include "EapolUID.h"
|
|
27 |
#include "EapTraceSymbian.h"
|
|
28 |
//-----------------------------------------------------------------------------------------
|
|
29 |
|
|
30 |
/**
|
|
31 |
* Pairs ECom implementation UIDs with a pointer to the instantiation
|
|
32 |
* method for that implementation. Required for all ECom implementation
|
|
33 |
* collections.
|
|
34 |
*/
|
|
35 |
const TImplementationProxy ImplementationTable[] =
|
|
36 |
{
|
|
37 |
{{ EAP_CORE_INTERFACEIMPLEMENTATION_IMPLEMENTATION_UID }, reinterpret_cast<TProxyNewLPtr>(CEapCoreInterfaceImplementation::NewL)}
|
|
38 |
};
|
|
39 |
|
|
40 |
//-----------------------------------------------------------------------------------------
|
|
41 |
|
|
42 |
/**
|
|
43 |
* Static constructor.
|
|
44 |
* @param aPartner Pointer to callback instance.
|
|
45 |
* @return Pointer to the constructed instance.
|
|
46 |
*/
|
|
47 |
CEapProcessInterface* CEapCoreInterfaceImplementation::NewL(MEapSendInterface * aPartner)
|
|
48 |
{
|
|
49 |
EAP_TRACE_DEBUG_SYMBIAN(
|
|
50 |
(_L("CEapCoreInterfaceImplementation::NewL")));
|
|
51 |
|
|
52 |
CEapCoreInterfaceImplementation* self = new (ELeave) CEapCoreInterfaceImplementation();
|
|
53 |
|
|
54 |
CleanupStack::PushL(self);
|
|
55 |
|
|
56 |
self->ConstructL(aPartner);
|
|
57 |
|
|
58 |
if (self->get_is_valid() != true)
|
|
59 |
{
|
|
60 |
User::Leave(KErrGeneral);
|
|
61 |
}
|
|
62 |
|
|
63 |
CleanupStack::Pop(self);
|
|
64 |
|
|
65 |
EAP_TRACE_DEBUG_SYMBIAN(
|
|
66 |
(_L("CEapCoreInterfaceImplementation::NewL end")));
|
|
67 |
return self;
|
|
68 |
}
|
|
69 |
|
|
70 |
//-----------------------------------------------------------------------------------------
|
|
71 |
|
|
72 |
/**
|
|
73 |
* C++ default constructor.
|
|
74 |
*/
|
|
75 |
CEapCoreInterfaceImplementation::CEapCoreInterfaceImplementation()
|
|
76 |
{
|
|
77 |
EAP_TRACE_DEBUG_SYMBIAN(
|
|
78 |
(_L("CEapCoreInterfaceImplementation::CEapCoreInterfaceImplementation")));
|
|
79 |
m_partner = 0;
|
|
80 |
m_is_valid = false;
|
|
81 |
iMTU = 0;
|
|
82 |
iTools = 0;
|
|
83 |
}
|
|
84 |
|
|
85 |
//-----------------------------------------------------------------------------------------
|
|
86 |
|
|
87 |
/**
|
|
88 |
* Destructor.
|
|
89 |
*/
|
|
90 |
CEapCoreInterfaceImplementation::~CEapCoreInterfaceImplementation()
|
|
91 |
{
|
|
92 |
EAP_TRACE_DEBUG_SYMBIAN(
|
|
93 |
(_L("CEapCoreInterfaceImplementation::~CEapCoreInterfaceImplementation")));
|
|
94 |
m_partner = 0;
|
|
95 |
iTools = 0;
|
|
96 |
iMTU = 0;
|
|
97 |
// iSession.Close();
|
|
98 |
}
|
|
99 |
|
|
100 |
//-----------------------------------------------------------------------------------------
|
|
101 |
TInt CEapCoreInterfaceImplementation::SetEnv(abs_eap_am_tools_c * const tools, const u32_t MTU)
|
|
102 |
{
|
|
103 |
EAP_TRACE_DEBUG_SYMBIAN(
|
|
104 |
(_L("CEapCoreInterfaceImplementation::SetEnv")));
|
|
105 |
iTools = tools;
|
|
106 |
iMTU = MTU;
|
|
107 |
return KErrNone;
|
|
108 |
}
|
|
109 |
|
|
110 |
/**
|
|
111 |
* Configure plugin implementation.
|
|
112 |
*
|
|
113 |
* @since S60 v3.2
|
|
114 |
* @param aHeaderOffset Offset of EAP-header in packet_send.
|
|
115 |
* @param aMTU Maximum transfer unit (MTU).
|
|
116 |
* @param aTrailerLength Length of trailer needed by lower levels..
|
|
117 |
* @return Return value is specified in interface specification.
|
|
118 |
*/
|
|
119 |
TInt CEapCoreInterfaceImplementation::Configure(
|
34
|
120 |
const TInt /* aHeaderOffset */,
|
|
121 |
const TInt /* aMTU */,
|
|
122 |
const TInt /* aTrailerLength */,
|
26
|
123 |
const void * const aConfigurationData,
|
|
124 |
const TInt aConfigurationDataLength)
|
|
125 |
{
|
|
126 |
EAP_TRACE_DEBUG_SYMBIAN(
|
|
127 |
(_L("CEapCoreInterfaceImplementation::Configure")));
|
|
128 |
|
|
129 |
TBuf<KMaxServerExe> ServerName;
|
|
130 |
TBuf<KMaxServerExe> ServerExe;
|
|
131 |
|
|
132 |
GetServerNameAndExe(&ServerName, &ServerExe);
|
|
133 |
|
|
134 |
TRAPD(err, iSession.ConnectL(iTools, this, ServerName, ServerExe, aConfigurationData, aConfigurationDataLength, EEapCoreIfNew));
|
|
135 |
|
|
136 |
if(err)
|
|
137 |
{
|
|
138 |
EAP_TRACE_DEBUG(
|
|
139 |
iTools,
|
|
140 |
TRACE_FLAGS_DEFAULT,
|
|
141 |
(EAPL("CEapCoreInterfaceImplementation::Configure - iSession.ConnectL err=%d\n"), err ));
|
|
142 |
return err;
|
|
143 |
}
|
|
144 |
|
|
145 |
EAP_TRACE_DEBUG_SYMBIAN((_L("CEapCoreInterfaceImplementation::Configure end")));
|
|
146 |
|
|
147 |
return err;
|
|
148 |
}
|
|
149 |
|
|
150 |
//-----------------------------------------------------------------------------------------
|
|
151 |
|
|
152 |
/**
|
|
153 |
* Shutdown plugin implementation.
|
|
154 |
*
|
|
155 |
* @since S60 v3.2
|
|
156 |
* @return Return value is specified in interface specification.
|
|
157 |
*/
|
|
158 |
TInt CEapCoreInterfaceImplementation::Shutdown()
|
|
159 |
{
|
|
160 |
EAP_TRACE_DEBUG_SYMBIAN(
|
|
161 |
(_L("CEapCoreInterfaceImplementation::Shutdown")));
|
|
162 |
iSession.Close();
|
|
163 |
|
|
164 |
return 0;
|
|
165 |
}
|
|
166 |
|
|
167 |
//-----------------------------------------------------------------------------------------
|
|
168 |
|
|
169 |
/**
|
|
170 |
* Send data to EAPOL.
|
|
171 |
*
|
|
172 |
* @since S60 v3.2
|
|
173 |
* @param aData Pointer to the data to be sent.
|
|
174 |
* @param aLength Length of the data to be sent.
|
|
175 |
* @return Return value is specified in interface specification.
|
|
176 |
*/
|
|
177 |
TInt CEapCoreInterfaceImplementation::ProcessData(
|
|
178 |
const void * const aData,
|
|
179 |
const TInt aLength )
|
|
180 |
{
|
|
181 |
EAP_TRACE_DEBUG(
|
|
182 |
iTools,
|
|
183 |
TRACE_FLAGS_DEFAULT,
|
|
184 |
(EAPL("CEapCoreInterfaceImplementation::ProcessData()\n")));
|
|
185 |
|
|
186 |
EAP_TRACE_DATA_DEBUG(
|
|
187 |
iTools,
|
|
188 |
TRACE_FLAGS_DEFAULT,
|
|
189 |
(EAPL("CEapCoreInterfaceImplementation::ProcessData()"),
|
|
190 |
aData,
|
|
191 |
aLength));
|
|
192 |
|
|
193 |
return iSession.process_data(EEapCoreProcessData, aData, aLength);
|
|
194 |
}
|
|
195 |
|
|
196 |
//-----------------------------------------------------------------------------------------
|
|
197 |
|
|
198 |
/**
|
|
199 |
* Symbian 2nd phase constructor.
|
|
200 |
*/
|
|
201 |
void CEapCoreInterfaceImplementation::ConstructL(MEapSendInterface * aPartner)
|
|
202 |
{
|
|
203 |
m_partner = aPartner;
|
|
204 |
m_is_valid = true;
|
|
205 |
EAP_TRACE_DEBUG_SYMBIAN(
|
|
206 |
(_L("CEapCoreInterfaceImplementation::ConstructL")));
|
|
207 |
|
|
208 |
// RWapiSession session;
|
|
209 |
// __UHEAP_MARK;
|
|
210 |
// CTestPacketHandler* tph = new (ELeave) CTestPacketHandler;
|
|
211 |
// CleanupStack::PushL( tph );
|
|
212 |
|
|
213 |
// CleanupStack::Pop( tph );
|
|
214 |
|
|
215 |
// delete tph;
|
|
216 |
|
|
217 |
}
|
|
218 |
|
|
219 |
//-----------------------------------------------------------------------------------------
|
|
220 |
|
|
221 |
bool CEapCoreInterfaceImplementation::get_is_valid()
|
|
222 |
{
|
|
223 |
EAP_TRACE_DEBUG_SYMBIAN(
|
|
224 |
(_L("CEapCoreInterfaceImplementation::get_is_valid = %d"),m_is_valid ));
|
|
225 |
|
|
226 |
return m_is_valid;
|
|
227 |
}
|
|
228 |
|
|
229 |
//-----------------------------------------------------------------------------------------
|
|
230 |
|
|
231 |
/// Function sends the data message to lower layer.
|
|
232 |
/// Data is formatted to Attribute-Value Pairs.
|
|
233 |
/// Look at eap_tlv_header_c and eap_tlv_message_data_c.
|
|
234 |
eap_status_e CEapCoreInterfaceImplementation::send_data(const TDesC8& message)
|
|
235 |
{
|
|
236 |
EAP_TRACE_DEBUG(
|
|
237 |
iTools,
|
|
238 |
TRACE_FLAGS_DEFAULT,
|
|
239 |
(EAPL("CEapCoreInterfaceImplementation::send_data \n")));
|
|
240 |
|
|
241 |
return EAP_STATUS_RETURN(iTools, iTools->convert_am_error_to_eapol_error(
|
|
242 |
m_partner->SendData(
|
|
243 |
message.Ptr(),
|
|
244 |
message.Length())));
|
|
245 |
}
|
|
246 |
|
|
247 |
//-----------------------------------------------------------------------------------------
|
|
248 |
|
|
249 |
// ======== GLOBAL FUNCTIONS ========
|
|
250 |
|
|
251 |
// ---------------------------------------------------------
|
|
252 |
// Returns an instance of the proxy table.
|
|
253 |
// Returns: KErrNone
|
|
254 |
// ---------------------------------------------------------
|
|
255 |
//
|
|
256 |
EAP_FUNC_EXPORT const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
|
|
257 |
{
|
|
258 |
EAP_TRACE_DEBUG_SYMBIAN(
|
|
259 |
(_L("TImplementationProxy* ImplementationGroupProxy")));
|
|
260 |
|
|
261 |
aTableCount = sizeof( ImplementationTable) / sizeof( TImplementationProxy );
|
|
262 |
return ImplementationTable;
|
|
263 |
}
|
|
264 |
|
|
265 |
//-----------------------------------------------------------------------------------------
|
|
266 |
|
|
267 |
// End of file.
|
|
268 |
|