10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 55586Skcpoon * Common Development and Distribution License (the "License"). 65586Skcpoon * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 229451SGeorge.Shepherd@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _NETINET_SCTP_H 270Sstevel@tonic-gate #define _NETINET_SCTP_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate #ifdef __cplusplus 300Sstevel@tonic-gate extern "C" { 310Sstevel@tonic-gate #endif 320Sstevel@tonic-gate 330Sstevel@tonic-gate #include <sys/types.h> 340Sstevel@tonic-gate 350Sstevel@tonic-gate /* 360Sstevel@tonic-gate * This file contains the structure defintions and function prototypes 370Sstevel@tonic-gate * described in the IETF SCTP socket API document. 380Sstevel@tonic-gate */ 390Sstevel@tonic-gate 400Sstevel@tonic-gate /* SCTP association ID type. */ 410Sstevel@tonic-gate typedef int sctp_assoc_t; 420Sstevel@tonic-gate typedef int32_t sctp_assoc32_t; 430Sstevel@tonic-gate 440Sstevel@tonic-gate /* 450Sstevel@tonic-gate * SCTP socket options 460Sstevel@tonic-gate */ 470Sstevel@tonic-gate #define SCTP_RTOINFO 1 480Sstevel@tonic-gate #define SCTP_ASSOCINFO 2 490Sstevel@tonic-gate #define SCTP_INITMSG 3 500Sstevel@tonic-gate #define SCTP_NODELAY 4 510Sstevel@tonic-gate #define SCTP_AUTOCLOSE 5 520Sstevel@tonic-gate #define SCTP_SET_PEER_PRIMARY_ADDR 6 530Sstevel@tonic-gate #define SCTP_PRIMARY_ADDR 7 545586Skcpoon #define SCTP_ADAPTATION_LAYER 8 550Sstevel@tonic-gate #define SCTP_DISABLE_FRAGMENTS 9 560Sstevel@tonic-gate #define SCTP_PEER_ADDR_PARAMS 10 570Sstevel@tonic-gate #define SCTP_DEFAULT_SEND_PARAM 11 580Sstevel@tonic-gate #define SCTP_EVENTS 12 590Sstevel@tonic-gate #define SCTP_I_WANT_MAPPED_V4_ADDR 13 600Sstevel@tonic-gate #define SCTP_MAXSEG 14 610Sstevel@tonic-gate #define SCTP_STATUS 15 620Sstevel@tonic-gate #define SCTP_GET_PEER_ADDR_INFO 16 630Sstevel@tonic-gate 640Sstevel@tonic-gate /* 650Sstevel@tonic-gate * Private socket options 660Sstevel@tonic-gate */ 670Sstevel@tonic-gate #define SCTP_GET_NLADDRS 17 680Sstevel@tonic-gate #define SCTP_GET_LADDRS 18 690Sstevel@tonic-gate #define SCTP_GET_NPADDRS 19 700Sstevel@tonic-gate #define SCTP_GET_PADDRS 20 710Sstevel@tonic-gate #define SCTP_ADD_ADDR 21 720Sstevel@tonic-gate #define SCTP_REM_ADDR 22 730Sstevel@tonic-gate 740Sstevel@tonic-gate /* 750Sstevel@tonic-gate * Additional SCTP socket options. This socket option is used to enable or 760Sstevel@tonic-gate * disable PR-SCTP support prior to establishing an association. By default, 770Sstevel@tonic-gate * PR-SCTP support is disabled. 780Sstevel@tonic-gate */ 790Sstevel@tonic-gate #define SCTP_PRSCTP 23 800Sstevel@tonic-gate 810Sstevel@tonic-gate /* 82*10212SGeorge.Shepherd@Sun.COM * SCTP socket option used to read per endpoint association statistics. 83*10212SGeorge.Shepherd@Sun.COM */ 84*10212SGeorge.Shepherd@Sun.COM #define SCTP_GET_ASSOC_STATS 24 85*10212SGeorge.Shepherd@Sun.COM 86*10212SGeorge.Shepherd@Sun.COM /* 870Sstevel@tonic-gate * Ancillary data identifiers 880Sstevel@tonic-gate */ 890Sstevel@tonic-gate #define SCTP_SNDRCV 0x100 900Sstevel@tonic-gate #define SCTP_INIT 0x101 910Sstevel@tonic-gate 920Sstevel@tonic-gate /* 930Sstevel@tonic-gate * Notification types 940Sstevel@tonic-gate */ 950Sstevel@tonic-gate #define SCTP_ASSOC_CHANGE 1 960Sstevel@tonic-gate #define SCTP_PEER_ADDR_CHANGE 2 970Sstevel@tonic-gate #define SCTP_REMOTE_ERROR 3 980Sstevel@tonic-gate #define SCTP_SEND_FAILED 4 990Sstevel@tonic-gate #define SCTP_SHUTDOWN_EVENT 5 1005586Skcpoon #define SCTP_ADAPTATION_INDICATION 6 1010Sstevel@tonic-gate #define SCTP_PARTIAL_DELIVERY_EVENT 7 1020Sstevel@tonic-gate 1030Sstevel@tonic-gate /* 1040Sstevel@tonic-gate * SCTP Ancillary Data Definitions 1050Sstevel@tonic-gate */ 1060Sstevel@tonic-gate 1070Sstevel@tonic-gate /* 1080Sstevel@tonic-gate * sctp_initmsg structure provides information for initializing new SCTP 1090Sstevel@tonic-gate * associations with sendmsg(). The SCTP_INITMSG socket option uses 1100Sstevel@tonic-gate * this same data structure. 1110Sstevel@tonic-gate */ 1120Sstevel@tonic-gate struct sctp_initmsg { 1130Sstevel@tonic-gate uint16_t sinit_num_ostreams; 1140Sstevel@tonic-gate uint16_t sinit_max_instreams; 1150Sstevel@tonic-gate uint16_t sinit_max_attempts; 1160Sstevel@tonic-gate uint16_t sinit_max_init_timeo; 1170Sstevel@tonic-gate }; 1180Sstevel@tonic-gate 1190Sstevel@tonic-gate /* 1200Sstevel@tonic-gate * sctp_sndrcvinfo structure specifies SCTP options for sendmsg() and 1210Sstevel@tonic-gate * describes SCTP header information about a received message through 1220Sstevel@tonic-gate * recvmsg(). 1230Sstevel@tonic-gate */ 1240Sstevel@tonic-gate struct sctp_sndrcvinfo { 1250Sstevel@tonic-gate uint16_t sinfo_stream; 1260Sstevel@tonic-gate uint16_t sinfo_ssn; 1270Sstevel@tonic-gate uint16_t sinfo_flags; 1280Sstevel@tonic-gate uint32_t sinfo_ppid; 1290Sstevel@tonic-gate uint32_t sinfo_context; 1300Sstevel@tonic-gate uint32_t sinfo_timetolive; 1310Sstevel@tonic-gate uint32_t sinfo_tsn; 1320Sstevel@tonic-gate uint32_t sinfo_cumtsn; 1330Sstevel@tonic-gate sctp_assoc_t sinfo_assoc_id; 1340Sstevel@tonic-gate }; 1350Sstevel@tonic-gate 1360Sstevel@tonic-gate /* sinfo_flags */ 1370Sstevel@tonic-gate #define MSG_UNORDERED 0x01 /* Unordered data */ 1380Sstevel@tonic-gate #define MSG_ABORT 0x02 /* Abort the connection */ 1390Sstevel@tonic-gate #define MSG_EOF 0x04 /* Shutdown the connection */ 1400Sstevel@tonic-gate 1410Sstevel@tonic-gate /* 1420Sstevel@tonic-gate * Use destination addr passed as parameter, not the association primary one. 1430Sstevel@tonic-gate */ 1440Sstevel@tonic-gate #define MSG_ADDR_OVER 0x08 1450Sstevel@tonic-gate /* 1460Sstevel@tonic-gate * This flag when set in sinfo_flags is used alongwith sinfo_timetolive to 1470Sstevel@tonic-gate * implement the "timed reliability" service discussed in RFC 3758. 1480Sstevel@tonic-gate */ 1490Sstevel@tonic-gate #define MSG_PR_SCTP 0x10 1500Sstevel@tonic-gate /* 1510Sstevel@tonic-gate * SCTP notification definitions 1520Sstevel@tonic-gate */ 1530Sstevel@tonic-gate 1540Sstevel@tonic-gate /* 1550Sstevel@tonic-gate * To receive any ancillary data or notifications, the application can 1560Sstevel@tonic-gate * register it's interest by calling the SCTP_EVENTS setsockopt() with 1570Sstevel@tonic-gate * the sctp_event_subscribe structure. 1580Sstevel@tonic-gate */ 1590Sstevel@tonic-gate struct sctp_event_subscribe { 1600Sstevel@tonic-gate uint8_t sctp_data_io_event; 1610Sstevel@tonic-gate uint8_t sctp_association_event; 1620Sstevel@tonic-gate uint8_t sctp_address_event; 1630Sstevel@tonic-gate uint8_t sctp_send_failure_event; 1640Sstevel@tonic-gate uint8_t sctp_peer_error_event; 1650Sstevel@tonic-gate uint8_t sctp_shutdown_event; 1660Sstevel@tonic-gate uint8_t sctp_partial_delivery_event; 1675586Skcpoon uint8_t sctp_adaptation_layer_event; 1680Sstevel@tonic-gate }; 1690Sstevel@tonic-gate 1700Sstevel@tonic-gate /* Association events used in sctp_assoc_change structure */ 1710Sstevel@tonic-gate #define SCTP_COMM_UP 0 1720Sstevel@tonic-gate #define SCTP_COMM_LOST 1 1730Sstevel@tonic-gate #define SCTP_RESTART 2 1740Sstevel@tonic-gate #define SCTP_SHUTDOWN_COMP 3 1750Sstevel@tonic-gate #define SCTP_CANT_STR_ASSOC 4 1760Sstevel@tonic-gate 1770Sstevel@tonic-gate /* 1780Sstevel@tonic-gate * Association flags. This flags is filled in the sac_flags for a SCTP_COMM_UP 1790Sstevel@tonic-gate * event if the association supports PR-SCTP. 1800Sstevel@tonic-gate */ 1810Sstevel@tonic-gate #define SCTP_PRSCTP_CAPABLE 0x01 1820Sstevel@tonic-gate 1830Sstevel@tonic-gate /* 1840Sstevel@tonic-gate * sctp_assoc_change notification informs the socket that an SCTP association 1850Sstevel@tonic-gate * has either begun or ended. The identifier for a new association is 1860Sstevel@tonic-gate * provided by this notification. 1870Sstevel@tonic-gate */ 1880Sstevel@tonic-gate struct sctp_assoc_change { 1890Sstevel@tonic-gate uint16_t sac_type; 1900Sstevel@tonic-gate uint16_t sac_flags; 1910Sstevel@tonic-gate uint32_t sac_length; 1920Sstevel@tonic-gate uint16_t sac_state; 1930Sstevel@tonic-gate uint16_t sac_error; 1940Sstevel@tonic-gate uint16_t sac_outbound_streams; 1950Sstevel@tonic-gate uint16_t sac_inbound_streams; 1960Sstevel@tonic-gate sctp_assoc_t sac_assoc_id; 1970Sstevel@tonic-gate /* 1980Sstevel@tonic-gate * The assoc ID can be followed by the ABORT chunk if available. 1990Sstevel@tonic-gate */ 2000Sstevel@tonic-gate }; 2010Sstevel@tonic-gate 2020Sstevel@tonic-gate /* 2030Sstevel@tonic-gate * A remote peer may send an Operational Error message to its peer. This 2040Sstevel@tonic-gate * message indicates a variety of error conditions on an association. 2050Sstevel@tonic-gate * The entire ERROR chunk as it appears on the wire is included in a 2060Sstevel@tonic-gate * SCTP_REMOTE_ERROR event. Refer to the SCTP specification RFC2960 2070Sstevel@tonic-gate * and any extensions for a list of possible error formats. 2080Sstevel@tonic-gate */ 2090Sstevel@tonic-gate struct sctp_remote_error { 2100Sstevel@tonic-gate uint16_t sre_type; 2110Sstevel@tonic-gate uint16_t sre_flags; 2120Sstevel@tonic-gate uint32_t sre_length; 2130Sstevel@tonic-gate uint16_t sre_error; 2140Sstevel@tonic-gate sctp_assoc_t sre_assoc_id; 2150Sstevel@tonic-gate /* 2160Sstevel@tonic-gate * The assoc ID is followed by the actual error chunk. 2170Sstevel@tonic-gate */ 2180Sstevel@tonic-gate }; 2190Sstevel@tonic-gate 2200Sstevel@tonic-gate /* 2210Sstevel@tonic-gate * Note: 2220Sstevel@tonic-gate * 2230Sstevel@tonic-gate * In order to keep the offsets and size of the structure having a 2240Sstevel@tonic-gate * struct sockaddr_storage field the same between a 32-bit application 2250Sstevel@tonic-gate * and a 64-bit amd64 kernel, we use a #pragma pack(4) for those 2260Sstevel@tonic-gate * structures. 2270Sstevel@tonic-gate */ 2280Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 2290Sstevel@tonic-gate #pragma pack(4) 2300Sstevel@tonic-gate #endif 2310Sstevel@tonic-gate 2320Sstevel@tonic-gate /* Address change event state */ 2330Sstevel@tonic-gate #define SCTP_ADDR_AVAILABLE 0 2340Sstevel@tonic-gate #define SCTP_ADDR_UNREACHABLE 1 2350Sstevel@tonic-gate #define SCTP_ADDR_REMOVED 2 2360Sstevel@tonic-gate #define SCTP_ADDR_ADDED 3 2370Sstevel@tonic-gate #define SCTP_ADDR_MADE_PRIM 4 2380Sstevel@tonic-gate 2390Sstevel@tonic-gate /* 2400Sstevel@tonic-gate * When a destination address on a multi-homed peer encounters a change, 2410Sstevel@tonic-gate * an interface details event, sctp_paddr_change, is sent to the socket. 2420Sstevel@tonic-gate */ 2430Sstevel@tonic-gate struct sctp_paddr_change { 2440Sstevel@tonic-gate uint16_t spc_type; 2450Sstevel@tonic-gate uint16_t spc_flags; 2460Sstevel@tonic-gate uint32_t spc_length; 2470Sstevel@tonic-gate struct sockaddr_storage spc_aaddr; 2480Sstevel@tonic-gate int spc_state; 2490Sstevel@tonic-gate int spc_error; 2500Sstevel@tonic-gate sctp_assoc_t spc_assoc_id; 2510Sstevel@tonic-gate }; 2520Sstevel@tonic-gate 2530Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 2540Sstevel@tonic-gate #pragma pack() 2550Sstevel@tonic-gate #endif 2560Sstevel@tonic-gate 2570Sstevel@tonic-gate /* flags used in sctp_send_failed notification. */ 2580Sstevel@tonic-gate #define SCTP_DATA_UNSENT 1 2590Sstevel@tonic-gate #define SCTP_DATA_SENT 2 2600Sstevel@tonic-gate 2610Sstevel@tonic-gate /* 2620Sstevel@tonic-gate * If SCTP cannot deliver a message it may return the message as a 2630Sstevel@tonic-gate * notification using the following structure. 2640Sstevel@tonic-gate */ 2650Sstevel@tonic-gate struct sctp_send_failed { 2660Sstevel@tonic-gate uint16_t ssf_type; 2670Sstevel@tonic-gate uint16_t ssf_flags; 2680Sstevel@tonic-gate uint32_t ssf_length; 2690Sstevel@tonic-gate uint32_t ssf_error; 2700Sstevel@tonic-gate struct sctp_sndrcvinfo ssf_info; 2710Sstevel@tonic-gate sctp_assoc_t ssf_assoc_id; 2720Sstevel@tonic-gate /* 2730Sstevel@tonic-gate * The assoc ID is followed by the failed message. 2740Sstevel@tonic-gate */ 2750Sstevel@tonic-gate }; 2760Sstevel@tonic-gate 2770Sstevel@tonic-gate /* 2780Sstevel@tonic-gate * When a peer sends a SHUTDOWN, SCTP delivers the sctp_shutdown_event 2790Sstevel@tonic-gate * notification to inform the socket user that it should cease sending data. 2800Sstevel@tonic-gate */ 2810Sstevel@tonic-gate struct sctp_shutdown_event { 2820Sstevel@tonic-gate uint16_t sse_type; 2830Sstevel@tonic-gate uint16_t sse_flags; 2840Sstevel@tonic-gate uint16_t sse_length; 2850Sstevel@tonic-gate sctp_assoc_t sse_assoc_id; 2860Sstevel@tonic-gate }; 2870Sstevel@tonic-gate 2880Sstevel@tonic-gate /* 2895586Skcpoon * When a peer sends an Adaptation Layer Indication parameter, SCTP 2905586Skcpoon * delivers the sctp_adaptation_event notification to inform the socket 2915586Skcpoon * user the peer's requested adaptation layer. 2920Sstevel@tonic-gate */ 2935586Skcpoon struct sctp_adaptation_event { 2940Sstevel@tonic-gate uint16_t sai_type; 2950Sstevel@tonic-gate uint16_t sai_flags; 2960Sstevel@tonic-gate uint32_t sai_length; 2975586Skcpoon uint32_t sai_adaptation_ind; 2980Sstevel@tonic-gate sctp_assoc_t sai_assoc_id; 2990Sstevel@tonic-gate }; 3000Sstevel@tonic-gate 3010Sstevel@tonic-gate /* Possible values in pdapi_indication for sctp_pdapi_event notification. */ 3020Sstevel@tonic-gate #define SCTP_PARTIAL_DELIVERY_ABORTED 1 3030Sstevel@tonic-gate 3040Sstevel@tonic-gate /* 3050Sstevel@tonic-gate * When a receiver is engaged in a partial delivery of a message the 3060Sstevel@tonic-gate * sctp_pdapi_event notification is used to indicate various events. 3070Sstevel@tonic-gate */ 3080Sstevel@tonic-gate struct sctp_pdapi_event { 3090Sstevel@tonic-gate uint16_t pdapi_type; 3100Sstevel@tonic-gate uint16_t pdapi_flags; 3110Sstevel@tonic-gate uint32_t pdapi_length; 3120Sstevel@tonic-gate uint32_t pdapi_indication; 3130Sstevel@tonic-gate sctp_assoc_t pdapi_assoc_id; 3140Sstevel@tonic-gate }; 3150Sstevel@tonic-gate 3160Sstevel@tonic-gate /* 3170Sstevel@tonic-gate * The sctp_notification structure is defined as the union of all 3180Sstevel@tonic-gate * notification types defined above. 3190Sstevel@tonic-gate */ 3200Sstevel@tonic-gate union sctp_notification { 3210Sstevel@tonic-gate struct { 3220Sstevel@tonic-gate uint16_t sn_type; /* Notification type. */ 3230Sstevel@tonic-gate uint16_t sn_flags; 3240Sstevel@tonic-gate uint32_t sn_length; 3250Sstevel@tonic-gate } sn_header; 3260Sstevel@tonic-gate struct sctp_assoc_change sn_assoc_change; 3270Sstevel@tonic-gate struct sctp_paddr_change sn_paddr_change; 3280Sstevel@tonic-gate struct sctp_remote_error sn_remote_error; 3290Sstevel@tonic-gate struct sctp_send_failed sn_send_failed; 3300Sstevel@tonic-gate struct sctp_shutdown_event sn_shutdown_event; 3315586Skcpoon struct sctp_adaptation_event sn_adaptation_event; 3320Sstevel@tonic-gate struct sctp_pdapi_event sn_pdapi_event; 3330Sstevel@tonic-gate }; 3340Sstevel@tonic-gate 3350Sstevel@tonic-gate /* 3360Sstevel@tonic-gate * sctp_opt_info() option definitions 3370Sstevel@tonic-gate */ 3380Sstevel@tonic-gate 3390Sstevel@tonic-gate /* 3400Sstevel@tonic-gate * The protocol parameters used to initialize and bound retransmission 3410Sstevel@tonic-gate * timeout (RTO) are tunable. See RFC2960 for more information on 3420Sstevel@tonic-gate * how these parameters are used in RTO calculation. 3430Sstevel@tonic-gate * 3440Sstevel@tonic-gate * The sctp_rtoinfo structure is used to access and modify these 3450Sstevel@tonic-gate * parameters. 3460Sstevel@tonic-gate */ 3470Sstevel@tonic-gate struct sctp_rtoinfo { 3480Sstevel@tonic-gate sctp_assoc_t srto_assoc_id; 3490Sstevel@tonic-gate uint32_t srto_initial; 3500Sstevel@tonic-gate uint32_t srto_max; 3510Sstevel@tonic-gate uint32_t srto_min; 3520Sstevel@tonic-gate }; 3530Sstevel@tonic-gate 3540Sstevel@tonic-gate /* 3550Sstevel@tonic-gate * The sctp_assocparams option is used to both examine and set various 3560Sstevel@tonic-gate * association and endpoint parameters. See RFC2960 for more information 3570Sstevel@tonic-gate * on how this parameter is used. The peer address parameter is ignored 3580Sstevel@tonic-gate * for one-to-one style socket. 3590Sstevel@tonic-gate */ 3600Sstevel@tonic-gate struct sctp_assocparams { 3610Sstevel@tonic-gate sctp_assoc_t sasoc_assoc_id; 3620Sstevel@tonic-gate uint16_t sasoc_asocmaxrxt; 3630Sstevel@tonic-gate uint16_t sasoc_number_peer_destinations; 3640Sstevel@tonic-gate uint32_t sasoc_peer_rwnd; 3650Sstevel@tonic-gate uint32_t sasoc_local_rwnd; 3660Sstevel@tonic-gate uint32_t sasoc_cookie_life; 3670Sstevel@tonic-gate }; 3680Sstevel@tonic-gate 3690Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 3700Sstevel@tonic-gate #pragma pack(4) 3710Sstevel@tonic-gate #endif 3720Sstevel@tonic-gate 3730Sstevel@tonic-gate /* sctp_paddrinfo reachability state. */ 3740Sstevel@tonic-gate #define SCTP_INACTIVE 1 3750Sstevel@tonic-gate #define SCTP_ACTIVE 2 3760Sstevel@tonic-gate 3770Sstevel@tonic-gate /* 3780Sstevel@tonic-gate * Applications can retrieve information about a specific peer address 3790Sstevel@tonic-gate * of an association, including its reachability state, congestion 3800Sstevel@tonic-gate * window, and retransmission timer values. This information is 3810Sstevel@tonic-gate * read-only. The sctp_paddrinfo structure is used to access this 3820Sstevel@tonic-gate * information: 3830Sstevel@tonic-gate */ 3840Sstevel@tonic-gate struct sctp_paddrinfo { 3850Sstevel@tonic-gate sctp_assoc_t spinfo_assoc_id; 3860Sstevel@tonic-gate struct sockaddr_storage spinfo_address; 3870Sstevel@tonic-gate int32_t spinfo_state; 3880Sstevel@tonic-gate uint32_t spinfo_cwnd; 3890Sstevel@tonic-gate uint32_t spinfo_srtt; 3900Sstevel@tonic-gate uint32_t spinfo_rto; 3910Sstevel@tonic-gate uint32_t spinfo_mtu; 3920Sstevel@tonic-gate }; 3930Sstevel@tonic-gate 3940Sstevel@tonic-gate /* 3950Sstevel@tonic-gate * Applications can enable or disable heartbeats for any peer address of 3960Sstevel@tonic-gate * an association, modify an address's heartbeat interval, force a 3970Sstevel@tonic-gate * heartbeat to be sent immediately, and adjust the address's maximum 3980Sstevel@tonic-gate * number of retransmissions sent before an address is considered 3990Sstevel@tonic-gate * unreachable. The sctp_paddrparams structure is used to access and modify 4000Sstevel@tonic-gate * an address' parameters. 4010Sstevel@tonic-gate */ 4020Sstevel@tonic-gate struct sctp_paddrparams { 4030Sstevel@tonic-gate sctp_assoc_t spp_assoc_id; 4040Sstevel@tonic-gate struct sockaddr_storage spp_address; 4050Sstevel@tonic-gate uint32_t spp_hbinterval; 4060Sstevel@tonic-gate uint16_t spp_pathmaxrxt; 4070Sstevel@tonic-gate }; 4080Sstevel@tonic-gate 4090Sstevel@tonic-gate /* 4100Sstevel@tonic-gate * A socket user can request that the peer mark the enclosed address as the 4110Sstevel@tonic-gate * association's primary. The enclosed address must be one of the 4120Sstevel@tonic-gate * association's locally bound addresses. The sctp_setpeerprim structure is 4130Sstevel@tonic-gate * used to make such request. 4140Sstevel@tonic-gate */ 4150Sstevel@tonic-gate struct sctp_setpeerprim { 4160Sstevel@tonic-gate sctp_assoc_t sspp_assoc_id; 4170Sstevel@tonic-gate struct sockaddr_storage sspp_addr; 4180Sstevel@tonic-gate }; 4190Sstevel@tonic-gate 4200Sstevel@tonic-gate /* 4210Sstevel@tonic-gate * A socket user can request that the local SCTP stack use the enclosed peer 4220Sstevel@tonic-gate * address as the association primary. The enclosed address must be one of 4230Sstevel@tonic-gate * the association peer's addresses. The sctp_setprim structure is used to 4240Sstevel@tonic-gate * make such request. 4250Sstevel@tonic-gate */ 4260Sstevel@tonic-gate struct sctp_setprim { 4270Sstevel@tonic-gate sctp_assoc_t ssp_assoc_id; 4280Sstevel@tonic-gate struct sockaddr_storage ssp_addr; 4290Sstevel@tonic-gate }; 4300Sstevel@tonic-gate 4310Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 4320Sstevel@tonic-gate #pragma pack() 4330Sstevel@tonic-gate #endif 4340Sstevel@tonic-gate 4350Sstevel@tonic-gate /* SCTP association states */ 4360Sstevel@tonic-gate #define SCTPS_IDLE -5 /* idle (opened, but not bound) */ 4370Sstevel@tonic-gate #define SCTPS_BOUND -4 /* bound, ready to connect or accept */ 4380Sstevel@tonic-gate #define SCTPS_LISTEN -3 /* listening for connection */ 4390Sstevel@tonic-gate #define SCTPS_COOKIE_WAIT -2 4400Sstevel@tonic-gate #define SCTPS_COOKIE_ECHOED -1 4410Sstevel@tonic-gate /* states < SCTPS_ESTABLISHED are those where connections not established */ 4420Sstevel@tonic-gate #define SCTPS_ESTABLISHED 0 /* established */ 4430Sstevel@tonic-gate #define SCTPS_SHUTDOWN_PENDING 1 4440Sstevel@tonic-gate #define SCTPS_SHUTDOWN_SENT 2 4450Sstevel@tonic-gate #define SCTPS_SHUTDOWN_RECEIVED 3 4460Sstevel@tonic-gate #define SCTPS_SHUTDOWN_ACK_SENT 4 4470Sstevel@tonic-gate 4480Sstevel@tonic-gate /* 4490Sstevel@tonic-gate * Applications can retrieve current status information about an 4500Sstevel@tonic-gate * association, including association state, peer receiver window size, 4510Sstevel@tonic-gate * number of unacked data chunks, and number of data chunks pending 4520Sstevel@tonic-gate * receipt. This information is read-only. The sctp_status structure is 4530Sstevel@tonic-gate * used to access this information: 4540Sstevel@tonic-gate */ 4550Sstevel@tonic-gate struct sctp_status { 4560Sstevel@tonic-gate sctp_assoc_t sstat_assoc_id; 4570Sstevel@tonic-gate int32_t sstat_state; 4580Sstevel@tonic-gate uint32_t sstat_rwnd; 4590Sstevel@tonic-gate uint16_t sstat_unackdata; 4600Sstevel@tonic-gate uint16_t sstat_penddata; 4610Sstevel@tonic-gate uint16_t sstat_instrms; 4620Sstevel@tonic-gate uint16_t sstat_outstrms; 4630Sstevel@tonic-gate uint32_t sstat_fragmentation_point; 4640Sstevel@tonic-gate struct sctp_paddrinfo sstat_primary; 4650Sstevel@tonic-gate }; 4660Sstevel@tonic-gate 4670Sstevel@tonic-gate /* Possible values for sstat_state */ 4680Sstevel@tonic-gate #define SCTP_CLOSED SCTPS_IDLE 4690Sstevel@tonic-gate #define SCTP_BOUND SCTPS_BOUND 4700Sstevel@tonic-gate #define SCTP_LISTEN SCTPS_LISTEN 4710Sstevel@tonic-gate #define SCTP_COOKIE_WAIT SCTPS_COOKIE_WAIT 4720Sstevel@tonic-gate #define SCTP_COOKIE_ECHOED SCTPS_COOKIE_ECHOED 4730Sstevel@tonic-gate #define SCTP_ESTABLISHED SCTPS_ESTABLISHED 4740Sstevel@tonic-gate #define SCTP_SHUTDOWN_PENDING SCTPS_SHUTDOWN_PENDING 4750Sstevel@tonic-gate #define SCTP_SHUTDOWN_SENT SCTPS_SHUTDOWN_SENT 4760Sstevel@tonic-gate #define SCTP_SHUTDOWN_RECEIVED SCTPS_SHUTDOWN_RECEIVED 4770Sstevel@tonic-gate #define SCTP_SHUTDOWN_ACK_SENT SCTPS_SHUTDOWN_ACK_SENT 4780Sstevel@tonic-gate 4790Sstevel@tonic-gate /* 4800Sstevel@tonic-gate * A socket user can request that the local endpoint set the specified 4815586Skcpoon * Adaptation Layer Indication parameter for all future INIT and INIT-ACK 4825586Skcpoon * exchanges. The sctp_setadaptation structure is used to make such request. 4830Sstevel@tonic-gate */ 4845586Skcpoon struct sctp_setadaptation { 4855586Skcpoon uint32_t ssb_adaptation_ind; 4860Sstevel@tonic-gate }; 4870Sstevel@tonic-gate 4880Sstevel@tonic-gate /* 489*10212SGeorge.Shepherd@Sun.COM * A socket user request reads local per endpoint association stats. 490*10212SGeorge.Shepherd@Sun.COM * All stats are counts except sas_maxrto, which is the max value 491*10212SGeorge.Shepherd@Sun.COM * since the last user request for stats on this endpoint. 492*10212SGeorge.Shepherd@Sun.COM */ 493*10212SGeorge.Shepherd@Sun.COM typedef struct sctp_assoc_stats { 494*10212SGeorge.Shepherd@Sun.COM uint64_t sas_rtxchunks; /* Retransmitted Chunks */ 495*10212SGeorge.Shepherd@Sun.COM uint64_t sas_gapcnt; /* Gap Acknowledgements Received */ 496*10212SGeorge.Shepherd@Sun.COM uint64_t sas_maxrto; /* Maximum Observed RTO this period */ 497*10212SGeorge.Shepherd@Sun.COM uint64_t sas_outseqtsns; /* TSN received > next expected */ 498*10212SGeorge.Shepherd@Sun.COM uint64_t sas_osacks; /* SACKs sent */ 499*10212SGeorge.Shepherd@Sun.COM uint64_t sas_isacks; /* SACKs received */ 500*10212SGeorge.Shepherd@Sun.COM uint64_t sas_octrlchunks; /* Control chunks sent - no dups */ 501*10212SGeorge.Shepherd@Sun.COM uint64_t sas_ictrlchunks; /* Control chunks received - no dups */ 502*10212SGeorge.Shepherd@Sun.COM uint64_t sas_oodchunks; /* Ordered data chunks sent */ 503*10212SGeorge.Shepherd@Sun.COM uint64_t sas_iodchunks; /* Ordered data chunks received */ 504*10212SGeorge.Shepherd@Sun.COM uint64_t sas_ouodchunks; /* Unordered data chunks sent */ 505*10212SGeorge.Shepherd@Sun.COM uint64_t sas_iuodchunks; /* Unordered data chunks received */ 506*10212SGeorge.Shepherd@Sun.COM uint64_t sas_idupchunks; /* Dups received (ordered+unordered) */ 507*10212SGeorge.Shepherd@Sun.COM } sctp_assoc_stats_t; 508*10212SGeorge.Shepherd@Sun.COM 509*10212SGeorge.Shepherd@Sun.COM /* 5100Sstevel@tonic-gate * Private ioctl option structure 5110Sstevel@tonic-gate */ 5120Sstevel@tonic-gate struct sctpopt { 5130Sstevel@tonic-gate sctp_assoc_t sopt_aid; 5140Sstevel@tonic-gate int sopt_name; 5150Sstevel@tonic-gate uint_t sopt_len; 5160Sstevel@tonic-gate caddr_t sopt_val; 5170Sstevel@tonic-gate }; 5180Sstevel@tonic-gate 5190Sstevel@tonic-gate #if defined(_SYSCALL32) 5200Sstevel@tonic-gate struct sctpopt32 { 5210Sstevel@tonic-gate sctp_assoc32_t sopt_aid; 5220Sstevel@tonic-gate int32_t sopt_name; 5230Sstevel@tonic-gate uint32_t sopt_len; 5240Sstevel@tonic-gate caddr32_t sopt_val; 5250Sstevel@tonic-gate }; 5260Sstevel@tonic-gate #endif /* _SYSCALL32 */ 5270Sstevel@tonic-gate 5280Sstevel@tonic-gate /* Forward Cumulative TSN chunk entry. */ 5290Sstevel@tonic-gate typedef struct ftsn_entry_s { 5300Sstevel@tonic-gate uint16_t ftsn_sid; 5310Sstevel@tonic-gate uint16_t ftsn_ssn; 5320Sstevel@tonic-gate } ftsn_entry_t; 5330Sstevel@tonic-gate 5340Sstevel@tonic-gate /* 5350Sstevel@tonic-gate * New socket functions for SCTP 5360Sstevel@tonic-gate */ 5370Sstevel@tonic-gate 5380Sstevel@tonic-gate /* sctp_bindx() operations. */ 5390Sstevel@tonic-gate #define SCTP_BINDX_ADD_ADDR 1 5400Sstevel@tonic-gate #define SCTP_BINDX_REM_ADDR 2 5410Sstevel@tonic-gate 5420Sstevel@tonic-gate #if !defined(_KERNEL) || defined(_BOOT) 5430Sstevel@tonic-gate #ifdef __STDC__ 5440Sstevel@tonic-gate extern int sctp_bindx(int, void *, int, int); 5450Sstevel@tonic-gate extern void sctp_freeladdrs(void *); 5460Sstevel@tonic-gate extern void sctp_freepaddrs(void *); 5470Sstevel@tonic-gate extern int sctp_getladdrs(int, sctp_assoc_t, void **); 5480Sstevel@tonic-gate extern int sctp_getpaddrs(int, sctp_assoc_t, void **); 5490Sstevel@tonic-gate extern int sctp_opt_info(int, sctp_assoc_t, int, void *, socklen_t *); 5500Sstevel@tonic-gate extern int sctp_peeloff(int, sctp_assoc_t); 5510Sstevel@tonic-gate extern ssize_t sctp_recvmsg(int, void *, size_t, struct sockaddr *, 5520Sstevel@tonic-gate socklen_t *, struct sctp_sndrcvinfo *, int *msg_flags); 5530Sstevel@tonic-gate extern ssize_t sctp_send(int, const void *, size_t, 5540Sstevel@tonic-gate const struct sctp_sndrcvinfo *, int); 5550Sstevel@tonic-gate extern ssize_t sctp_sendmsg(int, const void *, size_t, const struct sockaddr *, 5560Sstevel@tonic-gate socklen_t, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t); 5570Sstevel@tonic-gate #else /* __STDC__ */ 5580Sstevel@tonic-gate extern int sctp_bindx(); 5590Sstevel@tonic-gate extern void sctp_freeladdrs(); 5600Sstevel@tonic-gate extern void sctp_freepaddrs(); 5610Sstevel@tonic-gate extern int sctp_getladdrs(); 5620Sstevel@tonic-gate extern int sctp_getpaddrs(); 5630Sstevel@tonic-gate extern int sctp_opt_info(); 5640Sstevel@tonic-gate extern int sctp_peeloff(); 5650Sstevel@tonic-gate extern ssize_t sctp_recvmsg(); 5660Sstevel@tonic-gate extern ssize_t sctp_send(); 5670Sstevel@tonic-gate extern ssize_t sctp_sendmsg(); 5680Sstevel@tonic-gate #endif /* __STDC__ */ 5690Sstevel@tonic-gate #endif /* !defined(_KERNEL) || defined(_BOOT) */ 5700Sstevel@tonic-gate 5710Sstevel@tonic-gate 5720Sstevel@tonic-gate /* 5730Sstevel@tonic-gate * SCTP protocol related elements. 5740Sstevel@tonic-gate */ 5750Sstevel@tonic-gate 5760Sstevel@tonic-gate /* All SCTP chunks and parameters are 32-bit aligned */ 5770Sstevel@tonic-gate #define SCTP_ALIGN 4 5780Sstevel@tonic-gate 5790Sstevel@tonic-gate /* 5808153SGeorge.Shepherd@Sun.COM * SCTP association optional parameter handling. The top two bits 5818153SGeorge.Shepherd@Sun.COM * of the parameter type define how this and further parameters in 5828153SGeorge.Shepherd@Sun.COM * the received chunk should be handled. 5838153SGeorge.Shepherd@Sun.COM */ 5848153SGeorge.Shepherd@Sun.COM #define SCTP_UNREC_PARAM_MASK 0xc000 5858153SGeorge.Shepherd@Sun.COM /* Continue processing parameters after an unrecognized optional param? */ 5868153SGeorge.Shepherd@Sun.COM #define SCTP_CONT_PROC_PARAMS 0x8000 5878153SGeorge.Shepherd@Sun.COM /* Report this unreconized optional parameter or silently ignore it? */ 5888153SGeorge.Shepherd@Sun.COM #define SCTP_REPORT_THIS_PARAM 0x4000 5898153SGeorge.Shepherd@Sun.COM 5908153SGeorge.Shepherd@Sun.COM /* 5910Sstevel@tonic-gate * Data chunk bit manipulations 5920Sstevel@tonic-gate */ 5930Sstevel@tonic-gate #define SCTP_DATA_EBIT 0x01 5940Sstevel@tonic-gate #define SCTP_TBIT 0x01 5950Sstevel@tonic-gate #define SCTP_DATA_BBIT 0x02 5960Sstevel@tonic-gate #define SCTP_DATA_UBIT 0x04 5970Sstevel@tonic-gate 5980Sstevel@tonic-gate #define SCTP_DATA_GET_BBIT(sdc) ((sdc)->sdh_flags & SCTP_DATA_BBIT) 5990Sstevel@tonic-gate #define SCTP_GET_TBIT(cp) ((cp)->sch_flags & SCTP_TBIT) 6000Sstevel@tonic-gate #define SCTP_DATA_GET_EBIT(sdc) ((sdc)->sdh_flags & SCTP_DATA_EBIT) 6010Sstevel@tonic-gate #define SCTP_DATA_GET_UBIT(sdc) ((sdc)->sdh_flags & SCTP_DATA_UBIT) 6020Sstevel@tonic-gate 6030Sstevel@tonic-gate #define SCTP_DATA_SET_BBIT(sdc) ((sdc)->sdh_flags |= SCTP_DATA_BBIT) 6040Sstevel@tonic-gate #define SCTP_SET_TBIT(cp) ((cp)->sch_flags |= SCTP_TBIT) 6050Sstevel@tonic-gate #define SCTP_DATA_SET_EBIT(sdc) ((sdc)->sdh_flags |= SCTP_DATA_EBIT) 6060Sstevel@tonic-gate #define SCTP_DATA_SET_UBIT(sdc) ((sdc)->sdh_flags |= SCTP_DATA_UBIT) 6070Sstevel@tonic-gate 6080Sstevel@tonic-gate /* SCTP common header */ 6090Sstevel@tonic-gate typedef struct sctp_hdr { 6100Sstevel@tonic-gate uint16_t sh_sport; 6110Sstevel@tonic-gate uint16_t sh_dport; 6120Sstevel@tonic-gate uint32_t sh_verf; 6130Sstevel@tonic-gate uint32_t sh_chksum; 6140Sstevel@tonic-gate } sctp_hdr_t; 6150Sstevel@tonic-gate 6160Sstevel@tonic-gate /* Chunk IDs */ 6170Sstevel@tonic-gate typedef enum { 6180Sstevel@tonic-gate CHUNK_DATA, 6190Sstevel@tonic-gate CHUNK_INIT, 6200Sstevel@tonic-gate CHUNK_INIT_ACK, 6210Sstevel@tonic-gate CHUNK_SACK, 6220Sstevel@tonic-gate CHUNK_HEARTBEAT, 6230Sstevel@tonic-gate CHUNK_HEARTBEAT_ACK, 6240Sstevel@tonic-gate CHUNK_ABORT, 6250Sstevel@tonic-gate CHUNK_SHUTDOWN, 6260Sstevel@tonic-gate CHUNK_SHUTDOWN_ACK, 6270Sstevel@tonic-gate CHUNK_ERROR, 6280Sstevel@tonic-gate CHUNK_COOKIE, 6290Sstevel@tonic-gate CHUNK_COOKIE_ACK, 6300Sstevel@tonic-gate CHUNK_ECNE, 6310Sstevel@tonic-gate CHUNK_CWR, 6320Sstevel@tonic-gate CHUNK_SHUTDOWN_COMPLETE, 6330Sstevel@tonic-gate CHUNK_ASCONF_ACK = 128, 6340Sstevel@tonic-gate CHUNK_FORWARD_TSN = 192, 6350Sstevel@tonic-gate CHUNK_ASCONF = 193 6360Sstevel@tonic-gate } sctp_chunk_id_t; 6370Sstevel@tonic-gate 6380Sstevel@tonic-gate /* Common chunk header */ 6390Sstevel@tonic-gate typedef struct sctp_chunk_hdr { 6400Sstevel@tonic-gate uint8_t sch_id; 6410Sstevel@tonic-gate uint8_t sch_flags; 6420Sstevel@tonic-gate uint16_t sch_len; 6430Sstevel@tonic-gate } sctp_chunk_hdr_t; 6440Sstevel@tonic-gate 6450Sstevel@tonic-gate /* INIT chunk data definition */ 6460Sstevel@tonic-gate typedef struct sctp_init_chunk { 6470Sstevel@tonic-gate uint32_t sic_inittag; 6480Sstevel@tonic-gate uint32_t sic_a_rwnd; 6490Sstevel@tonic-gate uint16_t sic_outstr; 6500Sstevel@tonic-gate uint16_t sic_instr; 6510Sstevel@tonic-gate uint32_t sic_inittsn; 6520Sstevel@tonic-gate } sctp_init_chunk_t; 6530Sstevel@tonic-gate 6540Sstevel@tonic-gate /* SCTP DATA chunk */ 6550Sstevel@tonic-gate typedef struct sctp_data_chunk { 6560Sstevel@tonic-gate uint32_t sdc_tsn; 6570Sstevel@tonic-gate uint16_t sdc_sid; 6580Sstevel@tonic-gate uint16_t sdc_ssn; 6590Sstevel@tonic-gate uint32_t sdc_payload_id; 6600Sstevel@tonic-gate } sctp_data_chunk_t; 6610Sstevel@tonic-gate 6620Sstevel@tonic-gate /* sctp_data_hdr includes the SCTP chunk hdr and the DATA chunk */ 6630Sstevel@tonic-gate typedef struct sctp_data_hdr { 6640Sstevel@tonic-gate sctp_chunk_hdr_t sdh_chdr; 6650Sstevel@tonic-gate sctp_data_chunk_t sdh_data; 6660Sstevel@tonic-gate #define sdh_id sdh_chdr.sch_id 6670Sstevel@tonic-gate #define sdh_flags sdh_chdr.sch_flags 6680Sstevel@tonic-gate #define sdh_len sdh_chdr.sch_len 6690Sstevel@tonic-gate #define sdh_tsn sdh_data.sdc_tsn 6700Sstevel@tonic-gate #define sdh_sid sdh_data.sdc_sid 6710Sstevel@tonic-gate #define sdh_ssn sdh_data.sdc_ssn 6720Sstevel@tonic-gate #define sdh_payload_id sdh_data.sdc_payload_id 6730Sstevel@tonic-gate } sctp_data_hdr_t; 6740Sstevel@tonic-gate 6750Sstevel@tonic-gate typedef struct sctp_sack_chunk { 6760Sstevel@tonic-gate uint32_t ssc_cumtsn; 6770Sstevel@tonic-gate uint32_t ssc_a_rwnd; 6780Sstevel@tonic-gate uint16_t ssc_numfrags; 6790Sstevel@tonic-gate uint16_t ssc_numdups; 6800Sstevel@tonic-gate } sctp_sack_chunk_t; 6810Sstevel@tonic-gate 6820Sstevel@tonic-gate typedef struct sctp_sack_frag { 6830Sstevel@tonic-gate uint16_t ssf_start; 6840Sstevel@tonic-gate uint16_t ssf_end; 6850Sstevel@tonic-gate } sctp_sack_frag_t; 6860Sstevel@tonic-gate 6870Sstevel@tonic-gate /* Parameter types */ 6880Sstevel@tonic-gate #define PARM_UNKNOWN 0 6890Sstevel@tonic-gate #define PARM_HBINFO 1 6900Sstevel@tonic-gate #define PARM_ADDR4 5 6910Sstevel@tonic-gate #define PARM_ADDR6 6 6920Sstevel@tonic-gate #define PARM_COOKIE 7 6930Sstevel@tonic-gate #define PARM_UNRECOGNIZED 8 6940Sstevel@tonic-gate #define PARM_COOKIE_PRESERVE 9 6950Sstevel@tonic-gate #define PARM_ADDR_HOST_NAME 11 6960Sstevel@tonic-gate #define PARM_SUPP_ADDRS 12 6970Sstevel@tonic-gate #define PARM_ECN 0x8000 6980Sstevel@tonic-gate #define PARM_ECN_CAPABLE PARM_ECN 6990Sstevel@tonic-gate #define PARM_FORWARD_TSN 0xc000 7000Sstevel@tonic-gate #define PARM_ADD_IP 0xc001 7010Sstevel@tonic-gate #define PARM_DEL_IP 0xc002 7020Sstevel@tonic-gate #define PARM_ERROR_IND 0xc003 7030Sstevel@tonic-gate #define PARM_ASCONF_ERROR PARM_ERROR_IND 7040Sstevel@tonic-gate #define PARM_SET_PRIMARY 0xc004 7050Sstevel@tonic-gate #define PARM_PRIMARY_ADDR PARM_SET_PRIMARY 7060Sstevel@tonic-gate #define PARM_SUCCESS 0xc005 7070Sstevel@tonic-gate #define PARM_ASCONF_SUCCESS PARM_SUCCESS 7080Sstevel@tonic-gate #define PARM_ADAPT_LAYER_IND 0xc006 7090Sstevel@tonic-gate 7100Sstevel@tonic-gate 7110Sstevel@tonic-gate /* Lengths from SCTP spec */ 7120Sstevel@tonic-gate #define PARM_ADDR4_LEN 8 7130Sstevel@tonic-gate #define PARM_ADDR6_LEN 20 7140Sstevel@tonic-gate 7150Sstevel@tonic-gate /* Parameter header */ 7160Sstevel@tonic-gate typedef struct sctp_parm_hdr { 7170Sstevel@tonic-gate uint16_t sph_type; 7180Sstevel@tonic-gate uint16_t sph_len; 7190Sstevel@tonic-gate } sctp_parm_hdr_t; 7200Sstevel@tonic-gate 7219451SGeorge.Shepherd@Sun.COM /* 7229451SGeorge.Shepherd@Sun.COM * The following extend sctp_parm_hdr_t 7239451SGeorge.Shepherd@Sun.COM * with cause-specfic content used to fill 7249451SGeorge.Shepherd@Sun.COM * CAUSE blocks in ABORT or ERROR chunks. 7259451SGeorge.Shepherd@Sun.COM * The overall size of the CAUSE block will 7269451SGeorge.Shepherd@Sun.COM * be sizeof (sctp_parm_hdr_t) plus the size 7279451SGeorge.Shepherd@Sun.COM * of the extended cause structure, 7289451SGeorge.Shepherd@Sun.COM */ 7299451SGeorge.Shepherd@Sun.COM 7309451SGeorge.Shepherd@Sun.COM /* 7319451SGeorge.Shepherd@Sun.COM * Invalid stream-identifier extended cause. 7329451SGeorge.Shepherd@Sun.COM * SCTP_ERR_BAD_SID 7339451SGeorge.Shepherd@Sun.COM */ 7349451SGeorge.Shepherd@Sun.COM typedef struct sctp_bsc { 7359451SGeorge.Shepherd@Sun.COM uint16_t bsc_sid; 7369451SGeorge.Shepherd@Sun.COM uint16_t bsc_pad; /* RESV = 0 */ 7379451SGeorge.Shepherd@Sun.COM } sctp_bsc_t; 7389451SGeorge.Shepherd@Sun.COM 7399451SGeorge.Shepherd@Sun.COM /* 7409451SGeorge.Shepherd@Sun.COM * Missing parameter extended cause, currently 7419451SGeorge.Shepherd@Sun.COM * only one missing parameter is supported. 7429451SGeorge.Shepherd@Sun.COM * SCTP_ERR_MISSING_PARM 7439451SGeorge.Shepherd@Sun.COM */ 7449451SGeorge.Shepherd@Sun.COM typedef struct sctp_mpc { 7459451SGeorge.Shepherd@Sun.COM uint32_t mpc_num; 7469451SGeorge.Shepherd@Sun.COM uint16_t mpc_param; 7479451SGeorge.Shepherd@Sun.COM uint16_t mpc_pad; 7489451SGeorge.Shepherd@Sun.COM } sctp_mpc_t; 7499451SGeorge.Shepherd@Sun.COM 7500Sstevel@tonic-gate /* Error causes */ 7510Sstevel@tonic-gate #define SCTP_ERR_UNKNOWN 0 7520Sstevel@tonic-gate #define SCTP_ERR_BAD_SID 1 7530Sstevel@tonic-gate #define SCTP_ERR_MISSING_PARM 2 7540Sstevel@tonic-gate #define SCTP_ERR_STALE_COOKIE 3 7550Sstevel@tonic-gate #define SCTP_ERR_NO_RESOURCES 4 7560Sstevel@tonic-gate #define SCTP_ERR_BAD_ADDR 5 7570Sstevel@tonic-gate #define SCTP_ERR_UNREC_CHUNK 6 7580Sstevel@tonic-gate #define SCTP_ERR_BAD_MANDPARM 7 7590Sstevel@tonic-gate #define SCTP_ERR_UNREC_PARM 8 7600Sstevel@tonic-gate #define SCTP_ERR_NO_USR_DATA 9 7610Sstevel@tonic-gate #define SCTP_ERR_COOKIE_SHUT 10 7620Sstevel@tonic-gate #define SCTP_ERR_RESTART_NEW_ADDRS 11 7630Sstevel@tonic-gate #define SCTP_ERR_USER_ABORT 12 7640Sstevel@tonic-gate #define SCTP_ERR_DELETE_LASTADDR 256 7650Sstevel@tonic-gate #define SCTP_ERR_RESOURCE_SHORTAGE 257 7660Sstevel@tonic-gate #define SCTP_ERR_DELETE_SRCADDR 258 7670Sstevel@tonic-gate #define SCTP_ERR_AUTH_ERR 260 7680Sstevel@tonic-gate 7690Sstevel@tonic-gate /* 7700Sstevel@tonic-gate * Extensions 7710Sstevel@tonic-gate */ 7720Sstevel@tonic-gate 7730Sstevel@tonic-gate /* Extended Chunk Types */ 7740Sstevel@tonic-gate #define CHUNK_ASCONF 0xc1 7750Sstevel@tonic-gate #define CHUNK_ASCONF_ACK 0x80 7760Sstevel@tonic-gate 7770Sstevel@tonic-gate /* Extension Error Causes */ 7780Sstevel@tonic-gate #define SCTP_ERR_DEL_LAST_ADDR 0x0100 7790Sstevel@tonic-gate #define SCTP_ERR_RES_SHORTAGE 0x0101 7800Sstevel@tonic-gate #define SCTP_ERR_DEL_SRC_ADDR 0x0102 7810Sstevel@tonic-gate #define SCTP_ERR_ILLEGAL_ACK 0x0103 7820Sstevel@tonic-gate #define SCTP_ERR_UNAUTHORIZED 0x0104 7830Sstevel@tonic-gate 7840Sstevel@tonic-gate typedef struct sctp_addip4 { 7850Sstevel@tonic-gate sctp_parm_hdr_t sad4_addip_ph; 7860Sstevel@tonic-gate uint32_t asconf_req_cid; 7870Sstevel@tonic-gate sctp_parm_hdr_t sad4_addr4_ph; 7880Sstevel@tonic-gate ipaddr_t sad4_addr; 7890Sstevel@tonic-gate } sctp_addip4_t; 7900Sstevel@tonic-gate 7910Sstevel@tonic-gate typedef struct sctp_addip6 { 7920Sstevel@tonic-gate sctp_parm_hdr_t sad6_addip_ph; 7930Sstevel@tonic-gate uint32_t asconf_req_cid; 7940Sstevel@tonic-gate sctp_parm_hdr_t sad6_addr6_ph; 7950Sstevel@tonic-gate in6_addr_t sad6_addr; 7960Sstevel@tonic-gate } sctp_addip6_t; 7970Sstevel@tonic-gate 7980Sstevel@tonic-gate #ifdef __cplusplus 7990Sstevel@tonic-gate } 8000Sstevel@tonic-gate #endif 8010Sstevel@tonic-gate 8020Sstevel@tonic-gate #endif /* _NETINET_SCTP_H */ 803