1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/netwerk/sctp/src/netinet/sctp_var.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,502 @@ 1.4 +/*- 1.5 + * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. 1.6 + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. 1.7 + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. 1.8 + * 1.9 + * Redistribution and use in source and binary forms, with or without 1.10 + * modification, are permitted provided that the following conditions are met: 1.11 + * 1.12 + * a) Redistributions of source code must retain the above copyright notice, 1.13 + * this list of conditions and the following disclaimer. 1.14 + * 1.15 + * b) Redistributions in binary form must reproduce the above copyright 1.16 + * notice, this list of conditions and the following disclaimer in 1.17 + * the documentation and/or other materials provided with the distribution. 1.18 + * 1.19 + * c) Neither the name of Cisco Systems, Inc. nor the names of its 1.20 + * contributors may be used to endorse or promote products derived 1.21 + * from this software without specific prior written permission. 1.22 + * 1.23 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1.24 + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 1.25 + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1.26 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 1.27 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 1.28 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 1.29 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 1.30 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 1.31 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 1.32 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 1.33 + * THE POSSIBILITY OF SUCH DAMAGE. 1.34 + */ 1.35 + 1.36 +#ifdef __FreeBSD__ 1.37 +#include <sys/cdefs.h> 1.38 +__FBSDID("$FreeBSD: head/sys/netinet/sctp_var.h 242327 2012-10-29 20:47:32Z tuexen $"); 1.39 +#endif 1.40 + 1.41 +#ifndef _NETINET_SCTP_VAR_H_ 1.42 +#define _NETINET_SCTP_VAR_H_ 1.43 + 1.44 +#include <netinet/sctp_uio.h> 1.45 + 1.46 +#if defined(_KERNEL) || defined(__Userspace__) 1.47 + 1.48 +#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__Windows__) 1.49 +extern struct pr_usrreqs sctp_usrreqs; 1.50 +#endif 1.51 + 1.52 + 1.53 +#define sctp_feature_on(inp, feature) (inp->sctp_features |= feature) 1.54 +#define sctp_feature_off(inp, feature) (inp->sctp_features &= ~feature) 1.55 +#define sctp_is_feature_on(inp, feature) ((inp->sctp_features & feature) == feature) 1.56 +#define sctp_is_feature_off(inp, feature) ((inp->sctp_features & feature) == 0) 1.57 + 1.58 +#define sctp_stcb_feature_on(inp, stcb, feature) {\ 1.59 + if (stcb) { \ 1.60 + stcb->asoc.sctp_features |= feature; \ 1.61 + } else if (inp) { \ 1.62 + inp->sctp_features |= feature; \ 1.63 + } \ 1.64 +} 1.65 +#define sctp_stcb_feature_off(inp, stcb, feature) {\ 1.66 + if (stcb) { \ 1.67 + stcb->asoc.sctp_features &= ~feature; \ 1.68 + } else if (inp) { \ 1.69 + inp->sctp_features &= ~feature; \ 1.70 + } \ 1.71 +} 1.72 +#define sctp_stcb_is_feature_on(inp, stcb, feature) \ 1.73 + (((stcb != NULL) && \ 1.74 + ((stcb->asoc.sctp_features & feature) == feature)) || \ 1.75 + ((stcb == NULL) && (inp != NULL) && \ 1.76 + ((inp->sctp_features & feature) == feature))) 1.77 +#define sctp_stcb_is_feature_off(inp, stcb, feature) \ 1.78 + (((stcb != NULL) && \ 1.79 + ((stcb->asoc.sctp_features & feature) == 0)) || \ 1.80 + ((stcb == NULL) && (inp != NULL) && \ 1.81 + ((inp->sctp_features & feature) == 0)) || \ 1.82 + ((stcb == NULL) && (inp == NULL))) 1.83 + 1.84 +/* managing mobility_feature in inpcb (by micchie) */ 1.85 +#define sctp_mobility_feature_on(inp, feature) (inp->sctp_mobility_features |= feature) 1.86 +#define sctp_mobility_feature_off(inp, feature) (inp->sctp_mobility_features &= ~feature) 1.87 +#define sctp_is_mobility_feature_on(inp, feature) (inp->sctp_mobility_features & feature) 1.88 +#define sctp_is_mobility_feature_off(inp, feature) ((inp->sctp_mobility_features & feature) == 0) 1.89 + 1.90 +#define sctp_maxspace(sb) (max((sb)->sb_hiwat,SCTP_MINIMAL_RWND)) 1.91 + 1.92 +#define sctp_sbspace(asoc, sb) ((long) ((sctp_maxspace(sb) > (asoc)->sb_cc) ? (sctp_maxspace(sb) - (asoc)->sb_cc) : 0)) 1.93 + 1.94 +#define sctp_sbspace_failedmsgs(sb) ((long) ((sctp_maxspace(sb) > (sb)->sb_cc) ? (sctp_maxspace(sb) - (sb)->sb_cc) : 0)) 1.95 + 1.96 +#define sctp_sbspace_sub(a,b) ((a > b) ? (a - b) : 0) 1.97 + 1.98 +/* 1.99 + * I tried to cache the readq entries at one point. But the reality 1.100 + * is that it did not add any performance since this meant we had to 1.101 + * lock the STCB on read. And at that point once you have to do an 1.102 + * extra lock, it really does not matter if the lock is in the ZONE 1.103 + * stuff or in our code. Note that this same problem would occur with 1.104 + * an mbuf cache as well so it is not really worth doing, at least 1.105 + * right now :-D 1.106 + */ 1.107 + 1.108 +#define sctp_free_a_readq(_stcb, _readq) { \ 1.109 + SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_readq), (_readq)); \ 1.110 + SCTP_DECR_READQ_COUNT(); \ 1.111 +} 1.112 + 1.113 +#define sctp_alloc_a_readq(_stcb, _readq) { \ 1.114 + (_readq) = SCTP_ZONE_GET(SCTP_BASE_INFO(ipi_zone_readq), struct sctp_queued_to_read); \ 1.115 + if ((_readq)) { \ 1.116 + SCTP_INCR_READQ_COUNT(); \ 1.117 + } \ 1.118 +} 1.119 + 1.120 +#define sctp_free_a_strmoq(_stcb, _strmoq, _so_locked) { \ 1.121 + if ((_strmoq)->holds_key_ref) { \ 1.122 + sctp_auth_key_release(stcb, sp->auth_keyid, _so_locked); \ 1.123 + (_strmoq)->holds_key_ref = 0; \ 1.124 + } \ 1.125 + SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_strmoq), (_strmoq)); \ 1.126 + SCTP_DECR_STRMOQ_COUNT(); \ 1.127 +} 1.128 + 1.129 +#define sctp_alloc_a_strmoq(_stcb, _strmoq) { \ 1.130 + (_strmoq) = SCTP_ZONE_GET(SCTP_BASE_INFO(ipi_zone_strmoq), struct sctp_stream_queue_pending); \ 1.131 + if ((_strmoq)) { \ 1.132 + memset(_strmoq, 0, sizeof(struct sctp_stream_queue_pending)); \ 1.133 + SCTP_INCR_STRMOQ_COUNT(); \ 1.134 + (_strmoq)->holds_key_ref = 0; \ 1.135 + } \ 1.136 +} 1.137 + 1.138 +#define sctp_free_a_chunk(_stcb, _chk, _so_locked) { \ 1.139 + if ((_chk)->holds_key_ref) {\ 1.140 + sctp_auth_key_release((_stcb), (_chk)->auth_keyid, _so_locked); \ 1.141 + (_chk)->holds_key_ref = 0; \ 1.142 + } \ 1.143 + if (_stcb) { \ 1.144 + SCTP_TCB_LOCK_ASSERT((_stcb)); \ 1.145 + if ((_chk)->whoTo) { \ 1.146 + sctp_free_remote_addr((_chk)->whoTo); \ 1.147 + (_chk)->whoTo = NULL; \ 1.148 + } \ 1.149 + if (((_stcb)->asoc.free_chunk_cnt > SCTP_BASE_SYSCTL(sctp_asoc_free_resc_limit)) || \ 1.150 + (SCTP_BASE_INFO(ipi_free_chunks) > SCTP_BASE_SYSCTL(sctp_system_free_resc_limit))) { \ 1.151 + SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_chunk), (_chk)); \ 1.152 + SCTP_DECR_CHK_COUNT(); \ 1.153 + } else { \ 1.154 + TAILQ_INSERT_TAIL(&(_stcb)->asoc.free_chunks, (_chk), sctp_next); \ 1.155 + (_stcb)->asoc.free_chunk_cnt++; \ 1.156 + atomic_add_int(&SCTP_BASE_INFO(ipi_free_chunks), 1); \ 1.157 + } \ 1.158 + } else { \ 1.159 + SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_chunk), (_chk)); \ 1.160 + SCTP_DECR_CHK_COUNT(); \ 1.161 + } \ 1.162 +} 1.163 + 1.164 +#define sctp_alloc_a_chunk(_stcb, _chk) { \ 1.165 + if (TAILQ_EMPTY(&(_stcb)->asoc.free_chunks)) { \ 1.166 + (_chk) = SCTP_ZONE_GET(SCTP_BASE_INFO(ipi_zone_chunk), struct sctp_tmit_chunk); \ 1.167 + if ((_chk)) { \ 1.168 + SCTP_INCR_CHK_COUNT(); \ 1.169 + (_chk)->whoTo = NULL; \ 1.170 + (_chk)->holds_key_ref = 0; \ 1.171 + } \ 1.172 + } else { \ 1.173 + (_chk) = TAILQ_FIRST(&(_stcb)->asoc.free_chunks); \ 1.174 + TAILQ_REMOVE(&(_stcb)->asoc.free_chunks, (_chk), sctp_next); \ 1.175 + atomic_subtract_int(&SCTP_BASE_INFO(ipi_free_chunks), 1); \ 1.176 + (_chk)->holds_key_ref = 0; \ 1.177 + SCTP_STAT_INCR(sctps_cached_chk); \ 1.178 + (_stcb)->asoc.free_chunk_cnt--; \ 1.179 + } \ 1.180 +} 1.181 + 1.182 +#if defined(__FreeBSD__) && __FreeBSD_version > 500000 1.183 + 1.184 +#define sctp_free_remote_addr(__net) { \ 1.185 + if ((__net)) { \ 1.186 + if (SCTP_DECREMENT_AND_CHECK_REFCOUNT(&(__net)->ref_count)) { \ 1.187 + (void)SCTP_OS_TIMER_STOP(&(__net)->rxt_timer.timer); \ 1.188 + (void)SCTP_OS_TIMER_STOP(&(__net)->pmtu_timer.timer); \ 1.189 + if ((__net)->ro.ro_rt) { \ 1.190 + RTFREE((__net)->ro.ro_rt); \ 1.191 + (__net)->ro.ro_rt = NULL; \ 1.192 + } \ 1.193 + if ((__net)->src_addr_selected) { \ 1.194 + sctp_free_ifa((__net)->ro._s_addr); \ 1.195 + (__net)->ro._s_addr = NULL; \ 1.196 + } \ 1.197 + (__net)->src_addr_selected = 0; \ 1.198 + (__net)->dest_state &= ~SCTP_ADDR_REACHABLE; \ 1.199 + SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_net), (__net)); \ 1.200 + SCTP_DECR_RADDR_COUNT(); \ 1.201 + } \ 1.202 + } \ 1.203 +} 1.204 + 1.205 +#define sctp_sbfree(ctl, stcb, sb, m) { \ 1.206 + SCTP_SAVE_ATOMIC_DECREMENT(&(sb)->sb_cc, SCTP_BUF_LEN((m))); \ 1.207 + SCTP_SAVE_ATOMIC_DECREMENT(&(sb)->sb_mbcnt, MSIZE); \ 1.208 + if (((ctl)->do_not_ref_stcb == 0) && stcb) {\ 1.209 + SCTP_SAVE_ATOMIC_DECREMENT(&(stcb)->asoc.sb_cc, SCTP_BUF_LEN((m))); \ 1.210 + SCTP_SAVE_ATOMIC_DECREMENT(&(stcb)->asoc.my_rwnd_control_len, MSIZE); \ 1.211 + } \ 1.212 + if (SCTP_BUF_TYPE(m) != MT_DATA && SCTP_BUF_TYPE(m) != MT_HEADER && \ 1.213 + SCTP_BUF_TYPE(m) != MT_OOBDATA) \ 1.214 + atomic_subtract_int(&(sb)->sb_ctl,SCTP_BUF_LEN((m))); \ 1.215 +} 1.216 + 1.217 +#define sctp_sballoc(stcb, sb, m) { \ 1.218 + atomic_add_int(&(sb)->sb_cc,SCTP_BUF_LEN((m))); \ 1.219 + atomic_add_int(&(sb)->sb_mbcnt, MSIZE); \ 1.220 + if (stcb) { \ 1.221 + atomic_add_int(&(stcb)->asoc.sb_cc,SCTP_BUF_LEN((m))); \ 1.222 + atomic_add_int(&(stcb)->asoc.my_rwnd_control_len, MSIZE); \ 1.223 + } \ 1.224 + if (SCTP_BUF_TYPE(m) != MT_DATA && SCTP_BUF_TYPE(m) != MT_HEADER && \ 1.225 + SCTP_BUF_TYPE(m) != MT_OOBDATA) \ 1.226 + atomic_add_int(&(sb)->sb_ctl,SCTP_BUF_LEN((m))); \ 1.227 +} 1.228 + 1.229 +#else /* FreeBSD Version <= 500000 or non-FreeBSD */ 1.230 + 1.231 +#define sctp_free_remote_addr(__net) { \ 1.232 + if ((__net)) { \ 1.233 + if (SCTP_DECREMENT_AND_CHECK_REFCOUNT(&(__net)->ref_count)) { \ 1.234 + (void)SCTP_OS_TIMER_STOP(&(__net)->rxt_timer.timer); \ 1.235 + (void)SCTP_OS_TIMER_STOP(&(__net)->pmtu_timer.timer); \ 1.236 + (void)SCTP_OS_TIMER_STOP(&(__net)->hb_timer.timer); \ 1.237 + if ((__net)->ro.ro_rt) { \ 1.238 + RTFREE((__net)->ro.ro_rt); \ 1.239 + (__net)->ro.ro_rt = NULL; \ 1.240 + } \ 1.241 + if ((__net)->src_addr_selected) { \ 1.242 + sctp_free_ifa((__net)->ro._s_addr); \ 1.243 + (__net)->ro._s_addr = NULL; \ 1.244 + } \ 1.245 + (__net)->src_addr_selected = 0; \ 1.246 + (__net)->dest_state &=~SCTP_ADDR_REACHABLE; \ 1.247 + SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_net), (__net)); \ 1.248 + SCTP_DECR_RADDR_COUNT(); \ 1.249 + } \ 1.250 + } \ 1.251 +} 1.252 + 1.253 +#if defined(__Panda__) 1.254 +#define sctp_sbfree(ctl, stcb, sb, m) { \ 1.255 + if ((sb)->sb_cc >= (uint32_t)SCTP_BUF_LEN((m))) { \ 1.256 + atomic_subtract_int(&(sb)->sb_cc, SCTP_BUF_LEN((m))); \ 1.257 + } else { \ 1.258 + (sb)->sb_cc = 0; \ 1.259 + } \ 1.260 + if (((ctl)->do_not_ref_stcb == 0) && stcb) { \ 1.261 + if ((stcb)->asoc.sb_cc >= (uint32_t)SCTP_BUF_LEN((m))) { \ 1.262 + atomic_subtract_int(&(stcb)->asoc.sb_cc, SCTP_BUF_LEN((m))); \ 1.263 + } else { \ 1.264 + (stcb)->asoc.sb_cc = 0; \ 1.265 + } \ 1.266 + } \ 1.267 +} 1.268 + 1.269 +#define sctp_sballoc(stcb, sb, m) { \ 1.270 + atomic_add_int(&(sb)->sb_cc, SCTP_BUF_LEN((m))); \ 1.271 + if (stcb) { \ 1.272 + atomic_add_int(&(stcb)->asoc.sb_cc, SCTP_BUF_LEN((m))); \ 1.273 + } \ 1.274 +} 1.275 + 1.276 +#else 1.277 + 1.278 +#define sctp_sbfree(ctl, stcb, sb, m) { \ 1.279 + SCTP_SAVE_ATOMIC_DECREMENT(&(sb)->sb_cc, SCTP_BUF_LEN((m))); \ 1.280 + SCTP_SAVE_ATOMIC_DECREMENT(&(sb)->sb_mbcnt, MSIZE); \ 1.281 + if (((ctl)->do_not_ref_stcb == 0) && stcb) { \ 1.282 + SCTP_SAVE_ATOMIC_DECREMENT(&(stcb)->asoc.sb_cc, SCTP_BUF_LEN((m))); \ 1.283 + SCTP_SAVE_ATOMIC_DECREMENT(&(stcb)->asoc.my_rwnd_control_len, MSIZE); \ 1.284 + } \ 1.285 +} 1.286 + 1.287 +#define sctp_sballoc(stcb, sb, m) { \ 1.288 + atomic_add_int(&(sb)->sb_cc, SCTP_BUF_LEN((m))); \ 1.289 + atomic_add_int(&(sb)->sb_mbcnt, MSIZE); \ 1.290 + if (stcb) { \ 1.291 + atomic_add_int(&(stcb)->asoc.sb_cc, SCTP_BUF_LEN((m))); \ 1.292 + atomic_add_int(&(stcb)->asoc.my_rwnd_control_len, MSIZE); \ 1.293 + } \ 1.294 +} 1.295 +#endif 1.296 +#endif 1.297 + 1.298 +#define sctp_ucount_incr(val) { \ 1.299 + val++; \ 1.300 +} 1.301 + 1.302 +#define sctp_ucount_decr(val) { \ 1.303 + if (val > 0) { \ 1.304 + val--; \ 1.305 + } else { \ 1.306 + val = 0; \ 1.307 + } \ 1.308 +} 1.309 + 1.310 +#define sctp_mbuf_crush(data) do { \ 1.311 + struct mbuf *_m; \ 1.312 + _m = (data); \ 1.313 + while (_m && (SCTP_BUF_LEN(_m) == 0)) { \ 1.314 + (data) = SCTP_BUF_NEXT(_m); \ 1.315 + SCTP_BUF_NEXT(_m) = NULL; \ 1.316 + sctp_m_free(_m); \ 1.317 + _m = (data); \ 1.318 + } \ 1.319 +} while (0) 1.320 + 1.321 +#define sctp_flight_size_decrease(tp1) do { \ 1.322 + if (tp1->whoTo->flight_size >= tp1->book_size) \ 1.323 + tp1->whoTo->flight_size -= tp1->book_size; \ 1.324 + else \ 1.325 + tp1->whoTo->flight_size = 0; \ 1.326 +} while (0) 1.327 + 1.328 +#define sctp_flight_size_increase(tp1) do { \ 1.329 + (tp1)->whoTo->flight_size += (tp1)->book_size; \ 1.330 +} while (0) 1.331 + 1.332 +#ifdef SCTP_FS_SPEC_LOG 1.333 +#define sctp_total_flight_decrease(stcb, tp1) do { \ 1.334 + if (stcb->asoc.fs_index > SCTP_FS_SPEC_LOG_SIZE) \ 1.335 + stcb->asoc.fs_index = 0;\ 1.336 + stcb->asoc.fslog[stcb->asoc.fs_index].total_flight = stcb->asoc.total_flight; \ 1.337 + stcb->asoc.fslog[stcb->asoc.fs_index].tsn = tp1->rec.data.TSN_seq; \ 1.338 + stcb->asoc.fslog[stcb->asoc.fs_index].book = tp1->book_size; \ 1.339 + stcb->asoc.fslog[stcb->asoc.fs_index].sent = tp1->sent; \ 1.340 + stcb->asoc.fslog[stcb->asoc.fs_index].incr = 0; \ 1.341 + stcb->asoc.fslog[stcb->asoc.fs_index].decr = 1; \ 1.342 + stcb->asoc.fs_index++; \ 1.343 + tp1->window_probe = 0; \ 1.344 + if (stcb->asoc.total_flight >= tp1->book_size) { \ 1.345 + stcb->asoc.total_flight -= tp1->book_size; \ 1.346 + if (stcb->asoc.total_flight_count > 0) \ 1.347 + stcb->asoc.total_flight_count--; \ 1.348 + } else { \ 1.349 + stcb->asoc.total_flight = 0; \ 1.350 + stcb->asoc.total_flight_count = 0; \ 1.351 + } \ 1.352 +} while (0) 1.353 + 1.354 +#define sctp_total_flight_increase(stcb, tp1) do { \ 1.355 + if (stcb->asoc.fs_index > SCTP_FS_SPEC_LOG_SIZE) \ 1.356 + stcb->asoc.fs_index = 0;\ 1.357 + stcb->asoc.fslog[stcb->asoc.fs_index].total_flight = stcb->asoc.total_flight; \ 1.358 + stcb->asoc.fslog[stcb->asoc.fs_index].tsn = tp1->rec.data.TSN_seq; \ 1.359 + stcb->asoc.fslog[stcb->asoc.fs_index].book = tp1->book_size; \ 1.360 + stcb->asoc.fslog[stcb->asoc.fs_index].sent = tp1->sent; \ 1.361 + stcb->asoc.fslog[stcb->asoc.fs_index].incr = 1; \ 1.362 + stcb->asoc.fslog[stcb->asoc.fs_index].decr = 0; \ 1.363 + stcb->asoc.fs_index++; \ 1.364 + (stcb)->asoc.total_flight_count++; \ 1.365 + (stcb)->asoc.total_flight += (tp1)->book_size; \ 1.366 +} while (0) 1.367 + 1.368 +#else 1.369 + 1.370 +#define sctp_total_flight_decrease(stcb, tp1) do { \ 1.371 + tp1->window_probe = 0; \ 1.372 + if (stcb->asoc.total_flight >= tp1->book_size) { \ 1.373 + stcb->asoc.total_flight -= tp1->book_size; \ 1.374 + if (stcb->asoc.total_flight_count > 0) \ 1.375 + stcb->asoc.total_flight_count--; \ 1.376 + } else { \ 1.377 + stcb->asoc.total_flight = 0; \ 1.378 + stcb->asoc.total_flight_count = 0; \ 1.379 + } \ 1.380 +} while (0) 1.381 + 1.382 +#define sctp_total_flight_increase(stcb, tp1) do { \ 1.383 + (stcb)->asoc.total_flight_count++; \ 1.384 + (stcb)->asoc.total_flight += (tp1)->book_size; \ 1.385 +} while (0) 1.386 + 1.387 +#endif 1.388 + 1.389 +#define SCTP_PF_ENABLED(_net) (_net->pf_threshold < _net->failure_threshold) 1.390 +#define SCTP_NET_IS_PF(_net) (_net->pf_threshold < _net->error_count) 1.391 + 1.392 +struct sctp_nets; 1.393 +struct sctp_inpcb; 1.394 +struct sctp_tcb; 1.395 +struct sctphdr; 1.396 + 1.397 + 1.398 +#if (defined(__FreeBSD__) && __FreeBSD_version > 690000) || defined(__Windows__) || defined(__Userspace__) 1.399 +void sctp_close(struct socket *so); 1.400 +#else 1.401 +int sctp_detach(struct socket *so); 1.402 +#endif 1.403 +int sctp_disconnect(struct socket *so); 1.404 +#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__Windows__) 1.405 +#if defined(__FreeBSD__) && __FreeBSD_version < 902000 1.406 +void sctp_ctlinput __P((int, struct sockaddr *, void *)); 1.407 +int sctp_ctloutput __P((struct socket *, struct sockopt *)); 1.408 +#ifdef INET 1.409 +void sctp_input_with_port __P((struct mbuf *, int, uint16_t)); 1.410 +void sctp_input __P((struct mbuf *, int)); 1.411 +#endif 1.412 +void sctp_pathmtu_adjustment __P((struct sctp_tcb *, uint16_t)); 1.413 +#else 1.414 +void sctp_ctlinput(int, struct sockaddr *, void *); 1.415 +int sctp_ctloutput(struct socket *, struct sockopt *); 1.416 +#ifdef INET 1.417 +void sctp_input_with_port(struct mbuf *, int, uint16_t); 1.418 +void sctp_input(struct mbuf *, int); 1.419 +#endif 1.420 +void sctp_pathmtu_adjustment(struct sctp_tcb *, uint16_t); 1.421 +#endif 1.422 +#else 1.423 +#if defined(__Panda__) 1.424 +void sctp_input(pakhandle_type i_pak); 1.425 +#elif defined(__Userspace__) 1.426 +void sctp_pathmtu_adjustment(struct sctp_tcb *, uint16_t); 1.427 +#else 1.428 +void sctp_input(struct mbuf *,...); 1.429 +#endif 1.430 +void *sctp_ctlinput(int, struct sockaddr *, void *); 1.431 +int sctp_ctloutput(int, struct socket *, int, int, struct mbuf **); 1.432 +#endif 1.433 +#if defined(__FreeBSD__) && __FreeBSD_version < 902000 1.434 +void sctp_drain __P((void)); 1.435 +#else 1.436 +void sctp_drain(void); 1.437 +#endif 1.438 +#if defined(__Userspace__) 1.439 +void sctp_init(uint16_t, 1.440 + int (*)(void *addr, void *buffer, size_t length, uint8_t tos, uint8_t set_df), 1.441 + void (*)(const char *, ...)); 1.442 +#elif defined(__FreeBSD__) && __FreeBSD_version < 902000 1.443 +void sctp_init __P((void)); 1.444 +#elif defined(__APPLE__) && (!defined(APPLE_LEOPARD) && !defined(APPLE_SNOWLEOPARD) &&!defined(APPLE_LION) && !defined(APPLE_MOUNTAINLION)) 1.445 +void sctp_init(struct protosw *pp, struct domain *dp); 1.446 +#else 1.447 +void sctp_init(void); 1.448 +#endif 1.449 +void sctp_finish(void); 1.450 +#if defined(__FreeBSD__) || defined(__Windows__) || defined(__Userspace__) 1.451 +int sctp_flush(struct socket *, int); 1.452 +#endif 1.453 +#if defined(__FreeBSD__) && __FreeBSD_version < 902000 1.454 +int sctp_shutdown __P((struct socket *)); 1.455 +void sctp_notify __P((struct sctp_inpcb *, struct ip *ip, struct sctphdr *, 1.456 + struct sockaddr *, struct sctp_tcb *, 1.457 + struct sctp_nets *)); 1.458 +#else 1.459 +int sctp_shutdown(struct socket *); 1.460 +void sctp_notify(struct sctp_inpcb *, struct ip *ip, struct sctphdr *, 1.461 + struct sockaddr *, struct sctp_tcb *, 1.462 + struct sctp_nets *); 1.463 +#endif 1.464 +int sctp_bindx(struct socket *, int, struct sockaddr_storage *, 1.465 + int, int, struct proc *); 1.466 +/* can't use sctp_assoc_t here */ 1.467 +int sctp_peeloff(struct socket *, struct socket *, int, caddr_t, int *); 1.468 +#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__Windows__) 1.469 +int sctp_ingetaddr(struct socket *, struct sockaddr **); 1.470 +#elif defined(__Panda__) 1.471 +int sctp_ingetaddr(struct socket *, struct sockaddr *); 1.472 +#else 1.473 +int sctp_ingetaddr(struct socket *, struct mbuf *); 1.474 +#endif 1.475 +#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__Windows__) 1.476 +int sctp_peeraddr(struct socket *, struct sockaddr **); 1.477 +#elif defined(__Panda__) 1.478 +int sctp_peeraddr(struct socket *, struct sockaddr *); 1.479 +#else 1.480 +int sctp_peeraddr(struct socket *, struct mbuf *); 1.481 +#endif 1.482 +#if defined(__FreeBSD__) && __FreeBSD_version >= 500000 1.483 +#if __FreeBSD_version >= 700000 1.484 +int sctp_listen(struct socket *, int, struct thread *); 1.485 +#else 1.486 +int sctp_listen(struct socket *, struct thread *); 1.487 +#endif 1.488 +#elif defined(__Windows__) 1.489 +int sctp_listen(struct socket *, int, PKTHREAD); 1.490 +#elif defined(__Userspace__) 1.491 +int sctp_listen(struct socket *, int, struct proc *); 1.492 +#else 1.493 +int sctp_listen(struct socket *, struct proc *); 1.494 +#endif 1.495 +#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__Windows__) || defined(__Userspace__) 1.496 +int sctp_accept(struct socket *, struct sockaddr **); 1.497 +#elif defined(__Panda__) 1.498 +int sctp_accept(struct socket *, struct sockaddr *, int *, void *, int *); 1.499 +#else 1.500 +int sctp_accept(struct socket *, struct mbuf *); 1.501 +#endif 1.502 + 1.503 +#endif /* _KERNEL */ 1.504 + 1.505 +#endif /* !_NETINET_SCTP_VAR_H_ */