ipsec6.h revision 1.5
11.5Sdegroote/*	$NetBSD: ipsec6.h,v 1.5 2007/02/10 09:43:05 degroote Exp $	*/
21.1Sjonathan/*	$FreeBSD: src/sys/netipsec/ipsec6.h,v 1.1.4.1 2003/01/24 05:11:35 sam Exp $	*/
31.1Sjonathan/*	$KAME: ipsec.h,v 1.44 2001/03/23 08:08:47 itojun Exp $	*/
41.1Sjonathan
51.1Sjonathan/*
61.1Sjonathan * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
71.1Sjonathan * All rights reserved.
81.1Sjonathan *
91.1Sjonathan * Redistribution and use in source and binary forms, with or without
101.1Sjonathan * modification, are permitted provided that the following conditions
111.1Sjonathan * are met:
121.1Sjonathan * 1. Redistributions of source code must retain the above copyright
131.1Sjonathan *    notice, this list of conditions and the following disclaimer.
141.1Sjonathan * 2. Redistributions in binary form must reproduce the above copyright
151.1Sjonathan *    notice, this list of conditions and the following disclaimer in the
161.1Sjonathan *    documentation and/or other materials provided with the distribution.
171.1Sjonathan * 3. Neither the name of the project nor the names of its contributors
181.1Sjonathan *    may be used to endorse or promote products derived from this software
191.1Sjonathan *    without specific prior written permission.
201.1Sjonathan *
211.1Sjonathan * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
221.1Sjonathan * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
231.1Sjonathan * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
241.1Sjonathan * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
251.1Sjonathan * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
261.1Sjonathan * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
271.1Sjonathan * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
281.1Sjonathan * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
291.1Sjonathan * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
301.1Sjonathan * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
311.1Sjonathan * SUCH DAMAGE.
321.1Sjonathan */
331.1Sjonathan
341.1Sjonathan/*
351.1Sjonathan * IPsec controller part.
361.1Sjonathan */
371.1Sjonathan
381.1Sjonathan#ifndef _NETIPSEC_IPSEC6_H_
391.1Sjonathan#define _NETIPSEC_IPSEC6_H_
401.1Sjonathan
411.1Sjonathan#include <net/pfkeyv2.h>
421.1Sjonathan#include <netipsec/keydb.h>
431.2Sjonathan#ifdef __NetBSD__
441.2Sjonathan#include <netinet6/in6_pcb.h>
451.2Sjonathan#endif
461.1Sjonathan
471.1Sjonathan#ifdef _KERNEL
481.1Sjonathanextern int ip6_esp_trans_deflev;
491.1Sjonathanextern int ip6_esp_net_deflev;
501.1Sjonathanextern int ip6_ah_trans_deflev;
511.1Sjonathanextern int ip6_ah_net_deflev;
521.1Sjonathanextern int ip6_ipsec_ecn;
531.1Sjonathanextern int ip6_esp_randpad;
541.2Sjonathanextern struct secpolicy ip6_def_policy;
551.1Sjonathan
561.1Sjonathanstruct inpcb;
571.2Sjonathanstruct in6pcb;
581.1Sjonathan
591.1Sjonathan/* KAME compatibility shims */
601.1Sjonathan#define	ipsec6_getpolicybyaddr	ipsec_getpolicybyaddr
611.1Sjonathan#define	ipsec6_getpolicybysock	ipsec_getpolicybysock
621.1Sjonathan#define	ipsec6stat		newipsecstat
631.1Sjonathan#define	out_inval		ips_out_inval
641.1Sjonathan#define	in_polvio		ips_in_polvio
651.1Sjonathan#define	out_polvio		ips_out_polvio
661.1Sjonathan#define	key_freesp(_x)		KEY_FREESP(&_x)
671.1Sjonathan
681.2Sjonathanextern int ipsec6_delete_pcbpolicy __P((struct in6pcb *));
691.2Sjonathanextern int ipsec6_set_policy __P((struct in6pcb *inp, int optname,
701.1Sjonathan	caddr_t request, size_t len, int priv));
711.1Sjonathanextern int ipsec6_get_policy
721.2Sjonathan	__P((struct in6pcb *inp, caddr_t request, size_t len, struct mbuf **mp));
731.5Sdegrooteextern struct secpolicy *ipsec6_checkpolicy __P((struct mbuf *, u_int,
741.5Sdegroote    u_int, int *, struct in6pcb *));
751.5Sdegrootestruct secpolicy * ipsec6_check_policy(struct mbuf *,
761.5Sdegroote				const struct socket *, int, int*,int*);
771.2Sjonathanextern int ipsec6_in_reject __P((struct mbuf *, struct in6pcb *));
781.2Sjonathan/*
791.2Sjonathan * KAME ipsec6_in_reject_so(struct mbuf*, struct so)  compatibility shim
801.2Sjonathan */
811.2Sjonathan#define ipsec6_in_reject_so(m, _so) \
821.2Sjonathan  ipsec6_in_reject(m, ((_so) == NULL? NULL : sotoin6pcb(_so)))
831.1Sjonathan
841.1Sjonathanstruct tcp6cb;
851.1Sjonathan
861.2Sjonathanextern size_t ipsec6_hdrsiz __P((struct mbuf *, u_int, struct in6pcb *));
871.2Sjonathanextern size_t ipsec6_hdrsiz_tcp __P((struct tcpcb*));
881.1Sjonathan
891.1Sjonathanstruct ip6_hdr;
901.1Sjonathanextern const char *ipsec6_logpacketstr __P((struct ip6_hdr *, u_int32_t));
911.2Sjonathan
921.2Sjonathan#ifdef __NetBSD__
931.2Sjonathan/* NetBSD protosw ctlin entrypoint */
941.2Sjonathanextern void esp6_ctlinput __P((int, struct sockaddr *, void *));
951.2Sjonathanextern void ah6_ctlinput __P((int, struct sockaddr *, void *));
961.2Sjonathan#endif /* __NetBSD__ */
971.1Sjonathan
981.1Sjonathanstruct m_tag;
991.1Sjonathanextern int ipsec6_common_input(struct mbuf **mp, int *offp, int proto);
1001.1Sjonathanextern int ipsec6_common_input_cb(struct mbuf *m, struct secasvar *sav,
1011.1Sjonathan			int skip, int protoff, struct m_tag *mt);
1021.1Sjonathanextern void esp6_ctlinput(int, struct sockaddr *, void *);
1031.1Sjonathan
1041.1Sjonathanstruct ipsec_output_state;
1051.5Sdegroote
1061.5Sdegrooteint ipsec6_process_packet __P((struct mbuf*,struct ipsecrequest *));
1071.1Sjonathan#endif /*_KERNEL*/
1081.1Sjonathan
1091.4Selad#endif /* !_NETIPSEC_IPSEC6_H_ */
110