The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/netinet/sctp_header.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $KAME: sctp_header.h,v 1.13 2004/08/17 04:06:16 itojun Exp $    */
    2 /*      $DragonFly: src/sys/netinet/sctp_header.h,v 1.2 2006/05/20 02:42:12 dillon Exp $        */
    3 
    4 #ifndef _NETINET_SCTP_HEADER_H_
    5 #define _NETINET_SCTP_HEADER_H_
    6 
    7 /*
    8  * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc.
    9  * All rights reserved.
   10  *
   11  * Redistribution and use in source and binary forms, with or without
   12  * modification, are permitted provided that the following conditions
   13  * are met:
   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.
   25  *
   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
   36  * SUCH DAMAGE.
   37  */
   38 
   39 #ifndef _SYS_TYPES_H_
   40 #include <sys/types.h>
   41 #endif
   42 #ifndef _SYS_TIME_H_
   43 #include <sys/time.h>
   44 #endif
   45 #ifndef _NETINET_SCTP_H_
   46 #include <netinet/sctp.h>
   47 #endif
   48 #ifndef _NETINET_SCTP_CONSTANTS_H_
   49 #include <netinet/sctp_constants.h>
   50 #endif
   51 
   52 /*
   53  * Parameter structures
   54  */
   55 struct sctp_ipv4addr_param {
   56         struct sctp_paramhdr ph;        /* type=SCTP_IPV4_PARAM_TYPE, len=8 */
   57         u_int32_t addr;                 /* IPV4 address */
   58 };
   59 
   60 struct sctp_ipv6addr_param {
   61         struct sctp_paramhdr ph;        /* type=SCTP_IPV6_PARAM_TYPE, len=20 */
   62         u_int8_t  addr[16];             /* IPV6 address */
   63 };
   64 
   65 /* Cookie Preservative */
   66 struct sctp_cookie_perserve_param {
   67         struct sctp_paramhdr ph;        /* type=SCTP_COOKIE_PRESERVE, len=8 */
   68         u_int32_t time;                 /* time in ms to extend cookie */
   69 };
   70 
   71 /* Host Name Address */
   72 struct sctp_host_name_param {
   73         struct sctp_paramhdr ph;        /* type=SCTP_HOSTNAME_ADDRESS */
   74         char name[1];                   /* host name */
   75 };
   76 
   77 /* supported address type */
   78 struct sctp_supported_addr_param {
   79         struct sctp_paramhdr ph;        /* type=SCTP_SUPPORTED_ADDRTYPE */
   80         u_int16_t addr_type[1];         /* array of supported address types */
   81 };
   82 
   83 /* ECN parameter */
   84 struct sctp_ecn_supported_param {
   85         struct sctp_paramhdr ph;        /* type=SCTP_ECN_CAPABLE */
   86 };
   87 
   88 
   89 /* heartbeat info parameter */
   90 struct sctp_heartbeat_info_param {
   91         struct sctp_paramhdr ph;
   92         u_int32_t time_value_1;
   93         u_int32_t time_value_2;
   94         u_int32_t random_value1;
   95         u_int32_t random_value2;
   96         u_int16_t user_req;
   97         u_int8_t addr_family;
   98         u_int8_t addr_len;
   99         char address[SCTP_ADDRMAX];
  100 };
  101 
  102 
  103 /* draft-ietf-tsvwg-prsctp */
  104 /* PR-SCTP supported parameter */
  105 struct sctp_prsctp_supported_param {
  106         struct sctp_paramhdr ph;
  107 };
  108 
  109 
  110 /* draft-ietf-tsvwg-addip-sctp */
  111 struct sctp_asconf_paramhdr {           /* an ASCONF "parameter" */
  112         struct sctp_paramhdr ph;        /* a SCTP parameter header */
  113         u_int32_t correlation_id;       /* correlation id for this param */
  114 };
  115 
  116 struct sctp_asconf_addr_param {         /* an ASCONF address parameter */
  117         struct sctp_asconf_paramhdr aph;        /* asconf "parameter" */
  118         struct sctp_ipv6addr_param  addrp;      /* max storage size */
  119 };
  120 
  121 struct sctp_asconf_addrv4_param {               /* an ASCONF address (v4) parameter */
  122         struct sctp_asconf_paramhdr aph;        /* asconf "parameter" */
  123         struct sctp_ipv4addr_param  addrp;      /* max storage size */
  124 };
  125 
  126 
  127 /* ECN Nonce: draft-ladha-sctp-ecn-nonce */
  128 struct sctp_ecn_nonce_supported_param {
  129         struct sctp_paramhdr ph;        /* type = 0x8001  len = 4 */
  130 };
  131 
  132 struct sctp_supported_chunk_types_param {
  133         struct sctp_paramhdr ph;        /* type = 0x8002  len = x */
  134         u_int8_t chunk_types[0];
  135 };
  136 
  137 /*
  138  * Structures for DATA chunks
  139  */
  140 struct sctp_data {
  141         u_int32_t tsn;
  142         u_int16_t stream_id;
  143         u_int16_t stream_sequence;
  144         u_int32_t protocol_id;
  145         /* user data follows */
  146 };
  147 
  148 struct sctp_data_chunk {
  149         struct sctp_chunkhdr ch;
  150         struct sctp_data dp;
  151 };
  152 
  153 /*
  154  * Structures for the control chunks
  155  */
  156 
  157 /* Initiate (INIT)/Initiate Ack (INIT ACK) */
  158 struct sctp_init {
  159         u_int32_t initiate_tag;         /* initiate tag */
  160         u_int32_t a_rwnd;               /* a_rwnd */
  161         u_int16_t num_outbound_streams; /* OS */
  162         u_int16_t num_inbound_streams;  /* MIS */
  163         u_int32_t initial_tsn;          /* I-TSN */
  164         /* optional param's follow */
  165 };
  166 
  167 /* state cookie header */
  168 struct sctp_state_cookie {              /* this is our definition... */
  169         u_int8_t  identification[16];   /* id of who we are */
  170         u_int32_t cookie_life;          /* life I will award this cookie */
  171         u_int32_t tie_tag_my_vtag;      /* my tag in old association */
  172         u_int32_t tie_tag_peer_vtag;    /* peers tag in old association */
  173         u_int32_t peers_vtag;           /* peers tag in INIT (for quick ref) */
  174         u_int32_t my_vtag;              /* my tag in INIT-ACK (for quick ref) */
  175         struct timeval time_entered;    /* the time I built cookie */
  176         u_int32_t address[4];           /* 4 ints/128 bits */
  177         u_int32_t addr_type;            /* address type */
  178         u_int32_t laddress[4];          /* my local from address */
  179         u_int32_t laddr_type;           /* my local from address type */
  180         u_int32_t scope_id;             /* v6 scope id for link-locals */
  181         u_int16_t peerport;             /* port address of the peer in the INIT */
  182         u_int16_t myport;               /* my port address used in the INIT */
  183         u_int8_t ipv4_addr_legal;       /* Are V4 addr legal? */
  184         u_int8_t ipv6_addr_legal;       /* Are V6 addr legal? */
  185         u_int8_t local_scope;           /* IPv6 local scope flag */
  186         u_int8_t site_scope;            /* IPv6 site scope flag */
  187         u_int8_t ipv4_scope;            /* IPv4 private addr scope */
  188         u_int8_t loopback_scope;        /* loopback scope information */
  189         u_int16_t reserved;
  190         /*
  191          * at the end is tacked on the INIT chunk and the
  192          * INIT-ACK chunk (minus the cookie).
  193          */
  194 };
  195 
  196 struct sctp_inv_mandatory_param {
  197         u_int16_t cause;
  198         u_int16_t length;
  199         u_int32_t num_param;
  200         u_int16_t param;
  201         /*
  202          * We include this to 0 it since only a missing cookie
  203          * will cause this error.
  204          */
  205         u_int16_t resv;
  206 };
  207 
  208 struct sctp_unresolv_addr {
  209         u_int16_t cause;
  210         u_int16_t length;
  211         u_int16_t addr_type;
  212         u_int16_t reserved;     /* Only one invalid addr type */
  213 };
  214 
  215 /* state cookie parameter */
  216 struct sctp_state_cookie_param {
  217         struct sctp_paramhdr ph;
  218         struct sctp_state_cookie cookie;
  219 };
  220 
  221 struct sctp_init_chunk {
  222         struct sctp_chunkhdr ch;
  223         struct sctp_init init;
  224 };
  225 
  226 struct sctp_init_msg {
  227         struct sctphdr sh;
  228         struct sctp_init_chunk msg;
  229 };
  230 /* ... used for both INIT and INIT ACK */
  231 #define sctp_init_ack           sctp_init
  232 #define sctp_init_ack_chunk     sctp_init_chunk
  233 #define sctp_init_ack_msg       sctp_init_msg
  234 
  235 
  236 /* Selective Ack (SACK) */
  237 struct sctp_gap_ack_block {
  238         u_int16_t start;                /* Gap Ack block start */
  239         u_int16_t end;                  /* Gap Ack block end */
  240 };
  241 
  242 struct sctp_sack {
  243         u_int32_t cum_tsn_ack;          /* cumulative TSN Ack */
  244         u_int32_t a_rwnd;               /* updated a_rwnd of sender */
  245         u_int16_t num_gap_ack_blks;     /* number of Gap Ack blocks */
  246         u_int16_t num_dup_tsns;         /* number of duplicate TSNs */
  247         /* struct sctp_gap_ack_block's follow */
  248         /* u_int32_t duplicate_tsn's follow */
  249 };
  250 
  251 struct sctp_sack_chunk {
  252         struct sctp_chunkhdr ch;
  253         struct sctp_sack sack;
  254 };
  255 
  256 
  257 /* Heartbeat Request (HEARTBEAT) */
  258 struct sctp_heartbeat {
  259         struct sctp_heartbeat_info_param hb_info;
  260 };
  261 
  262 struct sctp_heartbeat_chunk {
  263         struct sctp_chunkhdr ch;
  264         struct sctp_heartbeat heartbeat;
  265 };
  266 /* ... used for Heartbeat Ack (HEARTBEAT ACK) */
  267 #define sctp_heartbeat_ack              sctp_heartbeat
  268 #define sctp_heartbeat_ack_chunk        sctp_heartbeat_chunk
  269 
  270 
  271 /* Abort Asssociation (ABORT) */
  272 struct sctp_abort_chunk {
  273         struct sctp_chunkhdr ch;
  274         /* optional error cause may follow */
  275 };
  276 
  277 struct sctp_abort_msg {
  278         struct sctphdr sh;
  279         struct sctp_abort_chunk msg;
  280 };
  281 
  282 
  283 /* Shutdown Association (SHUTDOWN) */
  284 struct sctp_shutdown_chunk {
  285         struct sctp_chunkhdr ch;
  286         u_int32_t cumulative_tsn_ack;
  287 };
  288 
  289 
  290 /* Shutdown Acknowledgment (SHUTDOWN ACK) */
  291 struct sctp_shutdown_ack_chunk {
  292         struct sctp_chunkhdr ch;
  293 };
  294 
  295 
  296 /* Operation Error (ERROR) */
  297 struct sctp_error_chunk {
  298         struct sctp_chunkhdr ch;
  299         /* optional error causes follow */
  300 };
  301 
  302 
  303 /* Cookie Echo (COOKIE ECHO) */
  304 struct sctp_cookie_echo_chunk {
  305         struct sctp_chunkhdr ch;
  306         struct sctp_state_cookie cookie;
  307 };
  308 
  309 /* Cookie Acknowledgment (COOKIE ACK) */
  310 struct sctp_cookie_ack_chunk {
  311         struct sctp_chunkhdr ch;
  312 };
  313 
  314 /* Explicit Congestion Notification Echo (ECNE) */
  315 struct sctp_ecne_chunk {
  316         struct sctp_chunkhdr ch;
  317         u_int32_t tsn;
  318 };
  319 
  320 /* Congestion Window Reduced (CWR) */
  321 struct sctp_cwr_chunk {
  322         struct sctp_chunkhdr ch;
  323         u_int32_t tsn;
  324 };
  325 
  326 /* Shutdown Complete (SHUTDOWN COMPLETE) */
  327 struct sctp_shutdown_complete_chunk {
  328         struct sctp_chunkhdr ch;
  329 };
  330 
  331 /* Oper error holding a stale cookie */
  332 struct sctp_stale_cookie_msg {
  333         struct sctp_paramhdr ph;        /* really an error cause */
  334         u_int32_t time_usec;
  335 };
  336 
  337 struct sctp_adaption_layer_indication {
  338         struct sctp_paramhdr ph;
  339         u_int32_t indication;
  340 };
  341 
  342 struct sctp_cookie_while_shutting_down {
  343         struct sctphdr sh;
  344         struct sctp_chunkhdr ch;
  345         struct sctp_paramhdr ph;        /* really an error cause */
  346 };
  347 
  348 struct sctp_shutdown_complete_msg {
  349         struct sctphdr sh;
  350         struct sctp_shutdown_complete_chunk shut_cmp;
  351 };
  352 
  353 /* draft-ietf-tsvwg-addip-sctp */
  354 /* Address/Stream Configuration Change (ASCONF) */
  355 struct sctp_asconf_chunk {
  356         struct sctp_chunkhdr ch;
  357         u_int32_t serial_number;
  358         /* lookup address parameter (mandatory) */
  359         /* asconf parameters follow */
  360 };
  361 
  362 /* Address/Stream Configuration Acknowledge (ASCONF ACK) */
  363 struct sctp_asconf_ack_chunk {
  364         struct sctp_chunkhdr ch;
  365         u_int32_t serial_number;
  366         /* asconf parameters follow */
  367 };
  368 
  369 /* draft-ietf-tsvwg-prsctp */
  370 /* Forward Cumulative TSN (FORWARD TSN) */
  371 struct sctp_forward_tsn_chunk {
  372         struct sctp_chunkhdr ch;
  373         u_int32_t new_cumulative_tsn;
  374         /* stream/sequence pairs (sctp_strseq) follow */
  375 };
  376 
  377 struct sctp_strseq {
  378         u_int16_t stream;
  379         u_int16_t sequence;
  380 };
  381 
  382 struct sctp_forward_tsn_msg {
  383         struct sctphdr sh;
  384         struct sctp_forward_tsn_chunk msg;
  385 };
  386 
  387 /* should be a multiple of 4 - 1 aka 3/7/11 etc. */
  388 
  389 #define SCTP_NUM_DB_TO_VERIFY 3
  390 
  391 struct sctp_chunk_desc {
  392         u_int8_t chunk_type;
  393         u_int8_t data_bytes[SCTP_NUM_DB_TO_VERIFY];
  394         u_int32_t tsn_ifany;
  395 };
  396 
  397 
  398 struct sctp_pktdrop_chunk {
  399         struct sctp_chunkhdr ch;
  400         u_int32_t bottle_bw;
  401         u_int32_t current_onq;
  402         u_int16_t trunc_len;
  403         u_int16_t reserved;
  404         u_int8_t data[0];
  405 };
  406 
  407 #define SCTP_RESET_YOUR  0x01   /* reset your streams and send response */
  408 #define SCTP_RESET_ALL   0x02   /* reset all of your streams */
  409 #define SCTP_RECIPRICAL  0x04   /* reset my streams too */
  410 
  411 struct sctp_stream_reset_request {
  412         struct sctp_paramhdr ph;
  413         u_int8_t reset_flags;              /* actual request */
  414         u_int8_t reset_pad[3];
  415         u_int32_t reset_req_seq;           /* monotonically increasing seq no */
  416         u_int16_t list_of_streams[0];      /* if not all list of streams */
  417 };
  418 
  419 #define SCTP_RESET_PERFORMED        0x01   /* Peers sending str was reset */
  420 #define SCTP_RESET_DENIED           0x02   /* Asked for but refused       */
  421 
  422 struct sctp_stream_reset_response {
  423         struct sctp_paramhdr ph;
  424         u_int8_t reset_flags;              /* actual request */
  425         u_int8_t reset_pad[3];
  426         u_int32_t reset_req_seq_resp;   /* copied from reset_req reset_req_seq */
  427         u_int32_t reset_at_tsn;         /* resetters next TSN to be assigned send wise */
  428         u_int32_t cumulative_tsn;       /* resetters cum-ack point receive wise */
  429         u_int16_t list_of_streams[0];   /* if not all list of streams */
  430 };
  431 
  432 /* convience structures, note that if you
  433  * are making a request for specific streams
  434  * then the request will need to be an overlay
  435  * structure.
  436  */
  437 
  438 struct sctp_stream_reset_req {
  439         struct sctp_chunkhdr ch;
  440         struct sctp_stream_reset_request sr_req;
  441 };
  442 
  443 struct sctp_stream_reset_resp {
  444         struct sctp_chunkhdr ch;
  445         struct sctp_stream_reset_response sr_resp;
  446 };
  447 
  448 
  449 /*
  450  * we pre-reserve enough room for a ECNE or CWR AND a SACK with no
  451  * missing pieces. If ENCE is missing we could have a couple of blocks.
  452  * This way we optimize so we MOST likely can bundle a SACK/ECN with
  453  * the smallest size data chunk I will split into. We could increase
  454  * throughput slightly by taking out these two but the  24-sack/8-CWR
  455  * i.e. 32 bytes I pre-reserve I feel is worth it for now.
  456  */
  457 #ifndef SCTP_MAX_OVERHEAD
  458 #ifdef AF_INET6
  459 #define SCTP_MAX_OVERHEAD (sizeof(struct sctp_data_chunk) + \
  460                            sizeof(struct sctphdr) + \
  461                            sizeof(struct sctp_ecne_chunk) + \
  462                            sizeof(struct sctp_sack_chunk) + \
  463                            sizeof(struct ip6_hdr))
  464 
  465 #define SCTP_MED_OVERHEAD (sizeof(struct sctp_data_chunk) + \
  466                            sizeof(struct sctphdr) + \
  467                            sizeof(struct ip6_hdr))
  468 
  469 
  470 #define SCTP_MIN_OVERHEAD (sizeof(struct ip6_hdr) + \
  471                            sizeof(struct sctphdr))
  472 
  473 #else
  474 #define SCTP_MAX_OVERHEAD (sizeof(struct sctp_data_chunk) + \
  475                            sizeof(struct sctphdr) + \
  476                            sizeof(struct sctp_ecne_chunk) + \
  477                            sizeof(struct sctp_sack_chunk) + \
  478                            sizeof(struct ip))
  479 
  480 #define SCTP_MED_OVERHEAD (sizeof(struct sctp_data_chunk) + \
  481                            sizeof(struct sctphdr) + \
  482                            sizeof(struct ip))
  483 
  484 
  485 #define SCTP_MIN_OVERHEAD (sizeof(struct ip) + \
  486                            sizeof(struct sctphdr))
  487 
  488 #endif /* AF_INET6 */
  489 #endif /* !SCTP_MAX_OVERHEAD */
  490 
  491 #define SCTP_MED_V4_OVERHEAD (sizeof(struct sctp_data_chunk) + \
  492                               sizeof(struct sctphdr) + \
  493                               sizeof(struct ip))
  494 
  495 #define SCTP_MIN_V4_OVERHEAD (sizeof(struct ip) + \
  496                               sizeof(struct sctphdr))
  497 
  498 #endif /* _NETINET_SCTP_HEADER_H_ */

Cache object: 7071f170ce70524aacd2641b894403ba


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.