1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ 2*4882a593Smuzhiyun /* SCTP kernel implementation 3*4882a593Smuzhiyun * (C) Copyright IBM Corp. 2001, 2004 4*4882a593Smuzhiyun * Copyright (c) 1999-2000 Cisco, Inc. 5*4882a593Smuzhiyun * Copyright (c) 1999-2001 Motorola, Inc. 6*4882a593Smuzhiyun * Copyright (c) 2002 Intel Corp. 7*4882a593Smuzhiyun * 8*4882a593Smuzhiyun * This file is part of the SCTP kernel implementation 9*4882a593Smuzhiyun * 10*4882a593Smuzhiyun * This header represents the structures and constants needed to support 11*4882a593Smuzhiyun * the SCTP Extension to the Sockets API. 12*4882a593Smuzhiyun * 13*4882a593Smuzhiyun * This SCTP implementation is free software; 14*4882a593Smuzhiyun * you can redistribute it and/or modify it under the terms of 15*4882a593Smuzhiyun * the GNU General Public License as published by 16*4882a593Smuzhiyun * the Free Software Foundation; either version 2, or (at your option) 17*4882a593Smuzhiyun * any later version. 18*4882a593Smuzhiyun * 19*4882a593Smuzhiyun * This SCTP implementation is distributed in the hope that it 20*4882a593Smuzhiyun * will be useful, but WITHOUT ANY WARRANTY; without even the implied 21*4882a593Smuzhiyun * ************************ 22*4882a593Smuzhiyun * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 23*4882a593Smuzhiyun * See the GNU General Public License for more details. 24*4882a593Smuzhiyun * 25*4882a593Smuzhiyun * You should have received a copy of the GNU General Public License 26*4882a593Smuzhiyun * along with GNU CC; see the file COPYING. If not, see 27*4882a593Smuzhiyun * <http://www.gnu.org/licenses/>. 28*4882a593Smuzhiyun * 29*4882a593Smuzhiyun * Please send any bug reports or fixes you make to the 30*4882a593Smuzhiyun * email address(es): 31*4882a593Smuzhiyun * lksctp developers <linux-sctp@vger.kernel.org> 32*4882a593Smuzhiyun * 33*4882a593Smuzhiyun * Or submit a bug report through the following website: 34*4882a593Smuzhiyun * http://www.sf.net/projects/lksctp 35*4882a593Smuzhiyun * 36*4882a593Smuzhiyun * Written or modified by: 37*4882a593Smuzhiyun * La Monte H.P. Yarroll <piggy@acm.org> 38*4882a593Smuzhiyun * R. Stewart <randall@sctp.chicago.il.us> 39*4882a593Smuzhiyun * K. Morneau <kmorneau@cisco.com> 40*4882a593Smuzhiyun * Q. Xie <qxie1@email.mot.com> 41*4882a593Smuzhiyun * Karl Knutson <karl@athena.chicago.il.us> 42*4882a593Smuzhiyun * Jon Grimm <jgrimm@us.ibm.com> 43*4882a593Smuzhiyun * Daisy Chang <daisyc@us.ibm.com> 44*4882a593Smuzhiyun * Ryan Layer <rmlayer@us.ibm.com> 45*4882a593Smuzhiyun * Ardelle Fan <ardelle.fan@intel.com> 46*4882a593Smuzhiyun * Sridhar Samudrala <sri@us.ibm.com> 47*4882a593Smuzhiyun * Inaky Perez-Gonzalez <inaky.gonzalez@intel.com> 48*4882a593Smuzhiyun * Vlad Yasevich <vladislav.yasevich@hp.com> 49*4882a593Smuzhiyun * 50*4882a593Smuzhiyun * Any bugs reported given to us we will try to fix... any fixes shared will 51*4882a593Smuzhiyun * be incorporated into the next SCTP release. 52*4882a593Smuzhiyun */ 53*4882a593Smuzhiyun 54*4882a593Smuzhiyun #ifndef _UAPI_SCTP_H 55*4882a593Smuzhiyun #define _UAPI_SCTP_H 56*4882a593Smuzhiyun 57*4882a593Smuzhiyun #include <linux/types.h> 58*4882a593Smuzhiyun #include <linux/socket.h> 59*4882a593Smuzhiyun 60*4882a593Smuzhiyun typedef __s32 sctp_assoc_t; 61*4882a593Smuzhiyun 62*4882a593Smuzhiyun #define SCTP_FUTURE_ASSOC 0 63*4882a593Smuzhiyun #define SCTP_CURRENT_ASSOC 1 64*4882a593Smuzhiyun #define SCTP_ALL_ASSOC 2 65*4882a593Smuzhiyun 66*4882a593Smuzhiyun /* The following symbols come from the Sockets API Extensions for 67*4882a593Smuzhiyun * SCTP <draft-ietf-tsvwg-sctpsocket-07.txt>. 68*4882a593Smuzhiyun */ 69*4882a593Smuzhiyun #define SCTP_RTOINFO 0 70*4882a593Smuzhiyun #define SCTP_ASSOCINFO 1 71*4882a593Smuzhiyun #define SCTP_INITMSG 2 72*4882a593Smuzhiyun #define SCTP_NODELAY 3 /* Get/set nodelay option. */ 73*4882a593Smuzhiyun #define SCTP_AUTOCLOSE 4 74*4882a593Smuzhiyun #define SCTP_SET_PEER_PRIMARY_ADDR 5 75*4882a593Smuzhiyun #define SCTP_PRIMARY_ADDR 6 76*4882a593Smuzhiyun #define SCTP_ADAPTATION_LAYER 7 77*4882a593Smuzhiyun #define SCTP_DISABLE_FRAGMENTS 8 78*4882a593Smuzhiyun #define SCTP_PEER_ADDR_PARAMS 9 79*4882a593Smuzhiyun #define SCTP_DEFAULT_SEND_PARAM 10 80*4882a593Smuzhiyun #define SCTP_EVENTS 11 81*4882a593Smuzhiyun #define SCTP_I_WANT_MAPPED_V4_ADDR 12 /* Turn on/off mapped v4 addresses */ 82*4882a593Smuzhiyun #define SCTP_MAXSEG 13 /* Get/set maximum fragment. */ 83*4882a593Smuzhiyun #define SCTP_STATUS 14 84*4882a593Smuzhiyun #define SCTP_GET_PEER_ADDR_INFO 15 85*4882a593Smuzhiyun #define SCTP_DELAYED_ACK_TIME 16 86*4882a593Smuzhiyun #define SCTP_DELAYED_ACK SCTP_DELAYED_ACK_TIME 87*4882a593Smuzhiyun #define SCTP_DELAYED_SACK SCTP_DELAYED_ACK_TIME 88*4882a593Smuzhiyun #define SCTP_CONTEXT 17 89*4882a593Smuzhiyun #define SCTP_FRAGMENT_INTERLEAVE 18 90*4882a593Smuzhiyun #define SCTP_PARTIAL_DELIVERY_POINT 19 /* Set/Get partial delivery point */ 91*4882a593Smuzhiyun #define SCTP_MAX_BURST 20 /* Set/Get max burst */ 92*4882a593Smuzhiyun #define SCTP_AUTH_CHUNK 21 /* Set only: add a chunk type to authenticate */ 93*4882a593Smuzhiyun #define SCTP_HMAC_IDENT 22 94*4882a593Smuzhiyun #define SCTP_AUTH_KEY 23 95*4882a593Smuzhiyun #define SCTP_AUTH_ACTIVE_KEY 24 96*4882a593Smuzhiyun #define SCTP_AUTH_DELETE_KEY 25 97*4882a593Smuzhiyun #define SCTP_PEER_AUTH_CHUNKS 26 /* Read only */ 98*4882a593Smuzhiyun #define SCTP_LOCAL_AUTH_CHUNKS 27 /* Read only */ 99*4882a593Smuzhiyun #define SCTP_GET_ASSOC_NUMBER 28 /* Read only */ 100*4882a593Smuzhiyun #define SCTP_GET_ASSOC_ID_LIST 29 /* Read only */ 101*4882a593Smuzhiyun #define SCTP_AUTO_ASCONF 30 102*4882a593Smuzhiyun #define SCTP_PEER_ADDR_THLDS 31 103*4882a593Smuzhiyun #define SCTP_RECVRCVINFO 32 104*4882a593Smuzhiyun #define SCTP_RECVNXTINFO 33 105*4882a593Smuzhiyun #define SCTP_DEFAULT_SNDINFO 34 106*4882a593Smuzhiyun #define SCTP_AUTH_DEACTIVATE_KEY 35 107*4882a593Smuzhiyun #define SCTP_REUSE_PORT 36 108*4882a593Smuzhiyun #define SCTP_PEER_ADDR_THLDS_V2 37 109*4882a593Smuzhiyun 110*4882a593Smuzhiyun /* Internal Socket Options. Some of the sctp library functions are 111*4882a593Smuzhiyun * implemented using these socket options. 112*4882a593Smuzhiyun */ 113*4882a593Smuzhiyun #define SCTP_SOCKOPT_BINDX_ADD 100 /* BINDX requests for adding addrs */ 114*4882a593Smuzhiyun #define SCTP_SOCKOPT_BINDX_REM 101 /* BINDX requests for removing addrs. */ 115*4882a593Smuzhiyun #define SCTP_SOCKOPT_PEELOFF 102 /* peel off association. */ 116*4882a593Smuzhiyun /* Options 104-106 are deprecated and removed. Do not use this space */ 117*4882a593Smuzhiyun #define SCTP_SOCKOPT_CONNECTX_OLD 107 /* CONNECTX old requests. */ 118*4882a593Smuzhiyun #define SCTP_GET_PEER_ADDRS 108 /* Get all peer address. */ 119*4882a593Smuzhiyun #define SCTP_GET_LOCAL_ADDRS 109 /* Get all local address. */ 120*4882a593Smuzhiyun #define SCTP_SOCKOPT_CONNECTX 110 /* CONNECTX requests. */ 121*4882a593Smuzhiyun #define SCTP_SOCKOPT_CONNECTX3 111 /* CONNECTX requests (updated) */ 122*4882a593Smuzhiyun #define SCTP_GET_ASSOC_STATS 112 /* Read only */ 123*4882a593Smuzhiyun #define SCTP_PR_SUPPORTED 113 124*4882a593Smuzhiyun #define SCTP_DEFAULT_PRINFO 114 125*4882a593Smuzhiyun #define SCTP_PR_ASSOC_STATUS 115 126*4882a593Smuzhiyun #define SCTP_PR_STREAM_STATUS 116 127*4882a593Smuzhiyun #define SCTP_RECONFIG_SUPPORTED 117 128*4882a593Smuzhiyun #define SCTP_ENABLE_STREAM_RESET 118 129*4882a593Smuzhiyun #define SCTP_RESET_STREAMS 119 130*4882a593Smuzhiyun #define SCTP_RESET_ASSOC 120 131*4882a593Smuzhiyun #define SCTP_ADD_STREAMS 121 132*4882a593Smuzhiyun #define SCTP_SOCKOPT_PEELOFF_FLAGS 122 133*4882a593Smuzhiyun #define SCTP_STREAM_SCHEDULER 123 134*4882a593Smuzhiyun #define SCTP_STREAM_SCHEDULER_VALUE 124 135*4882a593Smuzhiyun #define SCTP_INTERLEAVING_SUPPORTED 125 136*4882a593Smuzhiyun #define SCTP_SENDMSG_CONNECT 126 137*4882a593Smuzhiyun #define SCTP_EVENT 127 138*4882a593Smuzhiyun #define SCTP_ASCONF_SUPPORTED 128 139*4882a593Smuzhiyun #define SCTP_AUTH_SUPPORTED 129 140*4882a593Smuzhiyun #define SCTP_ECN_SUPPORTED 130 141*4882a593Smuzhiyun #define SCTP_EXPOSE_POTENTIALLY_FAILED_STATE 131 142*4882a593Smuzhiyun #define SCTP_EXPOSE_PF_STATE SCTP_EXPOSE_POTENTIALLY_FAILED_STATE 143*4882a593Smuzhiyun 144*4882a593Smuzhiyun /* PR-SCTP policies */ 145*4882a593Smuzhiyun #define SCTP_PR_SCTP_NONE 0x0000 146*4882a593Smuzhiyun #define SCTP_PR_SCTP_TTL 0x0010 147*4882a593Smuzhiyun #define SCTP_PR_SCTP_RTX 0x0020 148*4882a593Smuzhiyun #define SCTP_PR_SCTP_PRIO 0x0030 149*4882a593Smuzhiyun #define SCTP_PR_SCTP_MAX SCTP_PR_SCTP_PRIO 150*4882a593Smuzhiyun #define SCTP_PR_SCTP_MASK 0x0030 151*4882a593Smuzhiyun 152*4882a593Smuzhiyun #define __SCTP_PR_INDEX(x) ((x >> 4) - 1) 153*4882a593Smuzhiyun #define SCTP_PR_INDEX(x) __SCTP_PR_INDEX(SCTP_PR_SCTP_ ## x) 154*4882a593Smuzhiyun 155*4882a593Smuzhiyun #define SCTP_PR_POLICY(x) ((x) & SCTP_PR_SCTP_MASK) 156*4882a593Smuzhiyun #define SCTP_PR_SET_POLICY(flags, x) \ 157*4882a593Smuzhiyun do { \ 158*4882a593Smuzhiyun flags &= ~SCTP_PR_SCTP_MASK; \ 159*4882a593Smuzhiyun flags |= x; \ 160*4882a593Smuzhiyun } while (0) 161*4882a593Smuzhiyun 162*4882a593Smuzhiyun #define SCTP_PR_TTL_ENABLED(x) (SCTP_PR_POLICY(x) == SCTP_PR_SCTP_TTL) 163*4882a593Smuzhiyun #define SCTP_PR_RTX_ENABLED(x) (SCTP_PR_POLICY(x) == SCTP_PR_SCTP_RTX) 164*4882a593Smuzhiyun #define SCTP_PR_PRIO_ENABLED(x) (SCTP_PR_POLICY(x) == SCTP_PR_SCTP_PRIO) 165*4882a593Smuzhiyun 166*4882a593Smuzhiyun /* For enable stream reset */ 167*4882a593Smuzhiyun #define SCTP_ENABLE_RESET_STREAM_REQ 0x01 168*4882a593Smuzhiyun #define SCTP_ENABLE_RESET_ASSOC_REQ 0x02 169*4882a593Smuzhiyun #define SCTP_ENABLE_CHANGE_ASSOC_REQ 0x04 170*4882a593Smuzhiyun #define SCTP_ENABLE_STRRESET_MASK 0x07 171*4882a593Smuzhiyun 172*4882a593Smuzhiyun #define SCTP_STREAM_RESET_INCOMING 0x01 173*4882a593Smuzhiyun #define SCTP_STREAM_RESET_OUTGOING 0x02 174*4882a593Smuzhiyun 175*4882a593Smuzhiyun /* These are bit fields for msghdr->msg_flags. See section 5.1. */ 176*4882a593Smuzhiyun /* On user space Linux, these live in <bits/socket.h> as an enum. */ 177*4882a593Smuzhiyun enum sctp_msg_flags { 178*4882a593Smuzhiyun MSG_NOTIFICATION = 0x8000, 179*4882a593Smuzhiyun #define MSG_NOTIFICATION MSG_NOTIFICATION 180*4882a593Smuzhiyun }; 181*4882a593Smuzhiyun 182*4882a593Smuzhiyun /* 5.3.1 SCTP Initiation Structure (SCTP_INIT) 183*4882a593Smuzhiyun * 184*4882a593Smuzhiyun * This cmsghdr structure provides information for initializing new 185*4882a593Smuzhiyun * SCTP associations with sendmsg(). The SCTP_INITMSG socket option 186*4882a593Smuzhiyun * uses this same data structure. This structure is not used for 187*4882a593Smuzhiyun * recvmsg(). 188*4882a593Smuzhiyun * 189*4882a593Smuzhiyun * cmsg_level cmsg_type cmsg_data[] 190*4882a593Smuzhiyun * ------------ ------------ ---------------------- 191*4882a593Smuzhiyun * IPPROTO_SCTP SCTP_INIT struct sctp_initmsg 192*4882a593Smuzhiyun */ 193*4882a593Smuzhiyun struct sctp_initmsg { 194*4882a593Smuzhiyun __u16 sinit_num_ostreams; 195*4882a593Smuzhiyun __u16 sinit_max_instreams; 196*4882a593Smuzhiyun __u16 sinit_max_attempts; 197*4882a593Smuzhiyun __u16 sinit_max_init_timeo; 198*4882a593Smuzhiyun }; 199*4882a593Smuzhiyun 200*4882a593Smuzhiyun /* 5.3.2 SCTP Header Information Structure (SCTP_SNDRCV) 201*4882a593Smuzhiyun * 202*4882a593Smuzhiyun * This cmsghdr structure specifies SCTP options for sendmsg() and 203*4882a593Smuzhiyun * describes SCTP header information about a received message through 204*4882a593Smuzhiyun * recvmsg(). 205*4882a593Smuzhiyun * 206*4882a593Smuzhiyun * cmsg_level cmsg_type cmsg_data[] 207*4882a593Smuzhiyun * ------------ ------------ ---------------------- 208*4882a593Smuzhiyun * IPPROTO_SCTP SCTP_SNDRCV struct sctp_sndrcvinfo 209*4882a593Smuzhiyun */ 210*4882a593Smuzhiyun struct sctp_sndrcvinfo { 211*4882a593Smuzhiyun __u16 sinfo_stream; 212*4882a593Smuzhiyun __u16 sinfo_ssn; 213*4882a593Smuzhiyun __u16 sinfo_flags; 214*4882a593Smuzhiyun __u32 sinfo_ppid; 215*4882a593Smuzhiyun __u32 sinfo_context; 216*4882a593Smuzhiyun __u32 sinfo_timetolive; 217*4882a593Smuzhiyun __u32 sinfo_tsn; 218*4882a593Smuzhiyun __u32 sinfo_cumtsn; 219*4882a593Smuzhiyun sctp_assoc_t sinfo_assoc_id; 220*4882a593Smuzhiyun }; 221*4882a593Smuzhiyun 222*4882a593Smuzhiyun /* 5.3.4 SCTP Send Information Structure (SCTP_SNDINFO) 223*4882a593Smuzhiyun * 224*4882a593Smuzhiyun * This cmsghdr structure specifies SCTP options for sendmsg(). 225*4882a593Smuzhiyun * 226*4882a593Smuzhiyun * cmsg_level cmsg_type cmsg_data[] 227*4882a593Smuzhiyun * ------------ ------------ ------------------- 228*4882a593Smuzhiyun * IPPROTO_SCTP SCTP_SNDINFO struct sctp_sndinfo 229*4882a593Smuzhiyun */ 230*4882a593Smuzhiyun struct sctp_sndinfo { 231*4882a593Smuzhiyun __u16 snd_sid; 232*4882a593Smuzhiyun __u16 snd_flags; 233*4882a593Smuzhiyun __u32 snd_ppid; 234*4882a593Smuzhiyun __u32 snd_context; 235*4882a593Smuzhiyun sctp_assoc_t snd_assoc_id; 236*4882a593Smuzhiyun }; 237*4882a593Smuzhiyun 238*4882a593Smuzhiyun /* 5.3.5 SCTP Receive Information Structure (SCTP_RCVINFO) 239*4882a593Smuzhiyun * 240*4882a593Smuzhiyun * This cmsghdr structure describes SCTP receive information 241*4882a593Smuzhiyun * about a received message through recvmsg(). 242*4882a593Smuzhiyun * 243*4882a593Smuzhiyun * cmsg_level cmsg_type cmsg_data[] 244*4882a593Smuzhiyun * ------------ ------------ ------------------- 245*4882a593Smuzhiyun * IPPROTO_SCTP SCTP_RCVINFO struct sctp_rcvinfo 246*4882a593Smuzhiyun */ 247*4882a593Smuzhiyun struct sctp_rcvinfo { 248*4882a593Smuzhiyun __u16 rcv_sid; 249*4882a593Smuzhiyun __u16 rcv_ssn; 250*4882a593Smuzhiyun __u16 rcv_flags; 251*4882a593Smuzhiyun __u32 rcv_ppid; 252*4882a593Smuzhiyun __u32 rcv_tsn; 253*4882a593Smuzhiyun __u32 rcv_cumtsn; 254*4882a593Smuzhiyun __u32 rcv_context; 255*4882a593Smuzhiyun sctp_assoc_t rcv_assoc_id; 256*4882a593Smuzhiyun }; 257*4882a593Smuzhiyun 258*4882a593Smuzhiyun /* 5.3.6 SCTP Next Receive Information Structure (SCTP_NXTINFO) 259*4882a593Smuzhiyun * 260*4882a593Smuzhiyun * This cmsghdr structure describes SCTP receive information 261*4882a593Smuzhiyun * of the next message that will be delivered through recvmsg() 262*4882a593Smuzhiyun * if this information is already available when delivering 263*4882a593Smuzhiyun * the current message. 264*4882a593Smuzhiyun * 265*4882a593Smuzhiyun * cmsg_level cmsg_type cmsg_data[] 266*4882a593Smuzhiyun * ------------ ------------ ------------------- 267*4882a593Smuzhiyun * IPPROTO_SCTP SCTP_NXTINFO struct sctp_nxtinfo 268*4882a593Smuzhiyun */ 269*4882a593Smuzhiyun struct sctp_nxtinfo { 270*4882a593Smuzhiyun __u16 nxt_sid; 271*4882a593Smuzhiyun __u16 nxt_flags; 272*4882a593Smuzhiyun __u32 nxt_ppid; 273*4882a593Smuzhiyun __u32 nxt_length; 274*4882a593Smuzhiyun sctp_assoc_t nxt_assoc_id; 275*4882a593Smuzhiyun }; 276*4882a593Smuzhiyun 277*4882a593Smuzhiyun /* 5.3.7 SCTP PR-SCTP Information Structure (SCTP_PRINFO) 278*4882a593Smuzhiyun * 279*4882a593Smuzhiyun * This cmsghdr structure specifies SCTP options for sendmsg(). 280*4882a593Smuzhiyun * 281*4882a593Smuzhiyun * cmsg_level cmsg_type cmsg_data[] 282*4882a593Smuzhiyun * ------------ ------------ ------------------- 283*4882a593Smuzhiyun * IPPROTO_SCTP SCTP_PRINFO struct sctp_prinfo 284*4882a593Smuzhiyun */ 285*4882a593Smuzhiyun struct sctp_prinfo { 286*4882a593Smuzhiyun __u16 pr_policy; 287*4882a593Smuzhiyun __u32 pr_value; 288*4882a593Smuzhiyun }; 289*4882a593Smuzhiyun 290*4882a593Smuzhiyun /* 5.3.8 SCTP AUTH Information Structure (SCTP_AUTHINFO) 291*4882a593Smuzhiyun * 292*4882a593Smuzhiyun * This cmsghdr structure specifies SCTP options for sendmsg(). 293*4882a593Smuzhiyun * 294*4882a593Smuzhiyun * cmsg_level cmsg_type cmsg_data[] 295*4882a593Smuzhiyun * ------------ ------------ ------------------- 296*4882a593Smuzhiyun * IPPROTO_SCTP SCTP_AUTHINFO struct sctp_authinfo 297*4882a593Smuzhiyun */ 298*4882a593Smuzhiyun struct sctp_authinfo { 299*4882a593Smuzhiyun __u16 auth_keynumber; 300*4882a593Smuzhiyun }; 301*4882a593Smuzhiyun 302*4882a593Smuzhiyun /* 303*4882a593Smuzhiyun * sinfo_flags: 16 bits (unsigned integer) 304*4882a593Smuzhiyun * 305*4882a593Smuzhiyun * This field may contain any of the following flags and is composed of 306*4882a593Smuzhiyun * a bitwise OR of these values. 307*4882a593Smuzhiyun */ 308*4882a593Smuzhiyun enum sctp_sinfo_flags { 309*4882a593Smuzhiyun SCTP_UNORDERED = (1 << 0), /* Send/receive message unordered. */ 310*4882a593Smuzhiyun SCTP_ADDR_OVER = (1 << 1), /* Override the primary destination. */ 311*4882a593Smuzhiyun SCTP_ABORT = (1 << 2), /* Send an ABORT message to the peer. */ 312*4882a593Smuzhiyun SCTP_SACK_IMMEDIATELY = (1 << 3), /* SACK should be sent without delay. */ 313*4882a593Smuzhiyun /* 2 bits here have been used by SCTP_PR_SCTP_MASK */ 314*4882a593Smuzhiyun SCTP_SENDALL = (1 << 6), 315*4882a593Smuzhiyun SCTP_PR_SCTP_ALL = (1 << 7), 316*4882a593Smuzhiyun SCTP_NOTIFICATION = MSG_NOTIFICATION, /* Next message is not user msg but notification. */ 317*4882a593Smuzhiyun SCTP_EOF = MSG_FIN, /* Initiate graceful shutdown process. */ 318*4882a593Smuzhiyun }; 319*4882a593Smuzhiyun 320*4882a593Smuzhiyun typedef union { 321*4882a593Smuzhiyun __u8 raw; 322*4882a593Smuzhiyun struct sctp_initmsg init; 323*4882a593Smuzhiyun struct sctp_sndrcvinfo sndrcv; 324*4882a593Smuzhiyun } sctp_cmsg_data_t; 325*4882a593Smuzhiyun 326*4882a593Smuzhiyun /* These are cmsg_types. */ 327*4882a593Smuzhiyun typedef enum sctp_cmsg_type { 328*4882a593Smuzhiyun SCTP_INIT, /* 5.2.1 SCTP Initiation Structure */ 329*4882a593Smuzhiyun #define SCTP_INIT SCTP_INIT 330*4882a593Smuzhiyun SCTP_SNDRCV, /* 5.2.2 SCTP Header Information Structure */ 331*4882a593Smuzhiyun #define SCTP_SNDRCV SCTP_SNDRCV 332*4882a593Smuzhiyun SCTP_SNDINFO, /* 5.3.4 SCTP Send Information Structure */ 333*4882a593Smuzhiyun #define SCTP_SNDINFO SCTP_SNDINFO 334*4882a593Smuzhiyun SCTP_RCVINFO, /* 5.3.5 SCTP Receive Information Structure */ 335*4882a593Smuzhiyun #define SCTP_RCVINFO SCTP_RCVINFO 336*4882a593Smuzhiyun SCTP_NXTINFO, /* 5.3.6 SCTP Next Receive Information Structure */ 337*4882a593Smuzhiyun #define SCTP_NXTINFO SCTP_NXTINFO 338*4882a593Smuzhiyun SCTP_PRINFO, /* 5.3.7 SCTP PR-SCTP Information Structure */ 339*4882a593Smuzhiyun #define SCTP_PRINFO SCTP_PRINFO 340*4882a593Smuzhiyun SCTP_AUTHINFO, /* 5.3.8 SCTP AUTH Information Structure */ 341*4882a593Smuzhiyun #define SCTP_AUTHINFO SCTP_AUTHINFO 342*4882a593Smuzhiyun SCTP_DSTADDRV4, /* 5.3.9 SCTP Destination IPv4 Address Structure */ 343*4882a593Smuzhiyun #define SCTP_DSTADDRV4 SCTP_DSTADDRV4 344*4882a593Smuzhiyun SCTP_DSTADDRV6, /* 5.3.10 SCTP Destination IPv6 Address Structure */ 345*4882a593Smuzhiyun #define SCTP_DSTADDRV6 SCTP_DSTADDRV6 346*4882a593Smuzhiyun } sctp_cmsg_t; 347*4882a593Smuzhiyun 348*4882a593Smuzhiyun /* 349*4882a593Smuzhiyun * 5.3.1.1 SCTP_ASSOC_CHANGE 350*4882a593Smuzhiyun * 351*4882a593Smuzhiyun * Communication notifications inform the ULP that an SCTP association 352*4882a593Smuzhiyun * has either begun or ended. The identifier for a new association is 353*4882a593Smuzhiyun * provided by this notificaion. The notification information has the 354*4882a593Smuzhiyun * following format: 355*4882a593Smuzhiyun * 356*4882a593Smuzhiyun */ 357*4882a593Smuzhiyun struct sctp_assoc_change { 358*4882a593Smuzhiyun __u16 sac_type; 359*4882a593Smuzhiyun __u16 sac_flags; 360*4882a593Smuzhiyun __u32 sac_length; 361*4882a593Smuzhiyun __u16 sac_state; 362*4882a593Smuzhiyun __u16 sac_error; 363*4882a593Smuzhiyun __u16 sac_outbound_streams; 364*4882a593Smuzhiyun __u16 sac_inbound_streams; 365*4882a593Smuzhiyun sctp_assoc_t sac_assoc_id; 366*4882a593Smuzhiyun __u8 sac_info[0]; 367*4882a593Smuzhiyun }; 368*4882a593Smuzhiyun 369*4882a593Smuzhiyun /* 370*4882a593Smuzhiyun * sac_state: 32 bits (signed integer) 371*4882a593Smuzhiyun * 372*4882a593Smuzhiyun * This field holds one of a number of values that communicate the 373*4882a593Smuzhiyun * event that happened to the association. They include: 374*4882a593Smuzhiyun * 375*4882a593Smuzhiyun * Note: The following state names deviate from the API draft as 376*4882a593Smuzhiyun * the names clash too easily with other kernel symbols. 377*4882a593Smuzhiyun */ 378*4882a593Smuzhiyun enum sctp_sac_state { 379*4882a593Smuzhiyun SCTP_COMM_UP, 380*4882a593Smuzhiyun SCTP_COMM_LOST, 381*4882a593Smuzhiyun SCTP_RESTART, 382*4882a593Smuzhiyun SCTP_SHUTDOWN_COMP, 383*4882a593Smuzhiyun SCTP_CANT_STR_ASSOC, 384*4882a593Smuzhiyun }; 385*4882a593Smuzhiyun 386*4882a593Smuzhiyun /* 387*4882a593Smuzhiyun * 5.3.1.2 SCTP_PEER_ADDR_CHANGE 388*4882a593Smuzhiyun * 389*4882a593Smuzhiyun * When a destination address on a multi-homed peer encounters a change 390*4882a593Smuzhiyun * an interface details event is sent. The information has the 391*4882a593Smuzhiyun * following structure: 392*4882a593Smuzhiyun */ 393*4882a593Smuzhiyun struct sctp_paddr_change { 394*4882a593Smuzhiyun __u16 spc_type; 395*4882a593Smuzhiyun __u16 spc_flags; 396*4882a593Smuzhiyun __u32 spc_length; 397*4882a593Smuzhiyun struct sockaddr_storage spc_aaddr; 398*4882a593Smuzhiyun int spc_state; 399*4882a593Smuzhiyun int spc_error; 400*4882a593Smuzhiyun sctp_assoc_t spc_assoc_id; 401*4882a593Smuzhiyun } __attribute__((packed, aligned(4))); 402*4882a593Smuzhiyun 403*4882a593Smuzhiyun /* 404*4882a593Smuzhiyun * spc_state: 32 bits (signed integer) 405*4882a593Smuzhiyun * 406*4882a593Smuzhiyun * This field holds one of a number of values that communicate the 407*4882a593Smuzhiyun * event that happened to the address. They include: 408*4882a593Smuzhiyun */ 409*4882a593Smuzhiyun enum sctp_spc_state { 410*4882a593Smuzhiyun SCTP_ADDR_AVAILABLE, 411*4882a593Smuzhiyun SCTP_ADDR_UNREACHABLE, 412*4882a593Smuzhiyun SCTP_ADDR_REMOVED, 413*4882a593Smuzhiyun SCTP_ADDR_ADDED, 414*4882a593Smuzhiyun SCTP_ADDR_MADE_PRIM, 415*4882a593Smuzhiyun SCTP_ADDR_CONFIRMED, 416*4882a593Smuzhiyun SCTP_ADDR_POTENTIALLY_FAILED, 417*4882a593Smuzhiyun #define SCTP_ADDR_PF SCTP_ADDR_POTENTIALLY_FAILED 418*4882a593Smuzhiyun }; 419*4882a593Smuzhiyun 420*4882a593Smuzhiyun 421*4882a593Smuzhiyun /* 422*4882a593Smuzhiyun * 5.3.1.3 SCTP_REMOTE_ERROR 423*4882a593Smuzhiyun * 424*4882a593Smuzhiyun * A remote peer may send an Operational Error message to its peer. 425*4882a593Smuzhiyun * This message indicates a variety of error conditions on an 426*4882a593Smuzhiyun * association. The entire error TLV as it appears on the wire is 427*4882a593Smuzhiyun * included in a SCTP_REMOTE_ERROR event. Please refer to the SCTP 428*4882a593Smuzhiyun * specification [SCTP] and any extensions for a list of possible 429*4882a593Smuzhiyun * error formats. SCTP error TLVs have the format: 430*4882a593Smuzhiyun */ 431*4882a593Smuzhiyun struct sctp_remote_error { 432*4882a593Smuzhiyun __u16 sre_type; 433*4882a593Smuzhiyun __u16 sre_flags; 434*4882a593Smuzhiyun __u32 sre_length; 435*4882a593Smuzhiyun __be16 sre_error; 436*4882a593Smuzhiyun sctp_assoc_t sre_assoc_id; 437*4882a593Smuzhiyun __u8 sre_data[0]; 438*4882a593Smuzhiyun }; 439*4882a593Smuzhiyun 440*4882a593Smuzhiyun 441*4882a593Smuzhiyun /* 442*4882a593Smuzhiyun * 5.3.1.4 SCTP_SEND_FAILED 443*4882a593Smuzhiyun * 444*4882a593Smuzhiyun * If SCTP cannot deliver a message it may return the message as a 445*4882a593Smuzhiyun * notification. 446*4882a593Smuzhiyun */ 447*4882a593Smuzhiyun struct sctp_send_failed { 448*4882a593Smuzhiyun __u16 ssf_type; 449*4882a593Smuzhiyun __u16 ssf_flags; 450*4882a593Smuzhiyun __u32 ssf_length; 451*4882a593Smuzhiyun __u32 ssf_error; 452*4882a593Smuzhiyun struct sctp_sndrcvinfo ssf_info; 453*4882a593Smuzhiyun sctp_assoc_t ssf_assoc_id; 454*4882a593Smuzhiyun __u8 ssf_data[0]; 455*4882a593Smuzhiyun }; 456*4882a593Smuzhiyun 457*4882a593Smuzhiyun struct sctp_send_failed_event { 458*4882a593Smuzhiyun __u16 ssf_type; 459*4882a593Smuzhiyun __u16 ssf_flags; 460*4882a593Smuzhiyun __u32 ssf_length; 461*4882a593Smuzhiyun __u32 ssf_error; 462*4882a593Smuzhiyun struct sctp_sndinfo ssfe_info; 463*4882a593Smuzhiyun sctp_assoc_t ssf_assoc_id; 464*4882a593Smuzhiyun __u8 ssf_data[0]; 465*4882a593Smuzhiyun }; 466*4882a593Smuzhiyun 467*4882a593Smuzhiyun /* 468*4882a593Smuzhiyun * ssf_flags: 16 bits (unsigned integer) 469*4882a593Smuzhiyun * 470*4882a593Smuzhiyun * The flag value will take one of the following values 471*4882a593Smuzhiyun * 472*4882a593Smuzhiyun * SCTP_DATA_UNSENT - Indicates that the data was never put on 473*4882a593Smuzhiyun * the wire. 474*4882a593Smuzhiyun * 475*4882a593Smuzhiyun * SCTP_DATA_SENT - Indicates that the data was put on the wire. 476*4882a593Smuzhiyun * Note that this does not necessarily mean that the 477*4882a593Smuzhiyun * data was (or was not) successfully delivered. 478*4882a593Smuzhiyun */ 479*4882a593Smuzhiyun enum sctp_ssf_flags { 480*4882a593Smuzhiyun SCTP_DATA_UNSENT, 481*4882a593Smuzhiyun SCTP_DATA_SENT, 482*4882a593Smuzhiyun }; 483*4882a593Smuzhiyun 484*4882a593Smuzhiyun /* 485*4882a593Smuzhiyun * 5.3.1.5 SCTP_SHUTDOWN_EVENT 486*4882a593Smuzhiyun * 487*4882a593Smuzhiyun * When a peer sends a SHUTDOWN, SCTP delivers this notification to 488*4882a593Smuzhiyun * inform the application that it should cease sending data. 489*4882a593Smuzhiyun */ 490*4882a593Smuzhiyun struct sctp_shutdown_event { 491*4882a593Smuzhiyun __u16 sse_type; 492*4882a593Smuzhiyun __u16 sse_flags; 493*4882a593Smuzhiyun __u32 sse_length; 494*4882a593Smuzhiyun sctp_assoc_t sse_assoc_id; 495*4882a593Smuzhiyun }; 496*4882a593Smuzhiyun 497*4882a593Smuzhiyun /* 498*4882a593Smuzhiyun * 5.3.1.6 SCTP_ADAPTATION_INDICATION 499*4882a593Smuzhiyun * 500*4882a593Smuzhiyun * When a peer sends a Adaptation Layer Indication parameter , SCTP 501*4882a593Smuzhiyun * delivers this notification to inform the application 502*4882a593Smuzhiyun * that of the peers requested adaptation layer. 503*4882a593Smuzhiyun */ 504*4882a593Smuzhiyun struct sctp_adaptation_event { 505*4882a593Smuzhiyun __u16 sai_type; 506*4882a593Smuzhiyun __u16 sai_flags; 507*4882a593Smuzhiyun __u32 sai_length; 508*4882a593Smuzhiyun __u32 sai_adaptation_ind; 509*4882a593Smuzhiyun sctp_assoc_t sai_assoc_id; 510*4882a593Smuzhiyun }; 511*4882a593Smuzhiyun 512*4882a593Smuzhiyun /* 513*4882a593Smuzhiyun * 5.3.1.7 SCTP_PARTIAL_DELIVERY_EVENT 514*4882a593Smuzhiyun * 515*4882a593Smuzhiyun * When a receiver is engaged in a partial delivery of a 516*4882a593Smuzhiyun * message this notification will be used to indicate 517*4882a593Smuzhiyun * various events. 518*4882a593Smuzhiyun */ 519*4882a593Smuzhiyun struct sctp_pdapi_event { 520*4882a593Smuzhiyun __u16 pdapi_type; 521*4882a593Smuzhiyun __u16 pdapi_flags; 522*4882a593Smuzhiyun __u32 pdapi_length; 523*4882a593Smuzhiyun __u32 pdapi_indication; 524*4882a593Smuzhiyun sctp_assoc_t pdapi_assoc_id; 525*4882a593Smuzhiyun __u32 pdapi_stream; 526*4882a593Smuzhiyun __u32 pdapi_seq; 527*4882a593Smuzhiyun }; 528*4882a593Smuzhiyun 529*4882a593Smuzhiyun enum { SCTP_PARTIAL_DELIVERY_ABORTED=0, }; 530*4882a593Smuzhiyun 531*4882a593Smuzhiyun /* 532*4882a593Smuzhiyun * 5.3.1.8. SCTP_AUTHENTICATION_EVENT 533*4882a593Smuzhiyun * 534*4882a593Smuzhiyun * When a receiver is using authentication this message will provide 535*4882a593Smuzhiyun * notifications regarding new keys being made active as well as errors. 536*4882a593Smuzhiyun */ 537*4882a593Smuzhiyun struct sctp_authkey_event { 538*4882a593Smuzhiyun __u16 auth_type; 539*4882a593Smuzhiyun __u16 auth_flags; 540*4882a593Smuzhiyun __u32 auth_length; 541*4882a593Smuzhiyun __u16 auth_keynumber; 542*4882a593Smuzhiyun __u16 auth_altkeynumber; 543*4882a593Smuzhiyun __u32 auth_indication; 544*4882a593Smuzhiyun sctp_assoc_t auth_assoc_id; 545*4882a593Smuzhiyun }; 546*4882a593Smuzhiyun 547*4882a593Smuzhiyun enum { 548*4882a593Smuzhiyun SCTP_AUTH_NEW_KEY, 549*4882a593Smuzhiyun #define SCTP_AUTH_NEWKEY SCTP_AUTH_NEW_KEY /* compatible with before */ 550*4882a593Smuzhiyun SCTP_AUTH_FREE_KEY, 551*4882a593Smuzhiyun SCTP_AUTH_NO_AUTH, 552*4882a593Smuzhiyun }; 553*4882a593Smuzhiyun 554*4882a593Smuzhiyun /* 555*4882a593Smuzhiyun * 6.1.9. SCTP_SENDER_DRY_EVENT 556*4882a593Smuzhiyun * 557*4882a593Smuzhiyun * When the SCTP stack has no more user data to send or retransmit, this 558*4882a593Smuzhiyun * notification is given to the user. Also, at the time when a user app 559*4882a593Smuzhiyun * subscribes to this event, if there is no data to be sent or 560*4882a593Smuzhiyun * retransmit, the stack will immediately send up this notification. 561*4882a593Smuzhiyun */ 562*4882a593Smuzhiyun struct sctp_sender_dry_event { 563*4882a593Smuzhiyun __u16 sender_dry_type; 564*4882a593Smuzhiyun __u16 sender_dry_flags; 565*4882a593Smuzhiyun __u32 sender_dry_length; 566*4882a593Smuzhiyun sctp_assoc_t sender_dry_assoc_id; 567*4882a593Smuzhiyun }; 568*4882a593Smuzhiyun 569*4882a593Smuzhiyun #define SCTP_STREAM_RESET_INCOMING_SSN 0x0001 570*4882a593Smuzhiyun #define SCTP_STREAM_RESET_OUTGOING_SSN 0x0002 571*4882a593Smuzhiyun #define SCTP_STREAM_RESET_DENIED 0x0004 572*4882a593Smuzhiyun #define SCTP_STREAM_RESET_FAILED 0x0008 573*4882a593Smuzhiyun struct sctp_stream_reset_event { 574*4882a593Smuzhiyun __u16 strreset_type; 575*4882a593Smuzhiyun __u16 strreset_flags; 576*4882a593Smuzhiyun __u32 strreset_length; 577*4882a593Smuzhiyun sctp_assoc_t strreset_assoc_id; 578*4882a593Smuzhiyun __u16 strreset_stream_list[]; 579*4882a593Smuzhiyun }; 580*4882a593Smuzhiyun 581*4882a593Smuzhiyun #define SCTP_ASSOC_RESET_DENIED 0x0004 582*4882a593Smuzhiyun #define SCTP_ASSOC_RESET_FAILED 0x0008 583*4882a593Smuzhiyun struct sctp_assoc_reset_event { 584*4882a593Smuzhiyun __u16 assocreset_type; 585*4882a593Smuzhiyun __u16 assocreset_flags; 586*4882a593Smuzhiyun __u32 assocreset_length; 587*4882a593Smuzhiyun sctp_assoc_t assocreset_assoc_id; 588*4882a593Smuzhiyun __u32 assocreset_local_tsn; 589*4882a593Smuzhiyun __u32 assocreset_remote_tsn; 590*4882a593Smuzhiyun }; 591*4882a593Smuzhiyun 592*4882a593Smuzhiyun #define SCTP_ASSOC_CHANGE_DENIED 0x0004 593*4882a593Smuzhiyun #define SCTP_ASSOC_CHANGE_FAILED 0x0008 594*4882a593Smuzhiyun #define SCTP_STREAM_CHANGE_DENIED SCTP_ASSOC_CHANGE_DENIED 595*4882a593Smuzhiyun #define SCTP_STREAM_CHANGE_FAILED SCTP_ASSOC_CHANGE_FAILED 596*4882a593Smuzhiyun struct sctp_stream_change_event { 597*4882a593Smuzhiyun __u16 strchange_type; 598*4882a593Smuzhiyun __u16 strchange_flags; 599*4882a593Smuzhiyun __u32 strchange_length; 600*4882a593Smuzhiyun sctp_assoc_t strchange_assoc_id; 601*4882a593Smuzhiyun __u16 strchange_instrms; 602*4882a593Smuzhiyun __u16 strchange_outstrms; 603*4882a593Smuzhiyun }; 604*4882a593Smuzhiyun 605*4882a593Smuzhiyun /* 606*4882a593Smuzhiyun * Described in Section 7.3 607*4882a593Smuzhiyun * Ancillary Data and Notification Interest Options 608*4882a593Smuzhiyun */ 609*4882a593Smuzhiyun struct sctp_event_subscribe { 610*4882a593Smuzhiyun __u8 sctp_data_io_event; 611*4882a593Smuzhiyun __u8 sctp_association_event; 612*4882a593Smuzhiyun __u8 sctp_address_event; 613*4882a593Smuzhiyun __u8 sctp_send_failure_event; 614*4882a593Smuzhiyun __u8 sctp_peer_error_event; 615*4882a593Smuzhiyun __u8 sctp_shutdown_event; 616*4882a593Smuzhiyun __u8 sctp_partial_delivery_event; 617*4882a593Smuzhiyun __u8 sctp_adaptation_layer_event; 618*4882a593Smuzhiyun __u8 sctp_authentication_event; 619*4882a593Smuzhiyun __u8 sctp_sender_dry_event; 620*4882a593Smuzhiyun __u8 sctp_stream_reset_event; 621*4882a593Smuzhiyun __u8 sctp_assoc_reset_event; 622*4882a593Smuzhiyun __u8 sctp_stream_change_event; 623*4882a593Smuzhiyun __u8 sctp_send_failure_event_event; 624*4882a593Smuzhiyun }; 625*4882a593Smuzhiyun 626*4882a593Smuzhiyun /* 627*4882a593Smuzhiyun * 5.3.1 SCTP Notification Structure 628*4882a593Smuzhiyun * 629*4882a593Smuzhiyun * The notification structure is defined as the union of all 630*4882a593Smuzhiyun * notification types. 631*4882a593Smuzhiyun * 632*4882a593Smuzhiyun */ 633*4882a593Smuzhiyun union sctp_notification { 634*4882a593Smuzhiyun struct { 635*4882a593Smuzhiyun __u16 sn_type; /* Notification type. */ 636*4882a593Smuzhiyun __u16 sn_flags; 637*4882a593Smuzhiyun __u32 sn_length; 638*4882a593Smuzhiyun } sn_header; 639*4882a593Smuzhiyun struct sctp_assoc_change sn_assoc_change; 640*4882a593Smuzhiyun struct sctp_paddr_change sn_paddr_change; 641*4882a593Smuzhiyun struct sctp_remote_error sn_remote_error; 642*4882a593Smuzhiyun struct sctp_send_failed sn_send_failed; 643*4882a593Smuzhiyun struct sctp_shutdown_event sn_shutdown_event; 644*4882a593Smuzhiyun struct sctp_adaptation_event sn_adaptation_event; 645*4882a593Smuzhiyun struct sctp_pdapi_event sn_pdapi_event; 646*4882a593Smuzhiyun struct sctp_authkey_event sn_authkey_event; 647*4882a593Smuzhiyun struct sctp_sender_dry_event sn_sender_dry_event; 648*4882a593Smuzhiyun struct sctp_stream_reset_event sn_strreset_event; 649*4882a593Smuzhiyun struct sctp_assoc_reset_event sn_assocreset_event; 650*4882a593Smuzhiyun struct sctp_stream_change_event sn_strchange_event; 651*4882a593Smuzhiyun struct sctp_send_failed_event sn_send_failed_event; 652*4882a593Smuzhiyun }; 653*4882a593Smuzhiyun 654*4882a593Smuzhiyun /* Section 5.3.1 655*4882a593Smuzhiyun * All standard values for sn_type flags are greater than 2^15. 656*4882a593Smuzhiyun * Values from 2^15 and down are reserved. 657*4882a593Smuzhiyun */ 658*4882a593Smuzhiyun 659*4882a593Smuzhiyun enum sctp_sn_type { 660*4882a593Smuzhiyun SCTP_SN_TYPE_BASE = (1<<15), 661*4882a593Smuzhiyun SCTP_DATA_IO_EVENT = SCTP_SN_TYPE_BASE, 662*4882a593Smuzhiyun #define SCTP_DATA_IO_EVENT SCTP_DATA_IO_EVENT 663*4882a593Smuzhiyun SCTP_ASSOC_CHANGE, 664*4882a593Smuzhiyun #define SCTP_ASSOC_CHANGE SCTP_ASSOC_CHANGE 665*4882a593Smuzhiyun SCTP_PEER_ADDR_CHANGE, 666*4882a593Smuzhiyun #define SCTP_PEER_ADDR_CHANGE SCTP_PEER_ADDR_CHANGE 667*4882a593Smuzhiyun SCTP_SEND_FAILED, 668*4882a593Smuzhiyun #define SCTP_SEND_FAILED SCTP_SEND_FAILED 669*4882a593Smuzhiyun SCTP_REMOTE_ERROR, 670*4882a593Smuzhiyun #define SCTP_REMOTE_ERROR SCTP_REMOTE_ERROR 671*4882a593Smuzhiyun SCTP_SHUTDOWN_EVENT, 672*4882a593Smuzhiyun #define SCTP_SHUTDOWN_EVENT SCTP_SHUTDOWN_EVENT 673*4882a593Smuzhiyun SCTP_PARTIAL_DELIVERY_EVENT, 674*4882a593Smuzhiyun #define SCTP_PARTIAL_DELIVERY_EVENT SCTP_PARTIAL_DELIVERY_EVENT 675*4882a593Smuzhiyun SCTP_ADAPTATION_INDICATION, 676*4882a593Smuzhiyun #define SCTP_ADAPTATION_INDICATION SCTP_ADAPTATION_INDICATION 677*4882a593Smuzhiyun SCTP_AUTHENTICATION_EVENT, 678*4882a593Smuzhiyun #define SCTP_AUTHENTICATION_INDICATION SCTP_AUTHENTICATION_EVENT 679*4882a593Smuzhiyun SCTP_SENDER_DRY_EVENT, 680*4882a593Smuzhiyun #define SCTP_SENDER_DRY_EVENT SCTP_SENDER_DRY_EVENT 681*4882a593Smuzhiyun SCTP_STREAM_RESET_EVENT, 682*4882a593Smuzhiyun #define SCTP_STREAM_RESET_EVENT SCTP_STREAM_RESET_EVENT 683*4882a593Smuzhiyun SCTP_ASSOC_RESET_EVENT, 684*4882a593Smuzhiyun #define SCTP_ASSOC_RESET_EVENT SCTP_ASSOC_RESET_EVENT 685*4882a593Smuzhiyun SCTP_STREAM_CHANGE_EVENT, 686*4882a593Smuzhiyun #define SCTP_STREAM_CHANGE_EVENT SCTP_STREAM_CHANGE_EVENT 687*4882a593Smuzhiyun SCTP_SEND_FAILED_EVENT, 688*4882a593Smuzhiyun #define SCTP_SEND_FAILED_EVENT SCTP_SEND_FAILED_EVENT 689*4882a593Smuzhiyun SCTP_SN_TYPE_MAX = SCTP_SEND_FAILED_EVENT, 690*4882a593Smuzhiyun #define SCTP_SN_TYPE_MAX SCTP_SN_TYPE_MAX 691*4882a593Smuzhiyun }; 692*4882a593Smuzhiyun 693*4882a593Smuzhiyun /* Notification error codes used to fill up the error fields in some 694*4882a593Smuzhiyun * notifications. 695*4882a593Smuzhiyun * SCTP_PEER_ADDRESS_CHAGE : spc_error 696*4882a593Smuzhiyun * SCTP_ASSOC_CHANGE : sac_error 697*4882a593Smuzhiyun * These names should be potentially included in the draft 04 of the SCTP 698*4882a593Smuzhiyun * sockets API specification. 699*4882a593Smuzhiyun */ 700*4882a593Smuzhiyun typedef enum sctp_sn_error { 701*4882a593Smuzhiyun SCTP_FAILED_THRESHOLD, 702*4882a593Smuzhiyun SCTP_RECEIVED_SACK, 703*4882a593Smuzhiyun SCTP_HEARTBEAT_SUCCESS, 704*4882a593Smuzhiyun SCTP_RESPONSE_TO_USER_REQ, 705*4882a593Smuzhiyun SCTP_INTERNAL_ERROR, 706*4882a593Smuzhiyun SCTP_SHUTDOWN_GUARD_EXPIRES, 707*4882a593Smuzhiyun SCTP_PEER_FAULTY, 708*4882a593Smuzhiyun } sctp_sn_error_t; 709*4882a593Smuzhiyun 710*4882a593Smuzhiyun /* 711*4882a593Smuzhiyun * 7.1.1 Retransmission Timeout Parameters (SCTP_RTOINFO) 712*4882a593Smuzhiyun * 713*4882a593Smuzhiyun * The protocol parameters used to initialize and bound retransmission 714*4882a593Smuzhiyun * timeout (RTO) are tunable. See [SCTP] for more information on how 715*4882a593Smuzhiyun * these parameters are used in RTO calculation. 716*4882a593Smuzhiyun */ 717*4882a593Smuzhiyun struct sctp_rtoinfo { 718*4882a593Smuzhiyun sctp_assoc_t srto_assoc_id; 719*4882a593Smuzhiyun __u32 srto_initial; 720*4882a593Smuzhiyun __u32 srto_max; 721*4882a593Smuzhiyun __u32 srto_min; 722*4882a593Smuzhiyun }; 723*4882a593Smuzhiyun 724*4882a593Smuzhiyun /* 725*4882a593Smuzhiyun * 7.1.2 Association Parameters (SCTP_ASSOCINFO) 726*4882a593Smuzhiyun * 727*4882a593Smuzhiyun * This option is used to both examine and set various association and 728*4882a593Smuzhiyun * endpoint parameters. 729*4882a593Smuzhiyun */ 730*4882a593Smuzhiyun struct sctp_assocparams { 731*4882a593Smuzhiyun sctp_assoc_t sasoc_assoc_id; 732*4882a593Smuzhiyun __u16 sasoc_asocmaxrxt; 733*4882a593Smuzhiyun __u16 sasoc_number_peer_destinations; 734*4882a593Smuzhiyun __u32 sasoc_peer_rwnd; 735*4882a593Smuzhiyun __u32 sasoc_local_rwnd; 736*4882a593Smuzhiyun __u32 sasoc_cookie_life; 737*4882a593Smuzhiyun }; 738*4882a593Smuzhiyun 739*4882a593Smuzhiyun /* 740*4882a593Smuzhiyun * 7.1.9 Set Peer Primary Address (SCTP_SET_PEER_PRIMARY_ADDR) 741*4882a593Smuzhiyun * 742*4882a593Smuzhiyun * Requests that the peer mark the enclosed address as the association 743*4882a593Smuzhiyun * primary. The enclosed address must be one of the association's 744*4882a593Smuzhiyun * locally bound addresses. The following structure is used to make a 745*4882a593Smuzhiyun * set primary request: 746*4882a593Smuzhiyun */ 747*4882a593Smuzhiyun struct sctp_setpeerprim { 748*4882a593Smuzhiyun sctp_assoc_t sspp_assoc_id; 749*4882a593Smuzhiyun struct sockaddr_storage sspp_addr; 750*4882a593Smuzhiyun } __attribute__((packed, aligned(4))); 751*4882a593Smuzhiyun 752*4882a593Smuzhiyun /* 753*4882a593Smuzhiyun * 7.1.10 Set Primary Address (SCTP_PRIMARY_ADDR) 754*4882a593Smuzhiyun * 755*4882a593Smuzhiyun * Requests that the local SCTP stack use the enclosed peer address as 756*4882a593Smuzhiyun * the association primary. The enclosed address must be one of the 757*4882a593Smuzhiyun * association peer's addresses. The following structure is used to 758*4882a593Smuzhiyun * make a set peer primary request: 759*4882a593Smuzhiyun */ 760*4882a593Smuzhiyun struct sctp_prim { 761*4882a593Smuzhiyun sctp_assoc_t ssp_assoc_id; 762*4882a593Smuzhiyun struct sockaddr_storage ssp_addr; 763*4882a593Smuzhiyun } __attribute__((packed, aligned(4))); 764*4882a593Smuzhiyun 765*4882a593Smuzhiyun /* For backward compatibility use, define the old name too */ 766*4882a593Smuzhiyun #define sctp_setprim sctp_prim 767*4882a593Smuzhiyun 768*4882a593Smuzhiyun /* 769*4882a593Smuzhiyun * 7.1.11 Set Adaptation Layer Indicator (SCTP_ADAPTATION_LAYER) 770*4882a593Smuzhiyun * 771*4882a593Smuzhiyun * Requests that the local endpoint set the specified Adaptation Layer 772*4882a593Smuzhiyun * Indication parameter for all future INIT and INIT-ACK exchanges. 773*4882a593Smuzhiyun */ 774*4882a593Smuzhiyun struct sctp_setadaptation { 775*4882a593Smuzhiyun __u32 ssb_adaptation_ind; 776*4882a593Smuzhiyun }; 777*4882a593Smuzhiyun 778*4882a593Smuzhiyun /* 779*4882a593Smuzhiyun * 7.1.13 Peer Address Parameters (SCTP_PEER_ADDR_PARAMS) 780*4882a593Smuzhiyun * 781*4882a593Smuzhiyun * Applications can enable or disable heartbeats for any peer address 782*4882a593Smuzhiyun * of an association, modify an address's heartbeat interval, force a 783*4882a593Smuzhiyun * heartbeat to be sent immediately, and adjust the address's maximum 784*4882a593Smuzhiyun * number of retransmissions sent before an address is considered 785*4882a593Smuzhiyun * unreachable. The following structure is used to access and modify an 786*4882a593Smuzhiyun * address's parameters: 787*4882a593Smuzhiyun */ 788*4882a593Smuzhiyun enum sctp_spp_flags { 789*4882a593Smuzhiyun SPP_HB_ENABLE = 1<<0, /*Enable heartbeats*/ 790*4882a593Smuzhiyun SPP_HB_DISABLE = 1<<1, /*Disable heartbeats*/ 791*4882a593Smuzhiyun SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE, 792*4882a593Smuzhiyun SPP_HB_DEMAND = 1<<2, /*Send heartbeat immediately*/ 793*4882a593Smuzhiyun SPP_PMTUD_ENABLE = 1<<3, /*Enable PMTU discovery*/ 794*4882a593Smuzhiyun SPP_PMTUD_DISABLE = 1<<4, /*Disable PMTU discovery*/ 795*4882a593Smuzhiyun SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE, 796*4882a593Smuzhiyun SPP_SACKDELAY_ENABLE = 1<<5, /*Enable SACK*/ 797*4882a593Smuzhiyun SPP_SACKDELAY_DISABLE = 1<<6, /*Disable SACK*/ 798*4882a593Smuzhiyun SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE, 799*4882a593Smuzhiyun SPP_HB_TIME_IS_ZERO = 1<<7, /* Set HB delay to 0 */ 800*4882a593Smuzhiyun SPP_IPV6_FLOWLABEL = 1<<8, 801*4882a593Smuzhiyun SPP_DSCP = 1<<9, 802*4882a593Smuzhiyun }; 803*4882a593Smuzhiyun 804*4882a593Smuzhiyun struct sctp_paddrparams { 805*4882a593Smuzhiyun sctp_assoc_t spp_assoc_id; 806*4882a593Smuzhiyun struct sockaddr_storage spp_address; 807*4882a593Smuzhiyun __u32 spp_hbinterval; 808*4882a593Smuzhiyun __u16 spp_pathmaxrxt; 809*4882a593Smuzhiyun __u32 spp_pathmtu; 810*4882a593Smuzhiyun __u32 spp_sackdelay; 811*4882a593Smuzhiyun __u32 spp_flags; 812*4882a593Smuzhiyun __u32 spp_ipv6_flowlabel; 813*4882a593Smuzhiyun __u8 spp_dscp; 814*4882a593Smuzhiyun } __attribute__((packed, aligned(4))); 815*4882a593Smuzhiyun 816*4882a593Smuzhiyun /* 817*4882a593Smuzhiyun * 7.1.18. Add a chunk that must be authenticated (SCTP_AUTH_CHUNK) 818*4882a593Smuzhiyun * 819*4882a593Smuzhiyun * This set option adds a chunk type that the user is requesting to be 820*4882a593Smuzhiyun * received only in an authenticated way. Changes to the list of chunks 821*4882a593Smuzhiyun * will only effect future associations on the socket. 822*4882a593Smuzhiyun */ 823*4882a593Smuzhiyun struct sctp_authchunk { 824*4882a593Smuzhiyun __u8 sauth_chunk; 825*4882a593Smuzhiyun }; 826*4882a593Smuzhiyun 827*4882a593Smuzhiyun /* 828*4882a593Smuzhiyun * 7.1.19. Get or set the list of supported HMAC Identifiers (SCTP_HMAC_IDENT) 829*4882a593Smuzhiyun * 830*4882a593Smuzhiyun * This option gets or sets the list of HMAC algorithms that the local 831*4882a593Smuzhiyun * endpoint requires the peer to use. 832*4882a593Smuzhiyun */ 833*4882a593Smuzhiyun #ifndef __KERNEL__ 834*4882a593Smuzhiyun /* This here is only used by user space as is. It might not be a good idea 835*4882a593Smuzhiyun * to export/reveal the whole structure with reserved fields etc. 836*4882a593Smuzhiyun */ 837*4882a593Smuzhiyun enum { 838*4882a593Smuzhiyun SCTP_AUTH_HMAC_ID_SHA1 = 1, 839*4882a593Smuzhiyun SCTP_AUTH_HMAC_ID_SHA256 = 3, 840*4882a593Smuzhiyun }; 841*4882a593Smuzhiyun #endif 842*4882a593Smuzhiyun 843*4882a593Smuzhiyun struct sctp_hmacalgo { 844*4882a593Smuzhiyun __u32 shmac_num_idents; 845*4882a593Smuzhiyun __u16 shmac_idents[]; 846*4882a593Smuzhiyun }; 847*4882a593Smuzhiyun 848*4882a593Smuzhiyun /* Sadly, user and kernel space have different names for 849*4882a593Smuzhiyun * this structure member, so this is to not break anything. 850*4882a593Smuzhiyun */ 851*4882a593Smuzhiyun #define shmac_number_of_idents shmac_num_idents 852*4882a593Smuzhiyun 853*4882a593Smuzhiyun /* 854*4882a593Smuzhiyun * 7.1.20. Set a shared key (SCTP_AUTH_KEY) 855*4882a593Smuzhiyun * 856*4882a593Smuzhiyun * This option will set a shared secret key which is used to build an 857*4882a593Smuzhiyun * association shared key. 858*4882a593Smuzhiyun */ 859*4882a593Smuzhiyun struct sctp_authkey { 860*4882a593Smuzhiyun sctp_assoc_t sca_assoc_id; 861*4882a593Smuzhiyun __u16 sca_keynumber; 862*4882a593Smuzhiyun __u16 sca_keylength; 863*4882a593Smuzhiyun __u8 sca_key[]; 864*4882a593Smuzhiyun }; 865*4882a593Smuzhiyun 866*4882a593Smuzhiyun /* 867*4882a593Smuzhiyun * 7.1.21. Get or set the active shared key (SCTP_AUTH_ACTIVE_KEY) 868*4882a593Smuzhiyun * 869*4882a593Smuzhiyun * This option will get or set the active shared key to be used to build 870*4882a593Smuzhiyun * the association shared key. 871*4882a593Smuzhiyun */ 872*4882a593Smuzhiyun 873*4882a593Smuzhiyun struct sctp_authkeyid { 874*4882a593Smuzhiyun sctp_assoc_t scact_assoc_id; 875*4882a593Smuzhiyun __u16 scact_keynumber; 876*4882a593Smuzhiyun }; 877*4882a593Smuzhiyun 878*4882a593Smuzhiyun 879*4882a593Smuzhiyun /* 880*4882a593Smuzhiyun * 7.1.23. Get or set delayed ack timer (SCTP_DELAYED_SACK) 881*4882a593Smuzhiyun * 882*4882a593Smuzhiyun * This option will effect the way delayed acks are performed. This 883*4882a593Smuzhiyun * option allows you to get or set the delayed ack time, in 884*4882a593Smuzhiyun * milliseconds. It also allows changing the delayed ack frequency. 885*4882a593Smuzhiyun * Changing the frequency to 1 disables the delayed sack algorithm. If 886*4882a593Smuzhiyun * the assoc_id is 0, then this sets or gets the endpoints default 887*4882a593Smuzhiyun * values. If the assoc_id field is non-zero, then the set or get 888*4882a593Smuzhiyun * effects the specified association for the one to many model (the 889*4882a593Smuzhiyun * assoc_id field is ignored by the one to one model). Note that if 890*4882a593Smuzhiyun * sack_delay or sack_freq are 0 when setting this option, then the 891*4882a593Smuzhiyun * current values will remain unchanged. 892*4882a593Smuzhiyun */ 893*4882a593Smuzhiyun struct sctp_sack_info { 894*4882a593Smuzhiyun sctp_assoc_t sack_assoc_id; 895*4882a593Smuzhiyun uint32_t sack_delay; 896*4882a593Smuzhiyun uint32_t sack_freq; 897*4882a593Smuzhiyun }; 898*4882a593Smuzhiyun 899*4882a593Smuzhiyun struct sctp_assoc_value { 900*4882a593Smuzhiyun sctp_assoc_t assoc_id; 901*4882a593Smuzhiyun uint32_t assoc_value; 902*4882a593Smuzhiyun }; 903*4882a593Smuzhiyun 904*4882a593Smuzhiyun struct sctp_stream_value { 905*4882a593Smuzhiyun sctp_assoc_t assoc_id; 906*4882a593Smuzhiyun uint16_t stream_id; 907*4882a593Smuzhiyun uint16_t stream_value; 908*4882a593Smuzhiyun }; 909*4882a593Smuzhiyun 910*4882a593Smuzhiyun /* 911*4882a593Smuzhiyun * 7.2.2 Peer Address Information 912*4882a593Smuzhiyun * 913*4882a593Smuzhiyun * Applications can retrieve information about a specific peer address 914*4882a593Smuzhiyun * of an association, including its reachability state, congestion 915*4882a593Smuzhiyun * window, and retransmission timer values. This information is 916*4882a593Smuzhiyun * read-only. The following structure is used to access this 917*4882a593Smuzhiyun * information: 918*4882a593Smuzhiyun */ 919*4882a593Smuzhiyun struct sctp_paddrinfo { 920*4882a593Smuzhiyun sctp_assoc_t spinfo_assoc_id; 921*4882a593Smuzhiyun struct sockaddr_storage spinfo_address; 922*4882a593Smuzhiyun __s32 spinfo_state; 923*4882a593Smuzhiyun __u32 spinfo_cwnd; 924*4882a593Smuzhiyun __u32 spinfo_srtt; 925*4882a593Smuzhiyun __u32 spinfo_rto; 926*4882a593Smuzhiyun __u32 spinfo_mtu; 927*4882a593Smuzhiyun } __attribute__((packed, aligned(4))); 928*4882a593Smuzhiyun 929*4882a593Smuzhiyun /* Peer addresses's state. */ 930*4882a593Smuzhiyun /* UNKNOWN: Peer address passed by the upper layer in sendmsg or connect[x] 931*4882a593Smuzhiyun * calls. 932*4882a593Smuzhiyun * UNCONFIRMED: Peer address received in INIT/INIT-ACK address parameters. 933*4882a593Smuzhiyun * Not yet confirmed by a heartbeat and not available for data 934*4882a593Smuzhiyun * transfers. 935*4882a593Smuzhiyun * ACTIVE : Peer address confirmed, active and available for data transfers. 936*4882a593Smuzhiyun * INACTIVE: Peer address inactive and not available for data transfers. 937*4882a593Smuzhiyun */ 938*4882a593Smuzhiyun enum sctp_spinfo_state { 939*4882a593Smuzhiyun SCTP_INACTIVE, 940*4882a593Smuzhiyun SCTP_PF, 941*4882a593Smuzhiyun #define SCTP_POTENTIALLY_FAILED SCTP_PF 942*4882a593Smuzhiyun SCTP_ACTIVE, 943*4882a593Smuzhiyun SCTP_UNCONFIRMED, 944*4882a593Smuzhiyun SCTP_UNKNOWN = 0xffff /* Value used for transport state unknown */ 945*4882a593Smuzhiyun }; 946*4882a593Smuzhiyun 947*4882a593Smuzhiyun /* 948*4882a593Smuzhiyun * 7.2.1 Association Status (SCTP_STATUS) 949*4882a593Smuzhiyun * 950*4882a593Smuzhiyun * Applications can retrieve current status information about an 951*4882a593Smuzhiyun * association, including association state, peer receiver window size, 952*4882a593Smuzhiyun * number of unacked data chunks, and number of data chunks pending 953*4882a593Smuzhiyun * receipt. This information is read-only. The following structure is 954*4882a593Smuzhiyun * used to access this information: 955*4882a593Smuzhiyun */ 956*4882a593Smuzhiyun struct sctp_status { 957*4882a593Smuzhiyun sctp_assoc_t sstat_assoc_id; 958*4882a593Smuzhiyun __s32 sstat_state; 959*4882a593Smuzhiyun __u32 sstat_rwnd; 960*4882a593Smuzhiyun __u16 sstat_unackdata; 961*4882a593Smuzhiyun __u16 sstat_penddata; 962*4882a593Smuzhiyun __u16 sstat_instrms; 963*4882a593Smuzhiyun __u16 sstat_outstrms; 964*4882a593Smuzhiyun __u32 sstat_fragmentation_point; 965*4882a593Smuzhiyun struct sctp_paddrinfo sstat_primary; 966*4882a593Smuzhiyun }; 967*4882a593Smuzhiyun 968*4882a593Smuzhiyun /* 969*4882a593Smuzhiyun * 7.2.3. Get the list of chunks the peer requires to be authenticated 970*4882a593Smuzhiyun * (SCTP_PEER_AUTH_CHUNKS) 971*4882a593Smuzhiyun * 972*4882a593Smuzhiyun * This option gets a list of chunks for a specified association that 973*4882a593Smuzhiyun * the peer requires to be received authenticated only. 974*4882a593Smuzhiyun */ 975*4882a593Smuzhiyun struct sctp_authchunks { 976*4882a593Smuzhiyun sctp_assoc_t gauth_assoc_id; 977*4882a593Smuzhiyun __u32 gauth_number_of_chunks; 978*4882a593Smuzhiyun uint8_t gauth_chunks[]; 979*4882a593Smuzhiyun }; 980*4882a593Smuzhiyun 981*4882a593Smuzhiyun /* The broken spelling has been released already in lksctp-tools header, 982*4882a593Smuzhiyun * so don't break anyone, now that it's fixed. 983*4882a593Smuzhiyun */ 984*4882a593Smuzhiyun #define guth_number_of_chunks gauth_number_of_chunks 985*4882a593Smuzhiyun 986*4882a593Smuzhiyun /* Association states. */ 987*4882a593Smuzhiyun enum sctp_sstat_state { 988*4882a593Smuzhiyun SCTP_EMPTY = 0, 989*4882a593Smuzhiyun SCTP_CLOSED = 1, 990*4882a593Smuzhiyun SCTP_COOKIE_WAIT = 2, 991*4882a593Smuzhiyun SCTP_COOKIE_ECHOED = 3, 992*4882a593Smuzhiyun SCTP_ESTABLISHED = 4, 993*4882a593Smuzhiyun SCTP_SHUTDOWN_PENDING = 5, 994*4882a593Smuzhiyun SCTP_SHUTDOWN_SENT = 6, 995*4882a593Smuzhiyun SCTP_SHUTDOWN_RECEIVED = 7, 996*4882a593Smuzhiyun SCTP_SHUTDOWN_ACK_SENT = 8, 997*4882a593Smuzhiyun }; 998*4882a593Smuzhiyun 999*4882a593Smuzhiyun /* 1000*4882a593Smuzhiyun * 8.2.6. Get the Current Identifiers of Associations 1001*4882a593Smuzhiyun * (SCTP_GET_ASSOC_ID_LIST) 1002*4882a593Smuzhiyun * 1003*4882a593Smuzhiyun * This option gets the current list of SCTP association identifiers of 1004*4882a593Smuzhiyun * the SCTP associations handled by a one-to-many style socket. 1005*4882a593Smuzhiyun */ 1006*4882a593Smuzhiyun struct sctp_assoc_ids { 1007*4882a593Smuzhiyun __u32 gaids_number_of_ids; 1008*4882a593Smuzhiyun sctp_assoc_t gaids_assoc_id[]; 1009*4882a593Smuzhiyun }; 1010*4882a593Smuzhiyun 1011*4882a593Smuzhiyun /* 1012*4882a593Smuzhiyun * 8.3, 8.5 get all peer/local addresses in an association. 1013*4882a593Smuzhiyun * This parameter struct is used by SCTP_GET_PEER_ADDRS and 1014*4882a593Smuzhiyun * SCTP_GET_LOCAL_ADDRS socket options used internally to implement 1015*4882a593Smuzhiyun * sctp_getpaddrs() and sctp_getladdrs() API. 1016*4882a593Smuzhiyun */ 1017*4882a593Smuzhiyun struct sctp_getaddrs_old { 1018*4882a593Smuzhiyun sctp_assoc_t assoc_id; 1019*4882a593Smuzhiyun int addr_num; 1020*4882a593Smuzhiyun #ifdef __KERNEL__ 1021*4882a593Smuzhiyun struct sockaddr __user *addrs; 1022*4882a593Smuzhiyun #else 1023*4882a593Smuzhiyun struct sockaddr *addrs; 1024*4882a593Smuzhiyun #endif 1025*4882a593Smuzhiyun }; 1026*4882a593Smuzhiyun 1027*4882a593Smuzhiyun struct sctp_getaddrs { 1028*4882a593Smuzhiyun sctp_assoc_t assoc_id; /*input*/ 1029*4882a593Smuzhiyun __u32 addr_num; /*output*/ 1030*4882a593Smuzhiyun __u8 addrs[0]; /*output, variable size*/ 1031*4882a593Smuzhiyun }; 1032*4882a593Smuzhiyun 1033*4882a593Smuzhiyun /* A socket user request obtained via SCTP_GET_ASSOC_STATS that retrieves 1034*4882a593Smuzhiyun * association stats. All stats are counts except sas_maxrto and 1035*4882a593Smuzhiyun * sas_obs_rto_ipaddr. maxrto is the max observed rto + transport since 1036*4882a593Smuzhiyun * the last call. Will return 0 when RTO was not update since last call 1037*4882a593Smuzhiyun */ 1038*4882a593Smuzhiyun struct sctp_assoc_stats { 1039*4882a593Smuzhiyun sctp_assoc_t sas_assoc_id; /* Input */ 1040*4882a593Smuzhiyun /* Transport of observed max RTO */ 1041*4882a593Smuzhiyun struct sockaddr_storage sas_obs_rto_ipaddr; 1042*4882a593Smuzhiyun __u64 sas_maxrto; /* Maximum Observed RTO for period */ 1043*4882a593Smuzhiyun __u64 sas_isacks; /* SACKs received */ 1044*4882a593Smuzhiyun __u64 sas_osacks; /* SACKs sent */ 1045*4882a593Smuzhiyun __u64 sas_opackets; /* Packets sent */ 1046*4882a593Smuzhiyun __u64 sas_ipackets; /* Packets received */ 1047*4882a593Smuzhiyun __u64 sas_rtxchunks; /* Retransmitted Chunks */ 1048*4882a593Smuzhiyun __u64 sas_outofseqtsns;/* TSN received > next expected */ 1049*4882a593Smuzhiyun __u64 sas_idupchunks; /* Dups received (ordered+unordered) */ 1050*4882a593Smuzhiyun __u64 sas_gapcnt; /* Gap Acknowledgements Received */ 1051*4882a593Smuzhiyun __u64 sas_ouodchunks; /* Unordered data chunks sent */ 1052*4882a593Smuzhiyun __u64 sas_iuodchunks; /* Unordered data chunks received */ 1053*4882a593Smuzhiyun __u64 sas_oodchunks; /* Ordered data chunks sent */ 1054*4882a593Smuzhiyun __u64 sas_iodchunks; /* Ordered data chunks received */ 1055*4882a593Smuzhiyun __u64 sas_octrlchunks; /* Control chunks sent */ 1056*4882a593Smuzhiyun __u64 sas_ictrlchunks; /* Control chunks received */ 1057*4882a593Smuzhiyun }; 1058*4882a593Smuzhiyun 1059*4882a593Smuzhiyun /* 1060*4882a593Smuzhiyun * 8.1 sctp_bindx() 1061*4882a593Smuzhiyun * 1062*4882a593Smuzhiyun * The flags parameter is formed from the bitwise OR of zero or more of the 1063*4882a593Smuzhiyun * following currently defined flags: 1064*4882a593Smuzhiyun */ 1065*4882a593Smuzhiyun #define SCTP_BINDX_ADD_ADDR 0x01 1066*4882a593Smuzhiyun #define SCTP_BINDX_REM_ADDR 0x02 1067*4882a593Smuzhiyun 1068*4882a593Smuzhiyun /* This is the structure that is passed as an argument(optval) to 1069*4882a593Smuzhiyun * getsockopt(SCTP_SOCKOPT_PEELOFF). 1070*4882a593Smuzhiyun */ 1071*4882a593Smuzhiyun typedef struct { 1072*4882a593Smuzhiyun sctp_assoc_t associd; 1073*4882a593Smuzhiyun int sd; 1074*4882a593Smuzhiyun } sctp_peeloff_arg_t; 1075*4882a593Smuzhiyun 1076*4882a593Smuzhiyun typedef struct { 1077*4882a593Smuzhiyun sctp_peeloff_arg_t p_arg; 1078*4882a593Smuzhiyun unsigned flags; 1079*4882a593Smuzhiyun } sctp_peeloff_flags_arg_t; 1080*4882a593Smuzhiyun 1081*4882a593Smuzhiyun /* 1082*4882a593Smuzhiyun * Peer Address Thresholds socket option 1083*4882a593Smuzhiyun */ 1084*4882a593Smuzhiyun struct sctp_paddrthlds { 1085*4882a593Smuzhiyun sctp_assoc_t spt_assoc_id; 1086*4882a593Smuzhiyun struct sockaddr_storage spt_address; 1087*4882a593Smuzhiyun __u16 spt_pathmaxrxt; 1088*4882a593Smuzhiyun __u16 spt_pathpfthld; 1089*4882a593Smuzhiyun }; 1090*4882a593Smuzhiyun 1091*4882a593Smuzhiyun /* Use a new structure with spt_pathcpthld for back compatibility */ 1092*4882a593Smuzhiyun struct sctp_paddrthlds_v2 { 1093*4882a593Smuzhiyun sctp_assoc_t spt_assoc_id; 1094*4882a593Smuzhiyun struct sockaddr_storage spt_address; 1095*4882a593Smuzhiyun __u16 spt_pathmaxrxt; 1096*4882a593Smuzhiyun __u16 spt_pathpfthld; 1097*4882a593Smuzhiyun __u16 spt_pathcpthld; 1098*4882a593Smuzhiyun }; 1099*4882a593Smuzhiyun 1100*4882a593Smuzhiyun /* 1101*4882a593Smuzhiyun * Socket Option for Getting the Association/Stream-Specific PR-SCTP Status 1102*4882a593Smuzhiyun */ 1103*4882a593Smuzhiyun struct sctp_prstatus { 1104*4882a593Smuzhiyun sctp_assoc_t sprstat_assoc_id; 1105*4882a593Smuzhiyun __u16 sprstat_sid; 1106*4882a593Smuzhiyun __u16 sprstat_policy; 1107*4882a593Smuzhiyun __u64 sprstat_abandoned_unsent; 1108*4882a593Smuzhiyun __u64 sprstat_abandoned_sent; 1109*4882a593Smuzhiyun }; 1110*4882a593Smuzhiyun 1111*4882a593Smuzhiyun struct sctp_default_prinfo { 1112*4882a593Smuzhiyun sctp_assoc_t pr_assoc_id; 1113*4882a593Smuzhiyun __u32 pr_value; 1114*4882a593Smuzhiyun __u16 pr_policy; 1115*4882a593Smuzhiyun }; 1116*4882a593Smuzhiyun 1117*4882a593Smuzhiyun struct sctp_info { 1118*4882a593Smuzhiyun __u32 sctpi_tag; 1119*4882a593Smuzhiyun __u32 sctpi_state; 1120*4882a593Smuzhiyun __u32 sctpi_rwnd; 1121*4882a593Smuzhiyun __u16 sctpi_unackdata; 1122*4882a593Smuzhiyun __u16 sctpi_penddata; 1123*4882a593Smuzhiyun __u16 sctpi_instrms; 1124*4882a593Smuzhiyun __u16 sctpi_outstrms; 1125*4882a593Smuzhiyun __u32 sctpi_fragmentation_point; 1126*4882a593Smuzhiyun __u32 sctpi_inqueue; 1127*4882a593Smuzhiyun __u32 sctpi_outqueue; 1128*4882a593Smuzhiyun __u32 sctpi_overall_error; 1129*4882a593Smuzhiyun __u32 sctpi_max_burst; 1130*4882a593Smuzhiyun __u32 sctpi_maxseg; 1131*4882a593Smuzhiyun __u32 sctpi_peer_rwnd; 1132*4882a593Smuzhiyun __u32 sctpi_peer_tag; 1133*4882a593Smuzhiyun __u8 sctpi_peer_capable; 1134*4882a593Smuzhiyun __u8 sctpi_peer_sack; 1135*4882a593Smuzhiyun __u16 __reserved1; 1136*4882a593Smuzhiyun 1137*4882a593Smuzhiyun /* assoc status info */ 1138*4882a593Smuzhiyun __u64 sctpi_isacks; 1139*4882a593Smuzhiyun __u64 sctpi_osacks; 1140*4882a593Smuzhiyun __u64 sctpi_opackets; 1141*4882a593Smuzhiyun __u64 sctpi_ipackets; 1142*4882a593Smuzhiyun __u64 sctpi_rtxchunks; 1143*4882a593Smuzhiyun __u64 sctpi_outofseqtsns; 1144*4882a593Smuzhiyun __u64 sctpi_idupchunks; 1145*4882a593Smuzhiyun __u64 sctpi_gapcnt; 1146*4882a593Smuzhiyun __u64 sctpi_ouodchunks; 1147*4882a593Smuzhiyun __u64 sctpi_iuodchunks; 1148*4882a593Smuzhiyun __u64 sctpi_oodchunks; 1149*4882a593Smuzhiyun __u64 sctpi_iodchunks; 1150*4882a593Smuzhiyun __u64 sctpi_octrlchunks; 1151*4882a593Smuzhiyun __u64 sctpi_ictrlchunks; 1152*4882a593Smuzhiyun 1153*4882a593Smuzhiyun /* primary transport info */ 1154*4882a593Smuzhiyun struct sockaddr_storage sctpi_p_address; 1155*4882a593Smuzhiyun __s32 sctpi_p_state; 1156*4882a593Smuzhiyun __u32 sctpi_p_cwnd; 1157*4882a593Smuzhiyun __u32 sctpi_p_srtt; 1158*4882a593Smuzhiyun __u32 sctpi_p_rto; 1159*4882a593Smuzhiyun __u32 sctpi_p_hbinterval; 1160*4882a593Smuzhiyun __u32 sctpi_p_pathmaxrxt; 1161*4882a593Smuzhiyun __u32 sctpi_p_sackdelay; 1162*4882a593Smuzhiyun __u32 sctpi_p_sackfreq; 1163*4882a593Smuzhiyun __u32 sctpi_p_ssthresh; 1164*4882a593Smuzhiyun __u32 sctpi_p_partial_bytes_acked; 1165*4882a593Smuzhiyun __u32 sctpi_p_flight_size; 1166*4882a593Smuzhiyun __u16 sctpi_p_error; 1167*4882a593Smuzhiyun __u16 __reserved2; 1168*4882a593Smuzhiyun 1169*4882a593Smuzhiyun /* sctp sock info */ 1170*4882a593Smuzhiyun __u32 sctpi_s_autoclose; 1171*4882a593Smuzhiyun __u32 sctpi_s_adaptation_ind; 1172*4882a593Smuzhiyun __u32 sctpi_s_pd_point; 1173*4882a593Smuzhiyun __u8 sctpi_s_nodelay; 1174*4882a593Smuzhiyun __u8 sctpi_s_disable_fragments; 1175*4882a593Smuzhiyun __u8 sctpi_s_v4mapped; 1176*4882a593Smuzhiyun __u8 sctpi_s_frag_interleave; 1177*4882a593Smuzhiyun __u32 sctpi_s_type; 1178*4882a593Smuzhiyun __u32 __reserved3; 1179*4882a593Smuzhiyun }; 1180*4882a593Smuzhiyun 1181*4882a593Smuzhiyun struct sctp_reset_streams { 1182*4882a593Smuzhiyun sctp_assoc_t srs_assoc_id; 1183*4882a593Smuzhiyun uint16_t srs_flags; 1184*4882a593Smuzhiyun uint16_t srs_number_streams; /* 0 == ALL */ 1185*4882a593Smuzhiyun uint16_t srs_stream_list[]; /* list if srs_num_streams is not 0 */ 1186*4882a593Smuzhiyun }; 1187*4882a593Smuzhiyun 1188*4882a593Smuzhiyun struct sctp_add_streams { 1189*4882a593Smuzhiyun sctp_assoc_t sas_assoc_id; 1190*4882a593Smuzhiyun uint16_t sas_instrms; 1191*4882a593Smuzhiyun uint16_t sas_outstrms; 1192*4882a593Smuzhiyun }; 1193*4882a593Smuzhiyun 1194*4882a593Smuzhiyun struct sctp_event { 1195*4882a593Smuzhiyun sctp_assoc_t se_assoc_id; 1196*4882a593Smuzhiyun uint16_t se_type; 1197*4882a593Smuzhiyun uint8_t se_on; 1198*4882a593Smuzhiyun }; 1199*4882a593Smuzhiyun 1200*4882a593Smuzhiyun /* SCTP Stream schedulers */ 1201*4882a593Smuzhiyun enum sctp_sched_type { 1202*4882a593Smuzhiyun SCTP_SS_FCFS, 1203*4882a593Smuzhiyun SCTP_SS_DEFAULT = SCTP_SS_FCFS, 1204*4882a593Smuzhiyun SCTP_SS_PRIO, 1205*4882a593Smuzhiyun SCTP_SS_RR, 1206*4882a593Smuzhiyun SCTP_SS_MAX = SCTP_SS_RR 1207*4882a593Smuzhiyun }; 1208*4882a593Smuzhiyun 1209*4882a593Smuzhiyun #endif /* _UAPI_SCTP_H */ 1210