|
1 /* |
|
2 * Copyright (c) 2003-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 "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: "intermediate" class between |
|
15 * CIkev2Negotiation class of ikev2plugin and ECOM plug-in |
|
16 * |
|
17 */ |
|
18 #ifndef __IKEV2EAPINTERFACE_H_ |
|
19 #define __IKEV2EAPINTERFACE_H_ |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <abs_eap_vpn_if.h> // MAbsEapVpnInterface |
|
23 |
|
24 class CIkeData; |
|
25 class TPayloadIkev2; |
|
26 class CEapVpnInterface; |
|
27 class MIkeDebug; |
|
28 |
|
29 class MIkev2EapIfObserver |
|
30 { |
|
31 public: |
|
32 virtual void SendEapDataL(HBufC8* aEapData) = 0; |
|
33 virtual void EapEventL(TInt aEvent) = 0; |
|
34 }; |
|
35 |
|
36 /** |
|
37 * CIkev2EapIf |
|
38 * |
|
39 * CIkev2EapIf is an "intermediate" class between |
|
40 * CIkev2Negotiation class of ikev2plugin and ECOM plug-in (eapplugin) |
|
41 * which provides access into general EAP protocol implementation in |
|
42 * system. CIkev2EapIf implements also the callback functions required |
|
43 * by the EAP ECOM plug-in. |
|
44 * |
|
45 * @lib internal ikev2lib.lib |
|
46 * @since S60 3.0 |
|
47 */ |
|
48 NONSHARABLE_CLASS(CIkev2EapIf) : public CBase, public MAbsEapVpnInterface |
|
49 { |
|
50 public: |
|
51 |
|
52 /** |
|
53 * NewL |
|
54 * |
|
55 * @since S60 3.0 |
|
56 * @param aNeg IKE negotiation. Must be != NULL. Ownership not taken. |
|
57 * @param aEapType EAP type. |
|
58 * @param aIkeData Ref to IKE data. Ownership not taken. |
|
59 * @param aDebug Debug trace interface |
|
60 * @return self |
|
61 */ |
|
62 static CIkev2EapIf* NewL(MIkev2EapIfObserver& aEapIfObserver, |
|
63 TUint8 aEapType, |
|
64 CIkeData* aIkeData, |
|
65 MIkeDebug& aDebug); |
|
66 |
|
67 ~CIkev2EapIf(); |
|
68 inline TInt Status() {return iErrorStatus;} |
|
69 inline HBufC8* Identity() |
|
70 { |
|
71 HBufC8* Id = (HBufC8*)iIdentity; |
|
72 iIdentity = 0; |
|
73 return Id; |
|
74 } |
|
75 inline HBufC8* MSK() |
|
76 { |
|
77 HBufC8* msk = (HBufC8*)iMSK; |
|
78 iMSK = NULL; |
|
79 return msk; |
|
80 } |
|
81 void ErrorStopL() {}; |
|
82 void EapDataInbound(TPayloadIkev2* aEapPayload); |
|
83 void QueryIdentity(); |
|
84 |
|
85 /** |
|
86 * From MAbsEapVpnInterface. |
|
87 * Implementation of pure virtual methods |
|
88 */ |
|
89 void EapOutboundL(HBufC8* aResponse); |
|
90 void EapIdentityResponseL(HBufC8* aIdentity); |
|
91 void EapSharedKeyL(HBufC8* aSharedKey); |
|
92 void EapIndication(TNotification aNotification); |
|
93 |
|
94 private: // implementation |
|
95 |
|
96 CIkev2EapIf(MIkev2EapIfObserver& aEapIfObserver, TUint8 aEapType, MIkeDebug& aDebug); |
|
97 void ConstructL(CIkeData* aIkeData); |
|
98 |
|
99 private: // data |
|
100 MIkev2EapIfObserver& iEapIfObserver; |
|
101 CEapVpnInterface* iEapPlugin; // Own: ECOM plug-in |
|
102 HBufC8* iIdentity; // Identity buffer |
|
103 HBufC8* iMSK; // Preshared key |
|
104 TInt iErrorStatus; // Error status, if construct fails |
|
105 TUint8 iEapType; |
|
106 TUint8 iReserved[3]; // Dummy for alignment |
|
107 |
|
108 /** |
|
109 * Debug trace interface. |
|
110 * Not own. |
|
111 */ |
|
112 MIkeDebug& iDebug; |
|
113 }; |
|
114 |
|
115 // |
|
116 // Internal EAP event codes used in IKEv2 plug-in EapEventL() calls |
|
117 // |
|
118 const TInt KEapEventSuccess = 0; |
|
119 const TInt KEapEventGetIdentity = 1; |
|
120 const TInt KEapEventGetPSK = 2; |
|
121 const TInt KEapEventFailed = 3; |
|
122 |
|
123 #endif // __IKEV2EAPINTERFACE_H_ |
|
124 |