1 /* $KAME: sctp_uio.h,v 1.10 2004/08/17 04:06:20 itojun Exp $ */
2 /* $DragonFly: src/sys/netinet/sctp_uio.h,v 1.3 2006/05/20 02:42:12 dillon Exp $ */
4 #ifndef _NETINET_SCTP_UIO_H_
5 #define _NETINET_SCTP_UIO_H_
8 * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. All advertising materials mentioning features or use of this software
20 * must display the following acknowledgement:
21 * This product includes software developed by Cisco Systems, Inc.
22 * 4. Neither the name of the project nor the names of its contributors
23 * may be used to endorse or promote products derived from this software
24 * without specific prior written permission.
26 * THIS SOFTWARE IS PROVIDED BY CISCO SYSTEMS AND CONTRIBUTORS ``AS IS'' AND
27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL CISCO SYSTEMS OR CONTRIBUTORS BE LIABLE
30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 #include <sys/types.h>
40 #include <sys/socket.h>
42 typedef caddr_t sctp_assoc_t
;
44 /* On/Off setup for subscription to events */
45 struct sctp_event_subscribe
{
46 u_int8_t sctp_data_io_event
;
47 u_int8_t sctp_association_event
;
48 u_int8_t sctp_address_event
;
49 u_int8_t sctp_send_failure_event
;
50 u_int8_t sctp_peer_error_event
;
51 u_int8_t sctp_shutdown_event
;
52 u_int8_t sctp_partial_delivery_event
;
53 u_int8_t sctp_adaption_layer_event
;
54 u_int8_t sctp_stream_reset_events
;
57 /* ancillary data types */
58 #define SCTP_INIT 0x0001
59 #define SCTP_SNDRCV 0x0002
62 * ancillary data structures
65 u_int32_t sinit_num_ostreams
;
66 u_int32_t sinit_max_instreams
;
67 u_int16_t sinit_max_attempts
;
68 u_int16_t sinit_max_init_timeo
;
71 struct sctp_sndrcvinfo
{
72 u_int16_t sinfo_stream
;
74 u_int16_t sinfo_flags
;
76 u_int32_t sinfo_context
;
77 u_int32_t sinfo_timetolive
;
79 u_int32_t sinfo_cumtsn
;
80 sctp_assoc_t sinfo_assoc_id
;
83 struct sctp_snd_all_completes
{
84 u_int16_t sall_stream
;
87 u_int32_t sall_context
;
88 u_int32_t sall_num_sent
;
89 u_int32_t sall_num_failed
;
93 /* MSG_EOF (0x0100) is reused from sys/socket.h */
94 #define MSG_SENDALL 0x0200
95 #define MSG_PR_SCTP_TTL 0x0400 /* Partial Reliable on this msg */
96 #define MSG_PR_SCTP_BUF 0x0800 /* Buffer based PR-SCTP */
98 #define MSG_EOF 0x1000 /* Start shutdown procedures */
100 #define MSG_UNORDERED 0x2000 /* Message is un-ordered */
101 #define MSG_ADDR_OVER 0x4000 /* Override the primary-address */
102 #define MSG_ABORT 0x8000 /* Send an ABORT to peer */
105 struct sctp_pcbinfo
{
107 u_int32_t asoc_count
;
108 u_int32_t laddr_count
;
109 u_int32_t raddr_count
;
111 u_int32_t sockq_count
;
112 u_int32_t mbuf_track
;
115 struct sctp_sockstat
{
116 sctp_assoc_t ss_assoc_id
;
117 u_int32_t ss_total_sndbuf
;
118 u_int32_t ss_total_mbuf_sndbuf
;
119 u_int32_t ss_total_recv_buf
;
123 * notification event structures
127 /* association change events */
129 struct sctp_assoc_change
{
132 u_int32_t sac_length
;
135 u_int16_t sac_outbound_streams
;
136 u_int16_t sac_inbound_streams
;
137 sctp_assoc_t sac_assoc_id
;
139 /* sac_state values */
141 #define SCTP_COMM_UP 0x0001
142 #define SCTP_COMM_LOST 0x0002
143 #define SCTP_RESTART 0x0003
144 #define SCTP_SHUTDOWN_COMP 0x0004
145 #define SCTP_CANT_STR_ASSOC 0x0005
149 struct sctp_paddr_change
{
152 u_int32_t spc_length
;
153 struct sockaddr_storage spc_aaddr
;
156 sctp_assoc_t spc_assoc_id
;
158 /* paddr state values */
159 #define SCTP_ADDR_AVAILABLE 0x0001
160 #define SCTP_ADDR_UNREACHABLE 0x0002
161 #define SCTP_ADDR_REMOVED 0x0003
162 #define SCTP_ADDR_ADDED 0x0004
163 #define SCTP_ADDR_MADE_PRIM 0x0005
164 #define SCTP_ADDR_CONFIRMED 0x0006
167 * CAUTION: these are user exposed SCTP addr reachability states
168 * must be compatible with SCTP_ADDR states in sctp_constants.h
173 #define SCTP_ACTIVE 0x0001 /* SCTP_ADDR_REACHABLE */
178 #define SCTP_INACTIVE 0x0002 /* SCTP_ADDR_NOT_REACHABLE */
181 #ifdef SCTP_UNCONFIRMED
182 #undef SCTP_UNCONFIRMED
184 #define SCTP_UNCONFIRMED 0x0200 /* SCTP_ADDR_UNCONFIRMED */
186 #ifdef SCTP_NOHEARTBEAT
187 #undef SCTP_NOHEARTBEAT
189 #define SCTP_NOHEARTBEAT 0x0040 /* SCTP_ADDR_NOHB */
194 /* remote error events */
195 struct sctp_remote_error
{
198 u_int32_t sre_length
;
200 sctp_assoc_t sre_assoc_id
;
201 u_int8_t sre_data
[4];
204 /* data send failure event */
205 struct sctp_send_failed
{
208 u_int32_t ssf_length
;
210 struct sctp_sndrcvinfo ssf_info
;
211 sctp_assoc_t ssf_assoc_id
;
212 u_int8_t ssf_data
[4];
215 /* flag that indicates state of data */
216 #define SCTP_DATA_UNSENT 0x0001 /* inqueue never on wire */
217 #define SCTP_DATA_SENT 0x0002 /* on wire at failure */
220 struct sctp_shutdown_event
{
223 u_int32_t sse_length
;
224 sctp_assoc_t sse_assoc_id
;
227 /* Adaption layer indication stuff */
228 struct sctp_adaption_event
{
231 u_int32_t sai_length
;
232 u_int32_t sai_adaption_ind
;
233 sctp_assoc_t sai_assoc_id
;
236 struct sctp_setadaption
{
237 u_int32_t ssb_adaption_ind
;
240 /* pdapi indications */
241 struct sctp_pdapi_event
{
242 u_int16_t pdapi_type
;
243 u_int16_t pdapi_flags
;
244 u_int32_t pdapi_length
;
245 u_int32_t pdapi_indication
;
246 sctp_assoc_t pdapi_assoc_id
;
250 #define SCTP_PARTIAL_DELIVERY_ABORTED 0x0001
252 /* stream reset stuff */
254 struct sctp_stream_reset_event
{
255 u_int16_t strreset_type
;
256 u_int16_t strreset_flags
;
257 u_int32_t strreset_length
;
258 sctp_assoc_t strreset_assoc_id
;
259 u_int16_t strreset_list
[0];
262 /* flags in strreset_flags filed */
263 #define SCTP_STRRESET_INBOUND_STR 0x0001
264 #define SCTP_STRRESET_OUTBOUND_STR 0x0002
265 #define SCTP_STRRESET_ALL_STREAMS 0x0004
266 #define SCTP_STRRESET_STREAM_LIST 0x0008
268 #define MAX_ASOC_IDS_RET 255
270 struct sctp_assoc_ids
{
271 u_int16_t asls_assoc_start
; /* array of index's start at 0 */
272 u_int8_t asls_numb_present
;
273 u_int8_t asls_more_to_get
;
274 sctp_assoc_t asls_assoc_id
[MAX_ASOC_IDS_RET
];
277 /* notification types */
278 #define SCTP_ASSOC_CHANGE 0x0001
279 #define SCTP_PEER_ADDR_CHANGE 0x0002
280 #define SCTP_REMOTE_ERROR 0x0003
281 #define SCTP_SEND_FAILED 0x0004
282 #define SCTP_SHUTDOWN_EVENT 0x0005
283 #define SCTP_ADAPTION_INDICATION 0x0006
284 #define SCTP_PARTIAL_DELIVERY_EVENT 0x0007
285 #define SCTP_STREAM_RESET_EVENT 0x0008
296 /* notification event */
297 union sctp_notification
{
298 struct sctp_tlv sn_header
;
299 struct sctp_assoc_change sn_assoc_change
;
300 struct sctp_paddr_change sn_paddr_change
;
301 struct sctp_remote_error sn_remote_error
;
302 struct sctp_send_failed sn_send_failed
;
303 struct sctp_shutdown_event sn_shutdown_event
;
304 struct sctp_adaption_event sn_adaption_event
;
305 struct sctp_pdapi_event sn_pdapi_event
;
306 struct sctp_stream_reset_event sn_strreset_event
;
310 * socket option structs
312 #define SCTP_ISSUE_HB 0xffffffff /* get a on-demand hb */
313 #define SCTP_NO_HB 0x0 /* turn off hb's */
315 struct sctp_paddrparams
{
316 sctp_assoc_t spp_assoc_id
;
317 struct sockaddr_storage spp_address
;
318 u_int32_t spp_hbinterval
;
319 u_int16_t spp_pathmaxrxt
;
322 struct sctp_paddrinfo
{
323 sctp_assoc_t spinfo_assoc_id
;
324 struct sockaddr_storage spinfo_address
;
325 int32_t spinfo_state
;
326 u_int32_t spinfo_cwnd
;
327 u_int32_t spinfo_srtt
;
328 u_int32_t spinfo_rto
;
329 u_int32_t spinfo_mtu
;
332 struct sctp_rtoinfo
{
333 sctp_assoc_t srto_assoc_id
;
334 u_int32_t srto_initial
;
339 struct sctp_assocparams
{
340 sctp_assoc_t sasoc_assoc_id
;
341 u_int16_t sasoc_asocmaxrxt
;
342 u_int16_t sasoc_number_peer_destinations
;
343 u_int32_t sasoc_peer_rwnd
;
344 u_int32_t sasoc_local_rwnd
;
345 u_int32_t sasoc_cookie_life
;
348 struct sctp_setprim
{
349 sctp_assoc_t ssp_assoc_id
;
350 struct sockaddr_storage ssp_addr
;
353 struct sctp_setpeerprim
{
354 sctp_assoc_t sspp_assoc_id
;
355 struct sockaddr_storage sspp_addr
;
358 struct sctp_getaddresses
{
359 sctp_assoc_t sget_assoc_id
;
360 /* addr is filled in for N * sockaddr_storage */
361 struct sockaddr addr
[1];
364 struct sctp_setstrm_timeout
{
365 sctp_assoc_t ssto_assoc_id
;
366 u_int32_t ssto_timeout
;
367 u_int32_t ssto_streamid_start
;
368 u_int32_t ssto_streamid_end
;
372 sctp_assoc_t sstat_assoc_id
;
374 u_int32_t sstat_rwnd
;
375 u_int16_t sstat_unackdata
;
376 u_int16_t sstat_penddata
;
377 u_int16_t sstat_instrms
;
378 u_int16_t sstat_outstrms
;
379 u_int32_t sstat_fragmentation_point
;
380 struct sctp_paddrinfo sstat_primary
;
383 struct sctp_cwnd_args
{
384 struct sctp_nets
*net
; /* network to */
385 u_int32_t cwnd_new_value
; /* cwnd in k */
386 u_int32_t inflight
; /* flightsize in k */
387 int cwnd_augment
; /* increment to it */
390 struct sctp_blk_args
{
391 u_int32_t onmb
; /* in 1k bytes */
392 u_int32_t onsb
; /* in 1k bytes */
393 u_int16_t maxmb
; /* in 1k bytes */
394 u_int16_t maxsb
; /* in 1k bytes */
395 u_int16_t send_sent_qcnt
; /* chnk cnt */
396 u_int16_t stream_qcnt
; /* chnk cnt */
400 * Max we can reset in one setting, note this is dictated not by the
401 * define but the size of a mbuf cluster so don't change this define
402 * and think you can specify more. You must do multiple resets if you
403 * want to reset more than SCTP_MAX_EXPLICIT_STR_RESET.
405 #define SCTP_MAX_EXPLICT_STR_RESET 1000
407 #define SCTP_RESET_LOCAL_RECV 0x0001
408 #define SCTP_RESET_LOCAL_SEND 0x0002
409 #define SCTP_RESET_BOTH 0x0003
411 struct sctp_stream_reset
{
412 sctp_assoc_t strrst_assoc_id
;
413 u_int16_t strrst_flags
;
414 u_int16_t strrst_num_streams
; /* 0 == ALL */
415 u_int16_t strrst_list
[0]; /* list if strrst_num_streams is not 0*/
419 struct sctp_get_nonce_values
{
420 sctp_assoc_t gn_assoc_id
;
421 u_int32_t gn_peers_tag
;
422 u_int32_t gn_local_tag
;
434 u_int32_t largest_tsn
;
435 u_int32_t largest_new_tsn
;
445 struct sctp_rwnd_log
{
452 struct sctp_mbcnt_log
{
453 u_int32_t total_queue_size
;
454 u_int32_t size_change
;
455 u_int32_t total_queue_mb_size
;
456 u_int32_t mbcnt_change
;
459 struct sctp_cwnd_log
{
461 struct sctp_blk_args blk
;
462 struct sctp_cwnd_args cwnd
;
463 struct sctp_str_log strlog
;
464 struct sctp_fr_log fr
;
465 struct sctp_fr_map map
;
466 struct sctp_rwnd_log rwnd
;
467 struct sctp_mbcnt_log mbcnt
;
474 struct sctp_cwnd_log_req
{
475 int num_in_log
; /* Number in log */
476 int num_ret
; /* Number returned */
477 int start_at
; /* start at this one */
478 int end_at
; /* end at this one */
479 struct sctp_cwnd_log log
[0];
487 #if !(defined(_KERNEL) || (defined(__APPLE__) && defined(KERNEL)))
490 int sctp_peeloff (int, sctp_assoc_t
);
491 int sctp_bindx (int, struct sockaddr
*, int, int);
492 int sctp_connectx (int, struct sockaddr
*, int);
493 int sctp_getpaddrs (int, sctp_assoc_t
, struct sockaddr
**);
494 void sctp_freepaddrs (struct sockaddr
*);
495 int sctp_getladdrs (int, sctp_assoc_t
, struct sockaddr
**);
496 void sctp_freeladdrs (struct sockaddr
*);
497 int sctp_opt_info (int, sctp_assoc_t
, int, void *, size_t *);
499 ssize_t
sctp_sendmsg (int, const void *, size_t,
500 const struct sockaddr
*,
501 socklen_t
, u_int32_t
, u_int32_t
, u_int16_t
, u_int32_t
, u_int32_t
);
503 ssize_t
sctp_send (int sd
, const void *msg
, size_t len
,
504 const struct sctp_sndrcvinfo
*sinfo
,int flags
);
507 sctp_sendx(int sd
, const void *msg
, size_t len
,
508 struct sockaddr
*addrs
, int addrcnt
,
509 struct sctp_sndrcvinfo
*sinfo
, int flags
);
511 sctp_sendmsgx(int sd
, const void *, size_t,
512 struct sockaddr
*, int,
513 u_int32_t
, u_int32_t
, u_int16_t
, u_int32_t
, u_int32_t
);
516 sctp_getassocid(int sd
, struct sockaddr
*sa
);
518 ssize_t
sctp_recvmsg (int, void *, size_t, struct sockaddr
*,
519 socklen_t
*, struct sctp_sndrcvinfo
*, int *);
523 #endif /* !_KERNEL */
524 #endif /* _NETINET_SCTP_UIO_H_ */