OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [net/] [bsd_tcpip/] [current/] [include/] [net/] [pfkeyv2.h] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
//==========================================================================
2
//
3
//      include/net/pfkeyv2.h
4
//
5
//==========================================================================
6
// ####BSDCOPYRIGHTBEGIN####                                    
7
// -------------------------------------------                  
8
// This file is part of eCos, the Embedded Configurable Operating System.
9
//
10
// Portions of this software may have been derived from FreeBSD 
11
// or other sources, and if so are covered by the appropriate copyright
12
// and license included herein.                                 
13
//
14
// Portions created by the Free Software Foundation are         
15
// Copyright (C) 2002 Free Software Foundation, Inc.            
16
// -------------------------------------------                  
17
// ####BSDCOPYRIGHTEND####                                      
18
//==========================================================================
19
 
20
/*      $KAME: pfkeyv2.h,v 1.27 2001/07/31 06:41:24 itojun Exp $        */
21
 
22
/*
23
 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
24
 * All rights reserved.
25
 *
26
 * Redistribution and use in source and binary forms, with or without
27
 * modification, are permitted provided that the following conditions
28
 * are met:
29
 * 1. Redistributions of source code must retain the above copyright
30
 *    notice, this list of conditions and the following disclaimer.
31
 * 2. Redistributions in binary form must reproduce the above copyright
32
 *    notice, this list of conditions and the following disclaimer in the
33
 *    documentation and/or other materials provided with the distribution.
34
 * 3. Neither the name of the project nor the names of its contributors
35
 *    may be used to endorse or promote products derived from this software
36
 *    without specific prior written permission.
37
 *
38
 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
39
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
41
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
42
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
43
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
44
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
45
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
46
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
47
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
48
 * SUCH DAMAGE.
49
 */
50
 
51
/*
52
 * This file has been derived rfc 2367,
53
 * And added some flags of SADB_KEY_FLAGS_ as SADB_X_EXT_.
54
 *      sakane@ydc.co.jp
55
 */
56
 
57
#ifndef _NET_PFKEYV2_H_
58
#define _NET_PFKEYV2_H_
59
 
60
/*
61
This file defines structures and symbols for the PF_KEY Version 2
62
key management interface. It was written at the U.S. Naval Research
63
Laboratory. This file is in the public domain. The authors ask that
64
you leave this credit intact on any copies of this file.
65
*/
66
#ifndef __PFKEY_V2_H
67
#define __PFKEY_V2_H 1
68
 
69
#define PF_KEY_V2 2
70
#define PFKEYV2_REVISION        199806L
71
 
72
#define SADB_RESERVED    0
73
#define SADB_GETSPI      1
74
#define SADB_UPDATE      2
75
#define SADB_ADD         3
76
#define SADB_DELETE      4
77
#define SADB_GET         5
78
#define SADB_ACQUIRE     6
79
#define SADB_REGISTER    7
80
#define SADB_EXPIRE      8
81
#define SADB_FLUSH       9
82
#define SADB_DUMP        10
83
#define SADB_X_PROMISC   11
84
#define SADB_X_PCHANGE   12
85
 
86
#define SADB_X_SPDUPDATE  13
87
#define SADB_X_SPDADD     14
88
#define SADB_X_SPDDELETE  15    /* by policy index */
89
#define SADB_X_SPDGET     16
90
#define SADB_X_SPDACQUIRE 17
91
#define SADB_X_SPDDUMP    18
92
#define SADB_X_SPDFLUSH   19
93
#define SADB_X_SPDSETIDX  20
94
#define SADB_X_SPDEXPIRE  21
95
#define SADB_X_SPDDELETE2 22    /* by policy id */
96
#define SADB_MAX          22
97
 
98
struct sadb_msg {
99
  u_int8_t sadb_msg_version;
100
  u_int8_t sadb_msg_type;
101
  u_int8_t sadb_msg_errno;
102
  u_int8_t sadb_msg_satype;
103
  u_int16_t sadb_msg_len;
104
  u_int16_t sadb_msg_reserved;
105
  u_int32_t sadb_msg_seq;
106
  u_int32_t sadb_msg_pid;
107
};
108
 
109
struct sadb_ext {
110
  u_int16_t sadb_ext_len;
111
  u_int16_t sadb_ext_type;
112
};
113
 
114
struct sadb_sa {
115
  u_int16_t sadb_sa_len;
116
  u_int16_t sadb_sa_exttype;
117
  u_int32_t sadb_sa_spi;
118
  u_int8_t sadb_sa_replay;
119
  u_int8_t sadb_sa_state;
120
  u_int8_t sadb_sa_auth;
121
  u_int8_t sadb_sa_encrypt;
122
  u_int32_t sadb_sa_flags;
123
};
124
 
