Removed strayed code fragment
[strongswan.git] / src / charon / plugins / kernel_klips / pfkeyv2.h
1 /*
2 RFC 2367 PF_KEY Key Management API July 1998
3
4
5 Appendix D: Sample Header File
6
7 This file defines structures and symbols for the PF_KEY Version 2
8 key management interface. It was written at the U.S. Naval Research
9 Laboratory. This file is in the public domain. The authors ask that
10 you leave this credit intact on any copies of this file.
11 */
12 #ifndef __PFKEY_V2_H
13 #define __PFKEY_V2_H 1
14
15 #define PF_KEY_V2 2
16 #define PFKEYV2_REVISION 199806L
17
18 #define SADB_RESERVED 0
19 #define SADB_GETSPI 1
20 #define SADB_UPDATE 2
21 #define SADB_ADD 3
22 #define SADB_DELETE 4
23 #define SADB_GET 5
24 #define SADB_ACQUIRE 6
25 #define SADB_REGISTER 7
26 #define SADB_EXPIRE 8
27 #define SADB_FLUSH 9
28 #define SADB_DUMP 10
29 #define SADB_X_PROMISC 11
30 #define SADB_X_PCHANGE 12
31 #define SADB_X_GRPSA 13
32 #define SADB_X_ADDFLOW 14
33 #define SADB_X_DELFLOW 15
34 #define SADB_X_DEBUG 16
35 #define SADB_X_NAT_T_NEW_MAPPING 17
36 #define SADB_MAX 17
37
38 struct sadb_msg {
39 uint8_t sadb_msg_version;
40 uint8_t sadb_msg_type;
41 uint8_t sadb_msg_errno;
42 uint8_t sadb_msg_satype;
43 uint16_t sadb_msg_len;
44 uint16_t sadb_msg_reserved;
45 uint32_t sadb_msg_seq;
46 uint32_t sadb_msg_pid;
47 };
48
49 struct sadb_ext {
50 uint16_t sadb_ext_len;
51 uint16_t sadb_ext_type;
52 };
53
54 struct sadb_sa {
55 uint16_t sadb_sa_len;
56 uint16_t sadb_sa_exttype;
57 uint32_t sadb_sa_spi;
58 uint8_t sadb_sa_replay;
59 uint8_t sadb_sa_state;
60 uint8_t sadb_sa_auth;
61 uint8_t sadb_sa_encrypt;
62 uint32_t sadb_sa_flags;
63 };
64
65 struct sadb_lifetime {
66 uint16_t sadb_lifetime_len;
67 uint16_t sadb_lifetime_exttype;
68 uint32_t sadb_lifetime_allocations;
69 uint64_t sadb_lifetime_bytes;
70 uint64_t sadb_lifetime_addtime;
71 uint64_t sadb_lifetime_usetime;
72 uint32_t sadb_x_lifetime_packets;
73 uint32_t sadb_x_lifetime_reserved;
74 };
75
76 struct sadb_address {
77 uint16_t sadb_address_len;
78 uint16_t sadb_address_exttype;
79 uint8_t sadb_address_proto;
80 uint8_t sadb_address_prefixlen;
81 uint16_t sadb_address_reserved;
82 };
83
84 struct sadb_key {
85 uint16_t sadb_key_len;
86 uint16_t sadb_key_exttype;
87 uint16_t sadb_key_bits;
88 uint16_t sadb_key_reserved;
89 };
90
91 struct sadb_ident {
92 uint16_t sadb_ident_len;
93 uint16_t sadb_ident_exttype;
94 uint16_t sadb_ident_type;
95 uint16_t sadb_ident_reserved;
96 uint64_t sadb_ident_id;
97 };
98
99 struct sadb_sens {
100 uint16_t sadb_sens_len;
101 uint16_t sadb_sens_exttype;
102 uint32_t sadb_sens_dpd;
103 uint8_t sadb_sens_sens_level;
104 uint8_t sadb_sens_sens_len;
105 uint8_t sadb_sens_integ_level;
106 uint8_t sadb_sens_integ_len;
107 uint32_t sadb_sens_reserved;
108 };
109
110 struct sadb_prop {
111 uint16_t sadb_prop_len;
112 uint16_t sadb_prop_exttype;
113 uint8_t sadb_prop_replay;
114 uint8_t sadb_prop_reserved[3];
115 };
116
117 struct sadb_comb {
118 uint8_t sadb_comb_auth;
119 uint8_t sadb_comb_encrypt;
120 uint16_t sadb_comb_flags;
121 uint16_t sadb_comb_auth_minbits;
122 uint16_t sadb_comb_auth_maxbits;
123 uint16_t sadb_comb_encrypt_minbits;
124 uint16_t sadb_comb_encrypt_maxbits;
125 uint32_t sadb_comb_reserved;
126 uint32_t sadb_comb_soft_allocations;
127 uint32_t sadb_comb_hard_allocations;
128 uint64_t sadb_comb_soft_bytes;
129 uint64_t sadb_comb_hard_bytes;
130 uint64_t sadb_comb_soft_addtime;
131 uint64_t sadb_comb_hard_addtime;
132 uint64_t sadb_comb_soft_usetime;
133 uint64_t sadb_comb_hard_usetime;
134 uint32_t sadb_x_comb_soft_packets;
135 uint32_t sadb_x_comb_hard_packets;
136 };
137
138 struct sadb_supported {
139 uint16_t sadb_supported_len;
140 uint16_t sadb_supported_exttype;
141 uint32_t sadb_supported_reserved;
142 };
143
144 struct sadb_alg {
145 uint8_t sadb_alg_id;
146 uint8_t sadb_alg_ivlen;
147 uint16_t sadb_alg_minbits;
148 uint16_t sadb_alg_maxbits;
149 uint16_t sadb_alg_reserved;
150 };
151
152 struct sadb_spirange {
153 uint16_t sadb_spirange_len;
154 uint16_t sadb_spirange_exttype;
155 uint32_t sadb_spirange_min;
156 uint32_t sadb_spirange_max;
157 uint32_t sadb_spirange_reserved;
158 };
159
160 struct sadb_x_kmprivate {
161 uint16_t sadb_x_kmprivate_len;
162 uint16_t sadb_x_kmprivate_exttype;
163 uint32_t sadb_x_kmprivate_reserved;
164 };
165
166 struct sadb_x_satype {
167 uint16_t sadb_x_satype_len;
168 uint16_t sadb_x_satype_exttype;
169 uint8_t sadb_x_satype_satype;
170 uint8_t sadb_x_satype_reserved[3];
171 };
172
173 struct sadb_x_debug {
174 uint16_t sadb_x_debug_len;
175 uint16_t sadb_x_debug_exttype;
176 uint32_t sadb_x_debug_tunnel;
177 uint32_t sadb_x_debug_netlink;
178 uint32_t sadb_x_debug_xform;
179 uint32_t sadb_x_debug_eroute;
180 uint32_t sadb_x_debug_spi;
181 uint32_t sadb_x_debug_radij;
182 uint32_t sadb_x_debug_esp;
183 uint32_t sadb_x_debug_ah;
184 uint32_t sadb_x_debug_rcv;
185 uint32_t sadb_x_debug_pfkey;
186 uint32_t sadb_x_debug_ipcomp;
187 uint32_t sadb_x_debug_verbose;
188 uint8_t sadb_x_debug_reserved[4];
189 };
190
191 struct sadb_x_nat_t_type {
192 uint16_t sadb_x_nat_t_type_len;
193 uint16_t sadb_x_nat_t_type_exttype;
194 uint8_t sadb_x_nat_t_type_type;
195 uint8_t sadb_x_nat_t_type_reserved[3];
196 };
197 struct sadb_x_nat_t_port {
198 uint16_t sadb_x_nat_t_port_len;
199 uint16_t sadb_x_nat_t_port_exttype;
200 uint16_t sadb_x_nat_t_port_port;
201 uint16_t sadb_x_nat_t_port_reserved;
202 };
203
204 /*
205 * A protocol structure for passing through the transport level
206 * protocol. It contains more fields than are actually used/needed
207 * but it is this way to be compatible with the structure used in
208 * OpenBSD (http://www.openbsd.org/cgi-bin/cvsweb/src/sys/net/pfkeyv2.h)
209 */
210 struct sadb_protocol {
211 uint16_t sadb_protocol_len;
212 uint16_t sadb_protocol_exttype;
213 uint8_t sadb_protocol_proto;
214 uint8_t sadb_protocol_direction;
215 uint8_t sadb_protocol_flags;
216 uint8_t sadb_protocol_reserved2;
217 };
218
219 #define SADB_EXT_RESERVED 0
220 #define SADB_EXT_SA 1
221 #define SADB_EXT_LIFETIME_CURRENT 2
222 #define SADB_EXT_LIFETIME_HARD 3
223 #define SADB_EXT_LIFETIME_SOFT 4
224 #define SADB_EXT_ADDRESS_SRC 5
225 #define SADB_EXT_ADDRESS_DST 6
226 #define SADB_EXT_ADDRESS_PROXY 7
227 #define SADB_EXT_KEY_AUTH 8
228 #define SADB_EXT_KEY_ENCRYPT 9
229 #define SADB_EXT_IDENTITY_SRC 10
230 #define SADB_EXT_IDENTITY_DST 11
231 #define SADB_EXT_SENSITIVITY 12
232 #define SADB_EXT_PROPOSAL 13
233 #define SADB_EXT_SUPPORTED_AUTH 14
234 #define SADB_EXT_SUPPORTED_ENCRYPT 15
235 #define SADB_EXT_SPIRANGE 16
236 #define SADB_X_EXT_KMPRIVATE 17
237 #define SADB_X_EXT_SATYPE2 18
238 #define SADB_X_EXT_SA2 19
239 #define SADB_X_EXT_ADDRESS_DST2 20
240 #define SADB_X_EXT_ADDRESS_SRC_FLOW 21
241 #define SADB_X_EXT_ADDRESS_DST_FLOW 22
242 #define SADB_X_EXT_ADDRESS_SRC_MASK 23
243 #define SADB_X_EXT_ADDRESS_DST_MASK 24
244 #define SADB_X_EXT_DEBUG 25
245 #define SADB_X_EXT_PROTOCOL 26
246 #define SADB_X_EXT_NAT_T_TYPE 27
247 #define SADB_X_EXT_NAT_T_SPORT 28
248 #define SADB_X_EXT_NAT_T_DPORT 29
249 #define SADB_X_EXT_NAT_T_OA 30
250 #define SADB_EXT_MAX 30
251
252 /* SADB_X_DELFLOW required over and above SADB_X_SAFLAGS_CLEARFLOW */
253 #define SADB_X_EXT_ADDRESS_DELFLOW \
254 ( (1<<SADB_X_EXT_ADDRESS_SRC_FLOW) \
255 | (1<<SADB_X_EXT_ADDRESS_DST_FLOW) \
256 | (1<<SADB_X_EXT_ADDRESS_SRC_MASK) \
257 | (1<<SADB_X_EXT_ADDRESS_DST_MASK))
258
259 #define SADB_SATYPE_UNSPEC 0
260 #define SADB_SATYPE_AH 2
261 #define SADB_SATYPE_ESP 3
262 #define SADB_SATYPE_RSVP 5
263 #define SADB_SATYPE_OSPFV2 6
264 #define SADB_SATYPE_RIPV2 7
265 #define SADB_SATYPE_MIP 8
266 #define SADB_X_SATYPE_IPIP 9
267 #define SADB_X_SATYPE_COMP 10
268 #define SADB_X_SATYPE_INT 11
269 #define SADB_SATYPE_MAX 11
270
271 #define SADB_SASTATE_LARVAL 0
272 #define SADB_SASTATE_MATURE 1
273 #define SADB_SASTATE_DYING 2
274 #define SADB_SASTATE_DEAD 3
275 #define SADB_SASTATE_MAX 3
276
277 #define SADB_SAFLAGS_PFS 1
278 #define SADB_X_SAFLAGS_REPLACEFLOW 2
279 #define SADB_X_SAFLAGS_CLEARFLOW 4
280 #define SADB_X_SAFLAGS_INFLOW 8
281
282 #define SADB_AALG_NONE 0
283 #define SADB_AALG_MD5HMAC 2
284 #define SADB_AALG_SHA1HMAC 3
285 #define SADB_AALG_SHA256_HMAC 5
286 #define SADB_AALG_SHA384_HMAC 6
287 #define SADB_AALG_SHA512_HMAC 7
288 #define SADB_AALG_RIPEMD160HMAC 8
289 #define SADB_AALG_MAX 15
290
291 #define SADB_EALG_NONE 0
292 #define SADB_EALG_DESCBC 2
293 #define SADB_EALG_3DESCBC 3
294 #define SADB_EALG_BFCBC 7
295 #define SADB_EALG_NULL 11
296 #define SADB_EALG_AESCBC 12
297 #define SADB_EALG_MAX 255
298
299 #define SADB_X_CALG_NONE 0
300 #define SADB_X_CALG_OUI 1
301 #define SADB_X_CALG_DEFLATE 2
302 #define SADB_X_CALG_LZS 3
303 #define SADB_X_CALG_V42BIS 4
304 #define SADB_X_CALG_MAX 4
305
306 #define SADB_X_TALG_NONE 0
307 #define SADB_X_TALG_IPv4_in_IPv4 1
308 #define SADB_X_TALG_IPv6_in_IPv4 2
309 #define SADB_X_TALG_IPv4_in_IPv6 3
310 #define SADB_X_TALG_IPv6_in_IPv6 4
311 #define SADB_X_TALG_MAX 4
312
313
314 #define SADB_IDENTTYPE_RESERVED 0
315 #define SADB_IDENTTYPE_PREFIX 1
316 #define SADB_IDENTTYPE_FQDN 2
317 #define SADB_IDENTTYPE_USERFQDN 3
318 #define SADB_X_IDENTTYPE_CONNECTION 4
319 #define SADB_IDENTTYPE_MAX 4
320
321 #define SADB_KEY_FLAGS_MAX 0
322 #endif /* __PFKEY_V2_H */