Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /* SCTP kernel reference Implementation
0003  * (C) Copyright IBM Corp. 2001, 2004
0004  * Copyright (c) 1999-2000 Cisco, Inc.
0005  * Copyright (c) 1999-2001 Motorola, Inc.
0006  * Copyright (c) 2001 Intel Corp.
0007  * Copyright (c) 2001 Nokia, Inc.
0008  * Copyright (c) 2001 La Monte H.P. Yarroll
0009  *
0010  * This file is part of the SCTP kernel reference Implementation
0011  *
0012  * Various protocol defined structures.
0013  *
0014  * Please send any bug reports or fixes you make to the
0015  * email address(es):
0016  *    lksctp developers <linux-sctp@vger.kernel.org>
0017  *
0018  * Or submit a bug report through the following website:
0019  *    http://www.sf.net/projects/lksctp
0020  *
0021  * Written or modified by:
0022  *    La Monte H.P. Yarroll <piggy@acm.org>
0023  *    Karl Knutson <karl@athena.chicago.il.us>
0024  *    Jon Grimm <jgrimm@us.ibm.com>
0025  *    Xingang Guo <xingang.guo@intel.com>
0026  *    randall@sctp.chicago.il.us
0027  *    kmorneau@cisco.com
0028  *    qxie1@email.mot.com
0029  *    Sridhar Samudrala <sri@us.ibm.com>
0030  *    Kevin Gao <kevin.gao@intel.com>
0031  *
0032  * Any bugs reported given to us we will try to fix... any fixes shared will
0033  * be incorporated into the next SCTP release.
0034  */
0035 #ifndef __LINUX_SCTP_H__
0036 #define __LINUX_SCTP_H__
0037 
0038 #include <linux/in.h>       /* We need in_addr.  */
0039 #include <linux/in6.h>      /* We need in6_addr.  */
0040 #include <linux/skbuff.h>
0041 
0042 #include <uapi/linux/sctp.h>
0043 
0044 /* Section 3.1.  SCTP Common Header Format */
0045 struct sctphdr {
0046     __be16 source;
0047     __be16 dest;
0048     __be32 vtag;
0049     __le32 checksum;
0050 };
0051 
0052 static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb)
0053 {
0054     return (struct sctphdr *)skb_transport_header(skb);
0055 }
0056 
0057 /* Section 3.2.  Chunk Field Descriptions. */
0058 struct sctp_chunkhdr {
0059     __u8 type;
0060     __u8 flags;
0061     __be16 length;
0062 };
0063 
0064 
0065 /* Section 3.2.  Chunk Type Values.
0066  * [Chunk Type] identifies the type of information contained in the Chunk
0067  * Value field. It takes a value from 0 to 254. The value of 255 is
0068  * reserved for future use as an extension field.
0069  */
0070 enum sctp_cid {
0071     SCTP_CID_DATA           = 0,
0072         SCTP_CID_INIT           = 1,
0073         SCTP_CID_INIT_ACK       = 2,
0074         SCTP_CID_SACK           = 3,
0075         SCTP_CID_HEARTBEAT      = 4,
0076         SCTP_CID_HEARTBEAT_ACK      = 5,
0077         SCTP_CID_ABORT          = 6,
0078         SCTP_CID_SHUTDOWN       = 7,
0079         SCTP_CID_SHUTDOWN_ACK       = 8,
0080         SCTP_CID_ERROR          = 9,
0081         SCTP_CID_COOKIE_ECHO        = 10,
0082         SCTP_CID_COOKIE_ACK         = 11,
0083         SCTP_CID_ECN_ECNE       = 12,
0084         SCTP_CID_ECN_CWR        = 13,
0085         SCTP_CID_SHUTDOWN_COMPLETE  = 14,
0086 
0087     /* AUTH Extension Section 4.1 */
0088     SCTP_CID_AUTH           = 0x0F,
0089 
0090     /* sctp ndata 5.1. I-DATA */
0091     SCTP_CID_I_DATA         = 0x40,
0092 
0093     /* PR-SCTP Sec 3.2 */
0094     SCTP_CID_FWD_TSN        = 0xC0,
0095 
0096     /* Use hex, as defined in ADDIP sec. 3.1 */
0097     SCTP_CID_ASCONF         = 0xC1,
0098     SCTP_CID_I_FWD_TSN      = 0xC2,
0099     SCTP_CID_ASCONF_ACK     = 0x80,
0100     SCTP_CID_RECONF         = 0x82,
0101     SCTP_CID_PAD            = 0x84,
0102 }; /* enum */
0103 
0104 
0105 /* Section 3.2
0106  *  Chunk Types are encoded such that the highest-order two bits specify
0107  *  the action that must be taken if the processing endpoint does not
0108  *  recognize the Chunk Type.
0109  */
0110 enum {
0111     SCTP_CID_ACTION_DISCARD     = 0x00,
0112     SCTP_CID_ACTION_DISCARD_ERR = 0x40,
0113     SCTP_CID_ACTION_SKIP        = 0x80,
0114     SCTP_CID_ACTION_SKIP_ERR    = 0xc0,
0115 };
0116 
0117 enum { SCTP_CID_ACTION_MASK = 0xc0, };
0118 
0119 /* This flag is used in Chunk Flags for ABORT and SHUTDOWN COMPLETE.
0120  *
0121  * 3.3.7 Abort Association (ABORT) (6):
0122  *    The T bit is set to 0 if the sender had a TCB that it destroyed.
0123  *    If the sender did not have a TCB it should set this bit to 1.
0124  */
0125 enum { SCTP_CHUNK_FLAG_T = 0x01 };
0126 
0127 /*
0128  *  Set the T bit
0129  *
0130  *      0                   1                   2                   3
0131  *      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
0132  *     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0133  *     |   Type = 14   |Reserved     |T|      Length = 4               |
0134  *     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0135  *
0136  * Chunk Flags: 8 bits
0137  *
0138  *   Reserved:  7 bits
0139  *     Set to 0 on transmit and ignored on receipt.
0140  *
0141  *   T bit:  1 bit
0142  *     The T bit is set to 0 if the sender had a TCB that it destroyed. If
0143  *     the sender did NOT have a TCB it should set this bit to 1.
0144  *
0145  * Note: Special rules apply to this chunk for verification, please
0146  * see Section 8.5.1 for details.
0147  */
0148 
0149 #define sctp_test_T_bit(c)    ((c)->chunk_hdr->flags & SCTP_CHUNK_FLAG_T)
0150 
0151 /* RFC 2960
0152  * Section 3.2.1 Optional/Variable-length Parmaeter Format.
0153  */
0154 
0155 struct sctp_paramhdr {
0156     __be16 type;
0157     __be16 length;
0158 };
0159 
0160 enum sctp_param {
0161 
0162     /* RFC 2960 Section 3.3.5 */
0163     SCTP_PARAM_HEARTBEAT_INFO       = cpu_to_be16(1),
0164     /* RFC 2960 Section 3.3.2.1 */
0165     SCTP_PARAM_IPV4_ADDRESS         = cpu_to_be16(5),
0166     SCTP_PARAM_IPV6_ADDRESS         = cpu_to_be16(6),
0167     SCTP_PARAM_STATE_COOKIE         = cpu_to_be16(7),
0168     SCTP_PARAM_UNRECOGNIZED_PARAMETERS  = cpu_to_be16(8),
0169     SCTP_PARAM_COOKIE_PRESERVATIVE      = cpu_to_be16(9),
0170     SCTP_PARAM_HOST_NAME_ADDRESS        = cpu_to_be16(11),
0171     SCTP_PARAM_SUPPORTED_ADDRESS_TYPES  = cpu_to_be16(12),
0172     SCTP_PARAM_ECN_CAPABLE          = cpu_to_be16(0x8000),
0173 
0174     /* AUTH Extension Section 3 */
0175     SCTP_PARAM_RANDOM           = cpu_to_be16(0x8002),
0176     SCTP_PARAM_CHUNKS           = cpu_to_be16(0x8003),
0177     SCTP_PARAM_HMAC_ALGO            = cpu_to_be16(0x8004),
0178 
0179     /* Add-IP: Supported Extensions, Section 4.2 */
0180     SCTP_PARAM_SUPPORTED_EXT    = cpu_to_be16(0x8008),
0181 
0182     /* PR-SCTP Sec 3.1 */
0183     SCTP_PARAM_FWD_TSN_SUPPORT  = cpu_to_be16(0xc000),
0184 
0185     /* Add-IP Extension. Section 3.2 */
0186     SCTP_PARAM_ADD_IP       = cpu_to_be16(0xc001),
0187     SCTP_PARAM_DEL_IP       = cpu_to_be16(0xc002),
0188     SCTP_PARAM_ERR_CAUSE        = cpu_to_be16(0xc003),
0189     SCTP_PARAM_SET_PRIMARY      = cpu_to_be16(0xc004),
0190     SCTP_PARAM_SUCCESS_REPORT   = cpu_to_be16(0xc005),
0191     SCTP_PARAM_ADAPTATION_LAYER_IND = cpu_to_be16(0xc006),
0192 
0193     /* RE-CONFIG. Section 4 */
0194     SCTP_PARAM_RESET_OUT_REQUEST        = cpu_to_be16(0x000d),
0195     SCTP_PARAM_RESET_IN_REQUEST     = cpu_to_be16(0x000e),
0196     SCTP_PARAM_RESET_TSN_REQUEST        = cpu_to_be16(0x000f),
0197     SCTP_PARAM_RESET_RESPONSE       = cpu_to_be16(0x0010),
0198     SCTP_PARAM_RESET_ADD_OUT_STREAMS    = cpu_to_be16(0x0011),
0199     SCTP_PARAM_RESET_ADD_IN_STREAMS     = cpu_to_be16(0x0012),
0200 }; /* enum */
0201 
0202 
0203 /* RFC 2960 Section 3.2.1
0204  *  The Parameter Types are encoded such that the highest-order two bits
0205  *  specify the action that must be taken if the processing endpoint does
0206  *  not recognize the Parameter Type.
0207  *
0208  */
0209 enum {
0210     SCTP_PARAM_ACTION_DISCARD     = cpu_to_be16(0x0000),
0211     SCTP_PARAM_ACTION_DISCARD_ERR = cpu_to_be16(0x4000),
0212     SCTP_PARAM_ACTION_SKIP        = cpu_to_be16(0x8000),
0213     SCTP_PARAM_ACTION_SKIP_ERR    = cpu_to_be16(0xc000),
0214 };
0215 
0216 enum { SCTP_PARAM_ACTION_MASK = cpu_to_be16(0xc000), };
0217 
0218 /* RFC 2960 Section 3.3.1 Payload Data (DATA) (0) */
0219 
0220 struct sctp_datahdr {
0221     __be32 tsn;
0222     __be16 stream;
0223     __be16 ssn;
0224     __u32 ppid;
0225     __u8  payload[];
0226 };
0227 
0228 struct sctp_data_chunk {
0229     struct sctp_chunkhdr chunk_hdr;
0230     struct sctp_datahdr data_hdr;
0231 };
0232 
0233 struct sctp_idatahdr {
0234     __be32 tsn;
0235     __be16 stream;
0236     __be16 reserved;
0237     __be32 mid;
0238     union {
0239         __u32 ppid;
0240         __be32 fsn;
0241     };
0242     __u8 payload[0];
0243 };
0244 
0245 struct sctp_idata_chunk {
0246     struct sctp_chunkhdr chunk_hdr;
0247     struct sctp_idatahdr data_hdr;
0248 };
0249 
0250 /* DATA Chuck Specific Flags */
0251 enum {
0252     SCTP_DATA_MIDDLE_FRAG   = 0x00,
0253     SCTP_DATA_LAST_FRAG = 0x01,
0254     SCTP_DATA_FIRST_FRAG    = 0x02,
0255     SCTP_DATA_NOT_FRAG  = 0x03,
0256     SCTP_DATA_UNORDERED = 0x04,
0257     SCTP_DATA_SACK_IMM  = 0x08,
0258 };
0259 enum { SCTP_DATA_FRAG_MASK = 0x03, };
0260 
0261 
0262 /* RFC 2960 Section 3.3.2 Initiation (INIT) (1)
0263  *
0264  *  This chunk is used to initiate a SCTP association between two
0265  *  endpoints.
0266  */
0267 struct sctp_inithdr {
0268     __be32 init_tag;
0269     __be32 a_rwnd;
0270     __be16 num_outbound_streams;
0271     __be16 num_inbound_streams;
0272     __be32 initial_tsn;
0273     __u8  params[];
0274 };
0275 
0276 struct sctp_init_chunk {
0277     struct sctp_chunkhdr chunk_hdr;
0278     struct sctp_inithdr init_hdr;
0279 };
0280 
0281 
0282 /* Section 3.3.2.1. IPv4 Address Parameter (5) */
0283 struct sctp_ipv4addr_param {
0284     struct sctp_paramhdr param_hdr;
0285     struct in_addr addr;
0286 };
0287 
0288 /* Section 3.3.2.1. IPv6 Address Parameter (6) */
0289 struct sctp_ipv6addr_param {
0290     struct sctp_paramhdr param_hdr;
0291     struct in6_addr addr;
0292 };
0293 
0294 /* Section 3.3.2.1 Cookie Preservative (9) */
0295 struct sctp_cookie_preserve_param {
0296     struct sctp_paramhdr param_hdr;
0297     __be32 lifespan_increment;
0298 };
0299 
0300 /* Section 3.3.2.1 Host Name Address (11) */
0301 struct sctp_hostname_param {
0302     struct sctp_paramhdr param_hdr;
0303     uint8_t hostname[];
0304 };
0305 
0306 /* Section 3.3.2.1 Supported Address Types (12) */
0307 struct sctp_supported_addrs_param {
0308     struct sctp_paramhdr param_hdr;
0309     __be16 types[];
0310 };
0311 
0312 /* ADDIP Section 3.2.6 Adaptation Layer Indication */
0313 struct sctp_adaptation_ind_param {
0314     struct sctp_paramhdr param_hdr;
0315     __be32 adaptation_ind;
0316 };
0317 
0318 /* ADDIP Section 4.2.7 Supported Extensions Parameter */
0319 struct sctp_supported_ext_param {
0320     struct sctp_paramhdr param_hdr;
0321     __u8 chunks[];
0322 };
0323 
0324 /* AUTH Section 3.1 Random */
0325 struct sctp_random_param {
0326     struct sctp_paramhdr param_hdr;
0327     __u8 random_val[];
0328 };
0329 
0330 /* AUTH Section 3.2 Chunk List */
0331 struct sctp_chunks_param {
0332     struct sctp_paramhdr param_hdr;
0333     __u8 chunks[];
0334 };
0335 
0336 /* AUTH Section 3.3 HMAC Algorithm */
0337 struct sctp_hmac_algo_param {
0338     struct sctp_paramhdr param_hdr;
0339     __be16 hmac_ids[];
0340 };
0341 
0342 /* RFC 2960.  Section 3.3.3 Initiation Acknowledgement (INIT ACK) (2):
0343  *   The INIT ACK chunk is used to acknowledge the initiation of an SCTP
0344  *   association.
0345  */
0346 struct sctp_initack_chunk {
0347     struct sctp_chunkhdr chunk_hdr;
0348     struct sctp_inithdr init_hdr;
0349 };
0350 
0351 /* Section 3.3.3.1 State Cookie (7) */
0352 struct sctp_cookie_param {
0353     struct sctp_paramhdr p;
0354     __u8 body[];
0355 };
0356 
0357 /* Section 3.3.3.1 Unrecognized Parameters (8) */
0358 struct sctp_unrecognized_param {
0359     struct sctp_paramhdr param_hdr;
0360     struct sctp_paramhdr unrecognized;
0361 };
0362 
0363 
0364 
0365 /*
0366  * 3.3.4 Selective Acknowledgement (SACK) (3):
0367  *
0368  *  This chunk is sent to the peer endpoint to acknowledge received DATA
0369  *  chunks and to inform the peer endpoint of gaps in the received
0370  *  subsequences of DATA chunks as represented by their TSNs.
0371  */
0372 
0373 struct sctp_gap_ack_block {
0374     __be16 start;
0375     __be16 end;
0376 };
0377 
0378 union sctp_sack_variable {
0379     struct sctp_gap_ack_block gab;
0380     __be32 dup;
0381 };
0382 
0383 struct sctp_sackhdr {
0384     __be32 cum_tsn_ack;
0385     __be32 a_rwnd;
0386     __be16 num_gap_ack_blocks;
0387     __be16 num_dup_tsns;
0388     union sctp_sack_variable variable[];
0389 };
0390 
0391 struct sctp_sack_chunk {
0392     struct sctp_chunkhdr chunk_hdr;
0393     struct sctp_sackhdr sack_hdr;
0394 };
0395 
0396 
0397 /* RFC 2960.  Section 3.3.5 Heartbeat Request (HEARTBEAT) (4):
0398  *
0399  *  An endpoint should send this chunk to its peer endpoint to probe the
0400  *  reachability of a particular destination transport address defined in
0401  *  the present association.
0402  */
0403 
0404 struct sctp_heartbeathdr {
0405     struct sctp_paramhdr info;
0406 };
0407 
0408 struct sctp_heartbeat_chunk {
0409     struct sctp_chunkhdr chunk_hdr;
0410     struct sctp_heartbeathdr hb_hdr;
0411 };
0412 
0413 
0414 /* PAD chunk could be bundled with heartbeat chunk to probe pmtu */
0415 struct sctp_pad_chunk {
0416     struct sctp_chunkhdr uh;
0417 };
0418 
0419 
0420 /* For the abort and shutdown ACK we must carry the init tag in the
0421  * common header. Just the common header is all that is needed with a
0422  * chunk descriptor.
0423  */
0424 struct sctp_abort_chunk {
0425     struct sctp_chunkhdr uh;
0426 };
0427 
0428 
0429 /* For the graceful shutdown we must carry the tag (in common header)
0430  * and the highest consecutive acking value.
0431  */
0432 struct sctp_shutdownhdr {
0433     __be32 cum_tsn_ack;
0434 };
0435 
0436 struct sctp_shutdown_chunk {
0437     struct sctp_chunkhdr chunk_hdr;
0438     struct sctp_shutdownhdr shutdown_hdr;
0439 };
0440 
0441 /* RFC 2960.  Section 3.3.10 Operation Error (ERROR) (9) */
0442 
0443 struct sctp_errhdr {
0444     __be16 cause;
0445     __be16 length;
0446     __u8  variable[];
0447 };
0448 
0449 struct sctp_operr_chunk {
0450     struct sctp_chunkhdr chunk_hdr;
0451     struct sctp_errhdr err_hdr;
0452 };
0453 
0454 /* RFC 2960 3.3.10 - Operation Error
0455  *
0456  * Cause Code: 16 bits (unsigned integer)
0457  *
0458  *     Defines the type of error conditions being reported.
0459  *    Cause Code
0460  *     Value           Cause Code
0461  *     ---------      ----------------
0462  *      1              Invalid Stream Identifier
0463  *      2              Missing Mandatory Parameter
0464  *      3              Stale Cookie Error
0465  *      4              Out of Resource
0466  *      5              Unresolvable Address
0467  *      6              Unrecognized Chunk Type
0468  *      7              Invalid Mandatory Parameter
0469  *      8              Unrecognized Parameters
0470  *      9              No User Data
0471  *     10              Cookie Received While Shutting Down
0472  */
0473 enum sctp_error {
0474 
0475     SCTP_ERROR_NO_ERROR    = cpu_to_be16(0x00),
0476     SCTP_ERROR_INV_STRM    = cpu_to_be16(0x01),
0477     SCTP_ERROR_MISS_PARAM      = cpu_to_be16(0x02),
0478     SCTP_ERROR_STALE_COOKIE    = cpu_to_be16(0x03),
0479     SCTP_ERROR_NO_RESOURCE     = cpu_to_be16(0x04),
0480     SCTP_ERROR_DNS_FAILED      = cpu_to_be16(0x05),
0481     SCTP_ERROR_UNKNOWN_CHUNK   = cpu_to_be16(0x06),
0482     SCTP_ERROR_INV_PARAM       = cpu_to_be16(0x07),
0483     SCTP_ERROR_UNKNOWN_PARAM   = cpu_to_be16(0x08),
0484     SCTP_ERROR_NO_DATA         = cpu_to_be16(0x09),
0485     SCTP_ERROR_COOKIE_IN_SHUTDOWN = cpu_to_be16(0x0a),
0486 
0487 
0488     /* SCTP Implementation Guide:
0489      *  11  Restart of an association with new addresses
0490      *  12  User Initiated Abort
0491      *  13  Protocol Violation
0492      *  14  Restart of an Association with New Encapsulation Port
0493      */
0494 
0495     SCTP_ERROR_RESTART         = cpu_to_be16(0x0b),
0496     SCTP_ERROR_USER_ABORT      = cpu_to_be16(0x0c),
0497     SCTP_ERROR_PROTO_VIOLATION = cpu_to_be16(0x0d),
0498     SCTP_ERROR_NEW_ENCAP_PORT  = cpu_to_be16(0x0e),
0499 
0500     /* ADDIP Section 3.3  New Error Causes
0501      *
0502      * Four new Error Causes are added to the SCTP Operational Errors,
0503      * primarily for use in the ASCONF-ACK chunk.
0504      *
0505      * Value          Cause Code
0506      * ---------      ----------------
0507      * 0x00A0          Request to Delete Last Remaining IP Address.
0508      * 0x00A1          Operation Refused Due to Resource Shortage.
0509      * 0x00A2          Request to Delete Source IP Address.
0510      * 0x00A3          Association Aborted due to illegal ASCONF-ACK
0511      * 0x00A4          Request refused - no authorization.
0512      */
0513     SCTP_ERROR_DEL_LAST_IP  = cpu_to_be16(0x00A0),
0514     SCTP_ERROR_RSRC_LOW = cpu_to_be16(0x00A1),
0515     SCTP_ERROR_DEL_SRC_IP   = cpu_to_be16(0x00A2),
0516     SCTP_ERROR_ASCONF_ACK   = cpu_to_be16(0x00A3),
0517     SCTP_ERROR_REQ_REFUSED  = cpu_to_be16(0x00A4),
0518 
0519     /* AUTH Section 4.  New Error Cause
0520      *
0521      * This section defines a new error cause that will be sent if an AUTH
0522      * chunk is received with an unsupported HMAC identifier.
0523      * illustrates the new error cause.
0524      *
0525      * Cause Code      Error Cause Name
0526      * --------------------------------------------------------------
0527      * 0x0105          Unsupported HMAC Identifier
0528      */
0529      SCTP_ERROR_UNSUP_HMAC  = cpu_to_be16(0x0105)
0530 };
0531 
0532 
0533 
0534 /* RFC 2960.  Appendix A.  Explicit Congestion Notification.
0535  *   Explicit Congestion Notification Echo (ECNE) (12)
0536  */
0537 struct sctp_ecnehdr {
0538     __be32 lowest_tsn;
0539 };
0540 
0541 struct sctp_ecne_chunk {
0542     struct sctp_chunkhdr chunk_hdr;
0543     struct sctp_ecnehdr ence_hdr;
0544 };
0545 
0546 /* RFC 2960.  Appendix A.  Explicit Congestion Notification.
0547  *   Congestion Window Reduced (CWR) (13)
0548  */
0549 struct sctp_cwrhdr {
0550     __be32 lowest_tsn;
0551 };
0552 
0553 /* PR-SCTP
0554  * 3.2 Forward Cumulative TSN Chunk Definition (FORWARD TSN)
0555  *
0556  * Forward Cumulative TSN chunk has the following format:
0557  *
0558  *        0                   1                   2                   3
0559  *        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
0560  *      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0561  *      |   Type = 192  |  Flags = 0x00 |        Length = Variable      |
0562  *      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0563  *      |                      New Cumulative TSN                       |
0564  *      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0565  *      |         Stream-1              |       Stream Sequence-1       |
0566  *      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0567  *      \                                                               /
0568  *      /                                                               \
0569  *      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0570  *      |         Stream-N              |       Stream Sequence-N       |
0571  *      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0572  *
0573  *      Chunk Flags:
0574  *
0575  *        Set to all zeros on transmit and ignored on receipt.
0576  *
0577  *      New Cumulative TSN: 32 bit u_int
0578  *
0579  *       This indicates the new cumulative TSN to the data receiver. Upon
0580  *       the reception of this value, the data receiver MUST consider
0581  *       any missing TSNs earlier than or equal to this value as received
0582  *       and stop reporting them as gaps in any subsequent SACKs.
0583  *
0584  *      Stream-N: 16 bit u_int
0585  *
0586  *       This field holds a stream number that was skipped by this
0587  *       FWD-TSN.
0588  *
0589  *      Stream Sequence-N: 16 bit u_int
0590  *       This field holds the sequence number associated with the stream
0591  *       that was skipped. The stream sequence field holds the largest stream
0592  *       sequence number in this stream being skipped.  The receiver of
0593  *       the FWD-TSN's can use the Stream-N and Stream Sequence-N fields
0594  *       to enable delivery of any stranded TSN's that remain on the stream
0595  *       re-ordering queues. This field MUST NOT report TSN's corresponding
0596  *       to DATA chunk that are marked as unordered. For ordered DATA
0597  *       chunks this field MUST be filled in.
0598  */
0599 struct sctp_fwdtsn_skip {
0600     __be16 stream;
0601     __be16 ssn;
0602 };
0603 
0604 struct sctp_fwdtsn_hdr {
0605     __be32 new_cum_tsn;
0606     struct sctp_fwdtsn_skip skip[];
0607 };
0608 
0609 struct sctp_fwdtsn_chunk {
0610     struct sctp_chunkhdr chunk_hdr;
0611     struct sctp_fwdtsn_hdr fwdtsn_hdr;
0612 };
0613 
0614 struct sctp_ifwdtsn_skip {
0615     __be16 stream;
0616     __u8 reserved;
0617     __u8 flags;
0618     __be32 mid;
0619 };
0620 
0621 struct sctp_ifwdtsn_hdr {
0622     __be32 new_cum_tsn;
0623     struct sctp_ifwdtsn_skip skip[];
0624 };
0625 
0626 struct sctp_ifwdtsn_chunk {
0627     struct sctp_chunkhdr chunk_hdr;
0628     struct sctp_ifwdtsn_hdr fwdtsn_hdr;
0629 };
0630 
0631 /* ADDIP
0632  * Section 3.1.1 Address Configuration Change Chunk (ASCONF)
0633  *
0634  *  Serial Number: 32 bits (unsigned integer)
0635  *  This value represents a Serial Number for the ASCONF Chunk. The
0636  *  valid range of Serial Number is from 0 to 2^32-1.
0637  *  Serial Numbers wrap back to 0 after reaching 2^32 -1.
0638  *
0639  *  Address Parameter: 8 or 20 bytes (depending on type)
0640  *  The address is an address of the sender of the ASCONF chunk,
0641  *  the address MUST be considered part of the association by the
0642  *  peer endpoint. This field may be used by the receiver of the 
0643  *  ASCONF to help in finding the association. This parameter MUST
0644  *  be present in every ASCONF message i.e. it is a mandatory TLV
0645  *  parameter.
0646  *
0647  *  ASCONF Parameter: TLV format
0648  *  Each Address configuration change is represented by a TLV
0649  *  parameter as defined in Section 3.2. One or more requests may
0650  *  be present in an ASCONF Chunk.
0651  *
0652  * Section 3.1.2 Address Configuration Acknowledgement Chunk (ASCONF-ACK)
0653  * 
0654  *  Serial Number: 32 bits (unsigned integer)
0655  *  This value represents the Serial Number for the received ASCONF
0656  *  Chunk that is acknowledged by this chunk. This value is copied
0657  *  from the received ASCONF Chunk. 
0658  *
0659  *  ASCONF Parameter Response: TLV format
0660  *  The ASCONF Parameter Response is used in the ASCONF-ACK to
0661  *  report status of ASCONF processing.
0662  */
0663 struct sctp_addip_param {
0664     struct sctp_paramhdr param_hdr;
0665     __be32 crr_id;
0666 };
0667 
0668 struct sctp_addiphdr {
0669     __be32  serial;
0670     __u8    params[];
0671 };
0672 
0673 struct sctp_addip_chunk {
0674     struct sctp_chunkhdr chunk_hdr;
0675     struct sctp_addiphdr addip_hdr;
0676 };
0677 
0678 /* AUTH
0679  * Section 4.1  Authentication Chunk (AUTH)
0680  *
0681  *   This chunk is used to hold the result of the HMAC calculation.
0682  *
0683  *    0                   1                   2                   3
0684  *    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
0685  *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0686  *   | Type = 0x0F   |   Flags=0     |             Length            |
0687  *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0688  *   |     Shared Key Identifier     |   HMAC Identifier             |
0689  *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0690  *   |                                                               |
0691  *   \                             HMAC                              /
0692  *   /                                                               \
0693  *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0694  *
0695  *   Type: 1 byte (unsigned integer)
0696  *      This value MUST be set to 0x0F for  all AUTH-chunks.
0697  *
0698  *   Flags: 1 byte (unsigned integer)
0699  *  Set to zero on transmit and ignored on receipt.
0700  *
0701  *   Length: 2 bytes (unsigned integer)
0702  *      This value holds the length of the HMAC in bytes plus 8.
0703  *
0704  *  Shared Key Identifier: 2 bytes (unsigned integer)
0705  *  This value describes which endpoint pair shared key is used.
0706  *
0707  *   HMAC Identifier: 2 bytes (unsigned integer)
0708  *      This value describes which message digest is being used.  Table 2
0709  *  shows the currently defined values.
0710  *
0711  *    The following Table 2 shows the currently defined values for HMAC
0712  *       identifiers.
0713  *
0714  *   +-----------------+--------------------------+
0715  *   | HMAC Identifier | Message Digest Algorithm |
0716  *   +-----------------+--------------------------+
0717  *   | 0               | Reserved                 |
0718  *   | 1               | SHA-1 defined in [8]     |
0719  *   | 2               | Reserved                 |
0720  *   | 3               | SHA-256 defined in [8]   |
0721  *   +-----------------+--------------------------+
0722  *
0723  *
0724  *   HMAC: n bytes (unsigned integer) This hold the result of the HMAC
0725  *      calculation.
0726  */
0727 struct sctp_authhdr {
0728     __be16 shkey_id;
0729     __be16 hmac_id;
0730     __u8   hmac[];
0731 };
0732 
0733 struct sctp_auth_chunk {
0734     struct sctp_chunkhdr chunk_hdr;
0735     struct sctp_authhdr auth_hdr;
0736 };
0737 
0738 struct sctp_infox {
0739     struct sctp_info *sctpinfo;
0740     struct sctp_association *asoc;
0741 };
0742 
0743 struct sctp_reconf_chunk {
0744     struct sctp_chunkhdr chunk_hdr;
0745     __u8 params[];
0746 };
0747 
0748 struct sctp_strreset_outreq {
0749     struct sctp_paramhdr param_hdr;
0750     __be32 request_seq;
0751     __be32 response_seq;
0752     __be32 send_reset_at_tsn;
0753     __be16 list_of_streams[];
0754 };
0755 
0756 struct sctp_strreset_inreq {
0757     struct sctp_paramhdr param_hdr;
0758     __be32 request_seq;
0759     __be16 list_of_streams[];
0760 };
0761 
0762 struct sctp_strreset_tsnreq {
0763     struct sctp_paramhdr param_hdr;
0764     __be32 request_seq;
0765 };
0766 
0767 struct sctp_strreset_addstrm {
0768     struct sctp_paramhdr param_hdr;
0769     __be32 request_seq;
0770     __be16 number_of_streams;
0771     __be16 reserved;
0772 };
0773 
0774 enum {
0775     SCTP_STRRESET_NOTHING_TO_DO = 0x00,
0776     SCTP_STRRESET_PERFORMED     = 0x01,
0777     SCTP_STRRESET_DENIED        = 0x02,
0778     SCTP_STRRESET_ERR_WRONG_SSN = 0x03,
0779     SCTP_STRRESET_ERR_IN_PROGRESS   = 0x04,
0780     SCTP_STRRESET_ERR_BAD_SEQNO = 0x05,
0781     SCTP_STRRESET_IN_PROGRESS   = 0x06,
0782 };
0783 
0784 struct sctp_strreset_resp {
0785     struct sctp_paramhdr param_hdr;
0786     __be32 response_seq;
0787     __be32 result;
0788 };
0789 
0790 struct sctp_strreset_resptsn {
0791     struct sctp_paramhdr param_hdr;
0792     __be32 response_seq;
0793     __be32 result;
0794     __be32 senders_next_tsn;
0795     __be32 receivers_next_tsn;
0796 };
0797 
0798 enum {
0799     SCTP_DSCP_SET_MASK = 0x1,
0800     SCTP_DSCP_VAL_MASK = 0xfc,
0801     SCTP_FLOWLABEL_SET_MASK = 0x100000,
0802     SCTP_FLOWLABEL_VAL_MASK = 0xfffff
0803 };
0804 
0805 /* UDP Encapsulation
0806  * draft-tuexen-tsvwg-sctp-udp-encaps-cons-03.html#section-4-4
0807  *
0808  *   The error cause indicating an "Restart of an Association with
0809  *   New Encapsulation Port"
0810  *
0811  * 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
0812  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0813  * |        Cause Code = 14        |       Cause Length = 8        |
0814  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0815  * |   Current Encapsulation Port  |     New Encapsulation Port    |
0816  * +-------------------------------+-------------------------------+
0817  */
0818 struct sctp_new_encap_port_hdr {
0819     __be16 cur_port;
0820     __be16 new_port;
0821 };
0822 
0823 #endif /* __LINUX_SCTP_H__ */