125
struct sadb_lifetime {
126
  u_int16_t sadb_lifetime_len;
127
  u_int16_t sadb_lifetime_exttype;
128
  u_int32_t sadb_lifetime_allocations;
129
  u_int64_t sadb_lifetime_bytes;
130
  u_int64_t sadb_lifetime_addtime;
131
  u_int64_t sadb_lifetime_usetime;
132
};
133
 
134
struct sadb_address {
135
  u_int16_t sadb_address_len;
136
  u_int16_t sadb_address_exttype;
137
  u_int8_t sadb_address_proto;
138
  u_int8_t sadb_address_prefixlen;
139
  u_int16_t sadb_address_reserved;
140
};
141
 
142
struct sadb_key {
143
  u_int16_t sadb_key_len;
144
  u_int16_t sadb_key_exttype;
145
  u_int16_t sadb_key_bits;
146
  u_int16_t sadb_key_reserved;
147
};
148
 
149
struct sadb_ident {
150
  u_int16_t sadb_ident_len;
151
  u_int16_t sadb_ident_exttype;
152
  u_int16_t sadb_ident_type;
153
  u_int16_t sadb_ident_reserved;
154
  u_int64_t sadb_ident_id;
155
};
156
 
157
struct sadb_sens {
158
  u_int16_t sadb_sens_len;
159
  u_int16_t sadb_sens_exttype;
160
  u_int32_t sadb_sens_dpd;
161
  u_int8_t sadb_sens_sens_level;
162
  u_int8_t sadb_sens_sens_len;
163
  u_int8_t sadb_sens_integ_level;
164
  u_int8_t sadb_sens_integ_len;
165
  u_int32_t sadb_sens_reserved;
166
};
167
 
168
struct sadb_prop {
169
  u_int16_t sadb_prop_len;
170
  u_int16_t sadb_prop_exttype;
171
  u_int8_t sadb_prop_replay;
172
  u_int8_t sadb_prop_reserved[3];
173
};
174
 
175
struct sadb_comb {
176
  u_int8_t sadb_comb_auth;
177
  u_int8_t sadb_comb_encrypt;
178
  u_int16_t sadb_comb_flags;
179
  u_int16_t sadb_comb_auth_minbits;
180
  u_int16_t sadb_comb_auth_maxbits;
181
  u_int16_t sadb_comb_encrypt_minbits;
182
  u_int16_t sadb_comb_encrypt_maxbits;
183
  u_int32_t sadb_comb_reserved;
184
  u_int32_t sadb_comb_soft_allocations;
185
  u_int32_t sadb_comb_hard_allocations;
186
  u_int64_t sadb_comb_soft_bytes;
187
  u_int64_t sadb_comb_hard_bytes;
188
  u_int64_t sadb_comb_soft_addtime;
189
  u_int64_t sadb_comb_hard_addtime;
190
  u_int64_t sadb_comb_soft_usetime;
191
  u_int64_t sadb_comb_hard_usetime;
192
};
193
 
194
struct sadb_supported {
195
  u_int16_t sadb_supported_len;
196
  u_int16_t sadb_supported_exttype;
197
  u_int32_t sadb_supported_reserved;
198
};
199
 
200
struct sadb_alg {
201
  u_int8_t sadb_alg_id;
202
  u_int8_t sadb_alg_ivlen;
203
  u_int16_t sadb_alg_minbits;
204
  u_int16_t sadb_alg_maxbits;
205
  u_int16_t sadb_alg_reserved;
206
};
207
 
208
struct sadb_spirange {
209
  u_int16_t sadb_spirange_len;
210
  u_int16_t sadb_spirange_exttype;
211
  u_int32_t sadb_spirange_min;
212
  u_int32_t sadb_spirange_max;
213
  u_int32_t sadb_spirange_reserved;
214
};
215
 
216
struct sadb_x_kmprivate {
217
  u_int16_t sadb_x_kmprivate_len;
218
  u_int16_t sadb_x_kmprivate_exttype;
219
  u_int32_t sadb_x_kmprivate_reserved;
220
};
221
 
222
/*
223
 * XXX Additional SA Extension.
224
 * mode: tunnel or transport
225
 * reqid: to make SA unique nevertheless the address pair of SA are same.
226
 *        Mainly it's for VPN.
227
 */
228
struct sadb_x_sa2 {
229
  u_int16_t sadb_x_sa2_len;
230
  u_int16_t sadb_x_sa2_exttype;
231
  u_int8_t sadb_x_sa2_mode;
232
  u_int8_t sadb_x_sa2_reserved1;
233
  u_int16_t sadb_x_sa2_reserved2;
234
  u_int32_t sadb_x_sa2_sequence;
235
  u_int32_t sadb_x_sa2_reqid;
236
};
237
 
