summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ixiatrailer.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/dissectors/packet-ixiatrailer.c')
-rw-r--r--epan/dissectors/packet-ixiatrailer.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/epan/dissectors/packet-ixiatrailer.c b/epan/dissectors/packet-ixiatrailer.c
index 1cdff60b..c4f41c12 100644
--- a/epan/dissectors/packet-ixiatrailer.c
+++ b/epan/dissectors/packet-ixiatrailer.c
@@ -46,16 +46,16 @@ static const value_string ixiatrailer_ftype_timestamp[] = {
};
/* Preference settings */
-static gboolean ixiatrailer_summary_in_tree = TRUE;
+static bool ixiatrailer_summary_in_tree = true;
-static int proto_ixiatrailer = -1;
-static gint ett_ixiatrailer = -1;
+static int proto_ixiatrailer;
+static int ett_ixiatrailer;
-static int hf_ixiatrailer_packetlen = -1;
-static int hf_ixiatrailer_timestamp = -1;
-static int hf_ixiatrailer_generic = -1;
+static int hf_ixiatrailer_packetlen;
+static int hf_ixiatrailer_timestamp;
+static int hf_ixiatrailer_generic;
-static expert_field ei_ixiatrailer_field_length_invalid = EI_INIT;
+static expert_field ei_ixiatrailer_field_length_invalid;
/* The trailer begins with a sequence of TLVs, each of which has a
1-byte type, a 1-byte value length (not TLV length, so the TLV
@@ -72,13 +72,13 @@ static int
dissect_ixiatrailer(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
{
proto_tree *ti;
- guint tvblen, trailer_length, field_length;
- gboolean matched_without_fcs, matched_with_fcs;
+ unsigned tvblen, trailer_length, field_length;
+ bool matched_without_fcs, matched_with_fcs;
proto_tree *ixiatrailer_tree = NULL;
- guint offset = 0;
- guint16 cksum, comp_cksum;
+ unsigned offset = 0;
+ uint16_t cksum, comp_cksum;
vec_t vec;
- guint8 field_type;
+ uint8_t field_type;
/* A trailer must, at minimum, include:
@@ -123,7 +123,7 @@ dissect_ixiatrailer(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, voi
if (!matched_without_fcs && tvblen >= 13)
matched_with_fcs = (tvb_get_ntohs(tvb, tvblen-(4+4)) == IXIA_PATTERN);
else
- matched_with_fcs = FALSE;
+ matched_with_fcs = false;
if (!matched_without_fcs) {
if (!matched_with_fcs) {
/* Neither matched, so no Ixia trailer. */
@@ -137,7 +137,7 @@ dissect_ixiatrailer(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, voi
}
/* Read Trailer-length field */
- trailer_length = tvb_get_guint8(tvb, tvblen-5);
+ trailer_length = tvb_get_uint8(tvb, tvblen-5);
/* Should match overall length of trailer */
if ((tvblen-5) != trailer_length) {
return 0;
@@ -166,8 +166,8 @@ dissect_ixiatrailer(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, voi
while (offset < trailer_length - 2)
{
- field_type = tvb_get_guint8(tvb, offset++);
- field_length = tvb_get_guint8(tvb, offset++);
+ field_type = tvb_get_uint8(tvb, offset++);
+ field_length = tvb_get_uint8(tvb, offset++);
switch (field_type) {
case IXIATRAILER_FTYPE_ORIGINAL_PACKET_SIZE:
if (field_length != 2){
@@ -202,6 +202,12 @@ dissect_ixiatrailer(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, voi
return tvblen;
}
+static bool
+dissect_ixiatrailer_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
+{
+ return dissect_ixiatrailer(tvb, pinfo, tree, data) > 0;
+}
+
void
proto_register_ixiatrailer(void)
{
@@ -218,7 +224,7 @@ proto_register_ixiatrailer(void)
NULL, 0x0, NULL, HFILL }},
};
- static gint *ixiatrailer_ett[] = {
+ static int *ixiatrailer_ett[] = {
&ett_ixiatrailer
};
@@ -247,7 +253,7 @@ void
proto_reg_handoff_ixiatrailer(void)
{
/* Check for Ixia format in the ethernet trailer */
- heur_dissector_add("eth.trailer", dissect_ixiatrailer, "Ixia Trailer", "ixiatrailer_eth", proto_ixiatrailer, HEURISTIC_ENABLE);
+ heur_dissector_add("eth.trailer", dissect_ixiatrailer_heur, "Ixia Trailer", "ixiatrailer_eth", proto_ixiatrailer, HEURISTIC_ENABLE);
}
/*