xref: /freebsd/sys/netinet/sctp_uio.h (revision c3179e66)
1f8829a4aSRandall Stewart /*-
251369649SPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
351369649SPedro F. Giffuni  *
4b1006367SRandall Stewart  * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
5807aad63SMichael Tuexen  * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved.
6807aad63SMichael Tuexen  * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved.
7f8829a4aSRandall Stewart  *
8f8829a4aSRandall Stewart  * Redistribution and use in source and binary forms, with or without
9f8829a4aSRandall Stewart  * modification, are permitted provided that the following conditions are met:
10f8829a4aSRandall Stewart  *
11f8829a4aSRandall Stewart  * a) Redistributions of source code must retain the above copyright notice,
12f8829a4aSRandall Stewart  *    this list of conditions and the following disclaimer.
13f8829a4aSRandall Stewart  *
14f8829a4aSRandall Stewart  * b) Redistributions in binary form must reproduce the above copyright
15f8829a4aSRandall Stewart  *    notice, this list of conditions and the following disclaimer in
16f8829a4aSRandall Stewart  *    the documentation and/or other materials provided with the distribution.
17f8829a4aSRandall Stewart  *
18f8829a4aSRandall Stewart  * c) Neither the name of Cisco Systems, Inc. nor the names of its
19f8829a4aSRandall Stewart  *    contributors may be used to endorse or promote products derived
20f8829a4aSRandall Stewart  *    from this software without specific prior written permission.
21f8829a4aSRandall Stewart  *
22f8829a4aSRandall Stewart  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23f8829a4aSRandall Stewart  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
24f8829a4aSRandall Stewart  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25f8829a4aSRandall Stewart  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26f8829a4aSRandall Stewart  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27f8829a4aSRandall Stewart  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28f8829a4aSRandall Stewart  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29f8829a4aSRandall Stewart  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30f8829a4aSRandall Stewart  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31f8829a4aSRandall Stewart  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
32f8829a4aSRandall Stewart  * THE POSSIBILITY OF SUCH DAMAGE.
33f8829a4aSRandall Stewart  */
34f8829a4aSRandall Stewart 
35807aad63SMichael Tuexen #ifndef _NETINET_SCTP_UIO_H_
36807aad63SMichael Tuexen #define _NETINET_SCTP_UIO_H_
37f8829a4aSRandall Stewart 
38f8829a4aSRandall Stewart #if !defined(_KERNEL)
39f8829a4aSRandall Stewart #include <stdint.h>
40f8829a4aSRandall Stewart #endif
41f8829a4aSRandall Stewart #include <sys/types.h>
42f8829a4aSRandall Stewart #include <sys/socket.h>
4303b0b021SRandall Stewart #include <netinet/in.h>
44f8829a4aSRandall Stewart 
45f8829a4aSRandall Stewart typedef uint32_t sctp_assoc_t;
46f8829a4aSRandall Stewart 
47e2e7c62eSMichael Tuexen #define SCTP_FUTURE_ASSOC  0
48e2e7c62eSMichael Tuexen #define SCTP_CURRENT_ASSOC 1
49e2e7c62eSMichael Tuexen #define SCTP_ALL_ASSOC     2
50e2e7c62eSMichael Tuexen 
51e2e7c62eSMichael Tuexen struct sctp_event {
52e2e7c62eSMichael Tuexen 	sctp_assoc_t se_assoc_id;
53e2e7c62eSMichael Tuexen 	uint16_t se_type;
54e2e7c62eSMichael Tuexen 	uint8_t se_on;
55e2e7c62eSMichael Tuexen };
56e2e7c62eSMichael Tuexen 
57a10c3242SRandall Stewart /* Compatibility to previous define's */
58a10c3242SRandall Stewart #define sctp_stream_reset_events sctp_stream_reset_event
59a10c3242SRandall Stewart 
60f8829a4aSRandall Stewart /* On/Off setup for subscription to events */
61f8829a4aSRandall Stewart struct sctp_event_subscribe {
62f8829a4aSRandall Stewart 	uint8_t sctp_data_io_event;
63f8829a4aSRandall Stewart 	uint8_t sctp_association_event;
64f8829a4aSRandall Stewart 	uint8_t sctp_address_event;
65f8829a4aSRandall Stewart 	uint8_t sctp_send_failure_event;
66f8829a4aSRandall Stewart 	uint8_t sctp_peer_error_event;
67f8829a4aSRandall Stewart 	uint8_t sctp_shutdown_event;
68f8829a4aSRandall Stewart 	uint8_t sctp_partial_delivery_event;
69f8829a4aSRandall Stewart 	uint8_t sctp_adaptation_layer_event;
70f8829a4aSRandall Stewart 	uint8_t sctp_authentication_event;
71830d754dSRandall Stewart 	uint8_t sctp_sender_dry_event;
72a10c3242SRandall Stewart 	uint8_t sctp_stream_reset_event;
73f8829a4aSRandall Stewart };
74f8829a4aSRandall Stewart 
75f8829a4aSRandall Stewart /* ancillary data types */
76f8829a4aSRandall Stewart #define SCTP_INIT	0x0001
77f8829a4aSRandall Stewart #define SCTP_SNDRCV	0x0002
78f8829a4aSRandall Stewart #define SCTP_EXTRCV	0x0003
79e2e7c62eSMichael Tuexen #define SCTP_SNDINFO    0x0004
80e2e7c62eSMichael Tuexen #define SCTP_RCVINFO    0x0005
81e2e7c62eSMichael Tuexen #define SCTP_NXTINFO    0x0006
82e2e7c62eSMichael Tuexen #define SCTP_PRINFO     0x0007
83e2e7c62eSMichael Tuexen #define SCTP_AUTHINFO   0x0008
84e2e7c62eSMichael Tuexen #define SCTP_DSTADDRV4  0x0009
85e2e7c62eSMichael Tuexen #define SCTP_DSTADDRV6  0x000a
86e2e7c62eSMichael Tuexen 
87f8829a4aSRandall Stewart /*
88f8829a4aSRandall Stewart  * ancillary data structures
89f8829a4aSRandall Stewart  */
90f8829a4aSRandall Stewart struct sctp_initmsg {
91667d2d3cSRandall Stewart 	uint16_t sinit_num_ostreams;
92667d2d3cSRandall Stewart 	uint16_t sinit_max_instreams;
93f8829a4aSRandall Stewart 	uint16_t sinit_max_attempts;
94f8829a4aSRandall Stewart 	uint16_t sinit_max_init_timeo;
95f8829a4aSRandall Stewart };
96f8829a4aSRandall Stewart 
97f8829a4aSRandall Stewart /* We add 96 bytes to the size of sctp_sndrcvinfo.
98f8829a4aSRandall Stewart  * This makes the current structure 128 bytes long
99f8829a4aSRandall Stewart  * which is nicely 64 bit aligned but also has room
100b1ce21c6SRebecca Cran  * for us to add more and keep ABI compatibility.
101f8829a4aSRandall Stewart  * For example, already we have the sctp_extrcvinfo
102f8829a4aSRandall Stewart  * when enabled which is 48 bytes.
103f8829a4aSRandall Stewart  */
104f8829a4aSRandall Stewart 
105f42a358aSRandall Stewart /*
106f42a358aSRandall Stewart  * The assoc up needs a verfid
107f42a358aSRandall Stewart  * all sendrcvinfo's need a verfid for SENDING only.
108f42a358aSRandall Stewart  */
109f42a358aSRandall Stewart 
110e2e7c62eSMichael Tuexen #define SCTP_ALIGN_RESV_PAD 92
111e2e7c62eSMichael Tuexen #define SCTP_ALIGN_RESV_PAD_SHORT 76
112f8829a4aSRandall Stewart 
113f8829a4aSRandall Stewart struct sctp_sndrcvinfo {
114f8829a4aSRandall Stewart 	uint16_t sinfo_stream;
115f8829a4aSRandall Stewart 	uint16_t sinfo_ssn;
116f8829a4aSRandall Stewart 	uint16_t sinfo_flags;
117f8829a4aSRandall Stewart 	uint32_t sinfo_ppid;
118f8829a4aSRandall Stewart 	uint32_t sinfo_context;
119f8829a4aSRandall Stewart 	uint32_t sinfo_timetolive;
120f8829a4aSRandall Stewart 	uint32_t sinfo_tsn;
121f8829a4aSRandall Stewart 	uint32_t sinfo_cumtsn;
122f8829a4aSRandall Stewart 	sctp_assoc_t sinfo_assoc_id;
123e2e7c62eSMichael Tuexen 	uint16_t sinfo_keynumber;
124e2e7c62eSMichael Tuexen 	uint16_t sinfo_keynumber_valid;
125f8829a4aSRandall Stewart 	uint8_t __reserve_pad[SCTP_ALIGN_RESV_PAD];
126f8829a4aSRandall Stewart };
127f8829a4aSRandall Stewart 
128f8829a4aSRandall Stewart struct sctp_extrcvinfo {
12963981c2bSRandall Stewart 	uint16_t sinfo_stream;
13063981c2bSRandall Stewart 	uint16_t sinfo_ssn;
13163981c2bSRandall Stewart 	uint16_t sinfo_flags;
13263981c2bSRandall Stewart 	uint32_t sinfo_ppid;
13363981c2bSRandall Stewart 	uint32_t sinfo_context;
134179f731bSMichael Tuexen 	uint32_t sinfo_timetolive;	/* should have been sinfo_pr_value */
13563981c2bSRandall Stewart 	uint32_t sinfo_tsn;
13663981c2bSRandall Stewart 	uint32_t sinfo_cumtsn;
13763981c2bSRandall Stewart 	sctp_assoc_t sinfo_assoc_id;
138b70b526dSMichael Tuexen 	uint16_t serinfo_next_flags;
139b70b526dSMichael Tuexen 	uint16_t serinfo_next_stream;
140b70b526dSMichael Tuexen 	uint32_t serinfo_next_aid;
141b70b526dSMichael Tuexen 	uint32_t serinfo_next_length;
142b70b526dSMichael Tuexen 	uint32_t serinfo_next_ppid;
143e2e7c62eSMichael Tuexen 	uint16_t sinfo_keynumber;
144e2e7c62eSMichael Tuexen 	uint16_t sinfo_keynumber_valid;
145f42a358aSRandall Stewart 	uint8_t __reserve_pad[SCTP_ALIGN_RESV_PAD_SHORT];
146f8829a4aSRandall Stewart };
147179f731bSMichael Tuexen #define sinfo_pr_value sinfo_timetolive
148b70b526dSMichael Tuexen #define sreinfo_next_flags serinfo_next_flags
149b70b526dSMichael Tuexen #define sreinfo_next_stream serinfo_next_stream
150b70b526dSMichael Tuexen #define sreinfo_next_aid serinfo_next_aid
151b70b526dSMichael Tuexen #define sreinfo_next_length serinfo_next_length
152b70b526dSMichael Tuexen #define sreinfo_next_ppid serinfo_next_ppid
153b70b526dSMichael Tuexen 
154e2e7c62eSMichael Tuexen struct sctp_sndinfo {
155e2e7c62eSMichael Tuexen 	uint16_t snd_sid;
156e2e7c62eSMichael Tuexen 	uint16_t snd_flags;
157e2e7c62eSMichael Tuexen 	uint32_t snd_ppid;
158e2e7c62eSMichael Tuexen 	uint32_t snd_context;
159e2e7c62eSMichael Tuexen 	sctp_assoc_t snd_assoc_id;
160e2e7c62eSMichael Tuexen };
161e2e7c62eSMichael Tuexen 
162e2e7c62eSMichael Tuexen struct sctp_prinfo {
163e2e7c62eSMichael Tuexen 	uint16_t pr_policy;
164e2e7c62eSMichael Tuexen 	uint32_t pr_value;
165e2e7c62eSMichael Tuexen };
166e2e7c62eSMichael Tuexen 
1676037f89cSMichael Tuexen struct sctp_default_prinfo {
1686037f89cSMichael Tuexen 	uint16_t pr_policy;
1696037f89cSMichael Tuexen 	uint32_t pr_value;
1706037f89cSMichael Tuexen 	sctp_assoc_t pr_assoc_id;
1716037f89cSMichael Tuexen };
1726037f89cSMichael Tuexen 
173e2e7c62eSMichael Tuexen struct sctp_authinfo {
174254945d7SMichael Tuexen 	uint16_t auth_keynumber;
175e2e7c62eSMichael Tuexen };
176e2e7c62eSMichael Tuexen 
177e2e7c62eSMichael Tuexen struct sctp_rcvinfo {
178e2e7c62eSMichael Tuexen 	uint16_t rcv_sid;
179e2e7c62eSMichael Tuexen 	uint16_t rcv_ssn;
180e2e7c62eSMichael Tuexen 	uint16_t rcv_flags;
181e2e7c62eSMichael Tuexen 	uint32_t rcv_ppid;
182e2e7c62eSMichael Tuexen 	uint32_t rcv_tsn;
183e2e7c62eSMichael Tuexen 	uint32_t rcv_cumtsn;
184e2e7c62eSMichael Tuexen 	uint32_t rcv_context;
185e2e7c62eSMichael Tuexen 	sctp_assoc_t rcv_assoc_id;
186e2e7c62eSMichael Tuexen };
187e2e7c62eSMichael Tuexen 
188e2e7c62eSMichael Tuexen struct sctp_nxtinfo {
189e2e7c62eSMichael Tuexen 	uint16_t nxt_sid;
190e2e7c62eSMichael Tuexen 	uint16_t nxt_flags;
191e2e7c62eSMichael Tuexen 	uint32_t nxt_ppid;
192e2e7c62eSMichael Tuexen 	uint32_t nxt_length;
193e2e7c62eSMichael Tuexen 	sctp_assoc_t nxt_assoc_id;
194e2e7c62eSMichael Tuexen };
195e2e7c62eSMichael Tuexen 
196f8829a4aSRandall Stewart #define SCTP_NO_NEXT_MSG           0x0000
197f8829a4aSRandall Stewart #define SCTP_NEXT_MSG_AVAIL        0x0001
198f8829a4aSRandall Stewart #define SCTP_NEXT_MSG_ISCOMPLETE   0x0002
199f8829a4aSRandall Stewart #define SCTP_NEXT_MSG_IS_UNORDERED 0x0004
200f42a358aSRandall Stewart #define SCTP_NEXT_MSG_IS_NOTIFICATION 0x0008
201f8829a4aSRandall Stewart 
202e2e7c62eSMichael Tuexen struct sctp_recvv_rn {
203e2e7c62eSMichael Tuexen 	struct sctp_rcvinfo recvv_rcvinfo;
204e2e7c62eSMichael Tuexen 	struct sctp_nxtinfo recvv_nxtinfo;
205e2e7c62eSMichael Tuexen };
206e2e7c62eSMichael Tuexen 
207e2e7c62eSMichael Tuexen #define SCTP_RECVV_NOINFO  0
208e2e7c62eSMichael Tuexen #define SCTP_RECVV_RCVINFO 1
209e2e7c62eSMichael Tuexen #define SCTP_RECVV_NXTINFO 2
210e2e7c62eSMichael Tuexen #define SCTP_RECVV_RN      3
211e2e7c62eSMichael Tuexen 
2120b064106SMichael Tuexen #define SCTP_SENDV_NOINFO   0
213e2e7c62eSMichael Tuexen #define SCTP_SENDV_SNDINFO  1
214e2e7c62eSMichael Tuexen #define SCTP_SENDV_PRINFO   2
215e2e7c62eSMichael Tuexen #define SCTP_SENDV_AUTHINFO 3
216e2e7c62eSMichael Tuexen #define SCTP_SENDV_SPA      4
217e2e7c62eSMichael Tuexen 
218e2e7c62eSMichael Tuexen struct sctp_sendv_spa {
219e2e7c62eSMichael Tuexen 	uint32_t sendv_flags;
220e2e7c62eSMichael Tuexen 	struct sctp_sndinfo sendv_sndinfo;
221e2e7c62eSMichael Tuexen 	struct sctp_prinfo sendv_prinfo;
222e2e7c62eSMichael Tuexen 	struct sctp_authinfo sendv_authinfo;
223e2e7c62eSMichael Tuexen };
224e2e7c62eSMichael Tuexen 
225e2e7c62eSMichael Tuexen #define SCTP_SEND_SNDINFO_VALID  0x00000001
226e2e7c62eSMichael Tuexen #define SCTP_SEND_PRINFO_VALID   0x00000002
227e2e7c62eSMichael Tuexen #define SCTP_SEND_AUTHINFO_VALID 0x00000004
228e2e7c62eSMichael Tuexen 
229f8829a4aSRandall Stewart struct sctp_snd_all_completes {
230f8829a4aSRandall Stewart 	uint16_t sall_stream;
231f8829a4aSRandall Stewart 	uint16_t sall_flags;
232f8829a4aSRandall Stewart 	uint32_t sall_ppid;
233f8829a4aSRandall Stewart 	uint32_t sall_context;
234f8829a4aSRandall Stewart 	uint32_t sall_num_sent;
235f8829a4aSRandall Stewart 	uint32_t sall_num_failed;
236f8829a4aSRandall Stewart };
237f8829a4aSRandall Stewart 
238f8829a4aSRandall Stewart /* Flags that go into the sinfo->sinfo_flags field */
239e2e7c62eSMichael Tuexen #define SCTP_NOTIFICATION     0x0010	/* next message is a notification */
240e2e7c62eSMichael Tuexen #define SCTP_COMPLETE         0x0020	/* next message is complete */
241f8829a4aSRandall Stewart #define SCTP_EOF              0x0100	/* Start shutdown procedures */
242f8829a4aSRandall Stewart #define SCTP_ABORT            0x0200	/* Send an ABORT to peer */
243f8829a4aSRandall Stewart #define SCTP_UNORDERED        0x0400	/* Message is un-ordered */
244f8829a4aSRandall Stewart #define SCTP_ADDR_OVER        0x0800	/* Override the primary-address */
245f8829a4aSRandall Stewart #define SCTP_SENDALL          0x1000	/* Send this on all associations */
246f8829a4aSRandall Stewart #define SCTP_EOR              0x2000	/* end of message signal */
247830d754dSRandall Stewart #define SCTP_SACK_IMMEDIATELY 0x4000	/* Set I-Bit */
2482afb3e84SRandall Stewart 
249e2e7c62eSMichael Tuexen #define INVALID_SINFO_FLAG(x) (((x) & 0xfffffff0 \
25044b7479bSRandall Stewart                                     & ~(SCTP_EOF | SCTP_ABORT | SCTP_UNORDERED |\
251830d754dSRandall Stewart 				        SCTP_ADDR_OVER | SCTP_SENDALL | SCTP_EOR |\
252830d754dSRandall Stewart 					SCTP_SACK_IMMEDIATELY)) != 0)
253f8829a4aSRandall Stewart /* for the endpoint */
254f8829a4aSRandall Stewart 
255f0396ad1SMichael Tuexen /* The lower four bits is an enumeration of PR-SCTP policies */
2563c4401ecSMichael Tuexen #define SCTP_PR_SCTP_NONE 0x0000	/* Reliable transfer */
257f8829a4aSRandall Stewart #define SCTP_PR_SCTP_TTL  0x0001	/* Time based PR-SCTP */
258487e2e65SMichael Tuexen #define SCTP_PR_SCTP_PRIO 0x0002	/* Buffer based PR-SCTP */
259487e2e65SMichael Tuexen #define SCTP_PR_SCTP_BUF  SCTP_PR_SCTP_PRIO	/* For backwards compatibility */
2600053ed28SMichael Tuexen #define SCTP_PR_SCTP_RTX  0x0003	/* Number of retransmissions based
2610053ed28SMichael Tuexen 					 * PR-SCTP */
262f0396ad1SMichael Tuexen #define SCTP_PR_SCTP_MAX  SCTP_PR_SCTP_RTX
263f0396ad1SMichael Tuexen #define SCTP_PR_SCTP_ALL  0x000f	/* Used for aggregated stats */
264f8829a4aSRandall Stewart 
265e2e7c62eSMichael Tuexen #define PR_SCTP_POLICY(x)         ((x) & 0x0f)
266f0396ad1SMichael Tuexen #define PR_SCTP_ENABLED(x)        ((PR_SCTP_POLICY(x) != SCTP_PR_SCTP_NONE) && \
267f0396ad1SMichael Tuexen                                    (PR_SCTP_POLICY(x) != SCTP_PR_SCTP_ALL))
268f8829a4aSRandall Stewart #define PR_SCTP_TTL_ENABLED(x)    (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_TTL)
269f8829a4aSRandall Stewart #define PR_SCTP_BUF_ENABLED(x)    (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_BUF)
270f8829a4aSRandall Stewart #define PR_SCTP_RTX_ENABLED(x)    (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_RTX)
271f0396ad1SMichael Tuexen #define PR_SCTP_INVALID_POLICY(x) (PR_SCTP_POLICY(x) > SCTP_PR_SCTP_MAX)
272f0396ad1SMichael Tuexen #define PR_SCTP_VALID_POLICY(x)   (PR_SCTP_POLICY(x) <= SCTP_PR_SCTP_MAX)
273f0396ad1SMichael Tuexen 
274f8829a4aSRandall Stewart /* Stat's */
275f8829a4aSRandall Stewart struct sctp_pcbinfo {
276f8829a4aSRandall Stewart 	uint32_t ep_count;
277f8829a4aSRandall Stewart 	uint32_t asoc_count;
278f8829a4aSRandall Stewart 	uint32_t laddr_count;
279f8829a4aSRandall Stewart 	uint32_t raddr_count;
280f8829a4aSRandall Stewart 	uint32_t chk_count;
281f8829a4aSRandall Stewart 	uint32_t readq_count;
282f8829a4aSRandall Stewart 	uint32_t free_chunks;
283f8829a4aSRandall Stewart 	uint32_t stream_oque;
284f8829a4aSRandall Stewart };
285f8829a4aSRandall Stewart 
286f8829a4aSRandall Stewart struct sctp_sockstat {
287f8829a4aSRandall Stewart 	sctp_assoc_t ss_assoc_id;
288f8829a4aSRandall Stewart 	uint32_t ss_total_sndbuf;
289f8829a4aSRandall Stewart 	uint32_t ss_total_recv_buf;
290f8829a4aSRandall Stewart };
291f8829a4aSRandall Stewart 
292f8829a4aSRandall Stewart /*
293f8829a4aSRandall Stewart  * notification event structures
294f8829a4aSRandall Stewart  */
295f8829a4aSRandall Stewart 
296f8829a4aSRandall Stewart /*
297f8829a4aSRandall Stewart  * association change event
298f8829a4aSRandall Stewart  */
299f8829a4aSRandall Stewart struct sctp_assoc_change {
300f8829a4aSRandall Stewart 	uint16_t sac_type;
301f8829a4aSRandall Stewart 	uint16_t sac_flags;
302f8829a4aSRandall Stewart 	uint32_t sac_length;
303f8829a4aSRandall Stewart 	uint16_t sac_state;
304f8829a4aSRandall Stewart 	uint16_t sac_error;
305f8829a4aSRandall Stewart 	uint16_t sac_outbound_streams;
306f8829a4aSRandall Stewart 	uint16_t sac_inbound_streams;
307f8829a4aSRandall Stewart 	sctp_assoc_t sac_assoc_id;
308e06b67c7SMichael Tuexen 	uint8_t sac_info[];
309f8829a4aSRandall Stewart };
310f8829a4aSRandall Stewart 
311f8829a4aSRandall Stewart /* sac_state values */
312f8829a4aSRandall Stewart #define SCTP_COMM_UP            0x0001
313f8829a4aSRandall Stewart #define SCTP_COMM_LOST          0x0002
314f8829a4aSRandall Stewart #define SCTP_RESTART            0x0003
315f8829a4aSRandall Stewart #define SCTP_SHUTDOWN_COMP      0x0004
316f8829a4aSRandall Stewart #define SCTP_CANT_STR_ASSOC     0x0005
317f8829a4aSRandall Stewart 
318e06b67c7SMichael Tuexen /* sac_info values */
319e06b67c7SMichael Tuexen #define SCTP_ASSOC_SUPPORTS_PR			0x01
320e06b67c7SMichael Tuexen #define SCTP_ASSOC_SUPPORTS_AUTH		0x02
321e06b67c7SMichael Tuexen #define SCTP_ASSOC_SUPPORTS_ASCONF		0x03
322e06b67c7SMichael Tuexen #define SCTP_ASSOC_SUPPORTS_MULTIBUF		0x04
323e06b67c7SMichael Tuexen #define SCTP_ASSOC_SUPPORTS_RE_CONFIG		0x05
32444249214SRandall Stewart #define SCTP_ASSOC_SUPPORTS_INTERLEAVING	0x06
32544249214SRandall Stewart #define SCTP_ASSOC_SUPPORTS_MAX			0x06
326f8829a4aSRandall Stewart /*
327f8829a4aSRandall Stewart  * Address event
328f8829a4aSRandall Stewart  */
329f8829a4aSRandall Stewart struct sctp_paddr_change {
330f8829a4aSRandall Stewart 	uint16_t spc_type;
331f8829a4aSRandall Stewart 	uint16_t spc_flags;
332f8829a4aSRandall Stewart 	uint32_t spc_length;
333f8829a4aSRandall Stewart 	struct sockaddr_storage spc_aaddr;
334f8829a4aSRandall Stewart 	uint32_t spc_state;
335f8829a4aSRandall Stewart 	uint32_t spc_error;
336f8829a4aSRandall Stewart 	sctp_assoc_t spc_assoc_id;
337f8829a4aSRandall Stewart };
338f8829a4aSRandall Stewart 
339f8829a4aSRandall Stewart /* paddr state values */
340f8829a4aSRandall Stewart #define SCTP_ADDR_AVAILABLE	0x0001
341f8829a4aSRandall Stewart #define SCTP_ADDR_UNREACHABLE	0x0002
342f8829a4aSRandall Stewart #define SCTP_ADDR_REMOVED	0x0003
343f8829a4aSRandall Stewart #define SCTP_ADDR_ADDED		0x0004
344f8829a4aSRandall Stewart #define SCTP_ADDR_MADE_PRIM	0x0005
345f8829a4aSRandall Stewart #define SCTP_ADDR_CONFIRMED	0x0006
346f8829a4aSRandall Stewart 
347f8829a4aSRandall Stewart #define SCTP_ACTIVE		0x0001	/* SCTP_ADDR_REACHABLE */
348ca85e948SMichael Tuexen #define SCTP_INACTIVE		0x0002	/* neither SCTP_ADDR_REACHABLE nor
349ca85e948SMichael Tuexen 					 * SCTP_ADDR_UNCONFIRMED */
350f8829a4aSRandall Stewart #define SCTP_UNCONFIRMED	0x0200	/* SCTP_ADDR_UNCONFIRMED */
351f8829a4aSRandall Stewart 
352f8829a4aSRandall Stewart /* remote error events */
353f8829a4aSRandall Stewart struct sctp_remote_error {
354f8829a4aSRandall Stewart 	uint16_t sre_type;
355f8829a4aSRandall Stewart 	uint16_t sre_flags;
356f8829a4aSRandall Stewart 	uint32_t sre_length;
357f8829a4aSRandall Stewart 	uint16_t sre_error;
358f8829a4aSRandall Stewart 	sctp_assoc_t sre_assoc_id;
359e710ed26SMichael Tuexen 	uint8_t sre_data[];
360f8829a4aSRandall Stewart };
361f8829a4aSRandall Stewart 
3629935403aSMichael Tuexen /* data send failure event (deprecated) */
363f8829a4aSRandall Stewart struct sctp_send_failed {
364f8829a4aSRandall Stewart 	uint16_t ssf_type;
365f8829a4aSRandall Stewart 	uint16_t ssf_flags;
366f8829a4aSRandall Stewart 	uint32_t ssf_length;
367f8829a4aSRandall Stewart 	uint32_t ssf_error;
368f8829a4aSRandall Stewart 	struct sctp_sndrcvinfo ssf_info;
369f8829a4aSRandall Stewart 	sctp_assoc_t ssf_assoc_id;
370663fdad8SMichael Tuexen 	uint8_t ssf_data[];
371f8829a4aSRandall Stewart };
372f8829a4aSRandall Stewart 
3739935403aSMichael Tuexen /* data send failure event (not deprecated) */
3749935403aSMichael Tuexen struct sctp_send_failed_event {
3759935403aSMichael Tuexen 	uint16_t ssfe_type;
3769935403aSMichael Tuexen 	uint16_t ssfe_flags;
3779935403aSMichael Tuexen 	uint32_t ssfe_length;
3789935403aSMichael Tuexen 	uint32_t ssfe_error;
3799935403aSMichael Tuexen 	struct sctp_sndinfo ssfe_info;
3809935403aSMichael Tuexen 	sctp_assoc_t ssfe_assoc_id;
3819935403aSMichael Tuexen 	uint8_t ssfe_data[];
3829935403aSMichael Tuexen };
3839935403aSMichael Tuexen 
384f8829a4aSRandall Stewart /* flag that indicates state of data */
385f8829a4aSRandall Stewart #define SCTP_DATA_UNSENT	0x0001	/* inqueue never on wire */
386f8829a4aSRandall Stewart #define SCTP_DATA_SENT		0x0002	/* on wire at failure */
387f8829a4aSRandall Stewart 
388f8829a4aSRandall Stewart /* shutdown event */
389f8829a4aSRandall Stewart struct sctp_shutdown_event {
390f8829a4aSRandall Stewart 	uint16_t sse_type;
391f8829a4aSRandall Stewart 	uint16_t sse_flags;
392f8829a4aSRandall Stewart 	uint32_t sse_length;
393f8829a4aSRandall Stewart 	sctp_assoc_t sse_assoc_id;
394f8829a4aSRandall Stewart };
395f8829a4aSRandall Stewart 
396f8829a4aSRandall Stewart /* Adaptation layer indication stuff */
397f8829a4aSRandall Stewart struct sctp_adaptation_event {
398f8829a4aSRandall Stewart 	uint16_t sai_type;
399f8829a4aSRandall Stewart 	uint16_t sai_flags;
400f8829a4aSRandall Stewart 	uint32_t sai_length;
401f8829a4aSRandall Stewart 	uint32_t sai_adaptation_ind;
402f8829a4aSRandall Stewart 	sctp_assoc_t sai_assoc_id;
403f8829a4aSRandall Stewart };
404f8829a4aSRandall Stewart 
405f8829a4aSRandall Stewart struct sctp_setadaptation {
406f8829a4aSRandall Stewart 	uint32_t ssb_adaptation_ind;
407f8829a4aSRandall Stewart };
408f8829a4aSRandall Stewart 
409b1ce21c6SRebecca Cran /* compatible old spelling */
410f8829a4aSRandall Stewart struct sctp_adaption_event {
411f8829a4aSRandall Stewart 	uint16_t sai_type;
412f8829a4aSRandall Stewart 	uint16_t sai_flags;
413f8829a4aSRandall Stewart 	uint32_t sai_length;
414f8829a4aSRandall Stewart 	uint32_t sai_adaption_ind;
415f8829a4aSRandall Stewart 	sctp_assoc_t sai_assoc_id;
416f8829a4aSRandall Stewart };
417f8829a4aSRandall Stewart 
418f8829a4aSRandall Stewart struct sctp_setadaption {
419f8829a4aSRandall Stewart 	uint32_t ssb_adaption_ind;
420f8829a4aSRandall Stewart };
421f8829a4aSRandall Stewart 
422f8829a4aSRandall Stewart /*
423f8829a4aSRandall Stewart  * Partial Delivery API event
424f8829a4aSRandall Stewart  */
425f8829a4aSRandall Stewart struct sctp_pdapi_event {
426f8829a4aSRandall Stewart 	uint16_t pdapi_type;
427f8829a4aSRandall Stewart 	uint16_t pdapi_flags;
428f8829a4aSRandall Stewart 	uint32_t pdapi_length;
429f8829a4aSRandall Stewart 	uint32_t pdapi_indication;
4309a6142d8SRandall Stewart 	uint16_t pdapi_stream;
4319a6142d8SRandall Stewart 	uint16_t pdapi_seq;
432f8829a4aSRandall Stewart 	sctp_assoc_t pdapi_assoc_id;
433f8829a4aSRandall Stewart };
434f8829a4aSRandall Stewart 
435f8829a4aSRandall Stewart /* indication values */
436f8829a4aSRandall Stewart #define SCTP_PARTIAL_DELIVERY_ABORTED	0x0001
437f8829a4aSRandall Stewart 
438f8829a4aSRandall Stewart /*
439f8829a4aSRandall Stewart  * authentication key event
440f8829a4aSRandall Stewart  */
441f8829a4aSRandall Stewart struct sctp_authkey_event {
442f8829a4aSRandall Stewart 	uint16_t auth_type;
443f8829a4aSRandall Stewart 	uint16_t auth_flags;
444f8829a4aSRandall Stewart 	uint32_t auth_length;
445f8829a4aSRandall Stewart 	uint16_t auth_keynumber;
446f8829a4aSRandall Stewart 	uint16_t auth_altkeynumber;
447f8829a4aSRandall Stewart 	uint32_t auth_indication;
448f8829a4aSRandall Stewart 	sctp_assoc_t auth_assoc_id;
449f8829a4aSRandall Stewart };
450f8829a4aSRandall Stewart 
451f8829a4aSRandall Stewart /* indication values */
45278f28045SMichael Tuexen #define SCTP_AUTH_NEW_KEY	0x0001
45378f28045SMichael Tuexen #define SCTP_AUTH_NEWKEY	SCTP_AUTH_NEW_KEY
454830d754dSRandall Stewart #define SCTP_AUTH_NO_AUTH	0x0002
455830d754dSRandall Stewart #define SCTP_AUTH_FREE_KEY	0x0003
456830d754dSRandall Stewart 
457830d754dSRandall Stewart struct sctp_sender_dry_event {
458830d754dSRandall Stewart 	uint16_t sender_dry_type;
459830d754dSRandall Stewart 	uint16_t sender_dry_flags;
460830d754dSRandall Stewart 	uint32_t sender_dry_length;
461830d754dSRandall Stewart 	sctp_assoc_t sender_dry_assoc_id;
462830d754dSRandall Stewart };
463f8829a4aSRandall Stewart 
464f8829a4aSRandall Stewart /*
465c4e848b7SRandall Stewart  * Stream reset event - subscribe to SCTP_STREAM_RESET_EVENT
466f8829a4aSRandall Stewart  */
467f8829a4aSRandall Stewart struct sctp_stream_reset_event {
468f8829a4aSRandall Stewart 	uint16_t strreset_type;
469f8829a4aSRandall Stewart 	uint16_t strreset_flags;
470f8829a4aSRandall Stewart 	uint32_t strreset_length;
471f8829a4aSRandall Stewart 	sctp_assoc_t strreset_assoc_id;
472c4e848b7SRandall Stewart 	uint16_t strreset_stream_list[];
473f8829a4aSRandall Stewart };
474f8829a4aSRandall Stewart 
475c4e848b7SRandall Stewart /* flags in stream_reset_event (strreset_flags) */
476d7714577SMichael Tuexen #define SCTP_STREAM_RESET_INCOMING_SSN  0x0001
477d7714577SMichael Tuexen #define SCTP_STREAM_RESET_OUTGOING_SSN  0x0002
478d7714577SMichael Tuexen #define SCTP_STREAM_RESET_DENIED        0x0004
479d7714577SMichael Tuexen #define SCTP_STREAM_RESET_FAILED        0x0008
480c4e848b7SRandall Stewart 
481c4e848b7SRandall Stewart /*
482c4e848b7SRandall Stewart  * Assoc reset event - subscribe to SCTP_ASSOC_RESET_EVENT
483c4e848b7SRandall Stewart  */
484c4e848b7SRandall Stewart struct sctp_assoc_reset_event {
485c4e848b7SRandall Stewart 	uint16_t assocreset_type;
486c4e848b7SRandall Stewart 	uint16_t assocreset_flags;
487c4e848b7SRandall Stewart 	uint32_t assocreset_length;
488c4e848b7SRandall Stewart 	sctp_assoc_t assocreset_assoc_id;
489c4e848b7SRandall Stewart 	uint32_t assocreset_local_tsn;
490c4e848b7SRandall Stewart 	uint32_t assocreset_remote_tsn;
491c4e848b7SRandall Stewart };
492c4e848b7SRandall Stewart 
493c4e848b7SRandall Stewart #define SCTP_ASSOC_RESET_DENIED		0x0004
494c4e848b7SRandall Stewart #define SCTP_ASSOC_RESET_FAILED		0x0008
495c4e848b7SRandall Stewart 
496c4e848b7SRandall Stewart /*
497c4e848b7SRandall Stewart  * Stream change event - subscribe to SCTP_STREAM_CHANGE_EVENT
498c4e848b7SRandall Stewart  */
499c4e848b7SRandall Stewart struct sctp_stream_change_event {
500c4e848b7SRandall Stewart 	uint16_t strchange_type;
501c4e848b7SRandall Stewart 	uint16_t strchange_flags;
502c4e848b7SRandall Stewart 	uint32_t strchange_length;
503c4e848b7SRandall Stewart 	sctp_assoc_t strchange_assoc_id;
504c4e848b7SRandall Stewart 	uint16_t strchange_instrms;
505c4e848b7SRandall Stewart 	uint16_t strchange_outstrms;
506c4e848b7SRandall Stewart };
507c4e848b7SRandall Stewart 
508c4e848b7SRandall Stewart #define SCTP_STREAM_CHANGE_DENIED	0x0004
509c4e848b7SRandall Stewart #define SCTP_STREAM_CHANGE_FAILED	0x0008
510c4e848b7SRandall Stewart 
511f8829a4aSRandall Stewart /* SCTP notification event */
512f8829a4aSRandall Stewart struct sctp_tlv {
513f8829a4aSRandall Stewart 	uint16_t sn_type;
514f8829a4aSRandall Stewart 	uint16_t sn_flags;
515f8829a4aSRandall Stewart 	uint32_t sn_length;
516f8829a4aSRandall Stewart };
517f8829a4aSRandall Stewart 
518f8829a4aSRandall Stewart union sctp_notification {
519f8829a4aSRandall Stewart 	struct sctp_tlv sn_header;
520f8829a4aSRandall Stewart 	struct sctp_assoc_change sn_assoc_change;
521f8829a4aSRandall Stewart 	struct sctp_paddr_change sn_paddr_change;
522f8829a4aSRandall Stewart 	struct sctp_remote_error sn_remote_error;
523f8829a4aSRandall Stewart 	struct sctp_send_failed sn_send_failed;
524f8829a4aSRandall Stewart 	struct sctp_shutdown_event sn_shutdown_event;
525f8829a4aSRandall Stewart 	struct sctp_adaptation_event sn_adaptation_event;
526b1ce21c6SRebecca Cran 	/* compatibility same as above */
527f8829a4aSRandall Stewart 	struct sctp_adaption_event sn_adaption_event;
528f8829a4aSRandall Stewart 	struct sctp_pdapi_event sn_pdapi_event;
529f8829a4aSRandall Stewart 	struct sctp_authkey_event sn_auth_event;
530830d754dSRandall Stewart 	struct sctp_sender_dry_event sn_sender_dry_event;
53114ce0c0cSMichael Tuexen 	struct sctp_send_failed_event sn_send_failed_event;
532f8829a4aSRandall Stewart 	struct sctp_stream_reset_event sn_strreset_event;
533c4e848b7SRandall Stewart 	struct sctp_assoc_reset_event sn_assocreset_event;
534c4e848b7SRandall Stewart 	struct sctp_stream_change_event sn_strchange_event;
535f8829a4aSRandall Stewart };
536f8829a4aSRandall Stewart 
537f8829a4aSRandall Stewart /* notification types */
538f8829a4aSRandall Stewart #define SCTP_ASSOC_CHANGE                       0x0001
539f8829a4aSRandall Stewart #define SCTP_PEER_ADDR_CHANGE                   0x0002
540f8829a4aSRandall Stewart #define SCTP_REMOTE_ERROR                       0x0003
541f8829a4aSRandall Stewart #define SCTP_SEND_FAILED                        0x0004
542f8829a4aSRandall Stewart #define SCTP_SHUTDOWN_EVENT                     0x0005
543f8829a4aSRandall Stewart #define SCTP_ADAPTATION_INDICATION              0x0006
544f8829a4aSRandall Stewart /* same as above */
545f8829a4aSRandall Stewart #define SCTP_ADAPTION_INDICATION                0x0006
546f8829a4aSRandall Stewart #define SCTP_PARTIAL_DELIVERY_EVENT             0x0007
547f8829a4aSRandall Stewart #define SCTP_AUTHENTICATION_EVENT               0x0008
548f8829a4aSRandall Stewart #define SCTP_STREAM_RESET_EVENT                 0x0009
549830d754dSRandall Stewart #define SCTP_SENDER_DRY_EVENT                   0x000a
5500a80a2deSMichael Tuexen #define SCTP_NOTIFICATIONS_STOPPED_EVENT        0x000b	/* we don't send this */
551c4e848b7SRandall Stewart #define SCTP_ASSOC_RESET_EVENT                  0x000c
552c4e848b7SRandall Stewart #define SCTP_STREAM_CHANGE_EVENT                0x000d
5539935403aSMichael Tuexen #define SCTP_SEND_FAILED_EVENT                  0x000e
554f8829a4aSRandall Stewart /*
555f8829a4aSRandall Stewart  * socket option structs
556f8829a4aSRandall Stewart  */
557f8829a4aSRandall Stewart 
558f8829a4aSRandall Stewart struct sctp_paddrparams {
559f8829a4aSRandall Stewart 	struct sockaddr_storage spp_address;
560671d309cSRandall Stewart 	sctp_assoc_t spp_assoc_id;
561f8829a4aSRandall Stewart 	uint32_t spp_hbinterval;
562f8829a4aSRandall Stewart 	uint32_t spp_pathmtu;
563f8829a4aSRandall Stewart 	uint32_t spp_flags;
564f8829a4aSRandall Stewart 	uint32_t spp_ipv6_flowlabel;
565671d309cSRandall Stewart 	uint16_t spp_pathmaxrxt;
566b10f2dc8SMichael Tuexen 	uint8_t spp_dscp;
567f8829a4aSRandall Stewart };
568b10f2dc8SMichael Tuexen #define spp_ipv4_tos spp_dscp
569b10f2dc8SMichael Tuexen 
570f8829a4aSRandall Stewart #define SPP_HB_ENABLE		0x00000001
571f8829a4aSRandall Stewart #define SPP_HB_DISABLE		0x00000002
572f8829a4aSRandall Stewart #define SPP_HB_DEMAND		0x00000004
573f8829a4aSRandall Stewart #define SPP_PMTUD_ENABLE	0x00000008
574f8829a4aSRandall Stewart #define SPP_PMTUD_DISABLE	0x00000010
575f8829a4aSRandall Stewart #define SPP_HB_TIME_IS_ZERO     0x00000080
576f8829a4aSRandall Stewart #define SPP_IPV6_FLOWLABEL      0x00000100
577b10f2dc8SMichael Tuexen #define SPP_DSCP                0x00000200
578b10f2dc8SMichael Tuexen #define SPP_IPV4_TOS            SPP_DSCP
579f8829a4aSRandall Stewart 
580ca85e948SMichael Tuexen struct sctp_paddrthlds {
581ca85e948SMichael Tuexen 	struct sockaddr_storage spt_address;
582ec9925edSMichael Tuexen 	sctp_assoc_t spt_assoc_id;
583ca85e948SMichael Tuexen 	uint16_t spt_pathmaxrxt;
584ca85e948SMichael Tuexen 	uint16_t spt_pathpfthld;
5854f3b84b5SMichael Tuexen 	uint16_t spt_pathcpthld;
586ca85e948SMichael Tuexen };
587ca85e948SMichael Tuexen 
588f8829a4aSRandall Stewart struct sctp_paddrinfo {
589f8829a4aSRandall Stewart 	struct sockaddr_storage spinfo_address;
590671d309cSRandall Stewart 	sctp_assoc_t spinfo_assoc_id;
591f8829a4aSRandall Stewart 	int32_t spinfo_state;
592f8829a4aSRandall Stewart 	uint32_t spinfo_cwnd;
593f8829a4aSRandall Stewart 	uint32_t spinfo_srtt;
594f8829a4aSRandall Stewart 	uint32_t spinfo_rto;
595f8829a4aSRandall Stewart 	uint32_t spinfo_mtu;
596f8829a4aSRandall Stewart };
597f8829a4aSRandall Stewart 
598f8829a4aSRandall Stewart struct sctp_rtoinfo {
599f8829a4aSRandall Stewart 	sctp_assoc_t srto_assoc_id;
600f8829a4aSRandall Stewart 	uint32_t srto_initial;
601f8829a4aSRandall Stewart 	uint32_t srto_max;
602f8829a4aSRandall Stewart 	uint32_t srto_min;
603f8829a4aSRandall Stewart };
604f8829a4aSRandall Stewart 
605f8829a4aSRandall Stewart struct sctp_assocparams {
606f8829a4aSRandall Stewart 	sctp_assoc_t sasoc_assoc_id;
607f8829a4aSRandall Stewart 	uint32_t sasoc_peer_rwnd;
608f8829a4aSRandall Stewart 	uint32_t sasoc_local_rwnd;
609f8829a4aSRandall Stewart 	uint32_t sasoc_cookie_life;
610671d309cSRandall Stewart 	uint16_t sasoc_asocmaxrxt;
611671d309cSRandall Stewart 	uint16_t sasoc_number_peer_destinations;
612f8829a4aSRandall Stewart };
613f8829a4aSRandall Stewart 
614f8829a4aSRandall Stewart struct sctp_setprim {
615f8829a4aSRandall Stewart 	struct sockaddr_storage ssp_addr;
616671d309cSRandall Stewart 	sctp_assoc_t ssp_assoc_id;
617671d309cSRandall Stewart 	uint8_t ssp_padding[4];
618f8829a4aSRandall Stewart };
619f8829a4aSRandall Stewart 
620f8829a4aSRandall Stewart struct sctp_setpeerprim {
621f8829a4aSRandall Stewart 	struct sockaddr_storage sspp_addr;
622671d309cSRandall Stewart 	sctp_assoc_t sspp_assoc_id;
623671d309cSRandall Stewart 	uint8_t sspp_padding[4];
624f8829a4aSRandall Stewart };
625f8829a4aSRandall Stewart 
626c5d9e5c9SMichael Tuexen union sctp_sockstore {
627c5d9e5c9SMichael Tuexen 	struct sockaddr_in sin;
628c5d9e5c9SMichael Tuexen 	struct sockaddr_in6 sin6;
629c5d9e5c9SMichael Tuexen 	struct sockaddr sa;
630c5d9e5c9SMichael Tuexen };
631c5d9e5c9SMichael Tuexen 
632f8829a4aSRandall Stewart struct sctp_getaddresses {
633f8829a4aSRandall Stewart 	sctp_assoc_t sget_assoc_id;
634c5d9e5c9SMichael Tuexen 	union sctp_sockstore addr[];
635f8829a4aSRandall Stewart };
636f8829a4aSRandall Stewart 
637f8829a4aSRandall Stewart struct sctp_status {
638f8829a4aSRandall Stewart 	sctp_assoc_t sstat_assoc_id;
639f8829a4aSRandall Stewart 	int32_t sstat_state;
640f8829a4aSRandall Stewart 	uint32_t sstat_rwnd;
641f8829a4aSRandall Stewart 	uint16_t sstat_unackdata;
642f8829a4aSRandall Stewart 	uint16_t sstat_penddata;
643f8829a4aSRandall Stewart 	uint16_t sstat_instrms;
644f8829a4aSRandall Stewart 	uint16_t sstat_outstrms;
645f8829a4aSRandall Stewart 	uint32_t sstat_fragmentation_point;
646f8829a4aSRandall Stewart 	struct sctp_paddrinfo sstat_primary;
647f8829a4aSRandall Stewart };
648f8829a4aSRandall Stewart 
649f8829a4aSRandall Stewart /*
650f8829a4aSRandall Stewart  * AUTHENTICATION support
651f8829a4aSRandall Stewart  */
652f8829a4aSRandall Stewart /* SCTP_AUTH_CHUNK */
653f8829a4aSRandall Stewart struct sctp_authchunk {
654f8829a4aSRandall Stewart 	uint8_t sauth_chunk;
655f8829a4aSRandall Stewart };
656f8829a4aSRandall Stewart 
657f8829a4aSRandall Stewart /* SCTP_AUTH_KEY */
658f8829a4aSRandall Stewart struct sctp_authkey {
659f8829a4aSRandall Stewart 	sctp_assoc_t sca_assoc_id;
660f8829a4aSRandall Stewart 	uint16_t sca_keynumber;
661b845acdaSMichael Tuexen 	uint16_t sca_keylength;
662663fdad8SMichael Tuexen 	uint8_t sca_key[];
663f8829a4aSRandall Stewart };
664f8829a4aSRandall Stewart 
665f8829a4aSRandall Stewart /* SCTP_HMAC_IDENT */
666f8829a4aSRandall Stewart struct sctp_hmacalgo {
667bfefd190SRandall Stewart 	uint32_t shmac_number_of_idents;
668663fdad8SMichael Tuexen 	uint16_t shmac_idents[];
669f8829a4aSRandall Stewart };
670f8829a4aSRandall Stewart 
671f8829a4aSRandall Stewart /* AUTH hmac_id */
672f8829a4aSRandall Stewart #define SCTP_AUTH_HMAC_ID_RSVD		0x0000
673f8829a4aSRandall Stewart #define SCTP_AUTH_HMAC_ID_SHA1		0x0001	/* default, mandatory */
674f8829a4aSRandall Stewart #define SCTP_AUTH_HMAC_ID_SHA256	0x0003
675f8829a4aSRandall Stewart 
676f8829a4aSRandall Stewart /* SCTP_AUTH_ACTIVE_KEY / SCTP_AUTH_DELETE_KEY */
677f8829a4aSRandall Stewart struct sctp_authkeyid {
678f8829a4aSRandall Stewart 	sctp_assoc_t scact_assoc_id;
679f8829a4aSRandall Stewart 	uint16_t scact_keynumber;
680f8829a4aSRandall Stewart };
681f8829a4aSRandall Stewart 
682f8829a4aSRandall Stewart /* SCTP_PEER_AUTH_CHUNKS / SCTP_LOCAL_AUTH_CHUNKS */
683f8829a4aSRandall Stewart struct sctp_authchunks {
684f8829a4aSRandall Stewart 	sctp_assoc_t gauth_assoc_id;
6855fc8d746SMichael Tuexen 	uint32_t gauth_number_of_chunks;
686663fdad8SMichael Tuexen 	uint8_t gauth_chunks[];
687f8829a4aSRandall Stewart };
688f8829a4aSRandall Stewart 
689f8829a4aSRandall Stewart struct sctp_assoc_value {
690f8829a4aSRandall Stewart 	sctp_assoc_t assoc_id;
691f8829a4aSRandall Stewart 	uint32_t assoc_value;
692f8829a4aSRandall Stewart };
693f8829a4aSRandall Stewart 
694299108c5SRandall Stewart struct sctp_cc_option {
695299108c5SRandall Stewart 	int option;
696299108c5SRandall Stewart 	struct sctp_assoc_value aid_value;
697299108c5SRandall Stewart };
698299108c5SRandall Stewart 
699f7a77f6fSMichael Tuexen struct sctp_stream_value {
700f7a77f6fSMichael Tuexen 	sctp_assoc_t assoc_id;
701f7a77f6fSMichael Tuexen 	uint16_t stream_id;
702f7a77f6fSMichael Tuexen 	uint16_t stream_value;
703f7a77f6fSMichael Tuexen };
704f7a77f6fSMichael Tuexen 
705f8829a4aSRandall Stewart struct sctp_assoc_ids {
706830d754dSRandall Stewart 	uint32_t gaids_number_of_ids;
707663fdad8SMichael Tuexen 	sctp_assoc_t gaids_assoc_id[];
708f8829a4aSRandall Stewart };
709f8829a4aSRandall Stewart 
710d61a0ae0SRandall Stewart struct sctp_sack_info {
711d61a0ae0SRandall Stewart 	sctp_assoc_t sack_assoc_id;
712d61a0ae0SRandall Stewart 	uint32_t sack_delay;
713d61a0ae0SRandall Stewart 	uint32_t sack_freq;
714d61a0ae0SRandall Stewart };
715d61a0ae0SRandall Stewart 
7166a67588bSMichael Tuexen struct sctp_timeouts {
7176a67588bSMichael Tuexen 	sctp_assoc_t stimo_assoc_id;
7186a67588bSMichael Tuexen 	uint32_t stimo_init;
7196a67588bSMichael Tuexen 	uint32_t stimo_data;
7206a67588bSMichael Tuexen 	uint32_t stimo_sack;
7216a67588bSMichael Tuexen 	uint32_t stimo_shutdown;
7226a67588bSMichael Tuexen 	uint32_t stimo_heartbeat;
7236a67588bSMichael Tuexen 	uint32_t stimo_cookie;
7246a67588bSMichael Tuexen 	uint32_t stimo_shutdownack;
7256a67588bSMichael Tuexen };
7266a67588bSMichael Tuexen 
727c9c58059SMichael Tuexen struct sctp_udpencaps {
728c9c58059SMichael Tuexen 	struct sockaddr_storage sue_address;
729052230f9SMichael Tuexen 	sctp_assoc_t sue_assoc_id;
730c9c58059SMichael Tuexen 	uint16_t sue_port;
731c9c58059SMichael Tuexen };
732c9c58059SMichael Tuexen 
733f0396ad1SMichael Tuexen struct sctp_prstatus {
734f0396ad1SMichael Tuexen 	sctp_assoc_t sprstat_assoc_id;
735f0396ad1SMichael Tuexen 	uint16_t sprstat_sid;
736f0396ad1SMichael Tuexen 	uint16_t sprstat_policy;
737f0396ad1SMichael Tuexen 	uint64_t sprstat_abandoned_unsent;
738f0396ad1SMichael Tuexen 	uint64_t sprstat_abandoned_sent;
739f0396ad1SMichael Tuexen };
740f0396ad1SMichael Tuexen 
741f8829a4aSRandall Stewart struct sctp_cwnd_args {
742671d309cSRandall Stewart 	struct sctp_nets *net;	/* network to *//* FIXME: LP64 issue */
743f8829a4aSRandall Stewart 	uint32_t cwnd_new_value;	/* cwnd in k */
744f8829a4aSRandall Stewart 	uint32_t pseudo_cumack;
7458933fa13SRandall Stewart 	uint16_t inflight;	/* flightsize in k */
7468933fa13SRandall Stewart 	uint16_t cwnd_augment;	/* increment to it */
747f8829a4aSRandall Stewart 	uint8_t meets_pseudo_cumack;
748f8829a4aSRandall Stewart 	uint8_t need_new_pseudo_cumack;
749f8829a4aSRandall Stewart 	uint8_t cnt_in_send;
750f8829a4aSRandall Stewart 	uint8_t cnt_in_str;
751f8829a4aSRandall Stewart };
752f8829a4aSRandall Stewart 
753f8829a4aSRandall Stewart struct sctp_blk_args {
754f8829a4aSRandall Stewart 	uint32_t onsb;		/* in 1k bytes */
755f8829a4aSRandall Stewart 	uint32_t sndlen;	/* len of send being attempted */
756f8829a4aSRandall Stewart 	uint32_t peer_rwnd;	/* rwnd of peer */
757f8829a4aSRandall Stewart 	uint16_t send_sent_qcnt;	/* chnk cnt */
758f8829a4aSRandall Stewart 	uint16_t stream_qcnt;	/* chnk cnt */
759f8829a4aSRandall Stewart 	uint16_t chunks_on_oque;	/* chunks out */
760f8829a4aSRandall Stewart 	uint16_t flight_size;	/* flight size in k */
761f8829a4aSRandall Stewart };
762f8829a4aSRandall Stewart 
763f8829a4aSRandall Stewart /*
764f8829a4aSRandall Stewart  * Max we can reset in one setting, note this is dictated not by the define
765f8829a4aSRandall Stewart  * but the size of a mbuf cluster so don't change this define and think you
766f8829a4aSRandall Stewart  * can specify more. You must do multiple resets if you want to reset more
767f8829a4aSRandall Stewart  * than SCTP_MAX_EXPLICIT_STR_RESET.
768f8829a4aSRandall Stewart  */
769f8829a4aSRandall Stewart #define SCTP_MAX_EXPLICT_STR_RESET   1000
770f8829a4aSRandall Stewart 
771c4e848b7SRandall Stewart struct sctp_reset_streams {
772c4e848b7SRandall Stewart 	sctp_assoc_t srs_assoc_id;
773c4e848b7SRandall Stewart 	uint16_t srs_flags;
774c4e848b7SRandall Stewart 	uint16_t srs_number_streams;	/* 0 == ALL */
775c4e848b7SRandall Stewart 	uint16_t srs_stream_list[];	/* list if strrst_num_streams is not 0 */
776f8829a4aSRandall Stewart };
777f8829a4aSRandall Stewart 
778c4e848b7SRandall Stewart struct sctp_add_streams {
779c4e848b7SRandall Stewart 	sctp_assoc_t sas_assoc_id;
780c4e848b7SRandall Stewart 	uint16_t sas_instrms;
781c4e848b7SRandall Stewart 	uint16_t sas_outstrms;
782c4e848b7SRandall Stewart };
783f8829a4aSRandall Stewart 
784f8829a4aSRandall Stewart struct sctp_get_nonce_values {
785f8829a4aSRandall Stewart 	sctp_assoc_t gn_assoc_id;
786f8829a4aSRandall Stewart 	uint32_t gn_peers_tag;
787f8829a4aSRandall Stewart 	uint32_t gn_local_tag;
788f8829a4aSRandall Stewart };
789f8829a4aSRandall Stewart 
79052640d61SMichael Tuexen /* Values for SCTP_ACCEPT_ZERO_CHECKSUM */
79152640d61SMichael Tuexen #define SCTP_EDMID_NONE             0
79252640d61SMichael Tuexen #define SCTP_EDMID_LOWER_LAYER_DTLS 1
79352640d61SMichael Tuexen 
794f8829a4aSRandall Stewart /* Debugging logs */
795f8829a4aSRandall Stewart struct sctp_str_log {
796671d309cSRandall Stewart 	void *stcb;		/* FIXME: LP64 issue */
797f8829a4aSRandall Stewart 	uint32_t n_tsn;
798f8829a4aSRandall Stewart 	uint32_t e_tsn;
799f8829a4aSRandall Stewart 	uint16_t n_sseq;
800f8829a4aSRandall Stewart 	uint16_t e_sseq;
8016a91f103SRandall Stewart 	uint16_t strm;
802f8829a4aSRandall Stewart };
803f8829a4aSRandall Stewart 
804f8829a4aSRandall Stewart struct sctp_sb_log {
805671d309cSRandall Stewart 	void *stcb;		/* FIXME: LP64 issue */
806f8829a4aSRandall Stewart 	uint32_t so_sbcc;
807f8829a4aSRandall Stewart 	uint32_t stcb_sbcc;
808f8829a4aSRandall Stewart 	uint32_t incr;
809f8829a4aSRandall Stewart };
810f8829a4aSRandall Stewart 
811f8829a4aSRandall Stewart struct sctp_fr_log {
812f8829a4aSRandall Stewart 	uint32_t largest_tsn;
813f8829a4aSRandall Stewart 	uint32_t largest_new_tsn;
814f8829a4aSRandall Stewart 	uint32_t tsn;
815f8829a4aSRandall Stewart };
816f8829a4aSRandall Stewart 
817f8829a4aSRandall Stewart struct sctp_fr_map {
818f8829a4aSRandall Stewart 	uint32_t base;
819f8829a4aSRandall Stewart 	uint32_t cum;
820f8829a4aSRandall Stewart 	uint32_t high;
821f8829a4aSRandall Stewart };
822f8829a4aSRandall Stewart 
823f8829a4aSRandall Stewart struct sctp_rwnd_log {
824f8829a4aSRandall Stewart 	uint32_t rwnd;
825f8829a4aSRandall Stewart 	uint32_t send_size;
826f8829a4aSRandall Stewart 	uint32_t overhead;
827f8829a4aSRandall Stewart 	uint32_t new_rwnd;
828f8829a4aSRandall Stewart };
829f8829a4aSRandall Stewart 
830f8829a4aSRandall Stewart struct sctp_mbcnt_log {
831f8829a4aSRandall Stewart 	uint32_t total_queue_size;
832f8829a4aSRandall Stewart 	uint32_t size_change;
833f8829a4aSRandall Stewart 	uint32_t total_queue_mb_size;
834f8829a4aSRandall Stewart 	uint32_t mbcnt_change;
835f8829a4aSRandall Stewart };
836f8829a4aSRandall Stewart 
837f8829a4aSRandall Stewart struct sctp_sack_log {
838f8829a4aSRandall Stewart 	uint32_t cumack;
839f8829a4aSRandall Stewart 	uint32_t oldcumack;
840f8829a4aSRandall Stewart 	uint32_t tsn;
841f8829a4aSRandall Stewart 	uint16_t numGaps;
842f8829a4aSRandall Stewart 	uint16_t numDups;
843f8829a4aSRandall Stewart };
844f8829a4aSRandall Stewart 
845f8829a4aSRandall Stewart struct sctp_lock_log {
846671d309cSRandall Stewart 	void *sock;		/* FIXME: LP64 issue */
847671d309cSRandall Stewart 	void *inp;		/* FIXME: LP64 issue */
848f8829a4aSRandall Stewart 	uint8_t tcb_lock;
849f8829a4aSRandall Stewart 	uint8_t inp_lock;
850f8829a4aSRandall Stewart 	uint8_t info_lock;
851f8829a4aSRandall Stewart 	uint8_t sock_lock;
852f8829a4aSRandall Stewart 	uint8_t sockrcvbuf_lock;
853f8829a4aSRandall Stewart 	uint8_t socksndbuf_lock;
854f8829a4aSRandall Stewart 	uint8_t create_lock;
855f8829a4aSRandall Stewart 	uint8_t resv;
856f8829a4aSRandall Stewart };
857f8829a4aSRandall Stewart 
858f8829a4aSRandall Stewart struct sctp_rto_log {
859671d309cSRandall Stewart 	void *net;		/* FIXME: LP64 issue */
860f8829a4aSRandall Stewart 	uint32_t rtt;
861f8829a4aSRandall Stewart };
862f8829a4aSRandall Stewart 
863f8829a4aSRandall Stewart struct sctp_nagle_log {
864671d309cSRandall Stewart 	void *stcb;		/* FIXME: LP64 issue */
865f8829a4aSRandall Stewart 	uint32_t total_flight;
866f8829a4aSRandall Stewart 	uint32_t total_in_queue;
867f8829a4aSRandall Stewart 	uint16_t count_in_queue;
868f8829a4aSRandall Stewart 	uint16_t count_in_flight;
869f8829a4aSRandall Stewart };
870f8829a4aSRandall Stewart 
871f8829a4aSRandall Stewart struct sctp_sbwake_log {
872671d309cSRandall Stewart 	void *stcb;		/* FIXME: LP64 issue */
873f8829a4aSRandall Stewart 	uint16_t send_q;
874f8829a4aSRandall Stewart 	uint16_t sent_q;
875f8829a4aSRandall Stewart 	uint16_t flight;
876f8829a4aSRandall Stewart 	uint16_t wake_cnt;
877f8829a4aSRandall Stewart 	uint8_t stream_qcnt;	/* chnk cnt */
878f8829a4aSRandall Stewart 	uint8_t chunks_on_oque;	/* chunks out */
879f8829a4aSRandall Stewart 	uint8_t sbflags;
880f8829a4aSRandall Stewart 	uint8_t sctpflags;
881f8829a4aSRandall Stewart };
882f8829a4aSRandall Stewart 
883f8829a4aSRandall Stewart struct sctp_misc_info {
884f8829a4aSRandall Stewart 	uint32_t log1;
885f8829a4aSRandall Stewart 	uint32_t log2;
886f8829a4aSRandall Stewart 	uint32_t log3;
887f8829a4aSRandall Stewart 	uint32_t log4;
888f8829a4aSRandall Stewart };
889f8829a4aSRandall Stewart 
890f8829a4aSRandall Stewart struct sctp_log_closing {
891671d309cSRandall Stewart 	void *inp;		/* FIXME: LP64 issue */
892671d309cSRandall Stewart 	void *stcb;		/* FIXME: LP64 issue */
893f8829a4aSRandall Stewart 	uint32_t sctp_flags;
894f8829a4aSRandall Stewart 	uint16_t state;
895f8829a4aSRandall Stewart 	int16_t loc;
896f8829a4aSRandall Stewart };
897f8829a4aSRandall Stewart 
898f8829a4aSRandall Stewart struct sctp_mbuf_log {
899671d309cSRandall Stewart 	struct mbuf *mp;	/* FIXME: LP64 issue */
900f8829a4aSRandall Stewart 	caddr_t ext;
901f8829a4aSRandall Stewart 	caddr_t data;
902f8829a4aSRandall Stewart 	uint16_t size;
903f8829a4aSRandall Stewart 	uint8_t refcnt;
904f8829a4aSRandall Stewart 	uint8_t mbuf_flags;
905f8829a4aSRandall Stewart };
906f8829a4aSRandall Stewart 
907f8829a4aSRandall Stewart struct sctp_cwnd_log {
90880fefe0aSRandall Stewart 	uint64_t time_event;
909f8829a4aSRandall Stewart 	uint8_t from;
910f8829a4aSRandall Stewart 	uint8_t event_type;
911f8829a4aSRandall Stewart 	uint8_t resv[2];
912f8829a4aSRandall Stewart 	union {
913f8829a4aSRandall Stewart 		struct sctp_log_closing close;
914f8829a4aSRandall Stewart 		struct sctp_blk_args blk;
915f8829a4aSRandall Stewart 		struct sctp_cwnd_args cwnd;
916f8829a4aSRandall Stewart 		struct sctp_str_log strlog;
917f8829a4aSRandall Stewart 		struct sctp_fr_log fr;
918f8829a4aSRandall Stewart 		struct sctp_fr_map map;
919f8829a4aSRandall Stewart 		struct sctp_rwnd_log rwnd;
920f8829a4aSRandall Stewart 		struct sctp_mbcnt_log mbcnt;
921f8829a4aSRandall Stewart 		struct sctp_sack_log sack;
922f8829a4aSRandall Stewart 		struct sctp_lock_log lock;
923f8829a4aSRandall Stewart 		struct sctp_rto_log rto;
924f8829a4aSRandall Stewart 		struct sctp_sb_log sb;
925f8829a4aSRandall Stewart 		struct sctp_nagle_log nagle;
926f8829a4aSRandall Stewart 		struct sctp_sbwake_log wake;
927f8829a4aSRandall Stewart 		struct sctp_mbuf_log mb;
928f8829a4aSRandall Stewart 		struct sctp_misc_info misc;
929f8829a4aSRandall Stewart 	}     x;
930f8829a4aSRandall Stewart };
931f8829a4aSRandall Stewart 
932f8829a4aSRandall Stewart struct sctp_cwnd_log_req {
933671d309cSRandall Stewart 	int32_t num_in_log;	/* Number in log */
934671d309cSRandall Stewart 	int32_t num_ret;	/* Number returned */
935671d309cSRandall Stewart 	int32_t start_at;	/* start at this one */
936671d309cSRandall Stewart 	int32_t end_at;		/* end at this one */
937663fdad8SMichael Tuexen 	struct sctp_cwnd_log log[];
938f8829a4aSRandall Stewart };
939f8829a4aSRandall Stewart 
940851b7298SRandall Stewart struct sctp_timeval {
941851b7298SRandall Stewart 	uint32_t tv_sec;
942851b7298SRandall Stewart 	uint32_t tv_usec;
943851b7298SRandall Stewart };
944851b7298SRandall Stewart 
945f8829a4aSRandall Stewart struct sctpstat {
946892f1c71SRandall Stewart 	struct sctp_timeval sctps_discontinuitytime;	/* sctpStats 18
947892f1c71SRandall Stewart 							 * (TimeStamp) */
948f8829a4aSRandall Stewart 	/* MIB according to RFC 3873 */
949671d309cSRandall Stewart 	uint32_t sctps_currestab;	/* sctpStats  1   (Gauge32) */
950671d309cSRandall Stewart 	uint32_t sctps_activeestab;	/* sctpStats  2 (Counter32) */
951671d309cSRandall Stewart 	uint32_t sctps_restartestab;
952671d309cSRandall Stewart 	uint32_t sctps_collisionestab;
953671d309cSRandall Stewart 	uint32_t sctps_passiveestab;	/* sctpStats  3 (Counter32) */
954671d309cSRandall Stewart 	uint32_t sctps_aborted;	/* sctpStats  4 (Counter32) */
955671d309cSRandall Stewart 	uint32_t sctps_shutdown;	/* sctpStats  5 (Counter32) */
956671d309cSRandall Stewart 	uint32_t sctps_outoftheblue;	/* sctpStats  6 (Counter32) */
957671d309cSRandall Stewart 	uint32_t sctps_checksumerrors;	/* sctpStats  7 (Counter32) */
958671d309cSRandall Stewart 	uint32_t sctps_outcontrolchunks;	/* sctpStats  8 (Counter64) */
959671d309cSRandall Stewart 	uint32_t sctps_outorderchunks;	/* sctpStats  9 (Counter64) */
960671d309cSRandall Stewart 	uint32_t sctps_outunorderchunks;	/* sctpStats 10 (Counter64) */
961671d309cSRandall Stewart 	uint32_t sctps_incontrolchunks;	/* sctpStats 11 (Counter64) */
962671d309cSRandall Stewart 	uint32_t sctps_inorderchunks;	/* sctpStats 12 (Counter64) */
963671d309cSRandall Stewart 	uint32_t sctps_inunorderchunks;	/* sctpStats 13 (Counter64) */
964671d309cSRandall Stewart 	uint32_t sctps_fragusrmsgs;	/* sctpStats 14 (Counter64) */
965671d309cSRandall Stewart 	uint32_t sctps_reasmusrmsgs;	/* sctpStats 15 (Counter64) */
966671d309cSRandall Stewart 	uint32_t sctps_outpackets;	/* sctpStats 16 (Counter64) */
967671d309cSRandall Stewart 	uint32_t sctps_inpackets;	/* sctpStats 17 (Counter64) */
968671d309cSRandall Stewart 
969f8829a4aSRandall Stewart 	/* input statistics: */
970671d309cSRandall Stewart 	uint32_t sctps_recvpackets;	/* total input packets        */
971671d309cSRandall Stewart 	uint32_t sctps_recvdatagrams;	/* total input datagrams      */
972671d309cSRandall Stewart 	uint32_t sctps_recvpktwithdata;	/* total packets that had data */
973671d309cSRandall Stewart 	uint32_t sctps_recvsacks;	/* total input SACK chunks    */
974671d309cSRandall Stewart 	uint32_t sctps_recvdata;	/* total input DATA chunks    */
975671d309cSRandall Stewart 	uint32_t sctps_recvdupdata;	/* total input duplicate DATA chunks */
976671d309cSRandall Stewart 	uint32_t sctps_recvheartbeat;	/* total input HB chunks      */
977671d309cSRandall Stewart 	uint32_t sctps_recvheartbeatack;	/* total input HB-ACK chunks  */
978671d309cSRandall Stewart 	uint32_t sctps_recvecne;	/* total input ECNE chunks    */
979671d309cSRandall Stewart 	uint32_t sctps_recvauth;	/* total input AUTH chunks    */
980671d309cSRandall Stewart 	uint32_t sctps_recvauthmissing;	/* total input chunks missing AUTH */
981671d309cSRandall Stewart 	uint32_t sctps_recvivalhmacid;	/* total number of invalid HMAC ids
982f8829a4aSRandall Stewart 					 * received */
983671d309cSRandall Stewart 	uint32_t sctps_recvivalkeyid;	/* total number of invalid secret ids
984f8829a4aSRandall Stewart 					 * received */
985671d309cSRandall Stewart 	uint32_t sctps_recvauthfailed;	/* total number of auth failed */
986671d309cSRandall Stewart 	uint32_t sctps_recvexpress;	/* total fast path receives all one
987f8829a4aSRandall Stewart 					 * chunk */
988671d309cSRandall Stewart 	uint32_t sctps_recvexpressm;	/* total fast path multi-part data */
9899f0abda0SMichael Tuexen 	uint32_t sctps_recv_spare;	/* formerly sctps_recvnocrc */
990a99b6783SRandall Stewart 	uint32_t sctps_recvswcrc;
991a99b6783SRandall Stewart 	uint32_t sctps_recvhwcrc;
992a99b6783SRandall Stewart 
993f8829a4aSRandall Stewart 	/* output statistics: */
994671d309cSRandall Stewart 	uint32_t sctps_sendpackets;	/* total output packets       */
995671d309cSRandall Stewart 	uint32_t sctps_sendsacks;	/* total output SACKs         */
996671d309cSRandall Stewart 	uint32_t sctps_senddata;	/* total output DATA chunks   */
997671d309cSRandall Stewart 	uint32_t sctps_sendretransdata;	/* total output retransmitted DATA
998f8829a4aSRandall Stewart 					 * chunks */
999671d309cSRandall Stewart 	uint32_t sctps_sendfastretrans;	/* total output fast retransmitted
1000f8829a4aSRandall Stewart 					 * DATA chunks */
1001671d309cSRandall Stewart 	uint32_t sctps_sendmultfastretrans;	/* total FR's that happened
1002478d3f09SRandall Stewart 						 * more than once to same
1003478d3f09SRandall Stewart 						 * chunk (u-del multi-fr
1004478d3f09SRandall Stewart 						 * algo). */
1005671d309cSRandall Stewart 	uint32_t sctps_sendheartbeat;	/* total output HB chunks     */
1006671d309cSRandall Stewart 	uint32_t sctps_sendecne;	/* total output ECNE chunks    */
1007671d309cSRandall Stewart 	uint32_t sctps_sendauth;	/* total output AUTH chunks FIXME   */
1008671d309cSRandall Stewart 	uint32_t sctps_senderrors;	/* ip_output error counter */
10099f0abda0SMichael Tuexen 	uint32_t sctps_send_spare;	/* formerly sctps_sendnocrc */
1010a99b6783SRandall Stewart 	uint32_t sctps_sendswcrc;
1011a99b6783SRandall Stewart 	uint32_t sctps_sendhwcrc;
1012f8829a4aSRandall Stewart 	/* PCKDROPREP statistics: */
1013671d309cSRandall Stewart 	uint32_t sctps_pdrpfmbox;	/* Packet drop from middle box */
1014671d309cSRandall Stewart 	uint32_t sctps_pdrpfehos;	/* P-drop from end host */
1015671d309cSRandall Stewart 	uint32_t sctps_pdrpmbda;	/* P-drops with data */
1016671d309cSRandall Stewart 	uint32_t sctps_pdrpmbct;	/* P-drops, non-data, non-endhost */
1017671d309cSRandall Stewart 	uint32_t sctps_pdrpbwrpt;	/* P-drop, non-endhost, bandwidth rep
1018671d309cSRandall Stewart 					 * only */
1019671d309cSRandall Stewart 	uint32_t sctps_pdrpcrupt;	/* P-drop, not enough for chunk header */
1020671d309cSRandall Stewart 	uint32_t sctps_pdrpnedat;	/* P-drop, not enough data to confirm */
1021671d309cSRandall Stewart 	uint32_t sctps_pdrppdbrk;	/* P-drop, where process_chunk_drop
1022671d309cSRandall Stewart 					 * said break */
1023671d309cSRandall Stewart 	uint32_t sctps_pdrptsnnf;	/* P-drop, could not find TSN */
1024671d309cSRandall Stewart 	uint32_t sctps_pdrpdnfnd;	/* P-drop, attempt reverse TSN lookup */
1025671d309cSRandall Stewart 	uint32_t sctps_pdrpdiwnp;	/* P-drop, e-host confirms zero-rwnd */
1026671d309cSRandall Stewart 	uint32_t sctps_pdrpdizrw;	/* P-drop, midbox confirms no space */
1027671d309cSRandall Stewart 	uint32_t sctps_pdrpbadd;	/* P-drop, data did not match TSN */
10280053ed28SMichael Tuexen 	uint32_t sctps_pdrpmark;	/* P-drop, TSN's marked for Fast
10290053ed28SMichael Tuexen 					 * Retran */
1030f8829a4aSRandall Stewart 	/* timeouts */
1031671d309cSRandall Stewart 	uint32_t sctps_timoiterator;	/* Number of iterator timers that
1032478d3f09SRandall Stewart 					 * fired */
1033671d309cSRandall Stewart 	uint32_t sctps_timodata;	/* Number of T3 data time outs */
1034671d309cSRandall Stewart 	uint32_t sctps_timowindowprobe;	/* Number of window probe (T3) timers
1035478d3f09SRandall Stewart 					 * that fired */
1036671d309cSRandall Stewart 	uint32_t sctps_timoinit;	/* Number of INIT timers that fired */
1037671d309cSRandall Stewart 	uint32_t sctps_timosack;	/* Number of sack timers that fired */
1038671d309cSRandall Stewart 	uint32_t sctps_timoshutdown;	/* Number of shutdown timers that
1039478d3f09SRandall Stewart 					 * fired */
1040671d309cSRandall Stewart 	uint32_t sctps_timoheartbeat;	/* Number of heartbeat timers that
1041478d3f09SRandall Stewart 					 * fired */
1042671d309cSRandall Stewart 	uint32_t sctps_timocookie;	/* Number of times a cookie timeout
1043478d3f09SRandall Stewart 					 * fired */
1044671d309cSRandall Stewart 	uint32_t sctps_timosecret;	/* Number of times an endpoint changed
1045671d309cSRandall Stewart 					 * its cookie secret */
1046671d309cSRandall Stewart 	uint32_t sctps_timopathmtu;	/* Number of PMTU timers that fired */
1047671d309cSRandall Stewart 	uint32_t sctps_timoshutdownack;	/* Number of shutdown ack timers that
1048478d3f09SRandall Stewart 					 * fired */
1049671d309cSRandall Stewart 	uint32_t sctps_timoshutdownguard;	/* Number of shutdown guard
1050671d309cSRandall Stewart 						 * timers that fired */
1051671d309cSRandall Stewart 	uint32_t sctps_timostrmrst;	/* Number of stream reset timers that
1052478d3f09SRandall Stewart 					 * fired */
1053671d309cSRandall Stewart 	uint32_t sctps_timoearlyfr;	/* Number of early FR timers that
1054478d3f09SRandall Stewart 					 * fired */
1055671d309cSRandall Stewart 	uint32_t sctps_timoasconf;	/* Number of times an asconf timer
1056671d309cSRandall Stewart 					 * fired */
1057851b7298SRandall Stewart 	uint32_t sctps_timodelprim;	/* Number of times a prim_deleted
1058851b7298SRandall Stewart 					 * timer fired */
1059671d309cSRandall Stewart 	uint32_t sctps_timoautoclose;	/* Number of times auto close timer
1060671d309cSRandall Stewart 					 * fired */
1061671d309cSRandall Stewart 	uint32_t sctps_timoassockill;	/* Number of asoc free timers expired */
1062671d309cSRandall Stewart 	uint32_t sctps_timoinpkill;	/* Number of inp free timers expired */
1063ca85e948SMichael Tuexen 	/* former early FR counters */
1064ca85e948SMichael Tuexen 	uint32_t sctps_spare[11];
1065b1ce21c6SRebecca Cran 	/* others */
1066671d309cSRandall Stewart 	uint32_t sctps_hdrops;	/* packet shorter than header */
1067671d309cSRandall Stewart 	uint32_t sctps_badsum;	/* checksum error             */
1068671d309cSRandall Stewart 	uint32_t sctps_noport;	/* no endpoint for port       */
1069671d309cSRandall Stewart 	uint32_t sctps_badvtag;	/* bad v-tag                  */
1070671d309cSRandall Stewart 	uint32_t sctps_badsid;	/* bad SID                    */
1071671d309cSRandall Stewart 	uint32_t sctps_nomem;	/* no memory                  */
1072671d309cSRandall Stewart 	uint32_t sctps_fastretransinrtt;	/* number of multiple FR in a
1073671d309cSRandall Stewart 						 * RTT window */
1074671d309cSRandall Stewart 	uint32_t sctps_markedretrans;
1075671d309cSRandall Stewart 	uint32_t sctps_naglesent;	/* nagle allowed sending      */
1076b1ce21c6SRebecca Cran 	uint32_t sctps_naglequeued;	/* nagle doesn't allow sending */
1077b1ce21c6SRebecca Cran 	uint32_t sctps_maxburstqueued;	/* max burst doesn't allow sending */
1078671d309cSRandall Stewart 	uint32_t sctps_ifnomemqueued;	/* look ahead tells us no memory in
1079478d3f09SRandall Stewart 					 * interface ring buffer OR we had a
1080478d3f09SRandall Stewart 					 * send error and are queuing one
1081478d3f09SRandall Stewart 					 * send. */
1082671d309cSRandall Stewart 	uint32_t sctps_windowprobed;	/* total number of window probes sent */
1083671d309cSRandall Stewart 	uint32_t sctps_lowlevelerr;	/* total times an output error causes
1084478d3f09SRandall Stewart 					 * us to clamp down on next user send. */
1085671d309cSRandall Stewart 	uint32_t sctps_lowlevelerrusr;	/* total times sctp_senderrors were
1086478d3f09SRandall Stewart 					 * caused from a user send from a user
1087478d3f09SRandall Stewart 					 * invoked send not a sack response */
1088671d309cSRandall Stewart 	uint32_t sctps_datadropchklmt;	/* Number of in data drops due to
1089478d3f09SRandall Stewart 					 * chunk limit reached */
1090671d309cSRandall Stewart 	uint32_t sctps_datadroprwnd;	/* Number of in data drops due to rwnd
1091478d3f09SRandall Stewart 					 * limit reached */
1092671d309cSRandall Stewart 	uint32_t sctps_ecnereducedcwnd;	/* Number of times a ECN reduced the
1093478d3f09SRandall Stewart 					 * cwnd */
1094671d309cSRandall Stewart 	uint32_t sctps_vtagexpress;	/* Used express lookup via vtag */
1095671d309cSRandall Stewart 	uint32_t sctps_vtagbogus;	/* Collision in express lookup. */
1096671d309cSRandall Stewart 	uint32_t sctps_primary_randry;	/* Number of times the sender ran dry
1097f8829a4aSRandall Stewart 					 * of user data on primary */
1098671d309cSRandall Stewart 	uint32_t sctps_cmt_randry;	/* Same for above */
1099671d309cSRandall Stewart 	uint32_t sctps_slowpath_sack;	/* Sacks the slow way */
1100671d309cSRandall Stewart 	uint32_t sctps_wu_sacks_sent;	/* Window Update only sacks sent */
1101671d309cSRandall Stewart 	uint32_t sctps_sends_with_flags;	/* number of sends with
1102671d309cSRandall Stewart 						 * sinfo_flags !=0 */
1103b1ce21c6SRebecca Cran 	uint32_t sctps_sends_with_unord;	/* number of unordered sends */
1104671d309cSRandall Stewart 	uint32_t sctps_sends_with_eof;	/* number of sends with EOF flag set */
1105671d309cSRandall Stewart 	uint32_t sctps_sends_with_abort;	/* number of sends with ABORT
1106671d309cSRandall Stewart 						 * flag set */
1107671d309cSRandall Stewart 	uint32_t sctps_protocol_drain_calls;	/* number of times protocol
1108478d3f09SRandall Stewart 						 * drain called */
1109671d309cSRandall Stewart 	uint32_t sctps_protocol_drains_done;	/* number of times we did a
1110478d3f09SRandall Stewart 						 * protocol drain */
1111671d309cSRandall Stewart 	uint32_t sctps_read_peeks;	/* Number of times recv was called
1112671d309cSRandall Stewart 					 * with peek */
1113671d309cSRandall Stewart 	uint32_t sctps_cached_chk;	/* Number of cached chunks used */
1114671d309cSRandall Stewart 	uint32_t sctps_cached_strmoq;	/* Number of cached stream oq's used */
1115b1ce21c6SRebecca Cran 	uint32_t sctps_left_abandon;	/* Number of unread messages abandoned
1116f1f73e57SRandall Stewart 					 * by close */
1117ea44232bSRandall Stewart 	uint32_t sctps_send_burst_avoid;	/* Unused */
1118671d309cSRandall Stewart 	uint32_t sctps_send_cwnd_avoid;	/* Send cwnd full  avoidance, already
111917205eccSRandall Stewart 					 * max burst inflight to net */
1120671d309cSRandall Stewart 	uint32_t sctps_fwdtsn_map_over;	/* number of map array over-runs via
1121207304d4SRandall Stewart 					 * fwd-tsn's */
1122d77e2e42SRandall Stewart 	uint32_t sctps_queue_upd_ecne;	/* Number of times we queued or
1123d77e2e42SRandall Stewart 					 * updated an ECN chunk on send queue */
11244a2b92d9SMichael Tuexen 	uint32_t sctps_recvzerocrc;	/* Number of accepted packets with
11254a2b92d9SMichael Tuexen 					 * zero CRC */
11264a2b92d9SMichael Tuexen 	uint32_t sctps_sendzerocrc;	/* Number of packets sent with zero
11274a2b92d9SMichael Tuexen 					 * CRC */
11284a2b92d9SMichael Tuexen 	uint32_t sctps_reserved[29];	/* Future ABI compat - remove int's
1129892f1c71SRandall Stewart 					 * from here when adding new */
1130f8829a4aSRandall Stewart };
1131f8829a4aSRandall Stewart 
1132f8829a4aSRandall Stewart #define SCTP_STAT_INCR(_x) SCTP_STAT_INCR_BY(_x,1)
1133f8829a4aSRandall Stewart #define SCTP_STAT_DECR(_x) SCTP_STAT_DECR_BY(_x,1)
11342f9e6db0SMichael Tuexen #if defined(SMP) && defined(SCTP_USE_PERCPU_STAT)
1135ff014514SRandall Stewart #define SCTP_STAT_INCR_BY(_x,_d) (SCTP_BASE_STATS[PCPU_GET(cpuid)]._x += _d)
1136ff014514SRandall Stewart #define SCTP_STAT_DECR_BY(_x,_d) (SCTP_BASE_STATS[PCPU_GET(cpuid)]._x -= _d)
1137ff014514SRandall Stewart #else
1138b3f1ea41SRandall Stewart #define SCTP_STAT_INCR_BY(_x,_d) atomic_add_int(&SCTP_BASE_STAT(_x), _d)
1139b3f1ea41SRandall Stewart #define SCTP_STAT_DECR_BY(_x,_d) atomic_subtract_int(&SCTP_BASE_STAT(_x), _d)
1140ff014514SRandall Stewart #endif
1141f8829a4aSRandall Stewart /* The following macros are for handling MIB values, */
1142f8829a4aSRandall Stewart #define SCTP_STAT_INCR_COUNTER32(_x) SCTP_STAT_INCR(_x)
1143f8829a4aSRandall Stewart #define SCTP_STAT_INCR_COUNTER64(_x) SCTP_STAT_INCR(_x)
1144f8829a4aSRandall Stewart #define SCTP_STAT_INCR_GAUGE32(_x) SCTP_STAT_INCR(_x)
1145f8829a4aSRandall Stewart #define SCTP_STAT_DECR_COUNTER32(_x) SCTP_STAT_DECR(_x)
1146f8829a4aSRandall Stewart #define SCTP_STAT_DECR_COUNTER64(_x) SCTP_STAT_DECR(_x)
1147f8829a4aSRandall Stewart #define SCTP_STAT_DECR_GAUGE32(_x) SCTP_STAT_DECR(_x)
1148f8829a4aSRandall Stewart 
1149049640c1SMichael Tuexen /***********************************/
1150049640c1SMichael Tuexen /* And something for us old timers */
1151049640c1SMichael Tuexen /***********************************/
1152049640c1SMichael Tuexen 
1153049640c1SMichael Tuexen #ifndef ntohll
1154049640c1SMichael Tuexen #include <sys/endian.h>
1155049640c1SMichael Tuexen #define ntohll(x) be64toh(x)
1156049640c1SMichael Tuexen #endif
1157049640c1SMichael Tuexen 
1158049640c1SMichael Tuexen #ifndef htonll
1159049640c1SMichael Tuexen #include <sys/endian.h>
1160049640c1SMichael Tuexen #define htonll(x) htobe64(x)
1161049640c1SMichael Tuexen #endif
1162049640c1SMichael Tuexen /***********************************/
1163049640c1SMichael Tuexen 
1164a5d547adSRandall Stewart struct xsctp_inpcb {
1165a5d547adSRandall Stewart 	uint32_t last;
1166a5d547adSRandall Stewart 	uint32_t flags;
11676be15a24SMichael Tuexen 	uint64_t features;
1168a5d547adSRandall Stewart 	uint32_t total_sends;
1169a5d547adSRandall Stewart 	uint32_t total_recvs;
1170a5d547adSRandall Stewart 	uint32_t total_nospaces;
117117205eccSRandall Stewart 	uint32_t fragmentation_point;
1172671d309cSRandall Stewart 	uint16_t local_port;
11737325dfbbSAlfred Perlstein 	uint16_t qlen_old;
11747325dfbbSAlfred Perlstein 	uint16_t maxqlen_old;
1175f38b68aeSBrooks Davis 	uint16_t __spare16;
1176f38b68aeSBrooks Davis 	kvaddr_t socket;
11777325dfbbSAlfred Perlstein 	uint32_t qlen;
11787325dfbbSAlfred Perlstein 	uint32_t maxqlen;
1179f38b68aeSBrooks Davis 	uint32_t extra_padding[26];	/* future */
1180a5d547adSRandall Stewart };
1181a5d547adSRandall Stewart 
1182a5d547adSRandall Stewart struct xsctp_tcb {
1183d61a0ae0SRandall Stewart 	union sctp_sockstore primary_addr;	/* sctpAssocEntry 5/6 */
1184671d309cSRandall Stewart 	uint32_t last;
1185d61a0ae0SRandall Stewart 	uint32_t heartbeat_interval;	/* sctpAssocEntry 7   */
1186d61a0ae0SRandall Stewart 	uint32_t state;		/* sctpAssocEntry 8   */
1187d61a0ae0SRandall Stewart 	uint32_t in_streams;	/* sctpAssocEntry 9   */
1188d61a0ae0SRandall Stewart 	uint32_t out_streams;	/* sctpAssocEntry 10  */
1189d61a0ae0SRandall Stewart 	uint32_t max_nr_retrans;	/* sctpAssocEntry 11  */
1190d61a0ae0SRandall Stewart 	uint32_t primary_process;	/* sctpAssocEntry 12  */
1191d61a0ae0SRandall Stewart 	uint32_t T1_expireries;	/* sctpAssocEntry 13  */
1192d61a0ae0SRandall Stewart 	uint32_t T2_expireries;	/* sctpAssocEntry 14  */
1193d61a0ae0SRandall Stewart 	uint32_t retransmitted_tsns;	/* sctpAssocEntry 15  */
1194a5d547adSRandall Stewart 	uint32_t total_sends;
1195a5d547adSRandall Stewart 	uint32_t total_recvs;
1196a5d547adSRandall Stewart 	uint32_t local_tag;
1197a5d547adSRandall Stewart 	uint32_t remote_tag;
1198a5d547adSRandall Stewart 	uint32_t initial_tsn;
1199a5d547adSRandall Stewart 	uint32_t highest_tsn;
1200a5d547adSRandall Stewart 	uint32_t cumulative_tsn;
1201a5d547adSRandall Stewart 	uint32_t cumulative_tsn_ack;
120217205eccSRandall Stewart 	uint32_t mtu;
1203207304d4SRandall Stewart 	uint32_t refcnt;
1204671d309cSRandall Stewart 	uint16_t local_port;	/* sctpAssocEntry 3   */
1205671d309cSRandall Stewart 	uint16_t remote_port;	/* sctpAssocEntry 4   */
1206851b7298SRandall Stewart 	struct sctp_timeval start_time;	/* sctpAssocEntry 16  */
1207851b7298SRandall Stewart 	struct sctp_timeval discontinuity_time;	/* sctpAssocEntry 17  */
12084f6b4933SRandall Stewart 	uint32_t peers_rwnd;
1209a99b6783SRandall Stewart 	sctp_assoc_t assoc_id;	/* sctpAssocEntry 1   */
1210e29d4aa6SRandall Stewart 	uint32_t extra_padding[32];	/* future */
1211a5d547adSRandall Stewart };
1212a5d547adSRandall Stewart 
1213a5d547adSRandall Stewart struct xsctp_laddr {
1214d61a0ae0SRandall Stewart 	union sctp_sockstore address;	/* sctpAssocLocalAddrEntry 1/2 */
1215671d309cSRandall Stewart 	uint32_t last;
1216851b7298SRandall Stewart 	struct sctp_timeval start_time;	/* sctpAssocLocalAddrEntry 3   */
1217e29d4aa6SRandall Stewart 	uint32_t extra_padding[32];	/* future */
1218a5d547adSRandall Stewart };
1219a5d547adSRandall Stewart 
1220a5d547adSRandall Stewart struct xsctp_raddr {
1221d61a0ae0SRandall Stewart 	union sctp_sockstore address;	/* sctpAssocLocalRemEntry 1/2 */
1222671d309cSRandall Stewart 	uint32_t last;
1223d61a0ae0SRandall Stewart 	uint32_t rto;		/* sctpAssocLocalRemEntry 5   */
1224d61a0ae0SRandall Stewart 	uint32_t max_path_rtx;	/* sctpAssocLocalRemEntry 6   */
1225d61a0ae0SRandall Stewart 	uint32_t rtx;		/* sctpAssocLocalRemEntry 7   */
1226d61a0ae0SRandall Stewart 	uint32_t error_counter;	/* */
1227d61a0ae0SRandall Stewart 	uint32_t cwnd;		/* */
1228d61a0ae0SRandall Stewart 	uint32_t flight_size;	/* */
1229d61a0ae0SRandall Stewart 	uint32_t mtu;		/* */
1230671d309cSRandall Stewart 	uint8_t active;		/* sctpAssocLocalRemEntry 3   */
1231671d309cSRandall Stewart 	uint8_t confirmed;	/* */
1232671d309cSRandall Stewart 	uint8_t heartbeat_enabled;	/* sctpAssocLocalRemEntry 4   */
1233ca85e948SMichael Tuexen 	uint8_t potentially_failed;
1234851b7298SRandall Stewart 	struct sctp_timeval start_time;	/* sctpAssocLocalRemEntry 8   */
1235e29d4aa6SRandall Stewart 	uint32_t rtt;
1236ca85e948SMichael Tuexen 	uint32_t heartbeat_interval;
123729b9533bSMichael Tuexen 	uint32_t ssthresh;
1238292efb1bSMichael Tuexen 	uint16_t encaps_port;
1239292efb1bSMichael Tuexen 	uint16_t state;
1240292efb1bSMichael Tuexen 	uint32_t extra_padding[29];	/* future */
1241a5d547adSRandall Stewart };
124203b0b021SRandall Stewart 
1243b27a6b7dSRandall Stewart #define SCTP_MAX_LOGGING_SIZE 30000
1244b27a6b7dSRandall Stewart #define SCTP_TRACE_PARAMS 6	/* This number MUST be even   */
1245b27a6b7dSRandall Stewart 
1246b27a6b7dSRandall Stewart struct sctp_log_entry {
1247c99efcf6SRandall Stewart 	uint64_t timestamp;
1248b27a6b7dSRandall Stewart 	uint32_t subsys;
1249b27a6b7dSRandall Stewart 	uint32_t padding;
1250b27a6b7dSRandall Stewart 	uint32_t params[SCTP_TRACE_PARAMS];
1251b27a6b7dSRandall Stewart };
1252b27a6b7dSRandall Stewart 
1253b27a6b7dSRandall Stewart struct sctp_log {
1254b27a6b7dSRandall Stewart 	struct sctp_log_entry entry[SCTP_MAX_LOGGING_SIZE];
1255b27a6b7dSRandall Stewart 	uint32_t index;
1256b27a6b7dSRandall Stewart 	uint32_t padding;
1257b27a6b7dSRandall Stewart };
1258b27a6b7dSRandall Stewart 
1259f8829a4aSRandall Stewart /*
1260f8829a4aSRandall Stewart  * Kernel defined for sctp_send
1261f8829a4aSRandall Stewart  */
1262fc14de76SRandall Stewart #if defined(_KERNEL) || defined(__Userspace__)
1263f8829a4aSRandall Stewart int
1264f8829a4aSRandall Stewart sctp_lower_sosend(struct socket *so,
1265f8829a4aSRandall Stewart     struct sockaddr *addr,
1266f8829a4aSRandall Stewart     struct uio *uio,
12675ac91821SMichael Tuexen     struct mbuf *top,
1268f8829a4aSRandall Stewart     struct mbuf *control,
1269f8829a4aSRandall Stewart     int flags,
1270c105859eSRandall Stewart     struct sctp_sndrcvinfo *srcv
1271c105859eSRandall Stewart     ,struct thread *p
1272f8829a4aSRandall Stewart );
1273f8829a4aSRandall Stewart 
1274f8829a4aSRandall Stewart int
1275f8829a4aSRandall Stewart sctp_sorecvmsg(struct socket *so,
1276f8829a4aSRandall Stewart     struct uio *uio,
1277f8829a4aSRandall Stewart     struct mbuf **mp,
1278f8829a4aSRandall Stewart     struct sockaddr *from,
1279f8829a4aSRandall Stewart     int fromlen,
1280f8829a4aSRandall Stewart     int *msg_flags,
1281f8829a4aSRandall Stewart     struct sctp_sndrcvinfo *sinfo,
1282f8829a4aSRandall Stewart     int filling_sinfo);
1283f8829a4aSRandall Stewart #endif
1284f8829a4aSRandall Stewart 
1285f8829a4aSRandall Stewart /*
1286f8829a4aSRandall Stewart  * API system calls
1287f8829a4aSRandall Stewart  */
1288fc14de76SRandall Stewart #if !(defined(_KERNEL)) && !(defined(__Userspace__))
1289f8829a4aSRandall Stewart 
1290f8829a4aSRandall Stewart __BEGIN_DECLS
12916f56329aSXin LI int sctp_peeloff(int, sctp_assoc_t);
12926f56329aSXin LI int sctp_bindx(int, struct sockaddr *, int, int);
12936f56329aSXin LI int sctp_connectx(int, const struct sockaddr *, int, sctp_assoc_t *);
12946f56329aSXin LI int sctp_getaddrlen(sa_family_t);
12956f56329aSXin LI int sctp_getpaddrs(int, sctp_assoc_t, struct sockaddr **);
12966f56329aSXin LI void sctp_freepaddrs(struct sockaddr *);
12976f56329aSXin LI int sctp_getladdrs(int, sctp_assoc_t, struct sockaddr **);
12986f56329aSXin LI void sctp_freeladdrs(struct sockaddr *);
12996f56329aSXin LI int sctp_opt_info(int, sctp_assoc_t, int, void *, socklen_t *);
1300f8829a4aSRandall Stewart 
1301e2e7c62eSMichael Tuexen /* deprecated */
130221f67da7SMichael Tuexen ssize_t
130321f67da7SMichael Tuexen sctp_sendmsg(int, const void *, size_t, const struct sockaddr *,
13046f56329aSXin LI     socklen_t, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t);
1305f8829a4aSRandall Stewart 
1306e2e7c62eSMichael Tuexen /* deprecated */
130721f67da7SMichael Tuexen ssize_t
130821f67da7SMichael Tuexen sctp_send(int, const void *, size_t,
13096f56329aSXin LI     const struct sctp_sndrcvinfo *, int);
1310f8829a4aSRandall Stewart 
1311e2e7c62eSMichael Tuexen /* deprecated */
131221f67da7SMichael Tuexen ssize_t
131321f67da7SMichael Tuexen sctp_sendx(int, const void *, size_t, struct sockaddr *,
13146f56329aSXin LI     int, struct sctp_sndrcvinfo *, int);
131517205eccSRandall Stewart 
1316e2e7c62eSMichael Tuexen /* deprecated */
131721f67da7SMichael Tuexen ssize_t
131821f67da7SMichael Tuexen sctp_sendmsgx(int sd, const void *, size_t, struct sockaddr *,
13196f56329aSXin LI     int, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t);
1320f8829a4aSRandall Stewart 
13216f56329aSXin LI sctp_assoc_t sctp_getassocid(int, struct sockaddr *);
1322f8829a4aSRandall Stewart 
1323e2e7c62eSMichael Tuexen /* deprecated */
132421f67da7SMichael Tuexen ssize_t
132521f67da7SMichael Tuexen sctp_recvmsg(int, void *, size_t, struct sockaddr *, socklen_t *,
13266f56329aSXin LI     struct sctp_sndrcvinfo *, int *);
1327e2e7c62eSMichael Tuexen 
132821f67da7SMichael Tuexen ssize_t
132921f67da7SMichael Tuexen sctp_sendv(int, const struct iovec *, int, struct sockaddr *,
13306f56329aSXin LI     int, void *, socklen_t, unsigned int, int);
1331e2e7c62eSMichael Tuexen 
133221f67da7SMichael Tuexen ssize_t
133321f67da7SMichael Tuexen sctp_recvv(int, const struct iovec *, int, struct sockaddr *,
13346f56329aSXin LI     socklen_t *, void *, socklen_t *, unsigned int *, int *);
1335f8829a4aSRandall Stewart 
1336f8829a4aSRandall Stewart __END_DECLS
1337f8829a4aSRandall Stewart 
1338f8829a4aSRandall Stewart #endif				/* !_KERNEL */
1339f8829a4aSRandall Stewart #endif				/* !__sctp_uio_h__ */
1340