/*
* Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Cisco Systems, Inc.
* 4. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY CISCO SYSTEMS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL CISCO SYSTEMS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/types.h>
/*
* SCTP protocol - RFC2960.
*/
struct sctphdr {
u_int16_t src_port; /* source port */
u_int16_t dest_port; /* destination port */
u_int32_t v_tag; /* verification tag of packet */
u_int32_t checksum; /* Adler32 C-Sum */
/* chunks follow... */
} __packed;
/* ancillary data/notification interest options */
#define SCTP_EVENTS 0x0000000a
/* sctp_opt_info params */
#define SCTP_PEER_ADDR_PARAMS 0x0000000b
#define SCTP_GET_PEER_ADDR_INFO 0x0000000c
/* Hidden socket option that gets the addresses */
#define SCTP_GET_PEER_ADDRESSES 0x0000000d
#define SCTP_GET_LOCAL_ADDRESSES 0x0000000e
/*
* Blocking I/O is enabled on any TCP type socket by default.
* For the UDP model if this is turned on then the socket buffer is
* shared for send resources amongst all associations. The default
* for the UDP model is that is SS_NBIO is set. Which means all associations
* have a separate send limit BUT they will NOT ever BLOCK instead
* you will get an error back EAGAIN if you try to send too much. If
* you want the blocking symantics you set this option at the cost
* of sharing one socket send buffer size amongst all associations.
* Peeled off sockets turn this option off and block... but since both TCP and
* peeled off sockets have only one assoc per socket this is fine.
* It probably does NOT make sense to set this on SS_NBIO on a TCP model OR
* peeled off UDP model, but we do allow you to do so. You just use
* the normal syscall to toggle SS_NBIO the way you want.
*/
/* Blocking I/O is controlled by the SS_NBIO flag on the
* socket state so_state field.
*/
#define SCTP_GET_SNDBUF_USE 0x0000000f
/* latter added read/write */
#define SCTP_ADAPTION_LAYER 0x00000010
#define SCTP_DISABLE_FRAGMENTS 0x00000011
/* sctp_bindx() flags as socket options */
#define SCTP_BINDX_ADD_ADDR 0x00000012
#define SCTP_BINDX_REM_ADDR 0x00000013
/* return the total count in bytes needed to hold all local addresses bound */
#define SCTP_GET_LOCAL_ADDR_SIZE 0x00000014
/* Without this applied we will give V4 and V6 addresses on a V6 socket */
#define SCTP_I_WANT_MAPPED_V4_ADDR 0x00000015
/* Return the total count in bytes needed to hold the remote address */
#define SCTP_GET_REMOTE_ADDR_SIZE 0x00000016
#define SCTP_GET_PEGS 0x00000017
#define SCTP_DEFAULT_SEND_PARAM 0x00000018
#define SCTP_SET_DEBUG_LEVEL 0x00000019
#define SCTP_RTOINFO 0x0000001a
#define SCTP_AUTO_ASCONF 0x0000001b
#define SCTP_MAXBURST 0x0000001c
#define SCTP_GET_STAT_LOG 0x0000001d
#define SCTP_CONNECT_X 0x0000001e /* hidden opt for connectx */
#define SCTP_RESET_STREAMS 0x0000001f
#define SCTP_CONNECT_X_DELAYED 0x00000020 /* hidden opt for connectx_delayed
* part of sctp_sendx()
*/
#define SCTP_CONNECT_X_COMPLETE 0x00000021
#define SCTP_GET_ASOC_ID_LIST 0x00000022
/* Things for the AUTH draft possibly */
#define SCTP_PEER_PUBLIC_KEY 0x00000100 /* get the peers public key */
#define SCTP_MY_PUBLIC_KEY 0x00000101 /* get/set my endpoints public key */
#define SCTP_SET_AUTH_SECRET 0x00000102 /* get/set my shared secret */
#define SCTP_SET_AUTH_CHUNKS 0x00000103 /* specify what chunks you want
* the system may have additional requirements
* as well. I.e. probably ASCONF/ASCONF-ACK no matter
* if you want it or not.
*/
/* Debug things that need to be purged */
#define SCTP_SET_INITIAL_DBG_SEQ 0x00001f00
#define SCTP_RESET_PEGS 0x00002000
#define SCTP_CLR_STAT_LOG 0x00002100
/*
* error cause parameters (user visible)
*/
struct sctp_error_cause {
u_int16_t code;
u_int16_t length;
/* optional cause-specific info may follow */
} __packed;
struct sctp_error_invalid_stream {
struct sctp_error_cause cause; /* code=SCTP_ERROR_INVALID_STREAM */
u_int16_t stream_id; /* stream id of the DATA in error */
u_int16_t reserved;
} __packed;
#define SCTP_SAT_NETWORK_MIN 400 /* min ms for RTT to set satellite time */
#define SCTP_SAT_NETWORK_BURST_INCR 2 /* how many times to multiply maxburst in sat */
/* Data Chunk Specific Flags */
#define SCTP_DATA_FRAG_MASK 0x03
#define SCTP_DATA_MIDDLE_FRAG 0x00
#define SCTP_DATA_LAST_FRAG 0x01
#define SCTP_DATA_FIRST_FRAG 0x02
#define SCTP_DATA_NOT_FRAG 0x03
#define SCTP_DATA_UNORDERED 0x04