blob: 9a808efa11cb7328614d9fc575fa48231e0fc163 [file] [log] [blame]
Ben Cheng655a7c02013-10-16 16:09:24 -07001/****************************************************************************
2 ****************************************************************************
3 ***
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
9 ***
10 *** To edit the content of this header, modify the corresponding
11 *** source file (e.g. under external/kernel-headers/original/) then
12 *** run bionic/libc/kernel/tools/update_all.py
13 ***
14 *** Any manual change here will be lost the next time this script will
15 *** be run. You've been warned!
16 ***
17 ****************************************************************************
18 ****************************************************************************/
19#ifndef _UAPI_SCTP_H
20#define _UAPI_SCTP_H
21#include <linux/types.h>
22#include <linux/socket.h>
Ben Cheng655a7c02013-10-16 16:09:24 -070023typedef __s32 sctp_assoc_t;
Christopher Ferris24f97eb2019-05-20 12:58:13 -070024#define SCTP_FUTURE_ASSOC 0
25#define SCTP_CURRENT_ASSOC 1
26#define SCTP_ALL_ASSOC 2
Ben Cheng655a7c02013-10-16 16:09:24 -070027#define SCTP_RTOINFO 0
28#define SCTP_ASSOCINFO 1
29#define SCTP_INITMSG 2
Ben Cheng655a7c02013-10-16 16:09:24 -070030#define SCTP_NODELAY 3
31#define SCTP_AUTOCLOSE 4
32#define SCTP_SET_PEER_PRIMARY_ADDR 5
33#define SCTP_PRIMARY_ADDR 6
Ben Cheng655a7c02013-10-16 16:09:24 -070034#define SCTP_ADAPTATION_LAYER 7
35#define SCTP_DISABLE_FRAGMENTS 8
36#define SCTP_PEER_ADDR_PARAMS 9
37#define SCTP_DEFAULT_SEND_PARAM 10
Ben Cheng655a7c02013-10-16 16:09:24 -070038#define SCTP_EVENTS 11
39#define SCTP_I_WANT_MAPPED_V4_ADDR 12
40#define SCTP_MAXSEG 13
41#define SCTP_STATUS 14
Ben Cheng655a7c02013-10-16 16:09:24 -070042#define SCTP_GET_PEER_ADDR_INFO 15
43#define SCTP_DELAYED_ACK_TIME 16
44#define SCTP_DELAYED_ACK SCTP_DELAYED_ACK_TIME
45#define SCTP_DELAYED_SACK SCTP_DELAYED_ACK_TIME
Ben Cheng655a7c02013-10-16 16:09:24 -070046#define SCTP_CONTEXT 17
47#define SCTP_FRAGMENT_INTERLEAVE 18
48#define SCTP_PARTIAL_DELIVERY_POINT 19
49#define SCTP_MAX_BURST 20
Ben Cheng655a7c02013-10-16 16:09:24 -070050#define SCTP_AUTH_CHUNK 21
51#define SCTP_HMAC_IDENT 22
52#define SCTP_AUTH_KEY 23
53#define SCTP_AUTH_ACTIVE_KEY 24
Ben Cheng655a7c02013-10-16 16:09:24 -070054#define SCTP_AUTH_DELETE_KEY 25
55#define SCTP_PEER_AUTH_CHUNKS 26
56#define SCTP_LOCAL_AUTH_CHUNKS 27
57#define SCTP_GET_ASSOC_NUMBER 28
Ben Cheng655a7c02013-10-16 16:09:24 -070058#define SCTP_GET_ASSOC_ID_LIST 29
59#define SCTP_AUTO_ASCONF 30
60#define SCTP_PEER_ADDR_THLDS 31
Christopher Ferris82d75042015-01-26 10:57:07 -080061#define SCTP_RECVRCVINFO 32
Christopher Ferris82d75042015-01-26 10:57:07 -080062#define SCTP_RECVNXTINFO 33
63#define SCTP_DEFAULT_SNDINFO 34
Christopher Ferris76a1d452018-06-27 14:12:29 -070064#define SCTP_AUTH_DEACTIVATE_KEY 35
Christopher Ferris9ce28842018-10-25 12:11:39 -070065#define SCTP_REUSE_PORT 36
Christopher Ferris82d75042015-01-26 10:57:07 -080066#define SCTP_SOCKOPT_BINDX_ADD 100
Ben Cheng655a7c02013-10-16 16:09:24 -070067#define SCTP_SOCKOPT_BINDX_REM 101
68#define SCTP_SOCKOPT_PEELOFF 102
69#define SCTP_SOCKOPT_CONNECTX_OLD 107
70#define SCTP_GET_PEER_ADDRS 108
Ben Cheng655a7c02013-10-16 16:09:24 -070071#define SCTP_GET_LOCAL_ADDRS 109
72#define SCTP_SOCKOPT_CONNECTX 110
73#define SCTP_SOCKOPT_CONNECTX3 111
74#define SCTP_GET_ASSOC_STATS 112
Christopher Ferris49f525c2016-12-12 14:55:36 -080075#define SCTP_PR_SUPPORTED 113
Christopher Ferris49f525c2016-12-12 14:55:36 -080076#define SCTP_DEFAULT_PRINFO 114
77#define SCTP_PR_ASSOC_STATUS 115
Christopher Ferris525ce912017-07-26 13:12:53 -070078#define SCTP_PR_STREAM_STATUS 116
79#define SCTP_RECONFIG_SUPPORTED 117
80#define SCTP_ENABLE_STREAM_RESET 118
81#define SCTP_RESET_STREAMS 119
82#define SCTP_RESET_ASSOC 120
83#define SCTP_ADD_STREAMS 121
Christopher Ferris1308ad32017-11-14 17:32:13 -080084#define SCTP_SOCKOPT_PEELOFF_FLAGS 122
Christopher Ferris934ec942018-01-31 15:29:16 -080085#define SCTP_STREAM_SCHEDULER 123
86#define SCTP_STREAM_SCHEDULER_VALUE 124
Christopher Ferris76a1d452018-06-27 14:12:29 -070087#define SCTP_INTERLEAVING_SUPPORTED 125
88#define SCTP_SENDMSG_CONNECT 126
Christopher Ferrisd842e432019-03-07 10:21:59 -080089#define SCTP_EVENT 127
Christopher Ferris9584fa42019-12-09 15:36:13 -080090#define SCTP_ASCONF_SUPPORTED 128
91#define SCTP_AUTH_SUPPORTED 129
92#define SCTP_ECN_SUPPORTED 130
Christopher Ferris49f525c2016-12-12 14:55:36 -080093#define SCTP_PR_SCTP_NONE 0x0000
94#define SCTP_PR_SCTP_TTL 0x0010
Christopher Ferris49f525c2016-12-12 14:55:36 -080095#define SCTP_PR_SCTP_RTX 0x0020
96#define SCTP_PR_SCTP_PRIO 0x0030
97#define SCTP_PR_SCTP_MAX SCTP_PR_SCTP_PRIO
98#define SCTP_PR_SCTP_MASK 0x0030
Christopher Ferris49f525c2016-12-12 14:55:36 -080099#define __SCTP_PR_INDEX(x) ((x >> 4) - 1)
100#define SCTP_PR_INDEX(x) __SCTP_PR_INDEX(SCTP_PR_SCTP_ ##x)
101#define SCTP_PR_POLICY(x) ((x) & SCTP_PR_SCTP_MASK)
102#define SCTP_PR_SET_POLICY(flags,x) do { flags &= ~SCTP_PR_SCTP_MASK; flags |= x; } while(0)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800103#define SCTP_PR_TTL_ENABLED(x) (SCTP_PR_POLICY(x) == SCTP_PR_SCTP_TTL)
104#define SCTP_PR_RTX_ENABLED(x) (SCTP_PR_POLICY(x) == SCTP_PR_SCTP_RTX)
105#define SCTP_PR_PRIO_ENABLED(x) (SCTP_PR_POLICY(x) == SCTP_PR_SCTP_PRIO)
Christopher Ferris525ce912017-07-26 13:12:53 -0700106#define SCTP_ENABLE_RESET_STREAM_REQ 0x01
107#define SCTP_ENABLE_RESET_ASSOC_REQ 0x02
108#define SCTP_ENABLE_CHANGE_ASSOC_REQ 0x04
109#define SCTP_ENABLE_STRRESET_MASK 0x07
110#define SCTP_STREAM_RESET_INCOMING 0x01
111#define SCTP_STREAM_RESET_OUTGOING 0x02
Christopher Ferris82d75042015-01-26 10:57:07 -0800112enum sctp_msg_flags {
Tao Baod7db5942015-01-28 10:07:51 -0800113 MSG_NOTIFICATION = 0x8000,
Christopher Ferris82d75042015-01-26 10:57:07 -0800114#define MSG_NOTIFICATION MSG_NOTIFICATION
115};
Ben Cheng655a7c02013-10-16 16:09:24 -0700116struct sctp_initmsg {
Tao Baod7db5942015-01-28 10:07:51 -0800117 __u16 sinit_num_ostreams;
118 __u16 sinit_max_instreams;
119 __u16 sinit_max_attempts;
120 __u16 sinit_max_init_timeo;
Ben Cheng655a7c02013-10-16 16:09:24 -0700121};
122struct sctp_sndrcvinfo {
Tao Baod7db5942015-01-28 10:07:51 -0800123 __u16 sinfo_stream;
124 __u16 sinfo_ssn;
Tao Baod7db5942015-01-28 10:07:51 -0800125 __u16 sinfo_flags;
126 __u32 sinfo_ppid;
127 __u32 sinfo_context;
128 __u32 sinfo_timetolive;
Tao Baod7db5942015-01-28 10:07:51 -0800129 __u32 sinfo_tsn;
130 __u32 sinfo_cumtsn;
131 sctp_assoc_t sinfo_assoc_id;
Christopher Ferris82d75042015-01-26 10:57:07 -0800132};
Christopher Ferris82d75042015-01-26 10:57:07 -0800133struct sctp_sndinfo {
Tao Baod7db5942015-01-28 10:07:51 -0800134 __u16 snd_sid;
135 __u16 snd_flags;
136 __u32 snd_ppid;
Tao Baod7db5942015-01-28 10:07:51 -0800137 __u32 snd_context;
138 sctp_assoc_t snd_assoc_id;
Christopher Ferris82d75042015-01-26 10:57:07 -0800139};
140struct sctp_rcvinfo {
Tao Baod7db5942015-01-28 10:07:51 -0800141 __u16 rcv_sid;
142 __u16 rcv_ssn;
143 __u16 rcv_flags;
144 __u32 rcv_ppid;
Tao Baod7db5942015-01-28 10:07:51 -0800145 __u32 rcv_tsn;
146 __u32 rcv_cumtsn;
147 __u32 rcv_context;
148 sctp_assoc_t rcv_assoc_id;
Ben Cheng655a7c02013-10-16 16:09:24 -0700149};
Christopher Ferris82d75042015-01-26 10:57:07 -0800150struct sctp_nxtinfo {
Tao Baod7db5942015-01-28 10:07:51 -0800151 __u16 nxt_sid;
152 __u16 nxt_flags;
Tao Baod7db5942015-01-28 10:07:51 -0800153 __u32 nxt_ppid;
154 __u32 nxt_length;
155 sctp_assoc_t nxt_assoc_id;
Christopher Ferris82d75042015-01-26 10:57:07 -0800156};
Christopher Ferris76a1d452018-06-27 14:12:29 -0700157struct sctp_prinfo {
158 __u16 pr_policy;
159 __u32 pr_value;
160};
161struct sctp_authinfo {
162 __u16 auth_keynumber;
163};
Christopher Ferris82d75042015-01-26 10:57:07 -0800164enum sctp_sinfo_flags {
Tao Baod7db5942015-01-28 10:07:51 -0800165 SCTP_UNORDERED = (1 << 0),
166 SCTP_ADDR_OVER = (1 << 1),
167 SCTP_ABORT = (1 << 2),
Tao Baod7db5942015-01-28 10:07:51 -0800168 SCTP_SACK_IMMEDIATELY = (1 << 3),
Christopher Ferris76a1d452018-06-27 14:12:29 -0700169 SCTP_SENDALL = (1 << 6),
Christopher Ferris9ce28842018-10-25 12:11:39 -0700170 SCTP_PR_SCTP_ALL = (1 << 7),
Tao Baod7db5942015-01-28 10:07:51 -0800171 SCTP_NOTIFICATION = MSG_NOTIFICATION,
172 SCTP_EOF = MSG_FIN,
Ben Cheng655a7c02013-10-16 16:09:24 -0700173};
Ben Cheng655a7c02013-10-16 16:09:24 -0700174typedef union {
Tao Baod7db5942015-01-28 10:07:51 -0800175 __u8 raw;
176 struct sctp_initmsg init;
177 struct sctp_sndrcvinfo sndrcv;
Ben Cheng655a7c02013-10-16 16:09:24 -0700178} sctp_cmsg_data_t;
179typedef enum sctp_cmsg_type {
Tao Baod7db5942015-01-28 10:07:51 -0800180 SCTP_INIT,
Ben Cheng655a7c02013-10-16 16:09:24 -0700181#define SCTP_INIT SCTP_INIT
Tao Baod7db5942015-01-28 10:07:51 -0800182 SCTP_SNDRCV,
Ben Cheng655a7c02013-10-16 16:09:24 -0700183#define SCTP_SNDRCV SCTP_SNDRCV
Tao Baod7db5942015-01-28 10:07:51 -0800184 SCTP_SNDINFO,
Christopher Ferris82d75042015-01-26 10:57:07 -0800185#define SCTP_SNDINFO SCTP_SNDINFO
Tao Baod7db5942015-01-28 10:07:51 -0800186 SCTP_RCVINFO,
Christopher Ferris82d75042015-01-26 10:57:07 -0800187#define SCTP_RCVINFO SCTP_RCVINFO
Tao Baod7db5942015-01-28 10:07:51 -0800188 SCTP_NXTINFO,
Christopher Ferris82d75042015-01-26 10:57:07 -0800189#define SCTP_NXTINFO SCTP_NXTINFO
Christopher Ferris76a1d452018-06-27 14:12:29 -0700190 SCTP_PRINFO,
191#define SCTP_PRINFO SCTP_PRINFO
192 SCTP_AUTHINFO,
193#define SCTP_AUTHINFO SCTP_AUTHINFO
194 SCTP_DSTADDRV4,
195#define SCTP_DSTADDRV4 SCTP_DSTADDRV4
196 SCTP_DSTADDRV6,
197#define SCTP_DSTADDRV6 SCTP_DSTADDRV6
Ben Cheng655a7c02013-10-16 16:09:24 -0700198} sctp_cmsg_t;
199struct sctp_assoc_change {
Tao Baod7db5942015-01-28 10:07:51 -0800200 __u16 sac_type;
201 __u16 sac_flags;
Tao Baod7db5942015-01-28 10:07:51 -0800202 __u32 sac_length;
203 __u16 sac_state;
204 __u16 sac_error;
205 __u16 sac_outbound_streams;
Tao Baod7db5942015-01-28 10:07:51 -0800206 __u16 sac_inbound_streams;
207 sctp_assoc_t sac_assoc_id;
208 __u8 sac_info[0];
Ben Cheng655a7c02013-10-16 16:09:24 -0700209};
210enum sctp_sac_state {
Tao Baod7db5942015-01-28 10:07:51 -0800211 SCTP_COMM_UP,
212 SCTP_COMM_LOST,
213 SCTP_RESTART,
Tao Baod7db5942015-01-28 10:07:51 -0800214 SCTP_SHUTDOWN_COMP,
215 SCTP_CANT_STR_ASSOC,
Ben Cheng655a7c02013-10-16 16:09:24 -0700216};
217struct sctp_paddr_change {
Tao Baod7db5942015-01-28 10:07:51 -0800218 __u16 spc_type;
219 __u16 spc_flags;
220 __u32 spc_length;
221 struct sockaddr_storage spc_aaddr;
Tao Baod7db5942015-01-28 10:07:51 -0800222 int spc_state;
223 int spc_error;
224 sctp_assoc_t spc_assoc_id;
Ben Cheng655a7c02013-10-16 16:09:24 -0700225} __attribute__((packed, aligned(4)));
226enum sctp_spc_state {
Tao Baod7db5942015-01-28 10:07:51 -0800227 SCTP_ADDR_AVAILABLE,
228 SCTP_ADDR_UNREACHABLE,
229 SCTP_ADDR_REMOVED,
Tao Baod7db5942015-01-28 10:07:51 -0800230 SCTP_ADDR_ADDED,
231 SCTP_ADDR_MADE_PRIM,
232 SCTP_ADDR_CONFIRMED,
Ben Cheng655a7c02013-10-16 16:09:24 -0700233};
234struct sctp_remote_error {
Tao Baod7db5942015-01-28 10:07:51 -0800235 __u16 sre_type;
236 __u16 sre_flags;
237 __u32 sre_length;
Christopher Ferris1308ad32017-11-14 17:32:13 -0800238 __be16 sre_error;
Tao Baod7db5942015-01-28 10:07:51 -0800239 sctp_assoc_t sre_assoc_id;
240 __u8 sre_data[0];
Ben Cheng655a7c02013-10-16 16:09:24 -0700241};
242struct sctp_send_failed {
Tao Baod7db5942015-01-28 10:07:51 -0800243 __u16 ssf_type;
244 __u16 ssf_flags;
245 __u32 ssf_length;
Tao Baod7db5942015-01-28 10:07:51 -0800246 __u32 ssf_error;
247 struct sctp_sndrcvinfo ssf_info;
248 sctp_assoc_t ssf_assoc_id;
249 __u8 ssf_data[0];
Ben Cheng655a7c02013-10-16 16:09:24 -0700250};
251enum sctp_ssf_flags {
Tao Baod7db5942015-01-28 10:07:51 -0800252 SCTP_DATA_UNSENT,
253 SCTP_DATA_SENT,
Ben Cheng655a7c02013-10-16 16:09:24 -0700254};
255struct sctp_shutdown_event {
Tao Baod7db5942015-01-28 10:07:51 -0800256 __u16 sse_type;
257 __u16 sse_flags;
Tao Baod7db5942015-01-28 10:07:51 -0800258 __u32 sse_length;
259 sctp_assoc_t sse_assoc_id;
Ben Cheng655a7c02013-10-16 16:09:24 -0700260};
261struct sctp_adaptation_event {
Tao Baod7db5942015-01-28 10:07:51 -0800262 __u16 sai_type;
263 __u16 sai_flags;
264 __u32 sai_length;
265 __u32 sai_adaptation_ind;
Tao Baod7db5942015-01-28 10:07:51 -0800266 sctp_assoc_t sai_assoc_id;
Ben Cheng655a7c02013-10-16 16:09:24 -0700267};
Ben Cheng655a7c02013-10-16 16:09:24 -0700268struct sctp_pdapi_event {
Tao Baod7db5942015-01-28 10:07:51 -0800269 __u16 pdapi_type;
Tao Baod7db5942015-01-28 10:07:51 -0800270 __u16 pdapi_flags;
271 __u32 pdapi_length;
272 __u32 pdapi_indication;
273 sctp_assoc_t pdapi_assoc_id;
Christopher Ferris76a1d452018-06-27 14:12:29 -0700274 __u32 pdapi_stream;
275 __u32 pdapi_seq;
Ben Cheng655a7c02013-10-16 16:09:24 -0700276};
Tao Baod7db5942015-01-28 10:07:51 -0800277enum {
278 SCTP_PARTIAL_DELIVERY_ABORTED = 0,
279};
Ben Cheng655a7c02013-10-16 16:09:24 -0700280struct sctp_authkey_event {
Tao Baod7db5942015-01-28 10:07:51 -0800281 __u16 auth_type;
282 __u16 auth_flags;
283 __u32 auth_length;
Tao Baod7db5942015-01-28 10:07:51 -0800284 __u16 auth_keynumber;
285 __u16 auth_altkeynumber;
286 __u32 auth_indication;
287 sctp_assoc_t auth_assoc_id;
Ben Cheng655a7c02013-10-16 16:09:24 -0700288};
Tao Baod7db5942015-01-28 10:07:51 -0800289enum {
Christopher Ferris76a1d452018-06-27 14:12:29 -0700290 SCTP_AUTH_NEW_KEY,
291#define SCTP_AUTH_NEWKEY SCTP_AUTH_NEW_KEY
292 SCTP_AUTH_FREE_KEY,
293 SCTP_AUTH_NO_AUTH,
Tao Baod7db5942015-01-28 10:07:51 -0800294};
Ben Cheng655a7c02013-10-16 16:09:24 -0700295struct sctp_sender_dry_event {
Tao Baod7db5942015-01-28 10:07:51 -0800296 __u16 sender_dry_type;
297 __u16 sender_dry_flags;
298 __u32 sender_dry_length;
Tao Baod7db5942015-01-28 10:07:51 -0800299 sctp_assoc_t sender_dry_assoc_id;
Ben Cheng655a7c02013-10-16 16:09:24 -0700300};
Christopher Ferris525ce912017-07-26 13:12:53 -0700301#define SCTP_STREAM_RESET_INCOMING_SSN 0x0001
302#define SCTP_STREAM_RESET_OUTGOING_SSN 0x0002
303#define SCTP_STREAM_RESET_DENIED 0x0004
304#define SCTP_STREAM_RESET_FAILED 0x0008
305struct sctp_stream_reset_event {
306 __u16 strreset_type;
307 __u16 strreset_flags;
308 __u32 strreset_length;
309 sctp_assoc_t strreset_assoc_id;
310 __u16 strreset_stream_list[];
311};
312#define SCTP_ASSOC_RESET_DENIED 0x0004
313#define SCTP_ASSOC_RESET_FAILED 0x0008
314struct sctp_assoc_reset_event {
315 __u16 assocreset_type;
316 __u16 assocreset_flags;
317 __u32 assocreset_length;
318 sctp_assoc_t assocreset_assoc_id;
319 __u32 assocreset_local_tsn;
320 __u32 assocreset_remote_tsn;
321};
322#define SCTP_ASSOC_CHANGE_DENIED 0x0004
323#define SCTP_ASSOC_CHANGE_FAILED 0x0008
Christopher Ferris86a48372019-01-10 14:14:59 -0800324#define SCTP_STREAM_CHANGE_DENIED SCTP_ASSOC_CHANGE_DENIED
325#define SCTP_STREAM_CHANGE_FAILED SCTP_ASSOC_CHANGE_FAILED
Christopher Ferris525ce912017-07-26 13:12:53 -0700326struct sctp_stream_change_event {
327 __u16 strchange_type;
328 __u16 strchange_flags;
329 __u32 strchange_length;
330 sctp_assoc_t strchange_assoc_id;
331 __u16 strchange_instrms;
332 __u16 strchange_outstrms;
333};
Ben Cheng655a7c02013-10-16 16:09:24 -0700334struct sctp_event_subscribe {
Tao Baod7db5942015-01-28 10:07:51 -0800335 __u8 sctp_data_io_event;
Tao Baod7db5942015-01-28 10:07:51 -0800336 __u8 sctp_association_event;
337 __u8 sctp_address_event;
338 __u8 sctp_send_failure_event;
339 __u8 sctp_peer_error_event;
Tao Baod7db5942015-01-28 10:07:51 -0800340 __u8 sctp_shutdown_event;
341 __u8 sctp_partial_delivery_event;
342 __u8 sctp_adaptation_layer_event;
343 __u8 sctp_authentication_event;
Tao Baod7db5942015-01-28 10:07:51 -0800344 __u8 sctp_sender_dry_event;
Christopher Ferris525ce912017-07-26 13:12:53 -0700345 __u8 sctp_stream_reset_event;
346 __u8 sctp_assoc_reset_event;
347 __u8 sctp_stream_change_event;
Ben Cheng655a7c02013-10-16 16:09:24 -0700348};
Ben Cheng655a7c02013-10-16 16:09:24 -0700349union sctp_notification {
Tao Baod7db5942015-01-28 10:07:51 -0800350 struct {
Tao Baod7db5942015-01-28 10:07:51 -0800351 __u16 sn_type;
352 __u16 sn_flags;
353 __u32 sn_length;
354 } sn_header;
Tao Baod7db5942015-01-28 10:07:51 -0800355 struct sctp_assoc_change sn_assoc_change;
356 struct sctp_paddr_change sn_paddr_change;
357 struct sctp_remote_error sn_remote_error;
358 struct sctp_send_failed sn_send_failed;
Tao Baod7db5942015-01-28 10:07:51 -0800359 struct sctp_shutdown_event sn_shutdown_event;
360 struct sctp_adaptation_event sn_adaptation_event;
361 struct sctp_pdapi_event sn_pdapi_event;
362 struct sctp_authkey_event sn_authkey_event;
Tao Baod7db5942015-01-28 10:07:51 -0800363 struct sctp_sender_dry_event sn_sender_dry_event;
Christopher Ferris525ce912017-07-26 13:12:53 -0700364 struct sctp_stream_reset_event sn_strreset_event;
365 struct sctp_assoc_reset_event sn_assocreset_event;
366 struct sctp_stream_change_event sn_strchange_event;
Ben Cheng655a7c02013-10-16 16:09:24 -0700367};
Ben Cheng655a7c02013-10-16 16:09:24 -0700368enum sctp_sn_type {
Tao Baod7db5942015-01-28 10:07:51 -0800369 SCTP_SN_TYPE_BASE = (1 << 15),
Christopher Ferrisd842e432019-03-07 10:21:59 -0800370 SCTP_DATA_IO_EVENT = SCTP_SN_TYPE_BASE,
371#define SCTP_DATA_IO_EVENT SCTP_DATA_IO_EVENT
Tao Baod7db5942015-01-28 10:07:51 -0800372 SCTP_ASSOC_CHANGE,
Ben Cheng655a7c02013-10-16 16:09:24 -0700373#define SCTP_ASSOC_CHANGE SCTP_ASSOC_CHANGE
Tao Baod7db5942015-01-28 10:07:51 -0800374 SCTP_PEER_ADDR_CHANGE,
Ben Cheng655a7c02013-10-16 16:09:24 -0700375#define SCTP_PEER_ADDR_CHANGE SCTP_PEER_ADDR_CHANGE
Tao Baod7db5942015-01-28 10:07:51 -0800376 SCTP_SEND_FAILED,
Ben Cheng655a7c02013-10-16 16:09:24 -0700377#define SCTP_SEND_FAILED SCTP_SEND_FAILED
Tao Baod7db5942015-01-28 10:07:51 -0800378 SCTP_REMOTE_ERROR,
Ben Cheng655a7c02013-10-16 16:09:24 -0700379#define SCTP_REMOTE_ERROR SCTP_REMOTE_ERROR
Tao Baod7db5942015-01-28 10:07:51 -0800380 SCTP_SHUTDOWN_EVENT,
Ben Cheng655a7c02013-10-16 16:09:24 -0700381#define SCTP_SHUTDOWN_EVENT SCTP_SHUTDOWN_EVENT
Tao Baod7db5942015-01-28 10:07:51 -0800382 SCTP_PARTIAL_DELIVERY_EVENT,
Ben Cheng655a7c02013-10-16 16:09:24 -0700383#define SCTP_PARTIAL_DELIVERY_EVENT SCTP_PARTIAL_DELIVERY_EVENT
Tao Baod7db5942015-01-28 10:07:51 -0800384 SCTP_ADAPTATION_INDICATION,
Ben Cheng655a7c02013-10-16 16:09:24 -0700385#define SCTP_ADAPTATION_INDICATION SCTP_ADAPTATION_INDICATION
Tao Baod7db5942015-01-28 10:07:51 -0800386 SCTP_AUTHENTICATION_EVENT,
Ben Cheng655a7c02013-10-16 16:09:24 -0700387#define SCTP_AUTHENTICATION_INDICATION SCTP_AUTHENTICATION_EVENT
Tao Baod7db5942015-01-28 10:07:51 -0800388 SCTP_SENDER_DRY_EVENT,
Ben Cheng655a7c02013-10-16 16:09:24 -0700389#define SCTP_SENDER_DRY_EVENT SCTP_SENDER_DRY_EVENT
Christopher Ferris525ce912017-07-26 13:12:53 -0700390 SCTP_STREAM_RESET_EVENT,
391#define SCTP_STREAM_RESET_EVENT SCTP_STREAM_RESET_EVENT
392 SCTP_ASSOC_RESET_EVENT,
393#define SCTP_ASSOC_RESET_EVENT SCTP_ASSOC_RESET_EVENT
394 SCTP_STREAM_CHANGE_EVENT,
395#define SCTP_STREAM_CHANGE_EVENT SCTP_STREAM_CHANGE_EVENT
Christopher Ferrisd842e432019-03-07 10:21:59 -0800396 SCTP_SN_TYPE_MAX = SCTP_STREAM_CHANGE_EVENT,
397#define SCTP_SN_TYPE_MAX SCTP_SN_TYPE_MAX
Ben Cheng655a7c02013-10-16 16:09:24 -0700398};
399typedef enum sctp_sn_error {
Tao Baod7db5942015-01-28 10:07:51 -0800400 SCTP_FAILED_THRESHOLD,
401 SCTP_RECEIVED_SACK,
402 SCTP_HEARTBEAT_SUCCESS,
403 SCTP_RESPONSE_TO_USER_REQ,
Tao Baod7db5942015-01-28 10:07:51 -0800404 SCTP_INTERNAL_ERROR,
405 SCTP_SHUTDOWN_GUARD_EXPIRES,
406 SCTP_PEER_FAULTY,
Ben Cheng655a7c02013-10-16 16:09:24 -0700407} sctp_sn_error_t;
408struct sctp_rtoinfo {
Tao Baod7db5942015-01-28 10:07:51 -0800409 sctp_assoc_t srto_assoc_id;
410 __u32 srto_initial;
411 __u32 srto_max;
Tao Baod7db5942015-01-28 10:07:51 -0800412 __u32 srto_min;
Ben Cheng655a7c02013-10-16 16:09:24 -0700413};
Ben Cheng655a7c02013-10-16 16:09:24 -0700414struct sctp_assocparams {
Tao Baod7db5942015-01-28 10:07:51 -0800415 sctp_assoc_t sasoc_assoc_id;
Tao Baod7db5942015-01-28 10:07:51 -0800416 __u16 sasoc_asocmaxrxt;
417 __u16 sasoc_number_peer_destinations;
418 __u32 sasoc_peer_rwnd;
419 __u32 sasoc_local_rwnd;
Tao Baod7db5942015-01-28 10:07:51 -0800420 __u32 sasoc_cookie_life;
Ben Cheng655a7c02013-10-16 16:09:24 -0700421};
Ben Cheng655a7c02013-10-16 16:09:24 -0700422struct sctp_setpeerprim {
Tao Baod7db5942015-01-28 10:07:51 -0800423 sctp_assoc_t sspp_assoc_id;
Tao Baod7db5942015-01-28 10:07:51 -0800424 struct sockaddr_storage sspp_addr;
Ben Cheng655a7c02013-10-16 16:09:24 -0700425} __attribute__((packed, aligned(4)));
Ben Cheng655a7c02013-10-16 16:09:24 -0700426struct sctp_prim {
Tao Baod7db5942015-01-28 10:07:51 -0800427 sctp_assoc_t ssp_assoc_id;
Tao Baod7db5942015-01-28 10:07:51 -0800428 struct sockaddr_storage ssp_addr;
Ben Cheng655a7c02013-10-16 16:09:24 -0700429} __attribute__((packed, aligned(4)));
Ben Cheng655a7c02013-10-16 16:09:24 -0700430#define sctp_setprim sctp_prim
431struct sctp_setadaptation {
Tao Baod7db5942015-01-28 10:07:51 -0800432 __u32 ssb_adaptation_ind;
Ben Cheng655a7c02013-10-16 16:09:24 -0700433};
Ben Cheng655a7c02013-10-16 16:09:24 -0700434enum sctp_spp_flags {
Tao Baod7db5942015-01-28 10:07:51 -0800435 SPP_HB_ENABLE = 1 << 0,
Tao Baod7db5942015-01-28 10:07:51 -0800436 SPP_HB_DISABLE = 1 << 1,
437 SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE,
438 SPP_HB_DEMAND = 1 << 2,
439 SPP_PMTUD_ENABLE = 1 << 3,
Tao Baod7db5942015-01-28 10:07:51 -0800440 SPP_PMTUD_DISABLE = 1 << 4,
441 SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE,
442 SPP_SACKDELAY_ENABLE = 1 << 5,
443 SPP_SACKDELAY_DISABLE = 1 << 6,
Tao Baod7db5942015-01-28 10:07:51 -0800444 SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE,
445 SPP_HB_TIME_IS_ZERO = 1 << 7,
Christopher Ferris9ce28842018-10-25 12:11:39 -0700446 SPP_IPV6_FLOWLABEL = 1 << 8,
447 SPP_DSCP = 1 << 9,
Ben Cheng655a7c02013-10-16 16:09:24 -0700448};
449struct sctp_paddrparams {
Tao Baod7db5942015-01-28 10:07:51 -0800450 sctp_assoc_t spp_assoc_id;
451 struct sockaddr_storage spp_address;
452 __u32 spp_hbinterval;
453 __u16 spp_pathmaxrxt;
Tao Baod7db5942015-01-28 10:07:51 -0800454 __u32 spp_pathmtu;
455 __u32 spp_sackdelay;
456 __u32 spp_flags;
Christopher Ferris9ce28842018-10-25 12:11:39 -0700457 __u32 spp_ipv6_flowlabel;
458 __u8 spp_dscp;
Ben Cheng655a7c02013-10-16 16:09:24 -0700459} __attribute__((packed, aligned(4)));
460struct sctp_authchunk {
Tao Baod7db5942015-01-28 10:07:51 -0800461 __u8 sauth_chunk;
Ben Cheng655a7c02013-10-16 16:09:24 -0700462};
463enum {
Tao Baod7db5942015-01-28 10:07:51 -0800464 SCTP_AUTH_HMAC_ID_SHA1 = 1,
465 SCTP_AUTH_HMAC_ID_SHA256 = 3,
Ben Cheng655a7c02013-10-16 16:09:24 -0700466};
467struct sctp_hmacalgo {
Tao Baod7db5942015-01-28 10:07:51 -0800468 __u32 shmac_num_idents;
469 __u16 shmac_idents[];
Ben Cheng655a7c02013-10-16 16:09:24 -0700470};
471#define shmac_number_of_idents shmac_num_idents
472struct sctp_authkey {
Tao Baod7db5942015-01-28 10:07:51 -0800473 sctp_assoc_t sca_assoc_id;
474 __u16 sca_keynumber;
475 __u16 sca_keylength;
Tao Baod7db5942015-01-28 10:07:51 -0800476 __u8 sca_key[];
Ben Cheng655a7c02013-10-16 16:09:24 -0700477};
Ben Cheng655a7c02013-10-16 16:09:24 -0700478struct sctp_authkeyid {
Tao Baod7db5942015-01-28 10:07:51 -0800479 sctp_assoc_t scact_assoc_id;
Tao Baod7db5942015-01-28 10:07:51 -0800480 __u16 scact_keynumber;
Ben Cheng655a7c02013-10-16 16:09:24 -0700481};
Ben Cheng655a7c02013-10-16 16:09:24 -0700482struct sctp_sack_info {
Tao Baod7db5942015-01-28 10:07:51 -0800483 sctp_assoc_t sack_assoc_id;
Tao Baod7db5942015-01-28 10:07:51 -0800484 uint32_t sack_delay;
485 uint32_t sack_freq;
Ben Cheng655a7c02013-10-16 16:09:24 -0700486};
487struct sctp_assoc_value {
Tao Baod7db5942015-01-28 10:07:51 -0800488 sctp_assoc_t assoc_id;
489 uint32_t assoc_value;
Ben Cheng655a7c02013-10-16 16:09:24 -0700490};
Christopher Ferris934ec942018-01-31 15:29:16 -0800491struct sctp_stream_value {
492 sctp_assoc_t assoc_id;
493 uint16_t stream_id;
494 uint16_t stream_value;
495};
Ben Cheng655a7c02013-10-16 16:09:24 -0700496struct sctp_paddrinfo {
Tao Baod7db5942015-01-28 10:07:51 -0800497 sctp_assoc_t spinfo_assoc_id;
498 struct sockaddr_storage spinfo_address;
499 __s32 spinfo_state;
500 __u32 spinfo_cwnd;
Tao Baod7db5942015-01-28 10:07:51 -0800501 __u32 spinfo_srtt;
502 __u32 spinfo_rto;
503 __u32 spinfo_mtu;
Ben Cheng655a7c02013-10-16 16:09:24 -0700504} __attribute__((packed, aligned(4)));
505enum sctp_spinfo_state {
Tao Baod7db5942015-01-28 10:07:51 -0800506 SCTP_INACTIVE,
507 SCTP_PF,
508 SCTP_ACTIVE,
Tao Baod7db5942015-01-28 10:07:51 -0800509 SCTP_UNCONFIRMED,
510 SCTP_UNKNOWN = 0xffff
Ben Cheng655a7c02013-10-16 16:09:24 -0700511};
512struct sctp_status {
Tao Baod7db5942015-01-28 10:07:51 -0800513 sctp_assoc_t sstat_assoc_id;
514 __s32 sstat_state;
515 __u32 sstat_rwnd;
516 __u16 sstat_unackdata;
Tao Baod7db5942015-01-28 10:07:51 -0800517 __u16 sstat_penddata;
518 __u16 sstat_instrms;
519 __u16 sstat_outstrms;
520 __u32 sstat_fragmentation_point;
Tao Baod7db5942015-01-28 10:07:51 -0800521 struct sctp_paddrinfo sstat_primary;
Ben Cheng655a7c02013-10-16 16:09:24 -0700522};
Ben Cheng655a7c02013-10-16 16:09:24 -0700523struct sctp_authchunks {
Tao Baod7db5942015-01-28 10:07:51 -0800524 sctp_assoc_t gauth_assoc_id;
Tao Baod7db5942015-01-28 10:07:51 -0800525 __u32 gauth_number_of_chunks;
526 uint8_t gauth_chunks[];
Ben Cheng655a7c02013-10-16 16:09:24 -0700527};
528#define guth_number_of_chunks gauth_number_of_chunks
529enum sctp_sstat_state {
Tao Baod7db5942015-01-28 10:07:51 -0800530 SCTP_EMPTY = 0,
531 SCTP_CLOSED = 1,
532 SCTP_COOKIE_WAIT = 2,
Tao Baod7db5942015-01-28 10:07:51 -0800533 SCTP_COOKIE_ECHOED = 3,
534 SCTP_ESTABLISHED = 4,
535 SCTP_SHUTDOWN_PENDING = 5,
536 SCTP_SHUTDOWN_SENT = 6,
Tao Baod7db5942015-01-28 10:07:51 -0800537 SCTP_SHUTDOWN_RECEIVED = 7,
538 SCTP_SHUTDOWN_ACK_SENT = 8,
Ben Cheng655a7c02013-10-16 16:09:24 -0700539};
540struct sctp_assoc_ids {
Tao Baod7db5942015-01-28 10:07:51 -0800541 __u32 gaids_number_of_ids;
542 sctp_assoc_t gaids_assoc_id[];
Ben Cheng655a7c02013-10-16 16:09:24 -0700543};
544struct sctp_getaddrs_old {
Tao Baod7db5942015-01-28 10:07:51 -0800545 sctp_assoc_t assoc_id;
546 int addr_num;
547 struct sockaddr * addrs;
Ben Cheng655a7c02013-10-16 16:09:24 -0700548};
549struct sctp_getaddrs {
Tao Baod7db5942015-01-28 10:07:51 -0800550 sctp_assoc_t assoc_id;
551 __u32 addr_num;
552 __u8 addrs[0];
Ben Cheng655a7c02013-10-16 16:09:24 -0700553};
554struct sctp_assoc_stats {
Tao Baod7db5942015-01-28 10:07:51 -0800555 sctp_assoc_t sas_assoc_id;
556 struct sockaddr_storage sas_obs_rto_ipaddr;
Tao Baod7db5942015-01-28 10:07:51 -0800557 __u64 sas_maxrto;
558 __u64 sas_isacks;
559 __u64 sas_osacks;
560 __u64 sas_opackets;
Tao Baod7db5942015-01-28 10:07:51 -0800561 __u64 sas_ipackets;
562 __u64 sas_rtxchunks;
563 __u64 sas_outofseqtsns;
564 __u64 sas_idupchunks;
Tao Baod7db5942015-01-28 10:07:51 -0800565 __u64 sas_gapcnt;
566 __u64 sas_ouodchunks;
567 __u64 sas_iuodchunks;
568 __u64 sas_oodchunks;
Tao Baod7db5942015-01-28 10:07:51 -0800569 __u64 sas_iodchunks;
570 __u64 sas_octrlchunks;
571 __u64 sas_ictrlchunks;
Ben Cheng655a7c02013-10-16 16:09:24 -0700572};
Ben Cheng655a7c02013-10-16 16:09:24 -0700573#define SCTP_BINDX_ADD_ADDR 0x01
574#define SCTP_BINDX_REM_ADDR 0x02
Ben Cheng655a7c02013-10-16 16:09:24 -0700575typedef struct {
Tao Baod7db5942015-01-28 10:07:51 -0800576 sctp_assoc_t associd;
Tao Baod7db5942015-01-28 10:07:51 -0800577 int sd;
Ben Cheng655a7c02013-10-16 16:09:24 -0700578} sctp_peeloff_arg_t;
Christopher Ferris1308ad32017-11-14 17:32:13 -0800579typedef struct {
580 sctp_peeloff_arg_t p_arg;
581 unsigned flags;
582} sctp_peeloff_flags_arg_t;
Ben Cheng655a7c02013-10-16 16:09:24 -0700583struct sctp_paddrthlds {
Tao Baod7db5942015-01-28 10:07:51 -0800584 sctp_assoc_t spt_assoc_id;
Tao Baod7db5942015-01-28 10:07:51 -0800585 struct sockaddr_storage spt_address;
586 __u16 spt_pathmaxrxt;
587 __u16 spt_pathpfthld;
Ben Cheng655a7c02013-10-16 16:09:24 -0700588};
Christopher Ferris49f525c2016-12-12 14:55:36 -0800589struct sctp_prstatus {
590 sctp_assoc_t sprstat_assoc_id;
591 __u16 sprstat_sid;
592 __u16 sprstat_policy;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800593 __u64 sprstat_abandoned_unsent;
594 __u64 sprstat_abandoned_sent;
595};
596struct sctp_default_prinfo {
Christopher Ferris49f525c2016-12-12 14:55:36 -0800597 sctp_assoc_t pr_assoc_id;
598 __u32 pr_value;
599 __u16 pr_policy;
600};
Christopher Ferris49f525c2016-12-12 14:55:36 -0800601struct sctp_info {
602 __u32 sctpi_tag;
603 __u32 sctpi_state;
604 __u32 sctpi_rwnd;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800605 __u16 sctpi_unackdata;
606 __u16 sctpi_penddata;
607 __u16 sctpi_instrms;
608 __u16 sctpi_outstrms;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800609 __u32 sctpi_fragmentation_point;
610 __u32 sctpi_inqueue;
611 __u32 sctpi_outqueue;
612 __u32 sctpi_overall_error;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800613 __u32 sctpi_max_burst;
614 __u32 sctpi_maxseg;
615 __u32 sctpi_peer_rwnd;
616 __u32 sctpi_peer_tag;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800617 __u8 sctpi_peer_capable;
618 __u8 sctpi_peer_sack;
619 __u16 __reserved1;
620 __u64 sctpi_isacks;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800621 __u64 sctpi_osacks;
622 __u64 sctpi_opackets;
623 __u64 sctpi_ipackets;
624 __u64 sctpi_rtxchunks;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800625 __u64 sctpi_outofseqtsns;
626 __u64 sctpi_idupchunks;
627 __u64 sctpi_gapcnt;
628 __u64 sctpi_ouodchunks;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800629 __u64 sctpi_iuodchunks;
630 __u64 sctpi_oodchunks;
631 __u64 sctpi_iodchunks;
632 __u64 sctpi_octrlchunks;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800633 __u64 sctpi_ictrlchunks;
634 struct sockaddr_storage sctpi_p_address;
635 __s32 sctpi_p_state;
636 __u32 sctpi_p_cwnd;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800637 __u32 sctpi_p_srtt;
638 __u32 sctpi_p_rto;
639 __u32 sctpi_p_hbinterval;
640 __u32 sctpi_p_pathmaxrxt;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800641 __u32 sctpi_p_sackdelay;
642 __u32 sctpi_p_sackfreq;
643 __u32 sctpi_p_ssthresh;
644 __u32 sctpi_p_partial_bytes_acked;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800645 __u32 sctpi_p_flight_size;
646 __u16 sctpi_p_error;
647 __u16 __reserved2;
648 __u32 sctpi_s_autoclose;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800649 __u32 sctpi_s_adaptation_ind;
650 __u32 sctpi_s_pd_point;
651 __u8 sctpi_s_nodelay;
652 __u8 sctpi_s_disable_fragments;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800653 __u8 sctpi_s_v4mapped;
654 __u8 sctpi_s_frag_interleave;
655 __u32 sctpi_s_type;
656 __u32 __reserved3;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800657};
Christopher Ferris525ce912017-07-26 13:12:53 -0700658struct sctp_reset_streams {
659 sctp_assoc_t srs_assoc_id;
660 uint16_t srs_flags;
661 uint16_t srs_number_streams;
662 uint16_t srs_stream_list[];
663};
664struct sctp_add_streams {
665 sctp_assoc_t sas_assoc_id;
666 uint16_t sas_instrms;
667 uint16_t sas_outstrms;
668};
Christopher Ferrisd842e432019-03-07 10:21:59 -0800669struct sctp_event {
670 sctp_assoc_t se_assoc_id;
671 uint16_t se_type;
672 uint8_t se_on;
673};
Christopher Ferris934ec942018-01-31 15:29:16 -0800674enum sctp_sched_type {
675 SCTP_SS_FCFS,
Christopher Ferris86a48372019-01-10 14:14:59 -0800676 SCTP_SS_DEFAULT = SCTP_SS_FCFS,
Christopher Ferris934ec942018-01-31 15:29:16 -0800677 SCTP_SS_PRIO,
678 SCTP_SS_RR,
679 SCTP_SS_MAX = SCTP_SS_RR
680};
Ben Cheng655a7c02013-10-16 16:09:24 -0700681#endif