f205b10f0ab95f05ec3cef5aea549991c4f0f0d7
[deliverable/linux.git] / include / net / sctp / user.h
1 /* SCTP kernel implementation
2 * (C) Copyright IBM Corp. 2001, 2004
3 * Copyright (c) 1999-2000 Cisco, Inc.
4 * Copyright (c) 1999-2001 Motorola, Inc.
5 * Copyright (c) 2002 Intel Corp.
6 *
7 * This file is part of the SCTP kernel implementation
8 *
9 * This header represents the structures and constants needed to support
10 * the SCTP Extension to the Sockets API.
11 *
12 * This SCTP implementation is free software;
13 * you can redistribute it and/or modify it under the terms of
14 * the GNU General Public License as published by
15 * the Free Software Foundation; either version 2, or (at your option)
16 * any later version.
17 *
18 * This SCTP implementation is distributed in the hope that it
19 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
20 * ************************
21 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22 * See the GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with GNU CC; see the file COPYING. If not, write to
26 * the Free Software Foundation, 59 Temple Place - Suite 330,
27 * Boston, MA 02111-1307, USA.
28 *
29 * Please send any bug reports or fixes you make to the
30 * email address(es):
31 * lksctp developers <lksctp-developers@lists.sourceforge.net>
32 *
33 * Or submit a bug report through the following website:
34 * http://www.sf.net/projects/lksctp
35 *
36 * Written or modified by:
37 * La Monte H.P. Yarroll <piggy@acm.org>
38 * R. Stewart <randall@sctp.chicago.il.us>
39 * K. Morneau <kmorneau@cisco.com>
40 * Q. Xie <qxie1@email.mot.com>
41 * Karl Knutson <karl@athena.chicago.il.us>
42 * Jon Grimm <jgrimm@us.ibm.com>
43 * Daisy Chang <daisyc@us.ibm.com>
44 * Ryan Layer <rmlayer@us.ibm.com>
45 * Ardelle Fan <ardelle.fan@intel.com>
46 * Sridhar Samudrala <sri@us.ibm.com>
47 *
48 * Any bugs reported given to us we will try to fix... any fixes shared will
49 * be incorporated into the next SCTP release.
50 */
51
52 #ifndef __net_sctp_user_h__
53 #define __net_sctp_user_h__
54
55 #include <linux/types.h>
56 #include <linux/socket.h>
57
58 typedef __s32 sctp_assoc_t;
59
60 /* The following symbols come from the Sockets API Extensions for
61 * SCTP <draft-ietf-tsvwg-sctpsocket-07.txt>.
62 */
63 enum sctp_optname {
64 SCTP_RTOINFO,
65 #define SCTP_RTOINFO SCTP_RTOINFO
66 SCTP_ASSOCINFO,
67 #define SCTP_ASSOCINFO SCTP_ASSOCINFO
68 SCTP_INITMSG,
69 #define SCTP_INITMSG SCTP_INITMSG
70 SCTP_NODELAY, /* Get/set nodelay option. */
71 #define SCTP_NODELAY SCTP_NODELAY
72 SCTP_AUTOCLOSE,
73 #define SCTP_AUTOCLOSE SCTP_AUTOCLOSE
74 SCTP_SET_PEER_PRIMARY_ADDR,
75 #define SCTP_SET_PEER_PRIMARY_ADDR SCTP_SET_PEER_PRIMARY_ADDR
76 SCTP_PRIMARY_ADDR,
77 #define SCTP_PRIMARY_ADDR SCTP_PRIMARY_ADDR
78 SCTP_ADAPTATION_LAYER,
79 #define SCTP_ADAPTATION_LAYER SCTP_ADAPTATION_LAYER
80 SCTP_DISABLE_FRAGMENTS,
81 #define SCTP_DISABLE_FRAGMENTS SCTP_DISABLE_FRAGMENTS
82 SCTP_PEER_ADDR_PARAMS,
83 #define SCTP_PEER_ADDR_PARAMS SCTP_PEER_ADDR_PARAMS
84 SCTP_DEFAULT_SEND_PARAM,
85 #define SCTP_DEFAULT_SEND_PARAM SCTP_DEFAULT_SEND_PARAM
86 SCTP_EVENTS,
87 #define SCTP_EVENTS SCTP_EVENTS
88 SCTP_I_WANT_MAPPED_V4_ADDR, /* Turn on/off mapped v4 addresses */
89 #define SCTP_I_WANT_MAPPED_V4_ADDR SCTP_I_WANT_MAPPED_V4_ADDR
90 SCTP_MAXSEG, /* Get/set maximum fragment. */
91 #define SCTP_MAXSEG SCTP_MAXSEG
92 SCTP_STATUS,
93 #define SCTP_STATUS SCTP_STATUS
94 SCTP_GET_PEER_ADDR_INFO,
95 #define SCTP_GET_PEER_ADDR_INFO SCTP_GET_PEER_ADDR_INFO
96 SCTP_DELAYED_ACK,
97 #define SCTP_DELAYED_ACK_TIME SCTP_DELAYED_ACK
98 #define SCTP_DELAYED_ACK SCTP_DELAYED_ACK
99 SCTP_CONTEXT, /* Receive Context */
100 #define SCTP_CONTEXT SCTP_CONTEXT
101 SCTP_FRAGMENT_INTERLEAVE,
102 #define SCTP_FRAGMENT_INTERLEAVE SCTP_FRAGMENT_INTERLEAVE
103 SCTP_PARTIAL_DELIVERY_POINT, /* Set/Get partial delivery point */
104 #define SCTP_PARTIAL_DELIVERY_POINT SCTP_PARTIAL_DELIVERY_POINT
105 SCTP_MAX_BURST, /* Set/Get max burst */
106 #define SCTP_MAX_BURST SCTP_MAX_BURST
107 SCTP_AUTH_CHUNK, /* Set only: add a chunk type to authenticat */
108 #define SCTP_AUTH_CHUNK SCTP_AUTH_CHUNK
109 SCTP_HMAC_IDENT,
110 #define SCTP_HMAC_IDENT SCTP_HMAC_IDENT
111 SCTP_AUTH_KEY,
112 #define SCTP_AUTH_KEY SCTP_AUTH_KEY
113 SCTP_AUTH_ACTIVE_KEY,
114 #define SCTP_AUTH_ACTIVE_KEY SCTP_AUTH_ACTIVE_KEY
115 SCTP_AUTH_DELETE_KEY,
116 #define SCTP_AUTH_DELETE_KEY SCTP_AUTH_DELETE_KEY
117 SCTP_PEER_AUTH_CHUNKS, /* Read only */
118 #define SCTP_PEER_AUTH_CHUNKS SCTP_PEER_AUTH_CHUNKS
119 SCTP_LOCAL_AUTH_CHUNKS, /* Read only */
120 #define SCTP_LOCAL_AUTH_CHUNKS SCTP_LOCAL_AUTH_CHUNKS
121
122
123 /* Internal Socket Options. Some of the sctp library functions are
124 * implemented using these socket options.
125 */
126 SCTP_SOCKOPT_BINDX_ADD = 100,/* BINDX requests for adding addresses. */
127 #define SCTP_SOCKOPT_BINDX_ADD SCTP_SOCKOPT_BINDX_ADD
128 SCTP_SOCKOPT_BINDX_REM, /* BINDX requests for removing addresses. */
129 #define SCTP_SOCKOPT_BINDX_REM SCTP_SOCKOPT_BINDX_REM
130 SCTP_SOCKOPT_PEELOFF, /* peel off association. */
131 #define SCTP_SOCKOPT_PEELOFF SCTP_SOCKOPT_PEELOFF
132 SCTP_GET_PEER_ADDRS_NUM_OLD, /* Get number of peer addresss. */
133 #define SCTP_GET_PEER_ADDRS_NUM_OLD SCTP_GET_PEER_ADDRS_NUM_OLD
134 SCTP_GET_PEER_ADDRS_OLD, /* Get all peer addresss. */
135 #define SCTP_GET_PEER_ADDRS_OLD SCTP_GET_PEER_ADDRS_OLD
136 SCTP_GET_LOCAL_ADDRS_NUM_OLD, /* Get number of local addresss. */
137 #define SCTP_GET_LOCAL_ADDRS_NUM_OLD SCTP_GET_LOCAL_ADDRS_NUM_OLD
138 SCTP_GET_LOCAL_ADDRS_OLD, /* Get all local addresss. */
139 #define SCTP_GET_LOCAL_ADDRS_OLD SCTP_GET_LOCAL_ADDRS_OLD
140 SCTP_SOCKOPT_CONNECTX_OLD, /* CONNECTX old requests. */
141 #define SCTP_SOCKOPT_CONNECTX_OLD SCTP_SOCKOPT_CONNECTX_OLD
142 SCTP_GET_PEER_ADDRS, /* Get all peer addresss. */
143 #define SCTP_GET_PEER_ADDRS SCTP_GET_PEER_ADDRS
144 SCTP_GET_LOCAL_ADDRS, /* Get all local addresss. */
145 #define SCTP_GET_LOCAL_ADDRS SCTP_GET_LOCAL_ADDRS
146 SCTP_SOCKOPT_CONNECTX, /* CONNECTX requests. */
147 #define SCTP_SOCKOPT_CONNECTX SCTP_SOCKOPT_CONNECTX
148 };
149
150 /*
151 * 5.2.1 SCTP Initiation Structure (SCTP_INIT)
152 *
153 * This cmsghdr structure provides information for initializing new
154 * SCTP associations with sendmsg(). The SCTP_INITMSG socket option
155 * uses this same data structure. This structure is not used for
156 * recvmsg().
157 *
158 * cmsg_level cmsg_type cmsg_data[]
159 * ------------ ------------ ----------------------
160 * IPPROTO_SCTP SCTP_INIT struct sctp_initmsg
161 *
162 */
163 struct sctp_initmsg {
164 __u16 sinit_num_ostreams;
165 __u16 sinit_max_instreams;
166 __u16 sinit_max_attempts;
167 __u16 sinit_max_init_timeo;
168 };
169
170 /*
171 * 5.2.2 SCTP Header Information Structure (SCTP_SNDRCV)
172 *
173 * This cmsghdr structure specifies SCTP options for sendmsg() and
174 * describes SCTP header information about a received message through
175 * recvmsg().
176 *
177 * cmsg_level cmsg_type cmsg_data[]
178 * ------------ ------------ ----------------------
179 * IPPROTO_SCTP SCTP_SNDRCV struct sctp_sndrcvinfo
180 *
181 */
182 struct sctp_sndrcvinfo {
183 __u16 sinfo_stream;
184 __u16 sinfo_ssn;
185 __u16 sinfo_flags;
186 __u32 sinfo_ppid;
187 __u32 sinfo_context;
188 __u32 sinfo_timetolive;
189 __u32 sinfo_tsn;
190 __u32 sinfo_cumtsn;
191 sctp_assoc_t sinfo_assoc_id;
192 };
193
194 /*
195 * sinfo_flags: 16 bits (unsigned integer)
196 *
197 * This field may contain any of the following flags and is composed of
198 * a bitwise OR of these values.
199 */
200
201 enum sctp_sinfo_flags {
202 SCTP_UNORDERED = 1, /* Send/receive message unordered. */
203 SCTP_ADDR_OVER = 2, /* Override the primary destination. */
204 SCTP_ABORT=4, /* Send an ABORT message to the peer. */
205 SCTP_EOF=MSG_FIN, /* Initiate graceful shutdown process. */
206 };
207
208
209 typedef union {
210 __u8 raw;
211 struct sctp_initmsg init;
212 struct sctp_sndrcvinfo sndrcv;
213 } sctp_cmsg_data_t;
214
215 /* These are cmsg_types. */
216 typedef enum sctp_cmsg_type {
217 SCTP_INIT, /* 5.2.1 SCTP Initiation Structure */
218 SCTP_SNDRCV, /* 5.2.2 SCTP Header Information Structure */
219 } sctp_cmsg_t;
220
221
222 /*
223 * 5.3.1.1 SCTP_ASSOC_CHANGE
224 *
225 * Communication notifications inform the ULP that an SCTP association
226 * has either begun or ended. The identifier for a new association is
227 * provided by this notificaion. The notification information has the
228 * following format:
229 *
230 */
231 struct sctp_assoc_change {
232 __u16 sac_type;
233 __u16 sac_flags;
234 __u32 sac_length;
235 __u16 sac_state;
236 __u16 sac_error;
237 __u16 sac_outbound_streams;
238 __u16 sac_inbound_streams;
239 sctp_assoc_t sac_assoc_id;
240 __u8 sac_info[0];
241 };
242
243 /*
244 * sac_state: 32 bits (signed integer)
245 *
246 * This field holds one of a number of values that communicate the
247 * event that happened to the association. They include:
248 *
249 * Note: The following state names deviate from the API draft as
250 * the names clash too easily with other kernel symbols.
251 */
252 enum sctp_sac_state {
253 SCTP_COMM_UP,
254 SCTP_COMM_LOST,
255 SCTP_RESTART,
256 SCTP_SHUTDOWN_COMP,
257 SCTP_CANT_STR_ASSOC,
258 };
259
260 /*
261 * 5.3.1.2 SCTP_PEER_ADDR_CHANGE
262 *
263 * When a destination address on a multi-homed peer encounters a change
264 * an interface details event is sent. The information has the
265 * following structure:
266 */
267 struct sctp_paddr_change {
268 __u16 spc_type;
269 __u16 spc_flags;
270 __u32 spc_length;
271 struct sockaddr_storage spc_aaddr;
272 int spc_state;
273 int spc_error;
274 sctp_assoc_t spc_assoc_id;
275 } __attribute__((packed, aligned(4)));
276
277 /*
278 * spc_state: 32 bits (signed integer)
279 *
280 * This field holds one of a number of values that communicate the
281 * event that happened to the address. They include:
282 */
283 enum sctp_spc_state {
284 SCTP_ADDR_AVAILABLE,
285 SCTP_ADDR_UNREACHABLE,
286 SCTP_ADDR_REMOVED,
287 SCTP_ADDR_ADDED,
288 SCTP_ADDR_MADE_PRIM,
289 SCTP_ADDR_CONFIRMED,
290 };
291
292
293 /*
294 * 5.3.1.3 SCTP_REMOTE_ERROR
295 *
296 * A remote peer may send an Operational Error message to its peer.
297 * This message indicates a variety of error conditions on an
298 * association. The entire error TLV as it appears on the wire is
299 * included in a SCTP_REMOTE_ERROR event. Please refer to the SCTP
300 * specification [SCTP] and any extensions for a list of possible
301 * error formats. SCTP error TLVs have the format:
302 */
303 struct sctp_remote_error {
304 __u16 sre_type;
305 __u16 sre_flags;
306 __u32 sre_length;
307 __u16 sre_error;
308 sctp_assoc_t sre_assoc_id;
309 __u8 sre_data[0];
310 };
311
312
313 /*
314 * 5.3.1.4 SCTP_SEND_FAILED
315 *
316 * If SCTP cannot deliver a message it may return the message as a
317 * notification.
318 */
319 struct sctp_send_failed {
320 __u16 ssf_type;
321 __u16 ssf_flags;
322 __u32 ssf_length;
323 __u32 ssf_error;
324 struct sctp_sndrcvinfo ssf_info;
325 sctp_assoc_t ssf_assoc_id;
326 __u8 ssf_data[0];
327 };
328
329 /*
330 * ssf_flags: 16 bits (unsigned integer)
331 *
332 * The flag value will take one of the following values
333 *
334 * SCTP_DATA_UNSENT - Indicates that the data was never put on
335 * the wire.
336 *
337 * SCTP_DATA_SENT - Indicates that the data was put on the wire.
338 * Note that this does not necessarily mean that the
339 * data was (or was not) successfully delivered.
340 */
341 enum sctp_ssf_flags {
342 SCTP_DATA_UNSENT,
343 SCTP_DATA_SENT,
344 };
345
346 /*
347 * 5.3.1.5 SCTP_SHUTDOWN_EVENT
348 *
349 * When a peer sends a SHUTDOWN, SCTP delivers this notification to
350 * inform the application that it should cease sending data.
351 */
352 struct sctp_shutdown_event {
353 __u16 sse_type;
354 __u16 sse_flags;
355 __u32 sse_length;
356 sctp_assoc_t sse_assoc_id;
357 };
358
359 /*
360 * 5.3.1.6 SCTP_ADAPTATION_INDICATION
361 *
362 * When a peer sends a Adaptation Layer Indication parameter , SCTP
363 * delivers this notification to inform the application
364 * that of the peers requested adaptation layer.
365 */
366 struct sctp_adaptation_event {
367 __u16 sai_type;
368 __u16 sai_flags;
369 __u32 sai_length;
370 __u32 sai_adaptation_ind;
371 sctp_assoc_t sai_assoc_id;
372 };
373
374 /*
375 * 5.3.1.7 SCTP_PARTIAL_DELIVERY_EVENT
376 *
377 * When a receiver is engaged in a partial delivery of a
378 * message this notification will be used to indicate
379 * various events.
380 */
381 struct sctp_pdapi_event {
382 __u16 pdapi_type;
383 __u16 pdapi_flags;
384 __u32 pdapi_length;
385 __u32 pdapi_indication;
386 sctp_assoc_t pdapi_assoc_id;
387 };
388
389 enum { SCTP_PARTIAL_DELIVERY_ABORTED=0, };
390
391 struct sctp_authkey_event {
392 __u16 auth_type;
393 __u16 auth_flags;
394 __u32 auth_length;
395 __u16 auth_keynumber;
396 __u16 auth_altkeynumber;
397 __u32 auth_indication;
398 sctp_assoc_t auth_assoc_id;
399 };
400
401 enum { SCTP_AUTH_NEWKEY = 0, };
402
403
404 /*
405 * Described in Section 7.3
406 * Ancillary Data and Notification Interest Options
407 */
408 struct sctp_event_subscribe {
409 __u8 sctp_data_io_event;
410 __u8 sctp_association_event;
411 __u8 sctp_address_event;
412 __u8 sctp_send_failure_event;
413 __u8 sctp_peer_error_event;
414 __u8 sctp_shutdown_event;
415 __u8 sctp_partial_delivery_event;
416 __u8 sctp_adaptation_layer_event;
417 __u8 sctp_authentication_event;
418 };
419
420 /*
421 * 5.3.1 SCTP Notification Structure
422 *
423 * The notification structure is defined as the union of all
424 * notification types.
425 *
426 */
427 union sctp_notification {
428 struct {
429 __u16 sn_type; /* Notification type. */
430 __u16 sn_flags;
431 __u32 sn_length;
432 } sn_header;
433 struct sctp_assoc_change sn_assoc_change;
434 struct sctp_paddr_change sn_paddr_change;
435 struct sctp_remote_error sn_remote_error;
436 struct sctp_send_failed sn_send_failed;
437 struct sctp_shutdown_event sn_shutdown_event;
438 struct sctp_adaptation_event sn_adaptation_event;
439 struct sctp_pdapi_event sn_pdapi_event;
440 struct sctp_authkey_event sn_authkey_event;
441 };
442
443 /* Section 5.3.1
444 * All standard values for sn_type flags are greater than 2^15.
445 * Values from 2^15 and down are reserved.
446 */
447
448 enum sctp_sn_type {
449 SCTP_SN_TYPE_BASE = (1<<15),
450 SCTP_ASSOC_CHANGE,
451 SCTP_PEER_ADDR_CHANGE,
452 SCTP_SEND_FAILED,
453 SCTP_REMOTE_ERROR,
454 SCTP_SHUTDOWN_EVENT,
455 SCTP_PARTIAL_DELIVERY_EVENT,
456 SCTP_ADAPTATION_INDICATION,
457 SCTP_AUTHENTICATION_INDICATION,
458 };
459
460 /* Notification error codes used to fill up the error fields in some
461 * notifications.
462 * SCTP_PEER_ADDRESS_CHAGE : spc_error
463 * SCTP_ASSOC_CHANGE : sac_error
464 * These names should be potentially included in the draft 04 of the SCTP
465 * sockets API specification.
466 */
467 typedef enum sctp_sn_error {
468 SCTP_FAILED_THRESHOLD,
469 SCTP_RECEIVED_SACK,
470 SCTP_HEARTBEAT_SUCCESS,
471 SCTP_RESPONSE_TO_USER_REQ,
472 SCTP_INTERNAL_ERROR,
473 SCTP_SHUTDOWN_GUARD_EXPIRES,
474 SCTP_PEER_FAULTY,
475 } sctp_sn_error_t;
476
477 /*
478 * 7.1.1 Retransmission Timeout Parameters (SCTP_RTOINFO)
479 *
480 * The protocol parameters used to initialize and bound retransmission
481 * timeout (RTO) are tunable. See [SCTP] for more information on how
482 * these parameters are used in RTO calculation.
483 */
484 struct sctp_rtoinfo {
485 sctp_assoc_t srto_assoc_id;
486 __u32 srto_initial;
487 __u32 srto_max;
488 __u32 srto_min;
489 };
490
491 /*
492 * 7.1.2 Association Parameters (SCTP_ASSOCINFO)
493 *
494 * This option is used to both examine and set various association and
495 * endpoint parameters.
496 */
497 struct sctp_assocparams {
498 sctp_assoc_t sasoc_assoc_id;
499 __u16 sasoc_asocmaxrxt;
500 __u16 sasoc_number_peer_destinations;
501 __u32 sasoc_peer_rwnd;
502 __u32 sasoc_local_rwnd;
503 __u32 sasoc_cookie_life;
504 };
505
506 /*
507 * 7.1.9 Set Peer Primary Address (SCTP_SET_PEER_PRIMARY_ADDR)
508 *
509 * Requests that the peer mark the enclosed address as the association
510 * primary. The enclosed address must be one of the association's
511 * locally bound addresses. The following structure is used to make a
512 * set primary request:
513 */
514 struct sctp_setpeerprim {
515 sctp_assoc_t sspp_assoc_id;
516 struct sockaddr_storage sspp_addr;
517 } __attribute__((packed, aligned(4)));
518
519 /*
520 * 7.1.10 Set Primary Address (SCTP_PRIMARY_ADDR)
521 *
522 * Requests that the local SCTP stack use the enclosed peer address as
523 * the association primary. The enclosed address must be one of the
524 * association peer's addresses. The following structure is used to
525 * make a set peer primary request:
526 */
527 struct sctp_prim {
528 sctp_assoc_t ssp_assoc_id;
529 struct sockaddr_storage ssp_addr;
530 } __attribute__((packed, aligned(4)));
531
532 /*
533 * 7.1.11 Set Adaptation Layer Indicator (SCTP_ADAPTATION_LAYER)
534 *
535 * Requests that the local endpoint set the specified Adaptation Layer
536 * Indication parameter for all future INIT and INIT-ACK exchanges.
537 */
538 struct sctp_setadaptation {
539 __u32 ssb_adaptation_ind;
540 };
541
542 /*
543 * 7.1.13 Peer Address Parameters (SCTP_PEER_ADDR_PARAMS)
544 *
545 * Applications can enable or disable heartbeats for any peer address
546 * of an association, modify an address's heartbeat interval, force a
547 * heartbeat to be sent immediately, and adjust the address's maximum
548 * number of retransmissions sent before an address is considered
549 * unreachable. The following structure is used to access and modify an
550 * address's parameters:
551 */
552 enum sctp_spp_flags {
553 SPP_HB_ENABLE = 1<<0, /*Enable heartbeats*/
554 SPP_HB_DISABLE = 1<<1, /*Disable heartbeats*/
555 SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE,
556 SPP_HB_DEMAND = 1<<2, /*Send heartbeat immediately*/
557 SPP_PMTUD_ENABLE = 1<<3, /*Enable PMTU discovery*/
558 SPP_PMTUD_DISABLE = 1<<4, /*Disable PMTU discovery*/
559 SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE,
560 SPP_SACKDELAY_ENABLE = 1<<5, /*Enable SACK*/
561 SPP_SACKDELAY_DISABLE = 1<<6, /*Disable SACK*/
562 SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE,
563 SPP_HB_TIME_IS_ZERO = 1<<7, /* Set HB delay to 0 */
564 };
565
566 struct sctp_paddrparams {
567 sctp_assoc_t spp_assoc_id;
568 struct sockaddr_storage spp_address;
569 __u32 spp_hbinterval;
570 __u16 spp_pathmaxrxt;
571 __u32 spp_pathmtu;
572 __u32 spp_sackdelay;
573 __u32 spp_flags;
574 } __attribute__((packed, aligned(4)));
575
576 /*
577 * 7.1.18. Add a chunk that must be authenticated (SCTP_AUTH_CHUNK)
578 *
579 * This set option adds a chunk type that the user is requesting to be
580 * received only in an authenticated way. Changes to the list of chunks
581 * will only effect future associations on the socket.
582 */
583 struct sctp_authchunk {
584 __u8 sauth_chunk;
585 };
586
587 /*
588 * 7.1.19. Get or set the list of supported HMAC Identifiers (SCTP_HMAC_IDENT)
589 *
590 * This option gets or sets the list of HMAC algorithms that the local
591 * endpoint requires the peer to use.
592 */
593 struct sctp_hmacalgo {
594 __u32 shmac_num_idents;
595 __u16 shmac_idents[];
596 };
597
598 /*
599 * 7.1.20. Set a shared key (SCTP_AUTH_KEY)
600 *
601 * This option will set a shared secret key which is used to build an
602 * association shared key.
603 */
604 struct sctp_authkey {
605 sctp_assoc_t sca_assoc_id;
606 __u16 sca_keynumber;
607 __u16 sca_keylength;
608 __u8 sca_key[];
609 };
610
611 /*
612 * 7.1.21. Get or set the active shared key (SCTP_AUTH_ACTIVE_KEY)
613 *
614 * This option will get or set the active shared key to be used to build
615 * the association shared key.
616 */
617
618 struct sctp_authkeyid {
619 sctp_assoc_t scact_assoc_id;
620 __u16 scact_keynumber;
621 };
622
623
624 /*
625 * 7.1.23. Get or set delayed ack timer (SCTP_DELAYED_SACK)
626 *
627 * This option will effect the way delayed acks are performed. This
628 * option allows you to get or set the delayed ack time, in
629 * milliseconds. It also allows changing the delayed ack frequency.
630 * Changing the frequency to 1 disables the delayed sack algorithm. If
631 * the assoc_id is 0, then this sets or gets the endpoints default
632 * values. If the assoc_id field is non-zero, then the set or get
633 * effects the specified association for the one to many model (the
634 * assoc_id field is ignored by the one to one model). Note that if
635 * sack_delay or sack_freq are 0 when setting this option, then the
636 * current values will remain unchanged.
637 */
638 struct sctp_sack_info {
639 sctp_assoc_t sack_assoc_id;
640 uint32_t sack_delay;
641 uint32_t sack_freq;
642 };
643
644 struct sctp_assoc_value {
645 sctp_assoc_t assoc_id;
646 uint32_t assoc_value;
647 };
648
649 /*
650 * 7.2.2 Peer Address Information
651 *
652 * Applications can retrieve information about a specific peer address
653 * of an association, including its reachability state, congestion
654 * window, and retransmission timer values. This information is
655 * read-only. The following structure is used to access this
656 * information:
657 */
658 struct sctp_paddrinfo {
659 sctp_assoc_t spinfo_assoc_id;
660 struct sockaddr_storage spinfo_address;
661 __s32 spinfo_state;
662 __u32 spinfo_cwnd;
663 __u32 spinfo_srtt;
664 __u32 spinfo_rto;
665 __u32 spinfo_mtu;
666 } __attribute__((packed, aligned(4)));
667
668 /* Peer addresses's state. */
669 /* UNKNOWN: Peer address passed by the upper layer in sendmsg or connect[x]
670 * calls.
671 * UNCONFIRMED: Peer address received in INIT/INIT-ACK address parameters.
672 * Not yet confirmed by a heartbeat and not available for data
673 * transfers.
674 * ACTIVE : Peer address confirmed, active and available for data transfers.
675 * INACTIVE: Peer address inactive and not available for data transfers.
676 */
677 enum sctp_spinfo_state {
678 SCTP_INACTIVE,
679 SCTP_ACTIVE,
680 SCTP_UNCONFIRMED,
681 SCTP_UNKNOWN = 0xffff /* Value used for transport state unknown */
682 };
683
684 /*
685 * 7.2.1 Association Status (SCTP_STATUS)
686 *
687 * Applications can retrieve current status information about an
688 * association, including association state, peer receiver window size,
689 * number of unacked data chunks, and number of data chunks pending
690 * receipt. This information is read-only. The following structure is
691 * used to access this information:
692 */
693 struct sctp_status {
694 sctp_assoc_t sstat_assoc_id;
695 __s32 sstat_state;
696 __u32 sstat_rwnd;
697 __u16 sstat_unackdata;
698 __u16 sstat_penddata;
699 __u16 sstat_instrms;
700 __u16 sstat_outstrms;
701 __u32 sstat_fragmentation_point;
702 struct sctp_paddrinfo sstat_primary;
703 };
704
705 /*
706 * 7.2.3. Get the list of chunks the peer requires to be authenticated
707 * (SCTP_PEER_AUTH_CHUNKS)
708 *
709 * This option gets a list of chunks for a specified association that
710 * the peer requires to be received authenticated only.
711 */
712 struct sctp_authchunks {
713 sctp_assoc_t gauth_assoc_id;
714 __u32 gauth_number_of_chunks;
715 uint8_t gauth_chunks[];
716 };
717
718 /*
719 * 8.3, 8.5 get all peer/local addresses in an association.
720 * This parameter struct is used by SCTP_GET_PEER_ADDRS and
721 * SCTP_GET_LOCAL_ADDRS socket options used internally to implement
722 * sctp_getpaddrs() and sctp_getladdrs() API.
723 */
724 struct sctp_getaddrs_old {
725 sctp_assoc_t assoc_id;
726 int addr_num;
727 struct sockaddr __user *addrs;
728 };
729 struct sctp_getaddrs {
730 sctp_assoc_t assoc_id; /*input*/
731 __u32 addr_num; /*output*/
732 __u8 addrs[0]; /*output, variable size*/
733 };
734
735 /* These are bit fields for msghdr->msg_flags. See section 5.1. */
736 /* On user space Linux, these live in <bits/socket.h> as an enum. */
737 enum sctp_msg_flags {
738 MSG_NOTIFICATION = 0x8000,
739 #define MSG_NOTIFICATION MSG_NOTIFICATION
740 };
741
742 /*
743 * 8.1 sctp_bindx()
744 *
745 * The flags parameter is formed from the bitwise OR of zero or more of the
746 * following currently defined flags:
747 */
748 #define SCTP_BINDX_ADD_ADDR 0x01
749 #define SCTP_BINDX_REM_ADDR 0x02
750
751 /* This is the structure that is passed as an argument(optval) to
752 * getsockopt(SCTP_SOCKOPT_PEELOFF).
753 */
754 typedef struct {
755 sctp_assoc_t associd;
756 int sd;
757 } sctp_peeloff_arg_t;
758
759 #endif /* __net_sctp_user_h__ */
This page took 0.04565 seconds and 5 git commands to generate.