xref: /freebsd/sys/netipsec/keysock.h (revision 88768458d21c0a0eef6cf91053630b94a58fef3c)
188768458SSam Leffler /*	$FreeBSD$	*/
288768458SSam Leffler /*	$KAME: keysock.h,v 1.8 2000/03/27 05:11:06 sumikawa Exp $	*/
388768458SSam Leffler 
488768458SSam Leffler /*
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 #ifndef _NETIPSEC_KEYSOCK_H_
3488768458SSam Leffler #define _NETIPSEC_KEYSOCK_H_
3588768458SSam Leffler 
3688768458SSam Leffler /* statistics for pfkey socket */
3788768458SSam Leffler struct pfkeystat {
3888768458SSam Leffler 	/* kernel -> userland */
3988768458SSam Leffler 	u_quad_t out_total;		/* # of total calls */
4088768458SSam Leffler 	u_quad_t out_bytes;		/* total bytecount */
4188768458SSam Leffler 	u_quad_t out_msgtype[256];	/* message type histogram */
4288768458SSam Leffler 	u_quad_t out_invlen;		/* invalid length field */
4388768458SSam Leffler 	u_quad_t out_invver;		/* invalid version field */
4488768458SSam Leffler 	u_quad_t out_invmsgtype;	/* invalid message type field */
4588768458SSam Leffler 	u_quad_t out_tooshort;		/* msg too short */
4688768458SSam Leffler 	u_quad_t out_nomem;		/* memory allocation failure */
4788768458SSam Leffler 	u_quad_t out_dupext;		/* duplicate extension */
4888768458SSam Leffler 	u_quad_t out_invexttype;	/* invalid extension type */
4988768458SSam Leffler 	u_quad_t out_invsatype;		/* invalid sa type */
5088768458SSam Leffler 	u_quad_t out_invaddr;		/* invalid address extension */
5188768458SSam Leffler 	/* userland -> kernel */
5288768458SSam Leffler 	u_quad_t in_total;		/* # of total calls */
5388768458SSam Leffler 	u_quad_t in_bytes;		/* total bytecount */
5488768458SSam Leffler 	u_quad_t in_msgtype[256];	/* message type histogram */
5588768458SSam Leffler 	u_quad_t in_msgtarget[3];	/* one/all/registered */
5688768458SSam Leffler 	u_quad_t in_nomem;		/* memory allocation failure */
5788768458SSam Leffler 	/* others */
5888768458SSam Leffler 	u_quad_t sockerr;		/* # of socket related errors */
5988768458SSam Leffler };
6088768458SSam Leffler 
6188768458SSam Leffler #define KEY_SENDUP_ONE		0
6288768458SSam Leffler #define KEY_SENDUP_ALL		1
6388768458SSam Leffler #define KEY_SENDUP_REGISTERED	2
6488768458SSam Leffler 
6588768458SSam Leffler #ifdef _KERNEL
6688768458SSam Leffler struct keycb {
6788768458SSam Leffler 	struct rawcb kp_raw;	/* rawcb */
6888768458SSam Leffler 	int kp_promisc;		/* promiscuous mode */
6988768458SSam Leffler 	int kp_registered;	/* registered socket */
7088768458SSam Leffler };
7188768458SSam Leffler 
7288768458SSam Leffler extern struct pfkeystat pfkeystat;
7388768458SSam Leffler 
7488768458SSam Leffler extern int key_output __P((struct mbuf *, ...));
7588768458SSam Leffler extern int key_usrreq __P((struct socket *,
7688768458SSam Leffler 	int, struct mbuf *, struct mbuf *, struct mbuf *));
7788768458SSam Leffler 
7888768458SSam Leffler extern int key_sendup __P((struct socket *, struct sadb_msg *, u_int, int));
7988768458SSam Leffler extern int key_sendup_mbuf __P((struct socket *, struct mbuf *, int));
8088768458SSam Leffler #endif /* _KERNEL */
8188768458SSam Leffler 
8288768458SSam Leffler #endif /*_NETIPSEC_KEYSOCK_H_*/
83