More minor IPI work.
[dragonfly/vkernel-mp.git] / sys / netinet / sctp_var.h
blob8931d7d135fd75bcc205e0de99a6763bd8408e3a
1 /* $KAME: sctp_var.h,v 1.23 2004/10/27 07:57:49 itojun Exp $ */
2 /* $DragonFly: src/sys/netinet/sctp_var.h,v 1.4 2007/04/22 01:13:14 dillon Exp $ */
4 /*
5 * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc.
6 * All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by Cisco Systems, Inc.
19 * 4. Neither the name of the project nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY CISCO SYSTEMS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL CISCO SYSTEMS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
36 #ifndef _NETINET_SCTP_VAR_H_
37 #define _NETINET_SCTP_VAR_H_
39 #ifndef __OpenBSD__
40 #include <sys/socketvar.h>
41 #endif
42 #include <netinet/sctp_uio.h>
44 /* SCTP Kernel structures */
47 * Names for SCTP sysctl objects
49 #ifndef __APPLE__
50 #define SCTPCTL_MAXDGRAM 1 /* max datagram size */
51 #define SCTPCTL_RECVSPACE 2 /* default receive buffer space */
52 #define SCTPCTL_AUTOASCONF 3 /* auto asconf enable/disable flag */
53 #define SCTPCTL_ECN_ENABLE 4 /* Is ecn allowed */
54 #define SCTPCTL_ECN_NONCE 5 /* Is ecn nonce allowed */
55 #define SCTPCTL_STRICT_SACK 6 /* strictly require sack'd TSN's to be
56 * smaller than sndnxt.
58 #define SCTPCTL_NOCSUM_LO 7 /* Require that the Loopback NOT have
59 * the crc32 checksum on packets routed over
60 * it.
62 #define SCTPCTL_STRICT_INIT 8
63 #define SCTPCTL_PEER_CHK_OH 9
64 #define SCTPCTL_MAXBURST 10
65 #define SCTPCTL_MAXCHUNKONQ 11
66 #define SCTPCTL_DELAYED_SACK 12
67 #define SCTPCTL_HB_INTERVAL 13
68 #define SCTPCTL_PMTU_RAISE 14
69 #define SCTPCTL_SHUTDOWN_GUARD 15
70 #define SCTPCTL_SECRET_LIFETIME 16
71 #define SCTPCTL_RTO_MAX 17
72 #define SCTPCTL_RTO_MIN 18
73 #define SCTPCTL_RTO_INITIAL 19
74 #define SCTPCTL_INIT_RTO_MAX 20
75 #define SCTPCTL_COOKIE_LIFE 21
76 #define SCTPCTL_INIT_RTX_MAX 22
77 #define SCTPCTL_ASSOC_RTX_MAX 23
78 #define SCTPCTL_PATH_RTX_MAX 24
79 #define SCTPCTL_NR_OUTGOING_STREAMS 25
80 #ifdef SCTP_DEBUG
81 #define SCTPCTL_DEBUG 26
82 #define SCTPCTL_MAXID 27
83 #else
84 #define SCTPCTL_MAXID 26
85 #endif
87 #endif
89 #ifdef SCTP_DEBUG
90 #define SCTPCTL_NAMES { \
91 { 0, 0 }, \
92 { "maxdgram", CTLTYPE_INT }, \
93 { "recvspace", CTLTYPE_INT }, \
94 { "autoasconf", CTLTYPE_INT }, \
95 { "ecn_enable", CTLTYPE_INT }, \
96 { "ecn_nonce", CTLTYPE_INT }, \
97 { "strict_sack", CTLTYPE_INT }, \
98 { "looback_nocsum", CTLTYPE_INT }, \
99 { "strict_init", CTLTYPE_INT }, \
100 { "peer_chkoh", CTLTYPE_INT }, \
101 { "maxburst", CTLTYPE_INT }, \
102 { "maxchunks", CTLTYPE_INT }, \
103 { "delayed_sack_time", CTLTYPE_INT }, \
104 { "heartbeat_interval", CTLTYPE_INT }, \
105 { "pmtu_raise_time", CTLTYPE_INT }, \
106 { "shutdown_guard_time", CTLTYPE_INT }, \
107 { "secret_lifetime", CTLTYPE_INT }, \
108 { "rto_max", CTLTYPE_INT }, \
109 { "rto_min", CTLTYPE_INT }, \
110 { "rto_initial", CTLTYPE_INT }, \
111 { "init_rto_max", CTLTYPE_INT }, \
112 { "valid_cookie_life", CTLTYPE_INT }, \
113 { "init_rtx_max", CTLTYPE_INT }, \
114 { "assoc_rtx_max", CTLTYPE_INT }, \
115 { "path_rtx_max", CTLTYPE_INT }, \
116 { "nr_outgoing_streams", CTLTYPE_INT }, \
117 { "debug", CTLTYPE_INT }, \
119 #else
120 #define SCTPCTL_NAMES { \
121 { 0, 0 }, \
122 { "maxdgram", CTLTYPE_INT }, \
123 { "recvspace", CTLTYPE_INT }, \
124 { "autoasconf", CTLTYPE_INT }, \
125 { "ecn_enable", CTLTYPE_INT }, \
126 { "ecn_nonce", CTLTYPE_INT }, \
127 { "strict_sack", CTLTYPE_INT }, \
128 { "looback_nocsum", CTLTYPE_INT }, \
129 { "strict_init", CTLTYPE_INT }, \
130 { "peer_chkoh", CTLTYPE_INT }, \
131 { "maxburst", CTLTYPE_INT }, \
132 { "maxchunks", CTLTYPE_INT }, \
133 { "delayed_sack_time", CTLTYPE_INT }, \
134 { "heartbeat_interval", CTLTYPE_INT }, \
135 { "pmtu_raise_time", CTLTYPE_INT }, \
136 { "shutdown_guard_time", CTLTYPE_INT }, \
137 { "secret_lifetime", CTLTYPE_INT }, \
138 { "rto_max", CTLTYPE_INT }, \
139 { "rto_min", CTLTYPE_INT }, \
140 { "rto_initial", CTLTYPE_INT }, \
141 { "init_rto_max", CTLTYPE_INT }, \
142 { "valid_cookie_life", CTLTYPE_INT }, \
143 { "init_rtx_max", CTLTYPE_INT }, \
144 { "assoc_rtx_max", CTLTYPE_INT }, \
145 { "path_rtx_max", CTLTYPE_INT }, \
146 { "nr_outgoing_streams", CTLTYPE_INT }, \
148 #endif
150 #if defined(_KERNEL) || (defined(__APPLE__) && defined(KERNEL))
152 #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__)
153 #ifdef SYSCTL_DECL
154 SYSCTL_DECL(_net_inet_sctp);
155 #endif
156 extern struct pr_usrreqs sctp_usrreqs;
157 #elif defined(__NetBSD__)
158 int sctp_usrreq(struct socket *, int, struct mbuf *, struct mbuf *,
159 struct mbuf *, struct proc *);
160 #else
161 int sctp_usrreq(struct socket *, int, struct mbuf *, struct mbuf *,
162 struct mbuf *);
163 #endif
165 #define sctp_sbspace(ssb) ((long) (((ssb)->ssb_hiwat > (ssb)->ssb_cc) ? ((ssb)->ssb_hiwat - (ssb)->ssb_cc) : 0))
167 #define sctp_sbspace_sub(a,b) ((a > b) ? (a - b) : 0)
169 extern int sctp_sendspace;
170 extern int sctp_recvspace;
171 extern int sctp_ecn;
172 extern int sctp_ecn_nonce;
174 struct sctp_nets;
175 struct sctp_inpcb;
176 struct sctp_tcb;
177 struct sctphdr;
179 #if defined(__OpenBSD__)
180 void sctp_fasttim(void);
181 #endif
183 #if defined(__FreeBSD__) || defined(__APPLE__)
184 void sctp_ctlinput(int, struct sockaddr *, void *);
185 int sctp_ctloutput(struct socket *, struct sockopt *);
186 void sctp_input(struct mbuf *, int);
187 #elif defined(__DragonFly__)
188 void sctp_ctlinput(int, struct sockaddr *, void *);
189 int sctp_ctloutput(struct socket *, struct sockopt *);
190 void sctp_input(struct mbuf *, ... );
191 #else
192 void* sctp_ctlinput(int, struct sockaddr *, void *);
193 int sctp_ctloutput(int, struct socket *, int, int, struct mbuf **);
194 void sctp_input(struct mbuf *, ... );
195 #endif
196 void sctp_drain(void);
197 void sctp_init(void);
198 int sctp_shutdown(struct socket *);
199 void sctp_notify(struct sctp_inpcb *, int, struct sctphdr *,
200 struct sockaddr *, struct sctp_tcb *,
201 struct sctp_nets *);
202 int sctp_usr_recvd(struct socket *, int);
204 #if defined(INET6)
205 void ip_2_ip6_hdr(struct ip6_hdr *, struct ip *);
206 #endif
208 int sctp_bindx(struct socket *, int, struct sockaddr_storage *,
209 int, int, struct proc *);
211 /* can't use sctp_assoc_t here */
212 int sctp_peeloff(struct socket *, struct socket *, int, caddr_t, int *);
215 sctp_assoc_t sctp_getassocid(struct sockaddr *);
219 int sctp_ingetaddr(struct socket *,
220 #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__)
221 struct sockaddr **
222 #else
223 struct mbuf *
224 #endif
227 int sctp_peeraddr(struct socket *,
228 #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__)
229 struct sockaddr **
230 #else
231 struct mbuf *
232 #endif
235 #if (defined(__FreeBSD__) && __FreeBSD_version >= 500000) || defined(__DragonFly__)
236 int sctp_listen(struct socket *, struct thread *);
237 #else
238 int sctp_listen(struct socket *, struct proc *);
239 #endif
241 #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__)
242 int sctp_accept(struct socket *, struct sockaddr **);
243 #else
244 int sctp_accept(struct socket *, struct mbuf *);
245 #endif
247 #if defined(__NetBSD__) || defined(__OpenBSD__)
248 int sctp_sysctl(int *, u_int, void *, size_t *, void *, size_t);
249 #endif
252 * compatibility defines for OpenBSD, Apple
255 /* map callout into timeout for OpenBSD */
256 #ifdef __OpenBSD__
257 #ifndef callout_init
258 #define callout_init(args)
259 #define callout_reset(c, ticks, func, arg) \
260 do { \
261 timeout_set((c), (func), (arg)); \
262 timeout_add((c), (ticks)); \
263 } while (0)
264 #define callout_stop(c) timeout_del(c)
265 #define callout_pending(c) timeout_pending(c)
266 #define callout_active(c) timeout_initialized(c)
267 #endif
268 #endif
270 /* XXX: Hopefully temporary until APPLE changes to newer defs like other BSDs */
271 #if defined(__APPLE__)
272 #define if_addrlist if_addrhead
273 #define if_list if_link
274 #define ifa_list ifa_link
275 #endif /* __APPLE__ **/
277 #endif /* _KERNEL */
279 #endif /* !_NETINET_SCTP_VAR_H_ */