]> git.saurik.com Git - apple/xnu.git/blame - bsd/netinet6/ip6protosw.h
xnu-1699.22.73.tar.gz
[apple/xnu.git] / bsd / netinet6 / ip6protosw.h
CommitLineData
9bccf70c 1/* $FreeBSD: src/sys/netinet6/ip6protosw.h,v 1.2.2.3 2001/07/03 11:01:54 ume Exp $ */
b0d623f7 2/*
6d2010ae 3 * Copyright (c) 2008-2009 Apple Inc. All rights reserved.
b0d623f7
A
4 *
5 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 *
7 * This file contains Original Code and/or Modifications of Original Code
8 * as defined in and that are subject to the Apple Public Source License
9 * Version 2.0 (the 'License'). You may not use this file except in
10 * compliance with the License. The rights granted to you under the License
11 * may not be used to create, or enable the creation or redistribution of,
12 * unlawful or unlicensed copies of an Apple operating system, or to
13 * circumvent, violate, or enable the circumvention or violation of, any
14 * terms of an Apple operating system software license agreement.
15 *
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 *
19 * The Original Code and all software distributed under the License are
20 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
21 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
22 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
24 * Please see the License for the specific language governing rights and
25 * limitations under the License.
26 *
27 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
28 */
29
9bccf70c
A
30/* $KAME: ip6protosw.h,v 1.22 2001/02/08 18:02:08 itojun Exp $ */
31
1c79356b
A
32/*
33 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
34 * All rights reserved.
9bccf70c 35 *
1c79356b
A
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
38 * are met:
39 * 1. Redistributions of source code must retain the above copyright
40 * notice, this list of conditions and the following disclaimer.
41 * 2. Redistributions in binary form must reproduce the above copyright
42 * notice, this list of conditions and the following disclaimer in the
43 * documentation and/or other materials provided with the distribution.
44 * 3. Neither the name of the project nor the names of its contributors
45 * may be used to endorse or promote products derived from this software
46 * without specific prior written permission.
9bccf70c 47 *
1c79356b
A
48 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
49 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
51 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
52 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
54 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 * SUCH DAMAGE.
59 *
60 */
61
62/* BSDI protosw.h,v 2.3 1996/10/11 16:02:40 pjd Exp */
63
64/*-
65 * Copyright (c) 1982, 1986, 1993
66 * The Regents of the University of California. All rights reserved.
67 *
68 * Redistribution and use in source and binary forms, with or without
69 * modification, are permitted provided that the following conditions
70 * are met:
71 * 1. Redistributions of source code must retain the above copyright
72 * notice, this list of conditions and the following disclaimer.
73 * 2. Redistributions in binary form must reproduce the above copyright
74 * notice, this list of conditions and the following disclaimer in the
75 * documentation and/or other materials provided with the distribution.
76 * 3. All advertising materials mentioning features or use of this software
77 * must display the following acknowledgement:
78 * This product includes software developed by the University of
79 * California, Berkeley and its contributors.
80 * 4. Neither the name of the University nor the names of its contributors
81 * may be used to endorse or promote products derived from this software
82 * without specific prior written permission.
83 *
84 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
85 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
86 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
87 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
88 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
89 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
90 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
91 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
92 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
93 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
94 * SUCH DAMAGE.
95 *
96 * @(#)protosw.h 8.1 (Berkeley) 6/2/93
1c79356b
A
97 */
98
99#ifndef _NETINET6_IP6PROTOSW_H_
100#define _NETINET6_IP6PROTOSW_H_
9bccf70c 101#include <sys/appleapiopts.h>
91447636
A
102
103#ifdef KERNEL_PRIVATE
104#include <kern/locks.h>
1c79356b
A
105
106/*
107 * Protocol switch table for IPv6.
108 * All other definitions should refer to sys/protosw.h
109 */
110
111struct mbuf;
112struct sockaddr;
113struct socket;
114struct domain;
115struct proc;
116struct ip6_hdr;
9bccf70c
A
117struct icmp6_hdr;
118struct in6_addr;
1c79356b 119struct pr_usrreqs;
1c79356b 120
1c79356b
A
121/*
122 * argument type for the last arg of pr_ctlinput().
123 * should be consulted only with AF_INET6 family.
9bccf70c 124 *
6d2010ae 125 * IPv6 ICMP IPv6 [exthdrs] finalhdr payload
9bccf70c
A
126 * ^ ^ ^ ^
127 * | | ip6c_ip6 ip6c_off
128 * | ip6c_icmp6
129 * ip6c_m
130 *
131 * ip6c_finaldst usually points to ip6c_ip6->ip6_dst. if the original
132 * (internal) packet carries a routing header, it may point the final
133 * dstination address in the routing header.
134 *
135 * ip6c_src: ip6c_ip6->ip6_src + scope info + flowlabel in ip6c_ip6
136 * (beware of flowlabel, if you try to compare it against others)
137 * ip6c_dst: ip6c_finaldst + scope info
1c79356b
A
138 */
139struct ip6ctlparam {
140 struct mbuf *ip6c_m; /* start of mbuf chain */
9bccf70c 141 struct icmp6_hdr *ip6c_icmp6; /* icmp6 header of target packet */
1c79356b
A
142 struct ip6_hdr *ip6c_ip6; /* ip6 header of target packet */
143 int ip6c_off; /* offset of the target proto header */
9bccf70c
A
144 struct sockaddr_in6 *ip6c_src; /* srcaddr w/ additional info */
145 struct sockaddr_in6 *ip6c_dst; /* (final) dstaddr w/ additional info */
146 struct in6_addr *ip6c_finaldst; /* final destination address */
147 void *ip6c_cmdarg; /* control command dependent data */
148 u_int8_t ip6c_nxt; /* final next header field */
1c79356b
A
149};
150
b0d623f7
A
151#ifdef __LP64__ // K64todo: might also make sense for the generic case
152#pragma pack(4)
153#endif
1c79356b
A
154struct ip6protosw {
155 short pr_type; /* socket type used for */
156 struct domain *pr_domain; /* domain protocol a member of */
157 short pr_protocol; /* protocol number */
158 unsigned int pr_flags; /* see below */
159/* protocol-protocol hooks */
6d2010ae 160 int (*pr_input)(struct mbuf **, int *, int);
1c79356b 161 /* input to protocol (from below) */
91447636
A
162 int (*pr_output)(struct mbuf *m, struct socket *so,
163 struct sockaddr_in6 *, struct mbuf *);
1c79356b 164 /* output to protocol (from above) */
91447636 165 void (*pr_ctlinput)(int, struct sockaddr *, void *);
1c79356b 166 /* control input (from below) */
91447636 167 int (*pr_ctloutput)(struct socket *, struct sockopt *);
1c79356b
A
168 /* control output (from above) */
169/* user-protocol hook */
91447636
A
170 int (*pr_usrreq)(struct socket *, int, struct mbuf *,
171 struct mbuf *, struct mbuf *, struct proc *);
172 /* user request: see list below */
1c79356b
A
173
174/* utility hooks */
91447636 175 void (*pr_init)(void); /* initialization hook */
6d2010ae
A
176#if __APPLE__
177 void (*pr_unused)(void); /* placeholder - fasttimo is removed */
178#else
91447636 179 void (*pr_fasttimo)(void);
1c79356b 180 /* fast timeout (200ms) */
6d2010ae 181#endif
91447636 182 void (*pr_slowtimo)(void);
1c79356b 183 /* slow timeout (500ms) */
91447636 184 void (*pr_drain)(void);
1c79356b 185 /* flush any excess space possible */
9bccf70c
A
186#ifdef __APPLE__
187 /* for compat. with IPv4 protosw */
2d21ac55 188 int (*pr_sysctl)(void); /* sysctl for protocol */
9bccf70c 189#endif
1c79356b
A
190
191 struct pr_usrreqs *pr_usrreqs; /* supersedes pr_usrreq() */
9bccf70c 192#ifdef __APPLE__
b0d623f7
A
193 int (*pr_lock) (struct socket *so, int locktype, void *debug); /* lock function for protocol */
194 int (*pr_unlock) (struct socket *so, int locktype, void *debug); /* unlock for protocol */
91447636
A
195#ifdef _KERN_LOCKS_H_
196 lck_mtx_t * (*pr_getlock) (struct socket *so, int locktype); /* unlock for protocol */
197#else
198 void * (*pr_getlock) (struct socket *so, int locktype); /* unlock for protocol */
199#endif
9bccf70c 200 /* Filter hooks */
1c79356b 201 TAILQ_HEAD(pr6_sfilter, NFDescriptor) pr_sfilter;
9bccf70c 202 struct ip6protosw *pr_next; /* Chain for domain */
b0d623f7 203 u_int32_t reserved[1];
9bccf70c 204#endif
1c79356b 205};
b0d623f7
A
206#ifdef __LP64__ // K64todo: might also make sense for the generic case
207#pragma pack()
208#endif
1c79356b 209
b0d623f7
A
210#endif /* KERNEL_PRIVATE */
211#endif /* _NETINET6_IP6PROTOSW_H_ */