[XFS] Fix merge failures
[pandora-kernel.git] / include / linux / sctp.h
index 35108fe..8ba1c32 100644 (file)
  *
  * Various protocol defined structures.
  *
- * The SCTP reference implementation is free software;
+ * This SCTP implementation is free software;
  * you can redistribute it and/or modify it under the terms of
  * the GNU General Public License as published by
  * the Free Software Foundation; either version 2, or (at your option)
  * any later version.
  *
- * The SCTP reference implementation is distributed in the hope that it
+ * This SCTP implementation is distributed in the hope that it
  * will be useful, but WITHOUT ANY WARRANTY; without even the implied
  *                 ************************
  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@@ -63,6 +63,15 @@ typedef struct sctphdr {
        __be32 checksum;
 } __attribute__((packed)) sctp_sctphdr_t;
 
+#ifdef __KERNEL__
+#include <linux/skbuff.h>
+
+static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb)
+{
+       return (struct sctphdr *)skb_transport_header(skb);
+}
+#endif
+
 /* Section 3.2.  Chunk Field Descriptions. */
 typedef struct sctp_chunkhdr {
        __u8 type;
@@ -93,6 +102,9 @@ typedef enum {
         SCTP_CID_ECN_CWR               = 13,
         SCTP_CID_SHUTDOWN_COMPLETE     = 14,
 
+       /* AUTH Extension Section 4.1 */
+       SCTP_CID_AUTH                   = 0x0F,
+
        /* PR-SCTP Sec 3.2 */
        SCTP_CID_FWD_TSN                = 0xC0,
 
@@ -171,6 +183,14 @@ typedef enum {
        SCTP_PARAM_SUPPORTED_ADDRESS_TYPES      = __constant_htons(12),
        SCTP_PARAM_ECN_CAPABLE                  = __constant_htons(0x8000),
 
+       /* AUTH Extension Section 3 */
+       SCTP_PARAM_RANDOM                       = __constant_htons(0x8002),
+       SCTP_PARAM_CHUNKS                       = __constant_htons(0x8003),
+       SCTP_PARAM_HMAC_ALGO                    = __constant_htons(0x8004),
+
+       /* Add-IP: Supported Extensions, Section 4.2 */
+       SCTP_PARAM_SUPPORTED_EXT        = __constant_htons(0x8008),
+
        /* PR-SCTP Sec 3.1 */
        SCTP_PARAM_FWD_TSN_SUPPORT      = __constant_htons(0xc000),
 
@@ -180,7 +200,7 @@ typedef enum {
        SCTP_PARAM_ERR_CAUSE            = __constant_htons(0xc003),
        SCTP_PARAM_SET_PRIMARY          = __constant_htons(0xc004),
        SCTP_PARAM_SUCCESS_REPORT       = __constant_htons(0xc005),
-       SCTP_PARAM_ADAPTION_LAYER_IND   = __constant_htons(0xc006),
+       SCTP_PARAM_ADAPTATION_LAYER_IND = __constant_htons(0xc006),
 
 } sctp_param_t; /* enum */
 
@@ -281,11 +301,35 @@ typedef struct sctp_ecn_capable_param {
        sctp_paramhdr_t param_hdr;
 } __attribute__((packed)) sctp_ecn_capable_param_t;
 
-/* ADDIP Section 3.2.6 Adaption Layer Indication */
-typedef struct sctp_adaption_ind_param {
+/* ADDIP Section 3.2.6 Adaptation Layer Indication */
+typedef struct sctp_adaptation_ind_param {
+       struct sctp_paramhdr param_hdr;
+       __be32 adaptation_ind;
+} __attribute__((packed)) sctp_adaptation_ind_param_t;
+
+/* ADDIP Section 4.2.7 Supported Extensions Parameter */
+typedef struct sctp_supported_ext_param {
        struct sctp_paramhdr param_hdr;
-       __be32 adaption_ind;
-} __attribute__((packed)) sctp_adaption_ind_param_t;
+       __u8 chunks[0];
+} __attribute__((packed)) sctp_supported_ext_param_t;
+
+/* AUTH Section 3.1 Random */
+typedef struct sctp_random_param {
+       sctp_paramhdr_t param_hdr;
+       __u8 random_val[0];
+} __attribute__((packed)) sctp_random_param_t;
+
+/* AUTH Section 3.2 Chunk List */
+typedef struct sctp_chunks_param {
+       sctp_paramhdr_t param_hdr;
+       __u8 chunks[0];
+} __attribute__((packed)) sctp_chunks_param_t;
+
+/* AUTH Section 3.3 HMAC Algorithm */
+typedef struct sctp_hmac_algo_param {
+       sctp_paramhdr_t param_hdr;
+       __be16 hmac_ids[0];
+} __attribute__((packed)) sctp_hmac_algo_param_t;
 
 /* RFC 2960.  Section 3.3.3 Initiation Acknowledgement (INIT ACK) (2):
  *   The INIT ACK chunk is used to acknowledge the initiation of an SCTP
@@ -453,7 +497,19 @@ typedef enum {
        SCTP_ERROR_RSRC_LOW     = __constant_htons(0x0101),
        SCTP_ERROR_DEL_SRC_IP   = __constant_htons(0x0102),
        SCTP_ERROR_ASCONF_ACK   = __constant_htons(0x0103),
-       SCTP_ERROR_REQ_REFUSED  = __constant_htons(0x0104)
+       SCTP_ERROR_REQ_REFUSED  = __constant_htons(0x0104),
+
+       /* AUTH Section 4.  New Error Cause
+        *
+        * This section defines a new error cause that will be sent if an AUTH
+        * chunk is received with an unsupported HMAC identifier.
+        * illustrates the new error cause.
+        *
+        * Cause Code      Error Cause Name
+        * --------------------------------------------------------------
+        * 0x0105          Unsupported HMAC Identifier
+        */
+        SCTP_ERROR_UNSUP_HMAC  = __constant_htons(0x0105)
 } sctp_error_t;
 
 
@@ -591,4 +647,64 @@ typedef struct sctp_addip_chunk {
        sctp_addiphdr_t addip_hdr;
 } __attribute__((packed)) sctp_addip_chunk_t;
 
+/* AUTH
+ * Section 4.1  Authentication Chunk (AUTH)
+ *
+ *   This chunk is used to hold the result of the HMAC calculation.
+ *
+ *    0                   1                   2                   3
+ *    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
+ *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *   | Type = 0x0F   |   Flags=0     |             Length            |
+ *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *   |     Shared Key Identifier     |   HMAC Identifier             |
+ *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *   |                                                               |
+ *   \                             HMAC                              /
+ *   /                                                               \
+ *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *
+ *   Type: 1 byte (unsigned integer)
+ *     This value MUST be set to 0x0F for  all AUTH-chunks.
+ *
+ *   Flags: 1 byte (unsigned integer)
+ *     Set to zero on transmit and ignored on receipt.
+ *
+ *   Length: 2 bytes (unsigned integer)
+ *     This value holds the length of the HMAC in bytes plus 8.
+ *
+ *  Shared Key Identifier: 2 bytes (unsigned integer)
+ *     This value describes which endpoint pair shared key is used.
+ *
+ *   HMAC Identifier: 2 bytes (unsigned integer)
+ *     This value describes which message digest is being used.  Table 2
+ *     shows the currently defined values.
+ *
+ *    The following Table 2 shows the currently defined values for HMAC
+ *       identifiers.
+ *
+ *      +-----------------+--------------------------+
+ *      | HMAC Identifier | Message Digest Algorithm |
+ *      +-----------------+--------------------------+
+ *      | 0               | Reserved                 |
+ *      | 1               | SHA-1 defined in [8]     |
+ *      | 2               | Reserved                 |
+ *      | 3               | SHA-256 defined in [8]   |
+ *      +-----------------+--------------------------+
+ *
+ *
+ *   HMAC: n bytes (unsigned integer) This hold the result of the HMAC
+ *      calculation.
+ */
+typedef struct sctp_authhdr {
+       __be16 shkey_id;
+       __be16 hmac_id;
+       __u8   hmac[0];
+} __attribute__((packed)) sctp_authhdr_t;
+
+typedef struct sctp_auth_chunk {
+       sctp_chunkhdr_t chunk_hdr;
+       sctp_authhdr_t auth_hdr;
+} __attribute__((packed)) sctp_auth_chunk_t;
+
 #endif /* __LINUX_SCTP_H__ */