aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-devicenet.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2014-08-03 21:10:24 -0400
committerAnders Broman <a.broman58@gmail.com>2014-08-05 07:36:26 +0000
commit9d5f9141af289d3d8b253907eaaae101da1bd9fd (patch)
tree4d2816511482c04e3e8af66bd6251f5f7ce2dc2f /epan/dissectors/packet-devicenet.c
parentedbb9edf3928e79b41f9b84d2399205810febef2 (diff)
Eliminate proto_tree_add_text from some dissectors.
Other minor cleanup while in the area. Change-Id: Id8d957d3d68a2e3dd5089f490bd59d773e1be967 Reviewed-on: https://code.wireshark.org/review/3427 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-devicenet.c')
-rw-r--r--epan/dissectors/packet-devicenet.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/epan/dissectors/packet-devicenet.c b/epan/dissectors/packet-devicenet.c
index a8a8264fef..38087127d3 100644
--- a/epan/dissectors/packet-devicenet.c
+++ b/epan/dissectors/packet-devicenet.c
@@ -92,6 +92,7 @@ static int hf_devicenet_class8 = -1;
static int hf_devicenet_class16 = -1;
static int hf_devicenet_instance8 = -1;
static int hf_devicenet_instance16 = -1;
+static int hf_devicenet_attribute = -1;
static int hf_devicenet_fragment_type = -1;
static int hf_devicenet_fragment_count = -1;
@@ -273,6 +274,7 @@ static gint body_type_8_over_8_dissection(guint8 data_length, proto_tree *device
guint16 class_id, instance, attribute;
attribute_info_t* att_info;
gint start_offset = offset, length;
+ proto_item* ti;
devicenet_tree = proto_tree_add_subtree(devicenet_tree, tvb, offset, -1, ett_devicenet_8_8, NULL, "DeviceNet 8/8");
@@ -287,10 +289,11 @@ static gint body_type_8_over_8_dissection(guint8 data_length, proto_tree *device
if (data_length > 3)
{
attribute = tvb_get_guint8(tvb, offset);
+ ti = proto_tree_add_item(devicenet_tree, hf_devicenet_attribute, tvb, offset, 1, ENC_LITTLE_ENDIAN);
att_info = cip_get_attribute(class_id, instance, attribute);
if (att_info != NULL)
- proto_tree_add_text(devicenet_tree, tvb, offset, 1, "Instance Attribute: %s", att_info->text);
+ proto_item_append_text(ti, " (%s)", att_info->text);
offset++;
}
@@ -310,6 +313,7 @@ static gint body_type_8_over_16_dissection(guint8 data_length, proto_tree *devic
{
guint16 class_id, instance, attribute;
attribute_info_t* att_info;
+ proto_item* ti;
devicenet_tree = proto_tree_add_subtree(devicenet_tree, tvb, offset, -1, ett_devicenet_8_16, NULL, "DeviceNet 8/16");
@@ -323,10 +327,11 @@ static gint body_type_8_over_16_dissection(guint8 data_length, proto_tree *devic
if (data_length > 4)
{
attribute = tvb_get_guint8(tvb, offset);
+ ti = proto_tree_add_item(devicenet_tree, hf_devicenet_attribute, tvb, offset, 1, ENC_LITTLE_ENDIAN);
att_info = cip_get_attribute(class_id, instance, attribute);
if (att_info != NULL)
- proto_tree_add_text(devicenet_tree, tvb, offset, 1, "Instance Attribute: %s", att_info->text);
+ proto_item_append_text(ti, " (%s)", att_info->text);
offset++;
}
@@ -339,6 +344,7 @@ static gint body_type_16_over_8_dissection(guint8 data_length, proto_tree *devic
{
guint16 class_id, instance, attribute;
attribute_info_t* att_info;
+ proto_item* ti;
devicenet_tree = proto_tree_add_subtree(devicenet_tree, tvb, offset, -1, ett_devicenet_16_8, NULL, "DeviceNet 16/8");
@@ -353,10 +359,11 @@ static gint body_type_16_over_8_dissection(guint8 data_length, proto_tree *devic
if (data_length > 4)
{
attribute = tvb_get_guint8(tvb, offset);
+ ti = proto_tree_add_item(devicenet_tree, hf_devicenet_attribute, tvb, offset, 1, ENC_LITTLE_ENDIAN);
att_info = cip_get_attribute(class_id, instance, attribute);
if (att_info != NULL)
- proto_tree_add_text(devicenet_tree, tvb, offset, 1, "Instance Attribute: %s" ,att_info->text);
+ proto_item_append_text(ti, " (%s)", att_info->text);
offset++;
}
@@ -369,6 +376,7 @@ static gint body_type_16_over_16_dissection(guint8 data_length, proto_tree *devi
{
guint16 class_id, instance, attribute;
attribute_info_t* att_info;
+ proto_item* ti;
devicenet_tree = proto_tree_add_subtree(devicenet_tree, tvb, offset, 4, ett_devicenet_16_16, NULL, "DeviceNet 16/16");
@@ -383,10 +391,11 @@ static gint body_type_16_over_16_dissection(guint8 data_length, proto_tree *devi
if (data_length > 5)
{
attribute = tvb_get_guint8(tvb, offset);
+ ti = proto_tree_add_item(devicenet_tree, hf_devicenet_attribute, tvb, offset, 1, ENC_LITTLE_ENDIAN);
att_info = cip_get_attribute(class_id, instance, attribute);
if (att_info != NULL)
- proto_tree_add_text(devicenet_tree, tvb, offset, 1, "Instance Attribute: %s" ,att_info->text);
+ proto_item_append_text(ti, " (%s)", att_info->text);
offset++;
}
@@ -915,6 +924,11 @@ void proto_register_devicenet(void)
FT_UINT16, BASE_HEX, NULL, 0x00,
NULL, HFILL }
},
+ { &hf_devicenet_attribute,
+ { "Attribute", "devicenet.attribute",
+ FT_UINT8, BASE_HEX, NULL, 0x00,
+ NULL, HFILL }
+ },
{ &hf_devicenet_fragment_type,
{ "Fragment Type", "devicenet.fragment_type",
FT_UINT8, BASE_HEX, VALS(devicenet_fragmented_message_type_vals), 0xC0,