Blame view

include/uapi/linux/sctp.h 29.3 KB
60c778b25   Vlad Yasevich   [SCTP]: Stop clai...
1
  /* SCTP kernel implementation
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2
3
4
5
6
   * (C) Copyright IBM Corp. 2001, 2004
   * Copyright (c) 1999-2000 Cisco, Inc.
   * Copyright (c) 1999-2001 Motorola, Inc.
   * Copyright (c) 2002 Intel Corp.
   *
60c778b25   Vlad Yasevich   [SCTP]: Stop clai...
7
   * This file is part of the SCTP kernel implementation
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
8
9
10
11
   *
   * This header represents the structures and constants needed to support
   * the SCTP Extension to the Sockets API.
   *
60c778b25   Vlad Yasevich   [SCTP]: Stop clai...
12
   * This SCTP implementation is free software;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
13
14
15
16
17
   * you can redistribute it and/or modify it under the terms of
   * the GNU General Public License as published by
   * the Free Software Foundation; either version 2, or (at your option)
   * any later version.
   *
60c778b25   Vlad Yasevich   [SCTP]: Stop clai...
18
   * This SCTP implementation is distributed in the hope that it
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
19
20
21
22
23
24
   * will be useful, but WITHOUT ANY WARRANTY; without even the implied
   *                 ************************
   * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   * See the GNU General Public License for more details.
   *
   * You should have received a copy of the GNU General Public License
4b2f13a25   Jeff Kirsher   sctp: Fix FSF add...
25
26
   * along with GNU CC; see the file COPYING.  If not, see
   * <http://www.gnu.org/licenses/>.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
27
28
29
   *
   * Please send any bug reports or fixes you make to the
   * email address(es):
91705c61b   Daniel Borkmann   net: sctp: trivia...
30
   *    lksctp developers <linux-sctp@vger.kernel.org>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
31
32
33
34
35
36
37
38
39
40
41
42
43
   *
   * Or submit a bug report through the following website:
   *    http://www.sf.net/projects/lksctp
   *
   * Written or modified by:
   *    La Monte H.P. Yarroll    <piggy@acm.org>
   *    R. Stewart               <randall@sctp.chicago.il.us>
   *    K. Morneau               <kmorneau@cisco.com>
   *    Q. Xie                   <qxie1@email.mot.com>
   *    Karl Knutson             <karl@athena.chicago.il.us>
   *    Jon Grimm                <jgrimm@us.ibm.com>
   *    Daisy Chang              <daisyc@us.ibm.com>
   *    Ryan Layer               <rmlayer@us.ibm.com>
1b8664341   Daniel Borkmann   net: sctp: introd...
44
   *    Ardelle Fan              <ardelle.fan@intel.com>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
45
   *    Sridhar Samudrala        <sri@us.ibm.com>
1b8664341   Daniel Borkmann   net: sctp: introd...
46
47
   *    Inaky Perez-Gonzalez     <inaky.gonzalez@intel.com>
   *    Vlad Yasevich            <vladislav.yasevich@hp.com>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
48
49
50
51
   *
   * Any bugs reported given to us we will try to fix... any fixes shared will
   * be incorporated into the next SCTP release.
   */
1b8664341   Daniel Borkmann   net: sctp: introd...
52
53
  #ifndef _UAPI_SCTP_H
  #define _UAPI_SCTP_H
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
54
55
56
57
58
59
60
61
62
  
  #include <linux/types.h>
  #include <linux/socket.h>
  
  typedef __s32 sctp_assoc_t;
  
  /* The following symbols come from the Sockets API Extensions for
   * SCTP <draft-ietf-tsvwg-sctpsocket-07.txt>.
   */
a5b03ad21   Vlad Yasevich   sctp: Turn the en...
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
  #define SCTP_RTOINFO	0
  #define SCTP_ASSOCINFO  1
  #define SCTP_INITMSG	2
  #define SCTP_NODELAY	3		/* Get/set nodelay option. */
  #define SCTP_AUTOCLOSE	4
  #define SCTP_SET_PEER_PRIMARY_ADDR 5
  #define SCTP_PRIMARY_ADDR	6
  #define SCTP_ADAPTATION_LAYER	7
  #define SCTP_DISABLE_FRAGMENTS	8
  #define SCTP_PEER_ADDR_PARAMS	9
  #define SCTP_DEFAULT_SEND_PARAM	10
  #define SCTP_EVENTS	11
  #define SCTP_I_WANT_MAPPED_V4_ADDR 12	/* Turn on/off mapped v4 addresses  */
  #define SCTP_MAXSEG	13		/* Get/set maximum fragment. */
  #define SCTP_STATUS	14
  #define SCTP_GET_PEER_ADDR_INFO	15
  #define SCTP_DELAYED_ACK_TIME	16
  #define SCTP_DELAYED_ACK SCTP_DELAYED_ACK_TIME
4580ccc04   Shan Wei   sctp: user perfec...
81
  #define SCTP_DELAYED_SACK SCTP_DELAYED_ACK_TIME
a5b03ad21   Vlad Yasevich   sctp: Turn the en...
82
83
84
85
86
87
88
89
90
91
92
93
  #define SCTP_CONTEXT	17
  #define SCTP_FRAGMENT_INTERLEAVE	18
  #define SCTP_PARTIAL_DELIVERY_POINT	19 /* Set/Get partial delivery point */
  #define SCTP_MAX_BURST	20		/* Set/Get max burst */
  #define SCTP_AUTH_CHUNK	21	/* Set only: add a chunk type to authenticate */
  #define SCTP_HMAC_IDENT	22
  #define SCTP_AUTH_KEY	23
  #define SCTP_AUTH_ACTIVE_KEY	24
  #define SCTP_AUTH_DELETE_KEY	25
  #define SCTP_PEER_AUTH_CHUNKS	26	/* Read only */
  #define SCTP_LOCAL_AUTH_CHUNKS	27	/* Read only */
  #define SCTP_GET_ASSOC_NUMBER	28	/* Read only */
209ba424c   Wei Yongjun   sctp: implement s...
94
  #define SCTP_GET_ASSOC_ID_LIST	29	/* Read only */
7dc04d712   Michio Honda   sctp: Add socket ...
95
  #define SCTP_AUTO_ASCONF       30
5aa93bcf6   Neil Horman   sctp: Implement q...
96
  #define SCTP_PEER_ADDR_THLDS	31
0d3a421d2   Geir Ola Vaagland   net: sctp: implem...
97
  #define SCTP_RECVRCVINFO	32
2347c80ff   Geir Ola Vaagland   net: sctp: implem...
98
  #define SCTP_RECVNXTINFO	33
