Path: blob/buildjre8/ios-missing-include/netinet6/ipsec.h
861 views
/* $FreeBSD: src/sys/netinet6/ipsec.h,v 1.4.2.2 2001/07/03 11:01:54 ume Exp $ */1/* $KAME: ipsec.h,v 1.44 2001/03/23 08:08:47 itojun Exp $ */23/*4* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.5* All rights reserved.6*7* Redistribution and use in source and binary forms, with or without8* modification, are permitted provided that the following conditions9* are met:10* 1. Redistributions of source code must retain the above copyright11* notice, this list of conditions and the following disclaimer.12* 2. Redistributions in binary form must reproduce the above copyright13* notice, this list of conditions and the following disclaimer in the14* documentation and/or other materials provided with the distribution.15* 3. Neither the name of the project nor the names of its contributors16* may be used to endorse or promote products derived from this software17* without specific prior written permission.18*19* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND20* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE21* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE22* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE23* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL24* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS25* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)26* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT27* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY28* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF29* SUCH DAMAGE.30*/3132/*33* IPsec controller part.34*/3536#ifndef _NETINET6_IPSEC_H_37#define _NETINET6_IPSEC_H_38#include <sys/cdefs.h>39#include <sys/appleapiopts.h>4041#include <net/pfkeyv2.h>42#include <uuid/uuid.h>4344/* according to IANA assignment, port 0x0000 and proto 0xff are reserved. */45#define IPSEC_PORT_ANY 046#define IPSEC_ULPROTO_ANY 25547#define IPSEC_PROTO_ANY 2554849/* mode of security protocol */50/* NOTE: DON'T use IPSEC_MODE_ANY at SPD. It's only use in SAD */51#define IPSEC_MODE_ANY 0 /* i.e. wildcard. */52#define IPSEC_MODE_TRANSPORT 153#define IPSEC_MODE_TUNNEL 25455/*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_ANY 061#define IPSEC_DIR_INBOUND 162#define IPSEC_DIR_OUTBOUND 263#define IPSEC_DIR_MAX 364#define IPSEC_DIR_INVALID 46566/* 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_DISCARD 0 /* discarding packet */73#define IPSEC_POLICY_NONE 1 /* through IPsec engine */74#define IPSEC_POLICY_IPSEC 2 /* do IPsec */75#define IPSEC_POLICY_ENTRUST 3 /* consulting SPD if present. */76#define IPSEC_POLICY_BYPASS 4 /* only for privileged socket. */77#define IPSEC_POLICY_GENERATE 5 /* same as discard - IKE daemon can override with generated policy */7879/* Security protocol level */80#define IPSEC_LEVEL_DEFAULT 0 /* reference to system default */81#define IPSEC_LEVEL_USE 1 /* use SA if present. */82#define IPSEC_LEVEL_REQUIRE 2 /* require SA. */83#define IPSEC_LEVEL_UNIQUE 3 /* unique SA. */8485#define IPSEC_MANUAL_REQID_MAX 0x3fff86/*87* if security policy level == unique, this id88* indicate to a relative SA for use, else is89* zero.90* 1 - 0x3fff are reserved for manual keying.91* 0 are reserved for above reason. Others is92* for kernel use.93* Note that this id doesn't identify SA94* by only itself.95*/96#define IPSEC_REPLAYWSIZE 329798/* statistics for ipsec processing */99struct ipsecstat {100u_quad_t in_success __attribute__ ((aligned(8))); /* succeeded inbound process */101u_quad_t in_polvio __attribute__ ((aligned(8)));102/* security policy violation for inbound process */103u_quad_t in_nosa __attribute__ ((aligned(8))); /* inbound SA is unavailable */104u_quad_t in_inval __attribute__ ((aligned(8))); /* inbound processing failed due to EINVAL */105u_quad_t in_nomem __attribute__ ((aligned(8))); /* inbound processing failed due to ENOBUFS */106u_quad_t in_badspi __attribute__ ((aligned(8))); /* failed getting a SPI */107u_quad_t in_ahreplay __attribute__ ((aligned(8))); /* AH replay check failed */108u_quad_t in_espreplay __attribute__ ((aligned(8))); /* ESP replay check failed */109u_quad_t in_ahauthsucc __attribute__ ((aligned(8))); /* AH authentication success */110u_quad_t in_ahauthfail __attribute__ ((aligned(8))); /* AH authentication failure */111u_quad_t in_espauthsucc __attribute__ ((aligned(8))); /* ESP authentication success */112u_quad_t in_espauthfail __attribute__ ((aligned(8))); /* ESP authentication failure */113u_quad_t in_esphist[256] __attribute__ ((aligned(8)));114u_quad_t in_ahhist[256] __attribute__ ((aligned(8)));115u_quad_t in_comphist[256] __attribute__ ((aligned(8)));116u_quad_t out_success __attribute__ ((aligned(8))); /* succeeded outbound process */117u_quad_t out_polvio __attribute__ ((aligned(8)));118/* security policy violation for outbound process */119u_quad_t out_nosa __attribute__ ((aligned(8))); /* outbound SA is unavailable */120u_quad_t out_inval __attribute__ ((aligned(8))); /* outbound process failed due to EINVAL */121u_quad_t out_nomem __attribute__ ((aligned(8))); /* inbound processing failed due to ENOBUFS */122u_quad_t out_noroute __attribute__ ((aligned(8))); /* there is no route */123u_quad_t out_esphist[256] __attribute__ ((aligned(8)));124u_quad_t out_ahhist[256] __attribute__ ((aligned(8)));125u_quad_t out_comphist[256] __attribute__ ((aligned(8)));126};127128#define IPSEC_MAX_WAKE_PKT_LEN 100129struct ipsec_wake_pkt_info {130u_int8_t wake_pkt[IPSEC_MAX_WAKE_PKT_LEN];131uuid_string_t wake_uuid;132u_int32_t wake_pkt_spi;133u_int32_t wake_pkt_seq;134u_int16_t wake_pkt_len;135};136137struct ipsec_wake_pkt_event_data {138uuid_string_t wake_uuid;139};140141142__BEGIN_DECLS143extern caddr_t ipsec_set_policy(char *, int);144extern int ipsec_get_policylen(caddr_t);145extern char *ipsec_dump_policy(caddr_t, char *);146147extern const char *ipsec_strerror(void);148__END_DECLS149150#endif /* _NETINET6_IPSEC_H_ */151152153