ip6protosw.h revision 83366
162587Sitojun/* $FreeBSD: head/sys/netinet6/ip6protosw.h 83366 2001-09-12 08:38:13Z julian $ */ 278064Sume/* $KAME: ip6protosw.h,v 1.22 2001/02/08 18:02:08 itojun Exp $ */ 362587Sitojun 453541Sshin/* 553541Sshin * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 653541Sshin * All rights reserved. 753541Sshin * 853541Sshin * Redistribution and use in source and binary forms, with or without 953541Sshin * modification, are permitted provided that the following conditions 1053541Sshin * are met: 1153541Sshin * 1. Redistributions of source code must retain the above copyright 1253541Sshin * notice, this list of conditions and the following disclaimer. 1353541Sshin * 2. Redistributions in binary form must reproduce the above copyright 1453541Sshin * notice, this list of conditions and the following disclaimer in the 1553541Sshin * documentation and/or other materials provided with the distribution. 1653541Sshin * 3. Neither the name of the project nor the names of its contributors 1753541Sshin * may be used to endorse or promote products derived from this software 1853541Sshin * without specific prior written permission. 1953541Sshin * 2053541Sshin * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 2153541Sshin * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2253541Sshin * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2353541Sshin * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 2453541Sshin * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2553541Sshin * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2653541Sshin * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2753541Sshin * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2853541Sshin * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2953541Sshin * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3053541Sshin * SUCH DAMAGE. 3153541Sshin * 3253541Sshin */ 3353541Sshin 3453541Sshin/* BSDI protosw.h,v 2.3 1996/10/11 16:02:40 pjd Exp */ 3553541Sshin 3653541Sshin/*- 3753541Sshin * Copyright (c) 1982, 1986, 1993 3853541Sshin * The Regents of the University of California. All rights reserved. 3953541Sshin * 4053541Sshin * Redistribution and use in source and binary forms, with or without 4153541Sshin * modification, are permitted provided that the following conditions 4253541Sshin * are met: 4353541Sshin * 1. Redistributions of source code must retain the above copyright 4453541Sshin * notice, this list of conditions and the following disclaimer. 4553541Sshin * 2. Redistributions in binary form must reproduce the above copyright 4653541Sshin * notice, this list of conditions and the following disclaimer in the 4753541Sshin * documentation and/or other materials provided with the distribution. 4853541Sshin * 3. All advertising materials mentioning features or use of this software 4953541Sshin * must display the following acknowledgement: 5053541Sshin * This product includes software developed by the University of 5153541Sshin * California, Berkeley and its contributors. 5253541Sshin * 4. Neither the name of the University nor the names of its contributors 5353541Sshin * may be used to endorse or promote products derived from this software 5453541Sshin * without specific prior written permission. 5553541Sshin * 5653541Sshin * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 5753541Sshin * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 5853541Sshin * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 5953541Sshin * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 6053541Sshin * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 6153541Sshin * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 6253541Sshin * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 6353541Sshin * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 6453541Sshin * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 6553541Sshin * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 6653541Sshin * SUCH DAMAGE. 6753541Sshin * 6853541Sshin * @(#)protosw.h 8.1 (Berkeley) 6/2/93 6953541Sshin */ 7053541Sshin 7153541Sshin#ifndef _NETINET6_IP6PROTOSW_H_ 7253541Sshin#define _NETINET6_IP6PROTOSW_H_ 7353541Sshin 7453541Sshin/* 7564118Speter * For pfil_head structure. 7664118Speter */ 7764118Speter#include <net/pfil.h> 7864118Speter 7964118Speter/* 8053541Sshin * Protocol switch table for IPv6. 8153541Sshin * All other definitions should refer to sys/protosw.h 8253541Sshin */ 8353541Sshin 8462587Sitojunstruct mbuf; 8562587Sitojunstruct sockaddr; 8662587Sitojunstruct socket; 8762587Sitojunstruct domain; 8883366Sjulianstruct thread; 8962587Sitojunstruct ip6_hdr; 9078064Sumestruct icmp6_hdr; 9178064Sumestruct in6_addr; 9262587Sitojunstruct pr_usrreqs; 9353541Sshin 9453541Sshin/* 9553541Sshin * argument type for the last arg of pr_ctlinput(). 9653541Sshin * should be consulted only with AF_INET6 family. 9778064Sume * 9878064Sume * IPv6 ICMP IPv6 [exthdrs] finalhdr paylaod 9978064Sume * ^ ^ ^ ^ 10078064Sume * | | ip6c_ip6 ip6c_off 10178064Sume * | ip6c_icmp6 10278064Sume * ip6c_m 10378064Sume * 10478064Sume * ip6c_finaldst usually points to ip6c_ip6->ip6_dst. if the original 10578064Sume * (internal) packet carries a routing header, it may point the final 10678064Sume * dstination address in the routing header. 10778064Sume * 10878064Sume * ip6c_src: ip6c_ip6->ip6_src + scope info + flowlabel in ip6c_ip6 10978064Sume * (beware of flowlabel, if you try to compare it against others) 11078064Sume * ip6c_dst: ip6c_finaldst + scope info 11153541Sshin */ 11253541Sshinstruct ip6ctlparam { 11362587Sitojun struct mbuf *ip6c_m; /* start of mbuf chain */ 11478064Sume struct icmp6_hdr *ip6c_icmp6; /* icmp6 header of target packet */ 11562587Sitojun struct ip6_hdr *ip6c_ip6; /* ip6 header of target packet */ 11662587Sitojun int ip6c_off; /* offset of the target proto header */ 11778064Sume struct sockaddr_in6 *ip6c_src; /* srcaddr w/ additional info */ 11878064Sume struct sockaddr_in6 *ip6c_dst; /* (final) dstaddr w/ additional info */ 11978064Sume struct in6_addr *ip6c_finaldst; /* final destination address */ 12078064Sume void *ip6c_cmdarg; /* control command dependent data */ 12178064Sume u_int8_t ip6c_nxt; /* final next header field */ 12253541Sshin}; 12353541Sshin 12453541Sshinstruct ip6protosw { 12566586Sitojun short pr_type; /* socket type used for */ 12653541Sshin struct domain *pr_domain; /* domain protocol a member of */ 12753541Sshin short pr_protocol; /* protocol number */ 12853541Sshin short pr_flags; /* see below */ 12953541Sshin 13053541Sshin/* protocol-protocol hooks */ 13153541Sshin int (*pr_input) /* input to protocol (from below) */ 13253541Sshin __P((struct mbuf **, int *, int)); 13353541Sshin int (*pr_output) /* output to protocol (from above) */ 13453541Sshin __P((struct mbuf *, ...)); 13553541Sshin void (*pr_ctlinput) /* control input (from below) */ 13653541Sshin __P((int, struct sockaddr *, void *)); 13753541Sshin int (*pr_ctloutput) /* control output (from above) */ 13853541Sshin __P((struct socket *, struct sockopt *)); 13953541Sshin 14053541Sshin/* user-protocol hook */ 14153541Sshin int (*pr_usrreq) /* user request: see list below */ 14253541Sshin __P((struct socket *, int, struct mbuf *, 14383366Sjulian struct mbuf *, struct mbuf *, struct thread *)); 14453541Sshin 14553541Sshin/* utility hooks */ 14653541Sshin void (*pr_init) /* initialization hook */ 14753541Sshin __P((void)); 14853541Sshin 14953541Sshin void (*pr_fasttimo) /* fast timeout (200ms) */ 15053541Sshin __P((void)); 15153541Sshin void (*pr_slowtimo) /* slow timeout (500ms) */ 15253541Sshin __P((void)); 15353541Sshin void (*pr_drain) /* flush any excess space possible */ 15453541Sshin __P((void)); 15553541Sshin struct pr_usrreqs *pr_usrreqs; /* supersedes pr_usrreq() */ 15664118Speter struct pfil_head pr_pfh; 15753541Sshin}; 15853541Sshin 15953541Sshin#endif /* !_NETINET6_IP6PROTOSW_H_ */ 160