| 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 |
| 35 | #if defined(__FreeBSD__) && !defined(__Userspace__) |
| 36 | #include <sys/cdefs.h> |
| 37 | __FBSDID("$FreeBSD: head/sys/netinet/sctp_var.h 365071 2020-09-01 21:19:14Z mjg $"); |
| 38 | #endif |
| 39 |
| 40 | #ifndef _NETINET_SCTP_VAR_H_ |
| 41 | #define _NETINET_SCTP_VAR_H_ |
| 42 |
| 43 | #include <netinet/sctp_uio.h> |
| 44 |
| 45 | #if defined(_KERNEL) || defined(__Userspace__) |
| 46 |
| 47 | #if !defined(__Userspace__) |
| 48 | extern struct pr_usrreqs sctp_usrreqs; |
| 49 | #endif |
| 50 |
| 51 | #define sctp_feature_on(inp, feature) (inp->sctp_features |= feature) |
| 52 | #define sctp_feature_off(inp, feature) (inp->sctp_features &= ~feature) |
| 53 | #define sctp_is_feature_on(inp, feature) ((inp->sctp_features & feature) == feature) |
| 54 | #define sctp_is_feature_off(inp, feature) ((inp->sctp_features & feature) == 0) |
| 55 |
| 56 | #define sctp_stcb_feature_on(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_feature_off(inp, stcb, feature) {\ |
| 64 | if (stcb) { \ |
| 65 | stcb->asoc.sctp_features &= ~feature; \ |
| 66 | } else if (inp) { \ |
| 67 | inp->sctp_features &= ~feature; \ |
| 68 | } \ |
| 69 | } |
| 70 | #define sctp_stcb_is_feature_on(inp, stcb, feature) \ |
| 71 | (((stcb != NULL) && \ |
| 72 | ((stcb->asoc.sctp_features & feature) == feature)) || \ |
| 73 | ((stcb == NULL) && (inp != NULL) && \ |
| 74 | ((inp->sctp_features & feature) == feature))) |
| 75 | #define sctp_stcb_is_feature_off(inp, stcb, feature) \ |
| 76 | (((stcb != NULL) && \ |
| 77 | ((stcb->asoc.sctp_features & feature) == 0)) || \ |
| 78 | ((stcb == NULL) && (inp != NULL) && \ |
| 79 | ((inp->sctp_features & feature) == 0)) || \ |
| 80 | ((stcb == NULL) && (inp == NULL))) |
| 81 |
| 82 | /* managing mobility_feature in inpcb (by micchie) */ |
| 83 | #define sctp_mobility_feature_on(inp, feature) (inp->sctp_mobility_features |= feature) |
| 84 | #define sctp_mobility_feature_off(inp, feature) (inp->sctp_mobility_features &= ~feature) |
| 85 | #define sctp_is_mobility_feature_on(inp, feature) (inp->sctp_mobility_features & feature) |
| 86 | #define sctp_is_mobility_feature_off(inp, feature) ((inp->sctp_mobility_features & feature) == 0) |
| 87 |
| 88 | #define sctp_maxspace(sb) (max((sb)->sb_hiwat,SCTP_MINIMAL_RWND)) |
| 89 |
| 90 | #define sctp_sbspace(asoc, sb) ((long) ((sctp_maxspace(sb) > (asoc)->sb_cc) ? (sctp_maxspace(sb) - (asoc)->sb_cc) : 0)) |
| 91 |
| 92 | #define sctp_sbspace_failedmsgs(sb) ((long) ((sctp_maxspace(sb) > (sb)->sb_cc) ? (sctp_maxspace(sb) - (sb)->sb_cc) : 0)) |
| 93 |
| 94 | #define sctp_sbspace_sub(a,b) (((a) > (b)) ? ((a) - (b)) : 0) |
| 95 |
| 96 | /* |
| 97 | * I tried to cache the readq entries at one point. But the reality |
| 98 | * is that it did not add any performance since this meant we had to |
| 99 | * lock the STCB on read. And at that point once you have to do an |
| 100 | * extra lock, it really does not matter if the lock is in the ZONE |
| 101 | * stuff or in our code. Note that this same problem would occur with |
| 102 | * an mbuf cache as well so it is not really worth doing, at least |
| 103 | * right now :-D |
| 104 | */ |
| 105 | #ifdef INVARIANTS |
| 106 | #define sctp_free_a_readq(_stcb, _readq) { \ |
| 107 | if ((_readq)->on_strm_q) \ |
| 108 | panic("On strm q stcb:%p readq:%p", (_stcb), (_readq)); \ |
| 109 | SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_readq), (_readq)); \ |
| 110 | SCTP_DECR_READQ_COUNT(); \ |
| 111 | } |
| 112 | #else |
| 113 | #define sctp_free_a_readq(_stcb, _readq) { \ |
| 114 | SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_readq), (_readq)); \ |
| 115 | SCTP_DECR_READQ_COUNT(); \ |
| 116 | } |
| 117 | #endif |
| 118 |
| 119 | #define sctp_alloc_a_readq(_stcb, _readq) { \ |
| 120 | (_readq) = SCTP_ZONE_GET(SCTP_BASE_INFO(ipi_zone_readq), struct sctp_queued_to_read); \ |
| 121 | if ((_readq)) { \ |
| 122 | SCTP_INCR_READQ_COUNT(); \ |
| 123 | } \ |
| 124 | } |
| 125 |
| 126 | #define sctp_free_a_strmoq(_stcb, _strmoq, _so_locked) { \ |
| 127 | if ((_strmoq)->holds_key_ref) { \ |
| 128 | sctp_auth_key_release(stcb, sp->auth_keyid, _so_locked); \ |
| 129 | (_strmoq)->holds_key_ref = 0; \ |
| 130 | } \ |
| 131 | SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_strmoq), (_strmoq)); \ |
| 132 | SCTP_DECR_STRMOQ_COUNT(); \ |
| 133 | } |
| 134 |
| 135 | #define sctp_alloc_a_strmoq(_stcb, _strmoq) { \ |
| 136 | (_strmoq) = SCTP_ZONE_GET(SCTP_BASE_INFO(ipi_zone_strmoq), struct sctp_stream_queue_pending); \ |
| 137 | if ((_strmoq)) { \ |
| 138 | memset(_strmoq, 0, sizeof(struct sctp_stream_queue_pending)); \ |
| 139 | SCTP_INCR_STRMOQ_COUNT(); \ |
| 140 | (_strmoq)->holds_key_ref = 0; \ |
| 141 | } \ |
| 142 | } |
| 143 |
| 144 | #define sctp_free_a_chunk(_stcb, _chk, _so_locked) { \ |
| 145 | if ((_chk)->holds_key_ref) {\ |
| 146 | sctp_auth_key_release((_stcb), (_chk)->auth_keyid, _so_locked); \ |
| 147 | (_chk)->holds_key_ref = 0; \ |
| 148 | } \ |
| 149 | if (_stcb) { \ |
| 150 | SCTP_TCB_LOCK_ASSERT((_stcb)); \ |
| 151 | if ((_chk)->whoTo) { \ |
| 152 | sctp_free_remote_addr((_chk)->whoTo); \ |
| 153 | (_chk)->whoTo = NULL; \ |
| 154 | } \ |
| 155 | if (((_stcb)->asoc.free_chunk_cnt > SCTP_BASE_SYSCTL(sctp_asoc_free_resc_limit)) || \ |
| 156 | (SCTP_BASE_INFO(ipi_free_chunks) > SCTP_BASE_SYSCTL(sctp_system_free_resc_limit))) { \ |
| 157 | SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_chunk), (_chk)); \ |
| 158 | SCTP_DECR_CHK_COUNT(); \ |
| 159 | } else { \ |
| 160 | TAILQ_INSERT_TAIL(&(_stcb)->asoc.free_chunks, (_chk), sctp_next); \ |
| 161 | (_stcb)->asoc.free_chunk_cnt++; \ |
| 162 | atomic_add_int(&SCTP_BASE_INFO(ipi_free_chunks), 1); \ |
| 163 | } \ |
| 164 | } else { \ |
| 165 | SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_chunk), (_chk)); \ |
| 166 | SCTP_DECR_CHK_COUNT(); \ |
| 167 | } \ |
| 168 | } |
| 169 |
| 170 | #define sctp_alloc_a_chunk(_stcb, _chk) { \ |
| 171 | if (TAILQ_EMPTY(&(_stcb)->asoc.free_chunks)) { \ |
| 172 | (_chk) = SCTP_ZONE_GET(SCTP_BASE_INFO(ipi_zone_chunk), struct sctp_tmit_chunk); \ |
| 173 | if ((_chk)) { \ |
| 174 | SCTP_INCR_CHK_COUNT(); \ |
| 175 | (_chk)->whoTo = NULL; \ |
| 176 | (_chk)->holds_key_ref = 0; \ |
| 177 | } \ |
| 178 | } else { \ |
| 179 | (_chk) = TAILQ_FIRST(&(_stcb)->asoc.free_chunks); \ |
| 180 | TAILQ_REMOVE(&(_stcb)->asoc.free_chunks, (_chk), sctp_next); \ |
| 181 | atomic_subtract_int(&SCTP_BASE_INFO(ipi_free_chunks), 1); \ |
| 182 | (_chk)->holds_key_ref = 0; \ |
| 183 | SCTP_STAT_INCR(sctps_cached_chk); \ |
| 184 | (_stcb)->asoc.free_chunk_cnt--; \ |
| 185 | } \ |
| 186 | } |
| 187 |
| 188 | #if defined(__FreeBSD__) && !defined(__Userspace__) |
| 189 | #define sctp_free_remote_addr(__net) { \ |
| 190 | if ((__net)) { \ |
| 191 | if (SCTP_DECREMENT_AND_CHECK_REFCOUNT(&(__net)->ref_count)) { \ |
| 192 | RO_NHFREE(&(__net)->ro); \ |
| 193 | if ((__net)->src_addr_selected) { \ |
| 194 | sctp_free_ifa((__net)->ro._s_addr); \ |
| 195 | (__net)->ro._s_addr = NULL; \ |
| 196 | } \ |
| 197 | (__net)->src_addr_selected = 0; \ |
| 198 | (__net)->dest_state &= ~SCTP_ADDR_REACHABLE; \ |
| 199 | SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_net), (__net)); \ |
| 200 | SCTP_DECR_RADDR_COUNT(); \ |
| 201 | } \ |
| 202 | } \ |
| 203 | } |
| 204 |
| 205 | #define sctp_sbfree(ctl, stcb, sb, m) { \ |
| 206 | SCTP_SAVE_ATOMIC_DECREMENT(&(sb)->sb_cc, SCTP_BUF_LEN((m))); \ |
| 207 | SCTP_SAVE_ATOMIC_DECREMENT(&(sb)->sb_mbcnt, MSIZE); \ |
| 208 | if (((ctl)->do_not_ref_stcb == 0) && stcb) {\ |
| 209 | SCTP_SAVE_ATOMIC_DECREMENT(&(stcb)->asoc.sb_cc, SCTP_BUF_LEN((m))); \ |
| 210 | SCTP_SAVE_ATOMIC_DECREMENT(&(stcb)->asoc.my_rwnd_control_len, MSIZE); \ |
| 211 | } \ |
| 212 | if (SCTP_BUF_TYPE(m) != MT_DATA && SCTP_BUF_TYPE(m) != MT_HEADER && \ |
| 213 | SCTP_BUF_TYPE(m) != MT_OOBDATA) \ |
| 214 | atomic_subtract_int(&(sb)->sb_ctl,SCTP_BUF_LEN((m))); \ |
| 215 | } |
| 216 |
| 217 | #define sctp_sballoc(stcb, sb, m) { \ |
| 218 | atomic_add_int(&(sb)->sb_cc,SCTP_BUF_LEN((m))); \ |
| 219 | atomic_add_int(&(sb)->sb_mbcnt, MSIZE); \ |
| 220 | if (stcb) { \ |
| 221 | atomic_add_int(&(stcb)->asoc.sb_cc, SCTP_BUF_LEN((m))); \ |
| 222 | atomic_add_int(&(stcb)->asoc.my_rwnd_control_len, MSIZE); \ |
| 223 | } \ |
| 224 | if (SCTP_BUF_TYPE(m) != MT_DATA && SCTP_BUF_TYPE(m) != MT_HEADER && \ |
| 225 | SCTP_BUF_TYPE(m) != MT_OOBDATA) \ |
| 226 | atomic_add_int(&(sb)->sb_ctl,SCTP_BUF_LEN((m))); \ |
| 227 | } |
| 228 | #else /* FreeBSD Version <= 500000 or non-FreeBSD */ |
| 229 | #define sctp_free_remote_addr(__net) { \ |
| 230 | if ((__net)) { \ |
| 231 | if (SCTP_DECREMENT_AND_CHECK_REFCOUNT(&(__net)->ref_count)) { \ |
| 232 | if ((__net)->ro.ro_rt) { \ |
| 233 | RTFREE((__net)->ro.ro_rt); \ |
| 234 | (__net)->ro.ro_rt = NULL; \ |
| 235 | } \ |
| 236 | if ((__net)->src_addr_selected) { \ |
| 237 | sctp_free_ifa((__net)->ro._s_addr); \ |
| 238 | (__net)->ro._s_addr = NULL; \ |
| 239 | } \ |
| 240 | (__net)->src_addr_selected = 0; \ |
| 241 | (__net)->dest_state &=~SCTP_ADDR_REACHABLE; \ |
| 242 | SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_net), (__net)); \ |
| 243 | SCTP_DECR_RADDR_COUNT(); \ |
| 244 | } \ |
| 245 | } \ |
| 246 | } |
| 247 |
| 248 | #define sctp_sbfree(ctl, stcb, sb, m) { \ |
| 249 | SCTP_SAVE_ATOMIC_DECREMENT(&(sb)->sb_cc, SCTP_BUF_LEN((m))); \ |
| 250 | SCTP_SAVE_ATOMIC_DECREMENT(&(sb)->sb_mbcnt, MSIZE); \ |
| 251 | if (((ctl)->do_not_ref_stcb == 0) && stcb) { \ |
| 252 | SCTP_SAVE_ATOMIC_DECREMENT(&(stcb)->asoc.sb_cc, SCTP_BUF_LEN((m))); \ |
| 253 | SCTP_SAVE_ATOMIC_DECREMENT(&(stcb)->asoc.my_rwnd_control_len, MSIZE); \ |
| 254 | } \ |
| 255 | } |
| 256 |
| 257 | #define sctp_sballoc(stcb, sb, m) { \ |
| 258 | atomic_add_int(&(sb)->sb_cc, SCTP_BUF_LEN((m))); \ |
| 259 | atomic_add_int(&(sb)->sb_mbcnt, MSIZE); \ |
| 260 | if (stcb) { \ |
| 261 | atomic_add_int(&(stcb)->asoc.sb_cc, SCTP_BUF_LEN((m))); \ |
| 262 | atomic_add_int(&(stcb)->asoc.my_rwnd_control_len, MSIZE); \ |
| 263 | } \ |
| 264 | } |
| 265 | #endif |
| 266 |
| 267 | #define sctp_ucount_incr(val) { \ |
| 268 | val++; \ |
| 269 | } |
| 270 |
| 271 | #define sctp_ucount_decr(val) { \ |
| 272 | if (val > 0) { \ |
| 273 | val--; \ |
| 274 | } else { \ |
| 275 | val = 0; \ |
| 276 | } \ |
| 277 | } |
| 278 |
| 279 | #define sctp_mbuf_crush(data) do { \ |
| 280 | struct mbuf *_m; \ |
| 281 | _m = (data); \ |
| 282 | while (_m && (SCTP_BUF_LEN(_m) == 0)) { \ |
| 283 | (data) = SCTP_BUF_NEXT(_m); \ |
| 284 | SCTP_BUF_NEXT(_m) = NULL; \ |
| 285 | sctp_m_free(_m); \ |
| 286 | _m = (data); \ |
| 287 | } \ |
| 288 | } while (0) |
| 289 |
| 290 | #define sctp_flight_size_decrease(tp1) do { \ |
| 291 | if (tp1->whoTo->flight_size >= tp1->book_size) \ |
| 292 | tp1->whoTo->flight_size -= tp1->book_size; \ |
| 293 | else \ |
| 294 | tp1->whoTo->flight_size = 0; \ |
| 295 | } while (0) |
| 296 |
| 297 | #define sctp_flight_size_increase(tp1) do { \ |
| 298 | (tp1)->whoTo->flight_size += (tp1)->book_size; \ |
| 299 | } while (0) |
| 300 |
| 301 | #ifdef SCTP_FS_SPEC_LOG |
| 302 | #define sctp_total_flight_decrease(stcb, tp1) do { \ |
| 303 | if (stcb->asoc.fs_index > SCTP_FS_SPEC_LOG_SIZE) \ |
| 304 | stcb->asoc.fs_index = 0;\ |
| 305 | stcb->asoc.fslog[stcb->asoc.fs_index].total_flight = stcb->asoc.total_flight; \ |
| 306 | stcb->asoc.fslog[stcb->asoc.fs_index].tsn = tp1->rec.data.tsn; \ |
| 307 | stcb->asoc.fslog[stcb->asoc.fs_index].book = tp1->book_size; \ |
| 308 | stcb->asoc.fslog[stcb->asoc.fs_index].sent = tp1->sent; \ |
| 309 | stcb->asoc.fslog[stcb->asoc.fs_index].incr = 0; \ |
| 310 | stcb->asoc.fslog[stcb->asoc.fs_index].decr = 1; \ |
| 311 | stcb->asoc.fs_index++; \ |
| 312 | tp1->window_probe = 0; \ |
| 313 | if (stcb->asoc.total_flight >= tp1->book_size) { \ |
| 314 | stcb->asoc.total_flight -= tp1->book_size; \ |
| 315 | if (stcb->asoc.total_flight_count > 0) \ |
| 316 | stcb->asoc.total_flight_count--; \ |
| 317 | } else { \ |
| 318 | stcb->asoc.total_flight = 0; \ |
| 319 | stcb->asoc.total_flight_count = 0; \ |
| 320 | } \ |
| 321 | } while (0) |
| 322 |
| 323 | #define sctp_total_flight_increase(stcb, tp1) do { \ |
| 324 | if (stcb->asoc.fs_index > SCTP_FS_SPEC_LOG_SIZE) \ |
| 325 | stcb->asoc.fs_index = 0;\ |
| 326 | stcb->asoc.fslog[stcb->asoc.fs_index].total_flight = stcb->asoc.total_flight; \ |
| 327 | stcb->asoc.fslog[stcb->asoc.fs_index].tsn = tp1->rec.data.tsn; \ |
| 328 | stcb->asoc.fslog[stcb->asoc.fs_index].book = tp1->book_size; \ |
| 329 | stcb->asoc.fslog[stcb->asoc.fs_index].sent = tp1->sent; \ |
| 330 | stcb->asoc.fslog[stcb->asoc.fs_index].incr = 1; \ |
| 331 | stcb->asoc.fslog[stcb->asoc.fs_index].decr = 0; \ |
| 332 | stcb->asoc.fs_index++; \ |
| 333 | (stcb)->asoc.total_flight_count++; \ |
| 334 | (stcb)->asoc.total_flight += (tp1)->book_size; \ |
| 335 | } while (0) |
| 336 |
| 337 | #else |
| 338 |
| 339 | #define sctp_total_flight_decrease(stcb, tp1) do { \ |
| 340 | tp1->window_probe = 0; \ |
| 341 | if (stcb->asoc.total_flight >= tp1->book_size) { \ |
| 342 | stcb->asoc.total_flight -= tp1->book_size; \ |
| 343 | if (stcb->asoc.total_flight_count > 0) \ |
| 344 | stcb->asoc.total_flight_count--; \ |
| 345 | } else { \ |
| 346 | stcb->asoc.total_flight = 0; \ |
| 347 | stcb->asoc.total_flight_count = 0; \ |
| 348 | } \ |
| 349 | } while (0) |
| 350 |
| 351 | #define sctp_total_flight_increase(stcb, tp1) do { \ |
| 352 | (stcb)->asoc.total_flight_count++; \ |
| 353 | (stcb)->asoc.total_flight += (tp1)->book_size; \ |
| 354 | } while (0) |
| 355 |
| 356 | #endif |
| 357 |
| 358 | #define SCTP_PF_ENABLED(_net) (_net->pf_threshold < _net->failure_threshold) |
| 359 | #define SCTP_NET_IS_PF(_net) (_net->pf_threshold < _net->error_count) |
| 360 |
| 361 | struct sctp_nets; |
| 362 | struct sctp_inpcb; |
| 363 | struct sctp_tcb; |
| 364 | struct sctphdr; |
| 365 |
| 366 | #if defined(__FreeBSD__) || defined(_WIN32) || defined(__Userspace__) |
| 367 | void sctp_close(struct socket *so); |
| 368 | #else |
| 369 | int sctp_detach(struct socket *so); |
| 370 | #endif |
| 371 | int sctp_disconnect(struct socket *so); |
| 372 | #if !defined(__Userspace__) |
| 373 | #if defined(__APPLE__) && !defined(APPLE_LEOPARD) && !defined(APPLE_SNOWLEOPARD) && !defined(APPLE_LION) && !defined(APPLE_MOUNTAINLION) && !defined(APPLE_ELCAPITAN) |
| 374 | void sctp_ctlinput(int, struct sockaddr *, void *, struct ifnet * SCTP_UNUSED); |
| 375 | #else |
| 376 | void sctp_ctlinput(int, struct sockaddr *, void *); |
| 377 | #endif |
| 378 | int sctp_ctloutput(struct socket *, struct sockopt *); |
| 379 | #ifdef INET |
| 380 | void sctp_input_with_port(struct mbuf *, int, uint16_t); |
| 381 | #if defined(__FreeBSD__) && !defined(__Userspace__) |
| 382 | int sctp_input(struct mbuf **, int *, int); |
| 383 | #else |
| 384 | void sctp_input(struct mbuf *, int); |
| 385 | #endif |
| 386 | #endif |
| 387 | void sctp_pathmtu_adjustment(struct sctp_tcb *, uint16_t); |
| 388 | #else |
| 389 | #if defined(__Userspace__) |
| 390 | void sctp_pathmtu_adjustment(struct sctp_tcb *, uint16_t); |
| 391 | #else |
| 392 | void sctp_input(struct mbuf *,...); |
| 393 | #endif |
| 394 | void *sctp_ctlinput(int, struct sockaddr *, void *); |
| 395 | int sctp_ctloutput(int, struct socket *, int, int, struct mbuf **); |
| 396 | #endif |
| 397 | void sctp_drain(void); |
| 398 | #if defined(__Userspace__) |
| 399 | void sctp_init(uint16_t, |
| 400 | int (*)(void *addr, void *buffer, size_t length, uint8_t tos, uint8_t set_df), |
| 401 | void (*)(const char *, ...), int start_threads); |
| 402 | #elif defined(__APPLE__) && (!defined(APPLE_LEOPARD) && !defined(APPLE_SNOWLEOPARD) &&!defined(APPLE_LION) && !defined(APPLE_MOUNTAINLION)) |
| 403 | void sctp_init(struct protosw *pp, struct domain *dp); |
| 404 | #else |
| 405 | void sctp_init(void); |
| 406 | void sctp_notify(struct sctp_inpcb *, struct sctp_tcb *, struct sctp_nets *, |
| 407 | uint8_t, uint8_t, uint16_t, uint32_t); |
| 408 | #endif |
| 409 | #if !defined(__FreeBSD__) && !defined(__Userspace__) |
| 410 | void sctp_finish(void); |
| 411 | #endif |
| 412 | #if defined(__FreeBSD__) || defined(_WIN32) || defined(__Userspace__) |
| 413 | int sctp_flush(struct socket *, int); |
| 414 | #endif |
| 415 | int sctp_shutdown(struct socket *); |
| 416 | int sctp_bindx(struct socket *, int, struct sockaddr_storage *, |
| 417 | int, int, struct proc *); |
| 418 | /* can't use sctp_assoc_t here */ |
| 419 | int sctp_peeloff(struct socket *, struct socket *, int, caddr_t, int *); |
| 420 | #if !defined(__Userspace__) |
| 421 | int sctp_ingetaddr(struct socket *, struct sockaddr **); |
| 422 | #else |
| 423 | int sctp_ingetaddr(struct socket *, struct mbuf *); |
| 424 | #endif |
| 425 | #if !defined(__Userspace__) |
| 426 | int sctp_peeraddr(struct socket *, struct sockaddr **); |
| 427 | #else |
| 428 | int sctp_peeraddr(struct socket *, struct mbuf *); |
| 429 | #endif |
| 430 | #if defined(__FreeBSD__) && !defined(__Userspace__) |
| 431 | int sctp_listen(struct socket *, int, struct thread *); |
| 432 | #elif defined(_WIN32) && !defined(__Userspace__) |
| 433 | int sctp_listen(struct socket *, int, PKTHREAD); |
| 434 | #elif defined(__Userspace__) |
| 435 | int sctp_listen(struct socket *, int, struct proc *); |
| 436 | #else |
| 437 | int sctp_listen(struct socket *, struct proc *); |
| 438 | #endif |
| 439 | int sctp_accept(struct socket *, struct sockaddr **); |
| 440 |
| 441 | #endif /* _KERNEL */ |
| 442 |
| 443 | #endif /* !_NETINET_SCTP_VAR_H_ */ |
| 444 |