238
/* XXX Policy Extension */
239
/* sizeof(struct sadb_x_policy) == 16 */
240
struct sadb_x_policy {
241
  u_int16_t sadb_x_policy_len;
242
  u_int16_t sadb_x_policy_exttype;
243
  u_int16_t sadb_x_policy_type;         /* See policy type of ipsec.h */
244
  u_int8_t sadb_x_policy_dir;           /* direction, see ipsec.h */
245
  u_int8_t sadb_x_policy_reserved;
246
  u_int32_t sadb_x_policy_id;
247
  u_int32_t sadb_x_policy_reserved2;
248
};
249
/*
250
 * When policy_type == IPSEC, it is followed by some of
251
 * the ipsec policy request.
252
 * [total length of ipsec policy requests]
253
 *      = (sadb_x_policy_len * sizeof(uint64_t) - sizeof(struct sadb_x_policy))
254
 */
255
 
256
/* XXX IPsec Policy Request Extension */
257
/*
258
 * This structure is aligned 8 bytes.
259
 */
260
struct sadb_x_ipsecrequest {
261
  u_int16_t sadb_x_ipsecrequest_len;    /* structure length aligned to 8 bytes.
262
                                         * This value is true length of bytes.
263
                                         * Not in units of 64 bits. */
264
  u_int16_t sadb_x_ipsecrequest_proto;  /* See ipsec.h */
265
  u_int8_t sadb_x_ipsecrequest_mode;    /* See IPSEC_MODE_XX in ipsec.h. */
266
  u_int8_t sadb_x_ipsecrequest_level;   /* See IPSEC_LEVEL_XX in ipsec.h */
267
  u_int16_t sadb_x_ipsecrequest_reqid;  /* See ipsec.h */
268
 
269
  /*
270
   * followed by source IP address of SA, and immediately followed by
271
   * destination IP address of SA.  These encoded into two of sockaddr
272
   * structure without any padding.  Must set each sa_len exactly.
273
   * Each of length of the sockaddr structure are not aligned to 64bits,
274
   * but sum of x_request and addresses is aligned to 64bits.
275
   */
276
};
277
 
278
#define SADB_EXT_RESERVED             0
279
#define SADB_EXT_SA                   1
280
#define SADB_EXT_LIFETIME_CURRENT     2
281
#define SADB_EXT_LIFETIME_HARD        3
282
#define SADB_EXT_LIFETIME_SOFT        4
283
#define SADB_EXT_ADDRESS_SRC          5
284
#define SADB_EXT_ADDRESS_DST          6
285
#define SADB_EXT_ADDRESS_PROXY        7
286
#define SADB_EXT_KEY_AUTH             8
287
#define SADB_EXT_KEY_ENCRYPT          9
288
#define SADB_EXT_IDENTITY_SRC         10
289
#define SADB_EXT_IDENTITY_DST         11
290
#define SADB_EXT_SENSITIVITY          12
291
#define SADB_EXT_PROPOSAL             13
292
#define SADB_EXT_SUPPORTED_AUTH       14
293
#define SADB_EXT_SUPPORTED_ENCRYPT    15
294
#define SADB_EXT_SPIRANGE             16
295
#define SADB_X_EXT_KMPRIVATE          17
296
#define SADB_X_EXT_POLICY             18
297
#define SADB_X_EXT_SA2                19
298
#define SADB_EXT_MAX                  19
299
 
300
#define SADB_SATYPE_UNSPEC      0
301
#define SADB_SATYPE_AH          2
302
#define SADB_SATYPE_ESP         3
303
#define SADB_SATYPE_RSVP        5
304
#define SADB_SATYPE_OSPFV2      6
305
#define SADB_SATYPE_RIPV2       7
306
#define SADB_SATYPE_MIP         8
307
#define SADB_X_SATYPE_IPCOMP    9
308
/*#define SADB_X_SATYPE_POLICY  10      obsolete, do not reuse */
309
#define SADB_SATYPE_MAX         11
310
 
311
#define SADB_SASTATE_LARVAL   0
312
#define SADB_SASTATE_MATURE   1
313
#define SADB_SASTATE_DYING    2
314
#define SADB_SASTATE_DEAD     3
315
#define SADB_SASTATE_MAX      3
316
 
317
#define SADB_SAFLAGS_PFS      1
318
 
319
/* RFC2367 numbers - meets RFC2407 */
320
#define SADB_AALG_NONE          0
321
#define SADB_AALG_MD5HMAC       2
322
#define SADB_AALG_SHA1HMAC      3
323
#define SADB_AALG_MAX           251
324
/* private allocations - based on RFC2407/IANA assignment */
325
#define SADB_X_AALG_SHA2_256    5
326
#define SADB_X_AALG_SHA2_384    6
327
#define SADB_X_AALG_SHA2_512    7
328
/* private allocations should use 249-255 (RFC2407) */
329
#define SADB_X_AALG_MD5         249     /* Keyed MD5 */
330
#define SADB_X_AALG_SHA         250     /* Keyed SHA */
331
#define SADB_X_AALG_NULL        251     /* null authentication */
332
 
