aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-dccp.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2013-06-09 03:28:05 +0000
committerMichael Mann <mmann78@netscape.net>2013-06-09 03:28:05 +0000
commit2d37ec3cb0279abe706199317297c2b17e6e1893 (patch)
tree563e2a874043276d42233d46ec63357ee2ebe767 /epan/dissectors/packet-dccp.c
parent5ea3858f5341b44ee1c5fb614883b92c2d194811 (diff)
Batch of filterable expert infos.
svn path=/trunk/; revision=49853
Diffstat (limited to 'epan/dissectors/packet-dccp.c')
-rw-r--r--epan/dissectors/packet-dccp.c51
1 files changed, 32 insertions, 19 deletions
diff --git a/epan/dissectors/packet-dccp.c b/epan/dissectors/packet-dccp.c
index 40e56e7d8c..6eff1bd0c2 100644
--- a/epan/dissectors/packet-dccp.c
+++ b/epan/dissectors/packet-dccp.c
@@ -184,6 +184,10 @@ static int hf_dccp_data_checksum = -1;
static gint ett_dccp = -1;
static gint ett_dccp_options = -1;
+static expert_field ei_dccp_option_len_bad = EI_INIT;
+static expert_field ei_dccp_advertised_header_length_bad = EI_INIT;
+static expert_field ei_dccp_packet_type_reserved = EI_INIT;
+
static dissector_table_t dccp_subdissector_table;
static heur_dissector_list_t heur_subdissector_list;
static dissector_handle_t data_handle;
@@ -408,7 +412,7 @@ dissect_options(tvbuff_t *tvb, packet_info *pinfo _U_,
option_len = tvb_get_guint8(tvb, offset + 1);
if (option_len < 2) {
- expert_add_info_format(pinfo, option_item, PI_MALFORMED, PI_ERROR,
+ expert_add_info_format_text(pinfo, option_item, &ei_dccp_option_len_bad,
"Option length incorrect, must be >= 2");
return;
}
@@ -452,7 +456,7 @@ dissect_options(tvbuff_t *tvb, packet_info *pinfo _U_,
break;
case 37:
if (option_len > 8)
- expert_add_info_format(pinfo, option_item, PI_PROTOCOL, PI_WARN,
+ expert_add_info_format_text(pinfo, option_item, &ei_dccp_option_len_bad,
"NDP Count too long (max 6 bytes)");
else
proto_tree_add_text(dccp_options_tree, tvb, offset, option_len,
@@ -491,7 +495,7 @@ dissect_options(tvbuff_t *tvb, packet_info *pinfo _U_,
offset + 2, 4,
tvb_get_ntohl(tvb, offset + 2));
else
- expert_add_info_format(pinfo, option_item, PI_PROTOCOL, PI_WARN,
+ expert_add_info_format_text(pinfo, option_item, &ei_dccp_option_len_bad,
"Timestamp too long [%u != 6]", option_len);
break;
case 42:
@@ -514,7 +518,7 @@ dissect_options(tvbuff_t *tvb, packet_info *pinfo _U_,
tvb, offset + 6, 4,
tvb_get_ntohl(tvb, offset + 6));
} else
- expert_add_info_format(pinfo, option_item, PI_PROTOCOL, PI_WARN,
+ expert_add_info_format_text(pinfo, option_item, &ei_dccp_option_len_bad,
"Wrong Timestamp Echo length");
break;
case 43:
@@ -527,7 +531,7 @@ dissect_options(tvbuff_t *tvb, packet_info *pinfo _U_,
tvb, offset + 2, 4,
tvb_get_ntohl(tvb, offset + 2));
else
- expert_add_info_format(pinfo, option_item, PI_PROTOCOL, PI_WARN,
+ expert_add_info_format_text(pinfo, option_item, &ei_dccp_option_len_bad,
"Wrong Elapsed Time length");
break;
case 44:
@@ -536,7 +540,7 @@ dissect_options(tvbuff_t *tvb, packet_info *pinfo _U_,
tvb, offset + 2, 4,
tvb_get_ntohl(tvb, offset + 2));
} else
- expert_add_info_format(pinfo, option_item, PI_PROTOCOL, PI_WARN,
+ expert_add_info_format_text(pinfo, option_item, &ei_dccp_option_len_bad,
"Wrong Data checksum length");
break;
case 192: /* RFC 4342, 8.5 */
@@ -555,7 +559,7 @@ dissect_options(tvbuff_t *tvb, packet_info *pinfo _U_,
option_len, "CCID3 Loss Event Rate: %u",
p);
} else
- expert_add_info_format(pinfo, option_item, PI_PROTOCOL, PI_WARN,
+ expert_add_info_format_text(pinfo, option_item, &ei_dccp_option_len_bad,
"Wrong CCID3 Loss Event Rate length");
break;
case 193: /* RFC 4342, 8.6 */
@@ -572,7 +576,7 @@ dissect_options(tvbuff_t *tvb, packet_info *pinfo _U_,
"CCID3 Receive Rate: %u bytes/sec",
tvb_get_ntohl(tvb, offset + 2));
else
- expert_add_info_format(pinfo, option_item, PI_PROTOCOL, PI_WARN,
+ expert_add_info_format_text(pinfo, option_item, &ei_dccp_option_len_bad,
"Wrong CCID3 Receive Rate length");
break;
default:
@@ -803,7 +807,7 @@ dissect_dccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
if (dccph->x) {
if (advertised_dccp_header_len < DCCP_GEN_HDR_LEN_X) {
- expert_add_info_format(pinfo, offset_item, PI_MALFORMED, PI_ERROR,
+ expert_add_info_format_text(pinfo, offset_item, &ei_dccp_advertised_header_length_bad,
"Advertised header length (%u) is smaller than the minimum (%u)",
advertised_dccp_header_len, DCCP_GEN_HDR_LEN_X);
return tvb_length(tvb);
@@ -821,7 +825,7 @@ dissect_dccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
offset += 6;
} else {
if (advertised_dccp_header_len < DCCP_GEN_HDR_LEN_NO_X) {
- expert_add_info_format(pinfo, offset_item, PI_MALFORMED, PI_ERROR,
+ expert_add_info_format_text(pinfo, offset_item, &ei_dccp_advertised_header_length_bad,
"Advertised header length (%u) is smaller than the minimum (%u)",
advertised_dccp_header_len, DCCP_GEN_HDR_LEN_NO_X);
return tvb_length(tvb);
@@ -844,7 +848,7 @@ dissect_dccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
case 0x0: /* DCCP-Request */
case 0xA: /* DCCP-Listen */
if (advertised_dccp_header_len < offset + 4) {
- expert_add_info_format(pinfo, offset_item, PI_MALFORMED, PI_ERROR,
+ expert_add_info_format_text(pinfo, offset_item, &ei_dccp_advertised_header_length_bad,
"Advertised header length (%u) is smaller than the minimum (%u) for %s",
advertised_dccp_header_len, offset + 4,
val_to_str(dccph->type, dccp_packet_type_vals, "Unknown (%u)"));
@@ -860,7 +864,7 @@ dissect_dccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
break;
case 0x1: /* DCCP-Response */
if (advertised_dccp_header_len < offset + 12) {
- expert_add_info_format(pinfo, offset_item, PI_MALFORMED, PI_ERROR,
+ expert_add_info_format_text(pinfo, offset_item, &ei_dccp_advertised_header_length_bad,
"Advertised header length (%u) is smaller than the minimum (%u) for Response",
advertised_dccp_header_len, offset + 12);
return tvb_length(tvb);
@@ -900,7 +904,7 @@ dissect_dccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
case 0x4: /* DCCP-DataAck */
if (dccph->x) {
if (advertised_dccp_header_len < offset + 8) {
- expert_add_info_format(pinfo, offset_item, PI_MALFORMED, PI_ERROR,
+ expert_add_info_format_text(pinfo, offset_item, &ei_dccp_advertised_header_length_bad,
"Advertised header length (%u) is smaller than the minimum (%u) for %s",
advertised_dccp_header_len, offset + 8,
val_to_str(dccph->type, dccp_packet_type_vals, "Unknown (%u)"));
@@ -925,7 +929,7 @@ dissect_dccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
offset += 8; /* move offset past the Ack Number Subheader */
} else {
if (advertised_dccp_header_len < offset + 4) {
- expert_add_info_format(pinfo, offset_item, PI_MALFORMED, PI_ERROR,
+ expert_add_info_format_text(pinfo, offset_item, &ei_dccp_advertised_header_length_bad,
"Advertised header length (%u) is smaller than the minimum (%u) for %s",
advertised_dccp_header_len, offset + 4,
val_to_str(dccph->type, dccp_packet_type_vals, "Unknown (%u)"));
@@ -951,7 +955,7 @@ dissect_dccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
break;
case 0x7: /* DCCP-Reset */
if (advertised_dccp_header_len < offset + 4) {
- expert_add_info_format(pinfo, offset_item, PI_MALFORMED, PI_ERROR,
+ expert_add_info_format_text(pinfo, offset_item, &ei_dccp_advertised_header_length_bad,
"Advertised header length (%u) is smaller than the minimum (%u) for Reset",
advertised_dccp_header_len, offset + 4);
return tvb_length(tvb);
@@ -1002,7 +1006,7 @@ dissect_dccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
case 0x8: /* DCCP-Sync */
case 0x9: /* DCCP-SyncAck */
if (advertised_dccp_header_len < offset + 8) {
- expert_add_info_format(pinfo, offset_item, PI_MALFORMED, PI_ERROR,
+ expert_add_info_format_text(pinfo, offset_item, &ei_dccp_advertised_header_length_bad,
"Advertised header length (%u) is smaller than the minimum (%u) for %s",
advertised_dccp_header_len, offset + 8,
val_to_str(dccph->type, dccp_packet_type_vals, "Unknown (%u)"));
@@ -1026,8 +1030,7 @@ dissect_dccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
offset += 8; /* move offset past the Ack. Number Subheader */
break;
default:
- expert_add_info_format(pinfo, dccp_item, PI_PROTOCOL, PI_WARN,
- "Reserved packet type: unable to dissect further");
+ expert_add_info(pinfo, dccp_item, &ei_dccp_packet_type_reserved);
return tvb_length(tvb);
}
@@ -1036,7 +1039,7 @@ dissect_dccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
* DCCP header to the start of its application data area, in 32-bit words.
*/
if (advertised_dccp_header_len > DCCP_HDR_LEN_MAX) {
- expert_add_info_format(pinfo, offset_item, PI_PROTOCOL, PI_WARN,
+ expert_add_info_format_text(pinfo, offset_item, &ei_dccp_advertised_header_length_bad,
"Advertised header length (%u) is larger than the maximum (%u)",
advertised_dccp_header_len, DCCP_HDR_LEN_MAX);
return tvb_length(tvb);
@@ -1317,11 +1320,21 @@ proto_register_dccp(void)
&ett_dccp_options
};
+ static ei_register_info ei[] = {
+ { &ei_dccp_option_len_bad, { "dccp.option.len.bad", PI_PROTOCOL, PI_WARN, "Bad option length", EXPFILL }},
+ { &ei_dccp_advertised_header_length_bad, { "dccp.advertised_header_length.bad", PI_MALFORMED, PI_ERROR, "Advertised header length bad", EXPFILL }},
+ { &ei_dccp_packet_type_reserved, { "dccp.packet_type.reserved", PI_PROTOCOL, PI_WARN, "Reserved packet type: unable to dissect further", EXPFILL }},
+ };
+
+ expert_module_t* expert_dccp;
+
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));
+ expert_dccp = expert_register_protocol(proto_dccp);
+ expert_register_field_array(expert_dccp, ei, array_length(ei));
/* subdissectors */
dccp_subdissector_table =