xref: /freebsd/sys/netinet/sctp_uio.h (revision 42551e99)
1f8829a4aSRandall Stewart /*-
242551e99SRandall Stewart  * Copyright (c) 2001-2007, Cisco Systems, Inc. All rights reserved.
3f8829a4aSRandall Stewart  *
4f8829a4aSRandall Stewart  * Redistribution and use in source and binary forms, with or without
5f8829a4aSRandall Stewart  * modification, are permitted provided that the following conditions are met:
6f8829a4aSRandall Stewart  *
7f8829a4aSRandall Stewart  * a) Redistributions of source code must retain the above copyright notice,
8f8829a4aSRandall Stewart  *   this list of conditions and the following disclaimer.
9f8829a4aSRandall Stewart  *
10f8829a4aSRandall Stewart  * b) Redistributions in binary form must reproduce the above copyright
11f8829a4aSRandall Stewart  *    notice, this list of conditions and the following disclaimer in
12f8829a4aSRandall Stewart  *   the documentation and/or other materials provided with the distribution.
13f8829a4aSRandall Stewart  *
14f8829a4aSRandall Stewart  * c) Neither the name of Cisco Systems, Inc. nor the names of its
15f8829a4aSRandall Stewart  *    contributors may be used to endorse or promote products derived
16f8829a4aSRandall Stewart  *    from this software without specific prior written permission.
17f8829a4aSRandall Stewart  *
18f8829a4aSRandall Stewart  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19f8829a4aSRandall Stewart  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20f8829a4aSRandall Stewart  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21f8829a4aSRandall Stewart  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22f8829a4aSRandall Stewart  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23f8829a4aSRandall Stewart  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24f8829a4aSRandall Stewart  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25f8829a4aSRandall Stewart  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26f8829a4aSRandall Stewart  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27f8829a4aSRandall Stewart  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28f8829a4aSRandall Stewart  * THE POSSIBILITY OF SUCH DAMAGE.
29f8829a4aSRandall Stewart  */
30f8829a4aSRandall Stewart 
31f8829a4aSRandall Stewart /* $KAME: sctp_uio.h,v 1.11 2005/03/06 16:04:18 itojun Exp $	 */
32f8829a4aSRandall Stewart #include <sys/cdefs.h>
33f8829a4aSRandall Stewart __FBSDID("$FreeBSD$");
34f8829a4aSRandall Stewart 
35f8829a4aSRandall Stewart #ifndef __sctp_uio_h__
36f8829a4aSRandall Stewart #define __sctp_uio_h__
37f8829a4aSRandall Stewart 
38f8829a4aSRandall Stewart 
39f8829a4aSRandall Stewart #if ! defined(_KERNEL)
40f8829a4aSRandall Stewart #include <stdint.h>
41f8829a4aSRandall Stewart #endif
42f8829a4aSRandall Stewart #include <sys/types.h>
43f8829a4aSRandall Stewart #include <sys/socket.h>
44f42a358aSRandall Stewart #include <sys/time.h>
4503b0b021SRandall Stewart #include <netinet/in.h>
46f8829a4aSRandall Stewart 
47f8829a4aSRandall Stewart typedef uint32_t sctp_assoc_t;
48f8829a4aSRandall Stewart 
49f8829a4aSRandall Stewart /* On/Off setup for subscription to events */
50f8829a4aSRandall Stewart struct sctp_event_subscribe {
51f8829a4aSRandall Stewart 	uint8_t sctp_data_io_event;
52f8829a4aSRandall Stewart 	uint8_t sctp_association_event;
53f8829a4aSRandall Stewart 	uint8_t sctp_address_event;
54f8829a4aSRandall Stewart 	uint8_t sctp_send_failure_event;
55f8829a4aSRandall Stewart 	uint8_t sctp_peer_error_event;
56f8829a4aSRandall Stewart 	uint8_t sctp_shutdown_event;
57f8829a4aSRandall Stewart 	uint8_t sctp_partial_delivery_event;
58f8829a4aSRandall Stewart 	uint8_t sctp_adaptation_layer_event;
59f8829a4aSRandall Stewart 	uint8_t sctp_authentication_event;
60f8829a4aSRandall Stewart 	uint8_t sctp_stream_reset_events;
61f8829a4aSRandall Stewart };
62f8829a4aSRandall Stewart 
63f8829a4aSRandall Stewart /* ancillary data types */
64f8829a4aSRandall Stewart #define SCTP_INIT	0x0001
65f8829a4aSRandall Stewart #define SCTP_SNDRCV	0x0002
66f8829a4aSRandall Stewart #define SCTP_EXTRCV	0x0003
67f8829a4aSRandall Stewart /*
68f8829a4aSRandall Stewart  * ancillary data structures
69f8829a4aSRandall Stewart  */
70f8829a4aSRandall Stewart struct sctp_initmsg {
71f8829a4aSRandall Stewart 	uint32_t sinit_num_ostreams;
72f8829a4aSRandall Stewart 	uint32_t sinit_max_instreams;
73f8829a4aSRandall Stewart 	uint16_t sinit_max_attempts;
74f8829a4aSRandall Stewart 	uint16_t sinit_max_init_timeo;
75f8829a4aSRandall Stewart };
76f8829a4aSRandall Stewart 
77f8829a4aSRandall Stewart /* We add 96 bytes to the size of sctp_sndrcvinfo.
78f8829a4aSRandall Stewart  * This makes the current structure 128 bytes long
79f8829a4aSRandall Stewart  * which is nicely 64 bit aligned but also has room
80f8829a4aSRandall Stewart  * for us to add more and keep ABI compatability.
81f8829a4aSRandall Stewart  * For example, already we have the sctp_extrcvinfo
82f8829a4aSRandall Stewart  * when enabled which is 48 bytes.
83f8829a4aSRandall Stewart  */
84f8829a4aSRandall Stewart 
85f42a358aSRandall Stewart /*
86f42a358aSRandall Stewart  * The assoc up needs a verfid
87f42a358aSRandall Stewart  * all sendrcvinfo's need a verfid for SENDING only.
88f42a358aSRandall Stewart  */
89f42a358aSRandall Stewart 
90f42a358aSRandall Stewart 
91f8829a4aSRandall Stewart #define SCTP_ALIGN_RESV_PAD 96
92f42a358aSRandall Stewart #define SCTP_ALIGN_RESV_PAD_SHORT 80
93f8829a4aSRandall Stewart 
94f8829a4aSRandall Stewart struct sctp_sndrcvinfo {
95f8829a4aSRandall Stewart 	uint16_t sinfo_stream;
96f8829a4aSRandall Stewart 	uint16_t sinfo_ssn;
97f8829a4aSRandall Stewart 	uint16_t sinfo_flags;
98f8829a4aSRandall Stewart 	uint32_t sinfo_ppid;
99f8829a4aSRandall Stewart 	uint32_t sinfo_context;
100f8829a4aSRandall Stewart 	uint32_t sinfo_timetolive;
101f8829a4aSRandall Stewart 	uint32_t sinfo_tsn;
102f8829a4aSRandall Stewart 	uint32_t sinfo_cumtsn;
103f8829a4aSRandall Stewart 	sctp_assoc_t sinfo_assoc_id;
104f8829a4aSRandall Stewart 	uint8_t __reserve_pad[SCTP_ALIGN_RESV_PAD];
105f8829a4aSRandall Stewart };
106f8829a4aSRandall Stewart 
107f8829a4aSRandall Stewart struct sctp_extrcvinfo {
108f8829a4aSRandall Stewart 	uint16_t sinfo_stream;
109f8829a4aSRandall Stewart 	uint16_t sinfo_ssn;
110f8829a4aSRandall Stewart 	uint16_t sinfo_flags;
111f8829a4aSRandall Stewart 	uint32_t sinfo_ppid;
112f8829a4aSRandall Stewart 	uint32_t sinfo_context;
113f8829a4aSRandall Stewart 	uint32_t sinfo_timetolive;
114f8829a4aSRandall Stewart 	uint32_t sinfo_tsn;
115f8829a4aSRandall Stewart 	uint32_t sinfo_cumtsn;
116f8829a4aSRandall Stewart 	sctp_assoc_t sinfo_assoc_id;
117f8829a4aSRandall Stewart 	uint16_t next_flags;
118f8829a4aSRandall Stewart 	uint16_t next_stream;
119f8829a4aSRandall Stewart 	uint32_t next_asocid;
120f8829a4aSRandall Stewart 	uint32_t next_length;
121f8829a4aSRandall Stewart 	uint32_t next_ppid;
122f42a358aSRandall Stewart 	uint8_t __reserve_pad[SCTP_ALIGN_RESV_PAD_SHORT];
123f8829a4aSRandall Stewart };
124f8829a4aSRandall Stewart 
125f8829a4aSRandall Stewart #define SCTP_NO_NEXT_MSG           0x0000
126f8829a4aSRandall Stewart #define SCTP_NEXT_MSG_AVAIL        0x0001
127f8829a4aSRandall Stewart #define SCTP_NEXT_MSG_ISCOMPLETE   0x0002
128f8829a4aSRandall Stewart #define SCTP_NEXT_MSG_IS_UNORDERED 0x0004
129f42a358aSRandall Stewart #define SCTP_NEXT_MSG_IS_NOTIFICATION 0x0008
130f8829a4aSRandall Stewart 
131f8829a4aSRandall Stewart struct sctp_snd_all_completes {
132f8829a4aSRandall Stewart 	uint16_t sall_stream;
133f8829a4aSRandall Stewart 	uint16_t sall_flags;
134f8829a4aSRandall Stewart 	uint32_t sall_ppid;
135f8829a4aSRandall Stewart 	uint32_t sall_context;
136f8829a4aSRandall Stewart 	uint32_t sall_num_sent;
137f8829a4aSRandall Stewart 	uint32_t sall_num_failed;
138f8829a4aSRandall Stewart };
139f8829a4aSRandall Stewart 
140f8829a4aSRandall Stewart /* Flags that go into the sinfo->sinfo_flags field */
141f8829a4aSRandall Stewart #define SCTP_EOF 	  0x0100/* Start shutdown procedures */
142f8829a4aSRandall Stewart #define SCTP_ABORT	  0x0200/* Send an ABORT to peer */
143f8829a4aSRandall Stewart #define SCTP_UNORDERED 	  0x0400/* Message is un-ordered */
144f8829a4aSRandall Stewart #define SCTP_ADDR_OVER	  0x0800/* Override the primary-address */
145f8829a4aSRandall Stewart #define SCTP_SENDALL      0x1000/* Send this on all associations */
146f8829a4aSRandall Stewart #define SCTP_EOR          0x2000/* end of message signal */
14744b7479bSRandall Stewart #define INVALID_SINFO_FLAG(x) (((x) & 0xffffff00 \
14844b7479bSRandall Stewart                                     & ~(SCTP_EOF | SCTP_ABORT | SCTP_UNORDERED |\
14944b7479bSRandall Stewart 				        SCTP_ADDR_OVER | SCTP_SENDALL | SCTP_EOR)) != 0)
150f8829a4aSRandall Stewart /* for the endpoint */
151f8829a4aSRandall Stewart 
152f8829a4aSRandall Stewart /* The lower byte is an enumeration of PR-SCTP policies */
153f8829a4aSRandall Stewart #define SCTP_PR_SCTP_TTL  0x0001/* Time based PR-SCTP */
154f8829a4aSRandall Stewart #define SCTP_PR_SCTP_BUF  0x0002/* Buffer based PR-SCTP */
155f8829a4aSRandall Stewart #define SCTP_PR_SCTP_RTX  0x0003/* Number of retransmissions based PR-SCTP */
156f8829a4aSRandall Stewart 
157f8829a4aSRandall Stewart #define PR_SCTP_POLICY(x)         ((x) & 0xff)
158f8829a4aSRandall Stewart #define PR_SCTP_ENABLED(x)        (PR_SCTP_POLICY(x) != 0)
159f8829a4aSRandall Stewart #define PR_SCTP_TTL_ENABLED(x)    (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_TTL)
160f8829a4aSRandall Stewart #define PR_SCTP_BUF_ENABLED(x)    (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_BUF)
161f8829a4aSRandall Stewart #define PR_SCTP_RTX_ENABLED(x)    (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_RTX)
16244b7479bSRandall Stewart #define PR_SCTP_INVALID_POLICY(x) (PR_SCTP_POLICY(x) > SCTP_PR_SCTP_RTX)
163f8829a4aSRandall Stewart /* Stat's */
164f8829a4aSRandall Stewart struct sctp_pcbinfo {
165f8829a4aSRandall Stewart 	uint32_t ep_count;
166f8829a4aSRandall Stewart 	uint32_t asoc_count;
167f8829a4aSRandall Stewart 	uint32_t laddr_count;
168f8829a4aSRandall Stewart 	uint32_t raddr_count;
169f8829a4aSRandall Stewart 	uint32_t chk_count;
170f8829a4aSRandall Stewart 	uint32_t readq_count;
171f8829a4aSRandall Stewart 	uint32_t free_chunks;
172f8829a4aSRandall Stewart 	uint32_t stream_oque;
173f8829a4aSRandall Stewart };
174f8829a4aSRandall Stewart 
175f8829a4aSRandall Stewart struct sctp_sockstat {
176f8829a4aSRandall Stewart 	sctp_assoc_t ss_assoc_id;
177f8829a4aSRandall Stewart 	uint32_t ss_total_sndbuf;
178f8829a4aSRandall Stewart 	uint32_t ss_total_recv_buf;
179f8829a4aSRandall Stewart };
180f8829a4aSRandall Stewart 
181f8829a4aSRandall Stewart /*
182f8829a4aSRandall Stewart  * notification event structures
183f8829a4aSRandall Stewart  */
184f8829a4aSRandall Stewart 
185f8829a4aSRandall Stewart /*
186f8829a4aSRandall Stewart  * association change event
187f8829a4aSRandall Stewart  */
188f8829a4aSRandall Stewart struct sctp_assoc_change {
189f8829a4aSRandall Stewart 	uint16_t sac_type;
190f8829a4aSRandall Stewart 	uint16_t sac_flags;
191f8829a4aSRandall Stewart 	uint32_t sac_length;
192f8829a4aSRandall Stewart 	uint16_t sac_state;
193f8829a4aSRandall Stewart 	uint16_t sac_error;
194f8829a4aSRandall Stewart 	uint16_t sac_outbound_streams;
195f8829a4aSRandall Stewart 	uint16_t sac_inbound_streams;
196f8829a4aSRandall Stewart 	sctp_assoc_t sac_assoc_id;
197f8829a4aSRandall Stewart };
198f8829a4aSRandall Stewart 
199f8829a4aSRandall Stewart /* sac_state values */
200f8829a4aSRandall Stewart #define SCTP_COMM_UP		0x0001
201f8829a4aSRandall Stewart #define SCTP_COMM_LOST		0x0002
202f8829a4aSRandall Stewart #define SCTP_RESTART		0x0003
203f8829a4aSRandall Stewart #define SCTP_SHUTDOWN_COMP	0x0004
204f8829a4aSRandall Stewart #define SCTP_CANT_STR_ASSOC	0x0005
205f8829a4aSRandall Stewart 
206f8829a4aSRandall Stewart 
207f8829a4aSRandall Stewart /*
208f8829a4aSRandall Stewart  * Address event
209f8829a4aSRandall Stewart  */
210f8829a4aSRandall Stewart struct sctp_paddr_change {
211f8829a4aSRandall Stewart 	uint16_t spc_type;
212f8829a4aSRandall Stewart 	uint16_t spc_flags;
213f8829a4aSRandall Stewart 	uint32_t spc_length;
214f8829a4aSRandall Stewart 	struct sockaddr_storage spc_aaddr;
215f8829a4aSRandall Stewart 	uint32_t spc_state;
216f8829a4aSRandall Stewart 	uint32_t spc_error;
217f8829a4aSRandall Stewart 	sctp_assoc_t spc_assoc_id;
218f8829a4aSRandall Stewart };
219f8829a4aSRandall Stewart 
220f8829a4aSRandall Stewart /* paddr state values */
221f8829a4aSRandall Stewart #define SCTP_ADDR_AVAILABLE	0x0001
222f8829a4aSRandall Stewart #define SCTP_ADDR_UNREACHABLE	0x0002
223f8829a4aSRandall Stewart #define SCTP_ADDR_REMOVED	0x0003
224f8829a4aSRandall Stewart #define SCTP_ADDR_ADDED		0x0004
225f8829a4aSRandall Stewart #define SCTP_ADDR_MADE_PRIM	0x0005
226f8829a4aSRandall Stewart #define SCTP_ADDR_CONFIRMED	0x0006
227f8829a4aSRandall Stewart 
228f8829a4aSRandall Stewart /*
229f8829a4aSRandall Stewart  * CAUTION: these are user exposed SCTP addr reachability states must be
230f8829a4aSRandall Stewart  * compatible with SCTP_ADDR states in sctp_constants.h
231f8829a4aSRandall Stewart  */
232f8829a4aSRandall Stewart #ifdef SCTP_ACTIVE
233f8829a4aSRandall Stewart #undef SCTP_ACTIVE
234f8829a4aSRandall Stewart #endif
235f8829a4aSRandall Stewart #define SCTP_ACTIVE		0x0001	/* SCTP_ADDR_REACHABLE */
236f8829a4aSRandall Stewart 
237f8829a4aSRandall Stewart #ifdef SCTP_INACTIVE
238f8829a4aSRandall Stewart #undef SCTP_INACTIVE
239f8829a4aSRandall Stewart #endif
240f8829a4aSRandall Stewart #define SCTP_INACTIVE		0x0002	/* SCTP_ADDR_NOT_REACHABLE */
241f8829a4aSRandall Stewart 
242f8829a4aSRandall Stewart #ifdef SCTP_UNCONFIRMED
243f8829a4aSRandall Stewart #undef SCTP_UNCONFIRMED
244f8829a4aSRandall Stewart #endif
245f8829a4aSRandall Stewart #define SCTP_UNCONFIRMED	0x0200	/* SCTP_ADDR_UNCONFIRMED */
246f8829a4aSRandall Stewart 
247f8829a4aSRandall Stewart #ifdef SCTP_NOHEARTBEAT
248f8829a4aSRandall Stewart #undef SCTP_NOHEARTBEAT
249f8829a4aSRandall Stewart #endif
250f8829a4aSRandall Stewart #define SCTP_NOHEARTBEAT	0x0040	/* SCTP_ADDR_NOHB */
251f8829a4aSRandall Stewart 
252f8829a4aSRandall Stewart 
253f8829a4aSRandall Stewart /* remote error events */
254f8829a4aSRandall Stewart struct sctp_remote_error {
255f8829a4aSRandall Stewart 	uint16_t sre_type;
256f8829a4aSRandall Stewart 	uint16_t sre_flags;
257f8829a4aSRandall Stewart 	uint32_t sre_length;
258f8829a4aSRandall Stewart 	uint16_t sre_error;
259f8829a4aSRandall Stewart 	sctp_assoc_t sre_assoc_id;
260f8829a4aSRandall Stewart 	uint8_t sre_data[4];
261f8829a4aSRandall Stewart };
262f8829a4aSRandall Stewart 
263f8829a4aSRandall Stewart /* data send failure event */
264f8829a4aSRandall Stewart struct sctp_send_failed {
265f8829a4aSRandall Stewart 	uint16_t ssf_type;
266f8829a4aSRandall Stewart 	uint16_t ssf_flags;
267f8829a4aSRandall Stewart 	uint32_t ssf_length;
268f8829a4aSRandall Stewart 	uint32_t ssf_error;
269f8829a4aSRandall Stewart 	struct sctp_sndrcvinfo ssf_info;
270f8829a4aSRandall Stewart 	sctp_assoc_t ssf_assoc_id;
271f8829a4aSRandall Stewart 	uint8_t ssf_data[4];
272f8829a4aSRandall Stewart };
273f8829a4aSRandall Stewart 
274f8829a4aSRandall Stewart /* flag that indicates state of data */
275f8829a4aSRandall Stewart #define SCTP_DATA_UNSENT	0x0001	/* inqueue never on wire */
276f8829a4aSRandall Stewart #define SCTP_DATA_SENT		0x0002	/* on wire at failure */
277f8829a4aSRandall Stewart 
278f8829a4aSRandall Stewart /* shutdown event */
279f8829a4aSRandall Stewart struct sctp_shutdown_event {
280f8829a4aSRandall Stewart 	uint16_t sse_type;
281f8829a4aSRandall Stewart 	uint16_t sse_flags;
282f8829a4aSRandall Stewart 	uint32_t sse_length;
283f8829a4aSRandall Stewart 	sctp_assoc_t sse_assoc_id;
284f8829a4aSRandall Stewart };
285f8829a4aSRandall Stewart 
286f8829a4aSRandall Stewart /* Adaptation layer indication stuff */
287f8829a4aSRandall Stewart struct sctp_adaptation_event {
288f8829a4aSRandall Stewart 	uint16_t sai_type;
289f8829a4aSRandall Stewart 	uint16_t sai_flags;
290f8829a4aSRandall Stewart 	uint32_t sai_length;
291f8829a4aSRandall Stewart 	uint32_t sai_adaptation_ind;
292f8829a4aSRandall Stewart 	sctp_assoc_t sai_assoc_id;
293f8829a4aSRandall Stewart };
294f8829a4aSRandall Stewart 
295f8829a4aSRandall Stewart struct sctp_setadaptation {
296f8829a4aSRandall Stewart 	uint32_t ssb_adaptation_ind;
297f8829a4aSRandall Stewart };
298f8829a4aSRandall Stewart 
299f8829a4aSRandall Stewart /* compatable old spelling */
300f8829a4aSRandall Stewart struct sctp_adaption_event {
301f8829a4aSRandall Stewart 	uint16_t sai_type;
302f8829a4aSRandall Stewart 	uint16_t sai_flags;
303f8829a4aSRandall Stewart 	uint32_t sai_length;
304f8829a4aSRandall Stewart 	uint32_t sai_adaption_ind;
305f8829a4aSRandall Stewart 	sctp_assoc_t sai_assoc_id;
306f8829a4aSRandall Stewart };
307f8829a4aSRandall Stewart 
308f8829a4aSRandall Stewart struct sctp_setadaption {
309f8829a4aSRandall Stewart 	uint32_t ssb_adaption_ind;
310f8829a4aSRandall Stewart };
311f8829a4aSRandall Stewart 
312f8829a4aSRandall Stewart 
313f8829a4aSRandall Stewart /*
314f8829a4aSRandall Stewart  * Partial Delivery API event
315f8829a4aSRandall Stewart  */
316f8829a4aSRandall Stewart struct sctp_pdapi_event {
317f8829a4aSRandall Stewart 	uint16_t pdapi_type;
318f8829a4aSRandall Stewart 	uint16_t pdapi_flags;
319f8829a4aSRandall Stewart 	uint32_t pdapi_length;
320f8829a4aSRandall Stewart 	uint32_t pdapi_indication;
321f8829a4aSRandall Stewart 	sctp_assoc_t pdapi_assoc_id;
322f8829a4aSRandall Stewart };
323f8829a4aSRandall Stewart 
324f8829a4aSRandall Stewart /* indication values */
325f8829a4aSRandall Stewart #define SCTP_PARTIAL_DELIVERY_ABORTED	0x0001
326f8829a4aSRandall Stewart 
327f8829a4aSRandall Stewart 
328f8829a4aSRandall Stewart /*
329f8829a4aSRandall Stewart  * authentication key event
330f8829a4aSRandall Stewart  */
331f8829a4aSRandall Stewart struct sctp_authkey_event {
332f8829a4aSRandall Stewart 	uint16_t auth_type;
333f8829a4aSRandall Stewart 	uint16_t auth_flags;
334f8829a4aSRandall Stewart 	uint32_t auth_length;
335f8829a4aSRandall Stewart 	uint16_t auth_keynumber;
336f8829a4aSRandall Stewart 	uint16_t auth_altkeynumber;
337f8829a4aSRandall Stewart 	uint32_t auth_indication;
338f8829a4aSRandall Stewart 	sctp_assoc_t auth_assoc_id;
339f8829a4aSRandall Stewart };
340f8829a4aSRandall Stewart 
341f8829a4aSRandall Stewart /* indication values */
342f8829a4aSRandall Stewart #define SCTP_AUTH_NEWKEY	0x0001
343f8829a4aSRandall Stewart 
344f8829a4aSRandall Stewart 
345f8829a4aSRandall Stewart /*
346f8829a4aSRandall Stewart  * stream reset event
347f8829a4aSRandall Stewart  */
348f8829a4aSRandall Stewart struct sctp_stream_reset_event {
349f8829a4aSRandall Stewart 	uint16_t strreset_type;
350f8829a4aSRandall Stewart 	uint16_t strreset_flags;
351f8829a4aSRandall Stewart 	uint32_t strreset_length;
352f8829a4aSRandall Stewart 	sctp_assoc_t strreset_assoc_id;
353f8829a4aSRandall Stewart 	uint16_t strreset_list[0];
354f8829a4aSRandall Stewart };
355f8829a4aSRandall Stewart 
356f8829a4aSRandall Stewart /* flags in strreset_flags field */
357f8829a4aSRandall Stewart #define SCTP_STRRESET_INBOUND_STR  0x0001
358f8829a4aSRandall Stewart #define SCTP_STRRESET_OUTBOUND_STR 0x0002
359f8829a4aSRandall Stewart #define SCTP_STRRESET_ALL_STREAMS  0x0004
360f8829a4aSRandall Stewart #define SCTP_STRRESET_STREAM_LIST  0x0008
361f8829a4aSRandall Stewart #define SCTP_STRRESET_FAILED       0x0010
362f8829a4aSRandall Stewart 
363f8829a4aSRandall Stewart 
364f8829a4aSRandall Stewart /* SCTP notification event */
365f8829a4aSRandall Stewart struct sctp_tlv {
366f8829a4aSRandall Stewart 	uint16_t sn_type;
367f8829a4aSRandall Stewart 	uint16_t sn_flags;
368f8829a4aSRandall Stewart 	uint32_t sn_length;
369f8829a4aSRandall Stewart };
370f8829a4aSRandall Stewart 
371f8829a4aSRandall Stewart union sctp_notification {
372f8829a4aSRandall Stewart 	struct sctp_tlv sn_header;
373f8829a4aSRandall Stewart 	struct sctp_assoc_change sn_assoc_change;
374f8829a4aSRandall Stewart 	struct sctp_paddr_change sn_paddr_change;
375f8829a4aSRandall Stewart 	struct sctp_remote_error sn_remote_error;
376f8829a4aSRandall Stewart 	struct sctp_send_failed sn_send_failed;
377f8829a4aSRandall Stewart 	struct sctp_shutdown_event sn_shutdown_event;
378f8829a4aSRandall Stewart 	struct sctp_adaptation_event sn_adaptation_event;
379f8829a4aSRandall Stewart 	/* compatability same as above */
380f8829a4aSRandall Stewart 	struct sctp_adaption_event sn_adaption_event;
381f8829a4aSRandall Stewart 	struct sctp_pdapi_event sn_pdapi_event;
382f8829a4aSRandall Stewart 	struct sctp_authkey_event sn_auth_event;
383f8829a4aSRandall Stewart 	struct sctp_stream_reset_event sn_strreset_event;
384f8829a4aSRandall Stewart };
385f8829a4aSRandall Stewart 
386f8829a4aSRandall Stewart /* notification types */
387f8829a4aSRandall Stewart #define SCTP_ASSOC_CHANGE		0x0001
388f8829a4aSRandall Stewart #define SCTP_PEER_ADDR_CHANGE		0x0002
389f8829a4aSRandall Stewart #define SCTP_REMOTE_ERROR		0x0003
390f8829a4aSRandall Stewart #define SCTP_SEND_FAILED		0x0004
391f8829a4aSRandall Stewart #define SCTP_SHUTDOWN_EVENT		0x0005
392f8829a4aSRandall Stewart #define SCTP_ADAPTATION_INDICATION	0x0006
393f8829a4aSRandall Stewart /* same as above */
394f8829a4aSRandall Stewart #define SCTP_ADAPTION_INDICATION	0x0006
395f8829a4aSRandall Stewart #define SCTP_PARTIAL_DELIVERY_EVENT	0x0007
396f8829a4aSRandall Stewart #define SCTP_AUTHENTICATION_EVENT	0x0008
397f8829a4aSRandall Stewart #define SCTP_STREAM_RESET_EVENT		0x0009
398f8829a4aSRandall Stewart 
399f8829a4aSRandall Stewart 
400f8829a4aSRandall Stewart /*
401f8829a4aSRandall Stewart  * socket option structs
402f8829a4aSRandall Stewart  */
403f8829a4aSRandall Stewart 
404f8829a4aSRandall Stewart struct sctp_paddrparams {
405f8829a4aSRandall Stewart 	sctp_assoc_t spp_assoc_id;
406f8829a4aSRandall Stewart 	struct sockaddr_storage spp_address;
407f8829a4aSRandall Stewart 	uint32_t spp_hbinterval;
408f8829a4aSRandall Stewart 	uint16_t spp_pathmaxrxt;
409f8829a4aSRandall Stewart 	uint32_t spp_pathmtu;
410f8829a4aSRandall Stewart 	uint32_t spp_flags;
411f8829a4aSRandall Stewart 	uint32_t spp_ipv6_flowlabel;
412f8829a4aSRandall Stewart 	uint8_t spp_ipv4_tos;
413f8829a4aSRandall Stewart 
414f8829a4aSRandall Stewart };
415f8829a4aSRandall Stewart 
416f8829a4aSRandall Stewart #define SPP_HB_ENABLE		0x00000001
417f8829a4aSRandall Stewart #define SPP_HB_DISABLE		0x00000002
418f8829a4aSRandall Stewart #define SPP_HB_DEMAND		0x00000004
419f8829a4aSRandall Stewart #define SPP_PMTUD_ENABLE	0x00000008
420f8829a4aSRandall Stewart #define SPP_PMTUD_DISABLE	0x00000010
421f8829a4aSRandall Stewart #define SPP_SACKDELAY_ENABLE	0x00000020
422f8829a4aSRandall Stewart #define SPP_SACKDELAY_DISABLE	0x00000040
423f8829a4aSRandall Stewart #define SPP_HB_TIME_IS_ZERO     0x00000080
424f8829a4aSRandall Stewart #define SPP_IPV6_FLOWLABEL      0x00000100
425f8829a4aSRandall Stewart #define SPP_IPV4_TOS            0x00000200
426f8829a4aSRandall Stewart 
427f8829a4aSRandall Stewart struct sctp_paddrinfo {
428f8829a4aSRandall Stewart 	sctp_assoc_t spinfo_assoc_id;
429f8829a4aSRandall Stewart 	struct sockaddr_storage spinfo_address;
430f8829a4aSRandall Stewart 	int32_t spinfo_state;
431f8829a4aSRandall Stewart 	uint32_t spinfo_cwnd;
432f8829a4aSRandall Stewart 	uint32_t spinfo_srtt;
433f8829a4aSRandall Stewart 	uint32_t spinfo_rto;
434f8829a4aSRandall Stewart 	uint32_t spinfo_mtu;
435f8829a4aSRandall Stewart };
436f8829a4aSRandall Stewart 
437f8829a4aSRandall Stewart struct sctp_rtoinfo {
438f8829a4aSRandall Stewart 	sctp_assoc_t srto_assoc_id;
439f8829a4aSRandall Stewart 	uint32_t srto_initial;
440f8829a4aSRandall Stewart 	uint32_t srto_max;
441f8829a4aSRandall Stewart 	uint32_t srto_min;
442f8829a4aSRandall Stewart };
443f8829a4aSRandall Stewart 
444f8829a4aSRandall Stewart struct sctp_assocparams {
445f8829a4aSRandall Stewart 	sctp_assoc_t sasoc_assoc_id;
446f8829a4aSRandall Stewart 	uint16_t sasoc_asocmaxrxt;
447f8829a4aSRandall Stewart 	uint16_t sasoc_number_peer_destinations;
448f8829a4aSRandall Stewart 	uint32_t sasoc_peer_rwnd;
449f8829a4aSRandall Stewart 	uint32_t sasoc_local_rwnd;
450f8829a4aSRandall Stewart 	uint32_t sasoc_cookie_life;
45142551e99SRandall Stewart 	uint32_t sasoc_sack_delay;
45242551e99SRandall Stewart 	uint32_t sasoc_sack_freq;
453f8829a4aSRandall Stewart };
454f8829a4aSRandall Stewart 
455f8829a4aSRandall Stewart struct sctp_setprim {
456f8829a4aSRandall Stewart 	sctp_assoc_t ssp_assoc_id;
457f8829a4aSRandall Stewart 	struct sockaddr_storage ssp_addr;
458f8829a4aSRandall Stewart };
459f8829a4aSRandall Stewart 
460f8829a4aSRandall Stewart struct sctp_setpeerprim {
461f8829a4aSRandall Stewart 	sctp_assoc_t sspp_assoc_id;
462f8829a4aSRandall Stewart 	struct sockaddr_storage sspp_addr;
463f8829a4aSRandall Stewart };
464f8829a4aSRandall Stewart 
465f8829a4aSRandall Stewart struct sctp_getaddresses {
466f8829a4aSRandall Stewart 	sctp_assoc_t sget_assoc_id;
467f8829a4aSRandall Stewart 	/* addr is filled in for N * sockaddr_storage */
468f8829a4aSRandall Stewart 	struct sockaddr addr[1];
469f8829a4aSRandall Stewart };
470f8829a4aSRandall Stewart 
471f8829a4aSRandall Stewart struct sctp_setstrm_timeout {
472f8829a4aSRandall Stewart 	sctp_assoc_t ssto_assoc_id;
473f8829a4aSRandall Stewart 	uint32_t ssto_timeout;
474f8829a4aSRandall Stewart 	uint32_t ssto_streamid_start;
475f8829a4aSRandall Stewart 	uint32_t ssto_streamid_end;
476f8829a4aSRandall Stewart };
477f8829a4aSRandall Stewart 
478f8829a4aSRandall Stewart struct sctp_status {
479f8829a4aSRandall Stewart 	sctp_assoc_t sstat_assoc_id;
480f8829a4aSRandall Stewart 	int32_t sstat_state;
481f8829a4aSRandall Stewart 	uint32_t sstat_rwnd;
482f8829a4aSRandall Stewart 	uint16_t sstat_unackdata;
483f8829a4aSRandall Stewart 	uint16_t sstat_penddata;
484f8829a4aSRandall Stewart 	uint16_t sstat_instrms;
485f8829a4aSRandall Stewart 	uint16_t sstat_outstrms;
486f8829a4aSRandall Stewart 	uint32_t sstat_fragmentation_point;
487f8829a4aSRandall Stewart 	struct sctp_paddrinfo sstat_primary;
488f8829a4aSRandall Stewart };
489f8829a4aSRandall Stewart 
490f8829a4aSRandall Stewart /*
491f8829a4aSRandall Stewart  * AUTHENTICATION support
492f8829a4aSRandall Stewart  */
493f8829a4aSRandall Stewart /* SCTP_AUTH_CHUNK */
494f8829a4aSRandall Stewart struct sctp_authchunk {
495f8829a4aSRandall Stewart 	uint8_t sauth_chunk;
496f8829a4aSRandall Stewart };
497f8829a4aSRandall Stewart 
498f8829a4aSRandall Stewart /* SCTP_AUTH_KEY */
499f8829a4aSRandall Stewart struct sctp_authkey {
500f8829a4aSRandall Stewart 	sctp_assoc_t sca_assoc_id;
501f8829a4aSRandall Stewart 	uint16_t sca_keynumber;
502f8829a4aSRandall Stewart 	uint8_t sca_key[0];
503f8829a4aSRandall Stewart };
504f8829a4aSRandall Stewart 
505f8829a4aSRandall Stewart /* SCTP_HMAC_IDENT */
506f8829a4aSRandall Stewart struct sctp_hmacalgo {
507f8829a4aSRandall Stewart 	uint16_t shmac_idents[0];
508f8829a4aSRandall Stewart };
509f8829a4aSRandall Stewart 
510f8829a4aSRandall Stewart /* AUTH hmac_id */
511f8829a4aSRandall Stewart #define SCTP_AUTH_HMAC_ID_RSVD		0x0000
512f8829a4aSRandall Stewart #define SCTP_AUTH_HMAC_ID_SHA1		0x0001	/* default, mandatory */
513f8829a4aSRandall Stewart #define SCTP_AUTH_HMAC_ID_MD5		0x0002	/* deprecated */
514f8829a4aSRandall Stewart #define SCTP_AUTH_HMAC_ID_SHA256	0x0003
515f8829a4aSRandall Stewart #define SCTP_AUTH_HMAC_ID_SHA224	0x8001
516f8829a4aSRandall Stewart #define SCTP_AUTH_HMAC_ID_SHA384	0x8002
517f8829a4aSRandall Stewart #define SCTP_AUTH_HMAC_ID_SHA512	0x8003
518f8829a4aSRandall Stewart 
519f8829a4aSRandall Stewart 
520f8829a4aSRandall Stewart /* SCTP_AUTH_ACTIVE_KEY / SCTP_AUTH_DELETE_KEY */
521f8829a4aSRandall Stewart struct sctp_authkeyid {
522f8829a4aSRandall Stewart 	sctp_assoc_t scact_assoc_id;
523f8829a4aSRandall Stewart 	uint16_t scact_keynumber;
524f8829a4aSRandall Stewart };
525f8829a4aSRandall Stewart 
526f8829a4aSRandall Stewart /* SCTP_PEER_AUTH_CHUNKS / SCTP_LOCAL_AUTH_CHUNKS */
527f8829a4aSRandall Stewart struct sctp_authchunks {
528f8829a4aSRandall Stewart 	sctp_assoc_t gauth_assoc_id;
529f8829a4aSRandall Stewart 	uint8_t gauth_chunks[0];
530f8829a4aSRandall Stewart };
531f8829a4aSRandall Stewart 
532f8829a4aSRandall Stewart struct sctp_assoc_value {
533f8829a4aSRandall Stewart 	sctp_assoc_t assoc_id;
534f8829a4aSRandall Stewart 	uint32_t assoc_value;
535f8829a4aSRandall Stewart };
536f8829a4aSRandall Stewart 
537f8829a4aSRandall Stewart #define MAX_ASOC_IDS_RET 255
538f8829a4aSRandall Stewart struct sctp_assoc_ids {
539f8829a4aSRandall Stewart 	uint16_t asls_assoc_start;	/* array of index's start at 0 */
540f8829a4aSRandall Stewart 	uint8_t asls_numb_present;
541f8829a4aSRandall Stewart 	uint8_t asls_more_to_get;
542f8829a4aSRandall Stewart 	sctp_assoc_t asls_assoc_id[MAX_ASOC_IDS_RET];
543f8829a4aSRandall Stewart };
544f8829a4aSRandall Stewart 
545f8829a4aSRandall Stewart struct sctp_cwnd_args {
546f8829a4aSRandall Stewart 	struct sctp_nets *net;	/* network to */
547f8829a4aSRandall Stewart 	uint32_t cwnd_new_value;/* cwnd in k */
548f8829a4aSRandall Stewart 	uint32_t inflight;	/* flightsize in k */
549f8829a4aSRandall Stewart 	uint32_t pseudo_cumack;
550f8829a4aSRandall Stewart 	int cwnd_augment;	/* increment to it */
551f8829a4aSRandall Stewart 	uint8_t meets_pseudo_cumack;
552f8829a4aSRandall Stewart 	uint8_t need_new_pseudo_cumack;
553f8829a4aSRandall Stewart 	uint8_t cnt_in_send;
554f8829a4aSRandall Stewart 	uint8_t cnt_in_str;
555f8829a4aSRandall Stewart };
556f8829a4aSRandall Stewart 
557f8829a4aSRandall Stewart struct sctp_blk_args {
558f8829a4aSRandall Stewart 	uint32_t onsb;		/* in 1k bytes */
559f8829a4aSRandall Stewart 	uint32_t sndlen;	/* len of send being attempted */
560f8829a4aSRandall Stewart 	uint32_t peer_rwnd;	/* rwnd of peer */
561f8829a4aSRandall Stewart 	uint16_t send_sent_qcnt;/* chnk cnt */
562f8829a4aSRandall Stewart 	uint16_t stream_qcnt;	/* chnk cnt */
563f8829a4aSRandall Stewart 	uint16_t chunks_on_oque;/* chunks out */
564f8829a4aSRandall Stewart 	uint16_t flight_size;	/* flight size in k */
565f8829a4aSRandall Stewart };
566f8829a4aSRandall Stewart 
567f8829a4aSRandall Stewart /*
568f8829a4aSRandall Stewart  * Max we can reset in one setting, note this is dictated not by the define
569f8829a4aSRandall Stewart  * but the size of a mbuf cluster so don't change this define and think you
570f8829a4aSRandall Stewart  * can specify more. You must do multiple resets if you want to reset more
571f8829a4aSRandall Stewart  * than SCTP_MAX_EXPLICIT_STR_RESET.
572f8829a4aSRandall Stewart  */
573f8829a4aSRandall Stewart #define SCTP_MAX_EXPLICT_STR_RESET   1000
574f8829a4aSRandall Stewart 
575f8829a4aSRandall Stewart #define SCTP_RESET_LOCAL_RECV  0x0001
576f8829a4aSRandall Stewart #define SCTP_RESET_LOCAL_SEND  0x0002
577f8829a4aSRandall Stewart #define SCTP_RESET_BOTH        0x0003
578f8829a4aSRandall Stewart #define SCTP_RESET_TSN         0x0004
579f8829a4aSRandall Stewart 
580f8829a4aSRandall Stewart struct sctp_stream_reset {
581f8829a4aSRandall Stewart 	sctp_assoc_t strrst_assoc_id;
582f8829a4aSRandall Stewart 	uint16_t strrst_flags;
583f8829a4aSRandall Stewart 	uint16_t strrst_num_streams;	/* 0 == ALL */
584f8829a4aSRandall Stewart 	uint16_t strrst_list[0];/* list if strrst_num_streams is not 0 */
585f8829a4aSRandall Stewart };
586f8829a4aSRandall Stewart 
587f8829a4aSRandall Stewart 
588f8829a4aSRandall Stewart struct sctp_get_nonce_values {
589f8829a4aSRandall Stewart 	sctp_assoc_t gn_assoc_id;
590f8829a4aSRandall Stewart 	uint32_t gn_peers_tag;
591f8829a4aSRandall Stewart 	uint32_t gn_local_tag;
592f8829a4aSRandall Stewart };
593f8829a4aSRandall Stewart 
594f8829a4aSRandall Stewart /* Debugging logs */
595f8829a4aSRandall Stewart struct sctp_str_log {
5966a91f103SRandall Stewart 	void *stcb;
597f8829a4aSRandall Stewart 	uint32_t n_tsn;
598f8829a4aSRandall Stewart 	uint32_t e_tsn;
599f8829a4aSRandall Stewart 	uint16_t n_sseq;
600f8829a4aSRandall Stewart 	uint16_t e_sseq;
6016a91f103SRandall Stewart 	uint16_t strm;
602f8829a4aSRandall Stewart };
603f8829a4aSRandall Stewart 
604f8829a4aSRandall Stewart struct sctp_sb_log {
60550cec919SRandall Stewart 	void *stcb;
606f8829a4aSRandall Stewart 	uint32_t so_sbcc;
607f8829a4aSRandall Stewart 	uint32_t stcb_sbcc;
608f8829a4aSRandall Stewart 	uint32_t incr;
609f8829a4aSRandall Stewart };
610f8829a4aSRandall Stewart 
611f8829a4aSRandall Stewart struct sctp_fr_log {
612f8829a4aSRandall Stewart 	uint32_t largest_tsn;
613f8829a4aSRandall Stewart 	uint32_t largest_new_tsn;
614f8829a4aSRandall Stewart 	uint32_t tsn;
615f8829a4aSRandall Stewart };
616f8829a4aSRandall Stewart 
617f8829a4aSRandall Stewart struct sctp_fr_map {
618f8829a4aSRandall Stewart 	uint32_t base;
619f8829a4aSRandall Stewart 	uint32_t cum;
620f8829a4aSRandall Stewart 	uint32_t high;
621f8829a4aSRandall Stewart };
622f8829a4aSRandall Stewart 
623f8829a4aSRandall Stewart struct sctp_rwnd_log {
624f8829a4aSRandall Stewart 	uint32_t rwnd;
625f8829a4aSRandall Stewart 	uint32_t send_size;
626f8829a4aSRandall Stewart 	uint32_t overhead;
627f8829a4aSRandall Stewart 	uint32_t new_rwnd;
628f8829a4aSRandall Stewart };
629f8829a4aSRandall Stewart 
630f8829a4aSRandall Stewart struct sctp_mbcnt_log {
631f8829a4aSRandall Stewart 	uint32_t total_queue_size;
632f8829a4aSRandall Stewart 	uint32_t size_change;
633f8829a4aSRandall Stewart 	uint32_t total_queue_mb_size;
634f8829a4aSRandall Stewart 	uint32_t mbcnt_change;
635f8829a4aSRandall Stewart };
636f8829a4aSRandall Stewart 
637f8829a4aSRandall Stewart struct sctp_sack_log {
638f8829a4aSRandall Stewart 	uint32_t cumack;
639f8829a4aSRandall Stewart 	uint32_t oldcumack;
640f8829a4aSRandall Stewart 	uint32_t tsn;
641f8829a4aSRandall Stewart 	uint16_t numGaps;
642f8829a4aSRandall Stewart 	uint16_t numDups;
643f8829a4aSRandall Stewart };
644f8829a4aSRandall Stewart 
645f8829a4aSRandall Stewart struct sctp_lock_log {
64650cec919SRandall Stewart 	void *sock;
64750cec919SRandall Stewart 	void *inp;
648f8829a4aSRandall Stewart 	uint8_t tcb_lock;
649f8829a4aSRandall Stewart 	uint8_t inp_lock;
650f8829a4aSRandall Stewart 	uint8_t info_lock;
651f8829a4aSRandall Stewart 	uint8_t sock_lock;
652f8829a4aSRandall Stewart 	uint8_t sockrcvbuf_lock;
653f8829a4aSRandall Stewart 	uint8_t socksndbuf_lock;
654f8829a4aSRandall Stewart 	uint8_t create_lock;
655f8829a4aSRandall Stewart 	uint8_t resv;
656f8829a4aSRandall Stewart };
657f8829a4aSRandall Stewart 
658f8829a4aSRandall Stewart struct sctp_rto_log {
65950cec919SRandall Stewart 	void *net;
660f8829a4aSRandall Stewart 	uint32_t rtt;
661f8829a4aSRandall Stewart 	uint32_t rttvar;
662f8829a4aSRandall Stewart 	uint8_t direction;
663f8829a4aSRandall Stewart };
664f8829a4aSRandall Stewart 
665f8829a4aSRandall Stewart struct sctp_nagle_log {
66650cec919SRandall Stewart 	void *stcb;
667f8829a4aSRandall Stewart 	uint32_t total_flight;
668f8829a4aSRandall Stewart 	uint32_t total_in_queue;
669f8829a4aSRandall Stewart 	uint16_t count_in_queue;
670f8829a4aSRandall Stewart 	uint16_t count_in_flight;
671f8829a4aSRandall Stewart };
672f8829a4aSRandall Stewart 
673f8829a4aSRandall Stewart struct sctp_sbwake_log {
67450cec919SRandall Stewart 	void *stcb;
675f8829a4aSRandall Stewart 	uint16_t send_q;
676f8829a4aSRandall Stewart 	uint16_t sent_q;
677f8829a4aSRandall Stewart 	uint16_t flight;
678f8829a4aSRandall Stewart 	uint16_t wake_cnt;
679f8829a4aSRandall Stewart 	uint8_t stream_qcnt;	/* chnk cnt */
680f8829a4aSRandall Stewart 	uint8_t chunks_on_oque;	/* chunks out */
681f8829a4aSRandall Stewart 	uint8_t sbflags;
682f8829a4aSRandall Stewart 	uint8_t sctpflags;
683f8829a4aSRandall Stewart };
684f8829a4aSRandall Stewart 
685f8829a4aSRandall Stewart struct sctp_misc_info {
686f8829a4aSRandall Stewart 	uint32_t log1;
687f8829a4aSRandall Stewart 	uint32_t log2;
688f8829a4aSRandall Stewart 	uint32_t log3;
689f8829a4aSRandall Stewart 	uint32_t log4;
690f8829a4aSRandall Stewart };
691f8829a4aSRandall Stewart 
692f8829a4aSRandall Stewart struct sctp_log_closing {
69350cec919SRandall Stewart 	void *inp;
69450cec919SRandall Stewart 	void *stcb;
695f8829a4aSRandall Stewart 	uint32_t sctp_flags;
696f8829a4aSRandall Stewart 	uint16_t state;
697f8829a4aSRandall Stewart 	int16_t loc;
698f8829a4aSRandall Stewart };
699f8829a4aSRandall Stewart 
700f8829a4aSRandall Stewart struct sctp_mbuf_log {
701f8829a4aSRandall Stewart 	struct mbuf *mp;
702f8829a4aSRandall Stewart 	caddr_t ext;
703f8829a4aSRandall Stewart 	caddr_t data;
704f8829a4aSRandall Stewart 	uint16_t size;
705f8829a4aSRandall Stewart 	uint8_t refcnt;
706f8829a4aSRandall Stewart 	uint8_t mbuf_flags;
707f8829a4aSRandall Stewart };
708f8829a4aSRandall Stewart 
709f8829a4aSRandall Stewart struct sctp_cwnd_log {
710f8829a4aSRandall Stewart 	uint32_t time_event;
711f8829a4aSRandall Stewart 	uint8_t from;
712f8829a4aSRandall Stewart 	uint8_t event_type;
713f8829a4aSRandall Stewart 	uint8_t resv[2];
714f8829a4aSRandall Stewart 	union {
715f8829a4aSRandall Stewart 		struct sctp_log_closing close;
716f8829a4aSRandall Stewart 		struct sctp_blk_args blk;
717f8829a4aSRandall Stewart 		struct sctp_cwnd_args cwnd;
718f8829a4aSRandall Stewart 		struct sctp_str_log strlog;
719f8829a4aSRandall Stewart 		struct sctp_fr_log fr;
720f8829a4aSRandall Stewart 		struct sctp_fr_map map;
721f8829a4aSRandall Stewart 		struct sctp_rwnd_log rwnd;
722f8829a4aSRandall Stewart 		struct sctp_mbcnt_log mbcnt;
723f8829a4aSRandall Stewart 		struct sctp_sack_log sack;
724f8829a4aSRandall Stewart 		struct sctp_lock_log lock;
725f8829a4aSRandall Stewart 		struct sctp_rto_log rto;
726f8829a4aSRandall Stewart 		struct sctp_sb_log sb;
727f8829a4aSRandall Stewart 		struct sctp_nagle_log nagle;
728f8829a4aSRandall Stewart 		struct sctp_sbwake_log wake;
729f8829a4aSRandall Stewart 		struct sctp_mbuf_log mb;
730f8829a4aSRandall Stewart 		struct sctp_misc_info misc;
731f8829a4aSRandall Stewart 	}     x;
732f8829a4aSRandall Stewart };
733f8829a4aSRandall Stewart 
734f8829a4aSRandall Stewart struct sctp_cwnd_log_req {
735f8829a4aSRandall Stewart 	int num_in_log;		/* Number in log */
736f8829a4aSRandall Stewart 	int num_ret;		/* Number returned */
737f8829a4aSRandall Stewart 	int start_at;		/* start at this one */
738f8829a4aSRandall Stewart 	int end_at;		/* end at this one */
739f8829a4aSRandall Stewart 	struct sctp_cwnd_log log[0];
740f8829a4aSRandall Stewart };
741f8829a4aSRandall Stewart 
742f8829a4aSRandall Stewart struct sctpstat {
743f8829a4aSRandall Stewart 	/* MIB according to RFC 3873 */
744f8829a4aSRandall Stewart 	u_long sctps_currestab;	/* sctpStats  1   (Gauge32) */
745f8829a4aSRandall Stewart 	u_long sctps_activeestab;	/* sctpStats  2 (Counter32) */
746f42a358aSRandall Stewart 	u_long sctps_restartestab;
747f42a358aSRandall Stewart 	u_long sctps_collisionestab;
748f8829a4aSRandall Stewart 	u_long sctps_passiveestab;	/* sctpStats  3 (Counter32) */
749f8829a4aSRandall Stewart 	u_long sctps_aborted;	/* sctpStats  4 (Counter32) */
750f8829a4aSRandall Stewart 	u_long sctps_shutdown;	/* sctpStats  5 (Counter32) */
751f8829a4aSRandall Stewart 	u_long sctps_outoftheblue;	/* sctpStats  6 (Counter32) */
752f8829a4aSRandall Stewart 	u_long sctps_checksumerrors;	/* sctpStats  7 (Counter32) */
753f8829a4aSRandall Stewart 	u_long sctps_outcontrolchunks;	/* sctpStats  8 (Counter64) */
754f8829a4aSRandall Stewart 	u_long sctps_outorderchunks;	/* sctpStats  9 (Counter64) */
755f8829a4aSRandall Stewart 	u_long sctps_outunorderchunks;	/* sctpStats 10 (Counter64) */
756f8829a4aSRandall Stewart 	u_long sctps_incontrolchunks;	/* sctpStats 11 (Counter64) */
757f8829a4aSRandall Stewart 	u_long sctps_inorderchunks;	/* sctpStats 12 (Counter64) */
758f8829a4aSRandall Stewart 	u_long sctps_inunorderchunks;	/* sctpStats 13 (Counter64) */
759f8829a4aSRandall Stewart 	u_long sctps_fragusrmsgs;	/* sctpStats 14 (Counter64) */
760f8829a4aSRandall Stewart 	u_long sctps_reasmusrmsgs;	/* sctpStats 15 (Counter64) */
761f8829a4aSRandall Stewart 	u_long sctps_outpackets;/* sctpStats 16 (Counter64) */
762f8829a4aSRandall Stewart 	u_long sctps_inpackets;	/* sctpStats 17 (Counter64) */
763f42a358aSRandall Stewart 	struct timeval sctps_discontinuitytime;	/* sctpStats 18 (TimeStamp) */
764f8829a4aSRandall Stewart 	/* input statistics: */
765f8829a4aSRandall Stewart 	u_long sctps_recvpackets;	/* total input packets        */
766f8829a4aSRandall Stewart 	u_long sctps_recvdatagrams;	/* total input datagrams      */
767f8829a4aSRandall Stewart 	u_long sctps_recvpktwithdata;
768f8829a4aSRandall Stewart 	u_long sctps_recvsacks;	/* total input SACK chunks    */
769f8829a4aSRandall Stewart 	u_long sctps_recvdata;	/* total input DATA chunks    */
770f8829a4aSRandall Stewart 	u_long sctps_recvdupdata;	/* total input duplicate DATA chunks */
771f8829a4aSRandall Stewart 	u_long sctps_recvheartbeat;	/* total input HB chunks      */
772f8829a4aSRandall Stewart 	u_long sctps_recvheartbeatack;	/* total input HB-ACK chunks  */
773f8829a4aSRandall Stewart 	u_long sctps_recvecne;	/* total input ECNE chunks    */
774f8829a4aSRandall Stewart 	u_long sctps_recvauth;	/* total input AUTH chunks    */
775f8829a4aSRandall Stewart 	u_long sctps_recvauthmissing;	/* total input chunks missing AUTH */
776f8829a4aSRandall Stewart 	u_long sctps_recvivalhmacid;	/* total number of invalid HMAC ids
777f8829a4aSRandall Stewart 					 * received */
778f8829a4aSRandall Stewart 	u_long sctps_recvivalkeyid;	/* total number of invalid secret ids
779f8829a4aSRandall Stewart 					 * received */
780f8829a4aSRandall Stewart 	u_long sctps_recvauthfailed;	/* total number of auth failed */
781f8829a4aSRandall Stewart 	u_long sctps_recvexpress;	/* total fast path receives all one
782f8829a4aSRandall Stewart 					 * chunk */
783f8829a4aSRandall Stewart 	u_long sctps_recvexpressm;	/* total fast path multi-part data */
784f8829a4aSRandall Stewart 	/* output statistics: */
785f8829a4aSRandall Stewart 	u_long sctps_sendpackets;	/* total output packets       */
786f8829a4aSRandall Stewart 	u_long sctps_sendsacks;	/* total output SACKs         */
787f8829a4aSRandall Stewart 	u_long sctps_senddata;	/* total output DATA chunks   */
788f8829a4aSRandall Stewart 	u_long sctps_sendretransdata;	/* total output retransmitted DATA
789f8829a4aSRandall Stewart 					 * chunks */
790f8829a4aSRandall Stewart 	u_long sctps_sendfastretrans;	/* total output fast retransmitted
791f8829a4aSRandall Stewart 					 * DATA chunks */
792f8829a4aSRandall Stewart 	u_long sctps_sendmultfastretrans;	/* U-del */
793f8829a4aSRandall Stewart 	u_long sctps_sendheartbeat;	/* total output HB chunks     */
794f8829a4aSRandall Stewart 	u_long sctps_sendecne;	/* total output ECNE chunks    */
795f8829a4aSRandall Stewart 	u_long sctps_sendauth;	/* total output AUTH chunks FIXME   */
796f8829a4aSRandall Stewart 	u_long sctps_senderrors;/* ip_output error counter */
797f8829a4aSRandall Stewart 	/* PCKDROPREP statistics: */
798f8829a4aSRandall Stewart 	u_long sctps_pdrpfmbox;	/* */
799f8829a4aSRandall Stewart 	u_long sctps_pdrpfehos;	/* */
800f8829a4aSRandall Stewart 	u_long sctps_pdrpmbda;	/* */
801f8829a4aSRandall Stewart 	u_long sctps_pdrpmbct;	/* */
802f8829a4aSRandall Stewart 	u_long sctps_pdrpbwrpt;	/* */
803f8829a4aSRandall Stewart 	u_long sctps_pdrpcrupt;	/* */
804f8829a4aSRandall Stewart 	u_long sctps_pdrpnedat;	/* */
805f8829a4aSRandall Stewart 	u_long sctps_pdrppdbrk;	/* */
806f8829a4aSRandall Stewart 	u_long sctps_pdrptsnnf;	/* */
807f8829a4aSRandall Stewart 	u_long sctps_pdrpdnfnd;	/* */
808f8829a4aSRandall Stewart 	u_long sctps_pdrpdiwnp;	/* */
809f8829a4aSRandall Stewart 	u_long sctps_pdrpdizrw;	/* */
810f8829a4aSRandall Stewart 	u_long sctps_pdrpbadd;	/* */
811f8829a4aSRandall Stewart 	u_long sctps_pdrpmark;	/* */
812f8829a4aSRandall Stewart 	/* timeouts */
813f8829a4aSRandall Stewart 	u_long sctps_timoiterator;	/* */
814f8829a4aSRandall Stewart 	u_long sctps_timodata;	/* */
815f8829a4aSRandall Stewart 	u_long sctps_timowindowprobe;	/* */
816f8829a4aSRandall Stewart 	u_long sctps_timoinit;	/* */
817f8829a4aSRandall Stewart 	u_long sctps_timosack;	/* */
818f8829a4aSRandall Stewart 	u_long sctps_timoshutdown;	/* */
819f8829a4aSRandall Stewart 	u_long sctps_timoheartbeat;	/* */
820f8829a4aSRandall Stewart 	u_long sctps_timocookie;/* */
821f8829a4aSRandall Stewart 	u_long sctps_timosecret;/* */
822f8829a4aSRandall Stewart 	u_long sctps_timopathmtu;	/* */
823f8829a4aSRandall Stewart 	u_long sctps_timoshutdownack;	/* */
824f8829a4aSRandall Stewart 	u_long sctps_timoshutdownguard;	/* */
825f8829a4aSRandall Stewart 	u_long sctps_timostrmrst;	/* */
826f8829a4aSRandall Stewart 	u_long sctps_timoearlyfr;	/* */
827f8829a4aSRandall Stewart 	u_long sctps_timoasconf;/* */
828f8829a4aSRandall Stewart 	u_long sctps_timoautoclose;	/* */
829f8829a4aSRandall Stewart 	u_long sctps_timoassockill;	/* */
830f8829a4aSRandall Stewart 	u_long sctps_timoinpkill;	/* */
831f8829a4aSRandall Stewart 	/* Early fast retransmission counters */
832f8829a4aSRandall Stewart 	u_long sctps_earlyfrstart;
833f8829a4aSRandall Stewart 	u_long sctps_earlyfrstop;
834f8829a4aSRandall Stewart 	u_long sctps_earlyfrmrkretrans;
835f8829a4aSRandall Stewart 	u_long sctps_earlyfrstpout;
836f8829a4aSRandall Stewart 	u_long sctps_earlyfrstpidsck1;
837f8829a4aSRandall Stewart 	u_long sctps_earlyfrstpidsck2;
838f8829a4aSRandall Stewart 	u_long sctps_earlyfrstpidsck3;
839f8829a4aSRandall Stewart 	u_long sctps_earlyfrstpidsck4;
840f8829a4aSRandall Stewart 	u_long sctps_earlyfrstrid;
841f8829a4aSRandall Stewart 	u_long sctps_earlyfrstrout;
842f8829a4aSRandall Stewart 	u_long sctps_earlyfrstrtmr;
843f8829a4aSRandall Stewart 	/* otheres */
844f8829a4aSRandall Stewart 	u_long sctps_hdrops;	/* packet shorter than header */
845f8829a4aSRandall Stewart 	u_long sctps_badsum;	/* checksum error             */
846f8829a4aSRandall Stewart 	u_long sctps_noport;	/* no endpoint for port       */
847f8829a4aSRandall Stewart 	u_long sctps_badvtag;	/* bad v-tag                  */
848f8829a4aSRandall Stewart 	u_long sctps_badsid;	/* bad SID                    */
849f8829a4aSRandall Stewart 	u_long sctps_nomem;	/* no memory                  */
850f8829a4aSRandall Stewart 	u_long sctps_fastretransinrtt;	/* number of multiple FR in a RTT
851f8829a4aSRandall Stewart 					 * window */
852f8829a4aSRandall Stewart 	u_long sctps_markedretrans;
853f8829a4aSRandall Stewart 	u_long sctps_naglesent;	/* nagle allowed sending      */
854f8829a4aSRandall Stewart 	u_long sctps_naglequeued;	/* nagle does't allow sending */
855f8829a4aSRandall Stewart 	u_long sctps_maxburstqueued;	/* max burst dosn't allow sending */
856f8829a4aSRandall Stewart 	u_long sctps_ifnomemqueued;	/* */
857f8829a4aSRandall Stewart 	u_long sctps_windowprobed;	/* total number of window probes sent */
858f8829a4aSRandall Stewart 	u_long sctps_lowlevelerr;
859f8829a4aSRandall Stewart 	u_long sctps_lowlevelerrusr;
860f8829a4aSRandall Stewart 	u_long sctps_datadropchklmt;
861f8829a4aSRandall Stewart 	u_long sctps_datadroprwnd;
862f8829a4aSRandall Stewart 	u_long sctps_ecnereducedcwnd;
863f8829a4aSRandall Stewart 	u_long sctps_vtagexpress;	/* Used express lookup via vtag */
864f8829a4aSRandall Stewart 	u_long sctps_vtagbogus;	/* Collision in express lookup. */
865f8829a4aSRandall Stewart 	u_long sctps_primary_randry;	/* Number of times the sender ran dry
866f8829a4aSRandall Stewart 					 * of user data on primary */
867f8829a4aSRandall Stewart 	u_long sctps_cmt_randry;/* Same for above */
868f8829a4aSRandall Stewart 	u_long sctps_slowpath_sack;	/* Sacks the slow way */
869f8829a4aSRandall Stewart 	u_long sctps_wu_sacks_sent;	/* Window Update only sacks sent */
870a5d547adSRandall Stewart 	u_long sctps_sends_with_flags;	/* number of sends with sinfo_flags
871a5d547adSRandall Stewart 					 * !=0 */
872a5d547adSRandall Stewart 	u_long sctps_sends_with_unord;
873a5d547adSRandall Stewart 	u_long sctps_sends_with_eof;
874a5d547adSRandall Stewart 	u_long sctps_sends_with_abort;
875a5d547adSRandall Stewart 	u_long sctps_protocol_drain_calls;
876a5d547adSRandall Stewart 	u_long sctps_protocol_drains_done;
877f8829a4aSRandall Stewart };
878f8829a4aSRandall Stewart 
879f8829a4aSRandall Stewart #define SCTP_STAT_INCR(_x) SCTP_STAT_INCR_BY(_x,1)
880f8829a4aSRandall Stewart #define SCTP_STAT_DECR(_x) SCTP_STAT_DECR_BY(_x,1)
881f8829a4aSRandall Stewart #define SCTP_STAT_INCR_BY(_x,_d) atomic_add_long(&sctpstat._x, _d)
882f8829a4aSRandall Stewart #define SCTP_STAT_DECR_BY(_x,_d) atomic_add_long(&sctpstat._x, -(_d))
883f8829a4aSRandall Stewart /* The following macros are for handling MIB values, */
884f8829a4aSRandall Stewart #define SCTP_STAT_INCR_COUNTER32(_x) SCTP_STAT_INCR(_x)
885f8829a4aSRandall Stewart #define SCTP_STAT_INCR_COUNTER64(_x) SCTP_STAT_INCR(_x)
886f8829a4aSRandall Stewart #define SCTP_STAT_INCR_GAUGE32(_x) SCTP_STAT_INCR(_x)
887f8829a4aSRandall Stewart #define SCTP_STAT_DECR_COUNTER32(_x) SCTP_STAT_DECR(_x)
888f8829a4aSRandall Stewart #define SCTP_STAT_DECR_COUNTER64(_x) SCTP_STAT_DECR(_x)
889f8829a4aSRandall Stewart #define SCTP_STAT_DECR_GAUGE32(_x) SCTP_STAT_DECR(_x)
890f8829a4aSRandall Stewart 
89103b0b021SRandall Stewart union sctp_sockstore {
89242551e99SRandall Stewart #if defined(INET) || !defined(_KERNEL)
89303b0b021SRandall Stewart 	struct sockaddr_in sin;
89403b0b021SRandall Stewart #endif
89542551e99SRandall Stewart #if defined(INET6) || !defined(_KERNEL)
89603b0b021SRandall Stewart 	struct sockaddr_in6 sin6;
89703b0b021SRandall Stewart #endif
89803b0b021SRandall Stewart 	struct sockaddr sa;
89903b0b021SRandall Stewart };
90003b0b021SRandall Stewart 
901a5d547adSRandall Stewart struct xsctp_inpcb {
902a5d547adSRandall Stewart 	uint32_t last;
903a5d547adSRandall Stewart 	uint16_t local_port;
904a5d547adSRandall Stewart 	uint16_t number_local_addresses;
905a5d547adSRandall Stewart 	uint32_t number_associations;
906a5d547adSRandall Stewart 	uint32_t flags;
907a5d547adSRandall Stewart 	uint32_t features;
908a5d547adSRandall Stewart 	uint32_t total_sends;
909a5d547adSRandall Stewart 	uint32_t total_recvs;
910a5d547adSRandall Stewart 	uint32_t total_nospaces;
911a5d547adSRandall Stewart 	/* add more endpoint specific data here */
912a5d547adSRandall Stewart };
913a5d547adSRandall Stewart 
914a5d547adSRandall Stewart struct xsctp_tcb {
915f42a358aSRandall Stewart 	uint16_t LocalPort;	/* sctpAssocEntry 3   */
916f42a358aSRandall Stewart 	uint16_t RemPort;	/* sctpAssocEntry 4   */
917f42a358aSRandall Stewart 	union sctp_sockstore RemPrimAddr;	/* sctpAssocEntry 5/6 */
918f42a358aSRandall Stewart 	uint32_t HeartBeatInterval;	/* sctpAssocEntry 7   */
919f42a358aSRandall Stewart 	uint32_t State;		/* sctpAssocEntry 8   */
920f42a358aSRandall Stewart 	uint32_t InStreams;	/* sctpAssocEntry 9   */
921f42a358aSRandall Stewart 	uint32_t OutStreams;	/* sctpAssocEntry 10  */
922f42a358aSRandall Stewart 	uint32_t MaxRetr;	/* sctpAssocEntry 11  */
923f42a358aSRandall Stewart 	uint32_t PrimProcess;	/* sctpAssocEntry 12  */
924f42a358aSRandall Stewart 	uint32_t T1expireds;	/* sctpAssocEntry 13  */
925f42a358aSRandall Stewart 	uint32_t T2expireds;	/* sctpAssocEntry 14  */
926f42a358aSRandall Stewart 	uint32_t RtxChunks;	/* sctpAssocEntry 15  */
927f42a358aSRandall Stewart 	struct timeval StartTime;	/* sctpAssocEntry 16  */
928f42a358aSRandall Stewart 	struct timeval DiscontinuityTime;	/* sctpAssocEntry 17  */
929a5d547adSRandall Stewart 	uint32_t total_sends;
930a5d547adSRandall Stewart 	uint32_t total_recvs;
931a5d547adSRandall Stewart 	uint32_t local_tag;
932a5d547adSRandall Stewart 	uint32_t remote_tag;
933a5d547adSRandall Stewart 	uint32_t initial_tsn;
934a5d547adSRandall Stewart 	uint32_t highest_tsn;
935a5d547adSRandall Stewart 	uint32_t cumulative_tsn;
936a5d547adSRandall Stewart 	uint32_t cumulative_tsn_ack;
937a5d547adSRandall Stewart 	/* add more association specific data here */
938f42a358aSRandall Stewart 	uint16_t number_local_addresses;
939f42a358aSRandall Stewart 	uint16_t number_remote_addresses;
940a5d547adSRandall Stewart };
941a5d547adSRandall Stewart 
942a5d547adSRandall Stewart struct xsctp_laddr {
943f42a358aSRandall Stewart 	union sctp_sockstore LocalAddr;	/* sctpAssocLocalAddrEntry 1/2 */
944f42a358aSRandall Stewart 	struct timeval LocalStartTime;	/* sctpAssocLocalAddrEntry 3   */
945a5d547adSRandall Stewart 	/* add more local address specific data */
946a5d547adSRandall Stewart };
947a5d547adSRandall Stewart 
948a5d547adSRandall Stewart struct xsctp_raddr {
949f42a358aSRandall Stewart 	union sctp_sockstore RemAddr;	/* sctpAssocLocalRemEntry 1/2 */
950f42a358aSRandall Stewart 	uint8_t RemAddrActive;	/* sctpAssocLocalRemEntry 3   */
951f42a358aSRandall Stewart 	uint8_t RemAddrConfirmed;	/* */
952f42a358aSRandall Stewart 	uint8_t RemAddrHBActive;/* sctpAssocLocalRemEntry 4   */
953f42a358aSRandall Stewart 	uint32_t RemAddrRTO;	/* sctpAssocLocalRemEntry 5   */
954f42a358aSRandall Stewart 	uint32_t RemAddrMaxPathRtx;	/* sctpAssocLocalRemEntry 6   */
955f42a358aSRandall Stewart 	uint32_t RemAddrRtx;	/* sctpAssocLocalRemEntry 7   */
956f42a358aSRandall Stewart 	uint32_t RemAddrErrorCounter;	/* */
957f42a358aSRandall Stewart 	uint32_t RemAddrCwnd;	/* */
958f42a358aSRandall Stewart 	uint32_t RemAddrFlightSize;	/* */
959f42a358aSRandall Stewart 	struct timeval RemAddrStartTime;	/* sctpAssocLocalRemEntry 8   */
960a5d547adSRandall Stewart 	/* add more remote address specific data */
961a5d547adSRandall Stewart };
96203b0b021SRandall Stewart 
963f8829a4aSRandall Stewart /*
964f8829a4aSRandall Stewart  * Kernel defined for sctp_send
965f8829a4aSRandall Stewart  */
966f8829a4aSRandall Stewart #if defined(_KERNEL)
967f8829a4aSRandall Stewart int
968f8829a4aSRandall Stewart sctp_lower_sosend(struct socket *so,
969f8829a4aSRandall Stewart     struct sockaddr *addr,
970f8829a4aSRandall Stewart     struct uio *uio,
971f8829a4aSRandall Stewart     struct mbuf *top,
972f8829a4aSRandall Stewart     struct mbuf *control,
973f8829a4aSRandall Stewart     int flags,
974f8829a4aSRandall Stewart     int use_rcvinfo,
975f8829a4aSRandall Stewart     struct sctp_sndrcvinfo *srcv,
976f8829a4aSRandall Stewart     struct thread *p
977f8829a4aSRandall Stewart );
978f8829a4aSRandall Stewart 
979f8829a4aSRandall Stewart int
980f8829a4aSRandall Stewart sctp_sorecvmsg(struct socket *so,
981f8829a4aSRandall Stewart     struct uio *uio,
982f8829a4aSRandall Stewart     struct mbuf **mp,
983f8829a4aSRandall Stewart     struct sockaddr *from,
984f8829a4aSRandall Stewart     int fromlen,
985f8829a4aSRandall Stewart     int *msg_flags,
986f8829a4aSRandall Stewart     struct sctp_sndrcvinfo *sinfo,
987f8829a4aSRandall Stewart     int filling_sinfo);
988f8829a4aSRandall Stewart 
989f8829a4aSRandall Stewart 
990f8829a4aSRandall Stewart #endif
991f8829a4aSRandall Stewart 
992f8829a4aSRandall Stewart /*
993f8829a4aSRandall Stewart  * API system calls
994f8829a4aSRandall Stewart  */
995f8829a4aSRandall Stewart #if !(defined(_KERNEL))
996f8829a4aSRandall Stewart 
997f8829a4aSRandall Stewart __BEGIN_DECLS
998f8829a4aSRandall Stewart int sctp_peeloff __P((int, sctp_assoc_t));
999f8829a4aSRandall Stewart int sctp_bindx __P((int, struct sockaddr *, int, int));
100042551e99SRandall Stewart int sctp_connectx __P((int, const struct sockaddr *, int, sctp_assoc_t *));
1001f8829a4aSRandall Stewart int sctp_getaddrlen __P((sa_family_t));
1002f8829a4aSRandall Stewart int sctp_getpaddrs __P((int, sctp_assoc_t, struct sockaddr **));
1003f8829a4aSRandall Stewart void sctp_freepaddrs __P((struct sockaddr *));
1004f8829a4aSRandall Stewart int sctp_getladdrs __P((int, sctp_assoc_t, struct sockaddr **));
1005f8829a4aSRandall Stewart void sctp_freeladdrs __P((struct sockaddr *));
1006f8829a4aSRandall Stewart int sctp_opt_info __P((int, sctp_assoc_t, int, void *, socklen_t *));
1007f8829a4aSRandall Stewart 
1008f8829a4aSRandall Stewart ssize_t sctp_sendmsg
1009f8829a4aSRandall Stewart __P((int, const void *, size_t,
1010f8829a4aSRandall Stewart     const struct sockaddr *,
1011f8829a4aSRandall Stewart     socklen_t, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t));
1012f8829a4aSRandall Stewart 
1013f8829a4aSRandall Stewart 	ssize_t sctp_send __P((int sd, const void *msg, size_t len,
1014f8829a4aSRandall Stewart               const struct sctp_sndrcvinfo *sinfo, int flags));
1015f8829a4aSRandall Stewart 
1016f8829a4aSRandall Stewart 	ssize_t
1017f8829a4aSRandall Stewart 	sctp_sendx __P((int sd, const void *msg, size_t len,
1018f8829a4aSRandall Stewart                struct sockaddr *addrs, int addrcnt,
1019f8829a4aSRandall Stewart                struct sctp_sndrcvinfo *sinfo, int flags));
1020f8829a4aSRandall Stewart 	ssize_t
1021f8829a4aSRandall Stewart 	sctp_sendmsgx __P((int sd, const void *, size_t,
1022f8829a4aSRandall Stewart                   struct sockaddr *, int,
1023f8829a4aSRandall Stewart                   uint32_t, uint32_t, uint16_t, uint32_t, uint32_t));
1024f8829a4aSRandall Stewart 
1025f8829a4aSRandall Stewart sctp_assoc_t
1026f8829a4aSRandall Stewart sctp_getassocid __P((int sd, struct sockaddr *sa));
1027f8829a4aSRandall Stewart 
1028f8829a4aSRandall Stewart 	ssize_t sctp_recvmsg __P((int, void *, size_t, struct sockaddr *,
1029f8829a4aSRandall Stewart                  socklen_t *, struct sctp_sndrcvinfo *, int *));
1030f8829a4aSRandall Stewart 
1031f8829a4aSRandall Stewart __END_DECLS
1032f8829a4aSRandall Stewart 
1033f8829a4aSRandall Stewart #endif				/* !_KERNEL */
1034f8829a4aSRandall Stewart #endif				/* !__sctp_uio_h__ */
1035