sctp_var.h 15 KB

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