xref: /freebsd/sys/netipsec/ipsec6.h (revision fcf596178b5f2be36424ecbc1b6a3224b29c91d2)
188768458SSam Leffler /*	$FreeBSD$	*/
288768458SSam Leffler /*	$KAME: ipsec.h,v 1.44 2001/03/23 08:08:47 itojun Exp $	*/
388768458SSam Leffler 
4c398230bSWarner Losh /*-
588768458SSam Leffler  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
688768458SSam Leffler  * All rights reserved.
788768458SSam Leffler  *
888768458SSam Leffler  * Redistribution and use in source and binary forms, with or without
988768458SSam Leffler  * modification, are permitted provided that the following conditions
1088768458SSam Leffler  * are met:
1188768458SSam Leffler  * 1. Redistributions of source code must retain the above copyright
1288768458SSam Leffler  *    notice, this list of conditions and the following disclaimer.
1388768458SSam Leffler  * 2. Redistributions in binary form must reproduce the above copyright
1488768458SSam Leffler  *    notice, this list of conditions and the following disclaimer in the
1588768458SSam Leffler  *    documentation and/or other materials provided with the distribution.
1688768458SSam Leffler  * 3. Neither the name of the project nor the names of its contributors
1788768458SSam Leffler  *    may be used to endorse or promote products derived from this software
1888768458SSam Leffler  *    without specific prior written permission.
1988768458SSam Leffler  *
2088768458SSam Leffler  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
2188768458SSam Leffler  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2288768458SSam Leffler  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2388768458SSam Leffler  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
2488768458SSam Leffler  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2588768458SSam Leffler  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2688768458SSam Leffler  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2788768458SSam Leffler  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2888768458SSam Leffler  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2988768458SSam Leffler  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3088768458SSam Leffler  * SUCH DAMAGE.
3188768458SSam Leffler  */
3288768458SSam Leffler 
3388768458SSam Leffler /*
3488768458SSam Leffler  * IPsec controller part.
3588768458SSam Leffler  */
3688768458SSam Leffler 
3788768458SSam Leffler #ifndef _NETIPSEC_IPSEC6_H_
3888768458SSam Leffler #define _NETIPSEC_IPSEC6_H_
3988768458SSam Leffler 
4088768458SSam Leffler #include <net/pfkeyv2.h>
4188768458SSam Leffler #include <netipsec/keydb.h>
4288768458SSam Leffler 
4388768458SSam Leffler #ifdef _KERNEL
44db8c0879SAndrey V. Elsukov #include <sys/counter.h>
45db8c0879SAndrey V. Elsukov 
46db8c0879SAndrey V. Elsukov VNET_PCPUSTAT_DECLARE(struct ipsecstat, ipsec6stat);
47eddfbb76SRobert Watson VNET_DECLARE(int, ip6_esp_trans_deflev);
48eddfbb76SRobert Watson VNET_DECLARE(int, ip6_esp_net_deflev);
49eddfbb76SRobert Watson VNET_DECLARE(int, ip6_ah_trans_deflev);
50eddfbb76SRobert Watson VNET_DECLARE(int, ip6_ah_net_deflev);
51eddfbb76SRobert Watson VNET_DECLARE(int, ip6_ipsec_ecn);
5282cea7e6SBjoern A. Zeeb 
53db8c0879SAndrey V. Elsukov #define	IPSEC6STAT_INC(name)	\
54db8c0879SAndrey V. Elsukov     VNET_PCPUSTAT_ADD(struct ipsecstat, ipsec6stat, name, 1)
5582cea7e6SBjoern A. Zeeb #define	V_ip6_esp_trans_deflev	VNET(ip6_esp_trans_deflev)
5682cea7e6SBjoern A. Zeeb #define	V_ip6_esp_net_deflev	VNET(ip6_esp_net_deflev)
5782cea7e6SBjoern A. Zeeb #define	V_ip6_ah_trans_deflev	VNET(ip6_ah_trans_deflev)
5882cea7e6SBjoern A. Zeeb #define	V_ip6_ah_net_deflev	VNET(ip6_ah_net_deflev)
591e77c105SRobert Watson #define	V_ip6_ipsec_ecn		VNET(ip6_ipsec_ecn)
6088768458SSam Leffler 
6188768458SSam Leffler struct inpcb;
62*fcf59617SAndrey V. Elsukov struct secpolicy *ipsec6_checkpolicy(const struct mbuf *,
63*fcf59617SAndrey V. Elsukov     struct inpcb *, int *);
6488768458SSam Leffler 
65*fcf59617SAndrey V. Elsukov void ipsec6_setsockaddrs(const struct mbuf *, union sockaddr_union *,
66*fcf59617SAndrey V. Elsukov     union sockaddr_union *);
67*fcf59617SAndrey V. Elsukov int ipsec6_input(struct mbuf *, int, int);
68*fcf59617SAndrey V. Elsukov int ipsec6_in_reject(const struct mbuf *, struct inpcb *);
69*fcf59617SAndrey V. Elsukov int ipsec6_forward(struct mbuf *);
70*fcf59617SAndrey V. Elsukov int ipsec6_pcbctl(struct inpcb *, struct sockopt *);
71*fcf59617SAndrey V. Elsukov int ipsec6_output(struct mbuf *, struct inpcb *);
72*fcf59617SAndrey V. Elsukov int ipsec6_capability(struct mbuf *, u_int);
73*fcf59617SAndrey V. Elsukov int ipsec6_common_input_cb(struct mbuf *, struct secasvar *, int, int);
74*fcf59617SAndrey V. Elsukov int ipsec6_process_packet(struct mbuf *, struct secpolicy *, struct inpcb *);
75*fcf59617SAndrey V. Elsukov 
76*fcf59617SAndrey V. Elsukov int ip6_ipsec_filtertunnel(struct mbuf *);
77*fcf59617SAndrey V. Elsukov int ip6_ipsec_pcbctl(struct inpcb *, struct sockopt *);
7888768458SSam Leffler #endif /*_KERNEL*/
7988768458SSam Leffler 
8088768458SSam Leffler #endif /*_NETIPSEC_IPSEC6_H_*/
81