xref: /aosp_15_r20/external/ltp/utils/sctp/include/netinet/sctp.h (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1*49cdfc7eSAndroid Build Coastguard Worker /* SCTP kernel Implementation: User API extensions.
2*49cdfc7eSAndroid Build Coastguard Worker  *
3*49cdfc7eSAndroid Build Coastguard Worker  * sctp.h
4*49cdfc7eSAndroid Build Coastguard Worker  *
5*49cdfc7eSAndroid Build Coastguard Worker  * Distributed under the terms of the LGPL v2.1 as described in
6*49cdfc7eSAndroid Build Coastguard Worker  *    http://www.gnu.org/copyleft/lesser.txt
7*49cdfc7eSAndroid Build Coastguard Worker  *
8*49cdfc7eSAndroid Build Coastguard Worker  * This file is part of the user library that offers support for the
9*49cdfc7eSAndroid Build Coastguard Worker  * Linux Kernel SCTP Implementation. The main purpose of this
10*49cdfc7eSAndroid Build Coastguard Worker  * code is to provide the SCTP Socket API mappings for user
11*49cdfc7eSAndroid Build Coastguard Worker  * application to interface with SCTP in kernel.
12*49cdfc7eSAndroid Build Coastguard Worker  *
13*49cdfc7eSAndroid Build Coastguard Worker  * This header represents the structures and constants needed to support
14*49cdfc7eSAndroid Build Coastguard Worker  * the SCTP Extension to the Sockets API.
15*49cdfc7eSAndroid Build Coastguard Worker  *
16*49cdfc7eSAndroid Build Coastguard Worker  * (C) Copyright IBM Corp. 2001, 2004
17*49cdfc7eSAndroid Build Coastguard Worker  * Copyright (c) 1999-2000 Cisco, Inc.
18*49cdfc7eSAndroid Build Coastguard Worker  * Copyright (c) 1999-2001 Motorola, Inc.
19*49cdfc7eSAndroid Build Coastguard Worker  *
20*49cdfc7eSAndroid Build Coastguard Worker  * Written or modified by:
21*49cdfc7eSAndroid Build Coastguard Worker  *    La Monte H.P. Yarroll    <[email protected]>
22*49cdfc7eSAndroid Build Coastguard Worker  *    R. Stewart               <[email protected]>
23*49cdfc7eSAndroid Build Coastguard Worker  *    K. Morneau               <[email protected]>
24*49cdfc7eSAndroid Build Coastguard Worker  *    Q. Xie                   <[email protected]>
25*49cdfc7eSAndroid Build Coastguard Worker  *    Karl Knutson             <[email protected]>
26*49cdfc7eSAndroid Build Coastguard Worker  *    Jon Grimm                <[email protected]>
27*49cdfc7eSAndroid Build Coastguard Worker  *    Daisy Chang              <[email protected]>
28*49cdfc7eSAndroid Build Coastguard Worker  *    Inaky Perez-Gonzalez     <[email protected]>
29*49cdfc7eSAndroid Build Coastguard Worker  *    Sridhar Samudrala        <[email protected]>
30*49cdfc7eSAndroid Build Coastguard Worker  *    Vlad Yasevich		<[email protected]>
31*49cdfc7eSAndroid Build Coastguard Worker  */
32*49cdfc7eSAndroid Build Coastguard Worker 
33*49cdfc7eSAndroid Build Coastguard Worker #ifndef __linux_sctp_h__
34*49cdfc7eSAndroid Build Coastguard Worker #define __linux_sctp_h__
35*49cdfc7eSAndroid Build Coastguard Worker 
36*49cdfc7eSAndroid Build Coastguard Worker #include <stdint.h>
37*49cdfc7eSAndroid Build Coastguard Worker #include <linux/types.h>
38*49cdfc7eSAndroid Build Coastguard Worker #include <sys/socket.h>
39*49cdfc7eSAndroid Build Coastguard Worker 
40*49cdfc7eSAndroid Build Coastguard Worker #ifdef __cplusplus
41*49cdfc7eSAndroid Build Coastguard Worker extern "C" {
42*49cdfc7eSAndroid Build Coastguard Worker #endif
43*49cdfc7eSAndroid Build Coastguard Worker 
44*49cdfc7eSAndroid Build Coastguard Worker typedef __s32 sctp_assoc_t;
45*49cdfc7eSAndroid Build Coastguard Worker 
46*49cdfc7eSAndroid Build Coastguard Worker /* Socket option layer for SCTP */
47*49cdfc7eSAndroid Build Coastguard Worker #ifndef SOL_SCTP
48*49cdfc7eSAndroid Build Coastguard Worker #define SOL_SCTP	132
49*49cdfc7eSAndroid Build Coastguard Worker #endif
50*49cdfc7eSAndroid Build Coastguard Worker 
51*49cdfc7eSAndroid Build Coastguard Worker #ifndef IPPROTO_SCTP
52*49cdfc7eSAndroid Build Coastguard Worker #define IPPROTO_SCTP    132
53*49cdfc7eSAndroid Build Coastguard Worker #endif
54*49cdfc7eSAndroid Build Coastguard Worker 
55*49cdfc7eSAndroid Build Coastguard Worker /* 9. Preprocessor constants */
56*49cdfc7eSAndroid Build Coastguard Worker #define HAVE_SCTP
57*49cdfc7eSAndroid Build Coastguard Worker #define HAVE_KERNEL_SCTP
58*49cdfc7eSAndroid Build Coastguard Worker #define HAVE_SCTP_MULTIBUF
59*49cdfc7eSAndroid Build Coastguard Worker #define HAVE_SCTP_NOCONNECT
60*49cdfc7eSAndroid Build Coastguard Worker #define HAVE_SCTP_PRSCTP
61*49cdfc7eSAndroid Build Coastguard Worker #define HAVE_SCTP_ADDIP
62*49cdfc7eSAndroid Build Coastguard Worker #define HAVE_SCTP_CANSET_PRIMARY
63*49cdfc7eSAndroid Build Coastguard Worker 
64*49cdfc7eSAndroid Build Coastguard Worker /* The following symbols come from the Sockets API Extensions for
65*49cdfc7eSAndroid Build Coastguard Worker  * SCTP <draft-ietf-tsvwg-sctpsocket-07.txt>.
66*49cdfc7eSAndroid Build Coastguard Worker  */
67*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_RTOINFO	0
68*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_ASSOCINFO  1
69*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_INITMSG	2
70*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_NODELAY	3		/* Get/set nodelay option. */
71*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_AUTOCLOSE	4
72*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_SET_PEER_PRIMARY_ADDR 5
73*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_PRIMARY_ADDR	6
74*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_ADAPTATION_LAYER	7
75*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_DISABLE_FRAGMENTS	8
76*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_PEER_ADDR_PARAMS	9
77*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_DEFAULT_SEND_PARAM	10
78*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_EVENTS	11
79*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_I_WANT_MAPPED_V4_ADDR 12	/* Turn on/off mapped v4 addresses  */
80*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_MAXSEG	13		/* Get/set maximum fragment. */
81*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_STATUS	14
82*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_GET_PEER_ADDR_INFO	15
83*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_DELAYED_ACK_TIME	16
84*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_DELAYED_ACK SCTP_DELAYED_ACK_TIME
85*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_DELAYED_SACK SCTP_DELAYED_ACK_TIME
86*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_CONTEXT	17
87*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_FRAGMENT_INTERLEAVE	18
88*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_PARTIAL_DELIVERY_POINT	19 /* Set/Get partial delivery point */
89*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_MAX_BURST	20		/* Set/Get max burst */
90*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_AUTH_CHUNK	21	/* Set only: add a chunk type to authenticate */
91*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_HMAC_IDENT	22
92*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_AUTH_KEY	23
93*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_AUTH_ACTIVE_KEY	24
94*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_AUTH_DELETE_KEY	25
95*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_PEER_AUTH_CHUNKS	26	/* Read only */
96*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_LOCAL_AUTH_CHUNKS	27	/* Read only */
97*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_GET_ASSOC_NUMBER	28	/* Read only */
98*49cdfc7eSAndroid Build Coastguard Worker 
99*49cdfc7eSAndroid Build Coastguard Worker /* Internal Socket Options. Some of the sctp library functions are
100*49cdfc7eSAndroid Build Coastguard Worker  * implemented using these socket options.
101*49cdfc7eSAndroid Build Coastguard Worker  */
102*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_SOCKOPT_BINDX_ADD	100	/* BINDX requests for adding addrs */
103*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_SOCKOPT_BINDX_REM	101	/* BINDX requests for removing addrs. */
104*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_SOCKOPT_PEELOFF	102	/* peel off association. */
105*49cdfc7eSAndroid Build Coastguard Worker /* Options 104-106 are deprecated and removed. Do not use this space */
106*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_SOCKOPT_CONNECTX_OLD	107	/* CONNECTX old requests. */
107*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_GET_PEER_ADDRS	108		/* Get all peer addresss. */
108*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_GET_LOCAL_ADDRS	109		/* Get all local addresss. */
109*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_SOCKOPT_CONNECTX	110		/* CONNECTX requests. */
110*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_SOCKOPT_CONNECTX3	111	/* CONNECTX requests (updated) */
111*49cdfc7eSAndroid Build Coastguard Worker 
112*49cdfc7eSAndroid Build Coastguard Worker /* SCTP socket option used to read per endpoint association statistics. */
113*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_GET_ASSOC_STATS    112      /* Read only */
114*49cdfc7eSAndroid Build Coastguard Worker 
115*49cdfc7eSAndroid Build Coastguard Worker /*
116*49cdfc7eSAndroid Build Coastguard Worker  * 5.2.1 SCTP Initiation Structure (SCTP_INIT)
117*49cdfc7eSAndroid Build Coastguard Worker  *
118*49cdfc7eSAndroid Build Coastguard Worker  *   This cmsghdr structure provides information for initializing new
119*49cdfc7eSAndroid Build Coastguard Worker  *   SCTP associations with sendmsg().  The SCTP_INITMSG socket option
120*49cdfc7eSAndroid Build Coastguard Worker  *   uses this same data structure.  This structure is not used for
121*49cdfc7eSAndroid Build Coastguard Worker  *   recvmsg().
122*49cdfc7eSAndroid Build Coastguard Worker  *
123*49cdfc7eSAndroid Build Coastguard Worker  *   cmsg_level    cmsg_type      cmsg_data[]
124*49cdfc7eSAndroid Build Coastguard Worker  *   ------------  ------------   ----------------------
125*49cdfc7eSAndroid Build Coastguard Worker  *   IPPROTO_SCTP  SCTP_INIT      struct sctp_initmsg
126*49cdfc7eSAndroid Build Coastguard Worker  *
127*49cdfc7eSAndroid Build Coastguard Worker  */
128*49cdfc7eSAndroid Build Coastguard Worker struct sctp_initmsg {
129*49cdfc7eSAndroid Build Coastguard Worker 	__u16 sinit_num_ostreams;
130*49cdfc7eSAndroid Build Coastguard Worker 	__u16 sinit_max_instreams;
131*49cdfc7eSAndroid Build Coastguard Worker 	__u16 sinit_max_attempts;
132*49cdfc7eSAndroid Build Coastguard Worker 	__u16 sinit_max_init_timeo;
133*49cdfc7eSAndroid Build Coastguard Worker };
134*49cdfc7eSAndroid Build Coastguard Worker 
135*49cdfc7eSAndroid Build Coastguard Worker /*
136*49cdfc7eSAndroid Build Coastguard Worker  * 5.2.2 SCTP Header Information Structure (SCTP_SNDRCV)
137*49cdfc7eSAndroid Build Coastguard Worker  *
138*49cdfc7eSAndroid Build Coastguard Worker  *   This cmsghdr structure specifies SCTP options for sendmsg() and
139*49cdfc7eSAndroid Build Coastguard Worker  *   describes SCTP header information about a received message through
140*49cdfc7eSAndroid Build Coastguard Worker  *   recvmsg().
141*49cdfc7eSAndroid Build Coastguard Worker  *
142*49cdfc7eSAndroid Build Coastguard Worker  *   cmsg_level    cmsg_type      cmsg_data[]
143*49cdfc7eSAndroid Build Coastguard Worker  *   ------------  ------------   ----------------------
144*49cdfc7eSAndroid Build Coastguard Worker  *   IPPROTO_SCTP  SCTP_SNDRCV    struct sctp_sndrcvinfo
145*49cdfc7eSAndroid Build Coastguard Worker  *
146*49cdfc7eSAndroid Build Coastguard Worker  */
147*49cdfc7eSAndroid Build Coastguard Worker struct sctp_sndrcvinfo {
148*49cdfc7eSAndroid Build Coastguard Worker 	__u16 sinfo_stream;
149*49cdfc7eSAndroid Build Coastguard Worker 	__u16 sinfo_ssn;
150*49cdfc7eSAndroid Build Coastguard Worker 	__u16 sinfo_flags;
151*49cdfc7eSAndroid Build Coastguard Worker 	__u32 sinfo_ppid;
152*49cdfc7eSAndroid Build Coastguard Worker 	__u32 sinfo_context;
153*49cdfc7eSAndroid Build Coastguard Worker 	__u32 sinfo_timetolive;
154*49cdfc7eSAndroid Build Coastguard Worker 	__u32 sinfo_tsn;
155*49cdfc7eSAndroid Build Coastguard Worker 	__u32 sinfo_cumtsn;
156*49cdfc7eSAndroid Build Coastguard Worker 	sctp_assoc_t sinfo_assoc_id;
157*49cdfc7eSAndroid Build Coastguard Worker };
158*49cdfc7eSAndroid Build Coastguard Worker 
159*49cdfc7eSAndroid Build Coastguard Worker /*
160*49cdfc7eSAndroid Build Coastguard Worker  *  sinfo_flags: 16 bits (unsigned integer)
161*49cdfc7eSAndroid Build Coastguard Worker  *
162*49cdfc7eSAndroid Build Coastguard Worker  *   This field may contain any of the following flags and is composed of
163*49cdfc7eSAndroid Build Coastguard Worker  *   a bitwise OR of these values.
164*49cdfc7eSAndroid Build Coastguard Worker  */
165*49cdfc7eSAndroid Build Coastguard Worker 
166*49cdfc7eSAndroid Build Coastguard Worker enum sctp_sinfo_flags {
167*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_UNORDERED = 1,  /* Send/receive message unordered. */
168*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_ADDR_OVER = 2,  /* Override the primary destination. */
169*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_ABORT=4,        /* Send an ABORT message to the peer. */
170*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_SACK_IMMEDIATELY = 8,      /* SACK should be sent without delay */
171*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_EOF=MSG_FIN,    /* Initiate graceful shutdown process. */
172*49cdfc7eSAndroid Build Coastguard Worker };
173*49cdfc7eSAndroid Build Coastguard Worker 
174*49cdfc7eSAndroid Build Coastguard Worker 
175*49cdfc7eSAndroid Build Coastguard Worker typedef union {
176*49cdfc7eSAndroid Build Coastguard Worker 	__u8   			raw;
177*49cdfc7eSAndroid Build Coastguard Worker 	struct sctp_initmsg	init;
178*49cdfc7eSAndroid Build Coastguard Worker 	struct sctp_sndrcvinfo	sndrcv;
179*49cdfc7eSAndroid Build Coastguard Worker } sctp_cmsg_data_t;
180*49cdfc7eSAndroid Build Coastguard Worker 
181*49cdfc7eSAndroid Build Coastguard Worker /* These are cmsg_types.  */
182*49cdfc7eSAndroid Build Coastguard Worker typedef enum sctp_cmsg_type {
183*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_INIT,              /* 5.2.1 SCTP Initiation Structure */
184*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_INIT SCTP_INIT
185*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_SNDRCV,            /* 5.2.2 SCTP Header Information Structure */
186*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_SNDRCV SCTP_SNDRCV
187*49cdfc7eSAndroid Build Coastguard Worker } sctp_cmsg_t;
188*49cdfc7eSAndroid Build Coastguard Worker 
189*49cdfc7eSAndroid Build Coastguard Worker 
190*49cdfc7eSAndroid Build Coastguard Worker /*
191*49cdfc7eSAndroid Build Coastguard Worker  * 5.3.1.1 SCTP_ASSOC_CHANGE
192*49cdfc7eSAndroid Build Coastguard Worker  *
193*49cdfc7eSAndroid Build Coastguard Worker  *   Communication notifications inform the ULP that an SCTP association
194*49cdfc7eSAndroid Build Coastguard Worker  *   has either begun or ended. The identifier for a new association is
195*49cdfc7eSAndroid Build Coastguard Worker  *   provided by this notificaion. The notification information has the
196*49cdfc7eSAndroid Build Coastguard Worker  *   following format:
197*49cdfc7eSAndroid Build Coastguard Worker  *
198*49cdfc7eSAndroid Build Coastguard Worker  */
199*49cdfc7eSAndroid Build Coastguard Worker struct sctp_assoc_change {
200*49cdfc7eSAndroid Build Coastguard Worker 	__u16 sac_type;
201*49cdfc7eSAndroid Build Coastguard Worker 	__u16 sac_flags;
202*49cdfc7eSAndroid Build Coastguard Worker 	__u32 sac_length;
203*49cdfc7eSAndroid Build Coastguard Worker 	__u16 sac_state;
204*49cdfc7eSAndroid Build Coastguard Worker 	__u16 sac_error;
205*49cdfc7eSAndroid Build Coastguard Worker 	__u16 sac_outbound_streams;
206*49cdfc7eSAndroid Build Coastguard Worker 	__u16 sac_inbound_streams;
207*49cdfc7eSAndroid Build Coastguard Worker 	sctp_assoc_t sac_assoc_id;
208*49cdfc7eSAndroid Build Coastguard Worker 	__u8 sac_info[0];
209*49cdfc7eSAndroid Build Coastguard Worker };
210*49cdfc7eSAndroid Build Coastguard Worker 
211*49cdfc7eSAndroid Build Coastguard Worker /*
212*49cdfc7eSAndroid Build Coastguard Worker  *   sac_state: 32 bits (signed integer)
213*49cdfc7eSAndroid Build Coastguard Worker  *
214*49cdfc7eSAndroid Build Coastguard Worker  *   This field holds one of a number of values that communicate the
215*49cdfc7eSAndroid Build Coastguard Worker  *   event that happened to the association.  They include:
216*49cdfc7eSAndroid Build Coastguard Worker  *
217*49cdfc7eSAndroid Build Coastguard Worker  *   Note:  The following state names deviate from the API draft as
218*49cdfc7eSAndroid Build Coastguard Worker  *   the names clash too easily with other kernel symbols.
219*49cdfc7eSAndroid Build Coastguard Worker  */
220*49cdfc7eSAndroid Build Coastguard Worker enum sctp_sac_state {
221*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_COMM_UP,
222*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_COMM_LOST,
223*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_RESTART,
224*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_SHUTDOWN_COMP,
225*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_CANT_STR_ASSOC,
226*49cdfc7eSAndroid Build Coastguard Worker };
227*49cdfc7eSAndroid Build Coastguard Worker 
228*49cdfc7eSAndroid Build Coastguard Worker /*
229*49cdfc7eSAndroid Build Coastguard Worker  * 5.3.1.2 SCTP_PEER_ADDR_CHANGE
230*49cdfc7eSAndroid Build Coastguard Worker  *
231*49cdfc7eSAndroid Build Coastguard Worker  *   When a destination address on a multi-homed peer encounters a change
232*49cdfc7eSAndroid Build Coastguard Worker  *   an interface details event is sent.  The information has the
233*49cdfc7eSAndroid Build Coastguard Worker  *   following structure:
234*49cdfc7eSAndroid Build Coastguard Worker  */
235*49cdfc7eSAndroid Build Coastguard Worker struct sctp_paddr_change {
236*49cdfc7eSAndroid Build Coastguard Worker 	__u16 spc_type;
237*49cdfc7eSAndroid Build Coastguard Worker 	__u16 spc_flags;
238*49cdfc7eSAndroid Build Coastguard Worker 	__u32 spc_length;
239*49cdfc7eSAndroid Build Coastguard Worker 	struct sockaddr_storage spc_aaddr;
240*49cdfc7eSAndroid Build Coastguard Worker 	int spc_state;
241*49cdfc7eSAndroid Build Coastguard Worker 	int spc_error;
242*49cdfc7eSAndroid Build Coastguard Worker 	sctp_assoc_t spc_assoc_id;
243*49cdfc7eSAndroid Build Coastguard Worker } __attribute__((packed, aligned(4)));
244*49cdfc7eSAndroid Build Coastguard Worker 
245*49cdfc7eSAndroid Build Coastguard Worker /*
246*49cdfc7eSAndroid Build Coastguard Worker  *    spc_state:  32 bits (signed integer)
247*49cdfc7eSAndroid Build Coastguard Worker  *
248*49cdfc7eSAndroid Build Coastguard Worker  *   This field holds one of a number of values that communicate the
249*49cdfc7eSAndroid Build Coastguard Worker  *   event that happened to the address.  They include:
250*49cdfc7eSAndroid Build Coastguard Worker  */
251*49cdfc7eSAndroid Build Coastguard Worker enum sctp_spc_state {
252*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_ADDR_AVAILABLE,
253*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_ADDR_UNREACHABLE,
254*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_ADDR_REMOVED,
255*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_ADDR_ADDED,
256*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_ADDR_MADE_PRIM,
257*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_ADDR_CONFIRMED,
258*49cdfc7eSAndroid Build Coastguard Worker };
259*49cdfc7eSAndroid Build Coastguard Worker 
260*49cdfc7eSAndroid Build Coastguard Worker 
261*49cdfc7eSAndroid Build Coastguard Worker /*
262*49cdfc7eSAndroid Build Coastguard Worker  * 5.3.1.3 SCTP_REMOTE_ERROR
263*49cdfc7eSAndroid Build Coastguard Worker  *
264*49cdfc7eSAndroid Build Coastguard Worker  *   A remote peer may send an Operational Error message to its peer.
265*49cdfc7eSAndroid Build Coastguard Worker  *   This message indicates a variety of error conditions on an
266*49cdfc7eSAndroid Build Coastguard Worker  *   association. The entire error TLV as it appears on the wire is
267*49cdfc7eSAndroid Build Coastguard Worker  *   included in a SCTP_REMOTE_ERROR event.  Please refer to the SCTP
268*49cdfc7eSAndroid Build Coastguard Worker  *   specification [SCTP] and any extensions for a list of possible
269*49cdfc7eSAndroid Build Coastguard Worker  *   error formats. SCTP error TLVs have the format:
270*49cdfc7eSAndroid Build Coastguard Worker  */
271*49cdfc7eSAndroid Build Coastguard Worker struct sctp_remote_error {
272*49cdfc7eSAndroid Build Coastguard Worker 	__u16 sre_type;
273*49cdfc7eSAndroid Build Coastguard Worker 	__u16 sre_flags;
274*49cdfc7eSAndroid Build Coastguard Worker 	__u32 sre_length;
275*49cdfc7eSAndroid Build Coastguard Worker 	__u16 sre_error;
276*49cdfc7eSAndroid Build Coastguard Worker 	sctp_assoc_t sre_assoc_id;
277*49cdfc7eSAndroid Build Coastguard Worker 	__u8 sre_data[0];
278*49cdfc7eSAndroid Build Coastguard Worker };
279*49cdfc7eSAndroid Build Coastguard Worker 
280*49cdfc7eSAndroid Build Coastguard Worker 
281*49cdfc7eSAndroid Build Coastguard Worker /*
282*49cdfc7eSAndroid Build Coastguard Worker  * 5.3.1.4 SCTP_SEND_FAILED
283*49cdfc7eSAndroid Build Coastguard Worker  *
284*49cdfc7eSAndroid Build Coastguard Worker  *   If SCTP cannot deliver a message it may return the message as a
285*49cdfc7eSAndroid Build Coastguard Worker  *   notification.
286*49cdfc7eSAndroid Build Coastguard Worker  */
287*49cdfc7eSAndroid Build Coastguard Worker struct sctp_send_failed {
288*49cdfc7eSAndroid Build Coastguard Worker 	__u16 ssf_type;
289*49cdfc7eSAndroid Build Coastguard Worker 	__u16 ssf_flags;
290*49cdfc7eSAndroid Build Coastguard Worker 	__u32 ssf_length;
291*49cdfc7eSAndroid Build Coastguard Worker 	__u32 ssf_error;
292*49cdfc7eSAndroid Build Coastguard Worker 	struct sctp_sndrcvinfo ssf_info;
293*49cdfc7eSAndroid Build Coastguard Worker 	sctp_assoc_t ssf_assoc_id;
294*49cdfc7eSAndroid Build Coastguard Worker 	__u8 ssf_data[0];
295*49cdfc7eSAndroid Build Coastguard Worker };
296*49cdfc7eSAndroid Build Coastguard Worker 
297*49cdfc7eSAndroid Build Coastguard Worker /*
298*49cdfc7eSAndroid Build Coastguard Worker  *   ssf_flags: 16 bits (unsigned integer)
299*49cdfc7eSAndroid Build Coastguard Worker  *
300*49cdfc7eSAndroid Build Coastguard Worker  *   The flag value will take one of the following values
301*49cdfc7eSAndroid Build Coastguard Worker  *
302*49cdfc7eSAndroid Build Coastguard Worker  *   SCTP_DATA_UNSENT  - Indicates that the data was never put on
303*49cdfc7eSAndroid Build Coastguard Worker  *                       the wire.
304*49cdfc7eSAndroid Build Coastguard Worker  *
305*49cdfc7eSAndroid Build Coastguard Worker  *   SCTP_DATA_SENT    - Indicates that the data was put on the wire.
306*49cdfc7eSAndroid Build Coastguard Worker  *                       Note that this does not necessarily mean that the
307*49cdfc7eSAndroid Build Coastguard Worker  *                       data was (or was not) successfully delivered.
308*49cdfc7eSAndroid Build Coastguard Worker  */
309*49cdfc7eSAndroid Build Coastguard Worker enum sctp_ssf_flags {
310*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_DATA_UNSENT,
311*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_DATA_SENT,
312*49cdfc7eSAndroid Build Coastguard Worker };
313*49cdfc7eSAndroid Build Coastguard Worker 
314*49cdfc7eSAndroid Build Coastguard Worker /*
315*49cdfc7eSAndroid Build Coastguard Worker  * 5.3.1.5 SCTP_SHUTDOWN_EVENT
316*49cdfc7eSAndroid Build Coastguard Worker  *
317*49cdfc7eSAndroid Build Coastguard Worker  *   When a peer sends a SHUTDOWN, SCTP delivers this notification to
318*49cdfc7eSAndroid Build Coastguard Worker  *   inform the application that it should cease sending data.
319*49cdfc7eSAndroid Build Coastguard Worker  */
320*49cdfc7eSAndroid Build Coastguard Worker struct sctp_shutdown_event {
321*49cdfc7eSAndroid Build Coastguard Worker 	__u16 sse_type;
322*49cdfc7eSAndroid Build Coastguard Worker 	__u16 sse_flags;
323*49cdfc7eSAndroid Build Coastguard Worker 	__u32 sse_length;
324*49cdfc7eSAndroid Build Coastguard Worker 	sctp_assoc_t sse_assoc_id;
325*49cdfc7eSAndroid Build Coastguard Worker };
326*49cdfc7eSAndroid Build Coastguard Worker 
327*49cdfc7eSAndroid Build Coastguard Worker /*
328*49cdfc7eSAndroid Build Coastguard Worker  * 5.3.1.6 SCTP_ADAPTATION_INDICATION
329*49cdfc7eSAndroid Build Coastguard Worker  *
330*49cdfc7eSAndroid Build Coastguard Worker  *   When a peer sends a Adaptation Layer Indication parameter , SCTP
331*49cdfc7eSAndroid Build Coastguard Worker  *   delivers this notification to inform the application
332*49cdfc7eSAndroid Build Coastguard Worker  *   that of the peers requested adaptation layer.
333*49cdfc7eSAndroid Build Coastguard Worker  */
334*49cdfc7eSAndroid Build Coastguard Worker struct sctp_adaptation_event {
335*49cdfc7eSAndroid Build Coastguard Worker 	__u16 sai_type;
336*49cdfc7eSAndroid Build Coastguard Worker 	__u16 sai_flags;
337*49cdfc7eSAndroid Build Coastguard Worker 	__u32 sai_length;
338*49cdfc7eSAndroid Build Coastguard Worker 	__u32 sai_adaptation_ind;
339*49cdfc7eSAndroid Build Coastguard Worker 	sctp_assoc_t sai_assoc_id;
340*49cdfc7eSAndroid Build Coastguard Worker };
341*49cdfc7eSAndroid Build Coastguard Worker 
342*49cdfc7eSAndroid Build Coastguard Worker /*
343*49cdfc7eSAndroid Build Coastguard Worker  * 5.3.1.7 SCTP_PARTIAL_DELIVERY_EVENT
344*49cdfc7eSAndroid Build Coastguard Worker  *
345*49cdfc7eSAndroid Build Coastguard Worker  *   When a receiver is engaged in a partial delivery of a
346*49cdfc7eSAndroid Build Coastguard Worker  *   message this notification will be used to indicate
347*49cdfc7eSAndroid Build Coastguard Worker  *   various events.
348*49cdfc7eSAndroid Build Coastguard Worker  */
349*49cdfc7eSAndroid Build Coastguard Worker struct sctp_pdapi_event {
350*49cdfc7eSAndroid Build Coastguard Worker 	__u16 pdapi_type;
351*49cdfc7eSAndroid Build Coastguard Worker 	__u16 pdapi_flags;
352*49cdfc7eSAndroid Build Coastguard Worker 	__u32 pdapi_length;
353*49cdfc7eSAndroid Build Coastguard Worker 	__u32 pdapi_indication;
354*49cdfc7eSAndroid Build Coastguard Worker 	sctp_assoc_t pdapi_assoc_id;
355*49cdfc7eSAndroid Build Coastguard Worker };
356*49cdfc7eSAndroid Build Coastguard Worker 
357*49cdfc7eSAndroid Build Coastguard Worker enum { SCTP_PARTIAL_DELIVERY_ABORTED=0, };
358*49cdfc7eSAndroid Build Coastguard Worker 
359*49cdfc7eSAndroid Build Coastguard Worker /*
360*49cdfc7eSAndroid Build Coastguard Worker * 5.3.1.8.  SCTP_AUTHENTICATION_EVENT
361*49cdfc7eSAndroid Build Coastguard Worker *
362*49cdfc7eSAndroid Build Coastguard Worker *  When a receiver is using authentication this message will provide
363*49cdfc7eSAndroid Build Coastguard Worker *  notifications regarding new keys being made active as well as errors.
364*49cdfc7eSAndroid Build Coastguard Worker */
365*49cdfc7eSAndroid Build Coastguard Worker 
366*49cdfc7eSAndroid Build Coastguard Worker struct sctp_authkey_event {
367*49cdfc7eSAndroid Build Coastguard Worker 	__u16 auth_type;
368*49cdfc7eSAndroid Build Coastguard Worker 	__u16 auth_flags;
369*49cdfc7eSAndroid Build Coastguard Worker 	__u32 auth_length;
370*49cdfc7eSAndroid Build Coastguard Worker 	__u16 auth_keynumber;
371*49cdfc7eSAndroid Build Coastguard Worker 	__u16 auth_altkeynumber;
372*49cdfc7eSAndroid Build Coastguard Worker 	__u32 auth_indication;
373*49cdfc7eSAndroid Build Coastguard Worker 	sctp_assoc_t auth_assoc_id;
374*49cdfc7eSAndroid Build Coastguard Worker };
375*49cdfc7eSAndroid Build Coastguard Worker 
376*49cdfc7eSAndroid Build Coastguard Worker enum { SCTP_AUTH_NEWKEY = 0, };
377*49cdfc7eSAndroid Build Coastguard Worker 
378*49cdfc7eSAndroid Build Coastguard Worker struct sctp_sender_dry_event {
379*49cdfc7eSAndroid Build Coastguard Worker        __u16 sender_dry_type;
380*49cdfc7eSAndroid Build Coastguard Worker        __u16 sender_dry_flags;
381*49cdfc7eSAndroid Build Coastguard Worker        __u32 sender_dry_length;
382*49cdfc7eSAndroid Build Coastguard Worker        sctp_assoc_t sender_dry_assoc_id;
383*49cdfc7eSAndroid Build Coastguard Worker };
384*49cdfc7eSAndroid Build Coastguard Worker 
385*49cdfc7eSAndroid Build Coastguard Worker /*
386*49cdfc7eSAndroid Build Coastguard Worker  * Described in Section 7.3
387*49cdfc7eSAndroid Build Coastguard Worker  *   Ancillary Data and Notification Interest Options
388*49cdfc7eSAndroid Build Coastguard Worker  */
389*49cdfc7eSAndroid Build Coastguard Worker struct sctp_event_subscribe {
390*49cdfc7eSAndroid Build Coastguard Worker 	__u8 sctp_data_io_event;
391*49cdfc7eSAndroid Build Coastguard Worker 	__u8 sctp_association_event;
392*49cdfc7eSAndroid Build Coastguard Worker 	__u8 sctp_address_event;
393*49cdfc7eSAndroid Build Coastguard Worker 	__u8 sctp_send_failure_event;
394*49cdfc7eSAndroid Build Coastguard Worker 	__u8 sctp_peer_error_event;
395*49cdfc7eSAndroid Build Coastguard Worker 	__u8 sctp_shutdown_event;
396*49cdfc7eSAndroid Build Coastguard Worker 	__u8 sctp_partial_delivery_event;
397*49cdfc7eSAndroid Build Coastguard Worker 	__u8 sctp_adaptation_layer_event;
398*49cdfc7eSAndroid Build Coastguard Worker 	__u8 sctp_authentication_event;
399*49cdfc7eSAndroid Build Coastguard Worker 	__u8 sctp_sender_dry_event;
400*49cdfc7eSAndroid Build Coastguard Worker };
401*49cdfc7eSAndroid Build Coastguard Worker 
402*49cdfc7eSAndroid Build Coastguard Worker /*
403*49cdfc7eSAndroid Build Coastguard Worker  * 5.3.1 SCTP Notification Structure
404*49cdfc7eSAndroid Build Coastguard Worker  *
405*49cdfc7eSAndroid Build Coastguard Worker  *   The notification structure is defined as the union of all
406*49cdfc7eSAndroid Build Coastguard Worker  *   notification types.
407*49cdfc7eSAndroid Build Coastguard Worker  *
408*49cdfc7eSAndroid Build Coastguard Worker  */
409*49cdfc7eSAndroid Build Coastguard Worker union sctp_notification {
410*49cdfc7eSAndroid Build Coastguard Worker 	struct {
411*49cdfc7eSAndroid Build Coastguard Worker 		__u16 sn_type;             /* Notification type. */
412*49cdfc7eSAndroid Build Coastguard Worker 		__u16 sn_flags;
413*49cdfc7eSAndroid Build Coastguard Worker 		__u32 sn_length;
414*49cdfc7eSAndroid Build Coastguard Worker 	} sn_header;
415*49cdfc7eSAndroid Build Coastguard Worker 	struct sctp_assoc_change sn_assoc_change;
416*49cdfc7eSAndroid Build Coastguard Worker 	struct sctp_paddr_change sn_paddr_change;
417*49cdfc7eSAndroid Build Coastguard Worker 	struct sctp_remote_error sn_remote_error;
418*49cdfc7eSAndroid Build Coastguard Worker 	struct sctp_send_failed sn_send_failed;
419*49cdfc7eSAndroid Build Coastguard Worker 	struct sctp_shutdown_event sn_shutdown_event;
420*49cdfc7eSAndroid Build Coastguard Worker 	struct sctp_adaptation_event sn_adaptation_event;
421*49cdfc7eSAndroid Build Coastguard Worker 	struct sctp_pdapi_event sn_pdapi_event;
422*49cdfc7eSAndroid Build Coastguard Worker 	struct sctp_authkey_event sn_authkey_event;
423*49cdfc7eSAndroid Build Coastguard Worker 	struct sctp_sender_dry_event sn_sender_dry_event;
424*49cdfc7eSAndroid Build Coastguard Worker };
425*49cdfc7eSAndroid Build Coastguard Worker 
426*49cdfc7eSAndroid Build Coastguard Worker /* Section 5.3.1
427*49cdfc7eSAndroid Build Coastguard Worker  * All standard values for sn_type flags are greater than 2^15.
428*49cdfc7eSAndroid Build Coastguard Worker  * Values from 2^15 and down are reserved.
429*49cdfc7eSAndroid Build Coastguard Worker  */
430*49cdfc7eSAndroid Build Coastguard Worker 
431*49cdfc7eSAndroid Build Coastguard Worker enum sctp_sn_type {
432*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_SN_TYPE_BASE     = (1<<15),
433*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_ASSOC_CHANGE,
434*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_ASSOC_CHANGE SCTP_ASSOC_CHANGE
435*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_PEER_ADDR_CHANGE,
436*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_PEER_ADDR_CHANGE SCTP_PEER_ADDR_CHANGE
437*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_SEND_FAILED,
438*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_SEND_FAILED SCTP_SEND_FAILED
439*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_REMOTE_ERROR,
440*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_REMOTE_ERROR SCTP_REMOTE_ERROR
441*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_SHUTDOWN_EVENT,
442*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_SHUTDOWN_EVENT SCTP_SHUTDOWN_EVENT
443*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_PARTIAL_DELIVERY_EVENT,
444*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_PARTIAL_DELIVERY_EVENT SCTP_PARTIAL_DELIVERY_EVENT
445*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_ADAPTATION_INDICATION,
446*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_ADAPTATION_INDICATION SCTP_ADAPTATION_INDICATION
447*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_AUTHENTICATION_INDICATION,
448*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_AUTHENTICATION_INDICATION SCTP_AUTHENTICATION_INDICATION
449*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_SENDER_DRY_EVENT,
450*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_SENDER_DRY_EVENT SCTP_SENDER_DRY_EVENT
451*49cdfc7eSAndroid Build Coastguard Worker };
452*49cdfc7eSAndroid Build Coastguard Worker 
453*49cdfc7eSAndroid Build Coastguard Worker /* Notification error codes used to fill up the error fields in some
454*49cdfc7eSAndroid Build Coastguard Worker  * notifications.
455*49cdfc7eSAndroid Build Coastguard Worker  * SCTP_PEER_ADDRESS_CHAGE 	: spc_error
456*49cdfc7eSAndroid Build Coastguard Worker  * SCTP_ASSOC_CHANGE		: sac_error
457*49cdfc7eSAndroid Build Coastguard Worker  * These names should be potentially included in the draft 04 of the SCTP
458*49cdfc7eSAndroid Build Coastguard Worker  * sockets API specification.
459*49cdfc7eSAndroid Build Coastguard Worker  */
460*49cdfc7eSAndroid Build Coastguard Worker typedef enum sctp_sn_error {
461*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_FAILED_THRESHOLD,
462*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_RECEIVED_SACK,
463*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_HEARTBEAT_SUCCESS,
464*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_RESPONSE_TO_USER_REQ,
465*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_INTERNAL_ERROR,
466*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_SHUTDOWN_GUARD_EXPIRES,
467*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_PEER_FAULTY,
468*49cdfc7eSAndroid Build Coastguard Worker } sctp_sn_error_t;
469*49cdfc7eSAndroid Build Coastguard Worker 
470*49cdfc7eSAndroid Build Coastguard Worker /*
471*49cdfc7eSAndroid Build Coastguard Worker  * 7.1.1 Retransmission Timeout Parameters (SCTP_RTOINFO)
472*49cdfc7eSAndroid Build Coastguard Worker  *
473*49cdfc7eSAndroid Build Coastguard Worker  *   The protocol parameters used to initialize and bound retransmission
474*49cdfc7eSAndroid Build Coastguard Worker  *   timeout (RTO) are tunable.  See [SCTP] for more information on how
475*49cdfc7eSAndroid Build Coastguard Worker  *   these parameters are used in RTO calculation.
476*49cdfc7eSAndroid Build Coastguard Worker  */
477*49cdfc7eSAndroid Build Coastguard Worker struct sctp_rtoinfo {
478*49cdfc7eSAndroid Build Coastguard Worker 	sctp_assoc_t	srto_assoc_id;
479*49cdfc7eSAndroid Build Coastguard Worker 	__u32		srto_initial;
480*49cdfc7eSAndroid Build Coastguard Worker 	__u32		srto_max;
481*49cdfc7eSAndroid Build Coastguard Worker 	__u32		srto_min;
482*49cdfc7eSAndroid Build Coastguard Worker };
483*49cdfc7eSAndroid Build Coastguard Worker 
484*49cdfc7eSAndroid Build Coastguard Worker /*
485*49cdfc7eSAndroid Build Coastguard Worker  * 7.1.2 Association Parameters (SCTP_ASSOCINFO)
486*49cdfc7eSAndroid Build Coastguard Worker  *
487*49cdfc7eSAndroid Build Coastguard Worker  *   This option is used to both examine and set various association and
488*49cdfc7eSAndroid Build Coastguard Worker  *   endpoint parameters.
489*49cdfc7eSAndroid Build Coastguard Worker  */
490*49cdfc7eSAndroid Build Coastguard Worker struct sctp_assocparams {
491*49cdfc7eSAndroid Build Coastguard Worker 	sctp_assoc_t	sasoc_assoc_id;
492*49cdfc7eSAndroid Build Coastguard Worker 	__u16		sasoc_asocmaxrxt;
493*49cdfc7eSAndroid Build Coastguard Worker 	__u16		sasoc_number_peer_destinations;
494*49cdfc7eSAndroid Build Coastguard Worker 	__u32		sasoc_peer_rwnd;
495*49cdfc7eSAndroid Build Coastguard Worker 	__u32		sasoc_local_rwnd;
496*49cdfc7eSAndroid Build Coastguard Worker 	__u32		sasoc_cookie_life;
497*49cdfc7eSAndroid Build Coastguard Worker };
498*49cdfc7eSAndroid Build Coastguard Worker 
499*49cdfc7eSAndroid Build Coastguard Worker /*
500*49cdfc7eSAndroid Build Coastguard Worker  * 7.1.9 Set Peer Primary Address (SCTP_SET_PEER_PRIMARY_ADDR)
501*49cdfc7eSAndroid Build Coastguard Worker  *
502*49cdfc7eSAndroid Build Coastguard Worker  *  Requests that the peer mark the enclosed address as the association
503*49cdfc7eSAndroid Build Coastguard Worker  *  primary. The enclosed address must be one of the association's
504*49cdfc7eSAndroid Build Coastguard Worker  *  locally bound addresses. The following structure is used to make a
505*49cdfc7eSAndroid Build Coastguard Worker  *   set primary request:
506*49cdfc7eSAndroid Build Coastguard Worker  */
507*49cdfc7eSAndroid Build Coastguard Worker struct sctp_setpeerprim {
508*49cdfc7eSAndroid Build Coastguard Worker 	sctp_assoc_t            sspp_assoc_id;
509*49cdfc7eSAndroid Build Coastguard Worker 	struct sockaddr_storage sspp_addr;
510*49cdfc7eSAndroid Build Coastguard Worker } __attribute__((packed, aligned(4)));
511*49cdfc7eSAndroid Build Coastguard Worker 
512*49cdfc7eSAndroid Build Coastguard Worker /*
513*49cdfc7eSAndroid Build Coastguard Worker  * 7.1.10 Set Primary Address (SCTP_PRIMARY_ADDR)
514*49cdfc7eSAndroid Build Coastguard Worker  *
515*49cdfc7eSAndroid Build Coastguard Worker  *  Requests that the local SCTP stack use the enclosed peer address as
516*49cdfc7eSAndroid Build Coastguard Worker  *  the association primary. The enclosed address must be one of the
517*49cdfc7eSAndroid Build Coastguard Worker  *  association peer's addresses. The following structure is used to
518*49cdfc7eSAndroid Build Coastguard Worker  *  make a set peer primary request:
519*49cdfc7eSAndroid Build Coastguard Worker  */
520*49cdfc7eSAndroid Build Coastguard Worker struct sctp_setprim {
521*49cdfc7eSAndroid Build Coastguard Worker 	sctp_assoc_t            ssp_assoc_id;
522*49cdfc7eSAndroid Build Coastguard Worker 	struct sockaddr_storage ssp_addr;
523*49cdfc7eSAndroid Build Coastguard Worker } __attribute__((packed, aligned(4)));
524*49cdfc7eSAndroid Build Coastguard Worker 
525*49cdfc7eSAndroid Build Coastguard Worker /* For backward compatibility use, define the old name too */
526*49cdfc7eSAndroid Build Coastguard Worker #define sctp_prim sctp_setprim
527*49cdfc7eSAndroid Build Coastguard Worker 
528*49cdfc7eSAndroid Build Coastguard Worker /*
529*49cdfc7eSAndroid Build Coastguard Worker  * 7.1.11 Set Adaptation Layer Indicator (SCTP_ADAPTATION_LAYER)
530*49cdfc7eSAndroid Build Coastguard Worker  *
531*49cdfc7eSAndroid Build Coastguard Worker  * Requests that the local endpoint set the specified Adaptation Layer
532*49cdfc7eSAndroid Build Coastguard Worker  * Indication parameter for all future INIT and INIT-ACK exchanges.
533*49cdfc7eSAndroid Build Coastguard Worker  */
534*49cdfc7eSAndroid Build Coastguard Worker struct sctp_setadaptation {
535*49cdfc7eSAndroid Build Coastguard Worker 	__u32	ssb_adaptation_ind;
536*49cdfc7eSAndroid Build Coastguard Worker };
537*49cdfc7eSAndroid Build Coastguard Worker 
538*49cdfc7eSAndroid Build Coastguard Worker /*
539*49cdfc7eSAndroid Build Coastguard Worker  * 7.1.13 Peer Address Parameters  (SCTP_PEER_ADDR_PARAMS)
540*49cdfc7eSAndroid Build Coastguard Worker  *
541*49cdfc7eSAndroid Build Coastguard Worker  *   Applications can enable or disable heartbeats for any peer address
542*49cdfc7eSAndroid Build Coastguard Worker  *   of an association, modify an address's heartbeat interval, force a
543*49cdfc7eSAndroid Build Coastguard Worker  *   heartbeat to be sent immediately, and adjust the address's maximum
544*49cdfc7eSAndroid Build Coastguard Worker  *   number of retransmissions sent before an address is considered
545*49cdfc7eSAndroid Build Coastguard Worker  *   unreachable. The following structure is used to access and modify an
546*49cdfc7eSAndroid Build Coastguard Worker  *   address's parameters:
547*49cdfc7eSAndroid Build Coastguard Worker  */
548*49cdfc7eSAndroid Build Coastguard Worker enum  sctp_spp_flags {
549*49cdfc7eSAndroid Build Coastguard Worker 	SPP_HB_ENABLE = 1<<0,		/*Enable heartbeats*/
550*49cdfc7eSAndroid Build Coastguard Worker 	SPP_HB_DISABLE = 1<<1,		/*Disable heartbeats*/
551*49cdfc7eSAndroid Build Coastguard Worker 	SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE,
552*49cdfc7eSAndroid Build Coastguard Worker 	SPP_HB_DEMAND = 1<<2,		/*Send heartbeat immediately*/
553*49cdfc7eSAndroid Build Coastguard Worker 	SPP_PMTUD_ENABLE = 1<<3,	/*Enable PMTU discovery*/
554*49cdfc7eSAndroid Build Coastguard Worker 	SPP_PMTUD_DISABLE = 1<<4,	/*Disable PMTU discovery*/
555*49cdfc7eSAndroid Build Coastguard Worker 	SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE,
556*49cdfc7eSAndroid Build Coastguard Worker 	SPP_SACKDELAY_ENABLE = 1<<5,	/*Enable SACK*/
557*49cdfc7eSAndroid Build Coastguard Worker 	SPP_SACKDELAY_DISABLE = 1<<6,	/*Disable SACK*/
558*49cdfc7eSAndroid Build Coastguard Worker 	SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE,
559*49cdfc7eSAndroid Build Coastguard Worker 	SPP_HB_TIME_IS_ZERO = 1<<7,	/* Set HB delay to 0 */
560*49cdfc7eSAndroid Build Coastguard Worker };
561*49cdfc7eSAndroid Build Coastguard Worker 
562*49cdfc7eSAndroid Build Coastguard Worker struct sctp_paddrparams {
563*49cdfc7eSAndroid Build Coastguard Worker 	sctp_assoc_t		spp_assoc_id;
564*49cdfc7eSAndroid Build Coastguard Worker 	struct sockaddr_storage	spp_address;
565*49cdfc7eSAndroid Build Coastguard Worker 	__u32			spp_hbinterval;
566*49cdfc7eSAndroid Build Coastguard Worker 	__u16			spp_pathmaxrxt;
567*49cdfc7eSAndroid Build Coastguard Worker 	__u32			spp_pathmtu;
568*49cdfc7eSAndroid Build Coastguard Worker 	__u32			spp_sackdelay;
569*49cdfc7eSAndroid Build Coastguard Worker 	__u32			spp_flags;
570*49cdfc7eSAndroid Build Coastguard Worker } __attribute__((packed, aligned(4)));
571*49cdfc7eSAndroid Build Coastguard Worker 
572*49cdfc7eSAndroid Build Coastguard Worker /*
573*49cdfc7eSAndroid Build Coastguard Worker  * 7.1.18.  Add a chunk that must be authenticated (SCTP_AUTH_CHUNK)
574*49cdfc7eSAndroid Build Coastguard Worker  *
575*49cdfc7eSAndroid Build Coastguard Worker  * This set option adds a chunk type that the user is requesting to be
576*49cdfc7eSAndroid Build Coastguard Worker  * received only in an authenticated way.  Changes to the list of chunks
577*49cdfc7eSAndroid Build Coastguard Worker  * will only effect future associations on the socket.
578*49cdfc7eSAndroid Build Coastguard Worker  */
579*49cdfc7eSAndroid Build Coastguard Worker struct sctp_authchunk {
580*49cdfc7eSAndroid Build Coastguard Worker 	__u8		sauth_chunk;
581*49cdfc7eSAndroid Build Coastguard Worker };
582*49cdfc7eSAndroid Build Coastguard Worker 
583*49cdfc7eSAndroid Build Coastguard Worker /*
584*49cdfc7eSAndroid Build Coastguard Worker  * 7.1.19.  Get or set the list of supported HMAC Identifiers (SCTP_HMAC_IDENT)
585*49cdfc7eSAndroid Build Coastguard Worker  *
586*49cdfc7eSAndroid Build Coastguard Worker  * This option gets or sets the list of HMAC algorithms that the local
587*49cdfc7eSAndroid Build Coastguard Worker  * endpoint requires the peer to use.
588*49cdfc7eSAndroid Build Coastguard Worker */
589*49cdfc7eSAndroid Build Coastguard Worker 
590*49cdfc7eSAndroid Build Coastguard Worker enum {
591*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_AUTH_HMAC_ID_SHA1 = 1,
592*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_AUTH_HMAC_ID_SHA256 = 3,
593*49cdfc7eSAndroid Build Coastguard Worker };
594*49cdfc7eSAndroid Build Coastguard Worker 
595*49cdfc7eSAndroid Build Coastguard Worker struct sctp_hmacalgo {
596*49cdfc7eSAndroid Build Coastguard Worker 	__u32		shmac_number_of_idents;
597*49cdfc7eSAndroid Build Coastguard Worker 	__u16		shmac_idents[];
598*49cdfc7eSAndroid Build Coastguard Worker };
599*49cdfc7eSAndroid Build Coastguard Worker 
600*49cdfc7eSAndroid Build Coastguard Worker /*
601*49cdfc7eSAndroid Build Coastguard Worker  * 7.1.20.  Set a shared key (SCTP_AUTH_KEY)
602*49cdfc7eSAndroid Build Coastguard Worker  *
603*49cdfc7eSAndroid Build Coastguard Worker  * This option will set a shared secret key which is used to build an
604*49cdfc7eSAndroid Build Coastguard Worker  * association shared key.
605*49cdfc7eSAndroid Build Coastguard Worker  */
606*49cdfc7eSAndroid Build Coastguard Worker struct sctp_authkey {
607*49cdfc7eSAndroid Build Coastguard Worker 	sctp_assoc_t	sca_assoc_id;
608*49cdfc7eSAndroid Build Coastguard Worker 	__u16		sca_keynumber;
609*49cdfc7eSAndroid Build Coastguard Worker 	__u16		sca_keylength;
610*49cdfc7eSAndroid Build Coastguard Worker 	__u8		sca_key[];
611*49cdfc7eSAndroid Build Coastguard Worker };
612*49cdfc7eSAndroid Build Coastguard Worker 
613*49cdfc7eSAndroid Build Coastguard Worker /*
614*49cdfc7eSAndroid Build Coastguard Worker  * 7.1.21.  Get or set the active shared key (SCTP_AUTH_ACTIVE_KEY)
615*49cdfc7eSAndroid Build Coastguard Worker  *
616*49cdfc7eSAndroid Build Coastguard Worker  * This option will get or set the active shared key to be used to build
617*49cdfc7eSAndroid Build Coastguard Worker  * the association shared key.
618*49cdfc7eSAndroid Build Coastguard Worker  */
619*49cdfc7eSAndroid Build Coastguard Worker 
620*49cdfc7eSAndroid Build Coastguard Worker struct sctp_authkeyid {
621*49cdfc7eSAndroid Build Coastguard Worker 	sctp_assoc_t	scact_assoc_id;
622*49cdfc7eSAndroid Build Coastguard Worker 	__u16		scact_keynumber;
623*49cdfc7eSAndroid Build Coastguard Worker };
624*49cdfc7eSAndroid Build Coastguard Worker 
625*49cdfc7eSAndroid Build Coastguard Worker 
626*49cdfc7eSAndroid Build Coastguard Worker /*
627*49cdfc7eSAndroid Build Coastguard Worker  * 7.1.23.  Get or set delayed ack timer (SCTP_DELAYED_SACK)
628*49cdfc7eSAndroid Build Coastguard Worker  *
629*49cdfc7eSAndroid Build Coastguard Worker  * This option will effect the way delayed acks are performed.  This
630*49cdfc7eSAndroid Build Coastguard Worker  * option allows you to get or set the delayed ack time, in
631*49cdfc7eSAndroid Build Coastguard Worker  * milliseconds.  It also allows changing the delayed ack frequency.
632*49cdfc7eSAndroid Build Coastguard Worker  * Changing the frequency to 1 disables the delayed sack algorithm.  If
633*49cdfc7eSAndroid Build Coastguard Worker  * the assoc_id is 0, then this sets or gets the endpoints default
634*49cdfc7eSAndroid Build Coastguard Worker  * values.  If the assoc_id field is non-zero, then the set or get
635*49cdfc7eSAndroid Build Coastguard Worker  * effects the specified association for the one to many model (the
636*49cdfc7eSAndroid Build Coastguard Worker  * assoc_id field is ignored by the one to one model).  Note that if
637*49cdfc7eSAndroid Build Coastguard Worker  * sack_delay or sack_freq are 0 when setting this option, then the
638*49cdfc7eSAndroid Build Coastguard Worker  * current values will remain unchanged.
639*49cdfc7eSAndroid Build Coastguard Worker  */
640*49cdfc7eSAndroid Build Coastguard Worker struct sctp_sack_info {
641*49cdfc7eSAndroid Build Coastguard Worker 	sctp_assoc_t	sack_assoc_id;
642*49cdfc7eSAndroid Build Coastguard Worker 	uint32_t	sack_delay;
643*49cdfc7eSAndroid Build Coastguard Worker 	uint32_t	sack_freq;
644*49cdfc7eSAndroid Build Coastguard Worker };
645*49cdfc7eSAndroid Build Coastguard Worker 
646*49cdfc7eSAndroid Build Coastguard Worker struct sctp_assoc_value {
647*49cdfc7eSAndroid Build Coastguard Worker     sctp_assoc_t            assoc_id;
648*49cdfc7eSAndroid Build Coastguard Worker     uint32_t                assoc_value;
649*49cdfc7eSAndroid Build Coastguard Worker };
650*49cdfc7eSAndroid Build Coastguard Worker 
651*49cdfc7eSAndroid Build Coastguard Worker /*
652*49cdfc7eSAndroid Build Coastguard Worker  * 7.2.2 Peer Address Information
653*49cdfc7eSAndroid Build Coastguard Worker  *
654*49cdfc7eSAndroid Build Coastguard Worker  *   Applications can retrieve information about a specific peer address
655*49cdfc7eSAndroid Build Coastguard Worker  *   of an association, including its reachability state, congestion
656*49cdfc7eSAndroid Build Coastguard Worker  *   window, and retransmission timer values.  This information is
657*49cdfc7eSAndroid Build Coastguard Worker  *   read-only. The following structure is used to access this
658*49cdfc7eSAndroid Build Coastguard Worker  *   information:
659*49cdfc7eSAndroid Build Coastguard Worker  */
660*49cdfc7eSAndroid Build Coastguard Worker struct sctp_paddrinfo {
661*49cdfc7eSAndroid Build Coastguard Worker 	sctp_assoc_t		spinfo_assoc_id;
662*49cdfc7eSAndroid Build Coastguard Worker 	struct sockaddr_storage	spinfo_address;
663*49cdfc7eSAndroid Build Coastguard Worker 	__s32			spinfo_state;
664*49cdfc7eSAndroid Build Coastguard Worker 	__u32			spinfo_cwnd;
665*49cdfc7eSAndroid Build Coastguard Worker 	__u32			spinfo_srtt;
666*49cdfc7eSAndroid Build Coastguard Worker 	__u32			spinfo_rto;
667*49cdfc7eSAndroid Build Coastguard Worker 	__u32			spinfo_mtu;
668*49cdfc7eSAndroid Build Coastguard Worker } __attribute__((packed, aligned(4)));
669*49cdfc7eSAndroid Build Coastguard Worker 
670*49cdfc7eSAndroid Build Coastguard Worker /* Peer addresses's state. */
671*49cdfc7eSAndroid Build Coastguard Worker /* UNKNOWN: Peer address passed by the upper layer in sendmsg or connect[x]
672*49cdfc7eSAndroid Build Coastguard Worker  * calls.
673*49cdfc7eSAndroid Build Coastguard Worker  * UNCONFIRMED: Peer address received in INIT/INIT-ACK address parameters.
674*49cdfc7eSAndroid Build Coastguard Worker  *              Not yet confirmed by a heartbeat and not available for data
675*49cdfc7eSAndroid Build Coastguard Worker  *		transfers.
676*49cdfc7eSAndroid Build Coastguard Worker  * ACTIVE : Peer address confirmed, active and available for data transfers.
677*49cdfc7eSAndroid Build Coastguard Worker  * INACTIVE: Peer address inactive and not available for data transfers.
678*49cdfc7eSAndroid Build Coastguard Worker  */
679*49cdfc7eSAndroid Build Coastguard Worker enum sctp_spinfo_state {
680*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_INACTIVE,
681*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_PF,
682*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_ACTIVE,
683*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_UNCONFIRMED,
684*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_UNKNOWN = 0xffff
685*49cdfc7eSAndroid Build Coastguard Worker };
686*49cdfc7eSAndroid Build Coastguard Worker 
687*49cdfc7eSAndroid Build Coastguard Worker /*
688*49cdfc7eSAndroid Build Coastguard Worker  * 7.2.1 Association Status (SCTP_STATUS)
689*49cdfc7eSAndroid Build Coastguard Worker  *
690*49cdfc7eSAndroid Build Coastguard Worker  *   Applications can retrieve current status information about an
691*49cdfc7eSAndroid Build Coastguard Worker  *   association, including association state, peer receiver window size,
692*49cdfc7eSAndroid Build Coastguard Worker  *   number of unacked data chunks, and number of data chunks pending
693*49cdfc7eSAndroid Build Coastguard Worker  *   receipt.  This information is read-only.  The following structure is
694*49cdfc7eSAndroid Build Coastguard Worker  *   used to access this information:
695*49cdfc7eSAndroid Build Coastguard Worker  */
696*49cdfc7eSAndroid Build Coastguard Worker struct sctp_status {
697*49cdfc7eSAndroid Build Coastguard Worker 	sctp_assoc_t		sstat_assoc_id;
698*49cdfc7eSAndroid Build Coastguard Worker 	__s32			sstat_state;
699*49cdfc7eSAndroid Build Coastguard Worker 	__u32			sstat_rwnd;
700*49cdfc7eSAndroid Build Coastguard Worker 	__u16			sstat_unackdata;
701*49cdfc7eSAndroid Build Coastguard Worker 	__u16			sstat_penddata;
702*49cdfc7eSAndroid Build Coastguard Worker 	__u16			sstat_instrms;
703*49cdfc7eSAndroid Build Coastguard Worker 	__u16			sstat_outstrms;
704*49cdfc7eSAndroid Build Coastguard Worker 	__u32			sstat_fragmentation_point;
705*49cdfc7eSAndroid Build Coastguard Worker 	struct sctp_paddrinfo	sstat_primary;
706*49cdfc7eSAndroid Build Coastguard Worker };
707*49cdfc7eSAndroid Build Coastguard Worker 
708*49cdfc7eSAndroid Build Coastguard Worker /*
709*49cdfc7eSAndroid Build Coastguard Worker  * 7.2.3.  Get the list of chunks the peer requires to be authenticated
710*49cdfc7eSAndroid Build Coastguard Worker  *         (SCTP_PEER_AUTH_CHUNKS)
711*49cdfc7eSAndroid Build Coastguard Worker  *
712*49cdfc7eSAndroid Build Coastguard Worker  * This option gets a list of chunks for a specified association that
713*49cdfc7eSAndroid Build Coastguard Worker  * the peer requires to be received authenticated only.
714*49cdfc7eSAndroid Build Coastguard Worker  */
715*49cdfc7eSAndroid Build Coastguard Worker struct sctp_authchunks {
716*49cdfc7eSAndroid Build Coastguard Worker 	sctp_assoc_t	gauth_assoc_id;
717*49cdfc7eSAndroid Build Coastguard Worker 	__u32		gauth_number_of_chunks;
718*49cdfc7eSAndroid Build Coastguard Worker 	uint8_t		gauth_chunks[];
719*49cdfc7eSAndroid Build Coastguard Worker };
720*49cdfc7eSAndroid Build Coastguard Worker /* The broken spelling has been released already,
721*49cdfc7eSAndroid Build Coastguard Worker  * so don't break anyone, now that it's fixed.
722*49cdfc7eSAndroid Build Coastguard Worker  */
723*49cdfc7eSAndroid Build Coastguard Worker #define guth_number_of_chunks gauth_number_of_chunks
724*49cdfc7eSAndroid Build Coastguard Worker 
725*49cdfc7eSAndroid Build Coastguard Worker /* Association states.  */
726*49cdfc7eSAndroid Build Coastguard Worker enum sctp_sstat_state {
727*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_EMPTY                = 0,
728*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_CLOSED               = 1,
729*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_COOKIE_WAIT          = 2,
730*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_COOKIE_ECHOED        = 3,
731*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_ESTABLISHED          = 4,
732*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_SHUTDOWN_PENDING     = 5,
733*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_SHUTDOWN_SENT        = 6,
734*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_SHUTDOWN_RECEIVED    = 7,
735*49cdfc7eSAndroid Build Coastguard Worker 	SCTP_SHUTDOWN_ACK_SENT    = 8,
736*49cdfc7eSAndroid Build Coastguard Worker };
737*49cdfc7eSAndroid Build Coastguard Worker 
738*49cdfc7eSAndroid Build Coastguard Worker /*
739*49cdfc7eSAndroid Build Coastguard Worker  * 8.3, 8.5 get all peer/local addresses in an association.
740*49cdfc7eSAndroid Build Coastguard Worker  * This parameter struct is used by SCTP_GET_PEER_ADDRS and
741*49cdfc7eSAndroid Build Coastguard Worker  * SCTP_GET_LOCAL_ADDRS socket options used internally to implement
742*49cdfc7eSAndroid Build Coastguard Worker  * sctp_getpaddrs() and sctp_getladdrs() API.
743*49cdfc7eSAndroid Build Coastguard Worker  */
744*49cdfc7eSAndroid Build Coastguard Worker struct sctp_getaddrs_old {
745*49cdfc7eSAndroid Build Coastguard Worker 	sctp_assoc_t            assoc_id;
746*49cdfc7eSAndroid Build Coastguard Worker 	int			addr_num;
747*49cdfc7eSAndroid Build Coastguard Worker 	struct sockaddr		*addrs;
748*49cdfc7eSAndroid Build Coastguard Worker };
749*49cdfc7eSAndroid Build Coastguard Worker struct sctp_getaddrs {
750*49cdfc7eSAndroid Build Coastguard Worker 	sctp_assoc_t		assoc_id; /*input*/
751*49cdfc7eSAndroid Build Coastguard Worker 	__u32			addr_num; /*output*/
752*49cdfc7eSAndroid Build Coastguard Worker 	__u8			addrs[0]; /*output, variable size*/
753*49cdfc7eSAndroid Build Coastguard Worker };
754*49cdfc7eSAndroid Build Coastguard Worker 
755*49cdfc7eSAndroid Build Coastguard Worker /* A socket user request obtained via SCTP_GET_ASSOC_STATS that retrieves
756*49cdfc7eSAndroid Build Coastguard Worker  * association stats. All stats are counts except sas_maxrto and
757*49cdfc7eSAndroid Build Coastguard Worker  * sas_obs_rto_ipaddr. maxrto is the max observed rto + transport since
758*49cdfc7eSAndroid Build Coastguard Worker  * the last call. Will return 0 when did not change since last call
759*49cdfc7eSAndroid Build Coastguard Worker  */
760*49cdfc7eSAndroid Build Coastguard Worker struct sctp_assoc_stats {
761*49cdfc7eSAndroid Build Coastguard Worker 	sctp_assoc_t	sas_assoc_id;    /* Input */
762*49cdfc7eSAndroid Build Coastguard Worker 					 /* Transport of the observed max RTO spike */
763*49cdfc7eSAndroid Build Coastguard Worker 	struct sockaddr_storage sas_obs_rto_ipaddr;
764*49cdfc7eSAndroid Build Coastguard Worker 	__u64		sas_maxrto;      /* Maximum Observed RTO for period */
765*49cdfc7eSAndroid Build Coastguard Worker 	__u64		sas_isacks;	 /* SACKs received */
766*49cdfc7eSAndroid Build Coastguard Worker 	__u64		sas_osacks;	 /* SACKs sent */
767*49cdfc7eSAndroid Build Coastguard Worker 	__u64		sas_opackets;	 /* Packets sent */
768*49cdfc7eSAndroid Build Coastguard Worker 	__u64		sas_ipackets;	 /* Packets received */
769*49cdfc7eSAndroid Build Coastguard Worker 	__u64		sas_rtxchunks;   /* Retransmitted Chunks */
770*49cdfc7eSAndroid Build Coastguard Worker 	__u64		sas_outofseqtsns;/* TSN received > next expected */
771*49cdfc7eSAndroid Build Coastguard Worker 	__u64		sas_idupchunks;  /* Dups received (ordered+unordered) */
772*49cdfc7eSAndroid Build Coastguard Worker 	__u64		sas_gapcnt;      /* Gap Acknowledgements Received */
773*49cdfc7eSAndroid Build Coastguard Worker 	__u64		sas_ouodchunks;  /* Unordered data chunks sent */
774*49cdfc7eSAndroid Build Coastguard Worker 	__u64		sas_iuodchunks;  /* Unordered data chunks received */
775*49cdfc7eSAndroid Build Coastguard Worker 	__u64		sas_oodchunks;	 /* Ordered data chunks sent */
776*49cdfc7eSAndroid Build Coastguard Worker 	__u64		sas_iodchunks;	 /* Ordered data chunks received */
777*49cdfc7eSAndroid Build Coastguard Worker 	__u64		sas_octrlchunks; /* Control chunks sent */
778*49cdfc7eSAndroid Build Coastguard Worker 	__u64		sas_ictrlchunks; /* Control chunks received */
779*49cdfc7eSAndroid Build Coastguard Worker };
780*49cdfc7eSAndroid Build Coastguard Worker 
781*49cdfc7eSAndroid Build Coastguard Worker /* These are bit fields for msghdr->msg_flags.  See section 5.1.  */
782*49cdfc7eSAndroid Build Coastguard Worker /* On user space Linux, these live in <bits/socket.h> as an enum.  */
783*49cdfc7eSAndroid Build Coastguard Worker enum sctp_msg_flags {
784*49cdfc7eSAndroid Build Coastguard Worker 	MSG_NOTIFICATION = 0x8000,
785*49cdfc7eSAndroid Build Coastguard Worker #define MSG_NOTIFICATION MSG_NOTIFICATION
786*49cdfc7eSAndroid Build Coastguard Worker };
787*49cdfc7eSAndroid Build Coastguard Worker 
788*49cdfc7eSAndroid Build Coastguard Worker /*
789*49cdfc7eSAndroid Build Coastguard Worker  * 8.1 sctp_bindx()
790*49cdfc7eSAndroid Build Coastguard Worker  *
791*49cdfc7eSAndroid Build Coastguard Worker  * The flags parameter is formed from the bitwise OR of zero or more of the
792*49cdfc7eSAndroid Build Coastguard Worker  * following currently defined flags:
793*49cdfc7eSAndroid Build Coastguard Worker  */
794*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_BINDX_ADD_ADDR 0x01
795*49cdfc7eSAndroid Build Coastguard Worker #define SCTP_BINDX_REM_ADDR 0x02
796*49cdfc7eSAndroid Build Coastguard Worker 
797*49cdfc7eSAndroid Build Coastguard Worker /* This is the structure that is passed as an argument(optval) to
798*49cdfc7eSAndroid Build Coastguard Worker  * getsockopt(SCTP_SOCKOPT_PEELOFF).
799*49cdfc7eSAndroid Build Coastguard Worker  */
800*49cdfc7eSAndroid Build Coastguard Worker typedef struct {
801*49cdfc7eSAndroid Build Coastguard Worker 	sctp_assoc_t associd;
802*49cdfc7eSAndroid Build Coastguard Worker 	int sd;
803*49cdfc7eSAndroid Build Coastguard Worker } sctp_peeloff_arg_t;
804*49cdfc7eSAndroid Build Coastguard Worker 
805*49cdfc7eSAndroid Build Coastguard Worker 
806*49cdfc7eSAndroid Build Coastguard Worker int sctp_bindx(int sd, struct sockaddr *addrs, int addrcnt, int flags);
807*49cdfc7eSAndroid Build Coastguard Worker 
808*49cdfc7eSAndroid Build Coastguard Worker int sctp_connectx(int sd, struct sockaddr *addrs, int addrcnt,
809*49cdfc7eSAndroid Build Coastguard Worker 		  sctp_assoc_t *id);
810*49cdfc7eSAndroid Build Coastguard Worker 
811*49cdfc7eSAndroid Build Coastguard Worker int sctp_peeloff(int sd, sctp_assoc_t assoc_id);
812*49cdfc7eSAndroid Build Coastguard Worker 
813*49cdfc7eSAndroid Build Coastguard Worker /* Prototype for the library function sctp_opt_info defined in
814*49cdfc7eSAndroid Build Coastguard Worker  * API 7. Socket Options.
815*49cdfc7eSAndroid Build Coastguard Worker  */
816*49cdfc7eSAndroid Build Coastguard Worker int sctp_opt_info(int sd, sctp_assoc_t id, int opt, void *arg, socklen_t *size);
817*49cdfc7eSAndroid Build Coastguard Worker 
818*49cdfc7eSAndroid Build Coastguard Worker /* Get all peer address on a socket.  This is a new SCTP API
819*49cdfc7eSAndroid Build Coastguard Worker  * described in the section 8.3 of the Sockets API Extensions for SCTP.
820*49cdfc7eSAndroid Build Coastguard Worker  * This is implemented using the getsockopt() interface.
821*49cdfc7eSAndroid Build Coastguard Worker  */
822*49cdfc7eSAndroid Build Coastguard Worker int sctp_getpaddrs(int sd, sctp_assoc_t id, struct sockaddr **addrs);
823*49cdfc7eSAndroid Build Coastguard Worker 
824*49cdfc7eSAndroid Build Coastguard Worker /* Frees all resources allocated by sctp_getpaddrs().  This is a new SCTP API
825*49cdfc7eSAndroid Build Coastguard Worker  * described in the section 8.4 of the Sockets API Extensions for SCTP.
826*49cdfc7eSAndroid Build Coastguard Worker  */
827*49cdfc7eSAndroid Build Coastguard Worker int sctp_freepaddrs(struct sockaddr *addrs);
828*49cdfc7eSAndroid Build Coastguard Worker 
829*49cdfc7eSAndroid Build Coastguard Worker /* Get all locally bound address on a socket.  This is a new SCTP API
830*49cdfc7eSAndroid Build Coastguard Worker  * described in the section 8.5 of the Sockets API Extensions for SCTP.
831*49cdfc7eSAndroid Build Coastguard Worker  * This is implemented using the getsockopt() interface.
832*49cdfc7eSAndroid Build Coastguard Worker  */
833*49cdfc7eSAndroid Build Coastguard Worker int sctp_getladdrs(int sd, sctp_assoc_t id, struct sockaddr **addrs);
834*49cdfc7eSAndroid Build Coastguard Worker 
835*49cdfc7eSAndroid Build Coastguard Worker /* Frees all resources allocated by sctp_getladdrs().  This is a new SCTP API
836*49cdfc7eSAndroid Build Coastguard Worker  * described in the section 8.6 of the Sockets API Extensions for SCTP.
837*49cdfc7eSAndroid Build Coastguard Worker  */
838*49cdfc7eSAndroid Build Coastguard Worker int sctp_freeladdrs(struct sockaddr *addrs);
839*49cdfc7eSAndroid Build Coastguard Worker 
840*49cdfc7eSAndroid Build Coastguard Worker /* This library function assists the user with the advanced features
841*49cdfc7eSAndroid Build Coastguard Worker  * of SCTP.  This is a new SCTP API described in the section 8.7 of the
842*49cdfc7eSAndroid Build Coastguard Worker  * Sockets API Extensions for SCTP. This is implemented using the
843*49cdfc7eSAndroid Build Coastguard Worker  * sendmsg() interface.
844*49cdfc7eSAndroid Build Coastguard Worker  */
845*49cdfc7eSAndroid Build Coastguard Worker int sctp_sendmsg(int s, const void *msg, size_t len, struct sockaddr *to,
846*49cdfc7eSAndroid Build Coastguard Worker 		 socklen_t tolen, uint32_t ppid, uint32_t flags,
847*49cdfc7eSAndroid Build Coastguard Worker 		 uint16_t stream_no, uint32_t timetolive, uint32_t context);
848*49cdfc7eSAndroid Build Coastguard Worker 
849*49cdfc7eSAndroid Build Coastguard Worker /* This library function assist the user with sending a message without
850*49cdfc7eSAndroid Build Coastguard Worker  * dealing directly with the CMSG header.
851*49cdfc7eSAndroid Build Coastguard Worker  */
852*49cdfc7eSAndroid Build Coastguard Worker int sctp_send(int s, const void *msg, size_t len,
853*49cdfc7eSAndroid Build Coastguard Worker               const struct sctp_sndrcvinfo *sinfo, int flags);
854*49cdfc7eSAndroid Build Coastguard Worker 
855*49cdfc7eSAndroid Build Coastguard Worker /* This library function assists the user with the advanced features
856*49cdfc7eSAndroid Build Coastguard Worker  * of SCTP.  This is a new SCTP API described in the section 8.8 of the
857*49cdfc7eSAndroid Build Coastguard Worker  * Sockets API Extensions for SCTP. This is implemented using the
858*49cdfc7eSAndroid Build Coastguard Worker  * recvmsg() interface.
859*49cdfc7eSAndroid Build Coastguard Worker  */
860*49cdfc7eSAndroid Build Coastguard Worker int sctp_recvmsg(int s, void *msg, size_t len, struct sockaddr *from,
861*49cdfc7eSAndroid Build Coastguard Worker 		 socklen_t *fromlen, struct sctp_sndrcvinfo *sinfo,
862*49cdfc7eSAndroid Build Coastguard Worker 		 int *msg_flags);
863*49cdfc7eSAndroid Build Coastguard Worker 
864*49cdfc7eSAndroid Build Coastguard Worker /* Return the address length for an address family. */
865*49cdfc7eSAndroid Build Coastguard Worker int sctp_getaddrlen(sa_family_t family);
866*49cdfc7eSAndroid Build Coastguard Worker 
867*49cdfc7eSAndroid Build Coastguard Worker #ifdef __cplusplus
868*49cdfc7eSAndroid Build Coastguard Worker }
869*49cdfc7eSAndroid Build Coastguard Worker #endif
870*49cdfc7eSAndroid Build Coastguard Worker 
871*49cdfc7eSAndroid Build Coastguard Worker #endif /* __linux_sctp_h__ */
872