sctp_uio.h revision 167598
1163953Srrs/*-
2167598Srrs * Copyright (c) 2001-2007, Cisco Systems, Inc. All rights reserved.
3163953Srrs *
4163953Srrs * Redistribution and use in source and binary forms, with or without
5163953Srrs * modification, are permitted provided that the following conditions are met:
6163953Srrs *
7163953Srrs * a) Redistributions of source code must retain the above copyright notice,
8163953Srrs *   this list of conditions and the following disclaimer.
9163953Srrs *
10163953Srrs * b) Redistributions in binary form must reproduce the above copyright
11163953Srrs *    notice, this list of conditions and the following disclaimer in
12163953Srrs *   the documentation and/or other materials provided with the distribution.
13163953Srrs *
14163953Srrs * c) Neither the name of Cisco Systems, Inc. nor the names of its
15163953Srrs *    contributors may be used to endorse or promote products derived
16163953Srrs *    from this software without specific prior written permission.
17163953Srrs *
18163953Srrs * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19163953Srrs * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20163953Srrs * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21163953Srrs * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22163953Srrs * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23163953Srrs * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24163953Srrs * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25163953Srrs * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26163953Srrs * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27163953Srrs * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28163953Srrs * THE POSSIBILITY OF SUCH DAMAGE.
29163953Srrs */
30163953Srrs
31163953Srrs/* $KAME: sctp_uio.h,v 1.11 2005/03/06 16:04:18 itojun Exp $	 */
32163953Srrs#include <sys/cdefs.h>
33163953Srrs__FBSDID("$FreeBSD: head/sys/netinet/sctp_uio.h 167598 2007-03-15 11:27:14Z rrs $");
34163953Srrs
35163953Srrs#ifndef __sctp_uio_h__
36163953Srrs#define __sctp_uio_h__
37163953Srrs
38163953Srrs
39163953Srrs#if ! defined(_KERNEL)
40163953Srrs#include <stdint.h>
41163953Srrs#endif
42163953Srrs#include <sys/types.h>
43163953Srrs#include <sys/socket.h>
44166675Srrs#include <sys/time.h>
45164085Srrs#include <netinet/in.h>
46163953Srrs
47163953Srrstypedef uint32_t sctp_assoc_t;
48163953Srrs
49163953Srrs/* On/Off setup for subscription to events */
50163953Srrsstruct sctp_event_subscribe {
51163953Srrs	uint8_t sctp_data_io_event;
52163953Srrs	uint8_t sctp_association_event;
53163953Srrs	uint8_t sctp_address_event;
54163953Srrs	uint8_t sctp_send_failure_event;
55163953Srrs	uint8_t sctp_peer_error_event;
56163953Srrs	uint8_t sctp_shutdown_event;
57163953Srrs	uint8_t sctp_partial_delivery_event;
58163953Srrs	uint8_t sctp_adaptation_layer_event;
59163953Srrs	uint8_t sctp_authentication_event;
60163953Srrs	uint8_t sctp_stream_reset_events;
61163953Srrs};
62163953Srrs
63163953Srrs/* ancillary data types */
64163953Srrs#define SCTP_INIT	0x0001
65163953Srrs#define SCTP_SNDRCV	0x0002
66163953Srrs#define SCTP_EXTRCV	0x0003
67163953Srrs/*
68163953Srrs * ancillary data structures
69163953Srrs */
70163953Srrsstruct sctp_initmsg {
71163953Srrs	uint32_t sinit_num_ostreams;
72163953Srrs	uint32_t sinit_max_instreams;
73163953Srrs	uint16_t sinit_max_attempts;
74163953Srrs	uint16_t sinit_max_init_timeo;
75163953Srrs};
76163953Srrs
77163953Srrs/* We add 96 bytes to the size of sctp_sndrcvinfo.
78163953Srrs * This makes the current structure 128 bytes long
79163953Srrs * which is nicely 64 bit aligned but also has room
80163953Srrs * for us to add more and keep ABI compatability.
81163953Srrs * For example, already we have the sctp_extrcvinfo
82163953Srrs * when enabled which is 48 bytes.
83163953Srrs */
84163953Srrs
85166675Srrs/*
86166675Srrs * The assoc up needs a verfid
87166675Srrs * all sendrcvinfo's need a verfid for SENDING only.
88166675Srrs */
89166675Srrs
90166675Srrs
91163953Srrs#define SCTP_ALIGN_RESV_PAD 96
92166675Srrs#define SCTP_ALIGN_RESV_PAD_SHORT 80
93163953Srrs
94163953Srrsstruct sctp_sndrcvinfo {
95163953Srrs	uint16_t sinfo_stream;
96163953Srrs	uint16_t sinfo_ssn;
97163953Srrs	uint16_t sinfo_flags;
98163953Srrs	uint32_t sinfo_ppid;
99163953Srrs	uint32_t sinfo_context;
100163953Srrs	uint32_t sinfo_timetolive;
101163953Srrs	uint32_t sinfo_tsn;
102163953Srrs	uint32_t sinfo_cumtsn;
103163953Srrs	sctp_assoc_t sinfo_assoc_id;
104163953Srrs	uint8_t __reserve_pad[SCTP_ALIGN_RESV_PAD];
105163953Srrs};
106163953Srrs
107163953Srrsstruct sctp_extrcvinfo {
108163953Srrs	uint16_t sinfo_stream;
109163953Srrs	uint16_t sinfo_ssn;
110163953Srrs	uint16_t sinfo_flags;
111163953Srrs	uint32_t sinfo_ppid;
112163953Srrs	uint32_t sinfo_context;
113163953Srrs	uint32_t sinfo_timetolive;
114163953Srrs	uint32_t sinfo_tsn;
115163953Srrs	uint32_t sinfo_cumtsn;
116163953Srrs	sctp_assoc_t sinfo_assoc_id;
117163953Srrs	uint16_t next_flags;
118163953Srrs	uint16_t next_stream;
119163953Srrs	uint32_t next_asocid;
120163953Srrs	uint32_t next_length;
121163953Srrs	uint32_t next_ppid;
122166675Srrs	uint8_t __reserve_pad[SCTP_ALIGN_RESV_PAD_SHORT];
123163953Srrs};
124163953Srrs
125163953Srrs#define SCTP_NO_NEXT_MSG           0x0000
126163953Srrs#define SCTP_NEXT_MSG_AVAIL        0x0001
127163953Srrs#define SCTP_NEXT_MSG_ISCOMPLETE   0x0002
128163953Srrs#define SCTP_NEXT_MSG_IS_UNORDERED 0x0004
129166675Srrs#define SCTP_NEXT_MSG_IS_NOTIFICATION 0x0008
130163953Srrs
131163953Srrsstruct sctp_snd_all_completes {
132163953Srrs	uint16_t sall_stream;
133163953Srrs	uint16_t sall_flags;
134163953Srrs	uint32_t sall_ppid;
135163953Srrs	uint32_t sall_context;
136163953Srrs	uint32_t sall_num_sent;
137163953Srrs	uint32_t sall_num_failed;
138163953Srrs};
139163953Srrs
140163953Srrs/* Flags that go into the sinfo->sinfo_flags field */
141163953Srrs#define SCTP_EOF 	  0x0100/* Start shutdown procedures */
142163953Srrs#define SCTP_ABORT	  0x0200/* Send an ABORT to peer */
143163953Srrs#define SCTP_UNORDERED 	  0x0400/* Message is un-ordered */
144163953Srrs#define SCTP_ADDR_OVER	  0x0800/* Override the primary-address */
145163953Srrs#define SCTP_SENDALL      0x1000/* Send this on all associations */
146163953Srrs#define SCTP_EOR          0x2000/* end of message signal */
147166023Srrs#define INVALID_SINFO_FLAG(x) (((x) & 0xffffff00 \
148166023Srrs                                    & ~(SCTP_EOF | SCTP_ABORT | SCTP_UNORDERED |\
149166023Srrs				        SCTP_ADDR_OVER | SCTP_SENDALL | SCTP_EOR)) != 0)
150163953Srrs/* for the endpoint */
151163953Srrs
152163953Srrs/* The lower byte is an enumeration of PR-SCTP policies */
153163953Srrs#define SCTP_PR_SCTP_TTL  0x0001/* Time based PR-SCTP */
154163953Srrs#define SCTP_PR_SCTP_BUF  0x0002/* Buffer based PR-SCTP */
155163953Srrs#define SCTP_PR_SCTP_RTX  0x0003/* Number of retransmissions based PR-SCTP */
156163953Srrs
157166023Srrs#define PR_SCTP_POLICY(x)         ((x) & 0xff)
158166023Srrs#define PR_SCTP_ENABLED(x)        (PR_SCTP_POLICY(x) != 0)
159166023Srrs#define PR_SCTP_TTL_ENABLED(x)    (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_TTL)
160166023Srrs#define PR_SCTP_BUF_ENABLED(x)    (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_BUF)
161166023Srrs#define PR_SCTP_RTX_ENABLED(x)    (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_RTX)
162166023Srrs#define PR_SCTP_INVALID_POLICY(x) (PR_SCTP_POLICY(x) > SCTP_PR_SCTP_RTX)
163163953Srrs/* Stat's */
164163953Srrsstruct sctp_pcbinfo {
165163953Srrs	uint32_t ep_count;
166163953Srrs	uint32_t asoc_count;
167163953Srrs	uint32_t laddr_count;
168163953Srrs	uint32_t raddr_count;
169163953Srrs	uint32_t chk_count;
170163953Srrs	uint32_t readq_count;
171163953Srrs	uint32_t free_chunks;
172163953Srrs	uint32_t stream_oque;
173163953Srrs};
174163953Srrs
175163953Srrsstruct sctp_sockstat {
176163953Srrs	sctp_assoc_t ss_assoc_id;
177163953Srrs	uint32_t ss_total_sndbuf;
178163953Srrs	uint32_t ss_total_recv_buf;
179163953Srrs};
180163953Srrs
181163953Srrs/*
182163953Srrs * notification event structures
183163953Srrs */
184163953Srrs
185163953Srrs/*
186163953Srrs * association change event
187163953Srrs */
188163953Srrsstruct sctp_assoc_change {
189163953Srrs	uint16_t sac_type;
190163953Srrs	uint16_t sac_flags;
191163953Srrs	uint32_t sac_length;
192163953Srrs	uint16_t sac_state;
193163953Srrs	uint16_t sac_error;
194163953Srrs	uint16_t sac_outbound_streams;
195163953Srrs	uint16_t sac_inbound_streams;
196163953Srrs	sctp_assoc_t sac_assoc_id;
197163953Srrs};
198163953Srrs
199163953Srrs/* sac_state values */
200163953Srrs#define SCTP_COMM_UP		0x0001
201163953Srrs#define SCTP_COMM_LOST		0x0002
202163953Srrs#define SCTP_RESTART		0x0003
203163953Srrs#define SCTP_SHUTDOWN_COMP	0x0004
204163953Srrs#define SCTP_CANT_STR_ASSOC	0x0005
205163953Srrs
206163953Srrs
207163953Srrs/*
208163953Srrs * Address event
209163953Srrs */
210163953Srrsstruct sctp_paddr_change {
211163953Srrs	uint16_t spc_type;
212163953Srrs	uint16_t spc_flags;
213163953Srrs	uint32_t spc_length;
214163953Srrs	struct sockaddr_storage spc_aaddr;
215163953Srrs	uint32_t spc_state;
216163953Srrs	uint32_t spc_error;
217163953Srrs	sctp_assoc_t spc_assoc_id;
218163953Srrs};
219163953Srrs
220163953Srrs/* paddr state values */
221163953Srrs#define SCTP_ADDR_AVAILABLE	0x0001
222163953Srrs#define SCTP_ADDR_UNREACHABLE	0x0002
223163953Srrs#define SCTP_ADDR_REMOVED	0x0003
224163953Srrs#define SCTP_ADDR_ADDED		0x0004
225163953Srrs#define SCTP_ADDR_MADE_PRIM	0x0005
226163953Srrs#define SCTP_ADDR_CONFIRMED	0x0006
227163953Srrs
228163953Srrs/*
229163953Srrs * CAUTION: these are user exposed SCTP addr reachability states must be
230163953Srrs * compatible with SCTP_ADDR states in sctp_constants.h
231163953Srrs */
232163953Srrs#ifdef SCTP_ACTIVE
233163953Srrs#undef SCTP_ACTIVE
234163953Srrs#endif
235163953Srrs#define SCTP_ACTIVE		0x0001	/* SCTP_ADDR_REACHABLE */
236163953Srrs
237163953Srrs#ifdef SCTP_INACTIVE
238163953Srrs#undef SCTP_INACTIVE
239163953Srrs#endif
240163953Srrs#define SCTP_INACTIVE		0x0002	/* SCTP_ADDR_NOT_REACHABLE */
241163953Srrs
242163953Srrs#ifdef SCTP_UNCONFIRMED
243163953Srrs#undef SCTP_UNCONFIRMED
244163953Srrs#endif
245163953Srrs#define SCTP_UNCONFIRMED	0x0200	/* SCTP_ADDR_UNCONFIRMED */
246163953Srrs
247163953Srrs#ifdef SCTP_NOHEARTBEAT
248163953Srrs#undef SCTP_NOHEARTBEAT
249163953Srrs#endif
250163953Srrs#define SCTP_NOHEARTBEAT	0x0040	/* SCTP_ADDR_NOHB */
251163953Srrs
252163953Srrs
253163953Srrs/* remote error events */
254163953Srrsstruct sctp_remote_error {
255163953Srrs	uint16_t sre_type;
256163953Srrs	uint16_t sre_flags;
257163953Srrs	uint32_t sre_length;
258163953Srrs	uint16_t sre_error;
259163953Srrs	sctp_assoc_t sre_assoc_id;
260163953Srrs	uint8_t sre_data[4];
261163953Srrs};
262163953Srrs
263163953Srrs/* data send failure event */
264163953Srrsstruct sctp_send_failed {
265163953Srrs	uint16_t ssf_type;
266163953Srrs	uint16_t ssf_flags;
267163953Srrs	uint32_t ssf_length;
268163953Srrs	uint32_t ssf_error;
269163953Srrs	struct sctp_sndrcvinfo ssf_info;
270163953Srrs	sctp_assoc_t ssf_assoc_id;
271163953Srrs	uint8_t ssf_data[4];
272163953Srrs};
273163953Srrs
274163953Srrs/* flag that indicates state of data */
275163953Srrs#define SCTP_DATA_UNSENT	0x0001	/* inqueue never on wire */
276163953Srrs#define SCTP_DATA_SENT		0x0002	/* on wire at failure */
277163953Srrs
278163953Srrs/* shutdown event */
279163953Srrsstruct sctp_shutdown_event {
280163953Srrs	uint16_t sse_type;
281163953Srrs	uint16_t sse_flags;
282163953Srrs	uint32_t sse_length;
283163953Srrs	sctp_assoc_t sse_assoc_id;
284163953Srrs};
285163953Srrs
286163953Srrs/* Adaptation layer indication stuff */
287163953Srrsstruct sctp_adaptation_event {
288163953Srrs	uint16_t sai_type;
289163953Srrs	uint16_t sai_flags;
290163953Srrs	uint32_t sai_length;
291163953Srrs	uint32_t sai_adaptation_ind;
292163953Srrs	sctp_assoc_t sai_assoc_id;
293163953Srrs};
294163953Srrs
295163953Srrsstruct sctp_setadaptation {
296163953Srrs	uint32_t ssb_adaptation_ind;
297163953Srrs};
298163953Srrs
299163953Srrs/* compatable old spelling */
300163953Srrsstruct sctp_adaption_event {
301163953Srrs	uint16_t sai_type;
302163953Srrs	uint16_t sai_flags;
303163953Srrs	uint32_t sai_length;
304163953Srrs	uint32_t sai_adaption_ind;
305163953Srrs	sctp_assoc_t sai_assoc_id;
306163953Srrs};
307163953Srrs
308163953Srrsstruct sctp_setadaption {
309163953Srrs	uint32_t ssb_adaption_ind;
310163953Srrs};
311163953Srrs
312163953Srrs
313163953Srrs/*
314163953Srrs * Partial Delivery API event
315163953Srrs */
316163953Srrsstruct sctp_pdapi_event {
317163953Srrs	uint16_t pdapi_type;
318163953Srrs	uint16_t pdapi_flags;
319163953Srrs	uint32_t pdapi_length;
320163953Srrs	uint32_t pdapi_indication;
321163953Srrs	sctp_assoc_t pdapi_assoc_id;
322163953Srrs};
323163953Srrs
324163953Srrs/* indication values */
325163953Srrs#define SCTP_PARTIAL_DELIVERY_ABORTED	0x0001
326163953Srrs
327163953Srrs
328163953Srrs/*
329163953Srrs * authentication key event
330163953Srrs */
331163953Srrsstruct sctp_authkey_event {
332163953Srrs	uint16_t auth_type;
333163953Srrs	uint16_t auth_flags;
334163953Srrs	uint32_t auth_length;
335163953Srrs	uint16_t auth_keynumber;
336163953Srrs	uint16_t auth_altkeynumber;
337163953Srrs	uint32_t auth_indication;
338163953Srrs	sctp_assoc_t auth_assoc_id;
339163953Srrs};
340163953Srrs
341163953Srrs/* indication values */
342163953Srrs#define SCTP_AUTH_NEWKEY	0x0001
343163953Srrs
344163953Srrs
345163953Srrs/*
346163953Srrs * stream reset event
347163953Srrs */
348163953Srrsstruct sctp_stream_reset_event {
349163953Srrs	uint16_t strreset_type;
350163953Srrs	uint16_t strreset_flags;
351163953Srrs	uint32_t strreset_length;
352163953Srrs	sctp_assoc_t strreset_assoc_id;
353163953Srrs	uint16_t strreset_list[0];
354163953Srrs};
355163953Srrs
356163953Srrs/* flags in strreset_flags field */
357163953Srrs#define SCTP_STRRESET_INBOUND_STR  0x0001
358163953Srrs#define SCTP_STRRESET_OUTBOUND_STR 0x0002
359163953Srrs#define SCTP_STRRESET_ALL_STREAMS  0x0004
360163953Srrs#define SCTP_STRRESET_STREAM_LIST  0x0008
361163953Srrs#define SCTP_STRRESET_FAILED       0x0010
362163953Srrs
363163953Srrs
364163953Srrs/* SCTP notification event */
365163953Srrsstruct sctp_tlv {
366163953Srrs	uint16_t sn_type;
367163953Srrs	uint16_t sn_flags;
368163953Srrs	uint32_t sn_length;
369163953Srrs};
370163953Srrs
371163953Srrsunion sctp_notification {
372163953Srrs	struct sctp_tlv sn_header;
373163953Srrs	struct sctp_assoc_change sn_assoc_change;
374163953Srrs	struct sctp_paddr_change sn_paddr_change;
375163953Srrs	struct sctp_remote_error sn_remote_error;
376163953Srrs	struct sctp_send_failed sn_send_failed;
377163953Srrs	struct sctp_shutdown_event sn_shutdown_event;
378163953Srrs	struct sctp_adaptation_event sn_adaptation_event;
379163953Srrs	/* compatability same as above */
380163953Srrs	struct sctp_adaption_event sn_adaption_event;
381163953Srrs	struct sctp_pdapi_event sn_pdapi_event;
382163953Srrs	struct sctp_authkey_event sn_auth_event;
383163953Srrs	struct sctp_stream_reset_event sn_strreset_event;
384163953Srrs};
385163953Srrs
386163953Srrs/* notification types */
387163953Srrs#define SCTP_ASSOC_CHANGE		0x0001
388163953Srrs#define SCTP_PEER_ADDR_CHANGE		0x0002
389163953Srrs#define SCTP_REMOTE_ERROR		0x0003
390163953Srrs#define SCTP_SEND_FAILED		0x0004
391163953Srrs#define SCTP_SHUTDOWN_EVENT		0x0005
392163953Srrs#define SCTP_ADAPTATION_INDICATION	0x0006
393163953Srrs/* same as above */
394163953Srrs#define SCTP_ADAPTION_INDICATION	0x0006
395163953Srrs#define SCTP_PARTIAL_DELIVERY_EVENT	0x0007
396163953Srrs#define SCTP_AUTHENTICATION_EVENT	0x0008
397163953Srrs#define SCTP_STREAM_RESET_EVENT		0x0009
398163953Srrs
399163953Srrs
400163953Srrs/*
401163953Srrs * socket option structs
402163953Srrs */
403163953Srrs
404163953Srrsstruct sctp_paddrparams {
405163953Srrs	sctp_assoc_t spp_assoc_id;
406163953Srrs	struct sockaddr_storage spp_address;
407163953Srrs	uint32_t spp_hbinterval;
408163953Srrs	uint16_t spp_pathmaxrxt;
409163953Srrs	uint32_t spp_pathmtu;
410163953Srrs	uint32_t spp_flags;
411163953Srrs	uint32_t spp_ipv6_flowlabel;
412163953Srrs	uint8_t spp_ipv4_tos;
413163953Srrs
414163953Srrs};
415163953Srrs
416163953Srrs#define SPP_HB_ENABLE		0x00000001
417163953Srrs#define SPP_HB_DISABLE		0x00000002
418163953Srrs#define SPP_HB_DEMAND		0x00000004
419163953Srrs#define SPP_PMTUD_ENABLE	0x00000008
420163953Srrs#define SPP_PMTUD_DISABLE	0x00000010
421163953Srrs#define SPP_SACKDELAY_ENABLE	0x00000020
422163953Srrs#define SPP_SACKDELAY_DISABLE	0x00000040
423163953Srrs#define SPP_HB_TIME_IS_ZERO     0x00000080
424163953Srrs#define SPP_IPV6_FLOWLABEL      0x00000100
425163953Srrs#define SPP_IPV4_TOS            0x00000200
426163953Srrs
427163953Srrsstruct sctp_paddrinfo {
428163953Srrs	sctp_assoc_t spinfo_assoc_id;
429163953Srrs	struct sockaddr_storage spinfo_address;
430163953Srrs	int32_t spinfo_state;
431163953Srrs	uint32_t spinfo_cwnd;
432163953Srrs	uint32_t spinfo_srtt;
433163953Srrs	uint32_t spinfo_rto;
434163953Srrs	uint32_t spinfo_mtu;
435163953Srrs};
436163953Srrs
437163953Srrsstruct sctp_rtoinfo {
438163953Srrs	sctp_assoc_t srto_assoc_id;
439163953Srrs	uint32_t srto_initial;
440163953Srrs	uint32_t srto_max;
441163953Srrs	uint32_t srto_min;
442163953Srrs};
443163953Srrs
444163953Srrsstruct sctp_assocparams {
445163953Srrs	sctp_assoc_t sasoc_assoc_id;
446163953Srrs	uint16_t sasoc_asocmaxrxt;
447163953Srrs	uint16_t sasoc_number_peer_destinations;
448163953Srrs	uint32_t sasoc_peer_rwnd;
449163953Srrs	uint32_t sasoc_local_rwnd;
450163953Srrs	uint32_t sasoc_cookie_life;
451167598Srrs	uint32_t sasoc_sack_delay;
452167598Srrs	uint32_t sasoc_sack_freq;
453163953Srrs};
454163953Srrs
455163953Srrsstruct sctp_setprim {
456163953Srrs	sctp_assoc_t ssp_assoc_id;
457163953Srrs	struct sockaddr_storage ssp_addr;
458163953Srrs};
459163953Srrs
460163953Srrsstruct sctp_setpeerprim {
461163953Srrs	sctp_assoc_t sspp_assoc_id;
462163953Srrs	struct sockaddr_storage sspp_addr;
463163953Srrs};
464163953Srrs
465163953Srrsstruct sctp_getaddresses {
466163953Srrs	sctp_assoc_t sget_assoc_id;
467163953Srrs	/* addr is filled in for N * sockaddr_storage */
468163953Srrs	struct sockaddr addr[1];
469163953Srrs};
470163953Srrs
471163953Srrsstruct sctp_setstrm_timeout {
472163953Srrs	sctp_assoc_t ssto_assoc_id;
473163953Srrs	uint32_t ssto_timeout;
474163953Srrs	uint32_t ssto_streamid_start;
475163953Srrs	uint32_t ssto_streamid_end;
476163953Srrs};
477163953Srrs
478163953Srrsstruct sctp_status {
479163953Srrs	sctp_assoc_t sstat_assoc_id;
480163953Srrs	int32_t sstat_state;
481163953Srrs	uint32_t sstat_rwnd;
482163953Srrs	uint16_t sstat_unackdata;
483163953Srrs	uint16_t sstat_penddata;
484163953Srrs	uint16_t sstat_instrms;
485163953Srrs	uint16_t sstat_outstrms;
486163953Srrs	uint32_t sstat_fragmentation_point;
487163953Srrs	struct sctp_paddrinfo sstat_primary;
488163953Srrs};
489163953Srrs
490163953Srrs/*
491163953Srrs * AUTHENTICATION support
492163953Srrs */
493163953Srrs/* SCTP_AUTH_CHUNK */
494163953Srrsstruct sctp_authchunk {
495163953Srrs	uint8_t sauth_chunk;
496163953Srrs};
497163953Srrs
498163953Srrs/* SCTP_AUTH_KEY */
499163953Srrsstruct sctp_authkey {
500163953Srrs	sctp_assoc_t sca_assoc_id;
501163953Srrs	uint16_t sca_keynumber;
502163953Srrs	uint8_t sca_key[0];
503163953Srrs};
504163953Srrs
505163953Srrs/* SCTP_HMAC_IDENT */
506163953Srrsstruct sctp_hmacalgo {
507163953Srrs	uint16_t shmac_idents[0];
508163953Srrs};
509163953Srrs
510163953Srrs/* AUTH hmac_id */
511163953Srrs#define SCTP_AUTH_HMAC_ID_RSVD		0x0000
512163953Srrs#define SCTP_AUTH_HMAC_ID_SHA1		0x0001	/* default, mandatory */
513163953Srrs#define SCTP_AUTH_HMAC_ID_MD5		0x0002	/* deprecated */
514163953Srrs#define SCTP_AUTH_HMAC_ID_SHA256	0x0003
515163953Srrs#define SCTP_AUTH_HMAC_ID_SHA224	0x8001
516163953Srrs#define SCTP_AUTH_HMAC_ID_SHA384	0x8002
517163953Srrs#define SCTP_AUTH_HMAC_ID_SHA512	0x8003
518163953Srrs
519163953Srrs
520163953Srrs/* SCTP_AUTH_ACTIVE_KEY / SCTP_AUTH_DELETE_KEY */
521163953Srrsstruct sctp_authkeyid {
522163953Srrs	sctp_assoc_t scact_assoc_id;
523163953Srrs	uint16_t scact_keynumber;
524163953Srrs};
525163953Srrs
526163953Srrs/* SCTP_PEER_AUTH_CHUNKS / SCTP_LOCAL_AUTH_CHUNKS */
527163953Srrsstruct sctp_authchunks {
528163953Srrs	sctp_assoc_t gauth_assoc_id;
529163953Srrs	uint8_t gauth_chunks[0];
530163953Srrs};
531163953Srrs
532163953Srrsstruct sctp_assoc_value {
533163953Srrs	sctp_assoc_t assoc_id;
534163953Srrs	uint32_t assoc_value;
535163953Srrs};
536163953Srrs
537163953Srrs#define MAX_ASOC_IDS_RET 255
538163953Srrsstruct sctp_assoc_ids {
539163953Srrs	uint16_t asls_assoc_start;	/* array of index's start at 0 */
540163953Srrs	uint8_t asls_numb_present;
541163953Srrs	uint8_t asls_more_to_get;
542163953Srrs	sctp_assoc_t asls_assoc_id[MAX_ASOC_IDS_RET];
543163953Srrs};
544163953Srrs
545163953Srrsstruct sctp_cwnd_args {
546163953Srrs	struct sctp_nets *net;	/* network to */
547163953Srrs	uint32_t cwnd_new_value;/* cwnd in k */
548163953Srrs	uint32_t inflight;	/* flightsize in k */
549163953Srrs	uint32_t pseudo_cumack;
550163953Srrs	int cwnd_augment;	/* increment to it */
551163953Srrs	uint8_t meets_pseudo_cumack;
552163953Srrs	uint8_t need_new_pseudo_cumack;
553163953Srrs	uint8_t cnt_in_send;
554163953Srrs	uint8_t cnt_in_str;
555163953Srrs};
556163953Srrs
557163953Srrsstruct sctp_blk_args {
558163953Srrs	uint32_t onsb;		/* in 1k bytes */
559163953Srrs	uint32_t sndlen;	/* len of send being attempted */
560163953Srrs	uint32_t peer_rwnd;	/* rwnd of peer */
561163953Srrs	uint16_t send_sent_qcnt;/* chnk cnt */
562163953Srrs	uint16_t stream_qcnt;	/* chnk cnt */
563163953Srrs	uint16_t chunks_on_oque;/* chunks out */
564163953Srrs	uint16_t flight_size;	/* flight size in k */
565163953Srrs};
566163953Srrs
567163953Srrs/*
568163953Srrs * Max we can reset in one setting, note this is dictated not by the define
569163953Srrs * but the size of a mbuf cluster so don't change this define and think you
570163953Srrs * can specify more. You must do multiple resets if you want to reset more
571163953Srrs * than SCTP_MAX_EXPLICIT_STR_RESET.
572163953Srrs */
573163953Srrs#define SCTP_MAX_EXPLICT_STR_RESET   1000
574163953Srrs
575163953Srrs#define SCTP_RESET_LOCAL_RECV  0x0001
576163953Srrs#define SCTP_RESET_LOCAL_SEND  0x0002
577163953Srrs#define SCTP_RESET_BOTH        0x0003
578163953Srrs#define SCTP_RESET_TSN         0x0004
579163953Srrs
580163953Srrsstruct sctp_stream_reset {
581163953Srrs	sctp_assoc_t strrst_assoc_id;
582163953Srrs	uint16_t strrst_flags;
583163953Srrs	uint16_t strrst_num_streams;	/* 0 == ALL */
584163953Srrs	uint16_t strrst_list[0];/* list if strrst_num_streams is not 0 */
585163953Srrs};
586163953Srrs
587163953Srrs
588163953Srrsstruct sctp_get_nonce_values {
589163953Srrs	sctp_assoc_t gn_assoc_id;
590163953Srrs	uint32_t gn_peers_tag;
591163953Srrs	uint32_t gn_local_tag;
592163953Srrs};
593163953Srrs
594163953Srrs/* Debugging logs */
595163953Srrsstruct sctp_str_log {
596164181Srrs	void *stcb;
597163953Srrs	uint32_t n_tsn;
598163953Srrs	uint32_t e_tsn;
599163953Srrs	uint16_t n_sseq;
600163953Srrs	uint16_t e_sseq;
601164181Srrs	uint16_t strm;
602163953Srrs};
603163953Srrs
604163953Srrsstruct sctp_sb_log {
605163996Srrs	void *stcb;
606163953Srrs	uint32_t so_sbcc;
607163953Srrs	uint32_t stcb_sbcc;
608163953Srrs	uint32_t incr;
609163953Srrs};
610163953Srrs
611163953Srrsstruct sctp_fr_log {
612163953Srrs	uint32_t largest_tsn;
613163953Srrs	uint32_t largest_new_tsn;
614163953Srrs	uint32_t tsn;
615163953Srrs};
616163953Srrs
617163953Srrsstruct sctp_fr_map {
618163953Srrs	uint32_t base;
619163953Srrs	uint32_t cum;
620163953Srrs	uint32_t high;
621163953Srrs};
622163953Srrs
623163953Srrsstruct sctp_rwnd_log {
624163953Srrs	uint32_t rwnd;
625163953Srrs	uint32_t send_size;
626163953Srrs	uint32_t overhead;
627163953Srrs	uint32_t new_rwnd;
628163953Srrs};
629163953Srrs
630163953Srrsstruct sctp_mbcnt_log {
631163953Srrs	uint32_t total_queue_size;
632163953Srrs	uint32_t size_change;
633163953Srrs	uint32_t total_queue_mb_size;
634163953Srrs	uint32_t mbcnt_change;
635163953Srrs};
636163953Srrs
637163953Srrsstruct sctp_sack_log {
638163953Srrs	uint32_t cumack;
639163953Srrs	uint32_t oldcumack;
640163953Srrs	uint32_t tsn;
641163953Srrs	uint16_t numGaps;
642163953Srrs	uint16_t numDups;
643163953Srrs};
644163953Srrs
645163953Srrsstruct sctp_lock_log {
646163996Srrs	void *sock;
647163996Srrs	void *inp;
648163953Srrs	uint8_t tcb_lock;
649163953Srrs	uint8_t inp_lock;
650163953Srrs	uint8_t info_lock;
651163953Srrs	uint8_t sock_lock;
652163953Srrs	uint8_t sockrcvbuf_lock;
653163953Srrs	uint8_t socksndbuf_lock;
654163953Srrs	uint8_t create_lock;
655163953Srrs	uint8_t resv;
656163953Srrs};
657163953Srrs
658163953Srrsstruct sctp_rto_log {
659163996Srrs	void *net;
660163953Srrs	uint32_t rtt;
661163953Srrs	uint32_t rttvar;
662163953Srrs	uint8_t direction;
663163953Srrs};
664163953Srrs
665163953Srrsstruct sctp_nagle_log {
666163996Srrs	void *stcb;
667163953Srrs	uint32_t total_flight;
668163953Srrs	uint32_t total_in_queue;
669163953Srrs	uint16_t count_in_queue;
670163953Srrs	uint16_t count_in_flight;
671163953Srrs};
672163953Srrs
673163953Srrsstruct sctp_sbwake_log {
674163996Srrs	void *stcb;
675163953Srrs	uint16_t send_q;
676163953Srrs	uint16_t sent_q;
677163953Srrs	uint16_t flight;
678163953Srrs	uint16_t wake_cnt;
679163953Srrs	uint8_t stream_qcnt;	/* chnk cnt */
680163953Srrs	uint8_t chunks_on_oque;	/* chunks out */
681163953Srrs	uint8_t sbflags;
682163953Srrs	uint8_t sctpflags;
683163953Srrs};
684163953Srrs
685163953Srrsstruct sctp_misc_info {
686163953Srrs	uint32_t log1;
687163953Srrs	uint32_t log2;
688163953Srrs	uint32_t log3;
689163953Srrs	uint32_t log4;
690163953Srrs};
691163953Srrs
692163953Srrsstruct sctp_log_closing {
693163996Srrs	void *inp;
694163996Srrs	void *stcb;
695163953Srrs	uint32_t sctp_flags;
696163953Srrs	uint16_t state;
697163953Srrs	int16_t loc;
698163953Srrs};
699163953Srrs
700163953Srrsstruct sctp_mbuf_log {
701163953Srrs	struct mbuf *mp;
702163953Srrs	caddr_t ext;
703163953Srrs	caddr_t data;
704163953Srrs	uint16_t size;
705163953Srrs	uint8_t refcnt;
706163953Srrs	uint8_t mbuf_flags;
707163953Srrs};
708163953Srrs
709163953Srrsstruct sctp_cwnd_log {
710163953Srrs	uint32_t time_event;
711163953Srrs	uint8_t from;
712163953Srrs	uint8_t event_type;
713163953Srrs	uint8_t resv[2];
714163953Srrs	union {
715163953Srrs		struct sctp_log_closing close;
716163953Srrs		struct sctp_blk_args blk;
717163953Srrs		struct sctp_cwnd_args cwnd;
718163953Srrs		struct sctp_str_log strlog;
719163953Srrs		struct sctp_fr_log fr;
720163953Srrs		struct sctp_fr_map map;
721163953Srrs		struct sctp_rwnd_log rwnd;
722163953Srrs		struct sctp_mbcnt_log mbcnt;
723163953Srrs		struct sctp_sack_log sack;
724163953Srrs		struct sctp_lock_log lock;
725163953Srrs		struct sctp_rto_log rto;
726163953Srrs		struct sctp_sb_log sb;
727163953Srrs		struct sctp_nagle_log nagle;
728163953Srrs		struct sctp_sbwake_log wake;
729163953Srrs		struct sctp_mbuf_log mb;
730163953Srrs		struct sctp_misc_info misc;
731163953Srrs	}     x;
732163953Srrs};
733163953Srrs
734163953Srrsstruct sctp_cwnd_log_req {
735163953Srrs	int num_in_log;		/* Number in log */
736163953Srrs	int num_ret;		/* Number returned */
737163953Srrs	int start_at;		/* start at this one */
738163953Srrs	int end_at;		/* end at this one */
739163953Srrs	struct sctp_cwnd_log log[0];
740163953Srrs};
741163953Srrs
742163953Srrsstruct sctpstat {
743163953Srrs	/* MIB according to RFC 3873 */
744163953Srrs	u_long sctps_currestab;	/* sctpStats  1   (Gauge32) */
745163953Srrs	u_long sctps_activeestab;	/* sctpStats  2 (Counter32) */
746166675Srrs	u_long sctps_restartestab;
747166675Srrs	u_long sctps_collisionestab;
748163953Srrs	u_long sctps_passiveestab;	/* sctpStats  3 (Counter32) */
749163953Srrs	u_long sctps_aborted;	/* sctpStats  4 (Counter32) */
750163953Srrs	u_long sctps_shutdown;	/* sctpStats  5 (Counter32) */
751163953Srrs	u_long sctps_outoftheblue;	/* sctpStats  6 (Counter32) */
752163953Srrs	u_long sctps_checksumerrors;	/* sctpStats  7 (Counter32) */
753163953Srrs	u_long sctps_outcontrolchunks;	/* sctpStats  8 (Counter64) */
754163953Srrs	u_long sctps_outorderchunks;	/* sctpStats  9 (Counter64) */
755163953Srrs	u_long sctps_outunorderchunks;	/* sctpStats 10 (Counter64) */
756163953Srrs	u_long sctps_incontrolchunks;	/* sctpStats 11 (Counter64) */
757163953Srrs	u_long sctps_inorderchunks;	/* sctpStats 12 (Counter64) */
758163953Srrs	u_long sctps_inunorderchunks;	/* sctpStats 13 (Counter64) */
759163953Srrs	u_long sctps_fragusrmsgs;	/* sctpStats 14 (Counter64) */
760163953Srrs	u_long sctps_reasmusrmsgs;	/* sctpStats 15 (Counter64) */
761163953Srrs	u_long sctps_outpackets;/* sctpStats 16 (Counter64) */
762163953Srrs	u_long sctps_inpackets;	/* sctpStats 17 (Counter64) */
763166675Srrs	struct timeval sctps_discontinuitytime;	/* sctpStats 18 (TimeStamp) */
764163953Srrs	/* input statistics: */
765163953Srrs	u_long sctps_recvpackets;	/* total input packets        */
766163953Srrs	u_long sctps_recvdatagrams;	/* total input datagrams      */
767163953Srrs	u_long sctps_recvpktwithdata;
768163953Srrs	u_long sctps_recvsacks;	/* total input SACK chunks    */
769163953Srrs	u_long sctps_recvdata;	/* total input DATA chunks    */
770163953Srrs	u_long sctps_recvdupdata;	/* total input duplicate DATA chunks */
771163953Srrs	u_long sctps_recvheartbeat;	/* total input HB chunks      */
772163953Srrs	u_long sctps_recvheartbeatack;	/* total input HB-ACK chunks  */
773163953Srrs	u_long sctps_recvecne;	/* total input ECNE chunks    */
774163953Srrs	u_long sctps_recvauth;	/* total input AUTH chunks    */
775163953Srrs	u_long sctps_recvauthmissing;	/* total input chunks missing AUTH */
776163953Srrs	u_long sctps_recvivalhmacid;	/* total number of invalid HMAC ids
777163953Srrs					 * received */
778163953Srrs	u_long sctps_recvivalkeyid;	/* total number of invalid secret ids
779163953Srrs					 * received */
780163953Srrs	u_long sctps_recvauthfailed;	/* total number of auth failed */
781163953Srrs	u_long sctps_recvexpress;	/* total fast path receives all one
782163953Srrs					 * chunk */
783163953Srrs	u_long sctps_recvexpressm;	/* total fast path multi-part data */
784163953Srrs	/* output statistics: */
785163953Srrs	u_long sctps_sendpackets;	/* total output packets       */
786163953Srrs	u_long sctps_sendsacks;	/* total output SACKs         */
787163953Srrs	u_long sctps_senddata;	/* total output DATA chunks   */
788163953Srrs	u_long sctps_sendretransdata;	/* total output retransmitted DATA
789163953Srrs					 * chunks */
790163953Srrs	u_long sctps_sendfastretrans;	/* total output fast retransmitted
791163953Srrs					 * DATA chunks */
792163953Srrs	u_long sctps_sendmultfastretrans;	/* U-del */
793163953Srrs	u_long sctps_sendheartbeat;	/* total output HB chunks     */
794163953Srrs	u_long sctps_sendecne;	/* total output ECNE chunks    */
795163953Srrs	u_long sctps_sendauth;	/* total output AUTH chunks FIXME   */
796163953Srrs	u_long sctps_senderrors;/* ip_output error counter */
797163953Srrs	/* PCKDROPREP statistics: */
798163953Srrs	u_long sctps_pdrpfmbox;	/* */
799163953Srrs	u_long sctps_pdrpfehos;	/* */
800163953Srrs	u_long sctps_pdrpmbda;	/* */
801163953Srrs	u_long sctps_pdrpmbct;	/* */
802163953Srrs	u_long sctps_pdrpbwrpt;	/* */
803163953Srrs	u_long sctps_pdrpcrupt;	/* */
804163953Srrs	u_long sctps_pdrpnedat;	/* */
805163953Srrs	u_long sctps_pdrppdbrk;	/* */
806163953Srrs	u_long sctps_pdrptsnnf;	/* */
807163953Srrs	u_long sctps_pdrpdnfnd;	/* */
808163953Srrs	u_long sctps_pdrpdiwnp;	/* */
809163953Srrs	u_long sctps_pdrpdizrw;	/* */
810163953Srrs	u_long sctps_pdrpbadd;	/* */
811163953Srrs	u_long sctps_pdrpmark;	/* */
812163953Srrs	/* timeouts */
813163953Srrs	u_long sctps_timoiterator;	/* */
814163953Srrs	u_long sctps_timodata;	/* */
815163953Srrs	u_long sctps_timowindowprobe;	/* */
816163953Srrs	u_long sctps_timoinit;	/* */
817163953Srrs	u_long sctps_timosack;	/* */
818163953Srrs	u_long sctps_timoshutdown;	/* */
819163953Srrs	u_long sctps_timoheartbeat;	/* */
820163953Srrs	u_long sctps_timocookie;/* */
821163953Srrs	u_long sctps_timosecret;/* */
822163953Srrs	u_long sctps_timopathmtu;	/* */
823163953Srrs	u_long sctps_timoshutdownack;	/* */
824163953Srrs	u_long sctps_timoshutdownguard;	/* */
825163953Srrs	u_long sctps_timostrmrst;	/* */
826163953Srrs	u_long sctps_timoearlyfr;	/* */
827163953Srrs	u_long sctps_timoasconf;/* */
828163953Srrs	u_long sctps_timoautoclose;	/* */
829163953Srrs	u_long sctps_timoassockill;	/* */
830163953Srrs	u_long sctps_timoinpkill;	/* */
831163953Srrs	/* Early fast retransmission counters */
832163953Srrs	u_long sctps_earlyfrstart;
833163953Srrs	u_long sctps_earlyfrstop;
834163953Srrs	u_long sctps_earlyfrmrkretrans;
835163953Srrs	u_long sctps_earlyfrstpout;
836163953Srrs	u_long sctps_earlyfrstpidsck1;
837163953Srrs	u_long sctps_earlyfrstpidsck2;
838163953Srrs	u_long sctps_earlyfrstpidsck3;
839163953Srrs	u_long sctps_earlyfrstpidsck4;
840163953Srrs	u_long sctps_earlyfrstrid;
841163953Srrs	u_long sctps_earlyfrstrout;
842163953Srrs	u_long sctps_earlyfrstrtmr;
843163953Srrs	/* otheres */
844163953Srrs	u_long sctps_hdrops;	/* packet shorter than header */
845163953Srrs	u_long sctps_badsum;	/* checksum error             */
846163953Srrs	u_long sctps_noport;	/* no endpoint for port       */
847163953Srrs	u_long sctps_badvtag;	/* bad v-tag                  */
848163953Srrs	u_long sctps_badsid;	/* bad SID                    */
849163953Srrs	u_long sctps_nomem;	/* no memory                  */
850163953Srrs	u_long sctps_fastretransinrtt;	/* number of multiple FR in a RTT
851163953Srrs					 * window */
852163953Srrs	u_long sctps_markedretrans;
853163953Srrs	u_long sctps_naglesent;	/* nagle allowed sending      */
854163953Srrs	u_long sctps_naglequeued;	/* nagle does't allow sending */
855163953Srrs	u_long sctps_maxburstqueued;	/* max burst dosn't allow sending */
856163953Srrs	u_long sctps_ifnomemqueued;	/* */
857163953Srrs	u_long sctps_windowprobed;	/* total number of window probes sent */
858163953Srrs	u_long sctps_lowlevelerr;
859163953Srrs	u_long sctps_lowlevelerrusr;
860163953Srrs	u_long sctps_datadropchklmt;
861163953Srrs	u_long sctps_datadroprwnd;
862163953Srrs	u_long sctps_ecnereducedcwnd;
863163953Srrs	u_long sctps_vtagexpress;	/* Used express lookup via vtag */
864163953Srrs	u_long sctps_vtagbogus;	/* Collision in express lookup. */
865163953Srrs	u_long sctps_primary_randry;	/* Number of times the sender ran dry
866163953Srrs					 * of user data on primary */
867163953Srrs	u_long sctps_cmt_randry;/* Same for above */
868163953Srrs	u_long sctps_slowpath_sack;	/* Sacks the slow way */
869163953Srrs	u_long sctps_wu_sacks_sent;	/* Window Update only sacks sent */
870165220Srrs	u_long sctps_sends_with_flags;	/* number of sends with sinfo_flags
871165220Srrs					 * !=0 */
872165220Srrs	u_long sctps_sends_with_unord;
873165220Srrs	u_long sctps_sends_with_eof;
874165220Srrs	u_long sctps_sends_with_abort;
875165220Srrs	u_long sctps_protocol_drain_calls;
876165220Srrs	u_long sctps_protocol_drains_done;
877163953Srrs};
878163953Srrs
879163953Srrs#define SCTP_STAT_INCR(_x) SCTP_STAT_INCR_BY(_x,1)
880163953Srrs#define SCTP_STAT_DECR(_x) SCTP_STAT_DECR_BY(_x,1)
881163953Srrs#define SCTP_STAT_INCR_BY(_x,_d) atomic_add_long(&sctpstat._x, _d)
882163953Srrs#define SCTP_STAT_DECR_BY(_x,_d) atomic_add_long(&sctpstat._x, -(_d))
883163953Srrs/* The following macros are for handling MIB values, */
884163953Srrs#define SCTP_STAT_INCR_COUNTER32(_x) SCTP_STAT_INCR(_x)
885163953Srrs#define SCTP_STAT_INCR_COUNTER64(_x) SCTP_STAT_INCR(_x)
886163953Srrs#define SCTP_STAT_INCR_GAUGE32(_x) SCTP_STAT_INCR(_x)
887163953Srrs#define SCTP_STAT_DECR_COUNTER32(_x) SCTP_STAT_DECR(_x)
888163953Srrs#define SCTP_STAT_DECR_COUNTER64(_x) SCTP_STAT_DECR(_x)
889163953Srrs#define SCTP_STAT_DECR_GAUGE32(_x) SCTP_STAT_DECR(_x)
890163953Srrs
891164085Srrsunion sctp_sockstore {
892167598Srrs#if defined(INET) || !defined(_KERNEL)
893164085Srrs	struct sockaddr_in sin;
894164085Srrs#endif
895167598Srrs#if defined(INET6) || !defined(_KERNEL)
896164085Srrs	struct sockaddr_in6 sin6;
897164085Srrs#endif
898164085Srrs	struct sockaddr sa;
899164085Srrs};
900164085Srrs
901165220Srrsstruct xsctp_inpcb {
902165220Srrs	uint32_t last;
903165220Srrs	uint16_t local_port;
904165220Srrs	uint16_t number_local_addresses;
905165220Srrs	uint32_t number_associations;
906165220Srrs	uint32_t flags;
907165220Srrs	uint32_t features;
908165220Srrs	uint32_t total_sends;
909165220Srrs	uint32_t total_recvs;
910165220Srrs	uint32_t total_nospaces;
911165220Srrs	/* add more endpoint specific data here */
912165220Srrs};
913164085Srrs
914165220Srrsstruct xsctp_tcb {
915166675Srrs	uint16_t LocalPort;	/* sctpAssocEntry 3   */
916166675Srrs	uint16_t RemPort;	/* sctpAssocEntry 4   */
917166675Srrs	union sctp_sockstore RemPrimAddr;	/* sctpAssocEntry 5/6 */
918166675Srrs	uint32_t HeartBeatInterval;	/* sctpAssocEntry 7   */
919166675Srrs	uint32_t State;		/* sctpAssocEntry 8   */
920166675Srrs	uint32_t InStreams;	/* sctpAssocEntry 9   */
921166675Srrs	uint32_t OutStreams;	/* sctpAssocEntry 10  */
922166675Srrs	uint32_t MaxRetr;	/* sctpAssocEntry 11  */
923166675Srrs	uint32_t PrimProcess;	/* sctpAssocEntry 12  */
924166675Srrs	uint32_t T1expireds;	/* sctpAssocEntry 13  */
925166675Srrs	uint32_t T2expireds;	/* sctpAssocEntry 14  */
926166675Srrs	uint32_t RtxChunks;	/* sctpAssocEntry 15  */
927166675Srrs	struct timeval StartTime;	/* sctpAssocEntry 16  */
928166675Srrs	struct timeval DiscontinuityTime;	/* sctpAssocEntry 17  */
929165220Srrs	uint32_t total_sends;
930165220Srrs	uint32_t total_recvs;
931165220Srrs	uint32_t local_tag;
932165220Srrs	uint32_t remote_tag;
933165220Srrs	uint32_t initial_tsn;
934165220Srrs	uint32_t highest_tsn;
935165220Srrs	uint32_t cumulative_tsn;
936165220Srrs	uint32_t cumulative_tsn_ack;
937165220Srrs	/* add more association specific data here */
938166675Srrs	uint16_t number_local_addresses;
939166675Srrs	uint16_t number_remote_addresses;
940165220Srrs};
941165220Srrs
942165220Srrsstruct xsctp_laddr {
943166675Srrs	union sctp_sockstore LocalAddr;	/* sctpAssocLocalAddrEntry 1/2 */
944166675Srrs	struct timeval LocalStartTime;	/* sctpAssocLocalAddrEntry 3   */
945165220Srrs	/* add more local address specific data */
946165220Srrs};
947165220Srrs
948165220Srrsstruct xsctp_raddr {
949166675Srrs	union sctp_sockstore RemAddr;	/* sctpAssocLocalRemEntry 1/2 */
950166675Srrs	uint8_t RemAddrActive;	/* sctpAssocLocalRemEntry 3   */
951166675Srrs	uint8_t RemAddrConfirmed;	/* */
952166675Srrs	uint8_t RemAddrHBActive;/* sctpAssocLocalRemEntry 4   */
953166675Srrs	uint32_t RemAddrRTO;	/* sctpAssocLocalRemEntry 5   */
954166675Srrs	uint32_t RemAddrMaxPathRtx;	/* sctpAssocLocalRemEntry 6   */
955166675Srrs	uint32_t RemAddrRtx;	/* sctpAssocLocalRemEntry 7   */
956166675Srrs	uint32_t RemAddrErrorCounter;	/* */
957166675Srrs	uint32_t RemAddrCwnd;	/* */
958166675Srrs	uint32_t RemAddrFlightSize;	/* */
959166675Srrs	struct timeval RemAddrStartTime;	/* sctpAssocLocalRemEntry 8   */
960165220Srrs	/* add more remote address specific data */
961165220Srrs};
962165220Srrs
963163953Srrs/*
964163953Srrs * Kernel defined for sctp_send
965163953Srrs */
966163953Srrs#if defined(_KERNEL)
967163953Srrsint
968163953Srrssctp_lower_sosend(struct socket *so,
969163953Srrs    struct sockaddr *addr,
970163953Srrs    struct uio *uio,
971163953Srrs    struct mbuf *top,
972163953Srrs    struct mbuf *control,
973163953Srrs    int flags,
974163953Srrs    int use_rcvinfo,
975163953Srrs    struct sctp_sndrcvinfo *srcv,
976163953Srrs    struct thread *p
977163953Srrs);
978163953Srrs
979163953Srrsint
980163953Srrssctp_sorecvmsg(struct socket *so,
981163953Srrs    struct uio *uio,
982163953Srrs    struct mbuf **mp,
983163953Srrs    struct sockaddr *from,
984163953Srrs    int fromlen,
985163953Srrs    int *msg_flags,
986163953Srrs    struct sctp_sndrcvinfo *sinfo,
987163953Srrs    int filling_sinfo);
988163953Srrs
989163953Srrs
990163953Srrs#endif
991163953Srrs
992163953Srrs/*
993163953Srrs * API system calls
994163953Srrs */
995163953Srrs#if !(defined(_KERNEL))
996163953Srrs
997163953Srrs__BEGIN_DECLS
998163953Srrsint sctp_peeloff __P((int, sctp_assoc_t));
999163953Srrsint sctp_bindx __P((int, struct sockaddr *, int, int));
1000167598Srrsint sctp_connectx __P((int, const struct sockaddr *, int, sctp_assoc_t *));
1001163953Srrsint sctp_getaddrlen __P((sa_family_t));
1002163953Srrsint sctp_getpaddrs __P((int, sctp_assoc_t, struct sockaddr **));
1003163953Srrsvoid sctp_freepaddrs __P((struct sockaddr *));
1004163953Srrsint sctp_getladdrs __P((int, sctp_assoc_t, struct sockaddr **));
1005163953Srrsvoid sctp_freeladdrs __P((struct sockaddr *));
1006163953Srrsint sctp_opt_info __P((int, sctp_assoc_t, int, void *, socklen_t *));
1007163953Srrs
1008163953Srrsssize_t sctp_sendmsg
1009163953Srrs__P((int, const void *, size_t,
1010163953Srrs    const struct sockaddr *,
1011163953Srrs    socklen_t, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t));
1012163953Srrs
1013163953Srrs	ssize_t sctp_send __P((int sd, const void *msg, size_t len,
1014163953Srrs              const struct sctp_sndrcvinfo *sinfo, int flags));
1015163953Srrs
1016163953Srrs	ssize_t
1017163953Srrs	sctp_sendx __P((int sd, const void *msg, size_t len,
1018163953Srrs               struct sockaddr *addrs, int addrcnt,
1019163953Srrs               struct sctp_sndrcvinfo *sinfo, int flags));
1020163953Srrs	ssize_t
1021163953Srrs	sctp_sendmsgx __P((int sd, const void *, size_t,
1022163953Srrs                  struct sockaddr *, int,
1023163953Srrs                  uint32_t, uint32_t, uint16_t, uint32_t, uint32_t));
1024163953Srrs
1025163953Srrssctp_assoc_t
1026163953Srrssctp_getassocid __P((int sd, struct sockaddr *sa));
1027163953Srrs
1028163953Srrs	ssize_t sctp_recvmsg __P((int, void *, size_t, struct sockaddr *,
1029163953Srrs                 socklen_t *, struct sctp_sndrcvinfo *, int *));
1030163953Srrs
1031163953Srrs__END_DECLS
1032163953Srrs
1033163953Srrs#endif				/* !_KERNEL */
1034163953Srrs#endif				/* !__sctp_uio_h__ */
1035