|
1 /* |
|
2 * Copyright (c) 1999-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: Key management daemon PFKEY message module. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef PFKEYMSG_H |
|
19 #define PFKEYMSG_H |
|
20 |
|
21 #include <es_sock.h> |
|
22 #include <in_sock.h> |
|
23 #include <lib_pfkey.h> |
|
24 |
|
25 #include <networking/pfkeyv2.h> |
|
26 #include <networking/pfkeyext.h> |
|
27 |
|
28 // |
|
29 // Classes for handling PFKEY structures. |
|
30 // |
|
31 |
|
32 class TPfkeyBase |
|
33 { |
|
34 public: |
|
35 const struct sadb_msg* iMsg; |
|
36 TPfkeyBase(); |
|
37 |
|
38 #ifdef _DEBUG |
|
39 void String( TDes &aStr, |
|
40 const TDesC &aLabel ) const; |
|
41 #endif |
|
42 }; |
|
43 |
|
44 class TPfkeyAssociation |
|
45 { |
|
46 public: |
|
47 const struct sadb_sa* iExt; |
|
48 TPfkeyAssociation(); |
|
49 |
|
50 #ifdef _DEBUG |
|
51 void String( TDes &aStr, |
|
52 const TDesC &aLabel ) const; |
|
53 #endif |
|
54 }; |
|
55 |
|
56 class TPfkeyLifetime |
|
57 { |
|
58 public: |
|
59 const struct sadb_lifetime* iExt; |
|
60 TPfkeyLifetime(); |
|
61 |
|
62 #ifdef _DEBUG |
|
63 void String( TDes &aStr, |
|
64 const TDesC &aLabel ) const; |
|
65 #endif |
|
66 }; |
|
67 |
|
68 class TPfkeyAddress |
|
69 { |
|
70 public: |
|
71 const struct sadb_address* iExt; |
|
72 const TInetAddr* iAddr; |
|
73 TPfkeyAddress(); |
|
74 IMPORT_C const TInetAddr& Address() const; |
|
75 |
|
76 #ifdef _DEBUG |
|
77 void String( TDes &aStr, |
|
78 const TDesC &aLabel ) const; |
|
79 #endif |
|
80 }; |
|
81 |
|
82 class TPfkeyKey |
|
83 { |
|
84 public: |
|
85 const struct sadb_key* iExt; |
|
86 TPtrC8 iData; |
|
87 TPfkeyKey(); |
|
88 |
|
89 #ifdef _DEBUG |
|
90 void String( TDes &aStr, |
|
91 const TDesC &aLabel ) const; |
|
92 #endif |
|
93 }; |
|
94 |
|
95 class TPfkeyIdentity |
|
96 { |
|
97 public: |
|
98 const struct sadb_ident* iExt; |
|
99 TPtrC8 iData; |
|
100 TPfkeyIdentity(); |
|
101 |
|
102 #ifdef _DEBUG |
|
103 void String( TDes &aStr, |
|
104 const TDesC &aLabel ) const; |
|
105 #endif |
|
106 }; |
|
107 |
|
108 class TPfkeySensitivity |
|
109 { |
|
110 public: |
|
111 const struct sadb_sens* iExt; |
|
112 TPtrC8 iSensBitmap; |
|
113 TPtrC8 iIntegBitmap; |
|
114 TPfkeySensitivity(); |
|
115 |
|
116 #ifdef _DEBUG |
|
117 void String( TDes &aStr, |
|
118 const TDesC &aLabel ) const; |
|
119 #endif |
|
120 }; |
|
121 |
|
122 class TPfkeyProposal |
|
123 { |
|
124 public: |
|
125 const struct sadb_prop* iExt; |
|
126 const struct sadb_comb* iComb; |
|
127 TInt iNumComb; |
|
128 TPfkeyProposal(); |
|
129 |
|
130 #ifdef _DEBUG |
|
131 void String( TDes &aStr, |
|
132 const TDesC &aLabel ) const; |
|
133 #endif |
|
134 }; |
|
135 |
|
136 class TPfkeySupported |
|
137 { |
|
138 public: |
|
139 const struct sadb_supported* iExt; |
|
140 const struct sadb_alg* iAlg; |
|
141 TInt iNumAlg; |
|
142 TPfkeySupported(); |
|
143 |
|
144 #ifdef _DEBUG |
|
145 void String( TDes &aStr, |
|
146 const TDesC &aLabel ) const; |
|
147 #endif |
|
148 virtual void AlgString( TDes &aStr, |
|
149 TUint8 aAlg ) const = 0; |
|
150 }; |
|
151 |
|
152 class TPfkeySupportedAuth : public TPfkeySupported |
|
153 { |
|
154 public: |
|
155 void AlgString( TDes &aStr, |
|
156 TUint8 aAlg ) const; |
|
157 static void Alg2String( TDes &aStr, |
|
158 TUint8 aAlg ); |
|
159 }; |
|
160 |
|
161 class TPfkeySupportedEncrypt : public TPfkeySupported |
|
162 { |
|
163 public: |
|
164 void AlgString( TDes &aStr, |
|
165 TUint8 aAlg ) const; |
|
166 static void Alg2String( TDes &aStr, |
|
167 TUint8 aAlg ); |
|
168 }; |
|
169 |
|
170 class TPfkeySpirange |
|
171 { |
|
172 public: |
|
173 const struct sadb_spirange* iExt; |
|
174 TPfkeySpirange(); |
|
175 |
|
176 #ifdef _DEBUG |
|
177 void String( TDes &aStr, |
|
178 const TDesC &aLabel ) const; |
|
179 #endif |
|
180 }; |
|
181 |
|
182 class TPfKeySelector: public sadb_x_selector |
|
183 { |
|
184 public: |
|
185 TInetAddr iSrc; |
|
186 TInetAddr iDst; |
|
187 }; |
|
188 |
|
189 class TPfkeyTs |
|
190 { |
|
191 public: |
|
192 const struct sadb_x_ts* iExt; |
|
193 TPfkeyTs(); |
|
194 IMPORT_C TInt SelectorCount() const; |
|
195 IMPORT_C const TPfKeySelector& Selector( TInt aIndex ) const; |
|
196 |
|
197 #ifdef _DEBUG |
|
198 void String( TDes &aStr, |
|
199 const TDesC &aLabel ) const; |
|
200 #endif |
|
201 }; |
|
202 |
|
203 |
|
204 class TPFkeyPrivExt |
|
205 { |
|
206 public: |
|
207 const struct sadb_gen_ext* iExt; |
|
208 TPtrC8 iData; |
|
209 TPFkeyPrivExt(); |
|
210 |
|
211 #ifdef _DEBUG |
|
212 void String( TDes &aStr, |
|
213 const TDesC &aLabel ) const; |
|
214 #endif |
|
215 }; |
|
216 |
|
217 |
|
218 // |
|
219 // Internal presentation of the PF_KEY message |
|
220 // |
|
221 class TPfkeyMessage |
|
222 { |
|
223 public: |
|
224 // |
|
225 // Construct internal presentation from the PFKEY bytestream message |
|
226 TPfkeyMessage( TPfkeyRecvMsg& aMsg ); |
|
227 TPfkeyMessage(); |
|
228 TInt iError; // == KErrNone, if message format valid. |
|
229 TPfkeyBase iBase; |
|
230 TPfkeyAssociation iSa; |
|
231 TPfkeyLifetime iCurrent; |
|
232 TPfkeyLifetime iHard; |
|
233 TPfkeyLifetime iSoft; |
|
234 TPfkeyAddress iSrcAddr; |
|
235 TPfkeyAddress iDstAddr; |
|
236 TPfkeyAddress iProxyAddr; |
|
237 TPfkeyKey iAuthKey; |
|
238 TPfkeyKey iEncryptKey; |
|
239 TPfkeyIdentity iSrcIdent; |
|
240 TPfkeyIdentity iDstIdent; |
|
241 TPfkeySensitivity iSensitivity; |
|
242 TPfkeyProposal iProposal; |
|
243 TPfkeySupportedAuth iAuthAlgs; |
|
244 TPfkeySupportedEncrypt iEncryptAlgs; |
|
245 TPfkeySpirange iSpirange; |
|
246 TPfkeyTs iTs; |
|
247 TPFkeyPrivExt iPrivateExtension; // For ESP UDP encapsulation |
|
248 }; |
|
249 |
|
250 #endif // PFKEYMSG_H |