summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2008-03-16 00:03:13 +0000
committerGuy Harris <guy@alum.mit.edu>2008-03-16 00:03:13 +0000
commitd589b0523b5e64ff524e59c9d804cbb26411be3b (patch)
treeccb7b95226c01b0faaabf0d78a3b33581301bcba
parentbcd666a74f351ed587a6cb4e9aaebd8af4acd3a4 (diff)
downloadwireshark-d589b0523b5e64ff524e59c9d804cbb26411be3b.tar.gz
OK, now use DCCP rather than DCP for the Datagram Congestion Control
Protocol. (Better late than never....) svn path=/trunk/; revision=24646
-rw-r--r--epan/dissectors/Makefile.common2
-rw-r--r--epan/dissectors/packet-dccp.c (renamed from epan/dissectors/packet-dcp.c)696
-rw-r--r--epan/dissectors/packet-dccp.h (renamed from epan/dissectors/packet-dcp.h)12
3 files changed, 353 insertions, 357 deletions
diff --git a/epan/dissectors/Makefile.common b/epan/dissectors/Makefile.common
index 2c5c41f0b1..8d01d57b8b 100644
--- a/epan/dissectors/Makefile.common
+++ b/epan/dissectors/Makefile.common
@@ -268,6 +268,7 @@ CLEAN_DISSECTOR_SRC = \
packet-data.c \
packet-daytime.c \
packet-dcc.c \
+ packet-dccp.c \
packet-dcerpc-bossvr.c \
packet-dcerpc-browser.c \
packet-dcerpc-cds_clerkserver.c \
@@ -334,7 +335,6 @@ CLEAN_DISSECTOR_SRC = \
packet-dcom-remact.c \
packet-dcom-remunkn.c \
packet-dcom-sysact.c \
- packet-dcp.c \
packet-dcp-etsi.c \
packet-ddtp.c \
packet-dec-bpdu.c \
diff --git a/epan/dissectors/packet-dcp.c b/epan/dissectors/packet-dccp.c
index 1f768eb10c..e1dffdfc77 100644
--- a/epan/dissectors/packet-dcp.c
+++ b/epan/dissectors/packet-dccp.c
@@ -32,10 +32,6 @@
/* NOTES:
*
- * PROTOABBREV name collision problem, 'dccp' is used by
- * Distributed Checksum Clearinghouse Protocol.
- * This dissector should be named packet-dccp.c IMHO.
- *
* Nov 13, 2006: makes checksum computation dependent
* upon the header CsCov field (cf. RFC 4340, 5.1)
* (Gerrit Renker)
@@ -66,7 +62,7 @@
#include <epan/prefs.h>
#include <epan/emem.h>
-#include "packet-dcp.h"
+#include "packet-dccp.h"
#include "packet-ip.h"
#include <epan/conversation.h>
@@ -81,7 +77,7 @@
#define DCCP_HDR_LEN_MAX (DCCP_HDR_LEN + DCCP_HDR_PKT_TYPES_LEN_MAX + DCCP_OPT_LEN_MAX)
-static const value_string dcp_packet_type_vals[] = {
+static const value_string dccp_packet_type_vals[] = {
{0x0, "Request"},
{0x1, "Response"},
{0x2, "Data"},
@@ -101,7 +97,7 @@ static const value_string dcp_packet_type_vals[] = {
{0, NULL}
};
-static const value_string dcp_reset_code_vals[] = {
+static const value_string dccp_reset_code_vals[] = {
{0x00, "Unspecified"},
{0x01, "Closed"},
{0x02, "Aborted"},
@@ -118,7 +114,7 @@ static const value_string dcp_reset_code_vals[] = {
{0, NULL}
};
-static const value_string dcp_feature_options_vals[] = {
+static const value_string dccp_feature_options_vals[] = {
{0x20, "Change L"},
{0x21, "Confirm L"},
{0x22, "Change R"},
@@ -126,7 +122,7 @@ static const value_string dcp_feature_options_vals[] = {
{0, NULL}
};
-static const value_string dcp_feature_numbers_vals[] = {
+static const value_string dccp_feature_numbers_vals[] = {
{0x01, "CCID"},
{0x02, "Allow Short Seqnos"},
{0x03, "Sequence Window"},
@@ -158,52 +154,52 @@ static const value_string dcp_feature_numbers_vals[] = {
#endif /* 0/1 */
-static int proto_dcp = -1;
+static int proto_dccp = -1;
static int dccp_tap = -1;
-static int hf_dcp_srcport = -1;
-static int hf_dcp_dstport = -1;
-static int hf_dcp_port = -1;
-static int hf_dcp_data_offset = -1;
-static int hf_dcp_ccval = -1;
-static int hf_dcp_cscov = -1;
-static int hf_dcp_checksum = -1;
-static int hf_dcp_checksum_bad = -1;
-static int hf_dcp_res1 = -1;
-static int hf_dcp_type = -1;
-static int hf_dcp_x = -1;
-static int hf_dcp_res2 = -1;
-static int hf_dcp_seq = -1;
-
-static int hf_dcp_ack_res = -1;
-static int hf_dcp_ack = -1;
-
-static int hf_dcp_service_code = -1;
-static int hf_dcp_reset_code = -1;
-static int hf_dcp_data1 = -1;
-static int hf_dcp_data2 = -1;
-static int hf_dcp_data3 = -1;
-
-static int hf_dcp_options = -1;
-static int hf_dcp_option_type = -1;
-static int hf_dcp_feature_number = -1;
-static int hf_dcp_ndp_count = -1;
-static int hf_dcp_timestamp = -1;
-static int hf_dcp_timestamp_echo = -1;
-static int hf_dcp_elapsed_time = -1;
-static int hf_dcp_data_checksum = -1;
-
-static int hf_dcp_malformed = -1;
-
-static gint ett_dcp = -1;
-static gint ett_dcp_options = -1;
-
-static dissector_table_t dcp_subdissector_table;
+static int hf_dccp_srcport = -1;
+static int hf_dccp_dstport = -1;
+static int hf_dccp_port = -1;
+static int hf_dccp_data_offset = -1;
+static int hf_dccp_ccval = -1;
+static int hf_dccp_cscov = -1;
+static int hf_dccp_checksum = -1;
+static int hf_dccp_checksum_bad = -1;
+static int hf_dccp_res1 = -1;
+static int hf_dccp_type = -1;
+static int hf_dccp_x = -1;
+static int hf_dccp_res2 = -1;
+static int hf_dccp_seq = -1;
+
+static int hf_dccp_ack_res = -1;
+static int hf_dccp_ack = -1;
+
+static int hf_dccp_service_code = -1;
+static int hf_dccp_reset_code = -1;
+static int hf_dccp_data1 = -1;
+static int hf_dccp_data2 = -1;
+static int hf_dccp_data3 = -1;
+
+static int hf_dccp_options = -1;
+static int hf_dccp_option_type = -1;
+static int hf_dccp_feature_number = -1;
+static int hf_dccp_ndp_count = -1;
+static int hf_dccp_timestamp = -1;
+static int hf_dccp_timestamp_echo = -1;
+static int hf_dccp_elapsed_time = -1;
+static int hf_dccp_data_checksum = -1;
+
+static int hf_dccp_malformed = -1;
+
+static gint ett_dccp = -1;
+static gint ett_dccp_options = -1;
+
+static dissector_table_t dccp_subdissector_table;
static heur_dissector_list_t heur_subdissector_list;
static dissector_handle_t data_handle;
/* preferences */
-static gboolean dcp_summary_in_tree = TRUE;
+static gboolean dccp_summary_in_tree = TRUE;
static gboolean try_heuristic_first = FALSE;
static gboolean dccp_check_checksum = TRUE;
@@ -253,11 +249,11 @@ decode_dccp_ports(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tre
high_port = dport;
}
if (low_port != 0 &&
- dissector_try_port(dcp_subdissector_table, low_port, next_tvb, pinfo, tree)) {
+ dissector_try_port(dccp_subdissector_table, low_port, next_tvb, pinfo, tree)) {
return;
}
if (high_port != 0 &&
- dissector_try_port(dcp_subdissector_table, high_port, next_tvb, pinfo, tree)) {
+ dissector_try_port(dccp_subdissector_table, high_port, next_tvb, pinfo, tree)) {
return;
}
@@ -298,17 +294,17 @@ static guint64 tvb_get_ntoh_var(tvbuff_t *tvb, gint offset, guint nbytes)
return value;
}
-static void dissect_feature_options(proto_tree *dcp_options_tree, tvbuff_t *tvb, int offset, guint8 option_len,
+static void dissect_feature_options(proto_tree *dccp_options_tree, tvbuff_t *tvb, int offset, guint8 option_len,
guint8 option_type)
{
guint8 feature_number = tvb_get_guint8(tvb, offset + 2);
- proto_item *dcp_item;
+ proto_item *dccp_item;
int i;
- proto_tree_add_uint_hidden(dcp_options_tree, hf_dcp_feature_number, tvb, offset + 2, 1, feature_number);
+ proto_tree_add_uint_hidden(dccp_options_tree, hf_dccp_feature_number, tvb, offset + 2, 1, feature_number);
- dcp_item = proto_tree_add_text(dcp_options_tree, tvb, offset, option_len, "%s(",
- val_to_str(option_type, dcp_feature_options_vals, "Unknown Type"));
+ dccp_item = proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, "%s(",
+ val_to_str(option_type, dccp_feature_options_vals, "Unknown Type"));
/* decode the feature according to whether it is server-priority (list) or NN (single number) */
switch (feature_number) {
@@ -321,38 +317,38 @@ static void dissect_feature_options(proto_tree *dcp_options_tree, tvbuff_t *tvb,
case 8: /* Minimum Checksum Coverage; fall through */
case 9: /* Check Data Checksum; fall through */
case 192: /* Send Loss Event Rate, RFC 4342, section 8.4 */
- proto_item_append_text(dcp_item, "%s",
- val_to_str(feature_number, dcp_feature_numbers_vals, "Unknown Type"));
+ proto_item_append_text(dccp_item, "%s",
+ val_to_str(feature_number, dccp_feature_numbers_vals, "Unknown Type"));
for (i = 0; i < option_len - 3; i++)
- proto_item_append_text(dcp_item, "%s %d", i? "," : "", tvb_get_guint8(tvb, offset + 3 + i));
+ proto_item_append_text(dccp_item, "%s %d", i? "," : "", tvb_get_guint8(tvb, offset + 3 + i));
break;
/* Non-negotiable features (RFC 4340, 6.3.2) */
case 3: /* Sequence Window; fall through */
case 5: /* Ack Ratio */
- proto_item_append_text(dcp_item, "%s",
- val_to_str(feature_number, dcp_feature_numbers_vals, "Unknown Type"));
+ proto_item_append_text(dccp_item, "%s",
+ val_to_str(feature_number, dccp_feature_numbers_vals, "Unknown Type"));
if (option_len > 3) /* could be empty Confirm */
- proto_item_append_text(dcp_item, " %" G_GINT64_MODIFIER "u", tvb_get_ntoh_var(tvb, offset + 3, option_len - 3));
+ proto_item_append_text(dccp_item, " %" G_GINT64_MODIFIER "u", tvb_get_ntoh_var(tvb, offset + 3, option_len - 3));
break;
/* Reserved, specific, or unknown features */
default:
if (feature_number == 0 ||
(feature_number >= 10 && feature_number <= 127))
- proto_item_append_text(dcp_item, "Reserved feature number %d", feature_number);
+ proto_item_append_text(dccp_item, "Reserved feature number %d", feature_number);
else if (feature_number >= 193)
- proto_item_append_text(dcp_item, "CCID-specific feature number %d", feature_number);
+ proto_item_append_text(dccp_item, "CCID-specific feature number %d", feature_number);
else
- proto_item_append_text(dcp_item, "Unknown feature number %d", feature_number);
+ proto_item_append_text(dccp_item, "Unknown feature number %d", feature_number);
break;
}
- proto_item_append_text(dcp_item, ")");
+ proto_item_append_text(dccp_item, ")");
}
/*
* This function dissects DCCP options
*/
-static void dissect_options(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *dcp_options_tree, proto_tree *tree _U_, e_dcphdr *dcph _U_,
+static void dissect_options(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *dccp_options_tree, proto_tree *tree _U_, e_dccphdr *dccph _U_,
int offset_start,
int offset_end)
{
@@ -362,7 +358,7 @@ static void dissect_options(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *d
guint8 option_len = 0;
int i;
guint32 p;
- proto_item *dcp_item = NULL;
+ proto_item *dccp_item = NULL;
while( offset < offset_end ) {
@@ -370,13 +366,13 @@ static void dissect_options(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *d
/* first byte is the option type */
option_type = tvb_get_guint8(tvb, offset);
- proto_tree_add_uint_hidden(dcp_options_tree, hf_dcp_option_type, tvb, offset, 1, option_type);
+ proto_tree_add_uint_hidden(dccp_options_tree, hf_dccp_option_type, tvb, offset, 1, option_type);
if (option_type >= 32) { /* variable length options */
if(!tvb_bytes_exist(tvb, offset, 1)) {
/* DBG("malformed\n"); */
- proto_tree_add_boolean_hidden(dcp_options_tree, hf_dcp_malformed, tvb, offset, 0, TRUE);
+ proto_tree_add_boolean_hidden(dccp_options_tree, hf_dccp_malformed, tvb, offset, 0, TRUE);
THROW(ReportedBoundsError);
}
@@ -384,13 +380,13 @@ static void dissect_options(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *d
if (option_len < 2) {
/* DBG("malformed\n"); */
- proto_tree_add_boolean_hidden(dcp_options_tree, hf_dcp_malformed, tvb, offset, 0, TRUE);
+ proto_tree_add_boolean_hidden(dccp_options_tree, hf_dccp_malformed, tvb, offset, 0, TRUE);
THROW(ReportedBoundsError);
}
if(!tvb_bytes_exist(tvb, offset, option_len)) {
/* DBG("malformed\n"); */
- proto_tree_add_boolean_hidden(dcp_options_tree, hf_dcp_malformed, tvb, offset, 0, TRUE);
+ proto_tree_add_boolean_hidden(dccp_options_tree, hf_dccp_malformed, tvb, offset, 0, TRUE);
THROW(ReportedBoundsError);
}
@@ -401,145 +397,145 @@ static void dissect_options(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *d
switch (option_type) {
case 0:
- proto_tree_add_text(dcp_options_tree, tvb, offset, option_len, "Padding");
+ proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, "Padding");
break;
case 1:
- proto_tree_add_text(dcp_options_tree, tvb, offset, option_len, "Mandatory");
+ proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, "Mandatory");
break;
case 2:
- proto_tree_add_text(dcp_options_tree, tvb, offset, option_len, "Slow Receiver");
+ proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, "Slow Receiver");
break;
case 32:
case 33:
case 34:
case 35:
- dissect_feature_options(dcp_options_tree, tvb, offset, option_len, option_type);
+ dissect_feature_options(dccp_options_tree, tvb, offset, option_len, option_type);
break;
case 36:
- dcp_item = proto_tree_add_text(dcp_options_tree, tvb, offset, option_len, "Init Cookie(");
+ dccp_item = proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, "Init Cookie(");
for (i = 0; i < option_len - 2; i++) {
if(i==0)
- proto_item_append_text(dcp_item, "%02x", tvb_get_guint8(tvb, offset + 2 + i));
+ proto_item_append_text(dccp_item, "%02x", tvb_get_guint8(tvb, offset + 2 + i));
else
- proto_item_append_text(dcp_item, " %02x", tvb_get_guint8(tvb, offset + 2 + i));
+ proto_item_append_text(dccp_item, " %02x", tvb_get_guint8(tvb, offset + 2 + i));
}
- proto_item_append_text(dcp_item, ")");
+ proto_item_append_text(dccp_item, ")");
break;
case 37:
if (option_len > 8)
- proto_tree_add_text(dcp_options_tree, tvb, offset, option_len, "NDP Count too long (max 6 bytes)");
+ proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, "NDP Count too long (max 6 bytes)");
else
- proto_tree_add_text(dcp_options_tree, tvb, offset, option_len, "NDP Count: %" G_GINT64_MODIFIER "u",
+ proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, "NDP Count: %" G_GINT64_MODIFIER "u",
tvb_get_ntoh_var(tvb, offset + 2, option_len - 2));
break;
case 38:
- dcp_item = proto_tree_add_text(dcp_options_tree, tvb, offset, option_len, "Ack Vector [Nonce 0]:");
+ dccp_item = proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, "Ack Vector [Nonce 0]:");
for (i = 0; i < option_len - 2; i++)
- proto_item_append_text(dcp_item, " %02x", tvb_get_guint8(tvb, offset + 2 + i));
+ proto_item_append_text(dccp_item, " %02x", tvb_get_guint8(tvb, offset + 2 + i));
break;
case 39:
- dcp_item = proto_tree_add_text(dcp_options_tree, tvb, offset, option_len, "Ack Vector [Nonce 1]:");
+ dccp_item = proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, "Ack Vector [Nonce 1]:");
for (i = 0; i < option_len - 2; i++)
- proto_item_append_text(dcp_item, " %02x", tvb_get_guint8(tvb, offset + 2 + i));
- proto_item_append_text(dcp_item, ")");
+ proto_item_append_text(dccp_item, " %02x", tvb_get_guint8(tvb, offset + 2 + i));
+ proto_item_append_text(dccp_item, ")");
break;
case 40:
- dcp_item = proto_tree_add_text(dcp_options_tree, tvb, offset, option_len, "Data Dropped:");
+ dccp_item = proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, "Data Dropped:");
for (i = 0; i < option_len - 2; i++)
- proto_item_append_text(dcp_item, " %02x", tvb_get_guint8(tvb, offset + 2 + i));
+ proto_item_append_text(dccp_item, " %02x", tvb_get_guint8(tvb, offset + 2 + i));
break;
case 41:
if(option_len==6)
- proto_tree_add_uint(dcp_options_tree, hf_dcp_timestamp, tvb, offset + 2, 4,
+ proto_tree_add_uint(dccp_options_tree, hf_dccp_timestamp, tvb, offset + 2, 4,
tvb_get_ntohl(tvb, offset + 2));
else
- proto_tree_add_text(dcp_options_tree, tvb, offset, option_len,
+ proto_tree_add_text(dccp_options_tree, tvb, offset, option_len,
"Timestamp too long [%u != 6]", option_len);
break;
case 42:
if(option_len==6)
- proto_tree_add_uint(dcp_options_tree, hf_dcp_timestamp_echo, tvb, offset + 2, 4,
+ proto_tree_add_uint(dccp_options_tree, hf_dccp_timestamp_echo, tvb, offset + 2, 4,
tvb_get_ntohl(tvb, offset + 2));
else if (option_len==8) {
- proto_tree_add_uint(dcp_options_tree, hf_dcp_timestamp_echo, tvb, offset + 2, 4,
+ proto_tree_add_uint(dccp_options_tree, hf_dccp_timestamp_echo, tvb, offset + 2, 4,
tvb_get_ntohl(tvb, offset + 2));
- proto_tree_add_uint(dcp_options_tree, hf_dcp_elapsed_time, tvb, offset + 6, 2,
+ proto_tree_add_uint(dccp_options_tree, hf_dccp_elapsed_time, tvb, offset + 6, 2,
tvb_get_ntohs(tvb, offset + 6));
} else if (option_len==10) {
- proto_tree_add_uint(dcp_options_tree, hf_dcp_timestamp_echo, tvb, offset + 2, 4,
+ proto_tree_add_uint(dccp_options_tree, hf_dccp_timestamp_echo, tvb, offset + 2, 4,
tvb_get_ntohl(tvb, offset + 2));
- proto_tree_add_uint(dcp_options_tree, hf_dcp_elapsed_time, tvb, offset + 6, 4,
+ proto_tree_add_uint(dccp_options_tree, hf_dccp_elapsed_time, tvb, offset + 6, 4,
tvb_get_ntohl(tvb, offset + 6));
} else
- proto_tree_add_text(dcp_options_tree, tvb, offset, option_len, "Wrong Timestamp Echo length");
+ proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, "Wrong Timestamp Echo length");
break;
case 43:
if(option_len==4)
- proto_tree_add_uint(dcp_options_tree, hf_dcp_elapsed_time, tvb, offset + 2, 2,
+ proto_tree_add_uint(dccp_options_tree, hf_dccp_elapsed_time, tvb, offset + 2, 2,
tvb_get_ntohs(tvb, offset + 2));
else if (option_len==6)
- proto_tree_add_uint(dcp_options_tree, hf_dcp_elapsed_time, tvb, offset + 2, 4,
+ proto_tree_add_uint(dccp_options_tree, hf_dccp_elapsed_time, tvb, offset + 2, 4,
tvb_get_ntohl(tvb, offset + 2));
else
- proto_tree_add_text(dcp_options_tree, tvb, offset, option_len, "Wrong Elapsed Time length");
+ proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, "Wrong Elapsed Time length");
break;
case 44:
if(option_len==6) {
- proto_tree_add_uint(dcp_options_tree, hf_dcp_data_checksum, tvb, offset + 2, 4,
+ proto_tree_add_uint(dccp_options_tree, hf_dccp_data_checksum, tvb, offset + 2, 4,
tvb_get_ntohl(tvb, offset + 2));
} else
- proto_tree_add_text(dcp_options_tree, tvb, offset, option_len, "Wrong Data checksum length");
+ proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, "Wrong Data checksum length");
break;
case 192: /* RFC 4342, 8.5 */
if(option_len == 6) {
p = tvb_get_ntohl(tvb, offset + 2);
/* According to the comment in section 8.5 of RFC 4342, 0xffffffff can mean zero */
if (p == 0xFFFFFFFF)
- proto_tree_add_text(dcp_options_tree, tvb, offset, option_len, "CCID3 Loss Event Rate: 0 (or max)");
+ proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, "CCID3 Loss Event Rate: 0 (or max)");
else
- proto_tree_add_text(dcp_options_tree, tvb, offset, option_len, "CCID3 Loss Event Rate: %u", p);
+ proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, "CCID3 Loss Event Rate: %u", p);
} else
- proto_tree_add_text(dcp_options_tree, tvb, offset, option_len, "Wrong CCID3 Loss Event Rate length");
+ proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, "Wrong CCID3 Loss Event Rate length");
break;
case 193: /* RFC 4342, 8.6 */
- proto_tree_add_text(dcp_options_tree, tvb, offset, option_len, "CCID3 Loss Intervals");
+ proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, "CCID3 Loss Intervals");
/* FIXME: not implemented and apparently not used by any implementation so far */
break;
case 194: /* RFC 4342, 8.3 */
if(option_len == 6)
- proto_tree_add_text(dcp_options_tree, tvb, offset, option_len, "CCID3 Receive Rate: %u bytes/sec",
+ proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, "CCID3 Receive Rate: %u bytes/sec",
tvb_get_ntohl(tvb, offset + 2));
else
- proto_tree_add_text(dcp_options_tree, tvb, offset, option_len, "Wrong CCID3 Receive Rate length");
+ proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, "Wrong CCID3 Receive Rate length");
break;
default :
if(((option_type >= 45) && (option_type <= 127)) ||
((option_type >= 3) && (option_type <= 31))) {
- proto_tree_add_text(dcp_options_tree, tvb, offset, option_len, "Reserved");
+ proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, "Reserved");
break;
}
if (option_type >= 128) {
- proto_tree_add_text(dcp_options_tree, tvb, offset, option_len, "CCID option %d", option_type);
+ proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, "CCID option %d", option_type);
break;
}
/* if here we don't know this option */
- proto_tree_add_text(dcp_options_tree, tvb, offset, option_len, "Unknown");
+ proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, "Unknown");
break;
} /* end switch() */
@@ -549,21 +545,21 @@ static void dissect_options(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *d
} /* end while() */
}
/* compute DCCP checksum coverage according to RFC 4340, section 9 */
-static inline guint dccp_csum_coverage(const e_dcphdr *dcph, guint len)
+static inline guint dccp_csum_coverage(const e_dccphdr *dccph, guint len)
{
guint cov;
- if (dcph->cscov == 0)
+ if (dccph->cscov == 0)
return len;
- cov = (dcph->data_offset + dcph->cscov - 1) * sizeof(guint32);
+ cov = (dccph->data_offset + dccph->cscov - 1) * sizeof(guint32);
return (cov > len)? len : cov;
}
-static void dissect_dcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static void dissect_dccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
- proto_tree *dcp_tree = NULL;
- proto_tree *dcp_options_tree = NULL;
- proto_item *dcp_item = NULL;
+ proto_tree *dccp_tree = NULL;
+ proto_tree *dccp_options_tree = NULL;
+ proto_item *dccp_item = NULL;
vec_t cksum_vec[4];
guint32 phdr[2];
@@ -573,24 +569,24 @@ static void dissect_dcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint reported_len = 0;
guint advertised_dccp_header_len = 0;
guint options_len = 0;
- e_dcphdr *dcph;
+ e_dccphdr *dccph;
/* get at least a full message header */
if(tvb_length(tvb) < DCCP_HDR_LEN_MIN) {
/* DBG("malformed\n"); */
if (tree)
- proto_tree_add_boolean_hidden(dcp_tree, hf_dcp_malformed, tvb, offset, 0, TRUE);
+ proto_tree_add_boolean_hidden(dccp_tree, hf_dccp_malformed, tvb, offset, 0, TRUE);
if (check_col(pinfo->cinfo, COL_INFO))
col_set_str(pinfo->cinfo, COL_INFO, "Packet too short");
THROW(ReportedBoundsError);
}
- dcph=ep_alloc(sizeof(e_dcphdr));
+ dccph=ep_alloc(sizeof(e_dccphdr));
- memset(dcph, 0, sizeof(e_dcphdr));
+ memset(dccph, 0, sizeof(e_dccphdr));
- SET_ADDRESS(&dcph->ip_src, pinfo->src.type, pinfo->src.len, pinfo->src.data);
- SET_ADDRESS(&dcph->ip_dst, pinfo->dst.type, pinfo->dst.len, pinfo->dst.data);
+ SET_ADDRESS(&dccph->ip_src, pinfo->src.type, pinfo->src.len, pinfo->src.data);
+ SET_ADDRESS(&dccph->ip_dst, pinfo->dst.type, pinfo->dst.len, pinfo->dst.data);
if (check_col(pinfo->cinfo, COL_PROTOCOL))
col_set_str(pinfo->cinfo, COL_PROTOCOL, "DCCP");
@@ -598,87 +594,87 @@ static void dissect_dcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_clear(pinfo->cinfo, COL_INFO);
/* Extract generic header */
- dcph->sport=tvb_get_ntohs(tvb, offset);
- /* DBG("dcph->sport: %d\n", dcph->sport); */
- dcph->dport=tvb_get_ntohs(tvb, offset+2);
- /* DBG("dcph->dport: %d\n", dcph->dport); */
+ dccph->sport=tvb_get_ntohs(tvb, offset);
+ /* DBG("dccph->sport: %d\n", dccph->sport); */
+ dccph->dport=tvb_get_ntohs(tvb, offset+2);
+ /* DBG("dccph->dport: %d\n", dccph->dport); */
/* update pinfo structure. I guess I have to do it, because this is a transport protocol dissector. Right? */
pinfo->ptype=PT_DCCP;
- pinfo->srcport=dcph->sport;
- pinfo->destport=dcph->dport;
-
- dcph->data_offset=tvb_get_guint8(tvb, offset+4);
- /* DBG("dcph->data_offset: %d\n", dcph->data_offset); */
- dcph->cscov=tvb_get_guint8(tvb, offset+5)&0x0F;
- /* DBG("dcph->cscov: %d\n", dcph->cscov); */
- dcph->ccval=tvb_get_guint8(tvb, offset+5) &0xF0;
- dcph->ccval >>= 4;
- /* DBG("dcph->ccval: %d\n", dcph->ccval); */
- dcph->checksum=tvb_get_ntohs(tvb, offset+6);
- /* DBG("dcph->checksum: %d\n", dcph->checksum); */
- dcph->reserved1=tvb_get_guint8(tvb, offset+8)&0xE0;
- dcph->reserved1>>=5;
- /* DBG("dcph->reserved1: %d\n", dcph->reserved1); */
- dcph->type=tvb_get_guint8(tvb, offset+8)&0x1E;
- dcph->type>>=1;
- /* DBG("dcph->type: %d\n", dcph->type); */
- dcph->x=tvb_get_guint8(tvb, offset+8)&0x01;
- /* DBG("dcph->x: %d\n", dcph->x); */
- if(dcph->x) {
+ pinfo->srcport=dccph->sport;
+ pinfo->destport=dccph->dport;
+
+ dccph->data_offset=tvb_get_guint8(tvb, offset+4);
+ /* DBG("dccph->data_offset: %d\n", dccph->data_offset); */
+ dccph->cscov=tvb_get_guint8(tvb, offset+5)&0x0F;
+ /* DBG("dccph->cscov: %d\n", dccph->cscov); */
+ dccph->ccval=tvb_get_guint8(tvb, offset+5) &0xF0;
+ dccph->ccval >>= 4;
+ /* DBG("dccph->ccval: %d\n", dccph->ccval); */
+ dccph->checksum=tvb_get_ntohs(tvb, offset+6);
+ /* DBG("dccph->checksum: %d\n", dccph->checksum); */
+ dccph->reserved1=tvb_get_guint8(tvb, offset+8)&0xE0;
+ dccph->reserved1>>=5;
+ /* DBG("dccph->reserved1: %d\n", dccph->reserved1); */
+ dccph->type=tvb_get_guint8(tvb, offset+8)&0x1E;
+ dccph->type>>=1;
+ /* DBG("dccph->type: %d\n", dccph->type); */
+ dccph->x=tvb_get_guint8(tvb, offset+8)&0x01;
+ /* DBG("dccph->x: %d\n", dccph->x); */
+ if(dccph->x) {
if(tvb_length(tvb) < DCCP_HDR_LEN) { /* at least 16 bytes */
/* DBG("malformed\n"); */
- proto_tree_add_boolean_hidden(dcp_tree, hf_dcp_malformed, tvb, offset, 0, TRUE);
+ proto_tree_add_boolean_hidden(dccp_tree, hf_dccp_malformed, tvb, offset, 0, TRUE);
THROW(ReportedBoundsError);
}
- dcph->reserved2=tvb_get_guint8(tvb, offset+9);
- /* DBG("dcph->reserved2: %u\n", dcph->reserved2); */
- dcph->seq=tvb_get_ntohs(tvb, offset+10);
- dcph->seq<<=32;
- dcph->seq+=tvb_get_ntohl(tvb, offset+12);
- /* DBG("dcph->seq[48bits]: %" G_GINT64_MODIFIER "u\n", dcph->seq); */
+ dccph->reserved2=tvb_get_guint8(tvb, offset+9);
+ /* DBG("dccph->reserved2: %u\n", dccph->reserved2); */
+ dccph->seq=tvb_get_ntohs(tvb, offset+10);
+ dccph->seq<<=32;
+ dccph->seq+=tvb_get_ntohl(tvb, offset+12);
+ /* DBG("dccph->seq[48bits]: %" G_GINT64_MODIFIER "u\n", dccph->seq); */
} else {
- dcph->seq=tvb_get_guint8(tvb, offset+9);
- dcph->seq<<=16;
- dcph->seq+=tvb_get_ntohs(tvb, offset+10);
- /* DBG("dcph->seq[24bits]: %" G_GINT64_MODIFIER "u\n", dcph->seq); */
+ dccph->seq=tvb_get_guint8(tvb, offset+9);
+ dccph->seq<<=16;
+ dccph->seq+=tvb_get_ntohs(tvb, offset+10);
+ /* DBG("dccph->seq[24bits]: %" G_GINT64_MODIFIER "u\n", dccph->seq); */
}
if (check_col(pinfo->cinfo, COL_INFO))
col_add_fstr(pinfo->cinfo, COL_INFO, "%s > %s [%s] Seq=%" G_GINT64_MODIFIER "u",
- get_dccp_port(dcph->sport),
- get_dccp_port(dcph->dport),
- val_to_str(dcph->type, dcp_packet_type_vals, "Unknown Type"),
- dcph->seq);
+ get_dccp_port(dccph->sport),
+ get_dccp_port(dccph->dport),
+ val_to_str(dccph->type, dccp_packet_type_vals, "Unknown Type"),
+ dccph->seq);
if (tree) {
- if(dcp_summary_in_tree) {
- dcp_item =
- proto_tree_add_protocol_format(tree, proto_dcp, tvb, offset, dcph->data_offset*4,
+ if(dccp_summary_in_tree) {
+ dccp_item =
+ proto_tree_add_protocol_format(tree, proto_dccp, tvb, offset, dccph->data_offset*4,
"Datagram Congestion Control Protocol, Src Port: %s (%u), Dst Port: %s (%u)"
" [%s] Seq=%" G_GINT64_MODIFIER "u",
- get_dccp_port(dcph->sport), dcph->sport,
- get_dccp_port(dcph->dport), dcph->dport,
- val_to_str(dcph->type, dcp_packet_type_vals, "Unknown Type"),
- dcph->seq);
+ get_dccp_port(dccph->sport), dccph->sport,
+ get_dccp_port(dccph->dport), dccph->dport,
+ val_to_str(dccph->type, dccp_packet_type_vals, "Unknown Type"),
+ dccph->seq);
} else {
- dcp_item = proto_tree_add_item(tree, proto_dcp, tvb, offset, 8, FALSE);
+ dccp_item = proto_tree_add_item(tree, proto_dccp, tvb, offset, 8, FALSE);
}
- dcp_tree = proto_item_add_subtree(dcp_item, ett_dcp);
+ dccp_tree = proto_item_add_subtree(dccp_item, ett_dccp);
- proto_tree_add_uint_format_value(dcp_tree, hf_dcp_srcport, tvb, offset, 2, dcph->sport,
- "%s (%u)", get_dccp_port(dcph->sport), dcph->sport);
- proto_tree_add_uint_format_value(dcp_tree, hf_dcp_dstport, tvb, offset + 2, 2, dcph->dport,
- "%s (%u)", get_dccp_port(dcph->dport), dcph->dport);
+ proto_tree_add_uint_format_value(dccp_tree, hf_dccp_srcport, tvb, offset, 2, dccph->sport,
+ "%s (%u)", get_dccp_port(dccph->sport), dccph->sport);
+ proto_tree_add_uint_format_value(dccp_tree, hf_dccp_dstport, tvb, offset + 2, 2, dccph->dport,
+ "%s (%u)", get_dccp_port(dccph->dport), dccph->dport);
- proto_tree_add_uint_hidden(dcp_tree, hf_dcp_port, tvb, offset, 2, dcph->sport);
- proto_tree_add_uint_hidden(dcp_tree, hf_dcp_port, tvb, offset + 2, 2, dcph->dport);
+ proto_tree_add_uint_hidden(dccp_tree, hf_dccp_port, tvb, offset, 2, dccph->sport);
+ proto_tree_add_uint_hidden(dccp_tree, hf_dccp_port, tvb, offset + 2, 2, dccph->dport);
- proto_tree_add_uint(dcp_tree, hf_dcp_data_offset, tvb, offset + 4, 1, dcph->data_offset);
- proto_tree_add_uint(dcp_tree, hf_dcp_ccval, tvb, offset + 5, 1, dcph->ccval);
- proto_tree_add_uint(dcp_tree, hf_dcp_cscov, tvb, offset + 5, 1, dcph->cscov);
+ proto_tree_add_uint(dccp_tree, hf_dccp_data_offset, tvb, offset + 4, 1, dccph->data_offset);
+ proto_tree_add_uint(dccp_tree, hf_dccp_ccval, tvb, offset + 5, 1, dccph->ccval);
+ proto_tree_add_uint(dccp_tree, hf_dccp_cscov, tvb, offset + 5, 1, dccph->cscov);
/* checksum analysis taken from packet-udp (difference: mandatory checksums in DCCP) */
@@ -717,58 +713,58 @@ static void dissect_dcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
}
cksum_vec[3].ptr = tvb_get_ptr(tvb, offset, len);
- cksum_vec[3].len = dccp_csum_coverage(dcph, reported_len);
+ cksum_vec[3].len = dccp_csum_coverage(dccph, reported_len);
computed_cksum = in_cksum(&cksum_vec[0], 4);
if (computed_cksum == 0) {
- proto_tree_add_uint_format_value(dcp_tree, hf_dcp_checksum, tvb,
- offset + 6, 2, dcph->checksum,
- "0x%04x [correct]", dcph->checksum);
+ proto_tree_add_uint_format_value(dccp_tree, hf_dccp_checksum, tvb,
+ offset + 6, 2, dccph->checksum,
+ "0x%04x [correct]", dccph->checksum);
} else {
- proto_tree_add_boolean_hidden(dcp_tree, hf_dcp_checksum_bad, tvb, offset + 6, 2, TRUE);
- proto_tree_add_uint_format_value(dcp_tree, hf_dcp_checksum, tvb, offset + 6, 2, dcph->checksum,
- "0x%04x [incorrect, should be 0x%04x]", dcph->checksum,
- in_cksum_shouldbe(dcph->checksum, computed_cksum));
+ proto_tree_add_boolean_hidden(dccp_tree, hf_dccp_checksum_bad, tvb, offset + 6, 2, TRUE);
+ proto_tree_add_uint_format_value(dccp_tree, hf_dccp_checksum, tvb, offset + 6, 2, dccph->checksum,
+ "0x%04x [incorrect, should be 0x%04x]", dccph->checksum,
+ in_cksum_shouldbe(dccph->checksum, computed_cksum));
}
} else {
- proto_tree_add_uint_format_value(dcp_tree, hf_dcp_checksum, tvb,
- offset + 6, 2, dcph->checksum, "0x%04x", dcph->checksum);
+ proto_tree_add_uint_format_value(dccp_tree, hf_dccp_checksum, tvb,
+ offset + 6, 2, dccph->checksum, "0x%04x", dccph->checksum);
}
} else {
- proto_tree_add_uint_format_value(dcp_tree, hf_dcp_checksum, tvb,
- offset + 6, 2, dcph->checksum, "0x%04x", dcph->checksum);
+ proto_tree_add_uint_format_value(dccp_tree, hf_dccp_checksum, tvb,
+ offset + 6, 2, dccph->checksum, "0x%04x", dccph->checksum);
}
- proto_tree_add_uint_hidden(dcp_tree, hf_dcp_res1, tvb, offset + 8, 1, dcph->reserved1);
- proto_tree_add_uint(dcp_tree, hf_dcp_type, tvb, offset + 8, 1, dcph->type);
- proto_tree_add_boolean(dcp_tree, hf_dcp_x, tvb, offset + 8, 1, dcph->x);
- if(dcph->x) {
- proto_tree_add_uint_hidden(dcp_tree, hf_dcp_res2, tvb, offset + 9, 1, dcph->reserved2);
- proto_tree_add_uint64(dcp_tree, hf_dcp_seq, tvb, offset + 10, 6, dcph->seq);
+ proto_tree_add_uint_hidden(dccp_tree, hf_dccp_res1, tvb, offset + 8, 1, dccph->reserved1);
+ proto_tree_add_uint(dccp_tree, hf_dccp_type, tvb, offset + 8, 1, dccph->type);
+ proto_tree_add_boolean(dccp_tree, hf_dccp_x, tvb, offset + 8, 1, dccph->x);
+ if(dccph->x) {
+ proto_tree_add_uint_hidden(dccp_tree, hf_dccp_res2, tvb, offset + 9, 1, dccph->reserved2);
+ proto_tree_add_uint64(dccp_tree, hf_dccp_seq, tvb, offset + 10, 6, dccph->seq);
} else {
- proto_tree_add_uint64(dcp_tree, hf_dcp_seq, tvb, offset + 9, 3, dcph->seq);
+ proto_tree_add_uint64(dccp_tree, hf_dccp_seq, tvb, offset + 9, 3, dccph->seq);
}
}
- if(dcph->x)
+ if(dccph->x)
offset+=16; /* Skip over extended Generic header */
else
offset+=12; /* Skip over not extended Generic header */
/* dissecting type depending additional fields */
- switch(dcph->type) {
+ switch(dccph->type) {
case 0x0: /* DCCP-Request */
if(!tvb_bytes_exist(tvb, offset, 4)) { /* at least 4 byte */
if(tree)
- proto_tree_add_text(dcp_tree, tvb, offset, -1, "too short packet");
+ proto_tree_add_text(dccp_tree, tvb, offset, -1, "too short packet");
return;
}
- dcph->service_code=tvb_get_ntohl(tvb, offset);
+ dccph->service_code=tvb_get_ntohl(tvb, offset);
if(tree)
- proto_tree_add_uint(dcp_tree, hf_dcp_service_code, tvb, offset, 4, dcph->service_code);
+ proto_tree_add_uint(dccp_tree, hf_dccp_service_code, tvb, offset, 4, dccph->service_code);
if (check_col(pinfo->cinfo, COL_INFO))
- col_append_fstr(pinfo->cinfo, COL_INFO, " (service=%u)", dcph->service_code);
+ col_append_fstr(pinfo->cinfo, COL_INFO, " (service=%u)", dccph->service_code);
offset+=4; /* Skip over service code */
break;
@@ -776,33 +772,33 @@ static void dissect_dcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case 0x1: /* DCCP-Response */
if(!tvb_bytes_exist(tvb, offset, 8)) { /* at least 8 byte */
if(tree)
- proto_tree_add_text(dcp_tree, tvb, offset, -1, "too short packet");
+ proto_tree_add_text(dccp_tree, tvb, offset, -1, "too short packet");
return;
}
- dcph->ack_reserved=tvb_get_ntohs(tvb, offset);
+ dccph->ack_reserved=tvb_get_ntohs(tvb, offset);
if(tree)
- proto_tree_add_uint_hidden(dcp_tree, hf_dcp_ack_res, tvb, offset, 2, dcph->ack_reserved);
- dcph->ack=tvb_get_ntohs(tvb, offset+2);
- dcph->ack<<=32;
- dcph->ack+=tvb_get_ntohl(tvb, offset+4);
+ proto_tree_add_uint_hidden(dccp_tree, hf_dccp_ack_res, tvb, offset, 2, dccph->ack_reserved);
+ dccph->ack=tvb_get_ntohs(tvb, offset+2);
+ dccph->ack<<=32;
+ dccph->ack+=tvb_get_ntohl(tvb, offset+4);
if(tree)
- proto_tree_add_uint64(dcp_tree, hf_dcp_ack, tvb, offset + 2, 6, dcph->ack);
+ proto_tree_add_uint64(dccp_tree, hf_dccp_ack, tvb, offset + 2, 6, dccph->ack);
if (check_col(pinfo->cinfo, COL_INFO))
- col_append_fstr(pinfo->cinfo, COL_INFO, " (Ack=%" G_GINT64_MODIFIER "u)", dcph->ack);
+ col_append_fstr(pinfo->cinfo, COL_INFO, " (Ack=%" G_GINT64_MODIFIER "u)", dccph->ack);
offset+=8; /* Skip over Acknowledgement Number Subheader */
if(!tvb_bytes_exist(tvb, offset, 4)) { /* at least 4 byte */
if(tree)
- proto_tree_add_text(dcp_tree, tvb, offset, -1, "too short packet");
+ proto_tree_add_text(dccp_tree, tvb, offset, -1, "too short packet");
return;
}
- dcph->service_code=tvb_get_ntohl(tvb, offset);
+ dccph->service_code=tvb_get_ntohl(tvb, offset);
if(tree)
- proto_tree_add_uint(dcp_tree, hf_dcp_service_code, tvb, offset, 4, dcph->service_code);
+ proto_tree_add_uint(dccp_tree, hf_dccp_service_code, tvb, offset, 4, dccph->service_code);
if (check_col(pinfo->cinfo, COL_INFO))
- col_append_fstr(pinfo->cinfo, COL_INFO, " (service=%u)", dcph->service_code);
+ col_append_fstr(pinfo->cinfo, COL_INFO, " (service=%u)", dccph->service_code);
offset+=4; /* Skip over service code */
break;
@@ -813,40 +809,40 @@ static void dissect_dcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case 0x3: /* DCCP-Ack */
case 0x4: /* DCCP-DataAck */
- if(dcph->x) {
+ if(dccph->x) {
if(!tvb_bytes_exist(tvb, offset, 8)) { /* at least 8 byte */
if(tree)
- proto_tree_add_text(dcp_tree, tvb, offset, -1, "too short packet");
+ proto_tree_add_text(dccp_tree, tvb, offset, -1, "too short packet");
return;
}
- dcph->ack_reserved=tvb_get_ntohs(tvb, offset);
+ dccph->ack_reserved=tvb_get_ntohs(tvb, offset);
if(tree)
- proto_tree_add_uint_hidden(dcp_tree, hf_dcp_ack_res, tvb, offset, 2, dcph->ack_reserved);
- dcph->ack=tvb_get_ntohs(tvb, offset+2);
- dcph->ack<<=32;
- dcph->ack+=tvb_get_ntohl(tvb, offset+4);
+ proto_tree_add_uint_hidden(dccp_tree, hf_dccp_ack_res, tvb, offset, 2, dccph->ack_reserved);
+ dccph->ack=tvb_get_ntohs(tvb, offset+2);
+ dccph->ack<<=32;
+ dccph->ack+=tvb_get_ntohl(tvb, offset+4);
if(tree)
- proto_tree_add_uint64(dcp_tree, hf_dcp_ack, tvb, offset + 2, 6, dcph->ack);
+ proto_tree_add_uint64(dccp_tree, hf_dccp_ack, tvb, offset + 2, 6, dccph->ack);
if (check_col(pinfo->cinfo, COL_INFO))
- col_append_fstr(pinfo->cinfo, COL_INFO, " (Ack=%" G_GINT64_MODIFIER "u)", dcph->ack);
+ col_append_fstr(pinfo->cinfo, COL_INFO, " (Ack=%" G_GINT64_MODIFIER "u)", dccph->ack);
offset+=8; /* Skip over Acknowledgement Number Subheader */
} else {
if(!tvb_bytes_exist(tvb, offset, 4)) { /* at least 4 byte */
if(tree)
- proto_tree_add_text(dcp_tree, tvb, offset, -1, "too short packet");
+ proto_tree_add_text(dccp_tree, tvb, offset, -1, "too short packet");
return;
}
- dcph->ack_reserved=tvb_get_guint8(tvb, offset);
+ dccph->ack_reserved=tvb_get_guint8(tvb, offset);
if(tree)
- proto_tree_add_uint_hidden(dcp_tree, hf_dcp_ack_res, tvb, offset, 1, dcph->ack_reserved);
- dcph->ack=tvb_get_guint8(tvb, offset+1);
- dcph->ack<<=16;
- dcph->ack+=tvb_get_ntohs(tvb, offset+2);
+ proto_tree_add_uint_hidden(dccp_tree, hf_dccp_ack_res, tvb, offset, 1, dccph->ack_reserved);
+ dccph->ack=tvb_get_guint8(tvb, offset+1);
+ dccph->ack<<=16;
+ dccph->ack+=tvb_get_ntohs(tvb, offset+2);
if(tree)
- proto_tree_add_uint64(dcp_tree, hf_dcp_ack, tvb, offset + 1, 3, dcph->ack);
+ proto_tree_add_uint64(dccp_tree, hf_dccp_ack, tvb, offset + 1, 3, dccph->ack);
if (check_col(pinfo->cinfo, COL_INFO))
- col_append_fstr(pinfo->cinfo, COL_INFO, " (Ack=%" G_GINT64_MODIFIER "u)", dcph->ack);
+ col_append_fstr(pinfo->cinfo, COL_INFO, " (Ack=%" G_GINT64_MODIFIER "u)", dccph->ack);
offset+=4; /* Skip over Acknowledgement Number Subheader */
}
@@ -855,34 +851,34 @@ static void dissect_dcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case 0x7: /* DCCP-Reset */
if(!tvb_bytes_exist(tvb, offset, 8)) { /* at least 8 byte */
if(tree)
- proto_tree_add_text(dcp_tree, tvb, offset, -1, "too short packet");
+ proto_tree_add_text(dccp_tree, tvb, offset, -1, "too short packet");
return;
}
- dcph->ack_reserved=tvb_get_ntohs(tvb, offset);
+ dccph->ack_reserved=tvb_get_ntohs(tvb, offset);
if(tree)
- proto_tree_add_uint_hidden(dcp_tree, hf_dcp_ack_res, tvb, offset, 2, dcph->ack_reserved);
- dcph->ack=tvb_get_ntohs(tvb, offset+2);
- dcph->ack<<=32;
- dcph->ack+=tvb_get_ntohl(tvb, offset+4);
+ proto_tree_add_uint_hidden(dccp_tree, hf_dccp_ack_res, tvb, offset, 2, dccph->ack_reserved);
+ dccph->ack=tvb_get_ntohs(tvb, offset+2);
+ dccph->ack<<=32;
+ dccph->ack+=tvb_get_ntohl(tvb, offset+4);
if(tree)
- proto_tree_add_uint64(dcp_tree, hf_dcp_ack, tvb, offset + 2, 6, dcph->ack);
+ proto_tree_add_uint64(dccp_tree, hf_dccp_ack, tvb, offset + 2, 6, dccph->ack);
if (check_col(pinfo->cinfo, COL_INFO))
- col_append_fstr(pinfo->cinfo, COL_INFO, " (Ack=%" G_GINT64_MODIFIER "u)", dcph->ack);
+ col_append_fstr(pinfo->cinfo, COL_INFO, " (Ack=%" G_GINT64_MODIFIER "u)", dccph->ack);
offset+=8; /* Skip over Acknowledgement Number Subheader */
- dcph->reset_code=tvb_get_guint8(tvb, offset);
- dcph->data1=tvb_get_guint8(tvb, offset+1);
- dcph->data2=tvb_get_guint8(tvb, offset+2);
- dcph->data3=tvb_get_guint8(tvb, offset+3);
+ dccph->reset_code=tvb_get_guint8(tvb, offset);
+ dccph->data1=tvb_get_guint8(tvb, offset+1);
+ dccph->data2=tvb_get_guint8(tvb, offset+2);
+ dccph->data3=tvb_get_guint8(tvb, offset+3);
if(tree) {
- proto_tree_add_uint(dcp_tree, hf_dcp_reset_code, tvb, offset, 1, dcph->reset_code);
- proto_tree_add_uint(dcp_tree, hf_dcp_data1, tvb, offset + 1, 1, dcph->data1);
- proto_tree_add_uint(dcp_tree, hf_dcp_data2, tvb, offset + 2, 1, dcph->data2);
- proto_tree_add_uint(dcp_tree, hf_dcp_data3, tvb, offset + 3, 1, dcph->data3);
+ proto_tree_add_uint(dccp_tree, hf_dccp_reset_code, tvb, offset, 1, dccph->reset_code);
+ proto_tree_add_uint(dccp_tree, hf_dccp_data1, tvb, offset + 1, 1, dccph->data1);
+ proto_tree_add_uint(dccp_tree, hf_dccp_data2, tvb, offset + 2, 1, dccph->data2);
+ proto_tree_add_uint(dccp_tree, hf_dccp_data3, tvb, offset + 3, 1, dccph->data3);
}
if (check_col(pinfo->cinfo, COL_INFO))
- col_append_fstr(pinfo->cinfo, COL_INFO, " (code=%s)", val_to_str(dcph->reset_code, dcp_reset_code_vals, "Unknown"));
+ col_append_fstr(pinfo->cinfo, COL_INFO, " (code=%s)", val_to_str(dccph->reset_code, dccp_reset_code_vals, "Unknown"));
offset+=4; /* Skip over Reset Code and data123 */
break;
@@ -893,26 +889,26 @@ static void dissect_dcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case 0x9: /* DCCP-SyncAck */
if(!tvb_bytes_exist(tvb, offset, 8)) { /* at least 8 byte */
if(tree)
- proto_tree_add_text(dcp_tree, tvb, offset, -1, "too short packet");
+ proto_tree_add_text(dccp_tree, tvb, offset, -1, "too short packet");
return;
}
- dcph->ack_reserved=tvb_get_ntohs(tvb, offset);
+ dccph->ack_reserved=tvb_get_ntohs(tvb, offset);
if(tree)
- proto_tree_add_uint_hidden(dcp_tree, hf_dcp_ack_res, tvb, offset, 2, dcph->ack_reserved);
- dcph->ack=tvb_get_ntohs(tvb, offset+2);
- dcph->ack<<=32;
- dcph->ack+=tvb_get_ntohl(tvb, offset+4);
+ proto_tree_add_uint_hidden(dccp_tree, hf_dccp_ack_res, tvb, offset, 2, dccph->ack_reserved);
+ dccph->ack=tvb_get_ntohs(tvb, offset+2);
+ dccph->ack<<=32;
+ dccph->ack+=tvb_get_ntohl(tvb, offset+4);
if(tree)
- proto_tree_add_uint64(dcp_tree, hf_dcp_ack, tvb, offset + 2, 6, dcph->ack);
+ proto_tree_add_uint64(dccp_tree, hf_dccp_ack, tvb, offset + 2, 6, dccph->ack);
if (check_col(pinfo->cinfo, COL_INFO))
- col_append_fstr(pinfo->cinfo, COL_INFO, " (Ack=%" G_GINT64_MODIFIER "u)", dcph->ack);
+ col_append_fstr(pinfo->cinfo, COL_INFO, " (Ack=%" G_GINT64_MODIFIER "u)", dccph->ack);
offset+=8; /* Skip over Acknowledgement Number Subheader */
break;
default:
if(tree)
- proto_tree_add_text(dcp_tree, tvb, offset, -1, "Reserved packet type: unable to dissect further");
+ proto_tree_add_text(dccp_tree, tvb, offset, -1, "Reserved packet type: unable to dissect further");
return;
}
@@ -922,12 +918,12 @@ static void dissect_dcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*/
/* it's time to do some checks */
- advertised_dccp_header_len = dcph->data_offset*4;
+ advertised_dccp_header_len = dccph->data_offset*4;
options_len = advertised_dccp_header_len - offset;
if ( advertised_dccp_header_len > DCCP_HDR_LEN_MAX ) {
if(tree)
- proto_tree_add_text(dcp_tree, tvb, 4, 2,
+ proto_tree_add_text(dccp_tree, tvb, 4, 2,
"bogus data offset, advertised header length (%d) is larger than max (%d)",
advertised_dccp_header_len, DCCP_HDR_LEN_MAX);
return;
@@ -935,7 +931,7 @@ static void dissect_dcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if(tvb_length(tvb) < advertised_dccp_header_len) {
if(tree)
- proto_tree_add_text(dcp_tree, tvb, offset, -1, "too short packet: missing %d bytes of DCCP header",
+ proto_tree_add_text(dccp_tree, tvb, offset, -1, "too short packet: missing %d bytes of DCCP header",
advertised_dccp_header_len - tvb_reported_length_remaining(tvb, offset));
return;
}
@@ -943,7 +939,7 @@ static void dissect_dcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if(options_len > DCCP_OPT_LEN_MAX) {
/* DBG("malformed\n"); */
if(tree)
- proto_tree_add_boolean_hidden(dcp_tree, hf_dcp_malformed, tvb, offset, 0, TRUE);
+ proto_tree_add_boolean_hidden(dccp_tree, hf_dccp_malformed, tvb, offset, 0, TRUE);
THROW(ReportedBoundsError);
}
@@ -953,193 +949,193 @@ static void dissect_dcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
; /* ok no options, no need to skip over */
} else if (advertised_dccp_header_len < offset) {
if(tree) {
- proto_tree_add_text(dcp_tree, tvb, 4, 2,
+ proto_tree_add_text(dccp_tree, tvb, 4, 2,
"bogus data offset, advertised header length (%d) is shorter than expected",
advertised_dccp_header_len);
- proto_tree_add_boolean_hidden(dcp_tree, hf_dcp_malformed, tvb, offset, 0, TRUE);
+ proto_tree_add_boolean_hidden(dccp_tree, hf_dccp_malformed, tvb, offset, 0, TRUE);
}
THROW(ReportedBoundsError);
} else {
- if(dcp_tree) {
- dcp_item = proto_tree_add_none_format(dcp_tree, hf_dcp_options, tvb, offset, options_len, "Options: (%u bytes)", options_len);
- dcp_options_tree = proto_item_add_subtree(dcp_item, ett_dcp_options);
+ if(dccp_tree) {
+ dccp_item = proto_tree_add_none_format(dccp_tree, hf_dccp_options, tvb, offset, options_len, "Options: (%u bytes)", options_len);
+ dccp_options_tree = proto_item_add_subtree(dccp_item, ett_dccp_options);
}
- dissect_options(tvb, pinfo, dcp_options_tree, tree, dcph, offset, offset + options_len);
+ dissect_options(tvb, pinfo, dccp_options_tree, tree, dccph, offset, offset + options_len);
}
offset+=options_len; /* Skip over Options */
/* Queuing tap data */
- tap_queue_packet(dccp_tap, pinfo, dcph);
+ tap_queue_packet(dccp_tap, pinfo, dccph);
/* Call sub-dissectors */
if (!pinfo->in_error_pkt || tvb_length_remaining(tvb, offset) > 0)
- decode_dccp_ports(tvb, offset, pinfo, tree, dcph->sport, dcph->dport);
+ decode_dccp_ports(tvb, offset, pinfo, tree, dccph->sport, dccph->dport);
}
-void proto_register_dcp(void)
+void proto_register_dccp(void)
{
- module_t *dcp_module;
+ module_t *dccp_module;
static hf_register_info hf[] = {
- { &hf_dcp_srcport,
- { "Source Port", "dcp.srcport", FT_UINT16, BASE_DEC, NULL, 0x0,
+ { &hf_dccp_srcport,
+ { "Source Port", "dccp.srcport", FT_UINT16, BASE_DEC, NULL, 0x0,
"", HFILL }},
- { &hf_dcp_dstport,
- { "Destination Port", "dcp.dstport", FT_UINT16, BASE_DEC, NULL, 0x0,
+ { &hf_dccp_dstport,
+ { "Destination Port", "dccp.dstport", FT_UINT16, BASE_DEC, NULL, 0x0,
"", HFILL }},
- { &hf_dcp_port,
- { "Source or Destination Port", "dcp.port", FT_UINT16, BASE_DEC, NULL, 0x0,
+ { &hf_dccp_port,
+ { "Source or Destination Port", "dccp.port", FT_UINT16, BASE_DEC, NULL, 0x0,
"", HFILL }},
- { &hf_dcp_data_offset,
- { "Data Offset", "dcp.data_offset", FT_UINT8, BASE_DEC, NULL, 0x0,
+ { &hf_dccp_data_offset,
+ { "Data Offset", "dccp.data_offset", FT_UINT8, BASE_DEC, NULL, 0x0,
"", HFILL }},
- { &hf_dcp_ccval,
- { "CCVal", "dcp.ccval", FT_UINT8, BASE_DEC, NULL, 0x0,
+ { &hf_dccp_ccval,
+ { "CCVal", "dccp.ccval", FT_UINT8, BASE_DEC, NULL, 0x0,
"", HFILL }},
- { &hf_dcp_cscov,
- { "Checksum Coverage", "dcp.cscov", FT_UINT8, BASE_DEC, NULL, 0x0,
+ { &hf_dccp_cscov,
+ { "Checksum Coverage", "dccp.cscov", FT_UINT8, BASE_DEC, NULL, 0x0,
"", HFILL }},
- { &hf_dcp_checksum_bad,
- { "Bad Checksum", "dcp.checksum_bad", FT_BOOLEAN, BASE_DEC, NULL, 0x0,
+ { &hf_dccp_checksum_bad,
+ { "Bad Checksum", "dccp.checksum_bad", FT_BOOLEAN, BASE_DEC, NULL, 0x0,
"", HFILL }},
- { &hf_dcp_checksum,
- { "Checksum", "dcp.checksum", FT_UINT16, BASE_HEX, NULL, 0x0,
+ { &hf_dccp_checksum,
+ { "Checksum", "dccp.checksum", FT_UINT16, BASE_HEX, NULL, 0x0,
"", HFILL }},
- { &hf_dcp_res1,
- { "Reserved", "dcp.res1", FT_UINT8, BASE_HEX, NULL, 0x0,
+ { &hf_dccp_res1,
+ { "Reserved", "dccp.res1", FT_UINT8, BASE_HEX, NULL, 0x0,
"", HFILL }},
- { &hf_dcp_res2,
- { "Reserved", "dcp.res2", FT_UINT8, BASE_HEX, NULL, 0x0,
+ { &hf_dccp_res2,
+ { "Reserved", "dccp.res2", FT_UINT8, BASE_HEX, NULL, 0x0,
"", HFILL }},
- { &hf_dcp_type,
- { "Type", "dcp.type", FT_UINT8, BASE_DEC, VALS(dcp_packet_type_vals), 0x0,
+ { &hf_dccp_type,
+ { "Type", "dccp.type", FT_UINT8, BASE_DEC, VALS(dccp_packet_type_vals), 0x0,
"", HFILL }},
- { &hf_dcp_x,
- { "Extended Sequence Numbers", "dcp.x", FT_BOOLEAN, BASE_DEC, NULL, 0x0,
+ { &hf_dccp_x,
+ { "Extended Sequence Numbers", "dccp.x", FT_BOOLEAN, BASE_DEC, NULL, 0x0,
"", HFILL }},
- { &hf_dcp_seq,
- { "Sequence Number", "dcp.seq", FT_UINT64, BASE_DEC, NULL, 0x0,
+ { &hf_dccp_seq,
+ { "Sequence Number", "dccp.seq", FT_UINT64, BASE_DEC, NULL, 0x0,
"", HFILL }},
- { &hf_dcp_ack_res,
- { "Reserved", "dcp.ack_res", FT_UINT16, BASE_HEX, NULL, 0x0,
+ { &hf_dccp_ack_res,
+ { "Reserved", "dccp.ack_res", FT_UINT16, BASE_HEX, NULL, 0x0,
"", HFILL }},
- { &hf_dcp_ack,
- { "Acknowledgement Number", "dcp.ack", FT_UINT64, BASE_DEC, NULL, 0x0,
+ { &hf_dccp_ack,
+ { "Acknowledgement Number", "dccp.ack", FT_UINT64, BASE_DEC, NULL, 0x0,
"", HFILL }},
- { &hf_dcp_service_code,
- { "Service Code", "dcp.service_code", FT_UINT32, BASE_DEC, NULL, 0x0,
+ { &hf_dccp_service_code,
+ { "Service Code", "dccp.service_code", FT_UINT32, BASE_DEC, NULL, 0x0,
"", HFILL }},
- { &hf_dcp_reset_code,
- { "Reset Code", "dcp.reset_code", FT_UINT8, BASE_DEC, VALS(dcp_reset_code_vals), 0x0,
+ { &hf_dccp_reset_code,
+ { "Reset Code", "dccp.reset_code", FT_UINT8, BASE_DEC, VALS(dccp_reset_code_vals), 0x0,
"", HFILL }},
- { &hf_dcp_data1,
- { "Data 1", "dcp.data1", FT_UINT8, BASE_DEC, NULL, 0x0,
+ { &hf_dccp_data1,
+ { "Data 1", "dccp.data1", FT_UINT8, BASE_DEC, NULL, 0x0,
"", HFILL }},
- { &hf_dcp_data2,
- { "Data 2", "dcp.data2", FT_UINT8, BASE_DEC, NULL, 0x0,
+ { &hf_dccp_data2,
+ { "Data 2", "dccp.data2", FT_UINT8, BASE_DEC, NULL, 0x0,
"", HFILL }},
- { &hf_dcp_data3,
- { "Data 3", "dcp.data3", FT_UINT8, BASE_DEC, NULL, 0x0,
+ { &hf_dccp_data3,
+ { "Data 3", "dccp.data3", FT_UINT8, BASE_DEC, NULL, 0x0,
"", HFILL }},
- { &hf_dcp_option_type,
- { "Option Type", "dcp.option_type", FT_UINT8, BASE_DEC, NULL, 0x0,
+ { &hf_dccp_option_type,
+ { "Option Type", "dccp.option_type", FT_UINT8, BASE_DEC, NULL, 0x0,
"", HFILL }},
- { &hf_dcp_feature_number,
- { "Feature Number", "dcp.feature_number", FT_UINT8, BASE_DEC, NULL, 0x0,
+ { &hf_dccp_feature_number,
+ { "Feature Number", "dccp.feature_number", FT_UINT8, BASE_DEC, NULL, 0x0,
"", HFILL }},
- { &hf_dcp_ndp_count,
- { "NDP Count", "dcp.ndp_count", FT_UINT64, BASE_DEC, NULL, 0x0,
+ { &hf_dccp_ndp_count,
+ { "NDP Count", "dccp.ndp_count", FT_UINT64, BASE_DEC, NULL, 0x0,
"", HFILL }},
- { &hf_dcp_timestamp,
- { "Timestamp", "dcp.timestamp", FT_UINT32, BASE_DEC, NULL, 0x0,
+ { &hf_dccp_timestamp,
+ { "Timestamp", "dccp.timestamp", FT_UINT32, BASE_DEC, NULL, 0x0,
"", HFILL }},
- { &hf_dcp_timestamp_echo,
- { "Timestamp Echo", "dcp.timestamp_echo", FT_UINT32, BASE_DEC, NULL, 0x0,
+ { &hf_dccp_timestamp_echo,
+ { "Timestamp Echo", "dccp.timestamp_echo", FT_UINT32, BASE_DEC, NULL, 0x0,
"", HFILL }},
- { &hf_dcp_elapsed_time,
- { "Elapsed Time", "dcp.elapsed_time", FT_UINT32, BASE_DEC, NULL, 0x0,
+ { &hf_dccp_elapsed_time,
+ { "Elapsed Time", "dccp.elapsed_time", FT_UINT32, BASE_DEC, NULL, 0x0,
"", HFILL }},
- { &hf_dcp_data_checksum,
- { "Data Checksum", "dcp.checksum_data", FT_UINT32, BASE_HEX, NULL, 0x0,
+ { &hf_dccp_data_checksum,
+ { "Data Checksum", "dccp.checksum_data", FT_UINT32, BASE_HEX, NULL, 0x0,
"", HFILL }},
- { &hf_dcp_malformed,
- { "Malformed", "dcp.malformed", FT_BOOLEAN, BASE_DEC, NULL, 0x0,
+ { &hf_dccp_malformed,
+ { "Malformed", "dccp.malformed", FT_BOOLEAN, BASE_DEC, NULL, 0x0,
"", HFILL }},
- { &hf_dcp_options,
- { "Options", "dcp.options", FT_NONE, BASE_DEC, NULL, 0x0,
- "DCP Options fields", HFILL }}
+ { &hf_dccp_options,
+ { "Options", "dccp.options", FT_NONE, BASE_DEC, NULL, 0x0,
+ "DCCP Options fields", HFILL }}
};
static gint *ett[] = {
- &ett_dcp,
- &ett_dcp_options
+ &ett_dccp,
+ &ett_dccp_options
};
- proto_dcp = proto_register_protocol("Datagram Congestion Control Protocol", "DCP", "dcp");
- proto_register_field_array(proto_dcp, hf, array_length(hf));
+ proto_dccp = proto_register_protocol("Datagram Congestion Control Protocol", "DCCP", "dccp");
+ proto_register_field_array(proto_dccp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
/* subdissectors */
- dcp_subdissector_table = register_dissector_table("dcp.port", "DCP port", FT_UINT16, BASE_DEC);
- register_heur_dissector_list("dcp", &heur_subdissector_list);
+ dccp_subdissector_table = register_dissector_table("dccp.port", "DCCP port", FT_UINT16, BASE_DEC);
+ register_heur_dissector_list("dccp", &heur_subdissector_list);
/* reg preferences */
- dcp_module = prefs_register_protocol(proto_dcp, NULL);
- prefs_register_bool_preference(dcp_module, "summary_in_tree",
+ dccp_module = prefs_register_protocol(proto_dccp, NULL);
+ prefs_register_bool_preference(dccp_module, "summary_in_tree",
"Show DCCP summary in protocol tree",
"Whether the DCCP summary line should be shown in the protocol tree",
- &dcp_summary_in_tree);
+ &dccp_summary_in_tree);
- prefs_register_bool_preference(dcp_module, "try_heuristic_first",
+ prefs_register_bool_preference(dccp_module, "try_heuristic_first",
"Try heuristic sub-dissectors first",
"Try to decode a packet using an heuristic sub-dissector before using a sub-dissector "
"registered to a specific port",
&try_heuristic_first);
- prefs_register_bool_preference(dcp_module, "check_checksum",
+ prefs_register_bool_preference(dccp_module, "check_checksum",
"Check the validity of the DCCP checksum when possible",
"Whether to check the validity of the DCCP checksum",
&dccp_check_checksum);
}
-void proto_reg_handoff_dcp(void)
+void proto_reg_handoff_dccp(void)
{
- dissector_handle_t dcp_handle;
+ dissector_handle_t dccp_handle;
- dcp_handle = create_dissector_handle(dissect_dcp, proto_dcp);
- dissector_add("ip.proto", IP_PROTO_DCCP, dcp_handle);
+ dccp_handle = create_dissector_handle(dissect_dccp, proto_dccp);
+ dissector_add("ip.proto", IP_PROTO_DCCP, dccp_handle);
data_handle = find_dissector("data");
dccp_tap = register_tap("dccp");
}
diff --git a/epan/dissectors/packet-dcp.h b/epan/dissectors/packet-dccp.h
index 2f66bf3bc6..cfd90866ac 100644
--- a/epan/dissectors/packet-dcp.h
+++ b/epan/dissectors/packet-dccp.h
@@ -1,4 +1,4 @@
-/* packet-dcp.h
+/* packet-dccp.h
* Definitions for Datagram Congestion Control Protocol, "DCCP" dissection:
* it should be conformance to draft-ietf-dccp-spec-11.txt
*
@@ -29,11 +29,11 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifndef __PACKET_DCP_H__
-#define __PACKET_DCP_H__
+#ifndef __PACKET_DCCP_H__
+#define __PACKET_DCCP_H__
/* DCCP structs and definitions */
-typedef struct _e_dcphdr {
+typedef struct _e_dccphdr {
guint16 sport;
guint16 dport;
guint8 data_offset;
@@ -57,6 +57,6 @@ typedef struct _e_dcphdr {
address ip_src;
address ip_dst;
-} e_dcphdr;
+} e_dccphdr;
-#endif /* __PACKET_DCP_H__ */
+#endif /* __PACKET_DCCP_H__ */