LCOV - code coverage report
Current view: top level - include/linux - sctp.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 1 0.0 %
Date: 2014-02-18 Functions: 0 0 -
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* SCTP kernel reference Implementation
       2                 :            :  * (C) Copyright IBM Corp. 2001, 2004
       3                 :            :  * Copyright (c) 1999-2000 Cisco, Inc.
       4                 :            :  * Copyright (c) 1999-2001 Motorola, Inc.
       5                 :            :  * Copyright (c) 2001 Intel Corp.
       6                 :            :  * Copyright (c) 2001 Nokia, Inc.
       7                 :            :  * Copyright (c) 2001 La Monte H.P. Yarroll
       8                 :            :  *
       9                 :            :  * This file is part of the SCTP kernel reference Implementation
      10                 :            :  *
      11                 :            :  * Various protocol defined structures.
      12                 :            :  *
      13                 :            :  * This SCTP implementation is free software;
      14                 :            :  * you can redistribute it and/or modify it under the terms of
      15                 :            :  * the GNU General Public License as published by
      16                 :            :  * the Free Software Foundation; either version 2, or (at your option)
      17                 :            :  * any later version.
      18                 :            :  *
      19                 :            :  * This SCTP implementation is distributed in the hope that it
      20                 :            :  * will be useful, but WITHOUT ANY WARRANTY; without even the implied
      21                 :            :  *                 ************************
      22                 :            :  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
      23                 :            :  * See the GNU General Public License for more details.
      24                 :            :  *
      25                 :            :  * You should have received a copy of the GNU General Public License
      26                 :            :  * along with GNU CC; see the file COPYING.  If not, write to
      27                 :            :  * the Free Software Foundation, 59 Temple Place - Suite 330,
      28                 :            :  * Boston, MA 02111-1307, USA.
      29                 :            :  *
      30                 :            :  * Please send any bug reports or fixes you make to the
      31                 :            :  * email address(es):
      32                 :            :  *    lksctp developers <lksctp-developerst@lists.sourceforge.net>
      33                 :            :  *
      34                 :            :  * Or submit a bug report through the following website:
      35                 :            :  *    http://www.sf.net/projects/lksctp
      36                 :            :  *
      37                 :            :  * Written or modified by:
      38                 :            :  *    La Monte H.P. Yarroll <piggy@acm.org>
      39                 :            :  *    Karl Knutson <karl@athena.chicago.il.us>
      40                 :            :  *    Jon Grimm <jgrimm@us.ibm.com>
      41                 :            :  *    Xingang Guo <xingang.guo@intel.com>
      42                 :            :  *    randall@sctp.chicago.il.us
      43                 :            :  *    kmorneau@cisco.com
      44                 :            :  *    qxie1@email.mot.com
      45                 :            :  *    Sridhar Samudrala <sri@us.ibm.com>
      46                 :            :  *    Kevin Gao <kevin.gao@intel.com>
      47                 :            :  *
      48                 :            :  * Any bugs reported given to us we will try to fix... any fixes shared will
      49                 :            :  * be incorporated into the next SCTP release.
      50                 :            :  */
      51                 :            : #ifndef __LINUX_SCTP_H__
      52                 :            : #define __LINUX_SCTP_H__
      53                 :            : 
      54                 :            : #include <linux/in.h>             /* We need in_addr.  */
      55                 :            : #include <linux/in6.h>            /* We need in6_addr.  */
      56                 :            : #include <linux/skbuff.h>
      57                 :            : 
      58                 :            : #include <uapi/linux/sctp.h>
      59                 :            : 
      60                 :            : /* Section 3.1.  SCTP Common Header Format */
      61                 :            : typedef struct sctphdr {
      62                 :            :         __be16 source;
      63                 :            :         __be16 dest;
      64                 :            :         __be32 vtag;
      65                 :            :         __le32 checksum;
      66                 :            : } __packed sctp_sctphdr_t;
      67                 :            : 
      68                 :          0 : static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb)
      69                 :            : {
      70                 :            :         return (struct sctphdr *)skb_transport_header(skb);
      71                 :            : }
      72                 :            : 
      73                 :            : /* Section 3.2.  Chunk Field Descriptions. */
      74                 :            : typedef struct sctp_chunkhdr {
      75                 :            :         __u8 type;
      76                 :            :         __u8 flags;
      77                 :            :         __be16 length;
      78                 :            : } __packed sctp_chunkhdr_t;
      79                 :            : 
      80                 :            : 
      81                 :            : /* Section 3.2.  Chunk Type Values.
      82                 :            :  * [Chunk Type] identifies the type of information contained in the Chunk
      83                 :            :  * Value field. It takes a value from 0 to 254. The value of 255 is
      84                 :            :  * reserved for future use as an extension field.
      85                 :            :  */
      86                 :            : typedef enum {
      87                 :            :         SCTP_CID_DATA                   = 0,
      88                 :            :         SCTP_CID_INIT                   = 1,
      89                 :            :         SCTP_CID_INIT_ACK               = 2,
      90                 :            :         SCTP_CID_SACK                   = 3,
      91                 :            :         SCTP_CID_HEARTBEAT              = 4,
      92                 :            :         SCTP_CID_HEARTBEAT_ACK          = 5,
      93                 :            :         SCTP_CID_ABORT                  = 6,
      94                 :            :         SCTP_CID_SHUTDOWN               = 7,
      95                 :            :         SCTP_CID_SHUTDOWN_ACK           = 8,
      96                 :            :         SCTP_CID_ERROR                  = 9,
      97                 :            :         SCTP_CID_COOKIE_ECHO            = 10,
      98                 :            :         SCTP_CID_COOKIE_ACK             = 11,
      99                 :            :         SCTP_CID_ECN_ECNE               = 12,
     100                 :            :         SCTP_CID_ECN_CWR                = 13,
     101                 :            :         SCTP_CID_SHUTDOWN_COMPLETE      = 14,
     102                 :            : 
     103                 :            :         /* AUTH Extension Section 4.1 */
     104                 :            :         SCTP_CID_AUTH                   = 0x0F,
     105                 :            : 
     106                 :            :         /* PR-SCTP Sec 3.2 */
     107                 :            :         SCTP_CID_FWD_TSN                = 0xC0,
     108                 :            : 
     109                 :            :         /* Use hex, as defined in ADDIP sec. 3.1 */
     110                 :            :         SCTP_CID_ASCONF                 = 0xC1,
     111                 :            :         SCTP_CID_ASCONF_ACK             = 0x80,
     112                 :            : } sctp_cid_t; /* enum */
     113                 :            : 
     114                 :            : 
     115                 :            : /* Section 3.2
     116                 :            :  *  Chunk Types are encoded such that the highest-order two bits specify
     117                 :            :  *  the action that must be taken if the processing endpoint does not
     118                 :            :  *  recognize the Chunk Type.
     119                 :            :  */
     120                 :            : typedef enum {
     121                 :            :         SCTP_CID_ACTION_DISCARD     = 0x00,
     122                 :            :         SCTP_CID_ACTION_DISCARD_ERR = 0x40,
     123                 :            :         SCTP_CID_ACTION_SKIP        = 0x80,
     124                 :            :         SCTP_CID_ACTION_SKIP_ERR    = 0xc0,
     125                 :            : } sctp_cid_action_t;
     126                 :            : 
     127                 :            : enum { SCTP_CID_ACTION_MASK = 0xc0, };
     128                 :            : 
     129                 :            : /* This flag is used in Chunk Flags for ABORT and SHUTDOWN COMPLETE.
     130                 :            :  *
     131                 :            :  * 3.3.7 Abort Association (ABORT) (6):
     132                 :            :  *    The T bit is set to 0 if the sender had a TCB that it destroyed.
     133                 :            :  *    If the sender did not have a TCB it should set this bit to 1.
     134                 :            :  */
     135                 :            : enum { SCTP_CHUNK_FLAG_T = 0x01 };
     136                 :            : 
     137                 :            : /*
     138                 :            :  *  Set the T bit
     139                 :            :  *
     140                 :            :  *      0                   1                   2                   3
     141                 :            :  *      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     142                 :            :  *     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     143                 :            :  *     |   Type = 14   |Reserved     |T|      Length = 4               |
     144                 :            :  *     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     145                 :            :  *
     146                 :            :  * Chunk Flags: 8 bits
     147                 :            :  *
     148                 :            :  *   Reserved:  7 bits
     149                 :            :  *     Set to 0 on transmit and ignored on receipt.
     150                 :            :  *
     151                 :            :  *   T bit:  1 bit
     152                 :            :  *     The T bit is set to 0 if the sender had a TCB that it destroyed. If
     153                 :            :  *     the sender did NOT have a TCB it should set this bit to 1.
     154                 :            :  *
     155                 :            :  * Note: Special rules apply to this chunk for verification, please
     156                 :            :  * see Section 8.5.1 for details.
     157                 :            :  */
     158                 :            : 
     159                 :            : #define sctp_test_T_bit(c)    ((c)->chunk_hdr->flags & SCTP_CHUNK_FLAG_T)
     160                 :            : 
     161                 :            : /* RFC 2960
     162                 :            :  * Section 3.2.1 Optional/Variable-length Parmaeter Format.
     163                 :            :  */
     164                 :            : 
     165                 :            : typedef struct sctp_paramhdr {
     166                 :            :         __be16 type;
     167                 :            :         __be16 length;
     168                 :            : } __packed sctp_paramhdr_t;
     169                 :            : 
     170                 :            : typedef enum {
     171                 :            : 
     172                 :            :         /* RFC 2960 Section 3.3.5 */
     173                 :            :         SCTP_PARAM_HEARTBEAT_INFO               = cpu_to_be16(1),
     174                 :            :         /* RFC 2960 Section 3.3.2.1 */
     175                 :            :         SCTP_PARAM_IPV4_ADDRESS                 = cpu_to_be16(5),
     176                 :            :         SCTP_PARAM_IPV6_ADDRESS                 = cpu_to_be16(6),
     177                 :            :         SCTP_PARAM_STATE_COOKIE                 = cpu_to_be16(7),
     178                 :            :         SCTP_PARAM_UNRECOGNIZED_PARAMETERS      = cpu_to_be16(8),
     179                 :            :         SCTP_PARAM_COOKIE_PRESERVATIVE          = cpu_to_be16(9),
     180                 :            :         SCTP_PARAM_HOST_NAME_ADDRESS            = cpu_to_be16(11),
     181                 :            :         SCTP_PARAM_SUPPORTED_ADDRESS_TYPES      = cpu_to_be16(12),
     182                 :            :         SCTP_PARAM_ECN_CAPABLE                  = cpu_to_be16(0x8000),
     183                 :            : 
     184                 :            :         /* AUTH Extension Section 3 */
     185                 :            :         SCTP_PARAM_RANDOM                       = cpu_to_be16(0x8002),
     186                 :            :         SCTP_PARAM_CHUNKS                       = cpu_to_be16(0x8003),
     187                 :            :         SCTP_PARAM_HMAC_ALGO                    = cpu_to_be16(0x8004),
     188                 :            : 
     189                 :            :         /* Add-IP: Supported Extensions, Section 4.2 */
     190                 :            :         SCTP_PARAM_SUPPORTED_EXT        = cpu_to_be16(0x8008),
     191                 :            : 
     192                 :            :         /* PR-SCTP Sec 3.1 */
     193                 :            :         SCTP_PARAM_FWD_TSN_SUPPORT      = cpu_to_be16(0xc000),
     194                 :            : 
     195                 :            :         /* Add-IP Extension. Section 3.2 */
     196                 :            :         SCTP_PARAM_ADD_IP               = cpu_to_be16(0xc001),
     197                 :            :         SCTP_PARAM_DEL_IP               = cpu_to_be16(0xc002),
     198                 :            :         SCTP_PARAM_ERR_CAUSE            = cpu_to_be16(0xc003),
     199                 :            :         SCTP_PARAM_SET_PRIMARY          = cpu_to_be16(0xc004),
     200                 :            :         SCTP_PARAM_SUCCESS_REPORT       = cpu_to_be16(0xc005),
     201                 :            :         SCTP_PARAM_ADAPTATION_LAYER_IND = cpu_to_be16(0xc006),
     202                 :            : 
     203                 :            : } sctp_param_t; /* enum */
     204                 :            : 
     205                 :            : 
     206                 :            : /* RFC 2960 Section 3.2.1
     207                 :            :  *  The Parameter Types are encoded such that the highest-order two bits
     208                 :            :  *  specify the action that must be taken if the processing endpoint does
     209                 :            :  *  not recognize the Parameter Type.
     210                 :            :  *
     211                 :            :  */
     212                 :            : typedef enum {
     213                 :            :         SCTP_PARAM_ACTION_DISCARD     = cpu_to_be16(0x0000),
     214                 :            :         SCTP_PARAM_ACTION_DISCARD_ERR = cpu_to_be16(0x4000),
     215                 :            :         SCTP_PARAM_ACTION_SKIP        = cpu_to_be16(0x8000),
     216                 :            :         SCTP_PARAM_ACTION_SKIP_ERR    = cpu_to_be16(0xc000),
     217                 :            : } sctp_param_action_t;
     218                 :            : 
     219                 :            : enum { SCTP_PARAM_ACTION_MASK = cpu_to_be16(0xc000), };
     220                 :            : 
     221                 :            : /* RFC 2960 Section 3.3.1 Payload Data (DATA) (0) */
     222                 :            : 
     223                 :            : typedef struct sctp_datahdr {
     224                 :            :         __be32 tsn;
     225                 :            :         __be16 stream;
     226                 :            :         __be16 ssn;
     227                 :            :         __be32 ppid;
     228                 :            :         __u8  payload[0];
     229                 :            : } __packed sctp_datahdr_t;
     230                 :            : 
     231                 :            : typedef struct sctp_data_chunk {
     232                 :            :         sctp_chunkhdr_t chunk_hdr;
     233                 :            :         sctp_datahdr_t  data_hdr;
     234                 :            : } __packed sctp_data_chunk_t;
     235                 :            : 
     236                 :            : /* DATA Chuck Specific Flags */
     237                 :            : enum {
     238                 :            :         SCTP_DATA_MIDDLE_FRAG   = 0x00,
     239                 :            :         SCTP_DATA_LAST_FRAG     = 0x01,
     240                 :            :         SCTP_DATA_FIRST_FRAG    = 0x02,
     241                 :            :         SCTP_DATA_NOT_FRAG      = 0x03,
     242                 :            :         SCTP_DATA_UNORDERED     = 0x04,
     243                 :            :         SCTP_DATA_SACK_IMM      = 0x08,
     244                 :            : };
     245                 :            : enum { SCTP_DATA_FRAG_MASK = 0x03, };
     246                 :            : 
     247                 :            : 
     248                 :            : /* RFC 2960 Section 3.3.2 Initiation (INIT) (1)
     249                 :            :  *
     250                 :            :  *  This chunk is used to initiate a SCTP association between two
     251                 :            :  *  endpoints.
     252                 :            :  */
     253                 :            : typedef struct sctp_inithdr {
     254                 :            :         __be32 init_tag;
     255                 :            :         __be32 a_rwnd;
     256                 :            :         __be16 num_outbound_streams;
     257                 :            :         __be16 num_inbound_streams;
     258                 :            :         __be32 initial_tsn;
     259                 :            :         __u8  params[0];
     260                 :            : } __packed sctp_inithdr_t;
     261                 :            : 
     262                 :            : typedef struct sctp_init_chunk {
     263                 :            :         sctp_chunkhdr_t chunk_hdr;
     264                 :            :         sctp_inithdr_t init_hdr;
     265                 :            : } __packed sctp_init_chunk_t;
     266                 :            : 
     267                 :            : 
     268                 :            : /* Section 3.3.2.1. IPv4 Address Parameter (5) */
     269                 :            : typedef struct sctp_ipv4addr_param {
     270                 :            :         sctp_paramhdr_t param_hdr;
     271                 :            :         struct in_addr  addr;
     272                 :            : } __packed sctp_ipv4addr_param_t;
     273                 :            : 
     274                 :            : /* Section 3.3.2.1. IPv6 Address Parameter (6) */
     275                 :            : typedef struct sctp_ipv6addr_param {
     276                 :            :         sctp_paramhdr_t param_hdr;
     277                 :            :         struct in6_addr addr;
     278                 :            : } __packed sctp_ipv6addr_param_t;
     279                 :            : 
     280                 :            : /* Section 3.3.2.1 Cookie Preservative (9) */
     281                 :            : typedef struct sctp_cookie_preserve_param {
     282                 :            :         sctp_paramhdr_t param_hdr;
     283                 :            :         __be32          lifespan_increment;
     284                 :            : } __packed sctp_cookie_preserve_param_t;
     285                 :            : 
     286                 :            : /* Section 3.3.2.1 Host Name Address (11) */
     287                 :            : typedef struct sctp_hostname_param {
     288                 :            :         sctp_paramhdr_t param_hdr;
     289                 :            :         uint8_t hostname[0];
     290                 :            : } __packed sctp_hostname_param_t;
     291                 :            : 
     292                 :            : /* Section 3.3.2.1 Supported Address Types (12) */
     293                 :            : typedef struct sctp_supported_addrs_param {
     294                 :            :         sctp_paramhdr_t param_hdr;
     295                 :            :         __be16 types[0];
     296                 :            : } __packed sctp_supported_addrs_param_t;
     297                 :            : 
     298                 :            : /* Appendix A. ECN Capable (32768) */
     299                 :            : typedef struct sctp_ecn_capable_param {
     300                 :            :         sctp_paramhdr_t param_hdr;
     301                 :            : } __packed sctp_ecn_capable_param_t;
     302                 :            : 
     303                 :            : /* ADDIP Section 3.2.6 Adaptation Layer Indication */
     304                 :            : typedef struct sctp_adaptation_ind_param {
     305                 :            :         struct sctp_paramhdr param_hdr;
     306                 :            :         __be32 adaptation_ind;
     307                 :            : } __packed sctp_adaptation_ind_param_t;
     308                 :            : 
     309                 :            : /* ADDIP Section 4.2.7 Supported Extensions Parameter */
     310                 :            : typedef struct sctp_supported_ext_param {
     311                 :            :         struct sctp_paramhdr param_hdr;
     312                 :            :         __u8 chunks[0];
     313                 :            : } __packed sctp_supported_ext_param_t;
     314                 :            : 
     315                 :            : /* AUTH Section 3.1 Random */
     316                 :            : typedef struct sctp_random_param {
     317                 :            :         sctp_paramhdr_t param_hdr;
     318                 :            :         __u8 random_val[0];
     319                 :            : } __packed sctp_random_param_t;
     320                 :            : 
     321                 :            : /* AUTH Section 3.2 Chunk List */
     322                 :            : typedef struct sctp_chunks_param {
     323                 :            :         sctp_paramhdr_t param_hdr;
     324                 :            :         __u8 chunks[0];
     325                 :            : } __packed sctp_chunks_param_t;
     326                 :            : 
     327                 :            : /* AUTH Section 3.3 HMAC Algorithm */
     328                 :            : typedef struct sctp_hmac_algo_param {
     329                 :            :         sctp_paramhdr_t param_hdr;
     330                 :            :         __be16 hmac_ids[0];
     331                 :            : } __packed sctp_hmac_algo_param_t;
     332                 :            : 
     333                 :            : /* RFC 2960.  Section 3.3.3 Initiation Acknowledgement (INIT ACK) (2):
     334                 :            :  *   The INIT ACK chunk is used to acknowledge the initiation of an SCTP
     335                 :            :  *   association.
     336                 :            :  */
     337                 :            : typedef sctp_init_chunk_t sctp_initack_chunk_t;
     338                 :            : 
     339                 :            : /* Section 3.3.3.1 State Cookie (7) */
     340                 :            : typedef struct sctp_cookie_param {
     341                 :            :         sctp_paramhdr_t p;
     342                 :            :         __u8 body[0];
     343                 :            : } __packed sctp_cookie_param_t;
     344                 :            : 
     345                 :            : /* Section 3.3.3.1 Unrecognized Parameters (8) */
     346                 :            : typedef struct sctp_unrecognized_param {
     347                 :            :         sctp_paramhdr_t param_hdr;
     348                 :            :         sctp_paramhdr_t unrecognized;
     349                 :            : } __packed sctp_unrecognized_param_t;
     350                 :            : 
     351                 :            : 
     352                 :            : 
     353                 :            : /*
     354                 :            :  * 3.3.4 Selective Acknowledgement (SACK) (3):
     355                 :            :  *
     356                 :            :  *  This chunk is sent to the peer endpoint to acknowledge received DATA
     357                 :            :  *  chunks and to inform the peer endpoint of gaps in the received
     358                 :            :  *  subsequences of DATA chunks as represented by their TSNs.
     359                 :            :  */
     360                 :            : 
     361                 :            : typedef struct sctp_gap_ack_block {
     362                 :            :         __be16 start;
     363                 :            :         __be16 end;
     364                 :            : } __packed sctp_gap_ack_block_t;
     365                 :            : 
     366                 :            : typedef __be32 sctp_dup_tsn_t;
     367                 :            : 
     368                 :            : typedef union {
     369                 :            :         sctp_gap_ack_block_t    gab;
     370                 :            :         sctp_dup_tsn_t          dup;
     371                 :            : } sctp_sack_variable_t;
     372                 :            : 
     373                 :            : typedef struct sctp_sackhdr {
     374                 :            :         __be32 cum_tsn_ack;
     375                 :            :         __be32 a_rwnd;
     376                 :            :         __be16 num_gap_ack_blocks;
     377                 :            :         __be16 num_dup_tsns;
     378                 :            :         sctp_sack_variable_t variable[0];
     379                 :            : } __packed sctp_sackhdr_t;
     380                 :            : 
     381                 :            : typedef struct sctp_sack_chunk {
     382                 :            :         sctp_chunkhdr_t chunk_hdr;
     383                 :            :         sctp_sackhdr_t sack_hdr;
     384                 :            : } __packed sctp_sack_chunk_t;
     385                 :            : 
     386                 :            : 
     387                 :            : /* RFC 2960.  Section 3.3.5 Heartbeat Request (HEARTBEAT) (4):
     388                 :            :  *
     389                 :            :  *  An endpoint should send this chunk to its peer endpoint to probe the
     390                 :            :  *  reachability of a particular destination transport address defined in
     391                 :            :  *  the present association.
     392                 :            :  */
     393                 :            : 
     394                 :            : typedef struct sctp_heartbeathdr {
     395                 :            :         sctp_paramhdr_t info;
     396                 :            : } __packed sctp_heartbeathdr_t;
     397                 :            : 
     398                 :            : typedef struct sctp_heartbeat_chunk {
     399                 :            :         sctp_chunkhdr_t chunk_hdr;
     400                 :            :         sctp_heartbeathdr_t hb_hdr;
     401                 :            : } __packed sctp_heartbeat_chunk_t;
     402                 :            : 
     403                 :            : 
     404                 :            : /* For the abort and shutdown ACK we must carry the init tag in the
     405                 :            :  * common header. Just the common header is all that is needed with a
     406                 :            :  * chunk descriptor.
     407                 :            :  */
     408                 :            : typedef struct sctp_abort_chunk {
     409                 :            :         sctp_chunkhdr_t uh;
     410                 :            : } __packed sctp_abort_chunk_t;
     411                 :            : 
     412                 :            : 
     413                 :            : /* For the graceful shutdown we must carry the tag (in common header)
     414                 :            :  * and the highest consecutive acking value.
     415                 :            :  */
     416                 :            : typedef struct sctp_shutdownhdr {
     417                 :            :         __be32 cum_tsn_ack;
     418                 :            : } __packed sctp_shutdownhdr_t;
     419                 :            : 
     420                 :            : struct sctp_shutdown_chunk_t {
     421                 :            :         sctp_chunkhdr_t    chunk_hdr;
     422                 :            :         sctp_shutdownhdr_t shutdown_hdr;
     423                 :            : } __packed;
     424                 :            : 
     425                 :            : /* RFC 2960.  Section 3.3.10 Operation Error (ERROR) (9) */
     426                 :            : 
     427                 :            : typedef struct sctp_errhdr {
     428                 :            :         __be16 cause;
     429                 :            :         __be16 length;
     430                 :            :         __u8  variable[0];
     431                 :            : } __packed sctp_errhdr_t;
     432                 :            : 
     433                 :            : typedef struct sctp_operr_chunk {
     434                 :            :         sctp_chunkhdr_t chunk_hdr;
     435                 :            :         sctp_errhdr_t   err_hdr;
     436                 :            : } __packed sctp_operr_chunk_t;
     437                 :            : 
     438                 :            : /* RFC 2960 3.3.10 - Operation Error
     439                 :            :  *
     440                 :            :  * Cause Code: 16 bits (unsigned integer)
     441                 :            :  *
     442                 :            :  *     Defines the type of error conditions being reported.
     443                 :            :  *    Cause Code
     444                 :            :  *     Value           Cause Code
     445                 :            :  *     ---------      ----------------
     446                 :            :  *      1              Invalid Stream Identifier
     447                 :            :  *      2              Missing Mandatory Parameter
     448                 :            :  *      3              Stale Cookie Error
     449                 :            :  *      4              Out of Resource
     450                 :            :  *      5              Unresolvable Address
     451                 :            :  *      6              Unrecognized Chunk Type
     452                 :            :  *      7              Invalid Mandatory Parameter
     453                 :            :  *      8              Unrecognized Parameters
     454                 :            :  *      9              No User Data
     455                 :            :  *     10              Cookie Received While Shutting Down
     456                 :            :  */
     457                 :            : typedef enum {
     458                 :            : 
     459                 :            :         SCTP_ERROR_NO_ERROR        = cpu_to_be16(0x00),
     460                 :            :         SCTP_ERROR_INV_STRM        = cpu_to_be16(0x01),
     461                 :            :         SCTP_ERROR_MISS_PARAM      = cpu_to_be16(0x02),
     462                 :            :         SCTP_ERROR_STALE_COOKIE    = cpu_to_be16(0x03),
     463                 :            :         SCTP_ERROR_NO_RESOURCE     = cpu_to_be16(0x04),
     464                 :            :         SCTP_ERROR_DNS_FAILED      = cpu_to_be16(0x05),
     465                 :            :         SCTP_ERROR_UNKNOWN_CHUNK   = cpu_to_be16(0x06),
     466                 :            :         SCTP_ERROR_INV_PARAM       = cpu_to_be16(0x07),
     467                 :            :         SCTP_ERROR_UNKNOWN_PARAM   = cpu_to_be16(0x08),
     468                 :            :         SCTP_ERROR_NO_DATA         = cpu_to_be16(0x09),
     469                 :            :         SCTP_ERROR_COOKIE_IN_SHUTDOWN = cpu_to_be16(0x0a),
     470                 :            : 
     471                 :            : 
     472                 :            :         /* SCTP Implementation Guide:
     473                 :            :          *  11  Restart of an association with new addresses
     474                 :            :          *  12  User Initiated Abort
     475                 :            :          *  13  Protocol Violation
     476                 :            :          */
     477                 :            : 
     478                 :            :         SCTP_ERROR_RESTART         = cpu_to_be16(0x0b),
     479                 :            :         SCTP_ERROR_USER_ABORT      = cpu_to_be16(0x0c),
     480                 :            :         SCTP_ERROR_PROTO_VIOLATION = cpu_to_be16(0x0d),
     481                 :            : 
     482                 :            :         /* ADDIP Section 3.3  New Error Causes
     483                 :            :          *
     484                 :            :          * Four new Error Causes are added to the SCTP Operational Errors,
     485                 :            :          * primarily for use in the ASCONF-ACK chunk.
     486                 :            :          *
     487                 :            :          * Value          Cause Code
     488                 :            :          * ---------      ----------------
     489                 :            :          * 0x00A0          Request to Delete Last Remaining IP Address.
     490                 :            :          * 0x00A1          Operation Refused Due to Resource Shortage.
     491                 :            :          * 0x00A2          Request to Delete Source IP Address.
     492                 :            :          * 0x00A3          Association Aborted due to illegal ASCONF-ACK
     493                 :            :          * 0x00A4          Request refused - no authorization.
     494                 :            :          */
     495                 :            :         SCTP_ERROR_DEL_LAST_IP  = cpu_to_be16(0x00A0),
     496                 :            :         SCTP_ERROR_RSRC_LOW     = cpu_to_be16(0x00A1),
     497                 :            :         SCTP_ERROR_DEL_SRC_IP   = cpu_to_be16(0x00A2),
     498                 :            :         SCTP_ERROR_ASCONF_ACK   = cpu_to_be16(0x00A3),
     499                 :            :         SCTP_ERROR_REQ_REFUSED  = cpu_to_be16(0x00A4),
     500                 :            : 
     501                 :            :         /* AUTH Section 4.  New Error Cause
     502                 :            :          *
     503                 :            :          * This section defines a new error cause that will be sent if an AUTH
     504                 :            :          * chunk is received with an unsupported HMAC identifier.
     505                 :            :          * illustrates the new error cause.
     506                 :            :          *
     507                 :            :          * Cause Code      Error Cause Name
     508                 :            :          * --------------------------------------------------------------
     509                 :            :          * 0x0105          Unsupported HMAC Identifier
     510                 :            :          */
     511                 :            :          SCTP_ERROR_UNSUP_HMAC  = cpu_to_be16(0x0105)
     512                 :            : } sctp_error_t;
     513                 :            : 
     514                 :            : 
     515                 :            : 
     516                 :            : /* RFC 2960.  Appendix A.  Explicit Congestion Notification.
     517                 :            :  *   Explicit Congestion Notification Echo (ECNE) (12)
     518                 :            :  */
     519                 :            : typedef struct sctp_ecnehdr {
     520                 :            :         __be32 lowest_tsn;
     521                 :            : } sctp_ecnehdr_t;
     522                 :            : 
     523                 :            : typedef struct sctp_ecne_chunk {
     524                 :            :         sctp_chunkhdr_t chunk_hdr;
     525                 :            :         sctp_ecnehdr_t ence_hdr;
     526                 :            : } __packed sctp_ecne_chunk_t;
     527                 :            : 
     528                 :            : /* RFC 2960.  Appendix A.  Explicit Congestion Notification.
     529                 :            :  *   Congestion Window Reduced (CWR) (13)
     530                 :            :  */
     531                 :            : typedef struct sctp_cwrhdr {
     532                 :            :         __be32 lowest_tsn;
     533                 :            : } sctp_cwrhdr_t;
     534                 :            : 
     535                 :            : typedef struct sctp_cwr_chunk {
     536                 :            :         sctp_chunkhdr_t chunk_hdr;
     537                 :            :         sctp_cwrhdr_t cwr_hdr;
     538                 :            : } __packed sctp_cwr_chunk_t;
     539                 :            : 
     540                 :            : /* PR-SCTP
     541                 :            :  * 3.2 Forward Cumulative TSN Chunk Definition (FORWARD TSN)
     542                 :            :  *
     543                 :            :  * Forward Cumulative TSN chunk has the following format:
     544                 :            :  *
     545                 :            :  *        0                   1                   2                   3
     546                 :            :  *        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     547                 :            :  *      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     548                 :            :  *      |   Type = 192  |  Flags = 0x00 |        Length = Variable      |
     549                 :            :  *      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     550                 :            :  *      |                      New Cumulative TSN                       |
     551                 :            :  *      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     552                 :            :  *      |         Stream-1              |       Stream Sequence-1       |
     553                 :            :  *      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     554                 :            :  *      \                                                               /
     555                 :            :  *      /                                                               \
     556                 :            :  *      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     557                 :            :  *      |         Stream-N              |       Stream Sequence-N       |
     558                 :            :  *      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     559                 :            :  *
     560                 :            :  *      Chunk Flags:
     561                 :            :  *
     562                 :            :  *        Set to all zeros on transmit and ignored on receipt.
     563                 :            :  *
     564                 :            :  *      New Cumulative TSN: 32 bit u_int
     565                 :            :  *
     566                 :            :  *       This indicates the new cumulative TSN to the data receiver. Upon
     567                 :            :  *       the reception of this value, the data receiver MUST consider
     568                 :            :  *       any missing TSNs earlier than or equal to this value as received
     569                 :            :  *       and stop reporting them as gaps in any subsequent SACKs.
     570                 :            :  *
     571                 :            :  *      Stream-N: 16 bit u_int
     572                 :            :  *
     573                 :            :  *       This field holds a stream number that was skipped by this
     574                 :            :  *       FWD-TSN.
     575                 :            :  *
     576                 :            :  *      Stream Sequence-N: 16 bit u_int
     577                 :            :  *       This field holds the sequence number associated with the stream
     578                 :            :  *       that was skipped. The stream sequence field holds the largest stream
     579                 :            :  *       sequence number in this stream being skipped.  The receiver of
     580                 :            :  *       the FWD-TSN's can use the Stream-N and Stream Sequence-N fields
     581                 :            :  *       to enable delivery of any stranded TSN's that remain on the stream
     582                 :            :  *       re-ordering queues. This field MUST NOT report TSN's corresponding
     583                 :            :  *       to DATA chunk that are marked as unordered. For ordered DATA
     584                 :            :  *       chunks this field MUST be filled in.
     585                 :            :  */
     586                 :            : struct sctp_fwdtsn_skip {
     587                 :            :         __be16 stream;
     588                 :            :         __be16 ssn;
     589                 :            : } __packed;
     590                 :            : 
     591                 :            : struct sctp_fwdtsn_hdr {
     592                 :            :         __be32 new_cum_tsn;
     593                 :            :         struct sctp_fwdtsn_skip skip[0];
     594                 :            : } __packed;
     595                 :            : 
     596                 :            : struct sctp_fwdtsn_chunk {
     597                 :            :         struct sctp_chunkhdr chunk_hdr;
     598                 :            :         struct sctp_fwdtsn_hdr fwdtsn_hdr;
     599                 :            : } __packed;
     600                 :            : 
     601                 :            : 
     602                 :            : /* ADDIP
     603                 :            :  * Section 3.1.1 Address Configuration Change Chunk (ASCONF)
     604                 :            :  *
     605                 :            :  *      Serial Number: 32 bits (unsigned integer)
     606                 :            :  *      This value represents a Serial Number for the ASCONF Chunk. The
     607                 :            :  *      valid range of Serial Number is from 0 to 2^32-1.
     608                 :            :  *      Serial Numbers wrap back to 0 after reaching 2^32 -1.
     609                 :            :  *
     610                 :            :  *      Address Parameter: 8 or 20 bytes (depending on type)
     611                 :            :  *      The address is an address of the sender of the ASCONF chunk,
     612                 :            :  *      the address MUST be considered part of the association by the
     613                 :            :  *      peer endpoint. This field may be used by the receiver of the 
     614                 :            :  *      ASCONF to help in finding the association. This parameter MUST
     615                 :            :  *      be present in every ASCONF message i.e. it is a mandatory TLV
     616                 :            :  *      parameter.
     617                 :            :  *
     618                 :            :  *      ASCONF Parameter: TLV format
     619                 :            :  *      Each Address configuration change is represented by a TLV
     620                 :            :  *      parameter as defined in Section 3.2. One or more requests may
     621                 :            :  *      be present in an ASCONF Chunk.
     622                 :            :  *
     623                 :            :  * Section 3.1.2 Address Configuration Acknowledgement Chunk (ASCONF-ACK)
     624                 :            :  * 
     625                 :            :  *      Serial Number: 32 bits (unsigned integer)
     626                 :            :  *      This value represents the Serial Number for the received ASCONF
     627                 :            :  *      Chunk that is acknowledged by this chunk. This value is copied
     628                 :            :  *      from the received ASCONF Chunk. 
     629                 :            :  *
     630                 :            :  *      ASCONF Parameter Response: TLV format
     631                 :            :  *      The ASCONF Parameter Response is used in the ASCONF-ACK to
     632                 :            :  *      report status of ASCONF processing.
     633                 :            :  */
     634                 :            : typedef struct sctp_addip_param {
     635                 :            :         sctp_paramhdr_t param_hdr;
     636                 :            :         __be32          crr_id;
     637                 :            : } __packed sctp_addip_param_t;
     638                 :            : 
     639                 :            : typedef struct sctp_addiphdr {
     640                 :            :         __be32  serial;
     641                 :            :         __u8    params[0];
     642                 :            : } __packed sctp_addiphdr_t;
     643                 :            : 
     644                 :            : typedef struct sctp_addip_chunk {
     645                 :            :         sctp_chunkhdr_t chunk_hdr;
     646                 :            :         sctp_addiphdr_t addip_hdr;
     647                 :            : } __packed sctp_addip_chunk_t;
     648                 :            : 
     649                 :            : /* AUTH
     650                 :            :  * Section 4.1  Authentication Chunk (AUTH)
     651                 :            :  *
     652                 :            :  *   This chunk is used to hold the result of the HMAC calculation.
     653                 :            :  *
     654                 :            :  *    0                   1                   2                   3
     655                 :            :  *    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     656                 :            :  *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     657                 :            :  *   | Type = 0x0F   |   Flags=0     |             Length            |
     658                 :            :  *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     659                 :            :  *   |     Shared Key Identifier     |   HMAC Identifier             |
     660                 :            :  *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     661                 :            :  *   |                                                               |
     662                 :            :  *   \                             HMAC                              /
     663                 :            :  *   /                                                               \
     664                 :            :  *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     665                 :            :  *
     666                 :            :  *   Type: 1 byte (unsigned integer)
     667                 :            :  *      This value MUST be set to 0x0F for  all AUTH-chunks.
     668                 :            :  *
     669                 :            :  *   Flags: 1 byte (unsigned integer)
     670                 :            :  *      Set to zero on transmit and ignored on receipt.
     671                 :            :  *
     672                 :            :  *   Length: 2 bytes (unsigned integer)
     673                 :            :  *      This value holds the length of the HMAC in bytes plus 8.
     674                 :            :  *
     675                 :            :  *  Shared Key Identifier: 2 bytes (unsigned integer)
     676                 :            :  *      This value describes which endpoint pair shared key is used.
     677                 :            :  *
     678                 :            :  *   HMAC Identifier: 2 bytes (unsigned integer)
     679                 :            :  *      This value describes which message digest is being used.  Table 2
     680                 :            :  *      shows the currently defined values.
     681                 :            :  *
     682                 :            :  *    The following Table 2 shows the currently defined values for HMAC
     683                 :            :  *       identifiers.
     684                 :            :  *
     685                 :            :  *       +-----------------+--------------------------+
     686                 :            :  *       | HMAC Identifier | Message Digest Algorithm |
     687                 :            :  *       +-----------------+--------------------------+
     688                 :            :  *       | 0               | Reserved                 |
     689                 :            :  *       | 1               | SHA-1 defined in [8]     |
     690                 :            :  *       | 2               | Reserved                 |
     691                 :            :  *       | 3               | SHA-256 defined in [8]   |
     692                 :            :  *       +-----------------+--------------------------+
     693                 :            :  *
     694                 :            :  *
     695                 :            :  *   HMAC: n bytes (unsigned integer) This hold the result of the HMAC
     696                 :            :  *      calculation.
     697                 :            :  */
     698                 :            : typedef struct sctp_authhdr {
     699                 :            :         __be16 shkey_id;
     700                 :            :         __be16 hmac_id;
     701                 :            :         __u8   hmac[0];
     702                 :            : } __packed sctp_authhdr_t;
     703                 :            : 
     704                 :            : typedef struct sctp_auth_chunk {
     705                 :            :         sctp_chunkhdr_t chunk_hdr;
     706                 :            :         sctp_authhdr_t auth_hdr;
     707                 :            : } __packed sctp_auth_chunk_t;
     708                 :            : 
     709                 :            : #endif /* __LINUX_SCTP_H__ */

Generated by: LCOV version 1.9