6b3fd5f3a   Geir Ola Vaagland   net: sctp: implem...
99
  #define SCTP_DEFAULT_SNDINFO	34
65b07e5d0   Vlad Yasevich   [SCTP]: API updat...
100

a5b03ad21   Vlad Yasevich   sctp: Turn the en...
101
102
103
104
105
106
107
108
  /* Internal Socket Options. Some of the sctp library functions are
   * implemented using these socket options.
   */
  #define SCTP_SOCKOPT_BINDX_ADD	100	/* BINDX requests for adding addrs */
  #define SCTP_SOCKOPT_BINDX_REM	101	/* BINDX requests for removing addrs. */
  #define SCTP_SOCKOPT_PEELOFF	102	/* peel off association. */
  /* Options 104-106 are deprecated and removed. Do not use this space */
  #define SCTP_SOCKOPT_CONNECTX_OLD	107	/* CONNECTX old requests. */
b595076a1   Uwe Kleine-König   tree-wide: fix co...
109
110
  #define SCTP_GET_PEER_ADDRS	108		/* Get all peer address. */
  #define SCTP_GET_LOCAL_ADDRS	109		/* Get all local address. */
a5b03ad21   Vlad Yasevich   sctp: Turn the en...
111
112
  #define SCTP_SOCKOPT_CONNECTX	110		/* CONNECTX requests. */
  #define SCTP_SOCKOPT_CONNECTX3	111	/* CONNECTX requests (updated) */
196d67593   Michele Baldessari   sctp: Add support...
113
  #define SCTP_GET_ASSOC_STATS	112	/* Read only */
28aa4c26f   Xin Long   sctp: add SCTP_PR...
114
  #define SCTP_PR_SUPPORTED	113
f959fb442   Xin Long   sctp: add SCTP_DE...
115
  #define SCTP_DEFAULT_PRINFO	114
826d253d5   Xin Long   sctp: add SCTP_PR...
116
  #define SCTP_PR_ASSOC_STATUS	115
f959fb442   Xin Long   sctp: add SCTP_DE...
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
  
  /* PR-SCTP policies */
  #define SCTP_PR_SCTP_NONE	0x0000
  #define SCTP_PR_SCTP_TTL	0x0010
  #define SCTP_PR_SCTP_RTX	0x0020
  #define SCTP_PR_SCTP_PRIO	0x0030
  #define SCTP_PR_SCTP_MAX	SCTP_PR_SCTP_PRIO
  #define SCTP_PR_SCTP_MASK	0x0030
  
  #define __SCTP_PR_INDEX(x)	((x >> 4) - 1)
  #define SCTP_PR_INDEX(x)	__SCTP_PR_INDEX(SCTP_PR_SCTP_ ## x)
  
  #define SCTP_PR_POLICY(x)	((x) & SCTP_PR_SCTP_MASK)
  #define SCTP_PR_SET_POLICY(flags, x)	\
  	do {				\
  		flags &= ~SCTP_PR_SCTP_MASK;	\
  		flags |= x;		\
  	} while (0)
  
  #define SCTP_PR_TTL_ENABLED(x)	(SCTP_PR_POLICY(x) == SCTP_PR_SCTP_TTL)
  #define SCTP_PR_RTX_ENABLED(x)	(SCTP_PR_POLICY(x) == SCTP_PR_SCTP_RTX)
  #define SCTP_PR_PRIO_ENABLED(x)	(SCTP_PR_POLICY(x) == SCTP_PR_SCTP_PRIO)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
139

2347c80ff   Geir Ola Vaagland   net: sctp: implem...
140
141
142
143
144
145
  /* These are bit fields for msghdr->msg_flags.  See section 5.1.  */
  /* On user space Linux, these live in <bits/socket.h> as an enum.  */
  enum sctp_msg_flags {
  	MSG_NOTIFICATION = 0x8000,
  #define MSG_NOTIFICATION MSG_NOTIFICATION
  };
0d3a421d2   Geir Ola Vaagland   net: sctp: implem...
146
  /* 5.3.1 SCTP Initiation Structure (SCTP_INIT)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
147
148
149
150
151
152
153
154
155
   *
   *   This cmsghdr structure provides information for initializing new
   *   SCTP associations with sendmsg().  The SCTP_INITMSG socket option
   *   uses this same data structure.  This structure is not used for
   *   recvmsg().
   *
   *   cmsg_level    cmsg_type      cmsg_data[]
   *   ------------  ------------   ----------------------
   *   IPPROTO_SCTP  SCTP_INIT      struct sctp_initmsg
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
156
157
158
159
160
161
162
   */
  struct sctp_initmsg {
  	__u16 sinit_num_ostreams;
  	__u16 sinit_max_instreams;
  	__u16 sinit_max_attempts;
  	__u16 sinit_max_init_timeo;
  };
0d3a421d2   Geir Ola Vaagland   net: sctp: implem...
163
  /* 5.3.2 SCTP Header Information Structure (SCTP_SNDRCV)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
164
165
166
167
168
169
170
171
   *
   *   This cmsghdr structure specifies SCTP options for sendmsg() and
   *   describes SCTP header information about a received message through
   *   recvmsg().
   *
   *   cmsg_level    cmsg_type      cmsg_data[]
   *   ------------  ------------   ----------------------
   *   IPPROTO_SCTP  SCTP_SNDRCV    struct sctp_sndrcvinfo
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
172
173
174
175
176
177
178
179
180
181
182
183
   */
  struct sctp_sndrcvinfo {
  	__u16 sinfo_stream;
  	__u16 sinfo_ssn;
  	__u16 sinfo_flags;
  	__u32 sinfo_ppid;
  	__u32 sinfo_context;
  	__u32 sinfo_timetolive;
  	__u32 sinfo_tsn;
  	__u32 sinfo_cumtsn;
  	sctp_assoc_t sinfo_assoc_id;
  };
63b949382   Geir Ola Vaagland   net: sctp: implem...
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
  /* 5.3.4 SCTP Send Information Structure (SCTP_SNDINFO)
   *
   *   This cmsghdr structure specifies SCTP options for sendmsg().
   *
   *   cmsg_level    cmsg_type      cmsg_data[]
   *   ------------  ------------   -------------------
   *   IPPROTO_SCTP  SCTP_SNDINFO   struct sctp_sndinfo
   */
  struct sctp_sndinfo {
  	__u16 snd_sid;
  	__u16 snd_flags;
  	__u32 snd_ppid;
  	__u32 snd_context;
  	sctp_assoc_t snd_assoc_id;
  };
