1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _NETINET_SCTP_H 28*7c478bd9Sstevel@tonic-gate #define _NETINET_SCTP_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 33*7c478bd9Sstevel@tonic-gate extern "C" { 34*7c478bd9Sstevel@tonic-gate #endif 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate #include <sys/types.h> 37*7c478bd9Sstevel@tonic-gate 38*7c478bd9Sstevel@tonic-gate /* 39*7c478bd9Sstevel@tonic-gate * This file contains the structure defintions and function prototypes 40*7c478bd9Sstevel@tonic-gate * described in the IETF SCTP socket API document. 41*7c478bd9Sstevel@tonic-gate */ 42*7c478bd9Sstevel@tonic-gate 43*7c478bd9Sstevel@tonic-gate /* SCTP association ID type. */ 44*7c478bd9Sstevel@tonic-gate typedef int sctp_assoc_t; 45*7c478bd9Sstevel@tonic-gate typedef int32_t sctp_assoc32_t; 46*7c478bd9Sstevel@tonic-gate 47*7c478bd9Sstevel@tonic-gate /* 48*7c478bd9Sstevel@tonic-gate * SCTP socket options 49*7c478bd9Sstevel@tonic-gate */ 50*7c478bd9Sstevel@tonic-gate #define SCTP_RTOINFO 1 51*7c478bd9Sstevel@tonic-gate #define SCTP_ASSOCINFO 2 52*7c478bd9Sstevel@tonic-gate #define SCTP_INITMSG 3 53*7c478bd9Sstevel@tonic-gate #define SCTP_NODELAY 4 54*7c478bd9Sstevel@tonic-gate #define SCTP_AUTOCLOSE 5 55*7c478bd9Sstevel@tonic-gate #define SCTP_SET_PEER_PRIMARY_ADDR 6 56*7c478bd9Sstevel@tonic-gate #define SCTP_PRIMARY_ADDR 7 57*7c478bd9Sstevel@tonic-gate #define SCTP_ADAPTION_LAYER 8 58*7c478bd9Sstevel@tonic-gate #define SCTP_DISABLE_FRAGMENTS 9 59*7c478bd9Sstevel@tonic-gate #define SCTP_PEER_ADDR_PARAMS 10 60*7c478bd9Sstevel@tonic-gate #define SCTP_DEFAULT_SEND_PARAM 11 61*7c478bd9Sstevel@tonic-gate #define SCTP_EVENTS 12 62*7c478bd9Sstevel@tonic-gate #define SCTP_I_WANT_MAPPED_V4_ADDR 13 63*7c478bd9Sstevel@tonic-gate #define SCTP_MAXSEG 14 64*7c478bd9Sstevel@tonic-gate #define SCTP_STATUS 15 65*7c478bd9Sstevel@tonic-gate #define SCTP_GET_PEER_ADDR_INFO 16 66*7c478bd9Sstevel@tonic-gate 67*7c478bd9Sstevel@tonic-gate /* 68*7c478bd9Sstevel@tonic-gate * Private socket options 69*7c478bd9Sstevel@tonic-gate */ 70*7c478bd9Sstevel@tonic-gate #define SCTP_GET_NLADDRS 17 71*7c478bd9Sstevel@tonic-gate #define SCTP_GET_LADDRS 18 72*7c478bd9Sstevel@tonic-gate #define SCTP_GET_NPADDRS 19 73*7c478bd9Sstevel@tonic-gate #define SCTP_GET_PADDRS 20 74*7c478bd9Sstevel@tonic-gate #define SCTP_ADD_ADDR 21 75*7c478bd9Sstevel@tonic-gate #define SCTP_REM_ADDR 22 76*7c478bd9Sstevel@tonic-gate 77*7c478bd9Sstevel@tonic-gate /* 78*7c478bd9Sstevel@tonic-gate * Additional SCTP socket options. This socket option is used to enable or 79*7c478bd9Sstevel@tonic-gate * disable PR-SCTP support prior to establishing an association. By default, 80*7c478bd9Sstevel@tonic-gate * PR-SCTP support is disabled. 81*7c478bd9Sstevel@tonic-gate */ 82*7c478bd9Sstevel@tonic-gate #define SCTP_PRSCTP 23 83*7c478bd9Sstevel@tonic-gate 84*7c478bd9Sstevel@tonic-gate /* 85*7c478bd9Sstevel@tonic-gate * Ancillary data identifiers 86*7c478bd9Sstevel@tonic-gate */ 87*7c478bd9Sstevel@tonic-gate #define SCTP_SNDRCV 0x100 88*7c478bd9Sstevel@tonic-gate #define SCTP_INIT 0x101 89*7c478bd9Sstevel@tonic-gate 90*7c478bd9Sstevel@tonic-gate /* 91*7c478bd9Sstevel@tonic-gate * Notification types 92*7c478bd9Sstevel@tonic-gate */ 93*7c478bd9Sstevel@tonic-gate #define SCTP_ASSOC_CHANGE 1 94*7c478bd9Sstevel@tonic-gate #define SCTP_PEER_ADDR_CHANGE 2 95*7c478bd9Sstevel@tonic-gate #define SCTP_REMOTE_ERROR 3 96*7c478bd9Sstevel@tonic-gate #define SCTP_SEND_FAILED 4 97*7c478bd9Sstevel@tonic-gate #define SCTP_SHUTDOWN_EVENT 5 98*7c478bd9Sstevel@tonic-gate #define SCTP_ADAPTION_INDICATION 6 99*7c478bd9Sstevel@tonic-gate #define SCTP_PARTIAL_DELIVERY_EVENT 7 100*7c478bd9Sstevel@tonic-gate 101*7c478bd9Sstevel@tonic-gate /* 102*7c478bd9Sstevel@tonic-gate * SCTP Ancillary Data Definitions 103*7c478bd9Sstevel@tonic-gate */ 104*7c478bd9Sstevel@tonic-gate 105*7c478bd9Sstevel@tonic-gate /* 106*7c478bd9Sstevel@tonic-gate * sctp_initmsg structure provides information for initializing new SCTP 107*7c478bd9Sstevel@tonic-gate * associations with sendmsg(). The SCTP_INITMSG socket option uses 108*7c478bd9Sstevel@tonic-gate * this same data structure. 109*7c478bd9Sstevel@tonic-gate */ 110*7c478bd9Sstevel@tonic-gate struct sctp_initmsg { 111*7c478bd9Sstevel@tonic-gate uint16_t sinit_num_ostreams; 112*7c478bd9Sstevel@tonic-gate uint16_t sinit_max_instreams; 113*7c478bd9Sstevel@tonic-gate uint16_t sinit_max_attempts; 114*7c478bd9Sstevel@tonic-gate uint16_t sinit_max_init_timeo; 115*7c478bd9Sstevel@tonic-gate }; 116*7c478bd9Sstevel@tonic-gate 117*7c478bd9Sstevel@tonic-gate /* 118*7c478bd9Sstevel@tonic-gate * sctp_sndrcvinfo structure specifies SCTP options for sendmsg() and 119*7c478bd9Sstevel@tonic-gate * describes SCTP header information about a received message through 120*7c478bd9Sstevel@tonic-gate * recvmsg(). 121*7c478bd9Sstevel@tonic-gate */ 122*7c478bd9Sstevel@tonic-gate struct sctp_sndrcvinfo { 123*7c478bd9Sstevel@tonic-gate uint16_t sinfo_stream; 124*7c478bd9Sstevel@tonic-gate uint16_t sinfo_ssn; 125*7c478bd9Sstevel@tonic-gate uint16_t sinfo_flags; 126*7c478bd9Sstevel@tonic-gate uint32_t sinfo_ppid; 127*7c478bd9Sstevel@tonic-gate uint32_t sinfo_context; 128*7c478bd9Sstevel@tonic-gate uint32_t sinfo_timetolive; 129*7c478bd9Sstevel@tonic-gate uint32_t sinfo_tsn; 130*7c478bd9Sstevel@tonic-gate uint32_t sinfo_cumtsn; 131*7c478bd9Sstevel@tonic-gate sctp_assoc_t sinfo_assoc_id; 132*7c478bd9Sstevel@tonic-gate }; 133*7c478bd9Sstevel@tonic-gate 134*7c478bd9Sstevel@tonic-gate /* sinfo_flags */ 135*7c478bd9Sstevel@tonic-gate #define MSG_UNORDERED 0x01 /* Unordered data */ 136*7c478bd9Sstevel@tonic-gate #define MSG_ABORT 0x02 /* Abort the connection */ 137*7c478bd9Sstevel@tonic-gate #define MSG_EOF 0x04 /* Shutdown the connection */ 138*7c478bd9Sstevel@tonic-gate 139*7c478bd9Sstevel@tonic-gate /* 140*7c478bd9Sstevel@tonic-gate * Use destination addr passed as parameter, not the association primary one. 141*7c478bd9Sstevel@tonic-gate */ 142*7c478bd9Sstevel@tonic-gate #define MSG_ADDR_OVER 0x08 143*7c478bd9Sstevel@tonic-gate /* 144*7c478bd9Sstevel@tonic-gate * This flag when set in sinfo_flags is used alongwith sinfo_timetolive to 145*7c478bd9Sstevel@tonic-gate * implement the "timed reliability" service discussed in RFC 3758. 146*7c478bd9Sstevel@tonic-gate */ 147*7c478bd9Sstevel@tonic-gate #define MSG_PR_SCTP 0x10 148*7c478bd9Sstevel@tonic-gate /* 149*7c478bd9Sstevel@tonic-gate * SCTP notification definitions 150*7c478bd9Sstevel@tonic-gate */ 151*7c478bd9Sstevel@tonic-gate 152*7c478bd9Sstevel@tonic-gate /* 153*7c478bd9Sstevel@tonic-gate * To receive any ancillary data or notifications, the application can 154*7c478bd9Sstevel@tonic-gate * register it's interest by calling the SCTP_EVENTS setsockopt() with 155*7c478bd9Sstevel@tonic-gate * the sctp_event_subscribe structure. 156*7c478bd9Sstevel@tonic-gate */ 157*7c478bd9Sstevel@tonic-gate struct sctp_event_subscribe { 158*7c478bd9Sstevel@tonic-gate uint8_t sctp_data_io_event; 159*7c478bd9Sstevel@tonic-gate uint8_t sctp_association_event; 160*7c478bd9Sstevel@tonic-gate uint8_t sctp_address_event; 161*7c478bd9Sstevel@tonic-gate uint8_t sctp_send_failure_event; 162*7c478bd9Sstevel@tonic-gate uint8_t sctp_peer_error_event; 163*7c478bd9Sstevel@tonic-gate uint8_t sctp_shutdown_event; 164*7c478bd9Sstevel@tonic-gate uint8_t sctp_partial_delivery_event; 165*7c478bd9Sstevel@tonic-gate uint8_t sctp_adaption_layer_event; 166*7c478bd9Sstevel@tonic-gate }; 167*7c478bd9Sstevel@tonic-gate 168*7c478bd9Sstevel@tonic-gate /* Association events used in sctp_assoc_change structure */ 169*7c478bd9Sstevel@tonic-gate #define SCTP_COMM_UP 0 170*7c478bd9Sstevel@tonic-gate #define SCTP_COMM_LOST 1 171*7c478bd9Sstevel@tonic-gate #define SCTP_RESTART 2 172*7c478bd9Sstevel@tonic-gate #define SCTP_SHUTDOWN_COMP 3 173*7c478bd9Sstevel@tonic-gate #define SCTP_CANT_STR_ASSOC 4 174*7c478bd9Sstevel@tonic-gate 175*7c478bd9Sstevel@tonic-gate /* 176*7c478bd9Sstevel@tonic-gate * Association flags. This flags is filled in the sac_flags for a SCTP_COMM_UP 177*7c478bd9Sstevel@tonic-gate * event if the association supports PR-SCTP. 178*7c478bd9Sstevel@tonic-gate */ 179*7c478bd9Sstevel@tonic-gate #define SCTP_PRSCTP_CAPABLE 0x01 180*7c478bd9Sstevel@tonic-gate 181*7c478bd9Sstevel@tonic-gate /* 182*7c478bd9Sstevel@tonic-gate * sctp_assoc_change notification informs the socket that an SCTP association 183*7c478bd9Sstevel@tonic-gate * has either begun or ended. The identifier for a new association is 184*7c478bd9Sstevel@tonic-gate * provided by this notification. 185*7c478bd9Sstevel@tonic-gate */ 186*7c478bd9Sstevel@tonic-gate struct sctp_assoc_change { 187*7c478bd9Sstevel@tonic-gate uint16_t sac_type; 188*7c478bd9Sstevel@tonic-gate uint16_t sac_flags; 189*7c478bd9Sstevel@tonic-gate uint32_t sac_length; 190*7c478bd9Sstevel@tonic-gate uint16_t sac_state; 191*7c478bd9Sstevel@tonic-gate uint16_t sac_error; 192*7c478bd9Sstevel@tonic-gate uint16_t sac_outbound_streams; 193*7c478bd9Sstevel@tonic-gate uint16_t sac_inbound_streams; 194*7c478bd9Sstevel@tonic-gate sctp_assoc_t sac_assoc_id; 195*7c478bd9Sstevel@tonic-gate /* 196*7c478bd9Sstevel@tonic-gate * The assoc ID can be followed by the ABORT chunk if available. 197*7c478bd9Sstevel@tonic-gate */ 198*7c478bd9Sstevel@tonic-gate }; 199*7c478bd9Sstevel@tonic-gate 200*7c478bd9Sstevel@tonic-gate /* 201*7c478bd9Sstevel@tonic-gate * A remote peer may send an Operational Error message to its peer. This 202*7c478bd9Sstevel@tonic-gate * message indicates a variety of error conditions on an association. 203*7c478bd9Sstevel@tonic-gate * The entire ERROR chunk as it appears on the wire is included in a 204*7c478bd9Sstevel@tonic-gate * SCTP_REMOTE_ERROR event. Refer to the SCTP specification RFC2960 205*7c478bd9Sstevel@tonic-gate * and any extensions for a list of possible error formats. 206*7c478bd9Sstevel@tonic-gate */ 207*7c478bd9Sstevel@tonic-gate struct sctp_remote_error { 208*7c478bd9Sstevel@tonic-gate uint16_t sre_type; 209*7c478bd9Sstevel@tonic-gate uint16_t sre_flags; 210*7c478bd9Sstevel@tonic-gate uint32_t sre_length; 211*7c478bd9Sstevel@tonic-gate uint16_t sre_error; 212*7c478bd9Sstevel@tonic-gate sctp_assoc_t sre_assoc_id; 213*7c478bd9Sstevel@tonic-gate /* 214*7c478bd9Sstevel@tonic-gate * The assoc ID is followed by the actual error chunk. 215*7c478bd9Sstevel@tonic-gate */ 216*7c478bd9Sstevel@tonic-gate }; 217*7c478bd9Sstevel@tonic-gate 218*7c478bd9Sstevel@tonic-gate /* 219*7c478bd9Sstevel@tonic-gate * Note: 220*7c478bd9Sstevel@tonic-gate * 221*7c478bd9Sstevel@tonic-gate * In order to keep the offsets and size of the structure having a 222*7c478bd9Sstevel@tonic-gate * struct sockaddr_storage field the same between a 32-bit application 223*7c478bd9Sstevel@tonic-gate * and a 64-bit amd64 kernel, we use a #pragma pack(4) for those 224*7c478bd9Sstevel@tonic-gate * structures. 225*7c478bd9Sstevel@tonic-gate */ 226*7c478bd9Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 227*7c478bd9Sstevel@tonic-gate #pragma pack(4) 228*7c478bd9Sstevel@tonic-gate #endif 229*7c478bd9Sstevel@tonic-gate 230*7c478bd9Sstevel@tonic-gate /* Address change event state */ 231*7c478bd9Sstevel@tonic-gate #define SCTP_ADDR_AVAILABLE 0 232*7c478bd9Sstevel@tonic-gate #define SCTP_ADDR_UNREACHABLE 1 233*7c478bd9Sstevel@tonic-gate #define SCTP_ADDR_REMOVED 2 234*7c478bd9Sstevel@tonic-gate #define SCTP_ADDR_ADDED 3 235*7c478bd9Sstevel@tonic-gate #define SCTP_ADDR_MADE_PRIM 4 236*7c478bd9Sstevel@tonic-gate 237*7c478bd9Sstevel@tonic-gate /* 238*7c478bd9Sstevel@tonic-gate * When a destination address on a multi-homed peer encounters a change, 239*7c478bd9Sstevel@tonic-gate * an interface details event, sctp_paddr_change, is sent to the socket. 240*7c478bd9Sstevel@tonic-gate */ 241*7c478bd9Sstevel@tonic-gate struct sctp_paddr_change { 242*7c478bd9Sstevel@tonic-gate uint16_t spc_type; 243*7c478bd9Sstevel@tonic-gate uint16_t spc_flags; 244*7c478bd9Sstevel@tonic-gate uint32_t spc_length; 245*7c478bd9Sstevel@tonic-gate struct sockaddr_storage spc_aaddr; 246*7c478bd9Sstevel@tonic-gate int spc_state; 247*7c478bd9Sstevel@tonic-gate int spc_error; 248*7c478bd9Sstevel@tonic-gate sctp_assoc_t spc_assoc_id; 249*7c478bd9Sstevel@tonic-gate }; 250*7c478bd9Sstevel@tonic-gate 251*7c478bd9Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 252*7c478bd9Sstevel@tonic-gate #pragma pack() 253*7c478bd9Sstevel@tonic-gate #endif 254*7c478bd9Sstevel@tonic-gate 255*7c478bd9Sstevel@tonic-gate /* flags used in sctp_send_failed notification. */ 256*7c478bd9Sstevel@tonic-gate #define SCTP_DATA_UNSENT 1 257*7c478bd9Sstevel@tonic-gate #define SCTP_DATA_SENT 2 258*7c478bd9Sstevel@tonic-gate 259*7c478bd9Sstevel@tonic-gate /* 260*7c478bd9Sstevel@tonic-gate * If SCTP cannot deliver a message it may return the message as a 261*7c478bd9Sstevel@tonic-gate * notification using the following structure. 262*7c478bd9Sstevel@tonic-gate */ 263*7c478bd9Sstevel@tonic-gate struct sctp_send_failed { 264*7c478bd9Sstevel@tonic-gate uint16_t ssf_type; 265*7c478bd9Sstevel@tonic-gate uint16_t ssf_flags; 266*7c478bd9Sstevel@tonic-gate uint32_t ssf_length; 267*7c478bd9Sstevel@tonic-gate uint32_t ssf_error; 268*7c478bd9Sstevel@tonic-gate struct sctp_sndrcvinfo ssf_info; 269*7c478bd9Sstevel@tonic-gate sctp_assoc_t ssf_assoc_id; 270*7c478bd9Sstevel@tonic-gate /* 271*7c478bd9Sstevel@tonic-gate * The assoc ID is followed by the failed message. 272*7c478bd9Sstevel@tonic-gate */ 273*7c478bd9Sstevel@tonic-gate }; 274*7c478bd9Sstevel@tonic-gate 275*7c478bd9Sstevel@tonic-gate /* 276*7c478bd9Sstevel@tonic-gate * When a peer sends a SHUTDOWN, SCTP delivers the sctp_shutdown_event 277*7c478bd9Sstevel@tonic-gate * notification to inform the socket user that it should cease sending data. 278*7c478bd9Sstevel@tonic-gate */ 279*7c478bd9Sstevel@tonic-gate struct sctp_shutdown_event { 280*7c478bd9Sstevel@tonic-gate uint16_t sse_type; 281*7c478bd9Sstevel@tonic-gate uint16_t sse_flags; 282*7c478bd9Sstevel@tonic-gate uint16_t sse_length; 283*7c478bd9Sstevel@tonic-gate sctp_assoc_t sse_assoc_id; 284*7c478bd9Sstevel@tonic-gate }; 285*7c478bd9Sstevel@tonic-gate 286*7c478bd9Sstevel@tonic-gate /* 287*7c478bd9Sstevel@tonic-gate * When a peer sends an Adaption Layer Indication parameter, SCTP 288*7c478bd9Sstevel@tonic-gate * delivers the sctp_adaption_event notification to inform the socket 289*7c478bd9Sstevel@tonic-gate * user the peer's requested adaption layer. 290*7c478bd9Sstevel@tonic-gate */ 291*7c478bd9Sstevel@tonic-gate struct sctp_adaption_event { 292*7c478bd9Sstevel@tonic-gate uint16_t sai_type; 293*7c478bd9Sstevel@tonic-gate uint16_t sai_flags; 294*7c478bd9Sstevel@tonic-gate uint32_t sai_length; 295*7c478bd9Sstevel@tonic-gate uint32_t sai_adaption_ind; 296*7c478bd9Sstevel@tonic-gate sctp_assoc_t sai_assoc_id; 297*7c478bd9Sstevel@tonic-gate }; 298*7c478bd9Sstevel@tonic-gate 299*7c478bd9Sstevel@tonic-gate /* Possible values in pdapi_indication for sctp_pdapi_event notification. */ 300*7c478bd9Sstevel@tonic-gate #define SCTP_PARTIAL_DELIVERY_ABORTED 1 301*7c478bd9Sstevel@tonic-gate 302*7c478bd9Sstevel@tonic-gate /* 303*7c478bd9Sstevel@tonic-gate * When a receiver is engaged in a partial delivery of a message the 304*7c478bd9Sstevel@tonic-gate * sctp_pdapi_event notification is used to indicate various events. 305*7c478bd9Sstevel@tonic-gate */ 306*7c478bd9Sstevel@tonic-gate struct sctp_pdapi_event { 307*7c478bd9Sstevel@tonic-gate uint16_t pdapi_type; 308*7c478bd9Sstevel@tonic-gate uint16_t pdapi_flags; 309*7c478bd9Sstevel@tonic-gate uint32_t pdapi_length; 310*7c478bd9Sstevel@tonic-gate uint32_t pdapi_indication; 311*7c478bd9Sstevel@tonic-gate sctp_assoc_t pdapi_assoc_id; 312*7c478bd9Sstevel@tonic-gate }; 313*7c478bd9Sstevel@tonic-gate 314*7c478bd9Sstevel@tonic-gate /* 315*7c478bd9Sstevel@tonic-gate * The sctp_notification structure is defined as the union of all 316*7c478bd9Sstevel@tonic-gate * notification types defined above. 317*7c478bd9Sstevel@tonic-gate */ 318*7c478bd9Sstevel@tonic-gate union sctp_notification { 319*7c478bd9Sstevel@tonic-gate struct { 320*7c478bd9Sstevel@tonic-gate uint16_t sn_type; /* Notification type. */ 321*7c478bd9Sstevel@tonic-gate uint16_t sn_flags; 322*7c478bd9Sstevel@tonic-gate uint32_t sn_length; 323*7c478bd9Sstevel@tonic-gate } sn_header; 324*7c478bd9Sstevel@tonic-gate struct sctp_assoc_change sn_assoc_change; 325*7c478bd9Sstevel@tonic-gate struct sctp_paddr_change sn_paddr_change; 326*7c478bd9Sstevel@tonic-gate struct sctp_remote_error sn_remote_error; 327*7c478bd9Sstevel@tonic-gate struct sctp_send_failed sn_send_failed; 328*7c478bd9Sstevel@tonic-gate struct sctp_shutdown_event sn_shutdown_event; 329*7c478bd9Sstevel@tonic-gate struct sctp_adaption_event sn_adaption_event; 330*7c478bd9Sstevel@tonic-gate struct sctp_pdapi_event sn_pdapi_event; 331*7c478bd9Sstevel@tonic-gate }; 332*7c478bd9Sstevel@tonic-gate 333*7c478bd9Sstevel@tonic-gate /* 334*7c478bd9Sstevel@tonic-gate * sctp_opt_info() option definitions 335*7c478bd9Sstevel@tonic-gate */ 336*7c478bd9Sstevel@tonic-gate 337*7c478bd9Sstevel@tonic-gate /* 338*7c478bd9Sstevel@tonic-gate * The protocol parameters used to initialize and bound retransmission 339*7c478bd9Sstevel@tonic-gate * timeout (RTO) are tunable. See RFC2960 for more information on 340*7c478bd9Sstevel@tonic-gate * how these parameters are used in RTO calculation. 341*7c478bd9Sstevel@tonic-gate * 342*7c478bd9Sstevel@tonic-gate * The sctp_rtoinfo structure is used to access and modify these 343*7c478bd9Sstevel@tonic-gate * parameters. 344*7c478bd9Sstevel@tonic-gate */ 345*7c478bd9Sstevel@tonic-gate struct sctp_rtoinfo { 346*7c478bd9Sstevel@tonic-gate sctp_assoc_t srto_assoc_id; 347*7c478bd9Sstevel@tonic-gate uint32_t srto_initial; 348*7c478bd9Sstevel@tonic-gate uint32_t srto_max; 349*7c478bd9Sstevel@tonic-gate uint32_t srto_min; 350*7c478bd9Sstevel@tonic-gate }; 351*7c478bd9Sstevel@tonic-gate 352*7c478bd9Sstevel@tonic-gate /* 353*7c478bd9Sstevel@tonic-gate * The sctp_assocparams option is used to both examine and set various 354*7c478bd9Sstevel@tonic-gate * association and endpoint parameters. See RFC2960 for more information 355*7c478bd9Sstevel@tonic-gate * on how this parameter is used. The peer address parameter is ignored 356*7c478bd9Sstevel@tonic-gate * for one-to-one style socket. 357*7c478bd9Sstevel@tonic-gate */ 358*7c478bd9Sstevel@tonic-gate struct sctp_assocparams { 359*7c478bd9Sstevel@tonic-gate sctp_assoc_t sasoc_assoc_id; 360*7c478bd9Sstevel@tonic-gate uint16_t sasoc_asocmaxrxt; 361*7c478bd9Sstevel@tonic-gate uint16_t sasoc_number_peer_destinations; 362*7c478bd9Sstevel@tonic-gate uint32_t sasoc_peer_rwnd; 363*7c478bd9Sstevel@tonic-gate uint32_t sasoc_local_rwnd; 364*7c478bd9Sstevel@tonic-gate uint32_t sasoc_cookie_life; 365*7c478bd9Sstevel@tonic-gate }; 366*7c478bd9Sstevel@tonic-gate 367*7c478bd9Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 368*7c478bd9Sstevel@tonic-gate #pragma pack(4) 369*7c478bd9Sstevel@tonic-gate #endif 370*7c478bd9Sstevel@tonic-gate 371*7c478bd9Sstevel@tonic-gate /* sctp_paddrinfo reachability state. */ 372*7c478bd9Sstevel@tonic-gate #define SCTP_INACTIVE 1 373*7c478bd9Sstevel@tonic-gate #define SCTP_ACTIVE 2 374*7c478bd9Sstevel@tonic-gate 375*7c478bd9Sstevel@tonic-gate /* 376*7c478bd9Sstevel@tonic-gate * Applications can retrieve information about a specific peer address 377*7c478bd9Sstevel@tonic-gate * of an association, including its reachability state, congestion 378*7c478bd9Sstevel@tonic-gate * window, and retransmission timer values. This information is 379*7c478bd9Sstevel@tonic-gate * read-only. The sctp_paddrinfo structure is used to access this 380*7c478bd9Sstevel@tonic-gate * information: 381*7c478bd9Sstevel@tonic-gate */ 382*7c478bd9Sstevel@tonic-gate struct sctp_paddrinfo { 383*7c478bd9Sstevel@tonic-gate sctp_assoc_t spinfo_assoc_id; 384*7c478bd9Sstevel@tonic-gate struct sockaddr_storage spinfo_address; 385*7c478bd9Sstevel@tonic-gate int32_t spinfo_state; 386*7c478bd9Sstevel@tonic-gate uint32_t spinfo_cwnd; 387*7c478bd9Sstevel@tonic-gate uint32_t spinfo_srtt; 388*7c478bd9Sstevel@tonic-gate uint32_t spinfo_rto; 389*7c478bd9Sstevel@tonic-gate uint32_t spinfo_mtu; 390*7c478bd9Sstevel@tonic-gate }; 391*7c478bd9Sstevel@tonic-gate 392*7c478bd9Sstevel@tonic-gate /* 393*7c478bd9Sstevel@tonic-gate * Applications can enable or disable heartbeats for any peer address of 394*7c478bd9Sstevel@tonic-gate * an association, modify an address's heartbeat interval, force a 395*7c478bd9Sstevel@tonic-gate * heartbeat to be sent immediately, and adjust the address's maximum 396*7c478bd9Sstevel@tonic-gate * number of retransmissions sent before an address is considered 397*7c478bd9Sstevel@tonic-gate * unreachable. The sctp_paddrparams structure is used to access and modify 398*7c478bd9Sstevel@tonic-gate * an address' parameters. 399*7c478bd9Sstevel@tonic-gate */ 400*7c478bd9Sstevel@tonic-gate struct sctp_paddrparams { 401*7c478bd9Sstevel@tonic-gate sctp_assoc_t spp_assoc_id; 402*7c478bd9Sstevel@tonic-gate struct sockaddr_storage spp_address; 403*7c478bd9Sstevel@tonic-gate uint32_t spp_hbinterval; 404*7c478bd9Sstevel@tonic-gate uint16_t spp_pathmaxrxt; 405*7c478bd9Sstevel@tonic-gate }; 406*7c478bd9Sstevel@tonic-gate 407*7c478bd9Sstevel@tonic-gate /* 408*7c478bd9Sstevel@tonic-gate * A socket user can request that the peer mark the enclosed address as the 409*7c478bd9Sstevel@tonic-gate * association's primary. The enclosed address must be one of the 410*7c478bd9Sstevel@tonic-gate * association's locally bound addresses. The sctp_setpeerprim structure is 411*7c478bd9Sstevel@tonic-gate * used to make such request. 412*7c478bd9Sstevel@tonic-gate */ 413*7c478bd9Sstevel@tonic-gate struct sctp_setpeerprim { 414*7c478bd9Sstevel@tonic-gate sctp_assoc_t sspp_assoc_id; 415*7c478bd9Sstevel@tonic-gate struct sockaddr_storage sspp_addr; 416*7c478bd9Sstevel@tonic-gate }; 417*7c478bd9Sstevel@tonic-gate 418*7c478bd9Sstevel@tonic-gate /* 419*7c478bd9Sstevel@tonic-gate * A socket user can request that the local SCTP stack use the enclosed peer 420*7c478bd9Sstevel@tonic-gate * address as the association primary. The enclosed address must be one of 421*7c478bd9Sstevel@tonic-gate * the association peer's addresses. The sctp_setprim structure is used to 422*7c478bd9Sstevel@tonic-gate * make such request. 423*7c478bd9Sstevel@tonic-gate */ 424*7c478bd9Sstevel@tonic-gate struct sctp_setprim { 425*7c478bd9Sstevel@tonic-gate sctp_assoc_t ssp_assoc_id; 426*7c478bd9Sstevel@tonic-gate struct sockaddr_storage ssp_addr; 427*7c478bd9Sstevel@tonic-gate }; 428*7c478bd9Sstevel@tonic-gate 429*7c478bd9Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 430*7c478bd9Sstevel@tonic-gate #pragma pack() 431*7c478bd9Sstevel@tonic-gate #endif 432*7c478bd9Sstevel@tonic-gate 433*7c478bd9Sstevel@tonic-gate /* SCTP association states */ 434*7c478bd9Sstevel@tonic-gate #define SCTPS_IDLE -5 /* idle (opened, but not bound) */ 435*7c478bd9Sstevel@tonic-gate #define SCTPS_BOUND -4 /* bound, ready to connect or accept */ 436*7c478bd9Sstevel@tonic-gate #define SCTPS_LISTEN -3 /* listening for connection */ 437*7c478bd9Sstevel@tonic-gate #define SCTPS_COOKIE_WAIT -2 438*7c478bd9Sstevel@tonic-gate #define SCTPS_COOKIE_ECHOED -1 439*7c478bd9Sstevel@tonic-gate /* states < SCTPS_ESTABLISHED are those where connections not established */ 440*7c478bd9Sstevel@tonic-gate #define SCTPS_ESTABLISHED 0 /* established */ 441*7c478bd9Sstevel@tonic-gate #define SCTPS_SHUTDOWN_PENDING 1 442*7c478bd9Sstevel@tonic-gate #define SCTPS_SHUTDOWN_SENT 2 443*7c478bd9Sstevel@tonic-gate #define SCTPS_SHUTDOWN_RECEIVED 3 444*7c478bd9Sstevel@tonic-gate #define SCTPS_SHUTDOWN_ACK_SENT 4 445*7c478bd9Sstevel@tonic-gate 446*7c478bd9Sstevel@tonic-gate /* 447*7c478bd9Sstevel@tonic-gate * Applications can retrieve current status information about an 448*7c478bd9Sstevel@tonic-gate * association, including association state, peer receiver window size, 449*7c478bd9Sstevel@tonic-gate * number of unacked data chunks, and number of data chunks pending 450*7c478bd9Sstevel@tonic-gate * receipt. This information is read-only. The sctp_status structure is 451*7c478bd9Sstevel@tonic-gate * used to access this information: 452*7c478bd9Sstevel@tonic-gate */ 453*7c478bd9Sstevel@tonic-gate struct sctp_status { 454*7c478bd9Sstevel@tonic-gate sctp_assoc_t sstat_assoc_id; 455*7c478bd9Sstevel@tonic-gate int32_t sstat_state; 456*7c478bd9Sstevel@tonic-gate uint32_t sstat_rwnd; 457*7c478bd9Sstevel@tonic-gate uint16_t sstat_unackdata; 458*7c478bd9Sstevel@tonic-gate uint16_t sstat_penddata; 459*7c478bd9Sstevel@tonic-gate uint16_t sstat_instrms; 460*7c478bd9Sstevel@tonic-gate uint16_t sstat_outstrms; 461*7c478bd9Sstevel@tonic-gate uint32_t sstat_fragmentation_point; 462*7c478bd9Sstevel@tonic-gate struct sctp_paddrinfo sstat_primary; 463*7c478bd9Sstevel@tonic-gate }; 464*7c478bd9Sstevel@tonic-gate 465*7c478bd9Sstevel@tonic-gate /* Possible values for sstat_state */ 466*7c478bd9Sstevel@tonic-gate #define SCTP_CLOSED SCTPS_IDLE 467*7c478bd9Sstevel@tonic-gate #define SCTP_BOUND SCTPS_BOUND 468*7c478bd9Sstevel@tonic-gate #define SCTP_LISTEN SCTPS_LISTEN 469*7c478bd9Sstevel@tonic-gate #define SCTP_COOKIE_WAIT SCTPS_COOKIE_WAIT 470*7c478bd9Sstevel@tonic-gate #define SCTP_COOKIE_ECHOED SCTPS_COOKIE_ECHOED 471*7c478bd9Sstevel@tonic-gate #define SCTP_ESTABLISHED SCTPS_ESTABLISHED 472*7c478bd9Sstevel@tonic-gate #define SCTP_SHUTDOWN_PENDING SCTPS_SHUTDOWN_PENDING 473*7c478bd9Sstevel@tonic-gate #define SCTP_SHUTDOWN_SENT SCTPS_SHUTDOWN_SENT 474*7c478bd9Sstevel@tonic-gate #define SCTP_SHUTDOWN_RECEIVED SCTPS_SHUTDOWN_RECEIVED 475*7c478bd9Sstevel@tonic-gate #define SCTP_SHUTDOWN_ACK_SENT SCTPS_SHUTDOWN_ACK_SENT 476*7c478bd9Sstevel@tonic-gate 477*7c478bd9Sstevel@tonic-gate /* 478*7c478bd9Sstevel@tonic-gate * A socket user can request that the local endpoint set the specified 479*7c478bd9Sstevel@tonic-gate * Adaption Layer Indication parameter for all future INIT and INIT-ACK 480*7c478bd9Sstevel@tonic-gate * exchanges. The sctp_setadaption structure is used to make such request. 481*7c478bd9Sstevel@tonic-gate */ 482*7c478bd9Sstevel@tonic-gate struct sctp_setadaption { 483*7c478bd9Sstevel@tonic-gate uint32_t ssb_adaption_ind; 484*7c478bd9Sstevel@tonic-gate }; 485*7c478bd9Sstevel@tonic-gate 486*7c478bd9Sstevel@tonic-gate /* 487*7c478bd9Sstevel@tonic-gate * Private ioctl option structure 488*7c478bd9Sstevel@tonic-gate */ 489*7c478bd9Sstevel@tonic-gate struct sctpopt { 490*7c478bd9Sstevel@tonic-gate sctp_assoc_t sopt_aid; 491*7c478bd9Sstevel@tonic-gate int sopt_name; 492*7c478bd9Sstevel@tonic-gate uint_t sopt_len; 493*7c478bd9Sstevel@tonic-gate caddr_t sopt_val; 494*7c478bd9Sstevel@tonic-gate }; 495*7c478bd9Sstevel@tonic-gate 496*7c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 497*7c478bd9Sstevel@tonic-gate struct sctpopt32 { 498*7c478bd9Sstevel@tonic-gate sctp_assoc32_t sopt_aid; 499*7c478bd9Sstevel@tonic-gate int32_t sopt_name; 500*7c478bd9Sstevel@tonic-gate uint32_t sopt_len; 501*7c478bd9Sstevel@tonic-gate caddr32_t sopt_val; 502*7c478bd9Sstevel@tonic-gate }; 503*7c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 504*7c478bd9Sstevel@tonic-gate 505*7c478bd9Sstevel@tonic-gate /* Forward Cumulative TSN chunk entry. */ 506*7c478bd9Sstevel@tonic-gate typedef struct ftsn_entry_s { 507*7c478bd9Sstevel@tonic-gate uint16_t ftsn_sid; 508*7c478bd9Sstevel@tonic-gate uint16_t ftsn_ssn; 509*7c478bd9Sstevel@tonic-gate } ftsn_entry_t; 510*7c478bd9Sstevel@tonic-gate 511*7c478bd9Sstevel@tonic-gate /* 512*7c478bd9Sstevel@tonic-gate * New socket functions for SCTP 513*7c478bd9Sstevel@tonic-gate */ 514*7c478bd9Sstevel@tonic-gate 515*7c478bd9Sstevel@tonic-gate /* sctp_bindx() operations. */ 516*7c478bd9Sstevel@tonic-gate #define SCTP_BINDX_ADD_ADDR 1 517*7c478bd9Sstevel@tonic-gate #define SCTP_BINDX_REM_ADDR 2 518*7c478bd9Sstevel@tonic-gate 519*7c478bd9Sstevel@tonic-gate #if !defined(_KERNEL) || defined(_BOOT) 520*7c478bd9Sstevel@tonic-gate #ifdef __STDC__ 521*7c478bd9Sstevel@tonic-gate extern int sctp_bindx(int, void *, int, int); 522*7c478bd9Sstevel@tonic-gate extern void sctp_freeladdrs(void *); 523*7c478bd9Sstevel@tonic-gate extern void sctp_freepaddrs(void *); 524*7c478bd9Sstevel@tonic-gate extern int sctp_getladdrs(int, sctp_assoc_t, void **); 525*7c478bd9Sstevel@tonic-gate extern int sctp_getpaddrs(int, sctp_assoc_t, void **); 526*7c478bd9Sstevel@tonic-gate extern int sctp_opt_info(int, sctp_assoc_t, int, void *, socklen_t *); 527*7c478bd9Sstevel@tonic-gate extern int sctp_peeloff(int, sctp_assoc_t); 528*7c478bd9Sstevel@tonic-gate extern ssize_t sctp_recvmsg(int, void *, size_t, struct sockaddr *, 529*7c478bd9Sstevel@tonic-gate socklen_t *, struct sctp_sndrcvinfo *, int *msg_flags); 530*7c478bd9Sstevel@tonic-gate extern ssize_t sctp_send(int, const void *, size_t, 531*7c478bd9Sstevel@tonic-gate const struct sctp_sndrcvinfo *, int); 532*7c478bd9Sstevel@tonic-gate extern ssize_t sctp_sendmsg(int, const void *, size_t, const struct sockaddr *, 533*7c478bd9Sstevel@tonic-gate socklen_t, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t); 534*7c478bd9Sstevel@tonic-gate #else /* __STDC__ */ 535*7c478bd9Sstevel@tonic-gate extern int sctp_bindx(); 536*7c478bd9Sstevel@tonic-gate extern void sctp_freeladdrs(); 537*7c478bd9Sstevel@tonic-gate extern void sctp_freepaddrs(); 538*7c478bd9Sstevel@tonic-gate extern int sctp_getladdrs(); 539*7c478bd9Sstevel@tonic-gate extern int sctp_getpaddrs(); 540*7c478bd9Sstevel@tonic-gate extern int sctp_opt_info(); 541*7c478bd9Sstevel@tonic-gate extern int sctp_peeloff(); 542*7c478bd9Sstevel@tonic-gate extern ssize_t sctp_recvmsg(); 543*7c478bd9Sstevel@tonic-gate extern ssize_t sctp_send(); 544*7c478bd9Sstevel@tonic-gate extern ssize_t sctp_sendmsg(); 545*7c478bd9Sstevel@tonic-gate #endif /* __STDC__ */ 546*7c478bd9Sstevel@tonic-gate #endif /* !defined(_KERNEL) || defined(_BOOT) */ 547*7c478bd9Sstevel@tonic-gate 548*7c478bd9Sstevel@tonic-gate 549*7c478bd9Sstevel@tonic-gate /* 550*7c478bd9Sstevel@tonic-gate * SCTP protocol related elements. 551*7c478bd9Sstevel@tonic-gate */ 552*7c478bd9Sstevel@tonic-gate 553*7c478bd9Sstevel@tonic-gate /* All SCTP chunks and parameters are 32-bit aligned */ 554*7c478bd9Sstevel@tonic-gate #define SCTP_ALIGN 4 555*7c478bd9Sstevel@tonic-gate 556*7c478bd9Sstevel@tonic-gate /* 557*7c478bd9Sstevel@tonic-gate * Data chunk bit manipulations 558*7c478bd9Sstevel@tonic-gate */ 559*7c478bd9Sstevel@tonic-gate #define SCTP_DATA_EBIT 0x01 560*7c478bd9Sstevel@tonic-gate #define SCTP_TBIT 0x01 561*7c478bd9Sstevel@tonic-gate #define SCTP_DATA_BBIT 0x02 562*7c478bd9Sstevel@tonic-gate #define SCTP_DATA_UBIT 0x04 563*7c478bd9Sstevel@tonic-gate 564*7c478bd9Sstevel@tonic-gate #define SCTP_DATA_GET_BBIT(sdc) ((sdc)->sdh_flags & SCTP_DATA_BBIT) 565*7c478bd9Sstevel@tonic-gate #define SCTP_GET_TBIT(cp) ((cp)->sch_flags & SCTP_TBIT) 566*7c478bd9Sstevel@tonic-gate #define SCTP_DATA_GET_EBIT(sdc) ((sdc)->sdh_flags & SCTP_DATA_EBIT) 567*7c478bd9Sstevel@tonic-gate #define SCTP_DATA_GET_UBIT(sdc) ((sdc)->sdh_flags & SCTP_DATA_UBIT) 568*7c478bd9Sstevel@tonic-gate 569*7c478bd9Sstevel@tonic-gate #define SCTP_DATA_SET_BBIT(sdc) ((sdc)->sdh_flags |= SCTP_DATA_BBIT) 570*7c478bd9Sstevel@tonic-gate #define SCTP_SET_TBIT(cp) ((cp)->sch_flags |= SCTP_TBIT) 571*7c478bd9Sstevel@tonic-gate #define SCTP_DATA_SET_EBIT(sdc) ((sdc)->sdh_flags |= SCTP_DATA_EBIT) 572*7c478bd9Sstevel@tonic-gate #define SCTP_DATA_SET_UBIT(sdc) ((sdc)->sdh_flags |= SCTP_DATA_UBIT) 573*7c478bd9Sstevel@tonic-gate 574*7c478bd9Sstevel@tonic-gate /* SCTP common header */ 575*7c478bd9Sstevel@tonic-gate typedef struct sctp_hdr { 576*7c478bd9Sstevel@tonic-gate uint16_t sh_sport; 577*7c478bd9Sstevel@tonic-gate uint16_t sh_dport; 578*7c478bd9Sstevel@tonic-gate uint32_t sh_verf; 579*7c478bd9Sstevel@tonic-gate uint32_t sh_chksum; 580*7c478bd9Sstevel@tonic-gate } sctp_hdr_t; 581*7c478bd9Sstevel@tonic-gate 582*7c478bd9Sstevel@tonic-gate /* Chunk IDs */ 583*7c478bd9Sstevel@tonic-gate typedef enum { 584*7c478bd9Sstevel@tonic-gate CHUNK_DATA, 585*7c478bd9Sstevel@tonic-gate CHUNK_INIT, 586*7c478bd9Sstevel@tonic-gate CHUNK_INIT_ACK, 587*7c478bd9Sstevel@tonic-gate CHUNK_SACK, 588*7c478bd9Sstevel@tonic-gate CHUNK_HEARTBEAT, 589*7c478bd9Sstevel@tonic-gate CHUNK_HEARTBEAT_ACK, 590*7c478bd9Sstevel@tonic-gate CHUNK_ABORT, 591*7c478bd9Sstevel@tonic-gate CHUNK_SHUTDOWN, 592*7c478bd9Sstevel@tonic-gate CHUNK_SHUTDOWN_ACK, 593*7c478bd9Sstevel@tonic-gate CHUNK_ERROR, 594*7c478bd9Sstevel@tonic-gate CHUNK_COOKIE, 595*7c478bd9Sstevel@tonic-gate CHUNK_COOKIE_ACK, 596*7c478bd9Sstevel@tonic-gate CHUNK_ECNE, 597*7c478bd9Sstevel@tonic-gate CHUNK_CWR, 598*7c478bd9Sstevel@tonic-gate CHUNK_SHUTDOWN_COMPLETE, 599*7c478bd9Sstevel@tonic-gate CHUNK_ASCONF_ACK = 128, 600*7c478bd9Sstevel@tonic-gate CHUNK_FORWARD_TSN = 192, 601*7c478bd9Sstevel@tonic-gate CHUNK_ASCONF = 193 602*7c478bd9Sstevel@tonic-gate } sctp_chunk_id_t; 603*7c478bd9Sstevel@tonic-gate 604*7c478bd9Sstevel@tonic-gate /* Common chunk header */ 605*7c478bd9Sstevel@tonic-gate typedef struct sctp_chunk_hdr { 606*7c478bd9Sstevel@tonic-gate uint8_t sch_id; 607*7c478bd9Sstevel@tonic-gate uint8_t sch_flags; 608*7c478bd9Sstevel@tonic-gate uint16_t sch_len; 609*7c478bd9Sstevel@tonic-gate } sctp_chunk_hdr_t; 610*7c478bd9Sstevel@tonic-gate 611*7c478bd9Sstevel@tonic-gate /* INIT chunk data definition */ 612*7c478bd9Sstevel@tonic-gate typedef struct sctp_init_chunk { 613*7c478bd9Sstevel@tonic-gate uint32_t sic_inittag; 614*7c478bd9Sstevel@tonic-gate uint32_t sic_a_rwnd; 615*7c478bd9Sstevel@tonic-gate uint16_t sic_outstr; 616*7c478bd9Sstevel@tonic-gate uint16_t sic_instr; 617*7c478bd9Sstevel@tonic-gate uint32_t sic_inittsn; 618*7c478bd9Sstevel@tonic-gate } sctp_init_chunk_t; 619*7c478bd9Sstevel@tonic-gate 620*7c478bd9Sstevel@tonic-gate /* SCTP DATA chunk */ 621*7c478bd9Sstevel@tonic-gate typedef struct sctp_data_chunk { 622*7c478bd9Sstevel@tonic-gate uint32_t sdc_tsn; 623*7c478bd9Sstevel@tonic-gate uint16_t sdc_sid; 624*7c478bd9Sstevel@tonic-gate uint16_t sdc_ssn; 625*7c478bd9Sstevel@tonic-gate uint32_t sdc_payload_id; 626*7c478bd9Sstevel@tonic-gate } sctp_data_chunk_t; 627*7c478bd9Sstevel@tonic-gate 628*7c478bd9Sstevel@tonic-gate /* sctp_data_hdr includes the SCTP chunk hdr and the DATA chunk */ 629*7c478bd9Sstevel@tonic-gate typedef struct sctp_data_hdr { 630*7c478bd9Sstevel@tonic-gate sctp_chunk_hdr_t sdh_chdr; 631*7c478bd9Sstevel@tonic-gate sctp_data_chunk_t sdh_data; 632*7c478bd9Sstevel@tonic-gate #define sdh_id sdh_chdr.sch_id 633*7c478bd9Sstevel@tonic-gate #define sdh_flags sdh_chdr.sch_flags 634*7c478bd9Sstevel@tonic-gate #define sdh_len sdh_chdr.sch_len 635*7c478bd9Sstevel@tonic-gate #define sdh_tsn sdh_data.sdc_tsn 636*7c478bd9Sstevel@tonic-gate #define sdh_sid sdh_data.sdc_sid 637*7c478bd9Sstevel@tonic-gate #define sdh_ssn sdh_data.sdc_ssn 638*7c478bd9Sstevel@tonic-gate #define sdh_payload_id sdh_data.sdc_payload_id 639*7c478bd9Sstevel@tonic-gate } sctp_data_hdr_t; 640*7c478bd9Sstevel@tonic-gate 641*7c478bd9Sstevel@tonic-gate typedef struct sctp_sack_chunk { 642*7c478bd9Sstevel@tonic-gate uint32_t ssc_cumtsn; 643*7c478bd9Sstevel@tonic-gate uint32_t ssc_a_rwnd; 644*7c478bd9Sstevel@tonic-gate uint16_t ssc_numfrags; 645*7c478bd9Sstevel@tonic-gate uint16_t ssc_numdups; 646*7c478bd9Sstevel@tonic-gate } sctp_sack_chunk_t; 647*7c478bd9Sstevel@tonic-gate 648*7c478bd9Sstevel@tonic-gate typedef struct sctp_sack_frag { 649*7c478bd9Sstevel@tonic-gate uint16_t ssf_start; 650*7c478bd9Sstevel@tonic-gate uint16_t ssf_end; 651*7c478bd9Sstevel@tonic-gate } sctp_sack_frag_t; 652*7c478bd9Sstevel@tonic-gate 653*7c478bd9Sstevel@tonic-gate /* Parameter types */ 654*7c478bd9Sstevel@tonic-gate #define PARM_UNKNOWN 0 655*7c478bd9Sstevel@tonic-gate #define PARM_HBINFO 1 656*7c478bd9Sstevel@tonic-gate #define PARM_ADDR4 5 657*7c478bd9Sstevel@tonic-gate #define PARM_ADDR6 6 658*7c478bd9Sstevel@tonic-gate #define PARM_COOKIE 7 659*7c478bd9Sstevel@tonic-gate #define PARM_UNRECOGNIZED 8 660*7c478bd9Sstevel@tonic-gate #define PARM_COOKIE_PRESERVE 9 661*7c478bd9Sstevel@tonic-gate #define PARM_ADDR_HOST_NAME 11 662*7c478bd9Sstevel@tonic-gate #define PARM_SUPP_ADDRS 12 663*7c478bd9Sstevel@tonic-gate #define PARM_ECN 0x8000 664*7c478bd9Sstevel@tonic-gate #define PARM_ECN_CAPABLE PARM_ECN 665*7c478bd9Sstevel@tonic-gate #define PARM_FORWARD_TSN 0xc000 666*7c478bd9Sstevel@tonic-gate #define PARM_ADD_IP 0xc001 667*7c478bd9Sstevel@tonic-gate #define PARM_DEL_IP 0xc002 668*7c478bd9Sstevel@tonic-gate #define PARM_ERROR_IND 0xc003 669*7c478bd9Sstevel@tonic-gate #define PARM_ASCONF_ERROR PARM_ERROR_IND 670*7c478bd9Sstevel@tonic-gate #define PARM_SET_PRIMARY 0xc004 671*7c478bd9Sstevel@tonic-gate #define PARM_PRIMARY_ADDR PARM_SET_PRIMARY 672*7c478bd9Sstevel@tonic-gate #define PARM_SUCCESS 0xc005 673*7c478bd9Sstevel@tonic-gate #define PARM_ASCONF_SUCCESS PARM_SUCCESS 674*7c478bd9Sstevel@tonic-gate #define PARM_ADAPT_LAYER_IND 0xc006 675*7c478bd9Sstevel@tonic-gate 676*7c478bd9Sstevel@tonic-gate 677*7c478bd9Sstevel@tonic-gate /* Lengths from SCTP spec */ 678*7c478bd9Sstevel@tonic-gate #define PARM_ADDR4_LEN 8 679*7c478bd9Sstevel@tonic-gate #define PARM_ADDR6_LEN 20 680*7c478bd9Sstevel@tonic-gate 681*7c478bd9Sstevel@tonic-gate /* Parameter header */ 682*7c478bd9Sstevel@tonic-gate typedef struct sctp_parm_hdr { 683*7c478bd9Sstevel@tonic-gate uint16_t sph_type; 684*7c478bd9Sstevel@tonic-gate uint16_t sph_len; 685*7c478bd9Sstevel@tonic-gate } sctp_parm_hdr_t; 686*7c478bd9Sstevel@tonic-gate 687*7c478bd9Sstevel@tonic-gate /* Error causes */ 688*7c478bd9Sstevel@tonic-gate #define SCTP_ERR_UNKNOWN 0 689*7c478bd9Sstevel@tonic-gate #define SCTP_ERR_BAD_SID 1 690*7c478bd9Sstevel@tonic-gate #define SCTP_ERR_MISSING_PARM 2 691*7c478bd9Sstevel@tonic-gate #define SCTP_ERR_STALE_COOKIE 3 692*7c478bd9Sstevel@tonic-gate #define SCTP_ERR_NO_RESOURCES 4 693*7c478bd9Sstevel@tonic-gate #define SCTP_ERR_BAD_ADDR 5 694*7c478bd9Sstevel@tonic-gate #define SCTP_ERR_UNREC_CHUNK 6 695*7c478bd9Sstevel@tonic-gate #define SCTP_ERR_BAD_MANDPARM 7 696*7c478bd9Sstevel@tonic-gate #define SCTP_ERR_UNREC_PARM 8 697*7c478bd9Sstevel@tonic-gate #define SCTP_ERR_NO_USR_DATA 9 698*7c478bd9Sstevel@tonic-gate #define SCTP_ERR_COOKIE_SHUT 10 699*7c478bd9Sstevel@tonic-gate #define SCTP_ERR_RESTART_NEW_ADDRS 11 700*7c478bd9Sstevel@tonic-gate #define SCTP_ERR_USER_ABORT 12 701*7c478bd9Sstevel@tonic-gate #define SCTP_ERR_DELETE_LASTADDR 256 702*7c478bd9Sstevel@tonic-gate #define SCTP_ERR_RESOURCE_SHORTAGE 257 703*7c478bd9Sstevel@tonic-gate #define SCTP_ERR_DELETE_SRCADDR 258 704*7c478bd9Sstevel@tonic-gate #define SCTP_ERR_AUTH_ERR 260 705*7c478bd9Sstevel@tonic-gate 706*7c478bd9Sstevel@tonic-gate /* 707*7c478bd9Sstevel@tonic-gate * Extensions 708*7c478bd9Sstevel@tonic-gate */ 709*7c478bd9Sstevel@tonic-gate 710*7c478bd9Sstevel@tonic-gate /* Extended Chunk Types */ 711*7c478bd9Sstevel@tonic-gate #define CHUNK_ASCONF 0xc1 712*7c478bd9Sstevel@tonic-gate #define CHUNK_ASCONF_ACK 0x80 713*7c478bd9Sstevel@tonic-gate 714*7c478bd9Sstevel@tonic-gate /* Extension Error Causes */ 715*7c478bd9Sstevel@tonic-gate #define SCTP_ERR_DEL_LAST_ADDR 0x0100 716*7c478bd9Sstevel@tonic-gate #define SCTP_ERR_RES_SHORTAGE 0x0101 717*7c478bd9Sstevel@tonic-gate #define SCTP_ERR_DEL_SRC_ADDR 0x0102 718*7c478bd9Sstevel@tonic-gate #define SCTP_ERR_ILLEGAL_ACK 0x0103 719*7c478bd9Sstevel@tonic-gate #define SCTP_ERR_UNAUTHORIZED 0x0104 720*7c478bd9Sstevel@tonic-gate 721*7c478bd9Sstevel@tonic-gate typedef struct sctp_addip4 { 722*7c478bd9Sstevel@tonic-gate sctp_parm_hdr_t sad4_addip_ph; 723*7c478bd9Sstevel@tonic-gate uint32_t asconf_req_cid; 724*7c478bd9Sstevel@tonic-gate sctp_parm_hdr_t sad4_addr4_ph; 725*7c478bd9Sstevel@tonic-gate ipaddr_t sad4_addr; 726*7c478bd9Sstevel@tonic-gate } sctp_addip4_t; 727*7c478bd9Sstevel@tonic-gate 728*7c478bd9Sstevel@tonic-gate typedef struct sctp_addip6 { 729*7c478bd9Sstevel@tonic-gate sctp_parm_hdr_t sad6_addip_ph; 730*7c478bd9Sstevel@tonic-gate uint32_t asconf_req_cid; 731*7c478bd9Sstevel@tonic-gate sctp_parm_hdr_t sad6_addr6_ph; 732*7c478bd9Sstevel@tonic-gate in6_addr_t sad6_addr; 733*7c478bd9Sstevel@tonic-gate } sctp_addip6_t; 734*7c478bd9Sstevel@tonic-gate 735*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 736*7c478bd9Sstevel@tonic-gate } 737*7c478bd9Sstevel@tonic-gate #endif 738*7c478bd9Sstevel@tonic-gate 739*7c478bd9Sstevel@tonic-gate #endif /* _NETINET_SCTP_H */ 740