blob: 5c2a5299df5798b32d7514212e6327a69610e8d4 [file] [log] [blame]
James Kuszmaul4cb043c2021-01-17 11:25:51 -08001/*-
2 * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
3 * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved.
4 * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * a) Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
11 *
12 * b) Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the distribution.
15 *
16 * c) Neither the name of Cisco Systems, Inc. nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 * THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#ifdef __FreeBSD__
34#include <sys/cdefs.h>
35__FBSDID("$FreeBSD: head/sys/netinet/sctp_var.h 309682 2016-12-07 19:30:59Z tuexen $");
36#endif
37
38#ifndef _NETINET_SCTP_VAR_H_
39#define _NETINET_SCTP_VAR_H_
40
41#include <netinet/sctp_uio.h>
42
43#if defined(_KERNEL) || defined(__Userspace__)
44
45#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__Windows__)
46extern struct pr_usrreqs sctp_usrreqs;
47#endif
48
49
50#define sctp_feature_on(inp, feature) (inp->sctp_features |= feature)
51#define sctp_feature_off(inp, feature) (inp->sctp_features &= ~feature)
52#define sctp_is_feature_on(inp, feature) ((inp->sctp_features & feature) == feature)
53#define sctp_is_feature_off(inp, feature) ((inp->sctp_features & feature) == 0)
54
55#define sctp_stcb_feature_on(inp, stcb, feature) {\
56 if (stcb) { \
57 stcb->asoc.sctp_features |= feature; \
58 } else if (inp) { \
59 inp->sctp_features |= feature; \
60 } \
61}
62#define sctp_stcb_feature_off(inp, stcb, feature) {\
63 if (stcb) { \
64 stcb->asoc.sctp_features &= ~feature; \
65 } else if (inp) { \
66 inp->sctp_features &= ~feature; \
67 } \
68}
69#define sctp_stcb_is_feature_on(inp, stcb, feature) \
70 (((stcb != NULL) && \
71 ((stcb->asoc.sctp_features & feature) == feature)) || \
72 ((stcb == NULL) && (inp != NULL) && \
73 ((inp->sctp_features & feature) == feature)))
74#define sctp_stcb_is_feature_off(inp, stcb, feature) \
75 (((stcb != NULL) && \
76 ((stcb->asoc.sctp_features & feature) == 0)) || \
77 ((stcb == NULL) && (inp != NULL) && \
78 ((inp->sctp_features & feature) == 0)) || \
79 ((stcb == NULL) && (inp == NULL)))
80
81/* managing mobility_feature in inpcb (by micchie) */
82#define sctp_mobility_feature_on(inp, feature) (inp->sctp_mobility_features |= feature)
83#define sctp_mobility_feature_off(inp, feature) (inp->sctp_mobility_features &= ~feature)
84#define sctp_is_mobility_feature_on(inp, feature) (inp->sctp_mobility_features & feature)
85#define sctp_is_mobility_feature_off(inp, feature) ((inp->sctp_mobility_features & feature) == 0)
86
87#define sctp_maxspace(sb) (max((sb)->sb_hiwat,SCTP_MINIMAL_RWND))
88
89#define sctp_sbspace(asoc, sb) ((long) ((sctp_maxspace(sb) > (asoc)->sb_cc) ? (sctp_maxspace(sb) - (asoc)->sb_cc) : 0))
90
91#define sctp_sbspace_failedmsgs(sb) ((long) ((sctp_maxspace(sb) > (sb)->sb_cc) ? (sctp_maxspace(sb) - (sb)->sb_cc) : 0))
92
93#define sctp_sbspace_sub(a,b) (((a) > (b)) ? ((a) - (b)) : 0)
94
95/*
96 * I tried to cache the readq entries at one point. But the reality
97 * is that it did not add any performance since this meant we had to
98 * lock the STCB on read. And at that point once you have to do an
99 * extra lock, it really does not matter if the lock is in the ZONE
100 * stuff or in our code. Note that this same problem would occur with
101 * an mbuf cache as well so it is not really worth doing, at least
102 * right now :-D
103 */
104#ifdef INVARIANTS
105#define sctp_free_a_readq(_stcb, _readq) { \
106 if ((_readq)->on_strm_q) \
107 panic("On strm q stcb:%p readq:%p", (_stcb), (_readq)); \
108 SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_readq), (_readq)); \
109 SCTP_DECR_READQ_COUNT(); \
110}
111#else
112#define sctp_free_a_readq(_stcb, _readq) { \
113 SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_readq), (_readq)); \
114 SCTP_DECR_READQ_COUNT(); \
115}
116#endif
117
118#define sctp_alloc_a_readq(_stcb, _readq) { \
119 (_readq) = SCTP_ZONE_GET(SCTP_BASE_INFO(ipi_zone_readq), struct sctp_queued_to_read); \
120 if ((_readq)) { \
121 SCTP_INCR_READQ_COUNT(); \
122 } \
123}
124
125#define sctp_free_a_strmoq(_stcb, _strmoq, _so_locked) { \
126 if ((_strmoq)->holds_key_ref) { \
127 sctp_auth_key_release(stcb, sp->auth_keyid, _so_locked); \
128 (_strmoq)->holds_key_ref = 0; \
129 } \
130 SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_strmoq), (_strmoq)); \
131 SCTP_DECR_STRMOQ_COUNT(); \
132}
133
134#define sctp_alloc_a_strmoq(_stcb, _strmoq) { \
135 (_strmoq) = SCTP_ZONE_GET(SCTP_BASE_INFO(ipi_zone_strmoq), struct sctp_stream_queue_pending); \
136 if ((_strmoq)) { \
137 memset(_strmoq, 0, sizeof(struct sctp_stream_queue_pending)); \
138 SCTP_INCR_STRMOQ_COUNT(); \
139 (_strmoq)->holds_key_ref = 0; \
140 } \
141}
142
143#define sctp_free_a_chunk(_stcb, _chk, _so_locked) { \
144 if ((_chk)->holds_key_ref) {\
145 sctp_auth_key_release((_stcb), (_chk)->auth_keyid, _so_locked); \
146 (_chk)->holds_key_ref = 0; \
147 } \
148 if (_stcb) { \
149 SCTP_TCB_LOCK_ASSERT((_stcb)); \
150 if ((_chk)->whoTo) { \
151 sctp_free_remote_addr((_chk)->whoTo); \
152 (_chk)->whoTo = NULL; \
153 } \
154 if (((_stcb)->asoc.free_chunk_cnt > SCTP_BASE_SYSCTL(sctp_asoc_free_resc_limit)) || \
155 (SCTP_BASE_INFO(ipi_free_chunks) > SCTP_BASE_SYSCTL(sctp_system_free_resc_limit))) { \
156 SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_chunk), (_chk)); \
157 SCTP_DECR_CHK_COUNT(); \
158 } else { \
159 TAILQ_INSERT_TAIL(&(_stcb)->asoc.free_chunks, (_chk), sctp_next); \
160 (_stcb)->asoc.free_chunk_cnt++; \
161 atomic_add_int(&SCTP_BASE_INFO(ipi_free_chunks), 1); \
162 } \
163 } else { \
164 SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_chunk), (_chk)); \
165 SCTP_DECR_CHK_COUNT(); \
166 } \
167}
168
169#define sctp_alloc_a_chunk(_stcb, _chk) { \
170 if (TAILQ_EMPTY(&(_stcb)->asoc.free_chunks)) { \
171 (_chk) = SCTP_ZONE_GET(SCTP_BASE_INFO(ipi_zone_chunk), struct sctp_tmit_chunk); \
172 if ((_chk)) { \
173 SCTP_INCR_CHK_COUNT(); \
174 (_chk)->whoTo = NULL; \
175 (_chk)->holds_key_ref = 0; \
176 } \
177 } else { \
178 (_chk) = TAILQ_FIRST(&(_stcb)->asoc.free_chunks); \
179 TAILQ_REMOVE(&(_stcb)->asoc.free_chunks, (_chk), sctp_next); \
180 atomic_subtract_int(&SCTP_BASE_INFO(ipi_free_chunks), 1); \
181 (_chk)->holds_key_ref = 0; \
182 SCTP_STAT_INCR(sctps_cached_chk); \
183 (_stcb)->asoc.free_chunk_cnt--; \
184 } \
185}
186
187#if defined(__FreeBSD__) && __FreeBSD_version > 500000
188
189#define sctp_free_remote_addr(__net) { \
190 if ((__net)) { \
191 if (SCTP_DECREMENT_AND_CHECK_REFCOUNT(&(__net)->ref_count)) { \
192 (void)SCTP_OS_TIMER_STOP(&(__net)->rxt_timer.timer); \
193 (void)SCTP_OS_TIMER_STOP(&(__net)->pmtu_timer.timer); \
194 (void)SCTP_OS_TIMER_STOP(&(__net)->hb_timer.timer); \
195 if ((__net)->ro.ro_rt) { \
196 RTFREE((__net)->ro.ro_rt); \
197 (__net)->ro.ro_rt = NULL; \
198 } \
199 if ((__net)->src_addr_selected) { \
200 sctp_free_ifa((__net)->ro._s_addr); \
201 (__net)->ro._s_addr = NULL; \
202 } \
203 (__net)->src_addr_selected = 0; \
204 (__net)->dest_state &= ~SCTP_ADDR_REACHABLE; \
205 SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_net), (__net)); \
206 SCTP_DECR_RADDR_COUNT(); \
207 } \
208 } \
209}
210
211#define sctp_sbfree(ctl, stcb, sb, m) { \
212 SCTP_SAVE_ATOMIC_DECREMENT(&(sb)->sb_cc, SCTP_BUF_LEN((m))); \
213 SCTP_SAVE_ATOMIC_DECREMENT(&(sb)->sb_mbcnt, MSIZE); \
214 if (((ctl)->do_not_ref_stcb == 0) && stcb) {\
215 SCTP_SAVE_ATOMIC_DECREMENT(&(stcb)->asoc.sb_cc, SCTP_BUF_LEN((m))); \
216 SCTP_SAVE_ATOMIC_DECREMENT(&(stcb)->asoc.my_rwnd_control_len, MSIZE); \
217 } \
218 if (SCTP_BUF_TYPE(m) != MT_DATA && SCTP_BUF_TYPE(m) != MT_HEADER && \
219 SCTP_BUF_TYPE(m) != MT_OOBDATA) \
220 atomic_subtract_int(&(sb)->sb_ctl,SCTP_BUF_LEN((m))); \
221}
222
223#define sctp_sballoc(stcb, sb, m) { \
224 atomic_add_int(&(sb)->sb_cc,SCTP_BUF_LEN((m))); \
225 atomic_add_int(&(sb)->sb_mbcnt, MSIZE); \
226 if (stcb) { \
227 atomic_add_int(&(stcb)->asoc.sb_cc, SCTP_BUF_LEN((m))); \
228 atomic_add_int(&(stcb)->asoc.my_rwnd_control_len, MSIZE); \
229 } \
230 if (SCTP_BUF_TYPE(m) != MT_DATA && SCTP_BUF_TYPE(m) != MT_HEADER && \
231 SCTP_BUF_TYPE(m) != MT_OOBDATA) \
232 atomic_add_int(&(sb)->sb_ctl,SCTP_BUF_LEN((m))); \
233}
234
235#else /* FreeBSD Version <= 500000 or non-FreeBSD */
236
237#define sctp_free_remote_addr(__net) { \
238 if ((__net)) { \
239 if (SCTP_DECREMENT_AND_CHECK_REFCOUNT(&(__net)->ref_count)) { \
240 (void)SCTP_OS_TIMER_STOP(&(__net)->rxt_timer.timer); \
241 (void)SCTP_OS_TIMER_STOP(&(__net)->pmtu_timer.timer); \
242 (void)SCTP_OS_TIMER_STOP(&(__net)->hb_timer.timer); \
243 if ((__net)->ro.ro_rt) { \
244 RTFREE((__net)->ro.ro_rt); \
245 (__net)->ro.ro_rt = NULL; \
246 } \
247 if ((__net)->src_addr_selected) { \
248 sctp_free_ifa((__net)->ro._s_addr); \
249 (__net)->ro._s_addr = NULL; \
250 } \
251 (__net)->src_addr_selected = 0; \
252 (__net)->dest_state &=~SCTP_ADDR_REACHABLE; \
253 SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_net), (__net)); \
254 SCTP_DECR_RADDR_COUNT(); \
255 } \
256 } \
257}
258
259#if defined(__Panda__)
260#define sctp_sbfree(ctl, stcb, sb, m) { \
261 if ((sb)->sb_cc >= (uint32_t)SCTP_BUF_LEN((m))) { \
262 atomic_subtract_int(&(sb)->sb_cc, SCTP_BUF_LEN((m))); \
263 } else { \
264 (sb)->sb_cc = 0; \
265 } \
266 if (((ctl)->do_not_ref_stcb == 0) && stcb) { \
267 if ((stcb)->asoc.sb_cc >= (uint32_t)SCTP_BUF_LEN((m))) { \
268 atomic_subtract_int(&(stcb)->asoc.sb_cc, SCTP_BUF_LEN((m))); \
269 } else { \
270 (stcb)->asoc.sb_cc = 0; \
271 } \
272 } \
273}
274
275#define sctp_sballoc(stcb, sb, m) { \
276 atomic_add_int(&(sb)->sb_cc, SCTP_BUF_LEN((m))); \
277 if (stcb) { \
278 atomic_add_int(&(stcb)->asoc.sb_cc, SCTP_BUF_LEN((m))); \
279 } \
280}
281
282#else
283
284#define sctp_sbfree(ctl, stcb, sb, m) { \
285 SCTP_SAVE_ATOMIC_DECREMENT(&(sb)->sb_cc, SCTP_BUF_LEN((m))); \
286 SCTP_SAVE_ATOMIC_DECREMENT(&(sb)->sb_mbcnt, MSIZE); \
287 if (((ctl)->do_not_ref_stcb == 0) && stcb) { \
288 SCTP_SAVE_ATOMIC_DECREMENT(&(stcb)->asoc.sb_cc, SCTP_BUF_LEN((m))); \
289 SCTP_SAVE_ATOMIC_DECREMENT(&(stcb)->asoc.my_rwnd_control_len, MSIZE); \
290 } \
291}
292
293#define sctp_sballoc(stcb, sb, m) { \
294 atomic_add_int(&(sb)->sb_cc, SCTP_BUF_LEN((m))); \
295 atomic_add_int(&(sb)->sb_mbcnt, MSIZE); \
296 if (stcb) { \
297 atomic_add_int(&(stcb)->asoc.sb_cc, SCTP_BUF_LEN((m))); \
298 atomic_add_int(&(stcb)->asoc.my_rwnd_control_len, MSIZE); \
299 } \
300}
301#endif
302#endif
303
304#define sctp_ucount_incr(val) { \
305 val++; \
306}
307
308#define sctp_ucount_decr(val) { \
309 if (val > 0) { \
310 val--; \
311 } else { \
312 val = 0; \
313 } \
314}
315
316#define sctp_mbuf_crush(data) do { \
317 struct mbuf *_m; \
318 _m = (data); \
319 while (_m && (SCTP_BUF_LEN(_m) == 0)) { \
320 (data) = SCTP_BUF_NEXT(_m); \
321 SCTP_BUF_NEXT(_m) = NULL; \
322 sctp_m_free(_m); \
323 _m = (data); \
324 } \
325} while (0)
326
327#define sctp_flight_size_decrease(tp1) do { \
328 if (tp1->whoTo->flight_size >= tp1->book_size) \
329 tp1->whoTo->flight_size -= tp1->book_size; \
330 else \
331 tp1->whoTo->flight_size = 0; \
332} while (0)
333
334#define sctp_flight_size_increase(tp1) do { \
335 (tp1)->whoTo->flight_size += (tp1)->book_size; \
336} while (0)
337
338#ifdef SCTP_FS_SPEC_LOG
339#define sctp_total_flight_decrease(stcb, tp1) do { \
340 if (stcb->asoc.fs_index > SCTP_FS_SPEC_LOG_SIZE) \
341 stcb->asoc.fs_index = 0;\
342 stcb->asoc.fslog[stcb->asoc.fs_index].total_flight = stcb->asoc.total_flight; \
343 stcb->asoc.fslog[stcb->asoc.fs_index].tsn = tp1->rec.data.tsn; \
344 stcb->asoc.fslog[stcb->asoc.fs_index].book = tp1->book_size; \
345 stcb->asoc.fslog[stcb->asoc.fs_index].sent = tp1->sent; \
346 stcb->asoc.fslog[stcb->asoc.fs_index].incr = 0; \
347 stcb->asoc.fslog[stcb->asoc.fs_index].decr = 1; \
348 stcb->asoc.fs_index++; \
349 tp1->window_probe = 0; \
350 if (stcb->asoc.total_flight >= tp1->book_size) { \
351 stcb->asoc.total_flight -= tp1->book_size; \
352 if (stcb->asoc.total_flight_count > 0) \
353 stcb->asoc.total_flight_count--; \
354 } else { \
355 stcb->asoc.total_flight = 0; \
356 stcb->asoc.total_flight_count = 0; \
357 } \
358} while (0)
359
360#define sctp_total_flight_increase(stcb, tp1) do { \
361 if (stcb->asoc.fs_index > SCTP_FS_SPEC_LOG_SIZE) \
362 stcb->asoc.fs_index = 0;\
363 stcb->asoc.fslog[stcb->asoc.fs_index].total_flight = stcb->asoc.total_flight; \
364 stcb->asoc.fslog[stcb->asoc.fs_index].tsn = tp1->rec.data.tsn; \
365 stcb->asoc.fslog[stcb->asoc.fs_index].book = tp1->book_size; \
366 stcb->asoc.fslog[stcb->asoc.fs_index].sent = tp1->sent; \
367 stcb->asoc.fslog[stcb->asoc.fs_index].incr = 1; \
368 stcb->asoc.fslog[stcb->asoc.fs_index].decr = 0; \
369 stcb->asoc.fs_index++; \
370 (stcb)->asoc.total_flight_count++; \
371 (stcb)->asoc.total_flight += (tp1)->book_size; \
372} while (0)
373
374#else
375
376#define sctp_total_flight_decrease(stcb, tp1) do { \
377 tp1->window_probe = 0; \
378 if (stcb->asoc.total_flight >= tp1->book_size) { \
379 stcb->asoc.total_flight -= tp1->book_size; \
380 if (stcb->asoc.total_flight_count > 0) \
381 stcb->asoc.total_flight_count--; \
382 } else { \
383 stcb->asoc.total_flight = 0; \
384 stcb->asoc.total_flight_count = 0; \
385 } \
386} while (0)
387
388#define sctp_total_flight_increase(stcb, tp1) do { \
389 (stcb)->asoc.total_flight_count++; \
390 (stcb)->asoc.total_flight += (tp1)->book_size; \
391} while (0)
392
393#endif
394
395#define SCTP_PF_ENABLED(_net) (_net->pf_threshold < _net->failure_threshold)
396#define SCTP_NET_IS_PF(_net) (_net->pf_threshold < _net->error_count)
397
398struct sctp_nets;
399struct sctp_inpcb;
400struct sctp_tcb;
401struct sctphdr;
402
403
404#if (defined(__FreeBSD__) && __FreeBSD_version > 690000) || defined(__Windows__) || defined(__Userspace__)
405void sctp_close(struct socket *so);
406#else
407int sctp_detach(struct socket *so);
408#endif
409int sctp_disconnect(struct socket *so);
410#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__Windows__)
411#if defined(__FreeBSD__) && __FreeBSD_version < 902000
412void sctp_ctlinput __P((int, struct sockaddr *, void *));
413int sctp_ctloutput __P((struct socket *, struct sockopt *));
414#ifdef INET
415void sctp_input_with_port __P((struct mbuf *, int, uint16_t));
416void sctp_input __P((struct mbuf *, int));
417#endif
418void sctp_pathmtu_adjustment __P((struct sctp_tcb *, uint16_t));
419#else
420void sctp_ctlinput(int, struct sockaddr *, void *);
421int sctp_ctloutput(struct socket *, struct sockopt *);
422#ifdef INET
423void sctp_input_with_port(struct mbuf *, int, uint16_t);
424#if defined(__FreeBSD__) && __FreeBSD_version >= 1100020
425int sctp_input(struct mbuf **, int *, int);
426#else
427void sctp_input(struct mbuf *, int);
428#endif
429#endif
430void sctp_pathmtu_adjustment(struct sctp_tcb *, uint16_t);
431#endif
432#else
433#if defined(__Panda__)
434void sctp_input(pakhandle_type i_pak);
435#elif defined(__Userspace__)
436void sctp_pathmtu_adjustment(struct sctp_tcb *, uint16_t);
437#else
438void sctp_input(struct mbuf *,...);
439#endif
440void *sctp_ctlinput(int, struct sockaddr *, void *);
441int sctp_ctloutput(int, struct socket *, int, int, struct mbuf **);
442#endif
443#if defined(__FreeBSD__) && __FreeBSD_version < 902000
444void sctp_drain __P((void));
445#else
446void sctp_drain(void);
447#endif
448#if defined(__Userspace__)
449void sctp_init(uint16_t,
450 int (*)(void *addr, void *buffer, size_t length, uint8_t tos, uint8_t set_df),
451 void (*)(const char *, ...));
452#elif defined(__FreeBSD__) && __FreeBSD_version < 902000
453void sctp_init __P((void));
454#elif defined(__APPLE__) && (!defined(APPLE_LEOPARD) && !defined(APPLE_SNOWLEOPARD) &&!defined(APPLE_LION) && !defined(APPLE_MOUNTAINLION))
455void sctp_init(struct protosw *pp, struct domain *dp);
456#else
457void sctp_init(void);
458void sctp_notify(struct sctp_inpcb *, struct sctp_tcb *, struct sctp_nets *,
459 uint8_t, uint8_t, uint16_t, uint16_t);
460#endif
461#if !defined(__FreeBSD__)
462void sctp_finish(void);
463#endif
464#if defined(__FreeBSD__) || defined(__Windows__) || defined(__Userspace__)
465int sctp_flush(struct socket *, int);
466#endif
467#if defined(__FreeBSD__) && __FreeBSD_version < 902000
468int sctp_shutdown __P((struct socket *));
469#else
470int sctp_shutdown(struct socket *);
471#endif
472int sctp_bindx(struct socket *, int, struct sockaddr_storage *,
473 int, int, struct proc *);
474/* can't use sctp_assoc_t here */
475int sctp_peeloff(struct socket *, struct socket *, int, caddr_t, int *);
476#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__Windows__)
477int sctp_ingetaddr(struct socket *, struct sockaddr **);
478#elif defined(__Panda__)
479int sctp_ingetaddr(struct socket *, struct sockaddr *);
480#else
481int sctp_ingetaddr(struct socket *, struct mbuf *);
482#endif
483#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__Windows__)
484int sctp_peeraddr(struct socket *, struct sockaddr **);
485#elif defined(__Panda__)
486int sctp_peeraddr(struct socket *, struct sockaddr *);
487#else
488int sctp_peeraddr(struct socket *, struct mbuf *);
489#endif
490#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
491#if __FreeBSD_version >= 700000
492int sctp_listen(struct socket *, int, struct thread *);
493#else
494int sctp_listen(struct socket *, struct thread *);
495#endif
496#elif defined(__Windows__)
497int sctp_listen(struct socket *, int, PKTHREAD);
498#elif defined(__Userspace__)
499int sctp_listen(struct socket *, int, struct proc *);
500#else
501int sctp_listen(struct socket *, struct proc *);
502#endif
503#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__Windows__) || defined(__Userspace__)
504int sctp_accept(struct socket *, struct sockaddr **);
505#elif defined(__Panda__)
506int sctp_accept(struct socket *, struct sockaddr *, int *, void *, int *);
507#else
508int sctp_accept(struct socket *, struct mbuf *);
509#endif
510
511#endif /* _KERNEL */
512
513#endif /* !_NETINET_SCTP_VAR_H_ */