0d3a421d2   Geir Ola Vaagland   net: sctp: implem...
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
  /* 5.3.5 SCTP Receive Information Structure (SCTP_RCVINFO)
   *
   *   This cmsghdr structure describes SCTP receive information
   *   about a received message through recvmsg().
   *
   *   cmsg_level    cmsg_type      cmsg_data[]
   *   ------------  ------------   -------------------
   *   IPPROTO_SCTP  SCTP_RCVINFO   struct sctp_rcvinfo
   */
  struct sctp_rcvinfo {
  	__u16 rcv_sid;
  	__u16 rcv_ssn;
  	__u16 rcv_flags;
  	__u32 rcv_ppid;
  	__u32 rcv_tsn;
  	__u32 rcv_cumtsn;
  	__u32 rcv_context;
  	sctp_assoc_t rcv_assoc_id;
  };
2347c80ff   Geir Ola Vaagland   net: sctp: implem...
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
  /* 5.3.6 SCTP Next Receive Information Structure (SCTP_NXTINFO)
   *
   *   This cmsghdr structure describes SCTP receive information
   *   of the next message that will be delivered through recvmsg()
   *   if this information is already available when delivering
   *   the current message.
   *
   *   cmsg_level    cmsg_type      cmsg_data[]
   *   ------------  ------------   -------------------
   *   IPPROTO_SCTP  SCTP_NXTINFO   struct sctp_nxtinfo
   */
  struct sctp_nxtinfo {
  	__u16 nxt_sid;
  	__u16 nxt_flags;
  	__u32 nxt_ppid;
  	__u32 nxt_length;
  	sctp_assoc_t nxt_assoc_id;
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
236
237
238
239
240
241
  /*
   *  sinfo_flags: 16 bits (unsigned integer)
   *
   *   This field may contain any of the following flags and is composed of
   *   a bitwise OR of these values.
   */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
242
  enum sctp_sinfo_flags {
2347c80ff   Geir Ola Vaagland   net: sctp: implem...
243
244
245
246
247
248
  	SCTP_UNORDERED		= (1 << 0), /* Send/receive message unordered. */
  	SCTP_ADDR_OVER		= (1 << 1), /* Override the primary destination. */
  	SCTP_ABORT		= (1 << 2), /* Send an ABORT message to the peer. */
  	SCTP_SACK_IMMEDIATELY	= (1 << 3), /* SACK should be sent without delay. */
  	SCTP_NOTIFICATION	= MSG_NOTIFICATION, /* Next message is not user msg but notification. */
  	SCTP_EOF		= MSG_FIN,  /* Initiate graceful shutdown process. */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
249
  };
1b8664341   Daniel Borkmann   net: sctp: introd...
250
251
252
253
254
  typedef union {
  	__u8   			raw;
  	struct sctp_initmsg	init;
  	struct sctp_sndrcvinfo	sndrcv;
  } sctp_cmsg_data_t;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
255

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
256
257
  /* These are cmsg_types.  */
  typedef enum sctp_cmsg_type {
63b949382   Geir Ola Vaagland   net: sctp: implem...
258
  	SCTP_INIT,		/* 5.2.1 SCTP Initiation Structure */
1b8664341   Daniel Borkmann   net: sctp: introd...
259
  #define SCTP_INIT	SCTP_INIT
63b949382   Geir Ola Vaagland   net: sctp: implem...
260
  	SCTP_SNDRCV,		/* 5.2.2 SCTP Header Information Structure */
1b8664341   Daniel Borkmann   net: sctp: introd...
261
  #define SCTP_SNDRCV	SCTP_SNDRCV
63b949382   Geir Ola Vaagland   net: sctp: implem...
262
263
  	SCTP_SNDINFO,		/* 5.3.4 SCTP Send Information Structure */
  #define SCTP_SNDINFO	SCTP_SNDINFO
0d3a421d2   Geir Ola Vaagland   net: sctp: implem...
264
265
  	SCTP_RCVINFO,		/* 5.3.5 SCTP Receive Information Structure */
  #define SCTP_RCVINFO	SCTP_RCVINFO
2347c80ff   Geir Ola Vaagland   net: sctp: implem...
266
267
  	SCTP_NXTINFO,		/* 5.3.6 SCTP Next Receive Information Structure */
  #define SCTP_NXTINFO	SCTP_NXTINFO
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
268
  } sctp_cmsg_t;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
  /*
   * 5.3.1.1 SCTP_ASSOC_CHANGE
   *
   *   Communication notifications inform the ULP that an SCTP association
   *   has either begun or ended. The identifier for a new association is
   *   provided by this notificaion. The notification information has the
   *   following format:
   *
   */
  struct sctp_assoc_change {
  	__u16 sac_type;
  	__u16 sac_flags;
  	__u32 sac_length;
  	__u16 sac_state;
  	__u16 sac_error;
  	__u16 sac_outbound_streams;
  	__u16 sac_inbound_streams;
  	sctp_assoc_t sac_assoc_id;
a5a35e767   Vlad Yasevich   [SCTP]: Implement...
287
  	__u8 sac_info[0];
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
  };
  
  /*
   *   sac_state: 32 bits (signed integer)
   *
   *   This field holds one of a number of values that communicate the
   *   event that happened to the association.  They include:
   *
   *   Note:  The following state names deviate from the API draft as
   *   the names clash too easily with other kernel symbols.
   */
  enum sctp_sac_state {
  	SCTP_COMM_UP,
  	SCTP_COMM_LOST,
  	SCTP_RESTART,
  	SCTP_SHUTDOWN_COMP,
  	SCTP_CANT_STR_ASSOC,
  };
  
  /*
   * 5.3.1.2 SCTP_PEER_ADDR_CHANGE
   *
   *   When a destination address on a multi-homed peer encounters a change
   *   an interface details event is sent.  The information has the
   *   following structure:
   */
  struct sctp_paddr_change {
  	__u16 spc_type;
  	__u16 spc_flags;
  	__u32 spc_length;
  	struct sockaddr_storage spc_aaddr;
  	int spc_state;
  	int spc_error;
  	sctp_assoc_t spc_assoc_id;
20c9c825b   Sridhar Samudrala   [SCTP] Fix SCTP s...
322
  } __attribute__((packed, aligned(4)));
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
323
324
325
326
327
328
329
330
331
332
333
334
335
  
  /*
   *    spc_state:  32 bits (signed integer)
   *
   *   This field holds one of a number of values that communicate the
   *   event that happened to the address.  They include:
   */
  enum sctp_spc_state {
  	SCTP_ADDR_AVAILABLE,
  	SCTP_ADDR_UNREACHABLE,
  	SCTP_ADDR_REMOVED,
  	SCTP_ADDR_ADDED,
  	SCTP_ADDR_MADE_PRIM,
1ae4114dc   Vlad Yasevich   [SCTP]: Implement...
336
  	SCTP_ADDR_CONFIRMED,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
  };
  
  
  /*
   * 5.3.1.3 SCTP_REMOTE_ERROR
   *
   *   A remote peer may send an Operational Error message to its peer.
   *   This message indicates a variety of error conditions on an
   *   association. The entire error TLV as it appears on the wire is
   *   included in a SCTP_REMOTE_ERROR event.  Please refer to the SCTP
   *   specification [SCTP] and any extensions for a list of possible
   *   error formats. SCTP error TLVs have the format:
   */
  struct sctp_remote_error {
  	__u16 sre_type;
  	__u16 sre_flags;
  	__u32 sre_length;
  	__u16 sre_error;
  	sctp_assoc_t sre_assoc_id;
  	__u8 sre_data[0];
  };
  
  
  /*
   * 5.3.1.4 SCTP_SEND_FAILED
   *
   *   If SCTP cannot deliver a message it may return the message as a
   *   notification.
   */
  struct sctp_send_failed {
  	__u16 ssf_type;
  	__u16 ssf_flags;
  	__u32 ssf_length;
  	__u32 ssf_error;
  	struct sctp_sndrcvinfo ssf_info;
  	sctp_assoc_t ssf_assoc_id;
  	__u8 ssf_data[0];
  };
  
  /*
   *   ssf_flags: 16 bits (unsigned integer)
   *
   *   The flag value will take one of the following values
   *
   *   SCTP_DATA_UNSENT  - Indicates that the data was never put on
   *                       the wire.
   *
   *   SCTP_DATA_SENT    - Indicates that the data was put on the wire.
   *                       Note that this does not necessarily mean that the
   *                       data was (or was not) successfully delivered.
   */
  enum sctp_ssf_flags {
  	SCTP_DATA_UNSENT,
  	SCTP_DATA_SENT,
  };
  
  /*
   * 5.3.1.5 SCTP_SHUTDOWN_EVENT
   *
   *   When a peer sends a SHUTDOWN, SCTP delivers this notification to
   *   inform the application that it should cease sending data.
   */
  struct sctp_shutdown_event {
  	__u16 sse_type;
  	__u16 sse_flags;
  	__u32 sse_length;
  	sctp_assoc_t sse_assoc_id;
  };
  
  /*
0f3fffd8a   Ivan Skytte Jorgensen   [SCTP]: Fix typo ...
407
   * 5.3.1.6 SCTP_ADAPTATION_INDICATION
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
408
   *
0f3fffd8a   Ivan Skytte Jorgensen   [SCTP]: Fix typo ...
409
   *   When a peer sends a Adaptation Layer Indication parameter , SCTP
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
410
   *   delivers this notification to inform the application
0f3fffd8a   Ivan Skytte Jorgensen   [SCTP]: Fix typo ...
411
   *   that of the peers requested adaptation layer.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
412
   */
0f3fffd8a   Ivan Skytte Jorgensen   [SCTP]: Fix typo ...
413
  struct sctp_adaptation_event {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
414
415
416
  	__u16 sai_type;
  	__u16 sai_flags;
  	__u32 sai_length;
0f3fffd8a   Ivan Skytte Jorgensen   [SCTP]: Fix typo ...
417
  	__u32 sai_adaptation_ind;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
  	sctp_assoc_t sai_assoc_id;
  };
  
  /*
   * 5.3.1.7 SCTP_PARTIAL_DELIVERY_EVENT
   *
   *   When a receiver is engaged in a partial delivery of a
   *   message this notification will be used to indicate
   *   various events.
   */
  struct sctp_pdapi_event {
  	__u16 pdapi_type;
  	__u16 pdapi_flags;
  	__u32 pdapi_length;
  	__u32 pdapi_indication;
  	sctp_assoc_t pdapi_assoc_id;
  };
  
  enum { SCTP_PARTIAL_DELIVERY_ABORTED=0, };
1b8664341   Daniel Borkmann   net: sctp: introd...
437
438
439
440
441
442
  /*
   * 5.3.1.8.  SCTP_AUTHENTICATION_EVENT
   *
   *  When a receiver is using authentication this message will provide
   *  notifications regarding new keys being made active as well as errors.
   */
65b07e5d0   Vlad Yasevich   [SCTP]: API updat...
443
444
445
446
447
448
449
450
451
452
453
  struct sctp_authkey_event {
  	__u16 auth_type;
  	__u16 auth_flags;
  	__u32 auth_length;
  	__u16 auth_keynumber;
  	__u16 auth_altkeynumber;
  	__u32 auth_indication;
  	sctp_assoc_t auth_assoc_id;
  };
  
  enum { SCTP_AUTH_NEWKEY = 0, };
e1cdd553d   Wei Yongjun   sctp: implement e...
454
455
456
457
458
459
460
461
462
463
464
465
466
467
  /*
   * 6.1.9. SCTP_SENDER_DRY_EVENT
   *
   * When the SCTP stack has no more user data to send or retransmit, this
   * notification is given to the user. Also, at the time when a user app
   * subscribes to this event, if there is no data to be sent or
   * retransmit, the stack will immediately send up this notification.
   */
  struct sctp_sender_dry_event {
  	__u16 sender_dry_type;
  	__u16 sender_dry_flags;
  	__u32 sender_dry_length;
  	sctp_assoc_t sender_dry_assoc_id;
  };
65b07e5d0   Vlad Yasevich   [SCTP]: API updat...
468

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
469
470
471
472
473
474
475
476
477
478
479
480
  /*
   * Described in Section 7.3
   *   Ancillary Data and Notification Interest Options
   */
  struct sctp_event_subscribe {
  	__u8 sctp_data_io_event;
  	__u8 sctp_association_event;
  	__u8 sctp_address_event;
  	__u8 sctp_send_failure_event;
  	__u8 sctp_peer_error_event;
  	__u8 sctp_shutdown_event;
  	__u8 sctp_partial_delivery_event;
0f3fffd8a   Ivan Skytte Jorgensen   [SCTP]: Fix typo ...
481
  	__u8 sctp_adaptation_layer_event;
7e8616d8e   Vlad Yasevich   [SCTP]: Update AU...
482
  	__u8 sctp_authentication_event;
e1cdd553d   Wei Yongjun   sctp: implement e...
483
  	__u8 sctp_sender_dry_event;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
  };
  
  /*
   * 5.3.1 SCTP Notification Structure
   *
   *   The notification structure is defined as the union of all
   *   notification types.
   *
   */
  union sctp_notification {
  	struct {
  		__u16 sn_type;             /* Notification type. */
  		__u16 sn_flags;
  		__u32 sn_length;
  	} sn_header;
  	struct sctp_assoc_change sn_assoc_change;
  	struct sctp_paddr_change sn_paddr_change;
  	struct sctp_remote_error sn_remote_error;
  	struct sctp_send_failed sn_send_failed;
  	struct sctp_shutdown_event sn_shutdown_event;
0f3fffd8a   Ivan Skytte Jorgensen   [SCTP]: Fix typo ...
504
  	struct sctp_adaptation_event sn_adaptation_event;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
505
  	struct sctp_pdapi_event sn_pdapi_event;
65b07e5d0   Vlad Yasevich   [SCTP]: API updat...
506
  	struct sctp_authkey_event sn_authkey_event;
e1cdd553d   Wei Yongjun   sctp: implement e...
507
  	struct sctp_sender_dry_event sn_sender_dry_event;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
508
509
510
511
512
513
514
515
516
517
  };
  
  /* Section 5.3.1
   * All standard values for sn_type flags are greater than 2^15.
   * Values from 2^15 and down are reserved.
   */
  
  enum sctp_sn_type {
  	SCTP_SN_TYPE_BASE     = (1<<15),
  	SCTP_ASSOC_CHANGE,
1b8664341   Daniel Borkmann   net: sctp: introd...
518
  #define SCTP_ASSOC_CHANGE		SCTP_ASSOC_CHANGE
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
519
  	SCTP_PEER_ADDR_CHANGE,
1b8664341   Daniel Borkmann   net: sctp: introd...
520
  #define SCTP_PEER_ADDR_CHANGE		SCTP_PEER_ADDR_CHANGE
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
521
  	SCTP_SEND_FAILED,
1b8664341   Daniel Borkmann   net: sctp: introd...
522
  #define SCTP_SEND_FAILED		SCTP_SEND_FAILED
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
523
  	SCTP_REMOTE_ERROR,
1b8664341   Daniel Borkmann   net: sctp: introd...
524
  #define SCTP_REMOTE_ERROR		SCTP_REMOTE_ERROR
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
525
  	SCTP_SHUTDOWN_EVENT,
1b8664341   Daniel Borkmann   net: sctp: introd...
526
  #define SCTP_SHUTDOWN_EVENT		SCTP_SHUTDOWN_EVENT
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
527
  	SCTP_PARTIAL_DELIVERY_EVENT,
1b8664341   Daniel Borkmann   net: sctp: introd...
528
  #define SCTP_PARTIAL_DELIVERY_EVENT	SCTP_PARTIAL_DELIVERY_EVENT
0f3fffd8a   Ivan Skytte Jorgensen   [SCTP]: Fix typo ...
529
  	SCTP_ADAPTATION_INDICATION,
1b8664341   Daniel Borkmann   net: sctp: introd...
530
  #define SCTP_ADAPTATION_INDICATION	SCTP_ADAPTATION_INDICATION
ee916fd0f   Wei Yongjun   sctp: change auth...
531
532
  	SCTP_AUTHENTICATION_EVENT,
  #define SCTP_AUTHENTICATION_INDICATION	SCTP_AUTHENTICATION_EVENT
e1cdd553d   Wei Yongjun   sctp: implement e...
533
  	SCTP_SENDER_DRY_EVENT,
1b8664341   Daniel Borkmann   net: sctp: introd...
534
  #define SCTP_SENDER_DRY_EVENT		SCTP_SENDER_DRY_EVENT
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
  };
  
  /* Notification error codes used to fill up the error fields in some
   * notifications.
   * SCTP_PEER_ADDRESS_CHAGE 	: spc_error
   * SCTP_ASSOC_CHANGE		: sac_error
   * These names should be potentially included in the draft 04 of the SCTP
   * sockets API specification.
   */
  typedef enum sctp_sn_error {
  	SCTP_FAILED_THRESHOLD,
  	SCTP_RECEIVED_SACK,
  	SCTP_HEARTBEAT_SUCCESS,
  	SCTP_RESPONSE_TO_USER_REQ,
  	SCTP_INTERNAL_ERROR,
  	SCTP_SHUTDOWN_GUARD_EXPIRES,
  	SCTP_PEER_FAULTY,
  } sctp_sn_error_t;
  
  /*
   * 7.1.1 Retransmission Timeout Parameters (SCTP_RTOINFO)
   *
   *   The protocol parameters used to initialize and bound retransmission
   *   timeout (RTO) are tunable.  See [SCTP] for more information on how
1b8664341   Daniel Borkmann   net: sctp: introd...
559
   *   these parameters are used in RTO calculation.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
   */
  struct sctp_rtoinfo {
  	sctp_assoc_t	srto_assoc_id;
  	__u32		srto_initial;
  	__u32		srto_max;
  	__u32		srto_min;
  };
  
  /*
   * 7.1.2 Association Parameters (SCTP_ASSOCINFO)
   *
   *   This option is used to both examine and set various association and
   *   endpoint parameters.
   */
  struct sctp_assocparams {
  	sctp_assoc_t	sasoc_assoc_id;
  	__u16		sasoc_asocmaxrxt;
  	__u16		sasoc_number_peer_destinations;
  	__u32		sasoc_peer_rwnd;
  	__u32		sasoc_local_rwnd;
  	__u32		sasoc_cookie_life;
  };
  
  /*
   * 7.1.9 Set Peer Primary Address (SCTP_SET_PEER_PRIMARY_ADDR)
   *
   *  Requests that the peer mark the enclosed address as the association
   *  primary. The enclosed address must be one of the association's
   *  locally bound addresses. The following structure is used to make a
   *   set primary request:
   */
  struct sctp_setpeerprim {
  	sctp_assoc_t            sspp_assoc_id;
  	struct sockaddr_storage sspp_addr;
20c9c825b   Sridhar Samudrala   [SCTP] Fix SCTP s...
594
  } __attribute__((packed, aligned(4)));
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
595
596
597
598
599
600
601
602
603
604
605
606
  
  /*
   * 7.1.10 Set Primary Address (SCTP_PRIMARY_ADDR)
   *
   *  Requests that the local SCTP stack use the enclosed peer address as
   *  the association primary. The enclosed address must be one of the
   *  association peer's addresses. The following structure is used to
   *  make a set peer primary request:
   */
  struct sctp_prim {
  	sctp_assoc_t            ssp_assoc_id;
  	struct sockaddr_storage ssp_addr;
20c9c825b   Sridhar Samudrala   [SCTP] Fix SCTP s...
607
  } __attribute__((packed, aligned(4)));
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
608

1b8664341   Daniel Borkmann   net: sctp: introd...
609
610
  /* For backward compatibility use, define the old name too */
  #define sctp_setprim	sctp_prim
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
611
  /*
0f3fffd8a   Ivan Skytte Jorgensen   [SCTP]: Fix typo ...
612
   * 7.1.11 Set Adaptation Layer Indicator (SCTP_ADAPTATION_LAYER)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
613
   *
0f3fffd8a   Ivan Skytte Jorgensen   [SCTP]: Fix typo ...
614
   * Requests that the local endpoint set the specified Adaptation Layer
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
615
616
   * Indication parameter for all future INIT and INIT-ACK exchanges.
   */
0f3fffd8a   Ivan Skytte Jorgensen   [SCTP]: Fix typo ...
617
618
  struct sctp_setadaptation {
  	__u32	ssb_adaptation_ind;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
619
620
621
622
623
624
625
626
627
628
629
630
  };
  
  /*
   * 7.1.13 Peer Address Parameters  (SCTP_PEER_ADDR_PARAMS)
   *
   *   Applications can enable or disable heartbeats for any peer address
   *   of an association, modify an address's heartbeat interval, force a
   *   heartbeat to be sent immediately, and adjust the address's maximum
   *   number of retransmissions sent before an address is considered
   *   unreachable. The following structure is used to access and modify an
   *   address's parameters:
   */
52ccb8e90   Frank Filz   [SCTP]: Update SC...
631
  enum  sctp_spp_flags {
bdf3092af   Vlad Yasevich   [SCTP]: Honor fla...
632
633
  	SPP_HB_ENABLE = 1<<0,		/*Enable heartbeats*/
  	SPP_HB_DISABLE = 1<<1,		/*Disable heartbeats*/
52ccb8e90   Frank Filz   [SCTP]: Update SC...
634
  	SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE,
bdf3092af   Vlad Yasevich   [SCTP]: Honor fla...
635
636
637
  	SPP_HB_DEMAND = 1<<2,		/*Send heartbeat immediately*/
  	SPP_PMTUD_ENABLE = 1<<3,	/*Enable PMTU discovery*/
  	SPP_PMTUD_DISABLE = 1<<4,	/*Disable PMTU discovery*/
52ccb8e90   Frank Filz   [SCTP]: Update SC...
638
  	SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE,
bdf3092af   Vlad Yasevich   [SCTP]: Honor fla...
639
640
  	SPP_SACKDELAY_ENABLE = 1<<5,	/*Enable SACK*/
  	SPP_SACKDELAY_DISABLE = 1<<6,	/*Disable SACK*/
52ccb8e90   Frank Filz   [SCTP]: Update SC...
641
  	SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE,
bdf3092af   Vlad Yasevich   [SCTP]: Honor fla...
642
  	SPP_HB_TIME_IS_ZERO = 1<<7,	/* Set HB delay to 0 */
52ccb8e90   Frank Filz   [SCTP]: Update SC...
643
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
644
645
646
647
648
  struct sctp_paddrparams {
  	sctp_assoc_t		spp_assoc_id;
  	struct sockaddr_storage	spp_address;
  	__u32			spp_hbinterval;
  	__u16			spp_pathmaxrxt;
52ccb8e90   Frank Filz   [SCTP]: Update SC...
649
650
651
  	__u32			spp_pathmtu;
  	__u32			spp_sackdelay;
  	__u32			spp_flags;
20c9c825b   Sridhar Samudrala   [SCTP] Fix SCTP s...
652
  } __attribute__((packed, aligned(4)));
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
653

65b07e5d0   Vlad Yasevich   [SCTP]: API updat...
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
  /*
   * 7.1.18.  Add a chunk that must be authenticated (SCTP_AUTH_CHUNK)
   *
   * This set option adds a chunk type that the user is requesting to be
   * received only in an authenticated way.  Changes to the list of chunks
   * will only effect future associations on the socket.
   */
  struct sctp_authchunk {
  	__u8		sauth_chunk;
  };
  
  /*
   * 7.1.19.  Get or set the list of supported HMAC Identifiers (SCTP_HMAC_IDENT)
   *
   * This option gets or sets the list of HMAC algorithms that the local
   * endpoint requires the peer to use.
1b8664341   Daniel Borkmann   net: sctp: introd...
670
671
672
673
674
675
676
677
678
679
   */
  #ifndef __KERNEL__
  /* This here is only used by user space as is. It might not be a good idea
   * to export/reveal the whole structure with reserved fields etc.
   */
  enum {
  	SCTP_AUTH_HMAC_ID_SHA1 = 1,
  	SCTP_AUTH_HMAC_ID_SHA256 = 3,
  };
  #endif
65b07e5d0   Vlad Yasevich   [SCTP]: API updat...
680
  struct sctp_hmacalgo {
7e8616d8e   Vlad Yasevich   [SCTP]: Update AU...
681
  	__u32		shmac_num_idents;
65b07e5d0   Vlad Yasevich   [SCTP]: API updat...
682
683
  	__u16		shmac_idents[];
  };
1b8664341   Daniel Borkmann   net: sctp: introd...
684
685
686
687
  /* Sadly, user and kernel space have different names for
   * this structure member, so this is to not break anything.
   */
  #define shmac_number_of_idents	shmac_num_idents
65b07e5d0   Vlad Yasevich   [SCTP]: API updat...
688
689
690
691
692
693
694
695
696
  /*
   * 7.1.20.  Set a shared key (SCTP_AUTH_KEY)
   *
   * This option will set a shared secret key which is used to build an
   * association shared key.
   */
  struct sctp_authkey {
  	sctp_assoc_t	sca_assoc_id;
  	__u16		sca_keynumber;
7e8616d8e   Vlad Yasevich   [SCTP]: Update AU...
697
  	__u16		sca_keylength;
65b07e5d0   Vlad Yasevich   [SCTP]: API updat...
698
699
700
701
702
703
704
705
706
707
708
709
710
711
  	__u8		sca_key[];
  };
  
  /*
   * 7.1.21.  Get or set the active shared key (SCTP_AUTH_ACTIVE_KEY)
   *
   * This option will get or set the active shared key to be used to build
   * the association shared key.
   */
  
  struct sctp_authkeyid {
  	sctp_assoc_t	scact_assoc_id;
  	__u16		scact_keynumber;
  };
d364d9276   Wei Yongjun   sctp: Bring SCTP_...
712
713
714
715
716
717
718
719
720
721
722
723
724
  /*
   * 7.1.23.  Get or set delayed ack timer (SCTP_DELAYED_SACK)
   *
   * This option will effect the way delayed acks are performed.  This
   * option allows you to get or set the delayed ack time, in
   * milliseconds.  It also allows changing the delayed ack frequency.
   * Changing the frequency to 1 disables the delayed sack algorithm.  If
   * the assoc_id is 0, then this sets or gets the endpoints default
   * values.  If the assoc_id field is non-zero, then the set or get
   * effects the specified association for the one to many model (the
   * assoc_id field is ignored by the one to one model).  Note that if
   * sack_delay or sack_freq are 0 when setting this option, then the
   * current values will remain unchanged.
7708610b1   Frank Filz   [SCTP]: Add suppo...
725
   */
d364d9276   Wei Yongjun   sctp: Bring SCTP_...
726
727
728
729
730
  struct sctp_sack_info {
  	sctp_assoc_t	sack_assoc_id;
  	uint32_t	sack_delay;
  	uint32_t	sack_freq;
  };
7708610b1   Frank Filz   [SCTP]: Add suppo...
731
732
733
734
  struct sctp_assoc_value {
      sctp_assoc_t            assoc_id;
      uint32_t                assoc_value;
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
  /*
   * 7.2.2 Peer Address Information
   *
   *   Applications can retrieve information about a specific peer address
   *   of an association, including its reachability state, congestion
   *   window, and retransmission timer values.  This information is
   *   read-only. The following structure is used to access this
   *   information:
   */
  struct sctp_paddrinfo {
  	sctp_assoc_t		spinfo_assoc_id;
  	struct sockaddr_storage	spinfo_address;
  	__s32			spinfo_state;
  	__u32			spinfo_cwnd;
  	__u32			spinfo_srtt;
  	__u32			spinfo_rto;
  	__u32			spinfo_mtu;
20c9c825b   Sridhar Samudrala   [SCTP] Fix SCTP s...
752
  } __attribute__((packed, aligned(4)));
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
753
754
  
  /* Peer addresses's state. */
ad8fec172   Sridhar Samudrala   [SCTP]: Verify al...
755
756
757
758
759
760
761
762
  /* UNKNOWN: Peer address passed by the upper layer in sendmsg or connect[x]
   * calls.
   * UNCONFIRMED: Peer address received in INIT/INIT-ACK address parameters.
   *              Not yet confirmed by a heartbeat and not available for data
   *		transfers.
   * ACTIVE : Peer address confirmed, active and available for data transfers.
   * INACTIVE: Peer address inactive and not available for data transfers.
   */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
763
764
  enum sctp_spinfo_state {
  	SCTP_INACTIVE,
5aa93bcf6   Neil Horman   sctp: Implement q...
765
  	SCTP_PF,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
766
  	SCTP_ACTIVE,
ad8fec172   Sridhar Samudrala   [SCTP]: Verify al...
767
  	SCTP_UNCONFIRMED,
3f7a87d2f   Frank Filz   [SCTP] sctp_conne...
768
  	SCTP_UNKNOWN = 0xffff  /* Value used for transport state unknown */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
  };
  
  /*
   * 7.2.1 Association Status (SCTP_STATUS)
   *
   *   Applications can retrieve current status information about an
   *   association, including association state, peer receiver window size,
   *   number of unacked data chunks, and number of data chunks pending
   *   receipt.  This information is read-only.  The following structure is
   *   used to access this information:
   */
  struct sctp_status {
  	sctp_assoc_t		sstat_assoc_id;
  	__s32			sstat_state;
  	__u32			sstat_rwnd;
  	__u16			sstat_unackdata;
  	__u16			sstat_penddata;
  	__u16			sstat_instrms;
  	__u16			sstat_outstrms;
  	__u32			sstat_fragmentation_point;
  	struct sctp_paddrinfo	sstat_primary;
  };
  
  /*
65b07e5d0   Vlad Yasevich   [SCTP]: API updat...
793
794
795
796
797
798
799
   * 7.2.3.  Get the list of chunks the peer requires to be authenticated
   *         (SCTP_PEER_AUTH_CHUNKS)
   *
   * This option gets a list of chunks for a specified association that
   * the peer requires to be received authenticated only.
   */
  struct sctp_authchunks {
7e8616d8e   Vlad Yasevich   [SCTP]: Update AU...
800
801
802
  	sctp_assoc_t	gauth_assoc_id;
  	__u32		gauth_number_of_chunks;
  	uint8_t		gauth_chunks[];
65b07e5d0   Vlad Yasevich   [SCTP]: API updat...
803
  };
1b8664341   Daniel Borkmann   net: sctp: introd...
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
  /* The broken spelling has been released already in lksctp-tools header,
   * so don't break anyone, now that it's fixed.
   */
  #define guth_number_of_chunks	gauth_number_of_chunks
  
  /* Association states.  */
  enum sctp_sstat_state {
  	SCTP_EMPTY                = 0,
  	SCTP_CLOSED               = 1,
  	SCTP_COOKIE_WAIT          = 2,
  	SCTP_COOKIE_ECHOED        = 3,
  	SCTP_ESTABLISHED          = 4,
  	SCTP_SHUTDOWN_PENDING     = 5,
  	SCTP_SHUTDOWN_SENT        = 6,
  	SCTP_SHUTDOWN_RECEIVED    = 7,
  	SCTP_SHUTDOWN_ACK_SENT    = 8,
  };
65b07e5d0   Vlad Yasevich   [SCTP]: API updat...
821
  /*
209ba424c   Wei Yongjun   sctp: implement s...
822
823
824
825
826
827
828
829
830
831
832
833
   * 8.2.6. Get the Current Identifiers of Associations
   *        (SCTP_GET_ASSOC_ID_LIST)
   *
   * This option gets the current list of SCTP association identifiers of
   * the SCTP associations handled by a one-to-many style socket.
   */
  struct sctp_assoc_ids {
  	__u32		gaids_number_of_ids;
  	sctp_assoc_t	gaids_assoc_id[];
  };
  
  /*
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
834
   * 8.3, 8.5 get all peer/local addresses in an association.
1b8664341   Daniel Borkmann   net: sctp: introd...
835
   * This parameter struct is used by SCTP_GET_PEER_ADDRS and
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
836
   * SCTP_GET_LOCAL_ADDRS socket options used internally to implement
1b8664341   Daniel Borkmann   net: sctp: introd...
837
   * sctp_getpaddrs() and sctp_getladdrs() API.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
838
   */
5fe467ee9   Ivan Skytte Jørgensen   [SCTP] Fix sctp_g...
839
  struct sctp_getaddrs_old {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
840
841
  	sctp_assoc_t            assoc_id;
  	int			addr_num;
1b8664341   Daniel Borkmann   net: sctp: introd...
842
  #ifdef __KERNEL__
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
843
  	struct sockaddr		__user *addrs;
1b8664341   Daniel Borkmann   net: sctp: introd...
844
845
846
  #else
  	struct sockaddr		*addrs;
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
847
  };
1b8664341   Daniel Borkmann   net: sctp: introd...
848

5fe467ee9   Ivan Skytte Jørgensen   [SCTP] Fix sctp_g...
849
850
851
852
853
  struct sctp_getaddrs {
  	sctp_assoc_t		assoc_id; /*input*/
  	__u32			addr_num; /*output*/
  	__u8			addrs[0]; /*output, variable size*/
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
854

196d67593   Michele Baldessari   sctp: Add support...
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
  /* A socket user request obtained via SCTP_GET_ASSOC_STATS that retrieves
   * association stats. All stats are counts except sas_maxrto and
   * sas_obs_rto_ipaddr. maxrto is the max observed rto + transport since
   * the last call. Will return 0 when RTO was not update since last call
   */
  struct sctp_assoc_stats {
  	sctp_assoc_t	sas_assoc_id;    /* Input */
  					 /* Transport of observed max RTO */
  	struct sockaddr_storage sas_obs_rto_ipaddr;
  	__u64		sas_maxrto;      /* Maximum Observed RTO for period */
  	__u64		sas_isacks;	 /* SACKs received */
  	__u64		sas_osacks;	 /* SACKs sent */
  	__u64		sas_opackets;	 /* Packets sent */
  	__u64		sas_ipackets;	 /* Packets received */
  	__u64		sas_rtxchunks;   /* Retransmitted Chunks */
  	__u64		sas_outofseqtsns;/* TSN received > next expected */
  	__u64		sas_idupchunks;  /* Dups received (ordered+unordered) */
  	__u64		sas_gapcnt;      /* Gap Acknowledgements Received */
  	__u64		sas_ouodchunks;  /* Unordered data chunks sent */
  	__u64		sas_iuodchunks;  /* Unordered data chunks received */
  	__u64		sas_oodchunks;	 /* Ordered data chunks sent */
  	__u64		sas_iodchunks;	 /* Ordered data chunks received */
  	__u64		sas_octrlchunks; /* Control chunks sent */
  	__u64		sas_ictrlchunks; /* Control chunks received */
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
  /*
   * 8.1 sctp_bindx()
   *
   * The flags parameter is formed from the bitwise OR of zero or more of the
   * following currently defined flags:
   */
  #define SCTP_BINDX_ADD_ADDR 0x01
  #define SCTP_BINDX_REM_ADDR 0x02
  
  /* This is the structure that is passed as an argument(optval) to
   * getsockopt(SCTP_SOCKOPT_PEELOFF).
   */
  typedef struct {
  	sctp_assoc_t associd;
  	int sd;
  } sctp_peeloff_arg_t;
5aa93bcf6   Neil Horman   sctp: Implement q...
896
897
898
899
900
901
902
903
904
  /*
   *  Peer Address Thresholds socket option
   */
  struct sctp_paddrthlds {
  	sctp_assoc_t spt_assoc_id;
  	struct sockaddr_storage spt_address;
  	__u16 spt_pathmaxrxt;
  	__u16 spt_pathpfthld;
  };
1b8664341   Daniel Borkmann   net: sctp: introd...
905

826d253d5   Xin Long   sctp: add SCTP_PR...
906
907
908
909
910
911
912
913
914
915
  /*
   * Socket Option for Getting the Association/Stream-Specific PR-SCTP Status
   */
  struct sctp_prstatus {
  	sctp_assoc_t sprstat_assoc_id;
  	__u16 sprstat_sid;
  	__u16 sprstat_policy;
  	__u64 sprstat_abandoned_unsent;
  	__u64 sprstat_abandoned_sent;
  };
f959fb442   Xin Long   sctp: add SCTP_DE...
916
917
918
919
920
  struct sctp_default_prinfo {
  	sctp_assoc_t pr_assoc_id;
  	__u32 pr_value;
  	__u16 pr_policy;
  };
dca3f53c0   Phil Sutter   sctp: Export stru...
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
  struct sctp_info {
  	__u32	sctpi_tag;
  	__u32	sctpi_state;
  	__u32	sctpi_rwnd;
  	__u16	sctpi_unackdata;
  	__u16	sctpi_penddata;
  	__u16	sctpi_instrms;
  	__u16	sctpi_outstrms;
  	__u32	sctpi_fragmentation_point;
  	__u32	sctpi_inqueue;
  	__u32	sctpi_outqueue;
  	__u32	sctpi_overall_error;
  	__u32	sctpi_max_burst;
  	__u32	sctpi_maxseg;
  	__u32	sctpi_peer_rwnd;
  	__u32	sctpi_peer_tag;
  	__u8	sctpi_peer_capable;
  	__u8	sctpi_peer_sack;
  	__u16	__reserved1;
  
  	/* assoc status info */
  	__u64	sctpi_isacks;
  	__u64	sctpi_osacks;
  	__u64	sctpi_opackets;
  	__u64	sctpi_ipackets;
  	__u64	sctpi_rtxchunks;
  	__u64	sctpi_outofseqtsns;
  	__u64	sctpi_idupchunks;
  	__u64	sctpi_gapcnt;
  	__u64	sctpi_ouodchunks;
  	__u64	sctpi_iuodchunks;
  	__u64	sctpi_oodchunks;
  	__u64	sctpi_iodchunks;
  	__u64	sctpi_octrlchunks;
  	__u64	sctpi_ictrlchunks;
  
  	/* primary transport info */
  	struct sockaddr_storage	sctpi_p_address;
  	__s32	sctpi_p_state;
  	__u32	sctpi_p_cwnd;
  	__u32	sctpi_p_srtt;
  	__u32	sctpi_p_rto;
  	__u32	sctpi_p_hbinterval;
  	__u32	sctpi_p_pathmaxrxt;
  	__u32	sctpi_p_sackdelay;
  	__u32	sctpi_p_sackfreq;
  	__u32	sctpi_p_ssthresh;
  	__u32	sctpi_p_partial_bytes_acked;
  	__u32	sctpi_p_flight_size;
  	__u16	sctpi_p_error;
  	__u16	__reserved2;
  
  	/* sctp sock info */
  	__u32	sctpi_s_autoclose;
  	__u32	sctpi_s_adaptation_ind;
  	__u32	sctpi_s_pd_point;
  	__u8	sctpi_s_nodelay;
  	__u8	sctpi_s_disable_fragments;
  	__u8	sctpi_s_v4mapped;
  	__u8	sctpi_s_frag_interleave;
  	__u32	sctpi_s_type;
  	__u32	__reserved3;
  };
1b8664341   Daniel Borkmann   net: sctp: introd...
984
  #endif /* _UAPI_SCTP_H */