2 * Copyright (c) 2001-2007, 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__
39 #if ! defined(_KERNEL)
42 #include <sys/types.h>
43 #include <sys/socket.h>
45 #include <netinet/in.h>
47 typedef uint32_t sctp_assoc_t;
49 /* On/Off setup for subscription to events */
50 struct sctp_event_subscribe {
51 uint8_t sctp_data_io_event;
52 uint8_t sctp_association_event;
53 uint8_t sctp_address_event;
54 uint8_t sctp_send_failure_event;
55 uint8_t sctp_peer_error_event;
56 uint8_t sctp_shutdown_event;
57 uint8_t sctp_partial_delivery_event;
58 uint8_t sctp_adaptation_layer_event;
59 uint8_t sctp_authentication_event;
60 uint8_t sctp_stream_reset_events;
63 /* ancillary data types */
64 #define SCTP_INIT 0x0001
65 #define SCTP_SNDRCV 0x0002
66 #define SCTP_EXTRCV 0x0003
68 * ancillary data structures
71 uint32_t sinit_num_ostreams;
72 uint32_t sinit_max_instreams;
73 uint16_t sinit_max_attempts;
74 uint16_t sinit_max_init_timeo;
77 /* We add 96 bytes to the size of sctp_sndrcvinfo.
78 * This makes the current structure 128 bytes long
79 * which is nicely 64 bit aligned but also has room
80 * for us to add more and keep ABI compatability.
81 * For example, already we have the sctp_extrcvinfo
82 * when enabled which is 48 bytes.
86 * The assoc up needs a verfid
87 * all sendrcvinfo's need a verfid for SENDING only.
91 #define SCTP_ALIGN_RESV_PAD 96
92 #define SCTP_ALIGN_RESV_PAD_SHORT 80
94 struct sctp_sndrcvinfo {
95 uint16_t sinfo_stream;
99 uint32_t sinfo_context;
100 uint32_t sinfo_timetolive;
102 uint32_t sinfo_cumtsn;
103 sctp_assoc_t sinfo_assoc_id;
104 uint8_t __reserve_pad[SCTP_ALIGN_RESV_PAD];
107 struct sctp_extrcvinfo {
108 uint16_t sinfo_stream;
110 uint16_t sinfo_flags;
112 uint32_t sinfo_context;
113 uint32_t sinfo_timetolive;
115 uint32_t sinfo_cumtsn;
116 sctp_assoc_t sinfo_assoc_id;
118 uint16_t next_stream;
119 uint32_t next_asocid;
120 uint32_t next_length;
122 uint8_t __reserve_pad[SCTP_ALIGN_RESV_PAD_SHORT];
125 #define SCTP_NO_NEXT_MSG 0x0000
126 #define SCTP_NEXT_MSG_AVAIL 0x0001
127 #define SCTP_NEXT_MSG_ISCOMPLETE 0x0002
128 #define SCTP_NEXT_MSG_IS_UNORDERED 0x0004
129 #define SCTP_NEXT_MSG_IS_NOTIFICATION 0x0008
131 struct sctp_snd_all_completes {
132 uint16_t sall_stream;
135 uint32_t sall_context;
136 uint32_t sall_num_sent;
137 uint32_t sall_num_failed;
140 /* Flags that go into the sinfo->sinfo_flags field */
141 #define SCTP_EOF 0x0100/* Start shutdown procedures */
142 #define SCTP_ABORT 0x0200/* Send an ABORT to peer */
143 #define SCTP_UNORDERED 0x0400/* Message is un-ordered */
144 #define SCTP_ADDR_OVER 0x0800/* Override the primary-address */
145 #define SCTP_SENDALL 0x1000/* Send this on all associations */
146 #define SCTP_EOR 0x2000/* end of message signal */
147 #define INVALID_SINFO_FLAG(x) (((x) & 0xffffff00 \
148 & ~(SCTP_EOF | SCTP_ABORT | SCTP_UNORDERED |\
149 SCTP_ADDR_OVER | SCTP_SENDALL | SCTP_EOR)) != 0)
150 /* for the endpoint */
152 /* The lower byte is an enumeration of PR-SCTP policies */
153 #define SCTP_PR_SCTP_TTL 0x0001/* Time based PR-SCTP */
154 #define SCTP_PR_SCTP_BUF 0x0002/* Buffer based PR-SCTP */
155 #define SCTP_PR_SCTP_RTX 0x0003/* Number of retransmissions based PR-SCTP */
157 #define PR_SCTP_POLICY(x) ((x) & 0xff)
158 #define PR_SCTP_ENABLED(x) (PR_SCTP_POLICY(x) != 0)
159 #define PR_SCTP_TTL_ENABLED(x) (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_TTL)
160 #define PR_SCTP_BUF_ENABLED(x) (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_BUF)
161 #define PR_SCTP_RTX_ENABLED(x) (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_RTX)
162 #define PR_SCTP_INVALID_POLICY(x) (PR_SCTP_POLICY(x) > SCTP_PR_SCTP_RTX)
164 struct sctp_pcbinfo {
167 uint32_t laddr_count;
168 uint32_t raddr_count;
170 uint32_t readq_count;
171 uint32_t free_chunks;
172 uint32_t stream_oque;
175 struct sctp_sockstat {
176 sctp_assoc_t ss_assoc_id;
177 uint32_t ss_total_sndbuf;
178 uint32_t ss_total_recv_buf;
182 * notification event structures
186 * association change event
188 struct sctp_assoc_change {
194 uint16_t sac_outbound_streams;
195 uint16_t sac_inbound_streams;
196 sctp_assoc_t sac_assoc_id;
199 /* sac_state values */
200 #define SCTP_COMM_UP 0x0001
201 #define SCTP_COMM_LOST 0x0002
202 #define SCTP_RESTART 0x0003
203 #define SCTP_SHUTDOWN_COMP 0x0004
204 #define SCTP_CANT_STR_ASSOC 0x0005
210 struct sctp_paddr_change {
214 struct sockaddr_storage spc_aaddr;
217 sctp_assoc_t spc_assoc_id;
220 /* paddr state values */
221 #define SCTP_ADDR_AVAILABLE 0x0001
222 #define SCTP_ADDR_UNREACHABLE 0x0002
223 #define SCTP_ADDR_REMOVED 0x0003
224 #define SCTP_ADDR_ADDED 0x0004
225 #define SCTP_ADDR_MADE_PRIM 0x0005
226 #define SCTP_ADDR_CONFIRMED 0x0006
229 * CAUTION: these are user exposed SCTP addr reachability states must be
230 * compatible with SCTP_ADDR states in sctp_constants.h
235 #define SCTP_ACTIVE 0x0001 /* SCTP_ADDR_REACHABLE */
240 #define SCTP_INACTIVE 0x0002 /* SCTP_ADDR_NOT_REACHABLE */
242 #ifdef SCTP_UNCONFIRMED
243 #undef SCTP_UNCONFIRMED
245 #define SCTP_UNCONFIRMED 0x0200 /* SCTP_ADDR_UNCONFIRMED */
247 #ifdef SCTP_NOHEARTBEAT
248 #undef SCTP_NOHEARTBEAT
250 #define SCTP_NOHEARTBEAT 0x0040 /* SCTP_ADDR_NOHB */
253 /* remote error events */
254 struct sctp_remote_error {
259 sctp_assoc_t sre_assoc_id;
263 /* data send failure event */
264 struct sctp_send_failed {
269 struct sctp_sndrcvinfo ssf_info;
270 sctp_assoc_t ssf_assoc_id;
274 /* flag that indicates state of data */
275 #define SCTP_DATA_UNSENT 0x0001 /* inqueue never on wire */
276 #define SCTP_DATA_SENT 0x0002 /* on wire at failure */
279 struct sctp_shutdown_event {
283 sctp_assoc_t sse_assoc_id;
286 /* Adaptation layer indication stuff */
287 struct sctp_adaptation_event {
291 uint32_t sai_adaptation_ind;
292 sctp_assoc_t sai_assoc_id;
295 struct sctp_setadaptation {
296 uint32_t ssb_adaptation_ind;
299 /* compatable old spelling */
300 struct sctp_adaption_event {
304 uint32_t sai_adaption_ind;
305 sctp_assoc_t sai_assoc_id;
308 struct sctp_setadaption {
309 uint32_t ssb_adaption_ind;
314 * Partial Delivery API event
316 struct sctp_pdapi_event {
318 uint16_t pdapi_flags;
319 uint32_t pdapi_length;
320 uint32_t pdapi_indication;
321 sctp_assoc_t pdapi_assoc_id;
324 /* indication values */
325 #define SCTP_PARTIAL_DELIVERY_ABORTED 0x0001
329 * authentication key event
331 struct sctp_authkey_event {
334 uint32_t auth_length;
335 uint16_t auth_keynumber;
336 uint16_t auth_altkeynumber;
337 uint32_t auth_indication;
338 sctp_assoc_t auth_assoc_id;
341 /* indication values */
342 #define SCTP_AUTH_NEWKEY 0x0001
348 struct sctp_stream_reset_event {
349 uint16_t strreset_type;
350 uint16_t strreset_flags;
351 uint32_t strreset_length;
352 sctp_assoc_t strreset_assoc_id;
353 uint16_t strreset_list[0];
356 /* flags in strreset_flags field */
357 #define SCTP_STRRESET_INBOUND_STR 0x0001
358 #define SCTP_STRRESET_OUTBOUND_STR 0x0002
359 #define SCTP_STRRESET_ALL_STREAMS 0x0004
360 #define SCTP_STRRESET_STREAM_LIST 0x0008
361 #define SCTP_STRRESET_FAILED 0x0010
364 /* SCTP notification event */
371 union sctp_notification {
372 struct sctp_tlv sn_header;
373 struct sctp_assoc_change sn_assoc_change;
374 struct sctp_paddr_change sn_paddr_change;
375 struct sctp_remote_error sn_remote_error;
376 struct sctp_send_failed sn_send_failed;
377 struct sctp_shutdown_event sn_shutdown_event;
378 struct sctp_adaptation_event sn_adaptation_event;
379 /* compatability same as above */
380 struct sctp_adaption_event sn_adaption_event;
381 struct sctp_pdapi_event sn_pdapi_event;
382 struct sctp_authkey_event sn_auth_event;
383 struct sctp_stream_reset_event sn_strreset_event;
386 /* notification types */
387 #define SCTP_ASSOC_CHANGE 0x0001
388 #define SCTP_PEER_ADDR_CHANGE 0x0002
389 #define SCTP_REMOTE_ERROR 0x0003
390 #define SCTP_SEND_FAILED 0x0004
391 #define SCTP_SHUTDOWN_EVENT 0x0005
392 #define SCTP_ADAPTATION_INDICATION 0x0006
394 #define SCTP_ADAPTION_INDICATION 0x0006
395 #define SCTP_PARTIAL_DELIVERY_EVENT 0x0007
396 #define SCTP_AUTHENTICATION_EVENT 0x0008
397 #define SCTP_STREAM_RESET_EVENT 0x0009
401 * socket option structs
404 struct sctp_paddrparams {
405 sctp_assoc_t spp_assoc_id;
406 struct sockaddr_storage spp_address;
407 uint32_t spp_hbinterval;
408 uint16_t spp_pathmaxrxt;
409 uint32_t spp_pathmtu;
411 uint32_t spp_ipv6_flowlabel;
412 uint8_t spp_ipv4_tos;
416 #define SPP_HB_ENABLE 0x00000001
417 #define SPP_HB_DISABLE 0x00000002
418 #define SPP_HB_DEMAND 0x00000004
419 #define SPP_PMTUD_ENABLE 0x00000008
420 #define SPP_PMTUD_DISABLE 0x00000010
421 #define SPP_SACKDELAY_ENABLE 0x00000020
422 #define SPP_SACKDELAY_DISABLE 0x00000040
423 #define SPP_HB_TIME_IS_ZERO 0x00000080
424 #define SPP_IPV6_FLOWLABEL 0x00000100
425 #define SPP_IPV4_TOS 0x00000200
427 struct sctp_paddrinfo {
428 sctp_assoc_t spinfo_assoc_id;
429 struct sockaddr_storage spinfo_address;
430 int32_t spinfo_state;
431 uint32_t spinfo_cwnd;
432 uint32_t spinfo_srtt;
437 struct sctp_rtoinfo {
438 sctp_assoc_t srto_assoc_id;
439 uint32_t srto_initial;
444 struct sctp_assocparams {
445 sctp_assoc_t sasoc_assoc_id;
446 uint16_t sasoc_asocmaxrxt;
447 uint16_t sasoc_number_peer_destinations;
448 uint32_t sasoc_peer_rwnd;
449 uint32_t sasoc_local_rwnd;
450 uint32_t sasoc_cookie_life;
451 uint32_t sasoc_sack_delay;
452 uint32_t sasoc_sack_freq;
455 struct sctp_setprim {
456 sctp_assoc_t ssp_assoc_id;
457 struct sockaddr_storage ssp_addr;
460 struct sctp_setpeerprim {
461 sctp_assoc_t sspp_assoc_id;
462 struct sockaddr_storage sspp_addr;
465 struct sctp_getaddresses {
466 sctp_assoc_t sget_assoc_id;
467 /* addr is filled in for N * sockaddr_storage */
468 struct sockaddr addr[1];
471 struct sctp_setstrm_timeout {
472 sctp_assoc_t ssto_assoc_id;
473 uint32_t ssto_timeout;
474 uint32_t ssto_streamid_start;
475 uint32_t ssto_streamid_end;
479 sctp_assoc_t sstat_assoc_id;
482 uint16_t sstat_unackdata;
483 uint16_t sstat_penddata;
484 uint16_t sstat_instrms;
485 uint16_t sstat_outstrms;
486 uint32_t sstat_fragmentation_point;
487 struct sctp_paddrinfo sstat_primary;
491 * AUTHENTICATION support
493 /* SCTP_AUTH_CHUNK */
494 struct sctp_authchunk {
499 struct sctp_authkey {
500 sctp_assoc_t sca_assoc_id;
501 uint16_t sca_keynumber;
505 /* SCTP_HMAC_IDENT */
506 struct sctp_hmacalgo {
507 uint16_t shmac_idents[0];
511 #define SCTP_AUTH_HMAC_ID_RSVD 0x0000
512 #define SCTP_AUTH_HMAC_ID_SHA1 0x0001 /* default, mandatory */
513 #define SCTP_AUTH_HMAC_ID_MD5 0x0002 /* deprecated */
514 #define SCTP_AUTH_HMAC_ID_SHA256 0x0003
515 #define SCTP_AUTH_HMAC_ID_SHA224 0x8001
516 #define SCTP_AUTH_HMAC_ID_SHA384 0x8002
517 #define SCTP_AUTH_HMAC_ID_SHA512 0x8003
520 /* SCTP_AUTH_ACTIVE_KEY / SCTP_AUTH_DELETE_KEY */
521 struct sctp_authkeyid {
522 sctp_assoc_t scact_assoc_id;
523 uint16_t scact_keynumber;
526 /* SCTP_PEER_AUTH_CHUNKS / SCTP_LOCAL_AUTH_CHUNKS */
527 struct sctp_authchunks {
528 sctp_assoc_t gauth_assoc_id;
529 uint8_t gauth_chunks[0];
532 struct sctp_assoc_value {
533 sctp_assoc_t assoc_id;
534 uint32_t assoc_value;
537 #define MAX_ASOC_IDS_RET 255
538 struct sctp_assoc_ids {
539 uint16_t asls_assoc_start; /* array of index's start at 0 */
540 uint8_t asls_numb_present;
541 uint8_t asls_more_to_get;
542 sctp_assoc_t asls_assoc_id[MAX_ASOC_IDS_RET];
545 struct sctp_cwnd_args {
546 struct sctp_nets *net; /* network to */
547 uint32_t cwnd_new_value;/* cwnd in k */
548 uint32_t inflight; /* flightsize in k */
549 uint32_t pseudo_cumack;
550 int cwnd_augment; /* increment to it */
551 uint8_t meets_pseudo_cumack;
552 uint8_t need_new_pseudo_cumack;
557 struct sctp_blk_args {
558 uint32_t onsb; /* in 1k bytes */
559 uint32_t sndlen; /* len of send being attempted */
560 uint32_t peer_rwnd; /* rwnd of peer */
561 uint16_t send_sent_qcnt;/* chnk cnt */
562 uint16_t stream_qcnt; /* chnk cnt */
563 uint16_t chunks_on_oque;/* chunks out */
564 uint16_t flight_size; /* flight size in k */
568 * Max we can reset in one setting, note this is dictated not by the define
569 * but the size of a mbuf cluster so don't change this define and think you
570 * can specify more. You must do multiple resets if you want to reset more
571 * than SCTP_MAX_EXPLICIT_STR_RESET.
573 #define SCTP_MAX_EXPLICT_STR_RESET 1000
575 #define SCTP_RESET_LOCAL_RECV 0x0001
576 #define SCTP_RESET_LOCAL_SEND 0x0002
577 #define SCTP_RESET_BOTH 0x0003
578 #define SCTP_RESET_TSN 0x0004
580 struct sctp_stream_reset {
581 sctp_assoc_t strrst_assoc_id;
582 uint16_t strrst_flags;
583 uint16_t strrst_num_streams; /* 0 == ALL */
584 uint16_t strrst_list[0];/* list if strrst_num_streams is not 0 */
588 struct sctp_get_nonce_values {
589 sctp_assoc_t gn_assoc_id;
590 uint32_t gn_peers_tag;
591 uint32_t gn_local_tag;
595 struct sctp_str_log {
612 uint32_t largest_tsn;
613 uint32_t largest_new_tsn;
623 struct sctp_rwnd_log {
630 struct sctp_mbcnt_log {
631 uint32_t total_queue_size;
632 uint32_t size_change;
633 uint32_t total_queue_mb_size;
634 uint32_t mbcnt_change;
637 struct sctp_sack_log {
645 struct sctp_lock_log {
652 uint8_t sockrcvbuf_lock;
653 uint8_t socksndbuf_lock;
658 struct sctp_rto_log {
665 struct sctp_nagle_log {
667 uint32_t total_flight;
668 uint32_t total_in_queue;
669 uint16_t count_in_queue;
670 uint16_t count_in_flight;
673 struct sctp_sbwake_log {
679 uint8_t stream_qcnt; /* chnk cnt */
680 uint8_t chunks_on_oque; /* chunks out */
685 struct sctp_misc_info {
692 struct sctp_log_closing {
700 struct sctp_mbuf_log {
709 struct sctp_cwnd_log {
715 struct sctp_log_closing close;
716 struct sctp_blk_args blk;
717 struct sctp_cwnd_args cwnd;
718 struct sctp_str_log strlog;
719 struct sctp_fr_log fr;
720 struct sctp_fr_map map;
721 struct sctp_rwnd_log rwnd;
722 struct sctp_mbcnt_log mbcnt;
723 struct sctp_sack_log sack;
724 struct sctp_lock_log lock;
725 struct sctp_rto_log rto;
726 struct sctp_sb_log sb;
727 struct sctp_nagle_log nagle;
728 struct sctp_sbwake_log wake;
729 struct sctp_mbuf_log mb;
730 struct sctp_misc_info misc;
734 struct sctp_cwnd_log_req {
735 int num_in_log; /* Number in log */
736 int num_ret; /* Number returned */
737 int start_at; /* start at this one */
738 int end_at; /* end at this one */
739 struct sctp_cwnd_log log[0];
743 /* MIB according to RFC 3873 */
744 u_long sctps_currestab; /* sctpStats 1 (Gauge32) */
745 u_long sctps_activeestab; /* sctpStats 2 (Counter32) */
746 u_long sctps_restartestab;
747 u_long sctps_collisionestab;
748 u_long sctps_passiveestab; /* sctpStats 3 (Counter32) */
749 u_long sctps_aborted; /* sctpStats 4 (Counter32) */
750 u_long sctps_shutdown; /* sctpStats 5 (Counter32) */
751 u_long sctps_outoftheblue; /* sctpStats 6 (Counter32) */
752 u_long sctps_checksumerrors; /* sctpStats 7 (Counter32) */
753 u_long sctps_outcontrolchunks; /* sctpStats 8 (Counter64) */
754 u_long sctps_outorderchunks; /* sctpStats 9 (Counter64) */
755 u_long sctps_outunorderchunks; /* sctpStats 10 (Counter64) */
756 u_long sctps_incontrolchunks; /* sctpStats 11 (Counter64) */
757 u_long sctps_inorderchunks; /* sctpStats 12 (Counter64) */
758 u_long sctps_inunorderchunks; /* sctpStats 13 (Counter64) */
759 u_long sctps_fragusrmsgs; /* sctpStats 14 (Counter64) */
760 u_long sctps_reasmusrmsgs; /* sctpStats 15 (Counter64) */
761 u_long sctps_outpackets;/* sctpStats 16 (Counter64) */
762 u_long sctps_inpackets; /* sctpStats 17 (Counter64) */
763 struct timeval sctps_discontinuitytime; /* sctpStats 18 (TimeStamp) */
764 /* input statistics: */
765 u_long sctps_recvpackets; /* total input packets */
766 u_long sctps_recvdatagrams; /* total input datagrams */
767 u_long sctps_recvpktwithdata;
768 u_long sctps_recvsacks; /* total input SACK chunks */
769 u_long sctps_recvdata; /* total input DATA chunks */
770 u_long sctps_recvdupdata; /* total input duplicate DATA chunks */
771 u_long sctps_recvheartbeat; /* total input HB chunks */
772 u_long sctps_recvheartbeatack; /* total input HB-ACK chunks */
773 u_long sctps_recvecne; /* total input ECNE chunks */
774 u_long sctps_recvauth; /* total input AUTH chunks */
775 u_long sctps_recvauthmissing; /* total input chunks missing AUTH */
776 u_long sctps_recvivalhmacid; /* total number of invalid HMAC ids
778 u_long sctps_recvivalkeyid; /* total number of invalid secret ids
780 u_long sctps_recvauthfailed; /* total number of auth failed */
781 u_long sctps_recvexpress; /* total fast path receives all one
783 u_long sctps_recvexpressm; /* total fast path multi-part data */
784 /* output statistics: */
785 u_long sctps_sendpackets; /* total output packets */
786 u_long sctps_sendsacks; /* total output SACKs */
787 u_long sctps_senddata; /* total output DATA chunks */
788 u_long sctps_sendretransdata; /* total output retransmitted DATA
790 u_long sctps_sendfastretrans; /* total output fast retransmitted
792 u_long sctps_sendmultfastretrans; /* U-del */
793 u_long sctps_sendheartbeat; /* total output HB chunks */
794 u_long sctps_sendecne; /* total output ECNE chunks */
795 u_long sctps_sendauth; /* total output AUTH chunks FIXME */
796 u_long sctps_senderrors;/* ip_output error counter */
797 /* PCKDROPREP statistics: */
798 u_long sctps_pdrpfmbox; /* */
799 u_long sctps_pdrpfehos; /* */
800 u_long sctps_pdrpmbda; /* */
801 u_long sctps_pdrpmbct; /* */
802 u_long sctps_pdrpbwrpt; /* */
803 u_long sctps_pdrpcrupt; /* */
804 u_long sctps_pdrpnedat; /* */
805 u_long sctps_pdrppdbrk; /* */
806 u_long sctps_pdrptsnnf; /* */
807 u_long sctps_pdrpdnfnd; /* */
808 u_long sctps_pdrpdiwnp; /* */
809 u_long sctps_pdrpdizrw; /* */
810 u_long sctps_pdrpbadd; /* */
811 u_long sctps_pdrpmark; /* */
813 u_long sctps_timoiterator; /* */
814 u_long sctps_timodata; /* */
815 u_long sctps_timowindowprobe; /* */
816 u_long sctps_timoinit; /* */
817 u_long sctps_timosack; /* */
818 u_long sctps_timoshutdown; /* */
819 u_long sctps_timoheartbeat; /* */
820 u_long sctps_timocookie;/* */
821 u_long sctps_timosecret;/* */
822 u_long sctps_timopathmtu; /* */
823 u_long sctps_timoshutdownack; /* */
824 u_long sctps_timoshutdownguard; /* */
825 u_long sctps_timostrmrst; /* */
826 u_long sctps_timoearlyfr; /* */
827 u_long sctps_timoasconf;/* */
828 u_long sctps_timoautoclose; /* */
829 u_long sctps_timoassockill; /* */
830 u_long sctps_timoinpkill; /* */
831 /* Early fast retransmission counters */
832 u_long sctps_earlyfrstart;
833 u_long sctps_earlyfrstop;
834 u_long sctps_earlyfrmrkretrans;
835 u_long sctps_earlyfrstpout;
836 u_long sctps_earlyfrstpidsck1;
837 u_long sctps_earlyfrstpidsck2;
838 u_long sctps_earlyfrstpidsck3;
839 u_long sctps_earlyfrstpidsck4;
840 u_long sctps_earlyfrstrid;
841 u_long sctps_earlyfrstrout;
842 u_long sctps_earlyfrstrtmr;
844 u_long sctps_hdrops; /* packet shorter than header */
845 u_long sctps_badsum; /* checksum error */
846 u_long sctps_noport; /* no endpoint for port */
847 u_long sctps_badvtag; /* bad v-tag */
848 u_long sctps_badsid; /* bad SID */
849 u_long sctps_nomem; /* no memory */
850 u_long sctps_fastretransinrtt; /* number of multiple FR in a RTT
852 u_long sctps_markedretrans;
853 u_long sctps_naglesent; /* nagle allowed sending */
854 u_long sctps_naglequeued; /* nagle does't allow sending */
855 u_long sctps_maxburstqueued; /* max burst dosn't allow sending */
856 u_long sctps_ifnomemqueued; /* */
857 u_long sctps_windowprobed; /* total number of window probes sent */
858 u_long sctps_lowlevelerr;
859 u_long sctps_lowlevelerrusr;
860 u_long sctps_datadropchklmt;
861 u_long sctps_datadroprwnd;
862 u_long sctps_ecnereducedcwnd;
863 u_long sctps_vtagexpress; /* Used express lookup via vtag */
864 u_long sctps_vtagbogus; /* Collision in express lookup. */
865 u_long sctps_primary_randry; /* Number of times the sender ran dry
866 * of user data on primary */
867 u_long sctps_cmt_randry;/* Same for above */
868 u_long sctps_slowpath_sack; /* Sacks the slow way */
869 u_long sctps_wu_sacks_sent; /* Window Update only sacks sent */
870 u_long sctps_sends_with_flags; /* number of sends with sinfo_flags
872 u_long sctps_sends_with_unord;
873 u_long sctps_sends_with_eof;
874 u_long sctps_sends_with_abort;
875 u_long sctps_protocol_drain_calls;
876 u_long sctps_protocol_drains_done;
879 #define SCTP_STAT_INCR(_x) SCTP_STAT_INCR_BY(_x,1)
880 #define SCTP_STAT_DECR(_x) SCTP_STAT_DECR_BY(_x,1)
881 #define SCTP_STAT_INCR_BY(_x,_d) atomic_add_long(&sctpstat._x, _d)
882 #define SCTP_STAT_DECR_BY(_x,_d) atomic_add_long(&sctpstat._x, -(_d))
883 /* The following macros are for handling MIB values, */
884 #define SCTP_STAT_INCR_COUNTER32(_x) SCTP_STAT_INCR(_x)
885 #define SCTP_STAT_INCR_COUNTER64(_x) SCTP_STAT_INCR(_x)
886 #define SCTP_STAT_INCR_GAUGE32(_x) SCTP_STAT_INCR(_x)
887 #define SCTP_STAT_DECR_COUNTER32(_x) SCTP_STAT_DECR(_x)
888 #define SCTP_STAT_DECR_COUNTER64(_x) SCTP_STAT_DECR(_x)
889 #define SCTP_STAT_DECR_GAUGE32(_x) SCTP_STAT_DECR(_x)
891 union sctp_sockstore {
892 #if defined(INET) || !defined(_KERNEL)
893 struct sockaddr_in sin;
895 #if defined(INET6) || !defined(_KERNEL)
896 struct sockaddr_in6 sin6;
904 uint16_t number_local_addresses;
905 uint32_t number_associations;
908 uint32_t total_sends;
909 uint32_t total_recvs;
910 uint32_t total_nospaces;
911 /* add more endpoint specific data here */
915 uint16_t LocalPort; /* sctpAssocEntry 3 */
916 uint16_t RemPort; /* sctpAssocEntry 4 */
917 union sctp_sockstore RemPrimAddr; /* sctpAssocEntry 5/6 */
918 uint32_t HeartBeatInterval; /* sctpAssocEntry 7 */
919 uint32_t State; /* sctpAssocEntry 8 */
920 uint32_t InStreams; /* sctpAssocEntry 9 */
921 uint32_t OutStreams; /* sctpAssocEntry 10 */
922 uint32_t MaxRetr; /* sctpAssocEntry 11 */
923 uint32_t PrimProcess; /* sctpAssocEntry 12 */
924 uint32_t T1expireds; /* sctpAssocEntry 13 */
925 uint32_t T2expireds; /* sctpAssocEntry 14 */
926 uint32_t RtxChunks; /* sctpAssocEntry 15 */
927 struct timeval StartTime; /* sctpAssocEntry 16 */
928 struct timeval DiscontinuityTime; /* sctpAssocEntry 17 */
929 uint32_t total_sends;
930 uint32_t total_recvs;
933 uint32_t initial_tsn;
934 uint32_t highest_tsn;
935 uint32_t cumulative_tsn;
936 uint32_t cumulative_tsn_ack;
937 /* add more association specific data here */
938 uint16_t number_local_addresses;
939 uint16_t number_remote_addresses;
943 union sctp_sockstore LocalAddr; /* sctpAssocLocalAddrEntry 1/2 */
944 struct timeval LocalStartTime; /* sctpAssocLocalAddrEntry 3 */
945 /* add more local address specific data */
949 union sctp_sockstore RemAddr; /* sctpAssocLocalRemEntry 1/2 */
950 uint8_t RemAddrActive; /* sctpAssocLocalRemEntry 3 */
951 uint8_t RemAddrConfirmed; /* */
952 uint8_t RemAddrHBActive;/* sctpAssocLocalRemEntry 4 */
953 uint32_t RemAddrRTO; /* sctpAssocLocalRemEntry 5 */
954 uint32_t RemAddrMaxPathRtx; /* sctpAssocLocalRemEntry 6 */
955 uint32_t RemAddrRtx; /* sctpAssocLocalRemEntry 7 */
956 uint32_t RemAddrErrorCounter; /* */
957 uint32_t RemAddrCwnd; /* */
958 uint32_t RemAddrFlightSize; /* */
959 struct timeval RemAddrStartTime; /* sctpAssocLocalRemEntry 8 */
960 /* add more remote address specific data */
964 * Kernel defined for sctp_send
968 sctp_lower_sosend(struct socket *so,
969 struct sockaddr *addr,
972 struct mbuf *control,
975 struct sctp_sndrcvinfo *srcv,
980 sctp_sorecvmsg(struct socket *so,
983 struct sockaddr *from,
986 struct sctp_sndrcvinfo *sinfo,
995 #if !(defined(_KERNEL))
998 int sctp_peeloff __P((int, sctp_assoc_t));
999 int sctp_bindx __P((int, struct sockaddr *, int, int));
1000 int sctp_connectx __P((int, const struct sockaddr *, int, sctp_assoc_t *));
1001 int sctp_getaddrlen __P((sa_family_t));
1002 int sctp_getpaddrs __P((int, sctp_assoc_t, struct sockaddr **));
1003 void sctp_freepaddrs __P((struct sockaddr *));
1004 int sctp_getladdrs __P((int, sctp_assoc_t, struct sockaddr **));
1005 void sctp_freeladdrs __P((struct sockaddr *));
1006 int sctp_opt_info __P((int, sctp_assoc_t, int, void *, socklen_t *));
1008 ssize_t sctp_sendmsg
1009 __P((int, const void *, size_t,
1010 const struct sockaddr *,
1011 socklen_t, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t));
1013 ssize_t sctp_send __P((int sd, const void *msg, size_t len,
1014 const struct sctp_sndrcvinfo *sinfo, int flags));
1017 sctp_sendx __P((int sd, const void *msg, size_t len,
1018 struct sockaddr *addrs, int addrcnt,
1019 struct sctp_sndrcvinfo *sinfo, int flags));
1021 sctp_sendmsgx __P((int sd, const void *, size_t,
1022 struct sockaddr *, int,
1023 uint32_t, uint32_t, uint16_t, uint32_t, uint32_t));
1026 sctp_getassocid __P((int sd, struct sockaddr *sa));
1028 ssize_t sctp_recvmsg __P((int, void *, size_t, struct sockaddr *,
1029 socklen_t *, struct sctp_sndrcvinfo *, int *));
1033 #endif /* !_KERNEL */
1034 #endif /* !__sctp_uio_h__ */