michael@0: /*- michael@0: * Copyright (c) 2001-2007, 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_uio.h 255160 2013-09-02 22:48:41Z tuexen $"); michael@0: #endif michael@0: michael@0: #ifndef _NETINET_SCTP_UIO_H_ michael@0: #define _NETINET_SCTP_UIO_H_ michael@0: michael@0: #if (defined(__APPLE__) && defined(KERNEL)) michael@0: #ifndef _KERNEL michael@0: #define _KERNEL michael@0: #endif michael@0: #endif michael@0: michael@0: #if !(defined(__Windows__)) && !defined(__Userspace_os_Windows) michael@0: #if ! defined(_KERNEL) michael@0: #include michael@0: #endif michael@0: #include michael@0: #include michael@0: #include michael@0: #endif michael@0: #if defined(__Windows__) michael@0: #pragma warning(push) michael@0: #pragma warning(disable: 4200) michael@0: #if defined(_KERNEL) michael@0: #include michael@0: #include michael@0: #include michael@0: #endif michael@0: #endif michael@0: michael@0: typedef uint32_t sctp_assoc_t; michael@0: michael@0: #define SCTP_FUTURE_ASSOC 0 michael@0: #define SCTP_CURRENT_ASSOC 1 michael@0: #define SCTP_ALL_ASSOC 2 michael@0: michael@0: struct sctp_event { michael@0: sctp_assoc_t se_assoc_id; michael@0: uint16_t se_type; michael@0: uint8_t se_on; michael@0: }; michael@0: michael@0: /* Compatibility to previous define's */ michael@0: #define sctp_stream_reset_events sctp_stream_reset_event michael@0: michael@0: /* On/Off setup for subscription to events */ michael@0: struct sctp_event_subscribe { michael@0: uint8_t sctp_data_io_event; michael@0: uint8_t sctp_association_event; michael@0: uint8_t sctp_address_event; michael@0: uint8_t sctp_send_failure_event; michael@0: uint8_t sctp_peer_error_event; michael@0: uint8_t sctp_shutdown_event; michael@0: uint8_t sctp_partial_delivery_event; michael@0: uint8_t sctp_adaptation_layer_event; michael@0: uint8_t sctp_authentication_event; michael@0: uint8_t sctp_sender_dry_event; michael@0: uint8_t sctp_stream_reset_event; michael@0: }; michael@0: michael@0: /* ancillary data types */ michael@0: #define SCTP_INIT 0x0001 michael@0: #define SCTP_SNDRCV 0x0002 michael@0: #define SCTP_EXTRCV 0x0003 michael@0: #define SCTP_SNDINFO 0x0004 michael@0: #define SCTP_RCVINFO 0x0005 michael@0: #define SCTP_NXTINFO 0x0006 michael@0: #define SCTP_PRINFO 0x0007 michael@0: #define SCTP_AUTHINFO 0x0008 michael@0: #define SCTP_DSTADDRV4 0x0009 michael@0: #define SCTP_DSTADDRV6 0x000a michael@0: michael@0: /* michael@0: * ancillary data structures michael@0: */ michael@0: struct sctp_initmsg { michael@0: #if defined(__FreeBSD__) && __FreeBSD_version < 800000 michael@0: /* This is a bug. Not fixed for ABI compatibility */ michael@0: uint32_t sinit_num_ostreams; michael@0: uint32_t sinit_max_instreams; michael@0: #else michael@0: uint16_t sinit_num_ostreams; michael@0: uint16_t sinit_max_instreams; michael@0: #endif michael@0: uint16_t sinit_max_attempts; michael@0: uint16_t sinit_max_init_timeo; michael@0: }; michael@0: michael@0: /* We add 96 bytes to the size of sctp_sndrcvinfo. michael@0: * This makes the current structure 128 bytes long michael@0: * which is nicely 64 bit aligned but also has room michael@0: * for us to add more and keep ABI compatibility. michael@0: * For example, already we have the sctp_extrcvinfo michael@0: * when enabled which is 48 bytes. michael@0: */ michael@0: michael@0: /* michael@0: * The assoc up needs a verfid michael@0: * all sendrcvinfo's need a verfid for SENDING only. michael@0: */ michael@0: michael@0: michael@0: #define SCTP_ALIGN_RESV_PAD 92 michael@0: #define SCTP_ALIGN_RESV_PAD_SHORT 76 michael@0: michael@0: struct sctp_sndrcvinfo { michael@0: uint16_t sinfo_stream; michael@0: uint16_t sinfo_ssn; michael@0: uint16_t sinfo_flags; michael@0: #if defined(__FreeBSD__) && __FreeBSD_version < 800000 michael@0: uint16_t sinfo_pr_policy; michael@0: #endif michael@0: uint32_t sinfo_ppid; michael@0: uint32_t sinfo_context; michael@0: uint32_t sinfo_timetolive; michael@0: uint32_t sinfo_tsn; michael@0: uint32_t sinfo_cumtsn; michael@0: sctp_assoc_t sinfo_assoc_id; michael@0: uint16_t sinfo_keynumber; michael@0: uint16_t sinfo_keynumber_valid; michael@0: uint8_t __reserve_pad[SCTP_ALIGN_RESV_PAD]; michael@0: }; michael@0: michael@0: struct sctp_extrcvinfo { michael@0: uint16_t sinfo_stream; michael@0: uint16_t sinfo_ssn; michael@0: uint16_t sinfo_flags; michael@0: #if defined(__FreeBSD__) && __FreeBSD_version < 800000 michael@0: uint16_t sinfo_pr_policy; michael@0: #endif michael@0: uint32_t sinfo_ppid; michael@0: uint32_t sinfo_context; michael@0: uint32_t sinfo_timetolive; michael@0: uint32_t sinfo_tsn; michael@0: uint32_t sinfo_cumtsn; michael@0: sctp_assoc_t sinfo_assoc_id; michael@0: uint16_t sreinfo_next_flags; michael@0: uint16_t sreinfo_next_stream; michael@0: uint32_t sreinfo_next_aid; michael@0: uint32_t sreinfo_next_length; michael@0: uint32_t sreinfo_next_ppid; michael@0: uint16_t sinfo_keynumber; michael@0: uint16_t sinfo_keynumber_valid; michael@0: uint8_t __reserve_pad[SCTP_ALIGN_RESV_PAD_SHORT]; michael@0: }; michael@0: michael@0: struct sctp_sndinfo { michael@0: uint16_t snd_sid; michael@0: uint16_t snd_flags; michael@0: uint32_t snd_ppid; michael@0: uint32_t snd_context; michael@0: sctp_assoc_t snd_assoc_id; michael@0: }; michael@0: michael@0: struct sctp_prinfo { michael@0: uint16_t pr_policy; michael@0: uint32_t pr_value; michael@0: }; michael@0: michael@0: struct sctp_default_prinfo { michael@0: uint16_t pr_policy; michael@0: uint32_t pr_value; michael@0: sctp_assoc_t pr_assoc_id; michael@0: }; michael@0: michael@0: struct sctp_authinfo { michael@0: uint16_t auth_keynumber; michael@0: }; michael@0: michael@0: struct sctp_rcvinfo { michael@0: uint16_t rcv_sid; michael@0: uint16_t rcv_ssn; michael@0: uint16_t rcv_flags; michael@0: uint32_t rcv_ppid; michael@0: uint32_t rcv_tsn; michael@0: uint32_t rcv_cumtsn; michael@0: uint32_t rcv_context; michael@0: sctp_assoc_t rcv_assoc_id; michael@0: }; michael@0: michael@0: struct sctp_nxtinfo { michael@0: uint16_t nxt_sid; michael@0: uint16_t nxt_flags; michael@0: uint32_t nxt_ppid; michael@0: uint32_t nxt_length; michael@0: sctp_assoc_t nxt_assoc_id; michael@0: }; michael@0: michael@0: #define SCTP_NO_NEXT_MSG 0x0000 michael@0: #define SCTP_NEXT_MSG_AVAIL 0x0001 michael@0: #define SCTP_NEXT_MSG_ISCOMPLETE 0x0002 michael@0: #define SCTP_NEXT_MSG_IS_UNORDERED 0x0004 michael@0: #define SCTP_NEXT_MSG_IS_NOTIFICATION 0x0008 michael@0: michael@0: struct sctp_recvv_rn { michael@0: struct sctp_rcvinfo recvv_rcvinfo; michael@0: struct sctp_nxtinfo recvv_nxtinfo; michael@0: }; michael@0: michael@0: #define SCTP_RECVV_NOINFO 0 michael@0: #define SCTP_RECVV_RCVINFO 1 michael@0: #define SCTP_RECVV_NXTINFO 2 michael@0: #define SCTP_RECVV_RN 3 michael@0: michael@0: #define SCTP_SENDV_NOINFO 0 michael@0: #define SCTP_SENDV_SNDINFO 1 michael@0: #define SCTP_SENDV_PRINFO 2 michael@0: #define SCTP_SENDV_AUTHINFO 3 michael@0: #define SCTP_SENDV_SPA 4 michael@0: michael@0: struct sctp_sendv_spa { michael@0: uint32_t sendv_flags; michael@0: struct sctp_sndinfo sendv_sndinfo; michael@0: struct sctp_prinfo sendv_prinfo; michael@0: struct sctp_authinfo sendv_authinfo; michael@0: }; michael@0: michael@0: #define SCTP_SEND_SNDINFO_VALID 0x00000001 michael@0: #define SCTP_SEND_PRINFO_VALID 0x00000002 michael@0: #define SCTP_SEND_AUTHINFO_VALID 0x00000004 michael@0: michael@0: struct sctp_snd_all_completes { michael@0: uint16_t sall_stream; michael@0: uint16_t sall_flags; michael@0: uint32_t sall_ppid; michael@0: uint32_t sall_context; michael@0: uint32_t sall_num_sent; michael@0: uint32_t sall_num_failed; michael@0: }; michael@0: michael@0: /* Flags that go into the sinfo->sinfo_flags field */ michael@0: #define SCTP_NOTIFICATION 0x0010 /* next message is a notification */ michael@0: #define SCTP_COMPLETE 0x0020 /* next message is complete */ michael@0: #define SCTP_EOF 0x0100 /* Start shutdown procedures */ michael@0: #define SCTP_ABORT 0x0200 /* Send an ABORT to peer */ michael@0: #define SCTP_UNORDERED 0x0400 /* Message is un-ordered */ michael@0: #define SCTP_ADDR_OVER 0x0800 /* Override the primary-address */ michael@0: #define SCTP_SENDALL 0x1000 /* Send this on all associations */ michael@0: #define SCTP_EOR 0x2000 /* end of message signal */ michael@0: #define SCTP_SACK_IMMEDIATELY 0x4000 /* Set I-Bit */ michael@0: michael@0: #define INVALID_SINFO_FLAG(x) (((x) & 0xfffffff0 \ michael@0: & ~(SCTP_EOF | SCTP_ABORT | SCTP_UNORDERED |\ michael@0: SCTP_ADDR_OVER | SCTP_SENDALL | SCTP_EOR |\ michael@0: SCTP_SACK_IMMEDIATELY)) != 0) michael@0: /* for the endpoint */ michael@0: michael@0: /* The lower byte is an enumeration of PR-SCTP policies */ michael@0: #define SCTP_PR_SCTP_NONE 0x0000 /* Reliable transfer */ michael@0: #define SCTP_PR_SCTP_TTL 0x0001 /* Time based PR-SCTP */ michael@0: #define SCTP_PR_SCTP_BUF 0x0002 /* Buffer based PR-SCTP */ michael@0: #define SCTP_PR_SCTP_RTX 0x0003 /* Number of retransmissions based PR-SCTP */ michael@0: michael@0: #define PR_SCTP_POLICY(x) ((x) & 0x0f) michael@0: #define PR_SCTP_ENABLED(x) (PR_SCTP_POLICY(x) != SCTP_PR_SCTP_NONE) michael@0: #define PR_SCTP_TTL_ENABLED(x) (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_TTL) michael@0: #define PR_SCTP_BUF_ENABLED(x) (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_BUF) michael@0: #define PR_SCTP_RTX_ENABLED(x) (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_RTX) michael@0: #define PR_SCTP_INVALID_POLICY(x) (PR_SCTP_POLICY(x) > SCTP_PR_SCTP_RTX) michael@0: /* Stat's */ michael@0: struct sctp_pcbinfo { michael@0: uint32_t ep_count; michael@0: uint32_t asoc_count; michael@0: uint32_t laddr_count; michael@0: uint32_t raddr_count; michael@0: uint32_t chk_count; michael@0: uint32_t readq_count; michael@0: uint32_t free_chunks; michael@0: uint32_t stream_oque; michael@0: }; michael@0: michael@0: struct sctp_sockstat { michael@0: sctp_assoc_t ss_assoc_id; michael@0: uint32_t ss_total_sndbuf; michael@0: uint32_t ss_total_recv_buf; michael@0: }; michael@0: michael@0: /* michael@0: * notification event structures michael@0: */ michael@0: michael@0: /* michael@0: * association change event michael@0: */ michael@0: struct sctp_assoc_change { michael@0: uint16_t sac_type; michael@0: uint16_t sac_flags; michael@0: uint32_t sac_length; michael@0: uint16_t sac_state; michael@0: uint16_t sac_error; michael@0: uint16_t sac_outbound_streams; michael@0: uint16_t sac_inbound_streams; michael@0: sctp_assoc_t sac_assoc_id; michael@0: uint8_t sac_info[]; michael@0: }; michael@0: michael@0: /* sac_state values */ michael@0: #define SCTP_COMM_UP 0x0001 michael@0: #define SCTP_COMM_LOST 0x0002 michael@0: #define SCTP_RESTART 0x0003 michael@0: #define SCTP_SHUTDOWN_COMP 0x0004 michael@0: #define SCTP_CANT_STR_ASSOC 0x0005 michael@0: michael@0: /* sac_info values */ michael@0: #define SCTP_ASSOC_SUPPORTS_PR 0x01 michael@0: #define SCTP_ASSOC_SUPPORTS_AUTH 0x02 michael@0: #define SCTP_ASSOC_SUPPORTS_ASCONF 0x03 michael@0: #define SCTP_ASSOC_SUPPORTS_MULTIBUF 0x04 michael@0: #define SCTP_ASSOC_SUPPORTS_RE_CONFIG 0x05 michael@0: #define SCTP_ASSOC_SUPPORTS_MAX 0x05 michael@0: /* michael@0: * Address event michael@0: */ michael@0: struct sctp_paddr_change { michael@0: uint16_t spc_type; michael@0: uint16_t spc_flags; michael@0: uint32_t spc_length; michael@0: struct sockaddr_storage spc_aaddr; michael@0: uint32_t spc_state; michael@0: uint32_t spc_error; michael@0: sctp_assoc_t spc_assoc_id; michael@0: uint8_t spc_padding[4]; michael@0: }; michael@0: michael@0: /* paddr state values */ michael@0: #define SCTP_ADDR_AVAILABLE 0x0001 michael@0: #define SCTP_ADDR_UNREACHABLE 0x0002 michael@0: #define SCTP_ADDR_REMOVED 0x0003 michael@0: #define SCTP_ADDR_ADDED 0x0004 michael@0: #define SCTP_ADDR_MADE_PRIM 0x0005 michael@0: #define SCTP_ADDR_CONFIRMED 0x0006 michael@0: michael@0: #define SCTP_ACTIVE 0x0001 /* SCTP_ADDR_REACHABLE */ michael@0: #define SCTP_INACTIVE 0x0002 /* neither SCTP_ADDR_REACHABLE michael@0: nor SCTP_ADDR_UNCONFIRMED */ michael@0: #define SCTP_UNCONFIRMED 0x0200 /* SCTP_ADDR_UNCONFIRMED */ michael@0: michael@0: /* remote error events */ michael@0: struct sctp_remote_error { michael@0: uint16_t sre_type; michael@0: uint16_t sre_flags; michael@0: uint32_t sre_length; michael@0: uint16_t sre_error; michael@0: sctp_assoc_t sre_assoc_id; michael@0: uint8_t sre_data[4]; michael@0: }; michael@0: michael@0: /* data send failure event (deprecated) */ michael@0: struct sctp_send_failed { michael@0: uint16_t ssf_type; michael@0: uint16_t ssf_flags; michael@0: uint32_t ssf_length; michael@0: uint32_t ssf_error; michael@0: struct sctp_sndrcvinfo ssf_info; michael@0: sctp_assoc_t ssf_assoc_id; michael@0: uint8_t ssf_data[]; michael@0: }; michael@0: michael@0: /* data send failure event (not deprecated) */ michael@0: struct sctp_send_failed_event { michael@0: uint16_t ssfe_type; michael@0: uint16_t ssfe_flags; michael@0: uint32_t ssfe_length; michael@0: uint32_t ssfe_error; michael@0: struct sctp_sndinfo ssfe_info; michael@0: sctp_assoc_t ssfe_assoc_id; michael@0: uint8_t ssfe_data[]; michael@0: }; michael@0: michael@0: /* flag that indicates state of data */ michael@0: #define SCTP_DATA_UNSENT 0x0001 /* inqueue never on wire */ michael@0: #define SCTP_DATA_SENT 0x0002 /* on wire at failure */ michael@0: michael@0: /* shutdown event */ michael@0: struct sctp_shutdown_event { michael@0: uint16_t sse_type; michael@0: uint16_t sse_flags; michael@0: uint32_t sse_length; michael@0: sctp_assoc_t sse_assoc_id; michael@0: }; michael@0: michael@0: /* Adaptation layer indication stuff */ michael@0: struct sctp_adaptation_event { michael@0: uint16_t sai_type; michael@0: uint16_t sai_flags; michael@0: uint32_t sai_length; michael@0: uint32_t sai_adaptation_ind; michael@0: sctp_assoc_t sai_assoc_id; michael@0: }; michael@0: michael@0: struct sctp_setadaptation { michael@0: uint32_t ssb_adaptation_ind; michael@0: }; michael@0: michael@0: /* compatible old spelling */ michael@0: struct sctp_adaption_event { michael@0: uint16_t sai_type; michael@0: uint16_t sai_flags; michael@0: uint32_t sai_length; michael@0: uint32_t sai_adaption_ind; michael@0: sctp_assoc_t sai_assoc_id; michael@0: }; michael@0: michael@0: struct sctp_setadaption { michael@0: uint32_t ssb_adaption_ind; michael@0: }; michael@0: michael@0: michael@0: /* michael@0: * Partial Delivery API event michael@0: */ michael@0: struct sctp_pdapi_event { michael@0: uint16_t pdapi_type; michael@0: uint16_t pdapi_flags; michael@0: uint32_t pdapi_length; michael@0: uint32_t pdapi_indication; michael@0: uint16_t pdapi_stream; michael@0: uint16_t pdapi_seq; michael@0: sctp_assoc_t pdapi_assoc_id; michael@0: }; michael@0: michael@0: /* indication values */ michael@0: #define SCTP_PARTIAL_DELIVERY_ABORTED 0x0001 michael@0: michael@0: michael@0: /* michael@0: * authentication key event michael@0: */ michael@0: struct sctp_authkey_event { michael@0: uint16_t auth_type; michael@0: uint16_t auth_flags; michael@0: uint32_t auth_length; michael@0: uint16_t auth_keynumber; michael@0: uint16_t auth_altkeynumber; michael@0: uint32_t auth_indication; michael@0: sctp_assoc_t auth_assoc_id; michael@0: }; michael@0: michael@0: /* indication values */ michael@0: #define SCTP_AUTH_NEW_KEY 0x0001 michael@0: #define SCTP_AUTH_NEWKEY SCTP_AUTH_NEW_KEY michael@0: #define SCTP_AUTH_NO_AUTH 0x0002 michael@0: #define SCTP_AUTH_FREE_KEY 0x0003 michael@0: michael@0: michael@0: struct sctp_sender_dry_event { michael@0: uint16_t sender_dry_type; michael@0: uint16_t sender_dry_flags; michael@0: uint32_t sender_dry_length; michael@0: sctp_assoc_t sender_dry_assoc_id; michael@0: }; michael@0: michael@0: michael@0: /* michael@0: * Stream reset event - subscribe to SCTP_STREAM_RESET_EVENT michael@0: */ michael@0: struct sctp_stream_reset_event { michael@0: uint16_t strreset_type; michael@0: uint16_t strreset_flags; michael@0: uint32_t strreset_length; michael@0: sctp_assoc_t strreset_assoc_id; michael@0: uint16_t strreset_stream_list[]; michael@0: }; michael@0: michael@0: /* flags in stream_reset_event (strreset_flags) */ michael@0: #define SCTP_STREAM_RESET_INCOMING_SSN 0x0001 michael@0: #define SCTP_STREAM_RESET_OUTGOING_SSN 0x0002 michael@0: #define SCTP_STREAM_RESET_DENIED 0x0004 michael@0: #define SCTP_STREAM_RESET_FAILED 0x0008 michael@0: michael@0: /* michael@0: * Assoc reset event - subscribe to SCTP_ASSOC_RESET_EVENT michael@0: */ michael@0: struct sctp_assoc_reset_event { michael@0: uint16_t assocreset_type; michael@0: uint16_t assocreset_flags; michael@0: uint32_t assocreset_length; michael@0: sctp_assoc_t assocreset_assoc_id; michael@0: uint32_t assocreset_local_tsn; michael@0: uint32_t assocreset_remote_tsn; michael@0: }; michael@0: michael@0: #define SCTP_ASSOC_RESET_DENIED 0x0004 michael@0: #define SCTP_ASSOC_RESET_FAILED 0x0008 michael@0: michael@0: /* michael@0: * Stream change event - subscribe to SCTP_STREAM_CHANGE_EVENT michael@0: */ michael@0: struct sctp_stream_change_event { michael@0: uint16_t strchange_type; michael@0: uint16_t strchange_flags; michael@0: uint32_t strchange_length; michael@0: sctp_assoc_t strchange_assoc_id; michael@0: uint16_t strchange_instrms; michael@0: uint16_t strchange_outstrms; michael@0: }; michael@0: michael@0: #define SCTP_STREAM_CHANGE_DENIED 0x0004 michael@0: #define SCTP_STREAM_CHANGE_FAILED 0x0008 michael@0: michael@0: michael@0: /* SCTP notification event */ michael@0: struct sctp_tlv { michael@0: uint16_t sn_type; michael@0: uint16_t sn_flags; michael@0: uint32_t sn_length; michael@0: }; michael@0: michael@0: union sctp_notification { michael@0: struct sctp_tlv sn_header; michael@0: struct sctp_assoc_change sn_assoc_change; michael@0: struct sctp_paddr_change sn_paddr_change; michael@0: struct sctp_remote_error sn_remote_error; michael@0: struct sctp_send_failed sn_send_failed; michael@0: struct sctp_shutdown_event sn_shutdown_event; michael@0: struct sctp_adaptation_event sn_adaptation_event; michael@0: /* compatibility same as above */ michael@0: struct sctp_adaption_event sn_adaption_event; michael@0: struct sctp_pdapi_event sn_pdapi_event; michael@0: struct sctp_authkey_event sn_auth_event; michael@0: struct sctp_sender_dry_event sn_sender_dry_event; michael@0: struct sctp_send_failed_event sn_send_failed_event; michael@0: struct sctp_stream_reset_event sn_strreset_event; michael@0: struct sctp_assoc_reset_event sn_assocreset_event; michael@0: struct sctp_stream_change_event sn_strchange_event; michael@0: }; michael@0: michael@0: /* notification types */ michael@0: #define SCTP_ASSOC_CHANGE 0x0001 michael@0: #define SCTP_PEER_ADDR_CHANGE 0x0002 michael@0: #define SCTP_REMOTE_ERROR 0x0003 michael@0: #define SCTP_SEND_FAILED 0x0004 michael@0: #define SCTP_SHUTDOWN_EVENT 0x0005 michael@0: #define SCTP_ADAPTATION_INDICATION 0x0006 michael@0: /* same as above */ michael@0: #define SCTP_ADAPTION_INDICATION 0x0006 michael@0: #define SCTP_PARTIAL_DELIVERY_EVENT 0x0007 michael@0: #define SCTP_AUTHENTICATION_EVENT 0x0008 michael@0: #define SCTP_STREAM_RESET_EVENT 0x0009 michael@0: #define SCTP_SENDER_DRY_EVENT 0x000a michael@0: #define SCTP_NOTIFICATIONS_STOPPED_EVENT 0x000b /* we don't send this*/ michael@0: #define SCTP_ASSOC_RESET_EVENT 0x000c michael@0: #define SCTP_STREAM_CHANGE_EVENT 0x000d michael@0: #define SCTP_SEND_FAILED_EVENT 0x000e michael@0: /* michael@0: * socket option structs michael@0: */ michael@0: michael@0: struct sctp_paddrparams { michael@0: struct sockaddr_storage spp_address; michael@0: sctp_assoc_t spp_assoc_id; michael@0: uint32_t spp_hbinterval; michael@0: uint32_t spp_pathmtu; michael@0: uint32_t spp_flags; michael@0: uint32_t spp_ipv6_flowlabel; michael@0: uint16_t spp_pathmaxrxt; michael@0: uint8_t spp_dscp; michael@0: }; michael@0: #define spp_ipv4_tos spp_dscp michael@0: michael@0: #define SPP_HB_ENABLE 0x00000001 michael@0: #define SPP_HB_DISABLE 0x00000002 michael@0: #define SPP_HB_DEMAND 0x00000004 michael@0: #define SPP_PMTUD_ENABLE 0x00000008 michael@0: #define SPP_PMTUD_DISABLE 0x00000010 michael@0: #define SPP_HB_TIME_IS_ZERO 0x00000080 michael@0: #define SPP_IPV6_FLOWLABEL 0x00000100 michael@0: #define SPP_DSCP 0x00000200 michael@0: #define SPP_IPV4_TOS SPP_DSCP michael@0: michael@0: struct sctp_paddrthlds { michael@0: struct sockaddr_storage spt_address; michael@0: sctp_assoc_t spt_assoc_id; michael@0: uint16_t spt_pathmaxrxt; michael@0: uint16_t spt_pathpfthld; michael@0: }; michael@0: michael@0: struct sctp_paddrinfo { michael@0: struct sockaddr_storage spinfo_address; michael@0: sctp_assoc_t spinfo_assoc_id; michael@0: int32_t spinfo_state; michael@0: uint32_t spinfo_cwnd; michael@0: uint32_t spinfo_srtt; michael@0: uint32_t spinfo_rto; michael@0: uint32_t spinfo_mtu; michael@0: }; michael@0: michael@0: struct sctp_rtoinfo { michael@0: sctp_assoc_t srto_assoc_id; michael@0: uint32_t srto_initial; michael@0: uint32_t srto_max; michael@0: uint32_t srto_min; michael@0: }; michael@0: michael@0: struct sctp_assocparams { michael@0: sctp_assoc_t sasoc_assoc_id; michael@0: uint32_t sasoc_peer_rwnd; michael@0: uint32_t sasoc_local_rwnd; michael@0: uint32_t sasoc_cookie_life; michael@0: uint16_t sasoc_asocmaxrxt; michael@0: uint16_t sasoc_number_peer_destinations; michael@0: }; michael@0: michael@0: struct sctp_setprim { michael@0: struct sockaddr_storage ssp_addr; michael@0: sctp_assoc_t ssp_assoc_id; michael@0: uint8_t ssp_padding[4]; michael@0: }; michael@0: michael@0: struct sctp_setpeerprim { michael@0: struct sockaddr_storage sspp_addr; michael@0: sctp_assoc_t sspp_assoc_id; michael@0: uint8_t sspp_padding[4]; michael@0: }; michael@0: michael@0: struct sctp_getaddresses { michael@0: sctp_assoc_t sget_assoc_id; michael@0: /* addr is filled in for N * sockaddr_storage */ michael@0: struct sockaddr addr[1]; michael@0: }; michael@0: michael@0: struct sctp_status { michael@0: sctp_assoc_t sstat_assoc_id; michael@0: int32_t sstat_state; michael@0: uint32_t sstat_rwnd; michael@0: uint16_t sstat_unackdata; michael@0: uint16_t sstat_penddata; michael@0: uint16_t sstat_instrms; michael@0: uint16_t sstat_outstrms; michael@0: uint32_t sstat_fragmentation_point; michael@0: struct sctp_paddrinfo sstat_primary; michael@0: }; michael@0: michael@0: /* michael@0: * AUTHENTICATION support michael@0: */ michael@0: /* SCTP_AUTH_CHUNK */ michael@0: struct sctp_authchunk { michael@0: uint8_t sauth_chunk; michael@0: }; michael@0: michael@0: /* SCTP_AUTH_KEY */ michael@0: struct sctp_authkey { michael@0: sctp_assoc_t sca_assoc_id; michael@0: uint16_t sca_keynumber; michael@0: uint16_t sca_keylength; michael@0: uint8_t sca_key[]; michael@0: }; michael@0: michael@0: /* SCTP_HMAC_IDENT */ michael@0: struct sctp_hmacalgo { michael@0: uint32_t shmac_number_of_idents; michael@0: uint16_t shmac_idents[]; michael@0: }; michael@0: michael@0: /* AUTH hmac_id */ michael@0: #define SCTP_AUTH_HMAC_ID_RSVD 0x0000 michael@0: #define SCTP_AUTH_HMAC_ID_SHA1 0x0001 /* default, mandatory */ michael@0: #define SCTP_AUTH_HMAC_ID_SHA256 0x0003 michael@0: michael@0: /* SCTP_AUTH_ACTIVE_KEY / SCTP_AUTH_DELETE_KEY */ michael@0: struct sctp_authkeyid { michael@0: sctp_assoc_t scact_assoc_id; michael@0: uint16_t scact_keynumber; michael@0: }; michael@0: michael@0: /* SCTP_PEER_AUTH_CHUNKS / SCTP_LOCAL_AUTH_CHUNKS */ michael@0: struct sctp_authchunks { michael@0: sctp_assoc_t gauth_assoc_id; michael@0: uint32_t gauth_number_of_chunks; michael@0: uint8_t gauth_chunks[]; michael@0: }; michael@0: michael@0: struct sctp_assoc_value { michael@0: sctp_assoc_t assoc_id; michael@0: uint32_t assoc_value; michael@0: }; michael@0: michael@0: struct sctp_cc_option { michael@0: int option; michael@0: struct sctp_assoc_value aid_value; michael@0: }; michael@0: michael@0: struct sctp_stream_value { michael@0: sctp_assoc_t assoc_id; michael@0: uint16_t stream_id; michael@0: uint16_t stream_value; michael@0: }; michael@0: michael@0: struct sctp_assoc_ids { michael@0: uint32_t gaids_number_of_ids; michael@0: sctp_assoc_t gaids_assoc_id[]; michael@0: }; michael@0: michael@0: struct sctp_sack_info { michael@0: sctp_assoc_t sack_assoc_id; michael@0: uint32_t sack_delay; michael@0: uint32_t sack_freq; michael@0: }; michael@0: michael@0: struct sctp_timeouts { michael@0: sctp_assoc_t stimo_assoc_id; michael@0: uint32_t stimo_init; michael@0: uint32_t stimo_data; michael@0: uint32_t stimo_sack; michael@0: uint32_t stimo_shutdown; michael@0: uint32_t stimo_heartbeat; michael@0: uint32_t stimo_cookie; michael@0: uint32_t stimo_shutdownack; michael@0: }; michael@0: michael@0: struct sctp_udpencaps { michael@0: struct sockaddr_storage sue_address; michael@0: sctp_assoc_t sue_assoc_id; michael@0: uint16_t sue_port; michael@0: }; michael@0: michael@0: struct sctp_cwnd_args { michael@0: struct sctp_nets *net; /* network to */ /* FIXME: LP64 issue */ michael@0: uint32_t cwnd_new_value;/* cwnd in k */ michael@0: uint32_t pseudo_cumack; michael@0: uint16_t inflight; /* flightsize in k */ michael@0: uint16_t cwnd_augment; /* increment to it */ michael@0: uint8_t meets_pseudo_cumack; michael@0: uint8_t need_new_pseudo_cumack; michael@0: uint8_t cnt_in_send; michael@0: uint8_t cnt_in_str; michael@0: }; michael@0: michael@0: struct sctp_blk_args { michael@0: uint32_t onsb; /* in 1k bytes */ michael@0: uint32_t sndlen; /* len of send being attempted */ michael@0: uint32_t peer_rwnd; /* rwnd of peer */ michael@0: uint16_t send_sent_qcnt;/* chnk cnt */ michael@0: uint16_t stream_qcnt; /* chnk cnt */ michael@0: uint16_t chunks_on_oque;/* chunks out */ michael@0: uint16_t flight_size; /* flight size in k */ michael@0: }; michael@0: michael@0: /* michael@0: * Max we can reset in one setting, note this is dictated not by the define michael@0: * but the size of a mbuf cluster so don't change this define and think you michael@0: * can specify more. You must do multiple resets if you want to reset more michael@0: * than SCTP_MAX_EXPLICIT_STR_RESET. michael@0: */ michael@0: #define SCTP_MAX_EXPLICT_STR_RESET 1000 michael@0: michael@0: struct sctp_reset_streams { michael@0: sctp_assoc_t srs_assoc_id; michael@0: uint16_t srs_flags; michael@0: uint16_t srs_number_streams; /* 0 == ALL */ michael@0: uint16_t srs_stream_list[];/* list if strrst_num_streams is not 0 */ michael@0: }; michael@0: michael@0: struct sctp_add_streams { michael@0: sctp_assoc_t sas_assoc_id; michael@0: uint16_t sas_instrms; michael@0: uint16_t sas_outstrms; michael@0: }; michael@0: michael@0: struct sctp_get_nonce_values { michael@0: sctp_assoc_t gn_assoc_id; michael@0: uint32_t gn_peers_tag; michael@0: uint32_t gn_local_tag; michael@0: }; michael@0: michael@0: /* Debugging logs */ michael@0: struct sctp_str_log { michael@0: void *stcb; /* FIXME: LP64 issue */ michael@0: uint32_t n_tsn; michael@0: uint32_t e_tsn; michael@0: uint16_t n_sseq; michael@0: uint16_t e_sseq; michael@0: uint16_t strm; michael@0: }; michael@0: michael@0: struct sctp_sb_log { michael@0: void *stcb; /* FIXME: LP64 issue */ michael@0: uint32_t so_sbcc; michael@0: uint32_t stcb_sbcc; michael@0: uint32_t incr; michael@0: }; michael@0: michael@0: struct sctp_fr_log { michael@0: uint32_t largest_tsn; michael@0: uint32_t largest_new_tsn; michael@0: uint32_t tsn; michael@0: }; michael@0: michael@0: struct sctp_fr_map { michael@0: uint32_t base; michael@0: uint32_t cum; michael@0: uint32_t high; michael@0: }; michael@0: michael@0: struct sctp_rwnd_log { michael@0: uint32_t rwnd; michael@0: uint32_t send_size; michael@0: uint32_t overhead; michael@0: uint32_t new_rwnd; michael@0: }; michael@0: michael@0: struct sctp_mbcnt_log { michael@0: uint32_t total_queue_size; michael@0: uint32_t size_change; michael@0: uint32_t total_queue_mb_size; michael@0: uint32_t mbcnt_change; michael@0: }; michael@0: michael@0: struct sctp_sack_log { michael@0: uint32_t cumack; michael@0: uint32_t oldcumack; michael@0: uint32_t tsn; michael@0: uint16_t numGaps; michael@0: uint16_t numDups; michael@0: }; michael@0: michael@0: struct sctp_lock_log { michael@0: void *sock; /* FIXME: LP64 issue */ michael@0: void *inp; /* FIXME: LP64 issue */ michael@0: uint8_t tcb_lock; michael@0: uint8_t inp_lock; michael@0: uint8_t info_lock; michael@0: uint8_t sock_lock; michael@0: uint8_t sockrcvbuf_lock; michael@0: uint8_t socksndbuf_lock; michael@0: uint8_t create_lock; michael@0: uint8_t resv; michael@0: }; michael@0: michael@0: struct sctp_rto_log { michael@0: void * net; /* FIXME: LP64 issue */ michael@0: uint32_t rtt; michael@0: }; michael@0: michael@0: struct sctp_nagle_log { michael@0: void *stcb; /* FIXME: LP64 issue */ michael@0: uint32_t total_flight; michael@0: uint32_t total_in_queue; michael@0: uint16_t count_in_queue; michael@0: uint16_t count_in_flight; michael@0: }; michael@0: michael@0: struct sctp_sbwake_log { michael@0: void *stcb; /* FIXME: LP64 issue */ michael@0: uint16_t send_q; michael@0: uint16_t sent_q; michael@0: uint16_t flight; michael@0: uint16_t wake_cnt; michael@0: uint8_t stream_qcnt; /* chnk cnt */ michael@0: uint8_t chunks_on_oque;/* chunks out */ michael@0: uint8_t sbflags; michael@0: uint8_t sctpflags; michael@0: }; michael@0: michael@0: struct sctp_misc_info { michael@0: uint32_t log1; michael@0: uint32_t log2; michael@0: uint32_t log3; michael@0: uint32_t log4; michael@0: }; michael@0: michael@0: struct sctp_log_closing { michael@0: void *inp; /* FIXME: LP64 issue */ michael@0: void *stcb; /* FIXME: LP64 issue */ michael@0: uint32_t sctp_flags; michael@0: uint16_t state; michael@0: int16_t loc; michael@0: }; michael@0: michael@0: struct sctp_mbuf_log { michael@0: struct mbuf *mp; /* FIXME: LP64 issue */ michael@0: caddr_t ext; michael@0: caddr_t data; michael@0: uint16_t size; michael@0: uint8_t refcnt; michael@0: uint8_t mbuf_flags; michael@0: }; michael@0: michael@0: struct sctp_cwnd_log { michael@0: uint64_t time_event; michael@0: uint8_t from; michael@0: uint8_t event_type; michael@0: uint8_t resv[2]; michael@0: union { michael@0: struct sctp_log_closing close; michael@0: struct sctp_blk_args blk; michael@0: struct sctp_cwnd_args cwnd; michael@0: struct sctp_str_log strlog; michael@0: struct sctp_fr_log fr; michael@0: struct sctp_fr_map map; michael@0: struct sctp_rwnd_log rwnd; michael@0: struct sctp_mbcnt_log mbcnt; michael@0: struct sctp_sack_log sack; michael@0: struct sctp_lock_log lock; michael@0: struct sctp_rto_log rto; michael@0: struct sctp_sb_log sb; michael@0: struct sctp_nagle_log nagle; michael@0: struct sctp_sbwake_log wake; michael@0: struct sctp_mbuf_log mb; michael@0: struct sctp_misc_info misc; michael@0: } x; michael@0: }; michael@0: michael@0: struct sctp_cwnd_log_req { michael@0: int32_t num_in_log; /* Number in log */ michael@0: int32_t num_ret; /* Number returned */ michael@0: int32_t start_at; /* start at this one */ michael@0: int32_t end_at; /* end at this one */ michael@0: struct sctp_cwnd_log log[]; michael@0: }; michael@0: michael@0: struct sctp_timeval { michael@0: uint32_t tv_sec; michael@0: uint32_t tv_usec; michael@0: }; michael@0: michael@0: struct sctpstat { michael@0: struct sctp_timeval sctps_discontinuitytime; /* sctpStats 18 (TimeStamp) */ michael@0: /* MIB according to RFC 3873 */ michael@0: uint32_t sctps_currestab; /* sctpStats 1 (Gauge32) */ michael@0: uint32_t sctps_activeestab; /* sctpStats 2 (Counter32) */ michael@0: uint32_t sctps_restartestab; michael@0: uint32_t sctps_collisionestab; michael@0: uint32_t sctps_passiveestab; /* sctpStats 3 (Counter32) */ michael@0: uint32_t sctps_aborted; /* sctpStats 4 (Counter32) */ michael@0: uint32_t sctps_shutdown; /* sctpStats 5 (Counter32) */ michael@0: uint32_t sctps_outoftheblue; /* sctpStats 6 (Counter32) */ michael@0: uint32_t sctps_checksumerrors; /* sctpStats 7 (Counter32) */ michael@0: uint32_t sctps_outcontrolchunks; /* sctpStats 8 (Counter64) */ michael@0: uint32_t sctps_outorderchunks; /* sctpStats 9 (Counter64) */ michael@0: uint32_t sctps_outunorderchunks; /* sctpStats 10 (Counter64) */ michael@0: uint32_t sctps_incontrolchunks; /* sctpStats 11 (Counter64) */ michael@0: uint32_t sctps_inorderchunks; /* sctpStats 12 (Counter64) */ michael@0: uint32_t sctps_inunorderchunks; /* sctpStats 13 (Counter64) */ michael@0: uint32_t sctps_fragusrmsgs; /* sctpStats 14 (Counter64) */ michael@0: uint32_t sctps_reasmusrmsgs; /* sctpStats 15 (Counter64) */ michael@0: uint32_t sctps_outpackets; /* sctpStats 16 (Counter64) */ michael@0: uint32_t sctps_inpackets; /* sctpStats 17 (Counter64) */ michael@0: michael@0: /* input statistics: */ michael@0: uint32_t sctps_recvpackets; /* total input packets */ michael@0: uint32_t sctps_recvdatagrams; /* total input datagrams */ michael@0: uint32_t sctps_recvpktwithdata; /* total packets that had data */ michael@0: uint32_t sctps_recvsacks; /* total input SACK chunks */ michael@0: uint32_t sctps_recvdata; /* total input DATA chunks */ michael@0: uint32_t sctps_recvdupdata; /* total input duplicate DATA chunks */ michael@0: uint32_t sctps_recvheartbeat; /* total input HB chunks */ michael@0: uint32_t sctps_recvheartbeatack; /* total input HB-ACK chunks */ michael@0: uint32_t sctps_recvecne; /* total input ECNE chunks */ michael@0: uint32_t sctps_recvauth; /* total input AUTH chunks */ michael@0: uint32_t sctps_recvauthmissing; /* total input chunks missing AUTH */ michael@0: uint32_t sctps_recvivalhmacid; /* total number of invalid HMAC ids received */ michael@0: uint32_t sctps_recvivalkeyid; /* total number of invalid secret ids received */ michael@0: uint32_t sctps_recvauthfailed; /* total number of auth failed */ michael@0: uint32_t sctps_recvexpress; /* total fast path receives all one chunk */ michael@0: uint32_t sctps_recvexpressm; /* total fast path multi-part data */ michael@0: uint32_t sctps_recvnocrc; michael@0: uint32_t sctps_recvswcrc; michael@0: uint32_t sctps_recvhwcrc; michael@0: michael@0: /* output statistics: */ michael@0: uint32_t sctps_sendpackets; /* total output packets */ michael@0: uint32_t sctps_sendsacks; /* total output SACKs */ michael@0: uint32_t sctps_senddata; /* total output DATA chunks */ michael@0: uint32_t sctps_sendretransdata; /* total output retransmitted DATA chunks */ michael@0: uint32_t sctps_sendfastretrans; /* total output fast retransmitted DATA chunks */ michael@0: uint32_t sctps_sendmultfastretrans; /* total FR's that happened more than once michael@0: * to same chunk (u-del multi-fr algo). michael@0: */ michael@0: uint32_t sctps_sendheartbeat; /* total output HB chunks */ michael@0: uint32_t sctps_sendecne; /* total output ECNE chunks */ michael@0: uint32_t sctps_sendauth; /* total output AUTH chunks FIXME */ michael@0: uint32_t sctps_senderrors; /* ip_output error counter */ michael@0: uint32_t sctps_sendnocrc; michael@0: uint32_t sctps_sendswcrc; michael@0: uint32_t sctps_sendhwcrc; michael@0: /* PCKDROPREP statistics: */ michael@0: uint32_t sctps_pdrpfmbox; /* Packet drop from middle box */ michael@0: uint32_t sctps_pdrpfehos; /* P-drop from end host */ michael@0: uint32_t sctps_pdrpmbda; /* P-drops with data */ michael@0: uint32_t sctps_pdrpmbct; /* P-drops, non-data, non-endhost */ michael@0: uint32_t sctps_pdrpbwrpt; /* P-drop, non-endhost, bandwidth rep only */ michael@0: uint32_t sctps_pdrpcrupt; /* P-drop, not enough for chunk header */ michael@0: uint32_t sctps_pdrpnedat; /* P-drop, not enough data to confirm */ michael@0: uint32_t sctps_pdrppdbrk; /* P-drop, where process_chunk_drop said break */ michael@0: uint32_t sctps_pdrptsnnf; /* P-drop, could not find TSN */ michael@0: uint32_t sctps_pdrpdnfnd; /* P-drop, attempt reverse TSN lookup */ michael@0: uint32_t sctps_pdrpdiwnp; /* P-drop, e-host confirms zero-rwnd */ michael@0: uint32_t sctps_pdrpdizrw; /* P-drop, midbox confirms no space */ michael@0: uint32_t sctps_pdrpbadd; /* P-drop, data did not match TSN */ michael@0: uint32_t sctps_pdrpmark; /* P-drop, TSN's marked for Fast Retran */ michael@0: /* timeouts */ michael@0: uint32_t sctps_timoiterator; /* Number of iterator timers that fired */ michael@0: uint32_t sctps_timodata; /* Number of T3 data time outs */ michael@0: uint32_t sctps_timowindowprobe; /* Number of window probe (T3) timers that fired */ michael@0: uint32_t sctps_timoinit; /* Number of INIT timers that fired */ michael@0: uint32_t sctps_timosack; /* Number of sack timers that fired */ michael@0: uint32_t sctps_timoshutdown; /* Number of shutdown timers that fired */ michael@0: uint32_t sctps_timoheartbeat; /* Number of heartbeat timers that fired */ michael@0: uint32_t sctps_timocookie; /* Number of times a cookie timeout fired */ michael@0: uint32_t sctps_timosecret; /* Number of times an endpoint changed its cookie secret*/ michael@0: uint32_t sctps_timopathmtu; /* Number of PMTU timers that fired */ michael@0: uint32_t sctps_timoshutdownack; /* Number of shutdown ack timers that fired */ michael@0: uint32_t sctps_timoshutdownguard; /* Number of shutdown guard timers that fired */ michael@0: uint32_t sctps_timostrmrst; /* Number of stream reset timers that fired */ michael@0: uint32_t sctps_timoearlyfr; /* Number of early FR timers that fired */ michael@0: uint32_t sctps_timoasconf; /* Number of times an asconf timer fired */ michael@0: uint32_t sctps_timodelprim; /* Number of times a prim_deleted timer fired */ michael@0: uint32_t sctps_timoautoclose; /* Number of times auto close timer fired */ michael@0: uint32_t sctps_timoassockill; /* Number of asoc free timers expired */ michael@0: uint32_t sctps_timoinpkill; /* Number of inp free timers expired */ michael@0: /* former early FR counters */ michael@0: uint32_t sctps_spare[11]; michael@0: /* others */ michael@0: uint32_t sctps_hdrops; /* packet shorter than header */ michael@0: uint32_t sctps_badsum; /* checksum error */ michael@0: uint32_t sctps_noport; /* no endpoint for port */ michael@0: uint32_t sctps_badvtag; /* bad v-tag */ michael@0: uint32_t sctps_badsid; /* bad SID */ michael@0: uint32_t sctps_nomem; /* no memory */ michael@0: uint32_t sctps_fastretransinrtt; /* number of multiple FR in a RTT window */ michael@0: uint32_t sctps_markedretrans; michael@0: uint32_t sctps_naglesent; /* nagle allowed sending */ michael@0: uint32_t sctps_naglequeued; /* nagle doesn't allow sending */ michael@0: uint32_t sctps_maxburstqueued; /* max burst doesn't allow sending */ michael@0: uint32_t sctps_ifnomemqueued; /* look ahead tells us no memory in michael@0: * interface ring buffer OR we had a michael@0: * send error and are queuing one send. michael@0: */ michael@0: uint32_t sctps_windowprobed; /* total number of window probes sent */ michael@0: uint32_t sctps_lowlevelerr; /* total times an output error causes us michael@0: * to clamp down on next user send. michael@0: */ michael@0: uint32_t sctps_lowlevelerrusr; /* total times sctp_senderrors were caused from michael@0: * a user send from a user invoked send not michael@0: * a sack response michael@0: */ michael@0: uint32_t sctps_datadropchklmt; /* Number of in data drops due to chunk limit reached */ michael@0: uint32_t sctps_datadroprwnd; /* Number of in data drops due to rwnd limit reached */ michael@0: uint32_t sctps_ecnereducedcwnd; /* Number of times a ECN reduced the cwnd */ michael@0: uint32_t sctps_vtagexpress; /* Used express lookup via vtag */ michael@0: uint32_t sctps_vtagbogus; /* Collision in express lookup. */ michael@0: uint32_t sctps_primary_randry; /* Number of times the sender ran dry of user data on primary */ michael@0: uint32_t sctps_cmt_randry; /* Same for above */ michael@0: uint32_t sctps_slowpath_sack; /* Sacks the slow way */ michael@0: uint32_t sctps_wu_sacks_sent; /* Window Update only sacks sent */ michael@0: uint32_t sctps_sends_with_flags; /* number of sends with sinfo_flags !=0 */ michael@0: uint32_t sctps_sends_with_unord; /* number of unordered sends */ michael@0: uint32_t sctps_sends_with_eof; /* number of sends with EOF flag set */ michael@0: uint32_t sctps_sends_with_abort; /* number of sends with ABORT flag set */ michael@0: uint32_t sctps_protocol_drain_calls; /* number of times protocol drain called */ michael@0: uint32_t sctps_protocol_drains_done; /* number of times we did a protocol drain */ michael@0: uint32_t sctps_read_peeks; /* Number of times recv was called with peek */ michael@0: uint32_t sctps_cached_chk; /* Number of cached chunks used */ michael@0: uint32_t sctps_cached_strmoq; /* Number of cached stream oq's used */ michael@0: uint32_t sctps_left_abandon; /* Number of unread messages abandoned by close */ michael@0: uint32_t sctps_send_burst_avoid; /* Unused */ michael@0: uint32_t sctps_send_cwnd_avoid; /* Send cwnd full avoidance, already max burst inflight to net */ michael@0: uint32_t sctps_fwdtsn_map_over; /* number of map array over-runs via fwd-tsn's */ michael@0: uint32_t sctps_queue_upd_ecne; /* Number of times we queued or updated an ECN chunk on send queue */ michael@0: uint32_t sctps_reserved[31]; /* Future ABI compat - remove int's from here when adding new */ michael@0: }; michael@0: michael@0: #define SCTP_STAT_INCR(_x) SCTP_STAT_INCR_BY(_x,1) michael@0: #define SCTP_STAT_DECR(_x) SCTP_STAT_DECR_BY(_x,1) michael@0: #if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT) michael@0: #define SCTP_STAT_INCR_BY(_x,_d) (SCTP_BASE_STATS[PCPU_GET(cpuid)]._x += _d) michael@0: #define SCTP_STAT_DECR_BY(_x,_d) (SCTP_BASE_STATS[PCPU_GET(cpuid)]._x -= _d) michael@0: #else michael@0: #define SCTP_STAT_INCR_BY(_x,_d) atomic_add_int(&SCTP_BASE_STAT(_x), _d) michael@0: #define SCTP_STAT_DECR_BY(_x,_d) atomic_subtract_int(&SCTP_BASE_STAT(_x), _d) michael@0: #endif michael@0: /* The following macros are for handling MIB values, */ michael@0: #define SCTP_STAT_INCR_COUNTER32(_x) SCTP_STAT_INCR(_x) michael@0: #define SCTP_STAT_INCR_COUNTER64(_x) SCTP_STAT_INCR(_x) michael@0: #define SCTP_STAT_INCR_GAUGE32(_x) SCTP_STAT_INCR(_x) michael@0: #define SCTP_STAT_DECR_COUNTER32(_x) SCTP_STAT_DECR(_x) michael@0: #define SCTP_STAT_DECR_COUNTER64(_x) SCTP_STAT_DECR(_x) michael@0: #define SCTP_STAT_DECR_GAUGE32(_x) SCTP_STAT_DECR(_x) michael@0: michael@0: #if defined(__Userspace__) michael@0: union sctp_sockstore { michael@0: #if defined(INET) michael@0: struct sockaddr_in sin; michael@0: #endif michael@0: #if defined(INET6) michael@0: struct sockaddr_in6 sin6; michael@0: #endif michael@0: struct sockaddr_conn sconn; michael@0: struct sockaddr sa; michael@0: }; michael@0: #else michael@0: union sctp_sockstore { michael@0: struct sockaddr_in sin; michael@0: struct sockaddr_in6 sin6; michael@0: struct sockaddr sa; michael@0: }; michael@0: #endif michael@0: michael@0: michael@0: /***********************************/ michael@0: /* And something for us old timers */ michael@0: /***********************************/ michael@0: michael@0: #ifndef __APPLE__ michael@0: #ifndef __Userspace__ michael@0: #ifndef ntohll michael@0: #if defined(__Userspace_os_Linux) michael@0: #ifndef _BSD_SOURCE michael@0: #define _BSD_SOURCE michael@0: #endif michael@0: #include michael@0: #else michael@0: #include michael@0: #endif michael@0: #define ntohll(x) be64toh(x) michael@0: #endif michael@0: michael@0: #ifndef htonll michael@0: #if defined(__Userspace_os_Linux) michael@0: #ifndef _BSD_SOURCE michael@0: #define _BSD_SOURCE michael@0: #endif michael@0: #include michael@0: #else michael@0: #include michael@0: #endif michael@0: #define htonll(x) htobe64(x) michael@0: #endif michael@0: #endif michael@0: #endif michael@0: /***********************************/ michael@0: michael@0: michael@0: struct xsctp_inpcb { michael@0: uint32_t last; michael@0: uint32_t flags; michael@0: #if defined(__FreeBSD__) && __FreeBSD_version < 1000048 michael@0: uint32_t features; michael@0: #else michael@0: uint64_t features; michael@0: #endif michael@0: uint32_t total_sends; michael@0: uint32_t total_recvs; michael@0: uint32_t total_nospaces; michael@0: uint32_t fragmentation_point; michael@0: uint16_t local_port; michael@0: uint16_t qlen; michael@0: uint16_t maxqlen; michael@0: #if defined(__Windows__) michael@0: uint16_t padding; michael@0: #endif michael@0: #if defined(__FreeBSD__) && __FreeBSD_version < 1000048 michael@0: uint32_t extra_padding[32]; /* future */ michael@0: #else michael@0: uint32_t extra_padding[31]; /* future */ michael@0: #endif michael@0: }; michael@0: michael@0: struct xsctp_tcb { michael@0: union sctp_sockstore primary_addr; /* sctpAssocEntry 5/6 */ michael@0: uint32_t last; michael@0: uint32_t heartbeat_interval; /* sctpAssocEntry 7 */ michael@0: uint32_t state; /* sctpAssocEntry 8 */ michael@0: uint32_t in_streams; /* sctpAssocEntry 9 */ michael@0: uint32_t out_streams; /* sctpAssocEntry 10 */ michael@0: uint32_t max_nr_retrans; /* sctpAssocEntry 11 */ michael@0: uint32_t primary_process; /* sctpAssocEntry 12 */ michael@0: uint32_t T1_expireries; /* sctpAssocEntry 13 */ michael@0: uint32_t T2_expireries; /* sctpAssocEntry 14 */ michael@0: uint32_t retransmitted_tsns; /* sctpAssocEntry 15 */ michael@0: uint32_t total_sends; michael@0: uint32_t total_recvs; michael@0: uint32_t local_tag; michael@0: uint32_t remote_tag; michael@0: uint32_t initial_tsn; michael@0: uint32_t highest_tsn; michael@0: uint32_t cumulative_tsn; michael@0: uint32_t cumulative_tsn_ack; michael@0: uint32_t mtu; michael@0: uint32_t refcnt; michael@0: uint16_t local_port; /* sctpAssocEntry 3 */ michael@0: uint16_t remote_port; /* sctpAssocEntry 4 */ michael@0: struct sctp_timeval start_time; /* sctpAssocEntry 16 */ michael@0: struct sctp_timeval discontinuity_time; /* sctpAssocEntry 17 */ michael@0: #if defined(__FreeBSD__) michael@0: #if __FreeBSD_version >= 800000 michael@0: uint32_t peers_rwnd; michael@0: sctp_assoc_t assoc_id; /* sctpAssocEntry 1 */ michael@0: uint32_t extra_padding[32]; /* future */ michael@0: #else michael@0: #endif michael@0: #else michael@0: uint32_t peers_rwnd; michael@0: sctp_assoc_t assoc_id; /* sctpAssocEntry 1 */ michael@0: uint32_t extra_padding[32]; /* future */ michael@0: #endif michael@0: }; michael@0: michael@0: struct xsctp_laddr { michael@0: union sctp_sockstore address; /* sctpAssocLocalAddrEntry 1/2 */ michael@0: uint32_t last; michael@0: struct sctp_timeval start_time; /* sctpAssocLocalAddrEntry 3 */ michael@0: uint32_t extra_padding[32]; /* future */ michael@0: }; michael@0: michael@0: struct xsctp_raddr { michael@0: union sctp_sockstore address; /* sctpAssocLocalRemEntry 1/2 */ michael@0: uint32_t last; michael@0: uint32_t rto; /* sctpAssocLocalRemEntry 5 */ michael@0: uint32_t max_path_rtx; /* sctpAssocLocalRemEntry 6 */ michael@0: uint32_t rtx; /* sctpAssocLocalRemEntry 7 */ michael@0: uint32_t error_counter; /* */ michael@0: uint32_t cwnd; /* */ michael@0: uint32_t flight_size; /* */ michael@0: uint32_t mtu; /* */ michael@0: uint8_t active; /* sctpAssocLocalRemEntry 3 */ michael@0: uint8_t confirmed; /* */ michael@0: uint8_t heartbeat_enabled; /* sctpAssocLocalRemEntry 4 */ michael@0: uint8_t potentially_failed; michael@0: struct sctp_timeval start_time; /* sctpAssocLocalRemEntry 8 */ michael@0: #if defined(__FreeBSD__) michael@0: #if __FreeBSD_version >= 800000 michael@0: uint32_t rtt; michael@0: uint32_t heartbeat_interval; michael@0: uint32_t extra_padding[31]; /* future */ michael@0: #endif michael@0: #else michael@0: uint32_t rtt; michael@0: uint32_t heartbeat_interval; michael@0: uint32_t extra_padding[31]; /* future */ michael@0: #endif michael@0: }; michael@0: michael@0: #define SCTP_MAX_LOGGING_SIZE 30000 michael@0: #define SCTP_TRACE_PARAMS 6 /* This number MUST be even */ michael@0: michael@0: struct sctp_log_entry { michael@0: uint64_t timestamp; michael@0: uint32_t subsys; michael@0: uint32_t padding; michael@0: uint32_t params[SCTP_TRACE_PARAMS]; michael@0: }; michael@0: michael@0: struct sctp_log { michael@0: struct sctp_log_entry entry[SCTP_MAX_LOGGING_SIZE]; michael@0: uint32_t index; michael@0: uint32_t padding; michael@0: }; michael@0: michael@0: /* michael@0: * Kernel defined for sctp_send michael@0: */ michael@0: #if defined(_KERNEL) || defined(__Userspace__) michael@0: int michael@0: sctp_lower_sosend(struct socket *so, michael@0: struct sockaddr *addr, michael@0: struct uio *uio, michael@0: #if defined(__Panda__) michael@0: pakhandle_type i_pak, michael@0: pakhandle_type i_control, michael@0: #else michael@0: struct mbuf *i_pak, michael@0: struct mbuf *control, michael@0: #endif michael@0: int flags, michael@0: struct sctp_sndrcvinfo *srcv michael@0: #if !(defined(__Panda__) || defined(__Userspace__)) michael@0: #if defined(__FreeBSD__) && __FreeBSD_version >= 500000 michael@0: ,struct thread *p michael@0: #elif defined(__Windows__) michael@0: , PKTHREAD p michael@0: #else michael@0: ,struct proc *p michael@0: #endif michael@0: #endif michael@0: ); michael@0: michael@0: int michael@0: sctp_sorecvmsg(struct socket *so, michael@0: struct uio *uio, michael@0: #if defined(__Panda__) michael@0: particletype **mp, michael@0: #else michael@0: struct mbuf **mp, michael@0: #endif michael@0: struct sockaddr *from, michael@0: int fromlen, michael@0: int *msg_flags, michael@0: struct sctp_sndrcvinfo *sinfo, michael@0: int filling_sinfo); michael@0: #endif michael@0: michael@0: /* michael@0: * API system calls michael@0: */ michael@0: #if !(defined(_KERNEL)) && !(defined(__Userspace__)) michael@0: michael@0: __BEGIN_DECLS michael@0: #if defined(__FreeBSD__) && __FreeBSD_version < 902000 michael@0: int sctp_peeloff __P((int, sctp_assoc_t)); michael@0: int sctp_bindx __P((int, struct sockaddr *, int, int)); michael@0: int sctp_connectx __P((int, const struct sockaddr *, int, sctp_assoc_t *)); michael@0: int sctp_getaddrlen __P((sa_family_t)); michael@0: int sctp_getpaddrs __P((int, sctp_assoc_t, struct sockaddr **)); michael@0: void sctp_freepaddrs __P((struct sockaddr *)); michael@0: int sctp_getladdrs __P((int, sctp_assoc_t, struct sockaddr **)); michael@0: void sctp_freeladdrs __P((struct sockaddr *)); michael@0: int sctp_opt_info __P((int, sctp_assoc_t, int, void *, socklen_t *)); michael@0: michael@0: /* deprecated */ michael@0: ssize_t sctp_sendmsg __P((int, const void *, size_t, const struct sockaddr *, michael@0: socklen_t, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t)); michael@0: michael@0: /* deprecated */ michael@0: ssize_t sctp_send __P((int, const void *, size_t, michael@0: const struct sctp_sndrcvinfo *, int)); michael@0: michael@0: /* deprecated */ michael@0: ssize_t sctp_sendx __P((int, const void *, size_t, struct sockaddr *, michael@0: int, struct sctp_sndrcvinfo *, int)); michael@0: michael@0: /* deprecated */ michael@0: ssize_t sctp_sendmsgx __P((int sd, const void *, size_t, struct sockaddr *, michael@0: int, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t)); michael@0: michael@0: sctp_assoc_t sctp_getassocid __P((int, struct sockaddr *)); michael@0: michael@0: /* deprecated */ michael@0: ssize_t sctp_recvmsg __P((int, void *, size_t, struct sockaddr *, socklen_t *, michael@0: struct sctp_sndrcvinfo *, int *)); michael@0: michael@0: ssize_t sctp_sendv __P((int, const struct iovec *, int, struct sockaddr *, michael@0: int, void *, socklen_t, unsigned int, int)); michael@0: michael@0: ssize_t sctp_recvv __P((int, const struct iovec *, int, struct sockaddr *, michael@0: socklen_t *, void *, socklen_t *, unsigned int *, int *)); michael@0: #else michael@0: int sctp_peeloff(int, sctp_assoc_t); michael@0: int sctp_bindx(int, struct sockaddr *, int, int); michael@0: int sctp_connectx(int, const struct sockaddr *, int, sctp_assoc_t *); michael@0: int sctp_getaddrlen(sa_family_t); michael@0: int sctp_getpaddrs(int, sctp_assoc_t, struct sockaddr **); michael@0: void sctp_freepaddrs(struct sockaddr *); michael@0: int sctp_getladdrs(int, sctp_assoc_t, struct sockaddr **); michael@0: void sctp_freeladdrs(struct sockaddr *); michael@0: int sctp_opt_info(int, sctp_assoc_t, int, void *, socklen_t *); michael@0: michael@0: /* deprecated */ michael@0: ssize_t sctp_sendmsg(int, const void *, size_t, const struct sockaddr *, michael@0: socklen_t, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t); michael@0: michael@0: /* deprecated */ michael@0: ssize_t sctp_send(int, const void *, size_t, michael@0: const struct sctp_sndrcvinfo *, int); michael@0: michael@0: /* deprecated */ michael@0: ssize_t sctp_sendx(int, const void *, size_t, struct sockaddr *, michael@0: int, struct sctp_sndrcvinfo *, int); michael@0: michael@0: /* deprecated */ michael@0: ssize_t sctp_sendmsgx(int sd, const void *, size_t, struct sockaddr *, michael@0: int, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t); michael@0: michael@0: sctp_assoc_t sctp_getassocid(int, struct sockaddr *); michael@0: michael@0: /* deprecated */ michael@0: ssize_t sctp_recvmsg(int, void *, size_t, struct sockaddr *, socklen_t *, michael@0: struct sctp_sndrcvinfo *, int *); michael@0: michael@0: ssize_t sctp_sendv(int, const struct iovec *, int, struct sockaddr *, michael@0: int, void *, socklen_t, unsigned int, int); michael@0: michael@0: ssize_t sctp_recvv(int, const struct iovec *, int, struct sockaddr *, michael@0: socklen_t *, void *, socklen_t *, unsigned int *, int *); michael@0: #endif michael@0: __END_DECLS michael@0: michael@0: #endif /* !_KERNEL */ michael@0: #endif /* !__sctp_uio_h__ */