diff options
Diffstat (limited to 'epan/dissectors/packet-banana.c')
-rw-r--r-- | epan/dissectors/packet-banana.c | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/epan/dissectors/packet-banana.c b/epan/dissectors/packet-banana.c index b5b157c8f2..5f23549b71 100644 --- a/epan/dissectors/packet-banana.c +++ b/epan/dissectors/packet-banana.c @@ -11,7 +11,7 @@ /* * Based on "Banana Protocol Specifications" - * http://twistedmatrix.com/projects/core/documentation/specifications/banana.html + * https://twisted.org/documents/16.1.1/core/specifications/banana.html */ #include "config.h" @@ -23,25 +23,25 @@ void proto_register_banana(void); void proto_reg_handoff_banana(void); /* Initialize the protocol and registered fields */ -static int proto_banana = -1; -static int hf_banana_list = -1; -static int hf_banana_int = -1; -static int hf_banana_string = -1; -static int hf_banana_neg_int = -1; -static int hf_banana_float = -1; -static int hf_banana_lg_int = -1; -static int hf_banana_lg_neg_int = -1; -static int hf_banana_pb = -1; +static int proto_banana; +static int hf_banana_list; +static int hf_banana_int; +static int hf_banana_string; +static int hf_banana_neg_int; +static int hf_banana_float; +static int hf_banana_lg_int; +static int hf_banana_lg_neg_int; +static int hf_banana_pb; /* Initialize the subtree pointers */ -static gint ett_banana = -1; -static gint ett_list = -1; +static gint ett_banana; +static gint ett_list; -static expert_field ei_banana_unknown_type = EI_INIT; -static expert_field ei_banana_too_many_value_bytes = EI_INIT; -static expert_field ei_banana_length_too_long = EI_INIT; -static expert_field ei_banana_value_too_large = EI_INIT; -static expert_field ei_banana_pb_error = EI_INIT; +static expert_field ei_banana_unknown_type; +static expert_field ei_banana_too_many_value_bytes; +static expert_field ei_banana_length_too_long; +static expert_field ei_banana_value_too_large; +static expert_field ei_banana_pb_error; static dissector_handle_t banana_handle; @@ -144,7 +144,7 @@ dissect_banana_element(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int switch (byte) { case BE_LIST: if (val > MAX_ELEMENT_VAL) { - expert_add_info_format(pinfo, NULL, &ei_banana_length_too_long, "List length %" G_GINT64_MODIFIER "d longer than we can handle", val); + expert_add_info_format(pinfo, NULL, &ei_banana_length_too_long, "List length %" PRId64 " longer than we can handle", val); } ti = proto_tree_add_uint_format_value(tree, hf_banana_list, tvb, start_offset, offset - start_offset - 1, (guint32) val, "(%d items)", (gint) val); list_tree = proto_item_add_subtree(ti, ett_list); @@ -158,20 +158,20 @@ dissect_banana_element(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int break; case BE_INT: if (val > MAX_ELEMENT_VAL) { - expert_add_info_format(pinfo, NULL, &ei_banana_value_too_large, "Integer value %" G_GINT64_MODIFIER "d too large", val); + expert_add_info_format(pinfo, NULL, &ei_banana_value_too_large, "Integer value %" PRId64 " too large", val); } proto_tree_add_uint(tree, hf_banana_int, tvb, start_offset, offset - start_offset, (guint32) val); break; case BE_STRING: if (val > MAX_ELEMENT_VAL) { - expert_add_info_format(pinfo, NULL, &ei_banana_length_too_long, "String length %" G_GINT64_MODIFIER "d longer than we can handle", val); + expert_add_info_format(pinfo, NULL, &ei_banana_length_too_long, "String length %" PRId64 " longer than we can handle", val); } - proto_tree_add_item(tree, hf_banana_string, tvb, offset, (guint32) val, ENC_ASCII|ENC_NA); + proto_tree_add_item(tree, hf_banana_string, tvb, offset, (guint32) val, ENC_ASCII); offset += (gint) val; break; case BE_NEG_INT: if (val > MAX_ELEMENT_VAL) { - expert_add_info_format(pinfo, NULL, &ei_banana_value_too_large, "Integer value -%" G_GINT64_MODIFIER "d too large", val); + expert_add_info_format(pinfo, NULL, &ei_banana_value_too_large, "Integer value -%" PRId64 " too large", val); } proto_tree_add_int(tree, hf_banana_neg_int, tvb, start_offset, offset - start_offset, (gint32) val * -1); break; @@ -312,12 +312,13 @@ proto_register_banana(void) proto_register_subtree_array(ett, array_length(ett)); expert_banana = expert_register_protocol(proto_banana); expert_register_field_array(expert_banana, ei, array_length(ei)); + + banana_handle = register_dissector("banana", dissect_banana, proto_banana); } void proto_reg_handoff_banana(void) { - banana_handle = create_dissector_handle(dissect_banana, proto_banana); dissector_add_uint_range_with_preference("tcp.port", "", banana_handle); } |