Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Trunk/i386/include/netinet6/ipsec.h

1/*$FreeBSD: src/sys/netinet6/ipsec.h,v 1.4.2.2 2001/07/03 11:01:54 ume Exp $*/
2/*$KAME: ipsec.h,v 1.44 2001/03/23 08:08:47 itojun Exp $*/
3
4/*
5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of the project nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33/*
34 * IPsec controller part.
35 */
36
37#ifndef _NETINET6_IPSEC_H_
38#define _NETINET6_IPSEC_H_
39#include <sys/cdefs.h>
40#include <sys/appleapiopts.h>
41
42#include <net/pfkeyv2.h>
43
44/* according to IANA assignment, port 0x0000 and proto 0xff are reserved. */
45#define IPSEC_PORT_ANY0
46#define IPSEC_ULPROTO_ANY255
47#define IPSEC_PROTO_ANY255
48
49/* mode of security protocol */
50/* NOTE: DON'T use IPSEC_MODE_ANY at SPD. It's only use in SAD */
51#defineIPSEC_MODE_ANY0/* i.e. wildcard. */
52#defineIPSEC_MODE_TRANSPORT1
53#defineIPSEC_MODE_TUNNEL2
54
55/*
56 * Direction of security policy.
57 * NOTE: Since INVALID is used just as flag.
58 * The other are used for loop counter too.
59 */
60#define IPSEC_DIR_ANY0
61#define IPSEC_DIR_INBOUND1
62#define IPSEC_DIR_OUTBOUND2
63#define IPSEC_DIR_MAX3
64#define IPSEC_DIR_INVALID4
65
66/* Policy level */
67/*
68 * IPSEC, ENTRUST and BYPASS are allowed for setsockopt() in PCB,
69 * DISCARD, IPSEC and NONE are allowed for setkey() in SPD.
70 * DISCARD and NONE are allowed for system default.
71 */
72#define IPSEC_POLICY_DISCARD0/* discarding packet */
73#define IPSEC_POLICY_NONE1/* through IPsec engine */
74#define IPSEC_POLICY_IPSEC2/* do IPsec */
75#define IPSEC_POLICY_ENTRUST3/* consulting SPD if present. */
76#define IPSEC_POLICY_BYPASS4/* only for privileged socket. */
77#define IPSEC_POLICY_GENERATE 5 /* same as discard - IKE daemon can override with generated policy */
78
79/* Security protocol level */
80#defineIPSEC_LEVEL_DEFAULT0/* reference to system default */
81#defineIPSEC_LEVEL_USE1/* use SA if present. */
82#defineIPSEC_LEVEL_REQUIRE2/* require SA. */
83#defineIPSEC_LEVEL_UNIQUE3/* unique SA. */
84
85#define IPSEC_MANUAL_REQID_MAX0x3fff
86/*
87 * if security policy level == unique, this id
88 * indicate to a relative SA for use, else is
89 * zero.
90 * 1 - 0x3fff are reserved for manual keying.
91 * 0 are reserved for above reason. Others is
92 * for kernel use.
93 * Note that this id doesn't identify SA
94 * by only itself.
95 */
96#define IPSEC_REPLAYWSIZE 32
97
98/* statistics for ipsec processing */
99struct ipsecstat {
100u_quad_t in_success; /* succeeded inbound process */
101u_quad_t in_polvio;
102/* security policy violation for inbound process */
103u_quad_t in_nosa; /* inbound SA is unavailable */
104u_quad_t in_inval; /* inbound processing failed due to EINVAL */
105u_quad_t in_nomem; /* inbound processing failed due to ENOBUFS */
106u_quad_t in_badspi; /* failed getting a SPI */
107u_quad_t in_ahreplay; /* AH replay check failed */
108u_quad_t in_espreplay; /* ESP replay check failed */
109u_quad_t in_ahauthsucc; /* AH authentication success */
110u_quad_t in_ahauthfail; /* AH authentication failure */
111u_quad_t in_espauthsucc; /* ESP authentication success */
112u_quad_t in_espauthfail; /* ESP authentication failure */
113u_quad_t in_esphist[256];
114u_quad_t in_ahhist[256];
115u_quad_t in_comphist[256];
116u_quad_t out_success; /* succeeded outbound process */
117u_quad_t out_polvio;
118/* security policy violation for outbound process */
119u_quad_t out_nosa; /* outbound SA is unavailable */
120u_quad_t out_inval; /* outbound process failed due to EINVAL */
121u_quad_t out_nomem; /* inbound processing failed due to ENOBUFS */
122u_quad_t out_noroute; /* there is no route */
123u_quad_t out_esphist[256];
124u_quad_t out_ahhist[256];
125u_quad_t out_comphist[256];
126};
127
128
129__BEGIN_DECLS
130extern caddr_t ipsec_set_policy(char *, int);
131extern int ipsec_get_policylen(caddr_t);
132extern char *ipsec_dump_policy(caddr_t, char *);
133
134extern const char *ipsec_strerror(void);
135__END_DECLS
136
137#endif /* _NETINET6_IPSEC_H_ */
138

Archive Download this file

Revision: 1622