Watt-32 tcp/ip  2.2 dev-rel.10
ip6proto.h
Go to the documentation of this file.
1 
5 /* $FreeBSD: src/sys/netinet6/ip6protosw.h,v 1.9 2002/04/19 04:46:23 suz Exp $ */
6 /* $KAME: ip6protosw.h,v 1.25 2001/09/26 06:13:03 keiichi Exp $ */
7 
8 /*
9  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
10  * All rights reserved.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  * notice, this list of conditions and the following disclaimer.
17  * 2. Redistributions in binary form must reproduce the above copyright
18  * notice, this list of conditions and the following disclaimer in the
19  * documentation and/or other materials provided with the distribution.
20  * 3. Neither the name of the project nor the names of its contributors
21  * may be used to endorse or promote products derived from this software
22  * without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
25  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27  * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
28  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34  * SUCH DAMAGE.
35  *
36  */
37 
38 /* BSDI protosw.h,v 2.3 1996/10/11 16:02:40 pjd Exp */
39 
40 /*-
41  * Copyright (c) 1982, 1986, 1993
42  * The Regents of the University of California. All rights reserved.
43  *
44  * Redistribution and use in source and binary forms, with or without
45  * modification, are permitted provided that the following conditions
46  * are met:
47  * 1. Redistributions of source code must retain the above copyright
48  * notice, this list of conditions and the following disclaimer.
49  * 2. Redistributions in binary form must reproduce the above copyright
50  * notice, this list of conditions and the following disclaimer in the
51  * documentation and/or other materials provided with the distribution.
52  * 3. All advertising materials mentioning features or use of this software
53  * must display the following acknowledgement:
54  * This product includes software developed by the University of
55  * California, Berkeley and its contributors.
56  * 4. Neither the name of the University nor the names of its contributors
57  * may be used to endorse or promote products derived from this software
58  * without specific prior written permission.
59  *
60  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
61  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
62  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
63  * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
64  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
65  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
66  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
67  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
68  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
69  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
70  * SUCH DAMAGE.
71  *
72  * @(#)protosw.h 8.1 (Berkeley) 6/2/93
73  */
74 
75 #ifndef _NETINET6_IP6PROTOSW_H_
76 #define _NETINET6_IP6PROTOSW_H_
77 
78 /*
79  * For pfil_head structure.
80  */
81 #include <net/pfil.h>
82 
83 /*
84  * Protocol switch table for IPv6.
85  * All other definitions should refer to sys/protosw.h
86  */
87 
88 struct mbuf;
89 struct sockaddr;
90 struct socket;
91 struct domain;
92 struct thread;
93 struct ip6_hdr;
94 struct icmp6_hdr;
95 struct in6_addr;
96 struct pr_usrreqs;
97 
98 /*
99  * argument type for the last arg of pr_ctlinput().
100  * should be consulted only with AF_INET6 family.
101  *
102  * IPv6 ICMP IPv6 [exthdrs] finalhdr paylaod
103  * ^ ^ ^ ^
104  * | | ip6c_ip6 ip6c_off
105  * | ip6c_icmp6
106  * ip6c_m
107  *
108  * ip6c_finaldst usually points to ip6c_ip6->ip6_dst. if the original
109  * (internal) packet carries a routing header, it may point the final
110  * dstination address in the routing header.
111  *
112  * ip6c_src: ip6c_ip6->ip6_src + scope info + flowlabel in ip6c_ip6
113  * (beware of flowlabel, if you try to compare it against others)
114  * ip6c_dst: ip6c_finaldst + scope info
115  */
116 struct ip6ctlparam {
117  struct mbuf *ip6c_m; /* start of mbuf chain */
118  struct icmp6_hdr *ip6c_icmp6; /* icmp6 header of target packet */
119  struct ip6_hdr *ip6c_ip6; /* ip6 header of target packet */
120  int ip6c_off; /* offset of the target proto header */
121  struct sockaddr_in6 *ip6c_src; /* srcaddr w/ additional info */
122  struct sockaddr_in6 *ip6c_dst; /* (final) dstaddr w/ additional info */
123  struct in6_addr *ip6c_finaldst; /* final destination address */
124  void *ip6c_cmdarg; /* control command dependent data */
125  u_int8_t ip6c_nxt; /* final next header field */
126 };
127 
128 struct ip6protosw {
129  short pr_type; /* socket type used for */
130  struct domain *pr_domain; /* domain protocol a member of */
131  short pr_protocol; /* protocol number */
132  short pr_flags; /* see below */
133 
134 /* protocol-protocol hooks */
135  int (*pr_input) /* input to protocol (from below) */
136  __P((struct mbuf **, int *, int));
137  int (*pr_output) /* output to protocol (from above) */
138  __P((struct mbuf *, ...));
139  void (*pr_ctlinput) /* control input (from below) */
140  __P((int, struct sockaddr *, void *));
141  int (*pr_ctloutput) /* control output (from above) */
142  __P((struct socket *, struct sockopt *));
143 
144 /* user-protocol hook */
145  int (*pr_usrreq) /* user request: see list below */
146  __P((struct socket *, int, struct mbuf *,
147  struct mbuf *, struct mbuf *, struct thread *));
148 
149 /* utility hooks */
150  void (*pr_init) /* initialization hook */
151  __P((void));
152 
153  void (*pr_fasttimo) /* fast timeout (200ms) */
154  __P((void));
155  void (*pr_slowtimo) /* slow timeout (500ms) */
156  __P((void));
157  void (*pr_drain) /* flush any excess space possible */
158  __P((void));
159  struct pr_usrreqs *pr_usrreqs; /* supersedes pr_usrreq() */
160  struct pfil_head pr_pfh;
161 };
162 
163 #ifdef _KERNEL
164 extern struct ip6protosw inet6sw[];
165 #endif
166 
167 #endif /* !_NETINET6_IP6PROTOSW_H_ */
Definition: if.h:84
Definition: in.h:153
Definition: mbuf.h:6
Definition: ip6.h:90