COOKIE_ACK,
ECNE,
CWR,
- SHUTDOWN_COMPLETE
+ SHUTDOWN_COMPLETE,
+ UNKNOWN
} sctp_chunk_type;
/*
#define CHUNK_FLAGS_MASK 0x00FF0000
#define CHUNK_FLAGS_SHIFT 16
+#define CHUNK_UBIT_MASK 0x00040000
+#define CHUNK_UBIT_SHIFT 18
+
+#define CHUNK_BBIT_MASK 0x00020000
+#define CHUNK_BBIT_SHIFT 17
+
+#define CHUNK_EBIT_MASK 0x00010000
+#define CHUNK_EBIT_SHIFT 16
+
#define CHUNK_LENGTH_MASK 0x0000FFFF
#define CHUNK_LENGTH_SHIFT 0
h->params = clib_net_to_host_u32 (h->params);
}
+always_inline void
+vnet_sctp_set_ubit (sctp_chunks_common_hdr_t * h)
+{
+ h->params &= ~(CHUNK_UBIT_MASK);
+ h->params |= (1 << CHUNK_UBIT_SHIFT) & CHUNK_UBIT_MASK;
+}
+
+always_inline u8
+vnet_sctp_get_ubit (sctp_chunks_common_hdr_t * h)
+{
+ return ((h->params & CHUNK_UBIT_MASK) >> CHUNK_UBIT_SHIFT);
+}
+
+always_inline void
+vnet_sctp_set_bbit (sctp_chunks_common_hdr_t * h)
+{
+ h->params &= ~(CHUNK_BBIT_MASK);
+ h->params |= (1 << CHUNK_BBIT_SHIFT) & CHUNK_BBIT_MASK;
+}
+
+always_inline u8
+vnet_sctp_get_bbit (sctp_chunks_common_hdr_t * h)
+{
+ return ((h->params & CHUNK_BBIT_MASK) >> CHUNK_BBIT_SHIFT);
+}
+
+always_inline void
+vnet_sctp_set_ebit (sctp_chunks_common_hdr_t * h)
+{
+ h->params &= ~(CHUNK_EBIT_MASK);
+ h->params |= (1 << CHUNK_EBIT_SHIFT) & CHUNK_EBIT_MASK;
+}
+
+always_inline u8
+vnet_sctp_get_ebit (sctp_chunks_common_hdr_t * h)
+{
+ return ((h->params & CHUNK_EBIT_MASK) >> CHUNK_EBIT_SHIFT);
+}
+
always_inline void
vnet_sctp_set_chunk_type (sctp_chunks_common_hdr_t * h, sctp_chunk_type t)
{
} sctp_payload_data_chunk_t;
-always_inline void
-vnet_sctp_set_ebit (sctp_payload_data_chunk_t * p, u8 enable)
-{
- //p->chunk_hdr.flags = clib_host_to_net_u16 (enable);
-}
-
-always_inline u8
-vnet_sctp_get_ebit (sctp_payload_data_chunk_t * p)
-{
- //return (clib_net_to_host_u16 (p->chunk_hdr.flags));
- return 0;
-}
-
-always_inline void
-vnet_sctp_set_bbit (sctp_payload_data_chunk_t * p, u8 enable)
-{
- //p->chunk_hdr.flags = clib_host_to_net_u16 (enable << 1);
-}
-
-always_inline u8
-vnet_sctp_get_bbit (sctp_payload_data_chunk_t * p)
-{
- //return (clib_net_to_host_u16 (p->chunk_hdr.flags >> 1));
- return 0;
-}
-
-always_inline void
-vnet_sctp_set_ubit (sctp_payload_data_chunk_t * p, u8 enable)
-{
- //p->chunk_hdr.flags = clib_host_to_net_u16 (enable << 2);
-}
-
-always_inline u8
-vnet_sctp_get_ubit (sctp_payload_data_chunk_t * p)
-{
- //return (clib_net_to_host_u16 (p->chunk_hdr.flags >> 2));
- return 0;
-}
-
always_inline void
vnet_sctp_set_tsn (sctp_payload_data_chunk_t * p, u32 tsn)
{
return (4 - base_length % 4);
}
-#define DEFAULT_A_RWND 1480
#define INBOUND_STREAMS_COUNT 1
#define OUTBOUND_STREAMS_COUNT 1
*/
typedef sctp_init_chunk_t sctp_init_ack_chunk_t;
+typedef struct
+{
+ u16 type;
+ u16 length;
+
+} sctp_opt_params_hdr_t;
+
+#define SHA1_OUTPUT_LENGTH 20
/*
* 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
* \ \
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
-typedef struct
-{
- u16 type;
- u16 length;
-
-} sctp_opt_params_hdr_t;
-
typedef struct
{
sctp_opt_params_hdr_t param_hdr;
- u64 mac; /* RFC 2104 */
- u32 creation_time;
+ unsigned char mac[SHA1_OUTPUT_LENGTH]; /* RFC 2104 */
+ u64 creation_time;
u32 cookie_lifespan;
} sctp_state_cookie_param_t;
{
h->param_hdr.length = FQDN_MAX_LENGTH;
h->param_hdr.type = clib_host_to_net_u16 (SCTP_HOSTNAME_ADDRESS_TYPE);
- memset (h->hostname, '0', FQDN_MAX_LENGTH);
+ clib_memset (h->hostname, '0', FQDN_MAX_LENGTH);
memcpy (h->hostname, hostname, FQDN_MAX_LENGTH);
}
} sctp_err_cause_param_t;
+
+/*
+ * An end-point sends this chunk to its peer end-point to notify it of
+ * certain error conditions. It contains one or more error causes.
+ * An Operation Error is not considered fatal in and of itself, but may be
+ * used with an ABORT chunk to report a fatal condition. It has the
+ * following parameters:
+ *
+ * 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 = 9 | Chunk Flags | Length |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * \ \
+ * / one or more Error Causes /
+ * \ \
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+typedef struct
+{
+ sctp_header_t sctp_hdr;
+ sctp_chunks_common_hdr_t chunk_hdr;
+ sctp_err_cause_param_t err_causes[];
+
+} sctp_operation_error_t;
+
/*
* Abort Association (ABORT)
*