1139826Simp/*-
253541Sshin * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
353541Sshin * All rights reserved.
453541Sshin *
553541Sshin * Redistribution and use in source and binary forms, with or without
653541Sshin * modification, are permitted provided that the following conditions
753541Sshin * are met:
853541Sshin * 1. Redistributions of source code must retain the above copyright
953541Sshin *    notice, this list of conditions and the following disclaimer.
1053541Sshin * 2. Redistributions in binary form must reproduce the above copyright
1153541Sshin *    notice, this list of conditions and the following disclaimer in the
1253541Sshin *    documentation and/or other materials provided with the distribution.
1353541Sshin * 3. Neither the name of the project nor the names of its contributors
1453541Sshin *    may be used to endorse or promote products derived from this software
1553541Sshin *    without specific prior written permission.
1653541Sshin *
1753541Sshin * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
1853541Sshin * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1953541Sshin * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2053541Sshin * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
2153541Sshin * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2253541Sshin * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2353541Sshin * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2453541Sshin * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2553541Sshin * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2653541Sshin * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2753541Sshin * SUCH DAMAGE.
2853541Sshin *
29174510Sobrien *	$KAME: ip6protosw.h,v 1.25 2001/09/26 06:13:03 keiichi Exp $
3053541Sshin */
3153541Sshin
3253541Sshin/*-
3353541Sshin * Copyright (c) 1982, 1986, 1993
3453541Sshin *	The Regents of the University of California.  All rights reserved.
3553541Sshin *
3653541Sshin * Redistribution and use in source and binary forms, with or without
3753541Sshin * modification, are permitted provided that the following conditions
3853541Sshin * are met:
3953541Sshin * 1. Redistributions of source code must retain the above copyright
4053541Sshin *    notice, this list of conditions and the following disclaimer.
4153541Sshin * 2. Redistributions in binary form must reproduce the above copyright
4253541Sshin *    notice, this list of conditions and the following disclaimer in the
4353541Sshin *    documentation and/or other materials provided with the distribution.
4453541Sshin * 4. Neither the name of the University nor the names of its contributors
4553541Sshin *    may be used to endorse or promote products derived from this software
4653541Sshin *    without specific prior written permission.
4753541Sshin *
4853541Sshin * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
4953541Sshin * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
5053541Sshin * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
5153541Sshin * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
5253541Sshin * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
5353541Sshin * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
5453541Sshin * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
5553541Sshin * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
5653541Sshin * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
5753541Sshin * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
5853541Sshin * SUCH DAMAGE.
5953541Sshin *
6053541Sshin *	@(#)protosw.h	8.1 (Berkeley) 6/2/93
61174510Sobrien *	BSDI protosw.h,v 2.3 1996/10/11 16:02:40 pjd Exp
62174510Sobrien * $FreeBSD$
6353541Sshin */
6453541Sshin
6553541Sshin#ifndef _NETINET6_IP6PROTOSW_H_
6653541Sshin#define _NETINET6_IP6PROTOSW_H_
6753541Sshin
6853541Sshin/*
6953541Sshin * Protocol switch table for IPv6.
7053541Sshin * All other definitions should refer to sys/protosw.h
7153541Sshin */
7253541Sshin
7362587Sitojunstruct mbuf;
7462587Sitojunstruct sockaddr;
7562587Sitojunstruct socket;
7662587Sitojunstruct domain;
7783366Sjulianstruct thread;
7862587Sitojunstruct ip6_hdr;
7978064Sumestruct icmp6_hdr;
8078064Sumestruct in6_addr;
8162587Sitojunstruct pr_usrreqs;
8253541Sshin
8353541Sshin/*
8453541Sshin * argument type for the last arg of pr_ctlinput().
8553541Sshin * should be consulted only with AF_INET6 family.
8678064Sume *
87120913Sume * IPv6 ICMP IPv6 [exthdrs] finalhdr payload
8878064Sume * ^    ^    ^              ^
8978064Sume * |    |    ip6c_ip6       ip6c_off
9078064Sume * |    ip6c_icmp6
9178064Sume * ip6c_m
9278064Sume *
9378064Sume * ip6c_finaldst usually points to ip6c_ip6->ip6_dst.  if the original
9478064Sume * (internal) packet carries a routing header, it may point the final
9578064Sume * dstination address in the routing header.
9678064Sume *
9778064Sume * ip6c_src: ip6c_ip6->ip6_src + scope info + flowlabel in ip6c_ip6
9878064Sume *	(beware of flowlabel, if you try to compare it against others)
9978064Sume * ip6c_dst: ip6c_finaldst + scope info
10053541Sshin */
10153541Sshinstruct ip6ctlparam {
10262587Sitojun	struct mbuf *ip6c_m;		/* start of mbuf chain */
10378064Sume	struct icmp6_hdr *ip6c_icmp6;	/* icmp6 header of target packet */
10462587Sitojun	struct ip6_hdr *ip6c_ip6;	/* ip6 header of target packet */
10562587Sitojun	int ip6c_off;			/* offset of the target proto header */
10678064Sume	struct sockaddr_in6 *ip6c_src;	/* srcaddr w/ additional info */
10778064Sume	struct sockaddr_in6 *ip6c_dst;	/* (final) dstaddr w/ additional info */
10878064Sume	struct in6_addr *ip6c_finaldst;	/* final destination address */
10978064Sume	void *ip6c_cmdarg;		/* control command dependent data */
11078064Sume	u_int8_t ip6c_nxt;		/* final next header field */
11153541Sshin};
11253541Sshin
11353541Sshinstruct ip6protosw {
11466586Sitojun	short	pr_type;		/* socket type used for */
11553541Sshin	struct	domain *pr_domain;	/* domain protocol a member of */
11653541Sshin	short	pr_protocol;		/* protocol number */
11753541Sshin	short	pr_flags;		/* see below */
11853541Sshin
11953541Sshin/* protocol-protocol hooks */
12053541Sshin	int	(*pr_input)		/* input to protocol (from below) */
121244524Sdelphij			(struct mbuf **, int *, int);
12253541Sshin	int	(*pr_output)		/* output to protocol (from above) */
123244524Sdelphij			(struct mbuf *, ...);
12453541Sshin	void	(*pr_ctlinput)		/* control input (from below) */
125244524Sdelphij			(int, struct sockaddr *, void *);
12653541Sshin	int	(*pr_ctloutput)		/* control output (from above) */
127244524Sdelphij			(struct socket *, struct sockopt *);
12853541Sshin
12953541Sshin/* utility hooks */
13053541Sshin	void	(*pr_init)		/* initialization hook */
131244524Sdelphij			(void);
132193731Szec	void	(*pr_destroy)		/* cleanup hook */
133244524Sdelphij			(void);
13453541Sshin
13553541Sshin	void	(*pr_fasttimo)		/* fast timeout (200ms) */
136244524Sdelphij			(void);
13753541Sshin	void	(*pr_slowtimo)		/* slow timeout (500ms) */
138244524Sdelphij			(void);
13953541Sshin	void	(*pr_drain)		/* flush any excess space possible */
140244524Sdelphij			(void);
14153541Sshin	struct	pr_usrreqs *pr_usrreqs;	/* supersedes pr_usrreq() */
14253541Sshin};
14353541Sshin
14492699Sdarrenr#ifdef _KERNEL
14592699Sdarrenrextern struct ip6protosw inet6sw[];
14692699Sdarrenr#endif
14792699Sdarrenr
14853541Sshin#endif /* !_NETINET6_IP6PROTOSW_H_ */
149