]>
git.saurik.com Git - apple/xnu.git/blob - bsd/netinet6/ip6protosw.h
2 * Copyright (c) 2008-2013 Apple Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
29 /* $KAME: ip6protosw.h,v 1.22 2001/02/08 18:02:08 itojun Exp $ */
32 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
33 * All rights reserved.
35 * Redistribution and use in source and binary forms, with or without
36 * modification, are permitted provided that the following conditions
38 * 1. Redistributions of source code must retain the above copyright
39 * notice, this list of conditions and the following disclaimer.
40 * 2. Redistributions in binary form must reproduce the above copyright
41 * notice, this list of conditions and the following disclaimer in the
42 * documentation and/or other materials provided with the distribution.
43 * 3. Neither the name of the project nor the names of its contributors
44 * may be used to endorse or promote products derived from this software
45 * without specific prior written permission.
47 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
48 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
49 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
50 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
51 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
52 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
53 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
54 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
55 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
56 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
61 /* BSDI protosw.h,v 2.3 1996/10/11 16:02:40 pjd Exp */
64 * Copyright (c) 1982, 1986, 1993
65 * The Regents of the University of California. All rights reserved.
67 * Redistribution and use in source and binary forms, with or without
68 * modification, are permitted provided that the following conditions
70 * 1. Redistributions of source code must retain the above copyright
71 * notice, this list of conditions and the following disclaimer.
72 * 2. Redistributions in binary form must reproduce the above copyright
73 * notice, this list of conditions and the following disclaimer in the
74 * documentation and/or other materials provided with the distribution.
75 * 3. All advertising materials mentioning features or use of this software
76 * must display the following acknowledgement:
77 * This product includes software developed by the University of
78 * California, Berkeley and its contributors.
79 * 4. Neither the name of the University nor the names of its contributors
80 * may be used to endorse or promote products derived from this software
81 * without specific prior written permission.
83 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
84 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
85 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
86 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
87 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
88 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
89 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
90 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
91 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
92 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
95 * @(#)protosw.h 8.1 (Berkeley) 6/2/93
98 #ifndef _NETINET6_IP6PROTOSW_H_
99 #define _NETINET6_IP6PROTOSW_H_
100 #include <sys/appleapiopts.h>
102 #ifdef BSD_KERNEL_PRIVATE
103 #include <kern/locks.h>
106 * Protocol switch table for IPv6.
107 * All other definitions should refer to sys/protosw.h
120 * argument type for the last arg of pr_ctlinput().
121 * should be consulted only with AF_INET6 family.
123 * IPv6 ICMP IPv6 [exthdrs] finalhdr payload
125 * | | ip6c_ip6 ip6c_off
129 * ip6c_finaldst usually points to ip6c_ip6->ip6_dst. if the original
130 * (internal) packet carries a routing header, it may point the final
131 * dstination address in the routing header.
133 * ip6c_src: ip6c_ip6->ip6_src + scope info + flowlabel in ip6c_ip6
134 * (beware of flowlabel, if you try to compare it against others)
135 * ip6c_dst: ip6c_finaldst + scope info
138 struct mbuf
*ip6c_m
; /* start of mbuf chain */
139 struct icmp6_hdr
*ip6c_icmp6
; /* icmp6 header of target packet */
140 struct ip6_hdr
*ip6c_ip6
; /* ip6 header of target packet */
141 int ip6c_off
; /* offset of the target proto header */
142 struct sockaddr_in6
*ip6c_src
; /* srcaddr w/ additional info */
143 struct sockaddr_in6
*ip6c_dst
; /* (final) dstaddr w/ additional info */
144 struct in6_addr
*ip6c_finaldst
; /* final destination address */
145 void *ip6c_cmdarg
; /* control command dependent data */
146 u_int8_t ip6c_nxt
; /* final next header field */
152 * This closesly resembles protosw; we should merge them one day. Offsets
153 * must be exactly equivalent, due to casting.
156 TAILQ_ENTRY(ip6protosw
) pr_entry
; /* chain for domain */
157 struct domain
*pr_domain
; /* domain protocol a member of */
158 struct protosw
*pr_protosw
; /* pointer to self */
159 u_int16_t pr_type
; /* socket type used for */
160 u_int16_t pr_protocol
; /* protocol number */
161 u_int32_t pr_flags
; /* see below */
163 * protocol-protocol hooks
165 int (*pr_input
) /* input to protocol (from below) */
166 (struct mbuf
**, int *, int);
167 int (*pr_output
) /* output to protocol (from above) */
168 (struct mbuf
*m
, struct socket
*so
,
169 struct sockaddr_in6
*, struct mbuf
*);
170 void (*pr_ctlinput
) /* control input (from below) */
171 (int, struct sockaddr
*, void *);
172 int (*pr_ctloutput
) /* control output (from above) */
173 (struct socket
*, struct sockopt
*);
177 struct pr_usrreqs
*pr_usrreqs
; /* user request; see list below */
181 void (*pr_init
) /* initialization hook */
182 (struct ip6protosw
*, struct domain
*);
183 void (*pr_drain
)(void); /* flush any excess space possible */
184 /* for compat. with IPv4 protosw */
185 int (*pr_sysctl
)(void); /* sysctl for protocol */
186 int (*pr_lock
) /* lock function for protocol */
187 (struct socket
*so
, int locktype
, void *debug
);
188 int (*pr_unlock
) /* unlock for protocol */
189 (struct socket
*so
, int locktype
, void *debug
);
190 lck_mtx_t
*(*pr_getlock
) /* retrieve protocol lock */
191 (struct socket
*so
, int locktype
);
195 TAILQ_HEAD(, socket_filter
) pr_filter_head
;
196 struct protosw_old
*pr_old
;
198 #endif /* BSD_KERNEL_PRIVATE */
199 #endif /* _NETINET6_IP6PROTOSW_H_ */