aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-tnef.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2013-08-05 01:54:15 +0000
committerMichael Mann <mmann78@netscape.net>2013-08-05 01:54:15 +0000
commita22331bbd2c8f54b92ade8ec9c94f3d375146b4e (patch)
tree2dabef7cd2d68391f0305b2dfb39fcc78507be17 /epan/dissectors/packet-tnef.c
parentb67492bbc0db4f1ea6f4376846d3fca08773660b (diff)
Convert remaining proto_item_set_expert_flags in dissector directory.
svn path=/trunk/; revision=51142
Diffstat (limited to 'epan/dissectors/packet-tnef.c')
-rw-r--r--epan/dissectors/packet-tnef.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/epan/dissectors/packet-tnef.c b/epan/dissectors/packet-tnef.c
index 9318d0fc5b..7b367f6bda 100644
--- a/epan/dissectors/packet-tnef.c
+++ b/epan/dissectors/packet-tnef.c
@@ -31,6 +31,7 @@
#include <epan/packet.h>
#include <epan/addr_resolv.h>
#include <epan/strutil.h>
+#include <epan/expert.h>
#include <wiretap/tnef.h>
@@ -164,6 +165,9 @@ static int ett_tnef_counted_items = -1;
static int ett_tnef_attribute_date = -1;
static int ett_tnef_attribute_address = -1;
+static expert_field ei_tnef_expect_single_item = EI_INIT;
+static expert_field ei_tnef_incorrect_signature = EI_INIT;
+
static const value_string tnef_Lvl_vals[] = {
{ 1, "LVL-MESSAGE" },
{ 2, "LVL-ATTACHMENT" },
@@ -239,7 +243,7 @@ static const value_string tnef_Attribute_vals[] = {
{ 0, NULL }
};
-static gint dissect_counted_values(tvbuff_t *tvb, gint offset, int hf_id, packet_info *pinfo _U_, proto_tree *tree, gboolean single, gboolean unicode, guint encoding)
+static gint dissect_counted_values(tvbuff_t *tvb, gint offset, int hf_id, packet_info *pinfo, proto_tree *tree, gboolean single, gboolean unicode, guint encoding)
{
proto_item *item;
guint32 length, count, i;
@@ -249,10 +253,8 @@ static gint dissect_counted_values(tvbuff_t *tvb, gint offset, int hf_id, packe
if(count > 1) {
if(single) {
- item = proto_tree_add_text(tree, tvb, offset, 4,
+ item = proto_tree_add_expert_format(tree, pinfo, &ei_tnef_expect_single_item, tvb, offset, 4,
"Expecting a single item but found %d", count);
- proto_item_set_expert_flags(item, PI_MALFORMED, PI_ERROR);
-
tree = proto_item_add_subtree(item, ett_tnef_counted_items);
}
}
@@ -522,10 +524,8 @@ static void dissect_tnef(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* check the signature */
if(signature != TNEF_SIGNATURE) {
- proto_item_append_text(item, " [Incorrect, should be 0x%x. No further dissection possible. Check any Content-Transfer-Encoding has been removed.]", TNEF_SIGNATURE);
-
- proto_item_set_expert_flags(item, PI_MALFORMED, PI_WARN);
-
+ expert_add_info_format_text(pinfo, item, &ei_tnef_incorrect_signature,
+ " [Incorrect, should be 0x%x. No further dissection possible. Check any Content-Transfer-Encoding has been removed.]", TNEF_SIGNATURE);
return;
} else {
@@ -814,10 +814,19 @@ proto_register_tnef(void)
&ett_tnef_attribute_address,
};
+ static ei_register_info ei[] = {
+ { &ei_tnef_expect_single_item, { "tnef.expect_single_item", PI_MALFORMED, PI_ERROR, "Expected single item", EXPFILL }},
+ { &ei_tnef_incorrect_signature, { "tnef.signature.incorrect", PI_MALFORMED, PI_WARN, "Incorrect signature", EXPFILL }},
+ };
+
+ expert_module_t* expert_tnef;
+
proto_tnef = proto_register_protocol(PNAME, PSNAME, PFNAME);
proto_register_field_array(proto_tnef, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+ expert_tnef = expert_register_protocol(proto_tnef);
+ expert_register_field_array(expert_tnef, ei, array_length(ei));
/* Allow dissector to find be found by name. */
register_dissector(PFNAME, dissect_tnef, proto_tnef);