michael@0: /*- michael@0: * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. michael@0: * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. michael@0: * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. michael@0: * michael@0: * Redistribution and use in source and binary forms, with or without michael@0: * modification, are permitted provided that the following conditions are met: michael@0: * michael@0: * a) Redistributions of source code must retain the above copyright notice, michael@0: * this list of conditions and the following disclaimer. michael@0: * michael@0: * b) Redistributions in binary form must reproduce the above copyright michael@0: * notice, this list of conditions and the following disclaimer in michael@0: * the documentation and/or other materials provided with the distribution. michael@0: * michael@0: * c) Neither the name of Cisco Systems, Inc. nor the names of its michael@0: * contributors may be used to endorse or promote products derived michael@0: * from this software without specific prior written permission. michael@0: * michael@0: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS michael@0: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, michael@0: * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE michael@0: * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE michael@0: * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR michael@0: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF michael@0: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS michael@0: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN michael@0: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) michael@0: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF michael@0: * THE POSSIBILITY OF SUCH DAMAGE. michael@0: */ michael@0: michael@0: #ifdef __FreeBSD__ michael@0: #include michael@0: __FBSDID("$FreeBSD: head/sys/netinet/sctp_var.h 242327 2012-10-29 20:47:32Z tuexen $"); michael@0: #endif michael@0: michael@0: #ifndef _NETINET_SCTP_VAR_H_ michael@0: #define _NETINET_SCTP_VAR_H_ michael@0: michael@0: #include michael@0: michael@0: #if defined(_KERNEL) || defined(__Userspace__) michael@0: michael@0: #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__Windows__) michael@0: extern struct pr_usrreqs sctp_usrreqs; michael@0: #endif michael@0: michael@0: michael@0: #define sctp_feature_on(inp, feature) (inp->sctp_features |= feature) michael@0: #define sctp_feature_off(inp, feature) (inp->sctp_features &= ~feature) michael@0: #define sctp_is_feature_on(inp, feature) ((inp->sctp_features & feature) == feature) michael@0: #define sctp_is_feature_off(inp, feature) ((inp->sctp_features & feature) == 0) michael@0: michael@0: #define sctp_stcb_feature_on(inp, stcb, feature) {\ michael@0: if (stcb) { \ michael@0: stcb->asoc.sctp_features |= feature; \ michael@0: } else if (inp) { \ michael@0: inp->sctp_features |= feature; \ michael@0: } \ michael@0: } michael@0: #define sctp_stcb_feature_off(inp, stcb, feature) {\ michael@0: if (stcb) { \ michael@0: stcb->asoc.sctp_features &= ~feature; \ michael@0: } else if (inp) { \ michael@0: inp->sctp_features &= ~feature; \ michael@0: } \ michael@0: } michael@0: #define sctp_stcb_is_feature_on(inp, stcb, feature) \ michael@0: (((stcb != NULL) && \ michael@0: ((stcb->asoc.sctp_features & feature) == feature)) || \ michael@0: ((stcb == NULL) && (inp != NULL) && \ michael@0: ((inp->sctp_features & feature) == feature))) michael@0: #define sctp_stcb_is_feature_off(inp, stcb, feature) \ michael@0: (((stcb != NULL) && \ michael@0: ((stcb->asoc.sctp_features & feature) == 0)) || \ michael@0: ((stcb == NULL) && (inp != NULL) && \ michael@0: ((inp->sctp_features & feature) == 0)) || \ michael@0: ((stcb == NULL) && (inp == NULL))) michael@0: michael@0: /* managing mobility_feature in inpcb (by micchie) */ michael@0: #define sctp_mobility_feature_on(inp, feature) (inp->sctp_mobility_features |= feature) michael@0: #define sctp_mobility_feature_off(inp, feature) (inp->sctp_mobility_features &= ~feature) michael@0: #define sctp_is_mobility_feature_on(inp, feature) (inp->sctp_mobility_features & feature) michael@0: #define sctp_is_mobility_feature_off(inp, feature) ((inp->sctp_mobility_features & feature) == 0) michael@0: michael@0: #define sctp_maxspace(sb) (max((sb)->sb_hiwat,SCTP_MINIMAL_RWND)) michael@0: michael@0: #define sctp_sbspace(asoc, sb) ((long) ((sctp_maxspace(sb) > (asoc)->sb_cc) ? (sctp_maxspace(sb) - (asoc)->sb_cc) : 0)) michael@0: michael@0: #define sctp_sbspace_failedmsgs(sb) ((long) ((sctp_maxspace(sb) > (sb)->sb_cc) ? (sctp_maxspace(sb) - (sb)->sb_cc) : 0)) michael@0: michael@0: #define sctp_sbspace_sub(a,b) ((a > b) ? (a - b) : 0) michael@0: michael@0: /* michael@0: * I tried to cache the readq entries at one point. But the reality michael@0: * is that it did not add any performance since this meant we had to michael@0: * lock the STCB on read. And at that point once you have to do an michael@0: * extra lock, it really does not matter if the lock is in the ZONE michael@0: * stuff or in our code. Note that this same problem would occur with michael@0: * an mbuf cache as well so it is not really worth doing, at least michael@0: * right now :-D michael@0: */ michael@0: michael@0: #define sctp_free_a_readq(_stcb, _readq) { \ michael@0: SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_readq), (_readq)); \ michael@0: SCTP_DECR_READQ_COUNT(); \ michael@0: } michael@0: michael@0: #define sctp_alloc_a_readq(_stcb, _readq) { \ michael@0: (_readq) = SCTP_ZONE_GET(SCTP_BASE_INFO(ipi_zone_readq), struct sctp_queued_to_read); \ michael@0: if ((_readq)) { \ michael@0: SCTP_INCR_READQ_COUNT(); \ michael@0: } \ michael@0: } michael@0: michael@0: #define sctp_free_a_strmoq(_stcb, _strmoq, _so_locked) { \ michael@0: if ((_strmoq)->holds_key_ref) { \ michael@0: sctp_auth_key_release(stcb, sp->auth_keyid, _so_locked); \ michael@0: (_strmoq)->holds_key_ref = 0; \ michael@0: } \ michael@0: SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_strmoq), (_strmoq)); \ michael@0: SCTP_DECR_STRMOQ_COUNT(); \ michael@0: } michael@0: michael@0: #define sctp_alloc_a_strmoq(_stcb, _strmoq) { \ michael@0: (_strmoq) = SCTP_ZONE_GET(SCTP_BASE_INFO(ipi_zone_strmoq), struct sctp_stream_queue_pending); \ michael@0: if ((_strmoq)) { \ michael@0: memset(_strmoq, 0, sizeof(struct sctp_stream_queue_pending)); \ michael@0: SCTP_INCR_STRMOQ_COUNT(); \ michael@0: (_strmoq)->holds_key_ref = 0; \ michael@0: } \ michael@0: } michael@0: michael@0: #define sctp_free_a_chunk(_stcb, _chk, _so_locked) { \ michael@0: if ((_chk)->holds_key_ref) {\ michael@0: sctp_auth_key_release((_stcb), (_chk)->auth_keyid, _so_locked); \ michael@0: (_chk)->holds_key_ref = 0; \ michael@0: } \ michael@0: if (_stcb) { \ michael@0: SCTP_TCB_LOCK_ASSERT((_stcb)); \ michael@0: if ((_chk)->whoTo) { \ michael@0: sctp_free_remote_addr((_chk)->whoTo); \ michael@0: (_chk)->whoTo = NULL; \ michael@0: } \ michael@0: if (((_stcb)->asoc.free_chunk_cnt > SCTP_BASE_SYSCTL(sctp_asoc_free_resc_limit)) || \ michael@0: (SCTP_BASE_INFO(ipi_free_chunks) > SCTP_BASE_SYSCTL(sctp_system_free_resc_limit))) { \ michael@0: SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_chunk), (_chk)); \ michael@0: SCTP_DECR_CHK_COUNT(); \ michael@0: } else { \ michael@0: TAILQ_INSERT_TAIL(&(_stcb)->asoc.free_chunks, (_chk), sctp_next); \ michael@0: (_stcb)->asoc.free_chunk_cnt++; \ michael@0: atomic_add_int(&SCTP_BASE_INFO(ipi_free_chunks), 1); \ michael@0: } \ michael@0: } else { \ michael@0: SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_chunk), (_chk)); \ michael@0: SCTP_DECR_CHK_COUNT(); \ michael@0: } \ michael@0: } michael@0: michael@0: #define sctp_alloc_a_chunk(_stcb, _chk) { \ michael@0: if (TAILQ_EMPTY(&(_stcb)->asoc.free_chunks)) { \ michael@0: (_chk) = SCTP_ZONE_GET(SCTP_BASE_INFO(ipi_zone_chunk), struct sctp_tmit_chunk); \ michael@0: if ((_chk)) { \ michael@0: SCTP_INCR_CHK_COUNT(); \ michael@0: (_chk)->whoTo = NULL; \ michael@0: (_chk)->holds_key_ref = 0; \ michael@0: } \ michael@0: } else { \ michael@0: (_chk) = TAILQ_FIRST(&(_stcb)->asoc.free_chunks); \ michael@0: TAILQ_REMOVE(&(_stcb)->asoc.free_chunks, (_chk), sctp_next); \ michael@0: atomic_subtract_int(&SCTP_BASE_INFO(ipi_free_chunks), 1); \ michael@0: (_chk)->holds_key_ref = 0; \ michael@0: SCTP_STAT_INCR(sctps_cached_chk); \ michael@0: (_stcb)->asoc.free_chunk_cnt--; \ michael@0: } \ michael@0: } michael@0: michael@0: #if defined(__FreeBSD__) && __FreeBSD_version > 500000 michael@0: michael@0: #define sctp_free_remote_addr(__net) { \ michael@0: if ((__net)) { \ michael@0: if (SCTP_DECREMENT_AND_CHECK_REFCOUNT(&(__net)->ref_count)) { \ michael@0: (void)SCTP_OS_TIMER_STOP(&(__net)->rxt_timer.timer); \ michael@0: (void)SCTP_OS_TIMER_STOP(&(__net)->pmtu_timer.timer); \ michael@0: if ((__net)->ro.ro_rt) { \ michael@0: RTFREE((__net)->ro.ro_rt); \ michael@0: (__net)->ro.ro_rt = NULL; \ michael@0: } \ michael@0: if ((__net)->src_addr_selected) { \ michael@0: sctp_free_ifa((__net)->ro._s_addr); \ michael@0: (__net)->ro._s_addr = NULL; \ michael@0: } \ michael@0: (__net)->src_addr_selected = 0; \ michael@0: (__net)->dest_state &= ~SCTP_ADDR_REACHABLE; \ michael@0: SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_net), (__net)); \ michael@0: SCTP_DECR_RADDR_COUNT(); \ michael@0: } \ michael@0: } \ michael@0: } michael@0: michael@0: #define sctp_sbfree(ctl, stcb, sb, m) { \ michael@0: SCTP_SAVE_ATOMIC_DECREMENT(&(sb)->sb_cc, SCTP_BUF_LEN((m))); \ michael@0: SCTP_SAVE_ATOMIC_DECREMENT(&(sb)->sb_mbcnt, MSIZE); \ michael@0: if (((ctl)->do_not_ref_stcb == 0) && stcb) {\ michael@0: SCTP_SAVE_ATOMIC_DECREMENT(&(stcb)->asoc.sb_cc, SCTP_BUF_LEN((m))); \ michael@0: SCTP_SAVE_ATOMIC_DECREMENT(&(stcb)->asoc.my_rwnd_control_len, MSIZE); \ michael@0: } \ michael@0: if (SCTP_BUF_TYPE(m) != MT_DATA && SCTP_BUF_TYPE(m) != MT_HEADER && \ michael@0: SCTP_BUF_TYPE(m) != MT_OOBDATA) \ michael@0: atomic_subtract_int(&(sb)->sb_ctl,SCTP_BUF_LEN((m))); \ michael@0: } michael@0: michael@0: #define sctp_sballoc(stcb, sb, m) { \ michael@0: atomic_add_int(&(sb)->sb_cc,SCTP_BUF_LEN((m))); \ michael@0: atomic_add_int(&(sb)->sb_mbcnt, MSIZE); \ michael@0: if (stcb) { \ michael@0: atomic_add_int(&(stcb)->asoc.sb_cc,SCTP_BUF_LEN((m))); \ michael@0: atomic_add_int(&(stcb)->asoc.my_rwnd_control_len, MSIZE); \ michael@0: } \ michael@0: if (SCTP_BUF_TYPE(m) != MT_DATA && SCTP_BUF_TYPE(m) != MT_HEADER && \ michael@0: SCTP_BUF_TYPE(m) != MT_OOBDATA) \ michael@0: atomic_add_int(&(sb)->sb_ctl,SCTP_BUF_LEN((m))); \ michael@0: } michael@0: michael@0: #else /* FreeBSD Version <= 500000 or non-FreeBSD */ michael@0: michael@0: #define sctp_free_remote_addr(__net) { \ michael@0: if ((__net)) { \ michael@0: if (SCTP_DECREMENT_AND_CHECK_REFCOUNT(&(__net)->ref_count)) { \ michael@0: (void)SCTP_OS_TIMER_STOP(&(__net)->rxt_timer.timer); \ michael@0: (void)SCTP_OS_TIMER_STOP(&(__net)->pmtu_timer.timer); \ michael@0: (void)SCTP_OS_TIMER_STOP(&(__net)->hb_timer.timer); \ michael@0: if ((__net)->ro.ro_rt) { \ michael@0: RTFREE((__net)->ro.ro_rt); \ michael@0: (__net)->ro.ro_rt = NULL; \ michael@0: } \ michael@0: if ((__net)->src_addr_selected) { \ michael@0: sctp_free_ifa((__net)->ro._s_addr); \ michael@0: (__net)->ro._s_addr = NULL; \ michael@0: } \ michael@0: (__net)->src_addr_selected = 0; \ michael@0: (__net)->dest_state &=~SCTP_ADDR_REACHABLE; \ michael@0: SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_net), (__net)); \ michael@0: SCTP_DECR_RADDR_COUNT(); \ michael@0: } \ michael@0: } \ michael@0: } michael@0: michael@0: #if defined(__Panda__) michael@0: #define sctp_sbfree(ctl, stcb, sb, m) { \ michael@0: if ((sb)->sb_cc >= (uint32_t)SCTP_BUF_LEN((m))) { \ michael@0: atomic_subtract_int(&(sb)->sb_cc, SCTP_BUF_LEN((m))); \ michael@0: } else { \ michael@0: (sb)->sb_cc = 0; \ michael@0: } \ michael@0: if (((ctl)->do_not_ref_stcb == 0) && stcb) { \ michael@0: if ((stcb)->asoc.sb_cc >= (uint32_t)SCTP_BUF_LEN((m))) { \ michael@0: atomic_subtract_int(&(stcb)->asoc.sb_cc, SCTP_BUF_LEN((m))); \ michael@0: } else { \ michael@0: (stcb)->asoc.sb_cc = 0; \ michael@0: } \ michael@0: } \ michael@0: } michael@0: michael@0: #define sctp_sballoc(stcb, sb, m) { \ michael@0: atomic_add_int(&(sb)->sb_cc, SCTP_BUF_LEN((m))); \ michael@0: if (stcb) { \ michael@0: atomic_add_int(&(stcb)->asoc.sb_cc, SCTP_BUF_LEN((m))); \ michael@0: } \ michael@0: } michael@0: michael@0: #else michael@0: michael@0: #define sctp_sbfree(ctl, stcb, sb, m) { \ michael@0: SCTP_SAVE_ATOMIC_DECREMENT(&(sb)->sb_cc, SCTP_BUF_LEN((m))); \ michael@0: SCTP_SAVE_ATOMIC_DECREMENT(&(sb)->sb_mbcnt, MSIZE); \ michael@0: if (((ctl)->do_not_ref_stcb == 0) && stcb) { \ michael@0: SCTP_SAVE_ATOMIC_DECREMENT(&(stcb)->asoc.sb_cc, SCTP_BUF_LEN((m))); \ michael@0: SCTP_SAVE_ATOMIC_DECREMENT(&(stcb)->asoc.my_rwnd_control_len, MSIZE); \ michael@0: } \ michael@0: } michael@0: michael@0: #define sctp_sballoc(stcb, sb, m) { \ michael@0: atomic_add_int(&(sb)->sb_cc, SCTP_BUF_LEN((m))); \ michael@0: atomic_add_int(&(sb)->sb_mbcnt, MSIZE); \ michael@0: if (stcb) { \ michael@0: atomic_add_int(&(stcb)->asoc.sb_cc, SCTP_BUF_LEN((m))); \ michael@0: atomic_add_int(&(stcb)->asoc.my_rwnd_control_len, MSIZE); \ michael@0: } \ michael@0: } michael@0: #endif michael@0: #endif michael@0: michael@0: #define sctp_ucount_incr(val) { \ michael@0: val++; \ michael@0: } michael@0: michael@0: #define sctp_ucount_decr(val) { \ michael@0: if (val > 0) { \ michael@0: val--; \ michael@0: } else { \ michael@0: val = 0; \ michael@0: } \ michael@0: } michael@0: michael@0: #define sctp_mbuf_crush(data) do { \ michael@0: struct mbuf *_m; \ michael@0: _m = (data); \ michael@0: while (_m && (SCTP_BUF_LEN(_m) == 0)) { \ michael@0: (data) = SCTP_BUF_NEXT(_m); \ michael@0: SCTP_BUF_NEXT(_m) = NULL; \ michael@0: sctp_m_free(_m); \ michael@0: _m = (data); \ michael@0: } \ michael@0: } while (0) michael@0: michael@0: #define sctp_flight_size_decrease(tp1) do { \ michael@0: if (tp1->whoTo->flight_size >= tp1->book_size) \ michael@0: tp1->whoTo->flight_size -= tp1->book_size; \ michael@0: else \ michael@0: tp1->whoTo->flight_size = 0; \ michael@0: } while (0) michael@0: michael@0: #define sctp_flight_size_increase(tp1) do { \ michael@0: (tp1)->whoTo->flight_size += (tp1)->book_size; \ michael@0: } while (0) michael@0: michael@0: #ifdef SCTP_FS_SPEC_LOG michael@0: #define sctp_total_flight_decrease(stcb, tp1) do { \ michael@0: if (stcb->asoc.fs_index > SCTP_FS_SPEC_LOG_SIZE) \ michael@0: stcb->asoc.fs_index = 0;\ michael@0: stcb->asoc.fslog[stcb->asoc.fs_index].total_flight = stcb->asoc.total_flight; \ michael@0: stcb->asoc.fslog[stcb->asoc.fs_index].tsn = tp1->rec.data.TSN_seq; \ michael@0: stcb->asoc.fslog[stcb->asoc.fs_index].book = tp1->book_size; \ michael@0: stcb->asoc.fslog[stcb->asoc.fs_index].sent = tp1->sent; \ michael@0: stcb->asoc.fslog[stcb->asoc.fs_index].incr = 0; \ michael@0: stcb->asoc.fslog[stcb->asoc.fs_index].decr = 1; \ michael@0: stcb->asoc.fs_index++; \ michael@0: tp1->window_probe = 0; \ michael@0: if (stcb->asoc.total_flight >= tp1->book_size) { \ michael@0: stcb->asoc.total_flight -= tp1->book_size; \ michael@0: if (stcb->asoc.total_flight_count > 0) \ michael@0: stcb->asoc.total_flight_count--; \ michael@0: } else { \ michael@0: stcb->asoc.total_flight = 0; \ michael@0: stcb->asoc.total_flight_count = 0; \ michael@0: } \ michael@0: } while (0) michael@0: michael@0: #define sctp_total_flight_increase(stcb, tp1) do { \ michael@0: if (stcb->asoc.fs_index > SCTP_FS_SPEC_LOG_SIZE) \ michael@0: stcb->asoc.fs_index = 0;\ michael@0: stcb->asoc.fslog[stcb->asoc.fs_index].total_flight = stcb->asoc.total_flight; \ michael@0: stcb->asoc.fslog[stcb->asoc.fs_index].tsn = tp1->rec.data.TSN_seq; \ michael@0: stcb->asoc.fslog[stcb->asoc.fs_index].book = tp1->book_size; \ michael@0: stcb->asoc.fslog[stcb->asoc.fs_index].sent = tp1->sent; \ michael@0: stcb->asoc.fslog[stcb->asoc.fs_index].incr = 1; \ michael@0: stcb->asoc.fslog[stcb->asoc.fs_index].decr = 0; \ michael@0: stcb->asoc.fs_index++; \ michael@0: (stcb)->asoc.total_flight_count++; \ michael@0: (stcb)->asoc.total_flight += (tp1)->book_size; \ michael@0: } while (0) michael@0: michael@0: #else michael@0: michael@0: #define sctp_total_flight_decrease(stcb, tp1) do { \ michael@0: tp1->window_probe = 0; \ michael@0: if (stcb->asoc.total_flight >= tp1->book_size) { \ michael@0: stcb->asoc.total_flight -= tp1->book_size; \ michael@0: if (stcb->asoc.total_flight_count > 0) \ michael@0: stcb->asoc.total_flight_count--; \ michael@0: } else { \ michael@0: stcb->asoc.total_flight = 0; \ michael@0: stcb->asoc.total_flight_count = 0; \ michael@0: } \ michael@0: } while (0) michael@0: michael@0: #define sctp_total_flight_increase(stcb, tp1) do { \ michael@0: (stcb)->asoc.total_flight_count++; \ michael@0: (stcb)->asoc.total_flight += (tp1)->book_size; \ michael@0: } while (0) michael@0: michael@0: #endif michael@0: michael@0: #define SCTP_PF_ENABLED(_net) (_net->pf_threshold < _net->failure_threshold) michael@0: #define SCTP_NET_IS_PF(_net) (_net->pf_threshold < _net->error_count) michael@0: michael@0: struct sctp_nets; michael@0: struct sctp_inpcb; michael@0: struct sctp_tcb; michael@0: struct sctphdr; michael@0: michael@0: michael@0: #if (defined(__FreeBSD__) && __FreeBSD_version > 690000) || defined(__Windows__) || defined(__Userspace__) michael@0: void sctp_close(struct socket *so); michael@0: #else michael@0: int sctp_detach(struct socket *so); michael@0: #endif michael@0: int sctp_disconnect(struct socket *so); michael@0: #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__Windows__) michael@0: #if defined(__FreeBSD__) && __FreeBSD_version < 902000 michael@0: void sctp_ctlinput __P((int, struct sockaddr *, void *)); michael@0: int sctp_ctloutput __P((struct socket *, struct sockopt *)); michael@0: #ifdef INET michael@0: void sctp_input_with_port __P((struct mbuf *, int, uint16_t)); michael@0: void sctp_input __P((struct mbuf *, int)); michael@0: #endif michael@0: void sctp_pathmtu_adjustment __P((struct sctp_tcb *, uint16_t)); michael@0: #else michael@0: void sctp_ctlinput(int, struct sockaddr *, void *); michael@0: int sctp_ctloutput(struct socket *, struct sockopt *); michael@0: #ifdef INET michael@0: void sctp_input_with_port(struct mbuf *, int, uint16_t); michael@0: void sctp_input(struct mbuf *, int); michael@0: #endif michael@0: void sctp_pathmtu_adjustment(struct sctp_tcb *, uint16_t); michael@0: #endif michael@0: #else michael@0: #if defined(__Panda__) michael@0: void sctp_input(pakhandle_type i_pak); michael@0: #elif defined(__Userspace__) michael@0: void sctp_pathmtu_adjustment(struct sctp_tcb *, uint16_t); michael@0: #else michael@0: void sctp_input(struct mbuf *,...); michael@0: #endif michael@0: void *sctp_ctlinput(int, struct sockaddr *, void *); michael@0: int sctp_ctloutput(int, struct socket *, int, int, struct mbuf **); michael@0: #endif michael@0: #if defined(__FreeBSD__) && __FreeBSD_version < 902000 michael@0: void sctp_drain __P((void)); michael@0: #else michael@0: void sctp_drain(void); michael@0: #endif michael@0: #if defined(__Userspace__) michael@0: void sctp_init(uint16_t, michael@0: int (*)(void *addr, void *buffer, size_t length, uint8_t tos, uint8_t set_df), michael@0: void (*)(const char *, ...)); michael@0: #elif defined(__FreeBSD__) && __FreeBSD_version < 902000 michael@0: void sctp_init __P((void)); michael@0: #elif defined(__APPLE__) && (!defined(APPLE_LEOPARD) && !defined(APPLE_SNOWLEOPARD) &&!defined(APPLE_LION) && !defined(APPLE_MOUNTAINLION)) michael@0: void sctp_init(struct protosw *pp, struct domain *dp); michael@0: #else michael@0: void sctp_init(void); michael@0: #endif michael@0: void sctp_finish(void); michael@0: #if defined(__FreeBSD__) || defined(__Windows__) || defined(__Userspace__) michael@0: int sctp_flush(struct socket *, int); michael@0: #endif michael@0: #if defined(__FreeBSD__) && __FreeBSD_version < 902000 michael@0: int sctp_shutdown __P((struct socket *)); michael@0: void sctp_notify __P((struct sctp_inpcb *, struct ip *ip, struct sctphdr *, michael@0: struct sockaddr *, struct sctp_tcb *, michael@0: struct sctp_nets *)); michael@0: #else michael@0: int sctp_shutdown(struct socket *); michael@0: void sctp_notify(struct sctp_inpcb *, struct ip *ip, struct sctphdr *, michael@0: struct sockaddr *, struct sctp_tcb *, michael@0: struct sctp_nets *); michael@0: #endif michael@0: int sctp_bindx(struct socket *, int, struct sockaddr_storage *, michael@0: int, int, struct proc *); michael@0: /* can't use sctp_assoc_t here */ michael@0: int sctp_peeloff(struct socket *, struct socket *, int, caddr_t, int *); michael@0: #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__Windows__) michael@0: int sctp_ingetaddr(struct socket *, struct sockaddr **); michael@0: #elif defined(__Panda__) michael@0: int sctp_ingetaddr(struct socket *, struct sockaddr *); michael@0: #else michael@0: int sctp_ingetaddr(struct socket *, struct mbuf *); michael@0: #endif michael@0: #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__Windows__) michael@0: int sctp_peeraddr(struct socket *, struct sockaddr **); michael@0: #elif defined(__Panda__) michael@0: int sctp_peeraddr(struct socket *, struct sockaddr *); michael@0: #else michael@0: int sctp_peeraddr(struct socket *, struct mbuf *); michael@0: #endif michael@0: #if defined(__FreeBSD__) && __FreeBSD_version >= 500000 michael@0: #if __FreeBSD_version >= 700000 michael@0: int sctp_listen(struct socket *, int, struct thread *); michael@0: #else michael@0: int sctp_listen(struct socket *, struct thread *); michael@0: #endif michael@0: #elif defined(__Windows__) michael@0: int sctp_listen(struct socket *, int, PKTHREAD); michael@0: #elif defined(__Userspace__) michael@0: int sctp_listen(struct socket *, int, struct proc *); michael@0: #else michael@0: int sctp_listen(struct socket *, struct proc *); michael@0: #endif michael@0: #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__Windows__) || defined(__Userspace__) michael@0: int sctp_accept(struct socket *, struct sockaddr **); michael@0: #elif defined(__Panda__) michael@0: int sctp_accept(struct socket *, struct sockaddr *, int *, void *, int *); michael@0: #else michael@0: int sctp_accept(struct socket *, struct mbuf *); michael@0: #endif michael@0: michael@0: #endif /* _KERNEL */ michael@0: michael@0: #endif /* !_NETINET_SCTP_VAR_H_ */