aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-adwin-config.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2014-09-10 20:04:22 -0400
committerAnders Broman <a.broman58@gmail.com>2014-09-11 06:33:23 +0000
commit29993d5266ff0a19d0d49a19a0473d7bb17cda43 (patch)
tree0ccf0e41844fdeaf2d8c0fb5257659bcb157df54 /epan/dissectors/packet-adwin-config.c
parentd5940f576cc9b08b2fcbea71182ed0c7efb7f275 (diff)
Eliminate proto_tree_add_text from some dissectors.
Change-Id: Ie41ac30f8edaeee75b23717ef1d5147d804a65b3 Reviewed-on: https://code.wireshark.org/review/4074 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-adwin-config.c')
-rw-r--r--epan/dissectors/packet-adwin-config.c92
1 files changed, 60 insertions, 32 deletions
diff --git a/epan/dissectors/packet-adwin-config.c b/epan/dissectors/packet-adwin-config.c
index a070dec911..8decb96b01 100644
--- a/epan/dissectors/packet-adwin-config.c
+++ b/epan/dissectors/packet-adwin-config.c
@@ -98,6 +98,8 @@ static int hf_adwin_config_description = -1;
static int hf_adwin_config_dhcp = -1;
static int hf_adwin_config_filename = -1;
static int hf_adwin_config_filesize = -1;
+static int hf_adwin_config_filetime = -1;
+static int hf_adwin_config_updatetime = -1;
static int hf_adwin_config_gateway = -1;
static int hf_adwin_config_mac = -1;
static int hf_adwin_config_netmask_count = -1;
@@ -111,6 +113,8 @@ static int hf_adwin_config_reboot = -1;
static int hf_adwin_config_scan_id = -1;
static int hf_adwin_config_reply_broadcast = -1;
static int hf_adwin_config_revision = -1;
+static int hf_adwin_config_processor_type_raw = -1;
+static int hf_adwin_config_system_type_raw = -1;
static int hf_adwin_config_processor_type = -1;
static int hf_adwin_config_system_type = -1;
static int hf_adwin_config_server_ip = -1;
@@ -127,6 +131,7 @@ static int hf_adwin_config_status_bootloader_receive = -1;
static int hf_adwin_config_status_bootloader_reprogramming_done = -1;
static int hf_adwin_config_status_eeprom_support = -1;
static int hf_adwin_config_stream_length = -1;
+static int hf_adwin_config_eeprom_support = -1;
static int hf_adwin_config_timeout = -1;
static int hf_adwin_config_timerresets = -1;
static int hf_adwin_config_disk_free = -1;
@@ -143,9 +148,20 @@ static gint ett_adwin_config_debug = -1;
static void
dissect_UDPStatus(tvbuff_t *tvb, proto_tree *adwin_tree)
{
- proto_tree *status_tree;
proto_tree *debug_tree;
- proto_item *st, *dt;
+ proto_item *dt;
+
+ static const int * status_flags[] = {
+ &hf_adwin_config_status_bootloader,
+ &hf_adwin_config_status_reprogrammable,
+ &hf_adwin_config_status_configurable,
+ &hf_adwin_config_status_bootloader_boots,
+ &hf_adwin_config_status_bootloader_reprogrammable,
+ &hf_adwin_config_status_bootloader_receive,
+ &hf_adwin_config_status_bootloader_reprogramming_done,
+ &hf_adwin_config_status_eeprom_support,
+ NULL
+ };
if (! adwin_tree)
return;
@@ -157,16 +173,7 @@ dissect_UDPStatus(tvbuff_t *tvb, proto_tree *adwin_tree)
proto_tree_add_item(adwin_tree, hf_adwin_config_pattern, tvb, 0, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(adwin_tree, hf_adwin_config_version, tvb, 4, 4, ENC_BIG_ENDIAN);
- st = proto_tree_add_item(adwin_tree, hf_adwin_config_status, tvb, 8, 4, ENC_BIG_ENDIAN);
- status_tree = proto_item_add_subtree(st, ett_adwin_config_status);
- proto_tree_add_item(status_tree, hf_adwin_config_status_bootloader, tvb, 8, 4, ENC_BIG_ENDIAN);
- proto_tree_add_item(status_tree, hf_adwin_config_status_reprogrammable, tvb, 8, 4, ENC_BIG_ENDIAN);
- proto_tree_add_item(status_tree, hf_adwin_config_status_configurable, tvb, 8, 4, ENC_BIG_ENDIAN);
- proto_tree_add_item(status_tree, hf_adwin_config_status_bootloader_boots, tvb, 8, 4, ENC_BIG_ENDIAN);
- proto_tree_add_item(status_tree, hf_adwin_config_status_bootloader_reprogrammable, tvb, 8, 4, ENC_BIG_ENDIAN);
- proto_tree_add_item(status_tree, hf_adwin_config_status_bootloader_receive, tvb, 8, 4, ENC_BIG_ENDIAN);
- proto_tree_add_item(status_tree, hf_adwin_config_status_bootloader_reprogramming_done, tvb, 8, 4, ENC_BIG_ENDIAN);
- proto_tree_add_item(status_tree, hf_adwin_config_status_eeprom_support, tvb, 8, 4, ENC_BIG_ENDIAN);
+ proto_tree_add_bitmask(adwin_tree, tvb, 8, hf_adwin_config_status, ett_adwin_config_status, status_flags, ENC_BIG_ENDIAN);
proto_tree_add_item(adwin_tree, hf_adwin_config_server_version_beta, tvb, 12, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(adwin_tree, hf_adwin_config_server_version, tvb, 14, 2, ENC_BIG_ENDIAN);
@@ -203,17 +210,17 @@ dissect_UDPExtStatus(tvbuff_t *tvb, proto_tree *adwin_tree)
proto_tree_add_item(adwin_tree, hf_adwin_config_revision, tvb, 56, 8, ENC_ASCII|ENC_NA);
/* add the processor type raw values to the tree, to allow filtering */
- proto_tree_add_item(adwin_tree, hf_adwin_config_processor_type, tvb, 64, 2, ENC_ASCII|ENC_NA);
+ proto_tree_add_item(adwin_tree, hf_adwin_config_processor_type_raw, tvb, 64, 2, ENC_ASCII|ENC_NA);
/* add the processor type as a pretty printed string */
processor_type = tvb_get_string_enc(wmem_packet_scope(), tvb, 64, 2, ENC_ASCII|ENC_NA);
processor_type = str_to_str(processor_type, processor_type_mapping, "Unknown (%s)");
- proto_tree_add_text(adwin_tree, tvb, 64, 2, "Processor Type: %s", processor_type);
+ proto_tree_add_string(adwin_tree, hf_adwin_config_processor_type, tvb, 64, 2, processor_type);
/* add system type as raw value and pretty printed string */
- proto_tree_add_item(adwin_tree, hf_adwin_config_system_type, tvb, 66, 2, ENC_ASCII|ENC_NA);
+ proto_tree_add_item(adwin_tree, hf_adwin_config_system_type_raw, tvb, 66, 2, ENC_ASCII|ENC_NA);
system_type = tvb_get_string_enc(wmem_packet_scope(), tvb, 66, 2, ENC_ASCII|ENC_NA);
system_type = str_to_str(system_type, system_type_mapping, "Unknown (%s)");
- proto_tree_add_text(adwin_tree, tvb, 66, 2, "System Type: %s", system_type);
+ proto_tree_add_string(adwin_tree, hf_adwin_config_system_type, tvb, 66, 2, system_type);
proto_tree_add_item(adwin_tree, hf_adwin_config_unused, tvb, 68, 364, ENC_NA);
}
@@ -246,17 +253,17 @@ dissect_UDPMessage(tvbuff_t *tvb, proto_tree *adwin_tree)
proto_tree_add_item(adwin_tree, hf_adwin_config_revision, tvb, 88, 8, ENC_ASCII|ENC_NA);
/* add the processor type raw values to the tree, to allow filtering */
- proto_tree_add_item(adwin_tree, hf_adwin_config_processor_type, tvb, 96, 2, ENC_ASCII|ENC_NA);
+ proto_tree_add_item(adwin_tree, hf_adwin_config_processor_type_raw, tvb, 96, 2, ENC_ASCII|ENC_NA);
/* add the processor type as a pretty printed string */
processor_type = tvb_get_string_enc(wmem_packet_scope(), tvb, 96, 2, ENC_ASCII|ENC_NA);
processor_type = str_to_str(processor_type, processor_type_mapping, "Unknown");
- proto_tree_add_text(adwin_tree, tvb, 96, 2, "Processor Type: %s", processor_type);
+ proto_tree_add_string(adwin_tree, hf_adwin_config_processor_type, tvb, 96, 2, processor_type);
/* add system type as raw value and pretty printed string */
- proto_tree_add_item(adwin_tree, hf_adwin_config_system_type, tvb, 98, 2, ENC_ASCII|ENC_NA);
+ proto_tree_add_item(adwin_tree, hf_adwin_config_system_type_raw, tvb, 98, 2, ENC_ASCII|ENC_NA);
system_type = tvb_get_string_enc(wmem_packet_scope(), tvb, 98, 2, ENC_ASCII|ENC_NA);
system_type = str_to_str(system_type, system_type_mapping, "Unknown");
- proto_tree_add_text(adwin_tree, tvb, 98, 2, "System Type: %s", system_type);
+ proto_tree_add_string(adwin_tree, hf_adwin_config_system_type, tvb, 98, 2, system_type);
}
static void
@@ -336,13 +343,11 @@ dissect_TCPFlashUpdate(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
length = tvb_strnlen(tvb, offset, -1) + 1;
filename = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, length, ENC_ASCII|ENC_NA);
if (strncmp(filename, "eeprom_on", length) == 0) {
- proto_tree_add_text(adwin_tree, tvb, offset, length,
- "Enable EEPROM Support");
+ proto_tree_add_boolean(adwin_tree, hf_adwin_config_eeprom_support, tvb, offset, length, TRUE);
return offset+length;
}
if (strncmp(filename, "eeprom_off", length) == 0) {
- proto_tree_add_text(adwin_tree, tvb, offset, length,
- "Disable EEPROM Support");
+ proto_tree_add_boolean(adwin_tree, hf_adwin_config_eeprom_support, tvb, offset, length, FALSE);
return offset+length;
}
proto_tree_add_item(adwin_tree, hf_adwin_config_filename, tvb, 4, length, ENC_ASCII|ENC_NA);
@@ -353,12 +358,10 @@ dissect_TCPFlashUpdate(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
proto_tree_add_item(adwin_tree, hf_adwin_config_filesize, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
tmp_time.secs = tvb_get_ntohl(tvb, offset);
- proto_tree_add_text(adwin_tree, tvb, offset, 4,
- "File time: %s", abs_time_to_str(wmem_packet_scope(), &tmp_time, ABSOLUTE_TIME_LOCAL, TRUE));
+ proto_tree_add_time(adwin_tree, hf_adwin_config_filetime, tvb, offset, 4, &tmp_time);
offset += 4;
tmp_time.secs = tvb_get_ntohl(tvb, offset);
- proto_tree_add_text(adwin_tree, tvb, offset, 4,
- "Update time: %s", abs_time_to_str(wmem_packet_scope(), &tmp_time, ABSOLUTE_TIME_LOCAL, TRUE));
+ proto_tree_add_time(adwin_tree, hf_adwin_config_updatetime, tvb, offset, 4, &tmp_time);
offset += 4;
proto_tree_add_item(adwin_tree, hf_adwin_config_unused, tvb, offset, 128, ENC_NA);
offset += 128;
@@ -543,6 +546,16 @@ proto_register_adwin_config(void)
FT_INT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
+ { &hf_adwin_config_filetime,
+ { "File time", "adwin_config.filetime",
+ FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_adwin_config_updatetime,
+ { "Update time", "adwin_config.updatetime",
+ FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0,
+ NULL, HFILL }
+ },
{ &hf_adwin_config_gateway,
{ "Gateway IP", "adwin_config.gateway",
FT_IPv4, BASE_NONE, NULL, 0x0,
@@ -608,16 +621,26 @@ proto_register_adwin_config(void)
FT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
- { &hf_adwin_config_processor_type,
- { "Processor Type (Raw value)", "adwin_config.processor_type",
+ { &hf_adwin_config_processor_type_raw,
+ { "Processor Type (Raw value)", "adwin_config.processor_type_raw",
FT_STRING, BASE_NONE, NULL, 0x0,
"The DSP processor type of the ADwin system, e.g. T9, T10 or T11.", HFILL }
},
- { &hf_adwin_config_system_type,
- { "System Type (Raw value)", "adwin_config.system_type",
+ { &hf_adwin_config_system_type_raw,
+ { "System Type (Raw value)", "adwin_config.system_type_raw",
FT_STRING, BASE_NONE, NULL, 0x0,
"The system type of the ADwin system, e.g. Gold, Pro or Light.", HFILL }
},
+ { &hf_adwin_config_processor_type,
+ { "Processor Type", "adwin_config.processor_type",
+ FT_STRING, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_adwin_config_system_type,
+ { "System Type", "adwin_config.system_type",
+ FT_STRING, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }
+ },
{ &hf_adwin_config_server_ip,
{ "Server IP", "adwin_config.server_ip",
FT_IPv4, BASE_NONE, NULL, 0x0,
@@ -694,6 +717,11 @@ proto_register_adwin_config(void)
FT_INT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
+ { &hf_adwin_config_eeprom_support,
+ { "EEPROM Support", "adwin_config.eeprom_support",
+ FT_BOOLEAN, BASE_NONE, TFS(&tfs_enabled_disabled), 0x0,
+ NULL, HFILL }
+ },
{ &hf_adwin_config_timeout,
{ "Timeout", "adwin_config.timeout",
FT_UINT32, BASE_DEC, NULL, 0x0,