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