|
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: IKEv1 protocol plugin interface. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef C_IKEV1PLUGIN_H |
|
19 #define C_IKEV1PLUGIN_H |
|
20 |
|
21 #include <e32base.h> |
|
22 |
|
23 #include "ikepluginif.h" |
|
24 #include "pfkeysocketif.h" |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class CIkev1PluginSession; |
|
28 class CIpsecPolicyUtil; |
|
29 class CIpsecSaSpecList; |
|
30 class CPFKeySocketIf; |
|
31 class MIkeDataInterface; |
|
32 class MIkeDebug; |
|
33 class MKmdEventLoggerIf; |
|
34 class TIpsecSPI; |
|
35 class TInetAddr; |
|
36 |
|
37 /** |
|
38 * Ikev1 protocol plugin |
|
39 * @internalComponent |
|
40 */ |
|
41 /** |
|
42 * IKEv1 protocol plugin. |
|
43 * |
|
44 * @lib internal (ikev1lib.lib) |
|
45 */ |
|
46 |
|
47 NONSHARABLE_CLASS(CIkev1Plugin) : public CBase, |
|
48 public MIkePluginIf, |
|
49 public MPFKeyMessageListener |
|
50 { |
|
51 public: |
|
52 /** |
|
53 * Two-phased constructor. |
|
54 * @param aEventLogger Event logger interface |
|
55 * @param aDebug Debug trace interface |
|
56 */ |
|
57 static CIkev1Plugin* NewL( MKmdEventLoggerIf& aEventLogger, |
|
58 MIkeDebug& aDebug ); |
|
59 /** |
|
60 * Destructor. |
|
61 */ |
|
62 ~CIkev1Plugin(); |
|
63 |
|
64 /** |
|
65 * Handles IKE plugin session deletion. |
|
66 * @param aPluginSession IKE plugin session |
|
67 */ |
|
68 void IkePluginSessionDeleted( CIkev1PluginSession* aPluginSession ); |
|
69 |
|
70 /** |
|
71 * Gets acceptable IPsec policies for specified selectors. |
|
72 * |
|
73 * @param aLocalAddr IP address, including possible port, of the local end selector |
|
74 * @param aLocalMask Local end selector mask |
|
75 * @param aRemoteAddr IP address, including possible port, of the remote end selector |
|
76 * @param aRemoteMask Remote end selector mask |
|
77 * @param aProtocol Protocol id |
|
78 * @param aVpnNetId VPN net id |
|
79 */ |
|
80 CIpsecSaSpecList* GetIpseSaSpecListLC( const TInetAddr& aLocalAddr, const TInetAddr& aLocalMask, |
|
81 const TInetAddr& aRemoteAddr, const TInetAddr& aRemoteMask, |
|
82 TInt aProtocol, TUint32 aVpnNetId ); |
|
83 |
|
84 /** |
|
85 * Returns UID. |
|
86 */ |
|
87 TUint32 Uid(); |
|
88 |
|
89 /** |
|
90 * Returns event logger interface. |
|
91 */ |
|
92 MKmdEventLoggerIf& EventLogger(); |
|
93 |
|
94 |
|
95 // Methods to build and send PFKEY API primitives to IPsec |
|
96 |
|
97 void AcquireSAError( TIpsecSAData& aSAData, |
|
98 TInt aError ); |
|
99 |
|
100 void UpdateSAL( TIpsecSAData& aSaData ); |
|
101 |
|
102 void AddSAL( TIpsecSAData& aSaData ); |
|
103 |
|
104 void DeleteIpsecSA( TIpsecSPI& aIpsecSpi ); |
|
105 |
|
106 void DeleteIpsecSA( TUint32 aSPI, |
|
107 TInetAddr& aSrc, |
|
108 TInetAddr& aDst, |
|
109 TUint8 aProtocol ); |
|
110 |
|
111 // from base class MIkePluginIf |
|
112 |
|
113 /** |
|
114 * From MIkePluginIf. |
|
115 * Creates IKEv1 plugin session. |
|
116 * @param aVpnIapId VPN IAP id |
|
117 * @param aVpnNetId VPN NET id |
|
118 * @param aVpnInterfaceIndex VPN interface index |
|
119 * @param aDataInterface IKE data interface. |
|
120 * @return IKEv1 plugin session. Ownership transferred. |
|
121 */ |
|
122 MIkePluginSessionIf* CreateSessionL( TUint32 aVpnIapId, |
|
123 TUint32 aVpnNetId, |
|
124 TUint32 aVpnInterfaceIndex, |
|
125 MIkeDataInterface& aDataInterface ); |
|
126 |
|
127 // from base class MPFKeyMessageListener |
|
128 |
|
129 /** |
|
130 * From MPFKeyMessageListener. |
|
131 * Handles received PFKEY message. |
|
132 * @param aPfkeyMessage PFKEY message |
|
133 */ |
|
134 void PfkeyMessageReceived( const TPfkeyMessage& aPfkeyMessage ); |
|
135 |
|
136 private: |
|
137 CIkev1Plugin( MKmdEventLoggerIf& aEventLogger, |
|
138 MIkeDebug& aDebug ); |
|
139 void ConstructL(); |
|
140 |
|
141 |
|
142 private: |
|
143 |
|
144 /** |
|
145 * VPN PF key socket. |
|
146 * Own. |
|
147 */ |
|
148 CPFKeySocketIf* iPFKeySocket; |
|
149 |
|
150 /** |
|
151 * IPSec policy util. |
|
152 * Own. |
|
153 */ |
|
154 CIpsecPolicyUtil* iIpsecPolicyUtil; |
|
155 |
|
156 /** |
|
157 * IKEv1 plugin sessions. |
|
158 * Not own. |
|
159 */ |
|
160 RArray<CIkev1PluginSession*> iPluginSessions; |
|
161 |
|
162 /** |
|
163 * Event logger. |
|
164 * Not own. |
|
165 */ |
|
166 MKmdEventLoggerIf& iEventLogger; |
|
167 |
|
168 /** |
|
169 * Debug trace interface. |
|
170 * Not own. |
|
171 */ |
|
172 MIkeDebug& iDebug; |
|
173 }; |
|
174 |
|
175 |
|
176 #endif // C_IKEV1PLUGIN_H |