summaryrefslogtreecommitdiff
path: root/epan
diff options
context:
space:
mode:
authorMichael Tuexen <tuexen@wireshark.org>2016-04-06 15:37:24 -0300
committerMichael Tüxen <tuexen@wireshark.org>2016-04-06 23:28:11 +0000
commit2b2a9896811b237346b4f5c35e17a2dfd5f3ea97 (patch)
tree159b88121c4d5054077fec20ec459ba372ae696e /epan
parent7476db48cc90f18bed8e9b54afa14d2958104957 (diff)
downloadwireshark-2b2a9896811b237346b4f5c35e17a2dfd5f3ea97.tar.gz
Add support for the I-FORWARD-TSN chunk.
Change-Id: I4b9d2c33ba4d19bb542c11660f298ad2ff7e52c6 Reviewed-on: https://code.wireshark.org/review/14832 Petri-Dish: Michael Tüxen <tuexen@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Tüxen <tuexen@wireshark.org>
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-sctp.c55
-rw-r--r--epan/dissectors/packet-sctp.h1
2 files changed, 54 insertions, 2 deletions
diff --git a/epan/dissectors/packet-sctp.c b/epan/dissectors/packet-sctp.c
index 80428abb1f..7baf3a9ee0 100644
--- a/epan/dissectors/packet-sctp.c
+++ b/epan/dissectors/packet-sctp.c
@@ -222,6 +222,11 @@ static int hf_forward_tsn_chunk_tsn = -1;
static int hf_forward_tsn_chunk_sid = -1;
static int hf_forward_tsn_chunk_ssn = -1;
+static int hf_i_forward_tsn_chunk_tsn = -1;
+static int hf_i_forward_tsn_chunk_sid = -1;
+static int hf_i_forward_tsn_chunk_res = -1;
+static int hf_i_forward_tsn_chunk_mid = -1;
+
static int hf_asconf_ack_seq_nr = -1;
static int hf_asconf_seq_nr = -1;
static int hf_correlation_id = -1;
@@ -329,14 +334,15 @@ WS_DLL_PUBLIC_DEF const value_string chunk_type_values[] = {
{ SCTP_CWR_CHUNK_ID, "CWR" },
{ SCTP_SHUTDOWN_COMPLETE_CHUNK_ID, "SHUTDOWN_COMPLETE" },
{ SCTP_AUTH_CHUNK_ID, "AUTH" },
- { SCTP_NR_SACK_CHUNK_ID, "NR-SACK" },
- { SCTP_I_DATA_CHUNK_ID, "I-DATA" },
+ { SCTP_NR_SACK_CHUNK_ID, "NR_SACK" },
+ { SCTP_I_DATA_CHUNK_ID, "I_DATA" },
{ SCTP_ASCONF_ACK_CHUNK_ID, "ASCONF_ACK" },
{ SCTP_PKTDROP_CHUNK_ID, "PKTDROP" },
{ SCTP_RE_CONFIG_CHUNK_ID, "RE_CONFIG" },
{ SCTP_PAD_CHUNK_ID, "PAD" },
{ SCTP_FORWARD_TSN_CHUNK_ID, "FORWARD_TSN" },
{ SCTP_ASCONF_CHUNK_ID, "ASCONF" },
+ { SCTP_I_FORWARD_TSN_CHUNK_ID, "I_FORWARD_TSN" },
{ SCTP_IETF_EXT, "IETF_EXTENSION" },
{ 0, NULL } };
@@ -4068,6 +4074,44 @@ dissect_forward_tsn_chunk(tvbuff_t *chunk_tvb, guint16 chunk_length, proto_tree
}
}
+#define I_FORWARD_TSN_CHUNK_TSN_LENGTH 4
+#define I_FORWARD_TSN_CHUNK_SID_LENGTH 2
+#define I_FORWARD_TSN_CHUNK_RES_LENGTH 2
+#define I_FORWARD_TSN_CHUNK_MID_LENGTH 4
+#define I_FORWARD_TSN_CHUNK_TSN_OFFSET CHUNK_VALUE_OFFSET
+#define I_FORWARD_TSN_CHUNK_SID_OFFSET 0
+#define I_FORWARD_TSN_CHUNK_RES_OFFSET (I_FORWARD_TSN_CHUNK_SID_OFFSET + I_FORWARD_TSN_CHUNK_SID_LENGTH)
+#define I_FORWARD_TSN_CHUNK_MID_OFFSET (I_FORWARD_TSN_CHUNK_RES_OFFSET + I_FORWARD_TSN_CHUNK_RES_LENGTH)
+
+static void
+dissect_i_forward_tsn_chunk(tvbuff_t *chunk_tvb, guint16 chunk_length, proto_tree *chunk_tree, proto_item *chunk_item)
+{
+ guint offset;
+ guint16 number_of_affected_streams, affected_stream;
+
+ /* FIXME */
+ if (chunk_length < CHUNK_HEADER_LENGTH + I_FORWARD_TSN_CHUNK_TSN_LENGTH) {
+ proto_item_append_text(chunk_item, ", bogus chunk length %u < %u)",
+ chunk_length,
+ CHUNK_HEADER_LENGTH + I_FORWARD_TSN_CHUNK_TSN_LENGTH);
+ return;
+ }
+ if (chunk_tree) {
+ proto_tree_add_item(chunk_tree, hf_i_forward_tsn_chunk_tsn, chunk_tvb, I_FORWARD_TSN_CHUNK_TSN_OFFSET, I_FORWARD_TSN_CHUNK_TSN_LENGTH, ENC_BIG_ENDIAN);
+ number_of_affected_streams = (chunk_length - CHUNK_HEADER_LENGTH - I_FORWARD_TSN_CHUNK_TSN_LENGTH) /
+ (I_FORWARD_TSN_CHUNK_SID_LENGTH + I_FORWARD_TSN_CHUNK_RES_LENGTH + I_FORWARD_TSN_CHUNK_MID_LENGTH);
+ offset = CHUNK_VALUE_OFFSET + I_FORWARD_TSN_CHUNK_TSN_LENGTH;
+
+ for(affected_stream = 0; affected_stream < number_of_affected_streams; affected_stream++) {
+ proto_tree_add_item(chunk_tree, hf_i_forward_tsn_chunk_sid, chunk_tvb, offset + I_FORWARD_TSN_CHUNK_SID_OFFSET, I_FORWARD_TSN_CHUNK_SID_LENGTH, ENC_BIG_ENDIAN);
+ proto_tree_add_item(chunk_tree, hf_i_forward_tsn_chunk_res, chunk_tvb, offset + I_FORWARD_TSN_CHUNK_RES_OFFSET, I_FORWARD_TSN_CHUNK_RES_LENGTH, ENC_BIG_ENDIAN);
+ proto_tree_add_item(chunk_tree, hf_i_forward_tsn_chunk_mid, chunk_tvb, offset + I_FORWARD_TSN_CHUNK_MID_OFFSET, I_FORWARD_TSN_CHUNK_MID_LENGTH, ENC_BIG_ENDIAN);
+ offset += (I_FORWARD_TSN_CHUNK_SID_LENGTH + I_FORWARD_TSN_CHUNK_RES_LENGTH + I_FORWARD_TSN_CHUNK_MID_LENGTH);
+ }
+ proto_item_append_text(chunk_item, "(Cumulative TSN: %u)", tvb_get_ntohl(chunk_tvb, I_FORWARD_TSN_CHUNK_TSN_OFFSET));
+ }
+}
+
#define RE_CONFIG_PARAMETERS_OFFSET CHUNK_HEADER_LENGTH
static void
@@ -4399,6 +4443,9 @@ dissect_sctp_chunk(tvbuff_t *chunk_tvb,
case SCTP_ASCONF_CHUNK_ID:
dissect_asconf_chunk(chunk_tvb, length, pinfo, chunk_tree, chunk_item);
break;
+ case SCTP_I_FORWARD_TSN_CHUNK_ID:
+ dissect_i_forward_tsn_chunk(chunk_tvb, length, chunk_tree, chunk_item);
+ break;
case SCTP_PKTDROP_CHUNK_ID:
col_set_writable(pinfo->cinfo, FALSE);
dissect_pktdrop_chunk(chunk_tvb, length, pinfo, chunk_tree, chunk_item, flags_item);
@@ -4805,6 +4852,10 @@ proto_register_sctp(void)
{ &hf_forward_tsn_chunk_tsn, { "New cumulative TSN", "sctp.forward_tsn_tsn", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_forward_tsn_chunk_sid, { "Stream identifier", "sctp.forward_tsn_sid", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_forward_tsn_chunk_ssn, { "Stream sequence number", "sctp.forward_tsn_ssn", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+ { &hf_i_forward_tsn_chunk_tsn, { "New cumulative TSN", "sctp.forward_tsn_tsn", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+ { &hf_i_forward_tsn_chunk_sid, { "Stream identifier", "sctp.forward_tsn_sid", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+ { &hf_i_forward_tsn_chunk_res, { "Reserved", "sctp.forward_tsn_res", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+ { &hf_i_forward_tsn_chunk_mid, { "Message identifier", "sctp.forward_tsn_mid", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_parameter_type, { "Parameter type", "sctp.parameter_type", FT_UINT16, BASE_HEX, VALS(parameter_identifier_values), 0x0, NULL, HFILL } },
{ &hf_parameter_length, { "Parameter length", "sctp.parameter_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_parameter_value, { "Parameter value", "sctp.parameter_value", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
diff --git a/epan/dissectors/packet-sctp.h b/epan/dissectors/packet-sctp.h
index 65b8b892a2..fdcff86104 100644
--- a/epan/dissectors/packet-sctp.h
+++ b/epan/dissectors/packet-sctp.h
@@ -109,6 +109,7 @@ typedef struct _sctp_frag_msg {
#define SCTP_PAD_CHUNK_ID 0x84
#define SCTP_FORWARD_TSN_CHUNK_ID 0xC0
#define SCTP_ASCONF_CHUNK_ID 0xC1
+#define SCTP_I_FORWARD_TSN_CHUNK_ID 0xC2
#define SCTP_IETF_EXT 0xFF
#define IS_SCTP_CHUNK_TYPE(t) \