2 * Copyright (c) 2001-2006, Cisco Systems, Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
7 * a) Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
10 * b) Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in
12 * the documentation and/or other materials provided with the distribution.
14 * c) Neither the name of Cisco Systems, Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived
16 * from this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28 * THE POSSIBILITY OF SUCH DAMAGE.
31 /* $KAME: sctp_uio.h,v 1.11 2005/03/06 16:04:18 itojun Exp $ */
32 #include <sys/cdefs.h>
33 __FBSDID("$FreeBSD$");
35 #ifndef __sctp_uio_h__
36 #define __sctp_uio_h__
41 #if ! defined(_KERNEL)
44 #include <sys/types.h>
45 #include <sys/socket.h>
47 #include <netinet/in.h>
49 typedef uint32_t sctp_assoc_t;
51 /* On/Off setup for subscription to events */
52 struct sctp_event_subscribe {
53 uint8_t sctp_data_io_event;
54 uint8_t sctp_association_event;
55 uint8_t sctp_address_event;
56 uint8_t sctp_send_failure_event;
57 uint8_t sctp_peer_error_event;
58 uint8_t sctp_shutdown_event;
59 uint8_t sctp_partial_delivery_event;
60 uint8_t sctp_adaptation_layer_event;
61 uint8_t sctp_authentication_event;
62 uint8_t sctp_stream_reset_events;
65 /* ancillary data types */
66 #define SCTP_INIT 0x0001
67 #define SCTP_SNDRCV 0x0002
68 #define SCTP_EXTRCV 0x0003
70 * ancillary data structures
73 uint32_t sinit_num_ostreams;
74 uint32_t sinit_max_instreams;
75 uint16_t sinit_max_attempts;
76 uint16_t sinit_max_init_timeo;
79 /* We add 96 bytes to the size of sctp_sndrcvinfo.
80 * This makes the current structure 128 bytes long
81 * which is nicely 64 bit aligned but also has room
82 * for us to add more and keep ABI compatability.
83 * For example, already we have the sctp_extrcvinfo
84 * when enabled which is 48 bytes.
88 * The assoc up needs a verfid
89 * all sendrcvinfo's need a verfid for SENDING only.
93 #define SCTP_ALIGN_RESV_PAD 96
94 #define SCTP_ALIGN_RESV_PAD_SHORT 80
96 struct sctp_sndrcvinfo {
97 uint16_t sinfo_stream;
101 uint32_t sinfo_context;
102 uint32_t sinfo_timetolive;
104 uint32_t sinfo_cumtsn;
105 sctp_assoc_t sinfo_assoc_id;
106 uint8_t __reserve_pad[SCTP_ALIGN_RESV_PAD];
109 struct sctp_extrcvinfo {
110 uint16_t sinfo_stream;
112 uint16_t sinfo_flags;
114 uint32_t sinfo_context;
115 uint32_t sinfo_timetolive;
117 uint32_t sinfo_cumtsn;
118 sctp_assoc_t sinfo_assoc_id;
120 uint16_t next_stream;
121 uint32_t next_asocid;
122 uint32_t next_length;
124 uint8_t __reserve_pad[SCTP_ALIGN_RESV_PAD_SHORT];
127 #define SCTP_NO_NEXT_MSG 0x0000
128 #define SCTP_NEXT_MSG_AVAIL 0x0001
129 #define SCTP_NEXT_MSG_ISCOMPLETE 0x0002
130 #define SCTP_NEXT_MSG_IS_UNORDERED 0x0004
131 #define SCTP_NEXT_MSG_IS_NOTIFICATION 0x0008
133 struct sctp_snd_all_completes {
134 uint16_t sall_stream;
137 uint32_t sall_context;
138 uint32_t sall_num_sent;
139 uint32_t sall_num_failed;
142 /* Flags that go into the sinfo->sinfo_flags field */
143 #define SCTP_EOF 0x0100/* Start shutdown procedures */
144 #define SCTP_ABORT 0x0200/* Send an ABORT to peer */
145 #define SCTP_UNORDERED 0x0400/* Message is un-ordered */
146 #define SCTP_ADDR_OVER 0x0800/* Override the primary-address */
147 #define SCTP_SENDALL 0x1000/* Send this on all associations */
148 #define SCTP_EOR 0x2000/* end of message signal */
149 #define INVALID_SINFO_FLAG(x) (((x) & 0xffffff00 \
150 & ~(SCTP_EOF | SCTP_ABORT | SCTP_UNORDERED |\
151 SCTP_ADDR_OVER | SCTP_SENDALL | SCTP_EOR)) != 0)
152 /* for the endpoint */
154 /* The lower byte is an enumeration of PR-SCTP policies */
155 #define SCTP_PR_SCTP_TTL 0x0001/* Time based PR-SCTP */
156 #define SCTP_PR_SCTP_BUF 0x0002/* Buffer based PR-SCTP */
157 #define SCTP_PR_SCTP_RTX 0x0003/* Number of retransmissions based PR-SCTP */
159 #define PR_SCTP_POLICY(x) ((x) & 0xff)
160 #define PR_SCTP_ENABLED(x) (PR_SCTP_POLICY(x) != 0)
161 #define PR_SCTP_TTL_ENABLED(x) (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_TTL)
162 #define PR_SCTP_BUF_ENABLED(x) (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_BUF)
163 #define PR_SCTP_RTX_ENABLED(x) (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_RTX)
164 #define PR_SCTP_INVALID_POLICY(x) (PR_SCTP_POLICY(x) > SCTP_PR_SCTP_RTX)
166 struct sctp_pcbinfo {
169 uint32_t laddr_count;
170 uint32_t raddr_count;
172 uint32_t readq_count;
173 uint32_t free_chunks;
174 uint32_t stream_oque;
177 struct sctp_sockstat {
178 sctp_assoc_t ss_assoc_id;
179 uint32_t ss_total_sndbuf;
180 uint32_t ss_total_recv_buf;
184 * notification event structures
188 * association change event
190 struct sctp_assoc_change {
196 uint16_t sac_outbound_streams;
197 uint16_t sac_inbound_streams;
198 sctp_assoc_t sac_assoc_id;
201 /* sac_state values */
202 #define SCTP_COMM_UP 0x0001
203 #define SCTP_COMM_LOST 0x0002
204 #define SCTP_RESTART 0x0003
205 #define SCTP_SHUTDOWN_COMP 0x0004
206 #define SCTP_CANT_STR_ASSOC 0x0005
212 struct sctp_paddr_change {
216 struct sockaddr_storage spc_aaddr;
219 sctp_assoc_t spc_assoc_id;
222 /* paddr state values */
223 #define SCTP_ADDR_AVAILABLE 0x0001
224 #define SCTP_ADDR_UNREACHABLE 0x0002
225 #define SCTP_ADDR_REMOVED 0x0003
226 #define SCTP_ADDR_ADDED 0x0004
227 #define SCTP_ADDR_MADE_PRIM 0x0005
228 #define SCTP_ADDR_CONFIRMED 0x0006
231 * CAUTION: these are user exposed SCTP addr reachability states must be
232 * compatible with SCTP_ADDR states in sctp_constants.h
237 #define SCTP_ACTIVE 0x0001 /* SCTP_ADDR_REACHABLE */
242 #define SCTP_INACTIVE 0x0002 /* SCTP_ADDR_NOT_REACHABLE */
244 #ifdef SCTP_UNCONFIRMED
245 #undef SCTP_UNCONFIRMED
247 #define SCTP_UNCONFIRMED 0x0200 /* SCTP_ADDR_UNCONFIRMED */
249 #ifdef SCTP_NOHEARTBEAT
250 #undef SCTP_NOHEARTBEAT
252 #define SCTP_NOHEARTBEAT 0x0040 /* SCTP_ADDR_NOHB */
255 /* remote error events */
256 struct sctp_remote_error {
261 sctp_assoc_t sre_assoc_id;
265 /* data send failure event */
266 struct sctp_send_failed {
271 struct sctp_sndrcvinfo ssf_info;
272 sctp_assoc_t ssf_assoc_id;
276 /* flag that indicates state of data */
277 #define SCTP_DATA_UNSENT 0x0001 /* inqueue never on wire */
278 #define SCTP_DATA_SENT 0x0002 /* on wire at failure */
281 struct sctp_shutdown_event {
285 sctp_assoc_t sse_assoc_id;
288 /* Adaptation layer indication stuff */
289 struct sctp_adaptation_event {
293 uint32_t sai_adaptation_ind;
294 sctp_assoc_t sai_assoc_id;
297 struct sctp_setadaptation {
298 uint32_t ssb_adaptation_ind;
301 /* compatable old spelling */
302 struct sctp_adaption_event {
306 uint32_t sai_adaption_ind;
307 sctp_assoc_t sai_assoc_id;
310 struct sctp_setadaption {
311 uint32_t ssb_adaption_ind;
316 * Partial Delivery API event
318 struct sctp_pdapi_event {
320 uint16_t pdapi_flags;
321 uint32_t pdapi_length;
322 uint32_t pdapi_indication;
323 sctp_assoc_t pdapi_assoc_id;
326 /* indication values */
327 #define SCTP_PARTIAL_DELIVERY_ABORTED 0x0001
331 * authentication key event
333 struct sctp_authkey_event {
336 uint32_t auth_length;
337 uint16_t auth_keynumber;
338 uint16_t auth_altkeynumber;
339 uint32_t auth_indication;
340 sctp_assoc_t auth_assoc_id;
343 /* indication values */
344 #define SCTP_AUTH_NEWKEY 0x0001
350 struct sctp_stream_reset_event {
351 uint16_t strreset_type;
352 uint16_t strreset_flags;
353 uint32_t strreset_length;
354 sctp_assoc_t strreset_assoc_id;
355 uint16_t strreset_list[0];
358 /* flags in strreset_flags field */
359 #define SCTP_STRRESET_INBOUND_STR 0x0001
360 #define SCTP_STRRESET_OUTBOUND_STR 0x0002
361 #define SCTP_STRRESET_ALL_STREAMS 0x0004
362 #define SCTP_STRRESET_STREAM_LIST 0x0008
363 #define SCTP_STRRESET_FAILED 0x0010
366 /* SCTP notification event */
373 union sctp_notification {
374 struct sctp_tlv sn_header;
375 struct sctp_assoc_change sn_assoc_change;
376 struct sctp_paddr_change sn_paddr_change;
377 struct sctp_remote_error sn_remote_error;
378 struct sctp_send_failed sn_send_failed;
379 struct sctp_shutdown_event sn_shutdown_event;
380 struct sctp_adaptation_event sn_adaptation_event;
381 /* compatability same as above */
382 struct sctp_adaption_event sn_adaption_event;
383 struct sctp_pdapi_event sn_pdapi_event;
384 struct sctp_authkey_event sn_auth_event;
385 struct sctp_stream_reset_event sn_strreset_event;
388 /* notification types */
389 #define SCTP_ASSOC_CHANGE 0x0001
390 #define SCTP_PEER_ADDR_CHANGE 0x0002
391 #define SCTP_REMOTE_ERROR 0x0003
392 #define SCTP_SEND_FAILED 0x0004
393 #define SCTP_SHUTDOWN_EVENT 0x0005
394 #define SCTP_ADAPTATION_INDICATION 0x0006
396 #define SCTP_ADAPTION_INDICATION 0x0006
397 #define SCTP_PARTIAL_DELIVERY_EVENT 0x0007
398 #define SCTP_AUTHENTICATION_EVENT 0x0008
399 #define SCTP_STREAM_RESET_EVENT 0x0009
403 * socket option structs
406 struct sctp_paddrparams {
407 sctp_assoc_t spp_assoc_id;
408 struct sockaddr_storage spp_address;
409 uint32_t spp_hbinterval;
410 uint16_t spp_pathmaxrxt;
411 uint32_t spp_pathmtu;
412 uint32_t spp_sackdelay;
414 uint32_t spp_ipv6_flowlabel;
415 uint8_t spp_ipv4_tos;
419 #define SPP_HB_ENABLE 0x00000001
420 #define SPP_HB_DISABLE 0x00000002
421 #define SPP_HB_DEMAND 0x00000004
422 #define SPP_PMTUD_ENABLE 0x00000008
423 #define SPP_PMTUD_DISABLE 0x00000010
424 #define SPP_SACKDELAY_ENABLE 0x00000020
425 #define SPP_SACKDELAY_DISABLE 0x00000040
426 #define SPP_HB_TIME_IS_ZERO 0x00000080
427 #define SPP_IPV6_FLOWLABEL 0x00000100
428 #define SPP_IPV4_TOS 0x00000200
430 struct sctp_paddrinfo {
431 sctp_assoc_t spinfo_assoc_id;
432 struct sockaddr_storage spinfo_address;
433 int32_t spinfo_state;
434 uint32_t spinfo_cwnd;
435 uint32_t spinfo_srtt;
440 struct sctp_rtoinfo {
441 sctp_assoc_t srto_assoc_id;
442 uint32_t srto_initial;
447 struct sctp_assocparams {
448 sctp_assoc_t sasoc_assoc_id;
449 uint16_t sasoc_asocmaxrxt;
450 uint16_t sasoc_number_peer_destinations;
451 uint32_t sasoc_peer_rwnd;
452 uint32_t sasoc_local_rwnd;
453 uint32_t sasoc_cookie_life;
456 struct sctp_setprim {
457 sctp_assoc_t ssp_assoc_id;
458 struct sockaddr_storage ssp_addr;
461 struct sctp_setpeerprim {
462 sctp_assoc_t sspp_assoc_id;
463 struct sockaddr_storage sspp_addr;
466 struct sctp_getaddresses {
467 sctp_assoc_t sget_assoc_id;
468 /* addr is filled in for N * sockaddr_storage */
469 struct sockaddr addr[1];
472 struct sctp_setstrm_timeout {
473 sctp_assoc_t ssto_assoc_id;
474 uint32_t ssto_timeout;
475 uint32_t ssto_streamid_start;
476 uint32_t ssto_streamid_end;
480 sctp_assoc_t sstat_assoc_id;
483 uint16_t sstat_unackdata;
484 uint16_t sstat_penddata;
485 uint16_t sstat_instrms;
486 uint16_t sstat_outstrms;
487 uint32_t sstat_fragmentation_point;
488 struct sctp_paddrinfo sstat_primary;
492 * AUTHENTICATION support
494 /* SCTP_AUTH_CHUNK */
495 struct sctp_authchunk {
500 struct sctp_authkey {
501 sctp_assoc_t sca_assoc_id;
502 uint16_t sca_keynumber;
506 /* SCTP_HMAC_IDENT */
507 struct sctp_hmacalgo {
508 uint16_t shmac_idents[0];
512 #define SCTP_AUTH_HMAC_ID_RSVD 0x0000
513 #define SCTP_AUTH_HMAC_ID_SHA1 0x0001 /* default, mandatory */
514 #define SCTP_AUTH_HMAC_ID_MD5 0x0002 /* deprecated */
515 #define SCTP_AUTH_HMAC_ID_SHA256 0x0003
516 #define SCTP_AUTH_HMAC_ID_SHA224 0x8001
517 #define SCTP_AUTH_HMAC_ID_SHA384 0x8002
518 #define SCTP_AUTH_HMAC_ID_SHA512 0x8003
521 /* SCTP_AUTH_ACTIVE_KEY / SCTP_AUTH_DELETE_KEY */
522 struct sctp_authkeyid {
523 sctp_assoc_t scact_assoc_id;
524 uint16_t scact_keynumber;
527 /* SCTP_PEER_AUTH_CHUNKS / SCTP_LOCAL_AUTH_CHUNKS */
528 struct sctp_authchunks {
529 sctp_assoc_t gauth_assoc_id;
530 uint8_t gauth_chunks[0];
533 struct sctp_assoc_value {
534 sctp_assoc_t assoc_id;
535 uint32_t assoc_value;
538 #define MAX_ASOC_IDS_RET 255
539 struct sctp_assoc_ids {
540 uint16_t asls_assoc_start; /* array of index's start at 0 */
541 uint8_t asls_numb_present;
542 uint8_t asls_more_to_get;
543 sctp_assoc_t asls_assoc_id[MAX_ASOC_IDS_RET];
546 struct sctp_cwnd_args {
547 struct sctp_nets *net; /* network to */
548 uint32_t cwnd_new_value;/* cwnd in k */
549 uint32_t inflight; /* flightsize in k */
550 uint32_t pseudo_cumack;
551 int cwnd_augment; /* increment to it */
552 uint8_t meets_pseudo_cumack;
553 uint8_t need_new_pseudo_cumack;
558 struct sctp_blk_args {
559 uint32_t onsb; /* in 1k bytes */
560 uint32_t sndlen; /* len of send being attempted */
561 uint32_t peer_rwnd; /* rwnd of peer */
562 uint16_t send_sent_qcnt;/* chnk cnt */
563 uint16_t stream_qcnt; /* chnk cnt */
564 uint16_t chunks_on_oque;/* chunks out */
565 uint16_t flight_size; /* flight size in k */
569 * Max we can reset in one setting, note this is dictated not by the define
570 * but the size of a mbuf cluster so don't change this define and think you
571 * can specify more. You must do multiple resets if you want to reset more
572 * than SCTP_MAX_EXPLICIT_STR_RESET.
574 #define SCTP_MAX_EXPLICT_STR_RESET 1000
576 #define SCTP_RESET_LOCAL_RECV 0x0001
577 #define SCTP_RESET_LOCAL_SEND 0x0002
578 #define SCTP_RESET_BOTH 0x0003
579 #define SCTP_RESET_TSN 0x0004
581 struct sctp_stream_reset {
582 sctp_assoc_t strrst_assoc_id;
583 uint16_t strrst_flags;
584 uint16_t strrst_num_streams; /* 0 == ALL */
585 uint16_t strrst_list[0];/* list if strrst_num_streams is not 0 */
589 struct sctp_get_nonce_values {
590 sctp_assoc_t gn_assoc_id;
591 uint32_t gn_peers_tag;
592 uint32_t gn_local_tag;
596 struct sctp_str_log {
613 uint32_t largest_tsn;
614 uint32_t largest_new_tsn;
624 struct sctp_rwnd_log {
631 struct sctp_mbcnt_log {
632 uint32_t total_queue_size;
633 uint32_t size_change;
634 uint32_t total_queue_mb_size;
635 uint32_t mbcnt_change;
638 struct sctp_sack_log {
646 struct sctp_lock_log {
653 uint8_t sockrcvbuf_lock;
654 uint8_t socksndbuf_lock;
659 struct sctp_rto_log {
666 struct sctp_nagle_log {
668 uint32_t total_flight;
669 uint32_t total_in_queue;
670 uint16_t count_in_queue;
671 uint16_t count_in_flight;
674 struct sctp_sbwake_log {
680 uint8_t stream_qcnt; /* chnk cnt */
681 uint8_t chunks_on_oque; /* chunks out */
686 struct sctp_misc_info {
693 struct sctp_log_closing {
701 struct sctp_mbuf_log {
710 struct sctp_cwnd_log {
716 struct sctp_log_closing close;
717 struct sctp_blk_args blk;
718 struct sctp_cwnd_args cwnd;
719 struct sctp_str_log strlog;
720 struct sctp_fr_log fr;
721 struct sctp_fr_map map;
722 struct sctp_rwnd_log rwnd;
723 struct sctp_mbcnt_log mbcnt;
724 struct sctp_sack_log sack;
725 struct sctp_lock_log lock;
726 struct sctp_rto_log rto;
727 struct sctp_sb_log sb;
728 struct sctp_nagle_log nagle;
729 struct sctp_sbwake_log wake;
730 struct sctp_mbuf_log mb;
731 struct sctp_misc_info misc;
735 struct sctp_cwnd_log_req {
736 int num_in_log; /* Number in log */
737 int num_ret; /* Number returned */
738 int start_at; /* start at this one */
739 int end_at; /* end at this one */
740 struct sctp_cwnd_log log[0];
744 /* MIB according to RFC 3873 */
745 u_long sctps_currestab; /* sctpStats 1 (Gauge32) */
746 u_long sctps_activeestab; /* sctpStats 2 (Counter32) */
747 u_long sctps_restartestab;
748 u_long sctps_collisionestab;
749 u_long sctps_passiveestab; /* sctpStats 3 (Counter32) */
750 u_long sctps_aborted; /* sctpStats 4 (Counter32) */
751 u_long sctps_shutdown; /* sctpStats 5 (Counter32) */
752 u_long sctps_outoftheblue; /* sctpStats 6 (Counter32) */
753 u_long sctps_checksumerrors; /* sctpStats 7 (Counter32) */
754 u_long sctps_outcontrolchunks; /* sctpStats 8 (Counter64) */
755 u_long sctps_outorderchunks; /* sctpStats 9 (Counter64) */
756 u_long sctps_outunorderchunks; /* sctpStats 10 (Counter64) */
757 u_long sctps_incontrolchunks; /* sctpStats 11 (Counter64) */
758 u_long sctps_inorderchunks; /* sctpStats 12 (Counter64) */
759 u_long sctps_inunorderchunks; /* sctpStats 13 (Counter64) */
760 u_long sctps_fragusrmsgs; /* sctpStats 14 (Counter64) */
761 u_long sctps_reasmusrmsgs; /* sctpStats 15 (Counter64) */
762 u_long sctps_outpackets;/* sctpStats 16 (Counter64) */
763 u_long sctps_inpackets; /* sctpStats 17 (Counter64) */
764 struct timeval sctps_discontinuitytime; /* sctpStats 18 (TimeStamp) */
765 /* input statistics: */
766 u_long sctps_recvpackets; /* total input packets */
767 u_long sctps_recvdatagrams; /* total input datagrams */
768 u_long sctps_recvpktwithdata;
769 u_long sctps_recvsacks; /* total input SACK chunks */
770 u_long sctps_recvdata; /* total input DATA chunks */
771 u_long sctps_recvdupdata; /* total input duplicate DATA chunks */
772 u_long sctps_recvheartbeat; /* total input HB chunks */
773 u_long sctps_recvheartbeatack; /* total input HB-ACK chunks */
774 u_long sctps_recvecne; /* total input ECNE chunks */
775 u_long sctps_recvauth; /* total input AUTH chunks */
776 u_long sctps_recvauthmissing; /* total input chunks missing AUTH */
777 u_long sctps_recvivalhmacid; /* total number of invalid HMAC ids
779 u_long sctps_recvivalkeyid; /* total number of invalid secret ids
781 u_long sctps_recvauthfailed; /* total number of auth failed */
782 u_long sctps_recvexpress; /* total fast path receives all one
784 u_long sctps_recvexpressm; /* total fast path multi-part data */
785 /* output statistics: */
786 u_long sctps_sendpackets; /* total output packets */
787 u_long sctps_sendsacks; /* total output SACKs */
788 u_long sctps_senddata; /* total output DATA chunks */
789 u_long sctps_sendretransdata; /* total output retransmitted DATA
791 u_long sctps_sendfastretrans; /* total output fast retransmitted
793 u_long sctps_sendmultfastretrans; /* U-del */
794 u_long sctps_sendheartbeat; /* total output HB chunks */
795 u_long sctps_sendecne; /* total output ECNE chunks */
796 u_long sctps_sendauth; /* total output AUTH chunks FIXME */
797 u_long sctps_senderrors;/* ip_output error counter */
798 /* PCKDROPREP statistics: */
799 u_long sctps_pdrpfmbox; /* */
800 u_long sctps_pdrpfehos; /* */
801 u_long sctps_pdrpmbda; /* */
802 u_long sctps_pdrpmbct; /* */
803 u_long sctps_pdrpbwrpt; /* */
804 u_long sctps_pdrpcrupt; /* */
805 u_long sctps_pdrpnedat; /* */
806 u_long sctps_pdrppdbrk; /* */
807 u_long sctps_pdrptsnnf; /* */
808 u_long sctps_pdrpdnfnd; /* */
809 u_long sctps_pdrpdiwnp; /* */
810 u_long sctps_pdrpdizrw; /* */
811 u_long sctps_pdrpbadd; /* */
812 u_long sctps_pdrpmark; /* */
814 u_long sctps_timoiterator; /* */
815 u_long sctps_timodata; /* */
816 u_long sctps_timowindowprobe; /* */
817 u_long sctps_timoinit; /* */
818 u_long sctps_timosack; /* */
819 u_long sctps_timoshutdown; /* */
820 u_long sctps_timoheartbeat; /* */
821 u_long sctps_timocookie;/* */
822 u_long sctps_timosecret;/* */
823 u_long sctps_timopathmtu; /* */
824 u_long sctps_timoshutdownack; /* */
825 u_long sctps_timoshutdownguard; /* */
826 u_long sctps_timostrmrst; /* */
827 u_long sctps_timoearlyfr; /* */
828 u_long sctps_timoasconf;/* */
829 u_long sctps_timoautoclose; /* */
830 u_long sctps_timoassockill; /* */
831 u_long sctps_timoinpkill; /* */
832 /* Early fast retransmission counters */
833 u_long sctps_earlyfrstart;
834 u_long sctps_earlyfrstop;
835 u_long sctps_earlyfrmrkretrans;
836 u_long sctps_earlyfrstpout;
837 u_long sctps_earlyfrstpidsck1;
838 u_long sctps_earlyfrstpidsck2;
839 u_long sctps_earlyfrstpidsck3;
840 u_long sctps_earlyfrstpidsck4;
841 u_long sctps_earlyfrstrid;
842 u_long sctps_earlyfrstrout;
843 u_long sctps_earlyfrstrtmr;
845 u_long sctps_hdrops; /* packet shorter than header */
846 u_long sctps_badsum; /* checksum error */
847 u_long sctps_noport; /* no endpoint for port */
848 u_long sctps_badvtag; /* bad v-tag */
849 u_long sctps_badsid; /* bad SID */
850 u_long sctps_nomem; /* no memory */
851 u_long sctps_fastretransinrtt; /* number of multiple FR in a RTT
853 u_long sctps_markedretrans;
854 u_long sctps_naglesent; /* nagle allowed sending */
855 u_long sctps_naglequeued; /* nagle does't allow sending */
856 u_long sctps_maxburstqueued; /* max burst dosn't allow sending */
857 u_long sctps_ifnomemqueued; /* */
858 u_long sctps_windowprobed; /* total number of window probes sent */
859 u_long sctps_lowlevelerr;
860 u_long sctps_lowlevelerrusr;
861 u_long sctps_datadropchklmt;
862 u_long sctps_datadroprwnd;
863 u_long sctps_ecnereducedcwnd;
864 u_long sctps_vtagexpress; /* Used express lookup via vtag */
865 u_long sctps_vtagbogus; /* Collision in express lookup. */
866 u_long sctps_primary_randry; /* Number of times the sender ran dry
867 * of user data on primary */
868 u_long sctps_cmt_randry;/* Same for above */
869 u_long sctps_slowpath_sack; /* Sacks the slow way */
870 u_long sctps_wu_sacks_sent; /* Window Update only sacks sent */
871 u_long sctps_sends_with_flags; /* number of sends with sinfo_flags
873 u_long sctps_sends_with_unord;
874 u_long sctps_sends_with_eof;
875 u_long sctps_sends_with_abort;
876 u_long sctps_protocol_drain_calls;
877 u_long sctps_protocol_drains_done;
880 #define SCTP_STAT_INCR(_x) SCTP_STAT_INCR_BY(_x,1)
881 #define SCTP_STAT_DECR(_x) SCTP_STAT_DECR_BY(_x,1)
882 #define SCTP_STAT_INCR_BY(_x,_d) atomic_add_long(&sctpstat._x, _d)
883 #define SCTP_STAT_DECR_BY(_x,_d) atomic_add_long(&sctpstat._x, -(_d))
884 /* The following macros are for handling MIB values, */
885 #define SCTP_STAT_INCR_COUNTER32(_x) SCTP_STAT_INCR(_x)
886 #define SCTP_STAT_INCR_COUNTER64(_x) SCTP_STAT_INCR(_x)
887 #define SCTP_STAT_INCR_GAUGE32(_x) SCTP_STAT_INCR(_x)
888 #define SCTP_STAT_DECR_COUNTER32(_x) SCTP_STAT_DECR(_x)
889 #define SCTP_STAT_DECR_COUNTER64(_x) SCTP_STAT_DECR(_x)
890 #define SCTP_STAT_DECR_GAUGE32(_x) SCTP_STAT_DECR(_x)
892 union sctp_sockstore {
894 struct sockaddr_in sin;
897 struct sockaddr_in6 sin6;
905 uint16_t number_local_addresses;
906 uint32_t number_associations;
909 uint32_t total_sends;
910 uint32_t total_recvs;
911 uint32_t total_nospaces;
912 /* add more endpoint specific data here */
916 uint16_t LocalPort; /* sctpAssocEntry 3 */
917 uint16_t RemPort; /* sctpAssocEntry 4 */
918 union sctp_sockstore RemPrimAddr; /* sctpAssocEntry 5/6 */
919 uint32_t HeartBeatInterval; /* sctpAssocEntry 7 */
920 uint32_t State; /* sctpAssocEntry 8 */
921 uint32_t InStreams; /* sctpAssocEntry 9 */
922 uint32_t OutStreams; /* sctpAssocEntry 10 */
923 uint32_t MaxRetr; /* sctpAssocEntry 11 */
924 uint32_t PrimProcess; /* sctpAssocEntry 12 */
925 uint32_t T1expireds; /* sctpAssocEntry 13 */
926 uint32_t T2expireds; /* sctpAssocEntry 14 */
927 uint32_t RtxChunks; /* sctpAssocEntry 15 */
928 struct timeval StartTime; /* sctpAssocEntry 16 */
929 struct timeval DiscontinuityTime; /* sctpAssocEntry 17 */
930 uint32_t total_sends;
931 uint32_t total_recvs;
934 uint32_t initial_tsn;
935 uint32_t highest_tsn;
936 uint32_t cumulative_tsn;
937 uint32_t cumulative_tsn_ack;
938 /* add more association specific data here */
939 uint16_t number_local_addresses;
940 uint16_t number_remote_addresses;
944 union sctp_sockstore LocalAddr; /* sctpAssocLocalAddrEntry 1/2 */
945 struct timeval LocalStartTime; /* sctpAssocLocalAddrEntry 3 */
946 /* add more local address specific data */
950 union sctp_sockstore RemAddr; /* sctpAssocLocalRemEntry 1/2 */
951 uint8_t RemAddrActive; /* sctpAssocLocalRemEntry 3 */
952 uint8_t RemAddrConfirmed; /* */
953 uint8_t RemAddrHBActive;/* sctpAssocLocalRemEntry 4 */
954 uint32_t RemAddrRTO; /* sctpAssocLocalRemEntry 5 */
955 uint32_t RemAddrMaxPathRtx; /* sctpAssocLocalRemEntry 6 */
956 uint32_t RemAddrRtx; /* sctpAssocLocalRemEntry 7 */
957 uint32_t RemAddrErrorCounter; /* */
958 uint32_t RemAddrCwnd; /* */
959 uint32_t RemAddrFlightSize; /* */
960 struct timeval RemAddrStartTime; /* sctpAssocLocalRemEntry 8 */
961 /* add more remote address specific data */
965 * Kernel defined for sctp_send
969 sctp_lower_sosend(struct socket *so,
970 struct sockaddr *addr,
973 struct mbuf *control,
976 struct sctp_sndrcvinfo *srcv,
981 sctp_sorecvmsg(struct socket *so,
984 struct sockaddr *from,
987 struct sctp_sndrcvinfo *sinfo,
997 #if !(defined(_KERNEL))
1000 int sctp_peeloff __P((int, sctp_assoc_t));
1001 int sctp_bindx __P((int, struct sockaddr *, int, int));
1002 int sctp_connectx __P((int, const struct sockaddr *, int));
1003 int sctp_getaddrlen __P((sa_family_t));
1004 int sctp_getpaddrs __P((int, sctp_assoc_t, struct sockaddr **));
1005 void sctp_freepaddrs __P((struct sockaddr *));
1006 int sctp_getladdrs __P((int, sctp_assoc_t, struct sockaddr **));
1007 void sctp_freeladdrs __P((struct sockaddr *));
1008 int sctp_opt_info __P((int, sctp_assoc_t, int, void *, socklen_t *));
1010 ssize_t sctp_sendmsg
1011 __P((int, const void *, size_t,
1012 const struct sockaddr *,
1013 socklen_t, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t));
1015 ssize_t sctp_send __P((int sd, const void *msg, size_t len,
1016 const struct sctp_sndrcvinfo *sinfo, int flags));
1019 sctp_sendx __P((int sd, const void *msg, size_t len,
1020 struct sockaddr *addrs, int addrcnt,
1021 struct sctp_sndrcvinfo *sinfo, int flags));
1023 sctp_sendmsgx __P((int sd, const void *, size_t,
1024 struct sockaddr *, int,
1025 uint32_t, uint32_t, uint16_t, uint32_t, uint32_t));
1028 sctp_getassocid __P((int sd, struct sockaddr *sa));
1030 ssize_t sctp_recvmsg __P((int, void *, size_t, struct sockaddr *,
1031 socklen_t *, struct sctp_sndrcvinfo *, int *));
1035 #endif /* !_KERNEL */
1036 #endif /* !__sctp_uio_h__ */