333
/* RFC2367 numbers - meets RFC2407 */
334
#define SADB_EALG_NONE          0
335
#define SADB_EALG_DESCBC        2
336
#define SADB_EALG_3DESCBC       3
337
#define SADB_EALG_NULL          11
338
#define SADB_EALG_MAX           253
339
/* private allocations - based on RFC2407/IANA assignment */
340
#define SADB_X_EALG_CAST128CBC  6
341
#define SADB_X_EALG_BLOWFISHCBC 7
342
#define SADB_X_EALG_RIJNDAELCBC 12
343
#define SADB_X_EALG_AES         12
344
/* private allocations should use 249-255 (RFC2407) */
345
#define SADB_X_EALG_TWOFISHCBC  253     /* draft-ietf-ipsec-ciph-aes-cbc-00 */
346
 
347
#if 1   /*nonstandard */
348
#define SADB_X_CALG_NONE        0
349
#define SADB_X_CALG_OUI         1
350
#define SADB_X_CALG_DEFLATE     2
351
#define SADB_X_CALG_LZS         3
352
#define SADB_X_CALG_MAX         4
353
#endif
354
 
355
#define SADB_IDENTTYPE_RESERVED   0
356
#define SADB_IDENTTYPE_PREFIX     1
357
#define SADB_IDENTTYPE_FQDN       2
358
#define SADB_IDENTTYPE_USERFQDN   3
359
#define SADB_X_IDENTTYPE_ADDR     4
360
#define SADB_IDENTTYPE_MAX        4
361
 
362
/* `flags' in sadb_sa structure holds followings */
363
#define SADB_X_EXT_NONE         0x0000  /* i.e. new format. */
364
#define SADB_X_EXT_OLD          0x0001  /* old format. */
365
 
366
#define SADB_X_EXT_IV4B         0x0010  /* IV length of 4 bytes in use */
367
#define SADB_X_EXT_DERIV        0x0020  /* DES derived */
368
#define SADB_X_EXT_CYCSEQ       0x0040  /* allowing to cyclic sequence. */
369
 
370
        /* three of followings are exclusive flags each them */
371
#define SADB_X_EXT_PSEQ         0x0000  /* sequencial padding for ESP */
372
#define SADB_X_EXT_PRAND        0x0100  /* random padding for ESP */
373
#define SADB_X_EXT_PZERO        0x0200  /* zero padding for ESP */
374
#define SADB_X_EXT_PMASK        0x0300  /* mask for padding flag */
375
 
376
#if 1
377
#define SADB_X_EXT_RAWCPI       0x0080  /* use well known CPI (IPComp) */
378
#endif
379
 
380
#define SADB_KEY_FLAGS_MAX      0x0fff
381
 
382
/* SPI size for PF_KEYv2 */
383
#define PFKEY_SPI_SIZE  sizeof(u_int32_t)
384
 
385
/* Identifier for menber of lifetime structure */
386
#define SADB_X_LIFETIME_ALLOCATIONS     0
387
#define SADB_X_LIFETIME_BYTES           1
388
#define SADB_X_LIFETIME_ADDTIME         2
389
#define SADB_X_LIFETIME_USETIME         3
390
 
391
/* The rate for SOFT lifetime against HARD one. */
392
#define PFKEY_SOFT_LIFETIME_RATE        80
393
 
394
/* Utilities */
395
#define PFKEY_ALIGN8(a) (1 + (((a) - 1) | (8 - 1)))
396
#define PFKEY_EXTLEN(msg) \
397
        PFKEY_UNUNIT64(((struct sadb_ext *)(msg))->sadb_ext_len)
398
#define PFKEY_ADDR_PREFIX(ext) \
399
        (((struct sadb_address *)(ext))->sadb_address_prefixlen)
400
#define PFKEY_ADDR_PROTO(ext) \
401
        (((struct sadb_address *)(ext))->sadb_address_proto)
402
#define PFKEY_ADDR_SADDR(ext) \
403
        ((struct sockaddr *)((caddr_t)(ext) + sizeof(struct sadb_address)))
404
 
405
/* in 64bits */
406
#define PFKEY_UNUNIT64(a)       ((a) << 3)
407
#define PFKEY_UNIT64(a)         ((a) >> 3)
408
 
409
#endif /* __PFKEY_V2_H */
410
 
411
#endif /* _NET_PFKEYV2_H_ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.