aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2014-12-26 09:44:30 -0500
committerMichael Mann <mmann78@netscape.net>2014-12-26 20:41:49 +0000
commit4cf6583b9e5bc7fa5d6f6ac17cdc1f634ae1567e (patch)
treeba6086800171711931385b8ab402fc6e6f5e0083
parenta442a1c0e815fd61416cf408bd74d85a042ccc6a (diff)
Remove proto_tree_add_text from ZigBee dissectors.
Change-Id: I0488cb0ab33f2cc6dee227f1bfacec58eafc4190 Reviewed-on: https://code.wireshark.org/review/6055 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
-rw-r--r--epan/dissectors/packet-zbee-nwk-gp.c219
-rw-r--r--epan/dissectors/packet-zbee-nwk.c332
-rw-r--r--epan/dissectors/packet-zbee-zcl-general.c147
-rw-r--r--epan/dissectors/packet-zbee-zdp-binding.c58
-rw-r--r--epan/dissectors/packet-zbee-zdp-management.c166
-rw-r--r--epan/dissectors/packet-zbee-zdp.c169
-rw-r--r--epan/dissectors/packet-zbee-zdp.h29
7 files changed, 638 insertions, 482 deletions
diff --git a/epan/dissectors/packet-zbee-nwk-gp.c b/epan/dissectors/packet-zbee-nwk-gp.c
index e7db47d496..ce571bf27b 100644
--- a/epan/dissectors/packet-zbee-nwk-gp.c
+++ b/epan/dissectors/packet-zbee-nwk-gp.c
@@ -197,10 +197,12 @@ static int proto_zbee_nwk_gp = -1;
/* GP NWK FC. */
static int hf_zbee_nwk_gp_auto_commissioning = -1;
static int hf_zbee_nwk_gp_fc_ext = -1;
+static int hf_zbee_nwk_gp_fcf = -1;
static int hf_zbee_nwk_gp_frame_type = -1;
static int hf_zbee_nwk_gp_proto_version = -1;
/* GP NWK FC extension. */
+static int hf_zbee_nwk_gp_fc_ext_field = -1;
static int hf_zbee_nwk_gp_fc_ext_app_id = -1;
static int hf_zbee_nwk_gp_fc_ext_direction = -1;
static int hf_zbee_nwk_gp_fc_ext_rx_after_tx = -1;
@@ -222,13 +224,16 @@ static int hf_zbee_nwk_gp_command_id = -1;
/* Commissioning. */
static int hf_zbee_nwk_gp_cmd_comm_device_id = -1;
+static int hf_zbee_nwk_gp_cmd_comm_ext_opt = -1;
static int hf_zbee_nwk_gp_cmd_comm_ext_opt_gpd_key_encr = -1;
static int hf_zbee_nwk_gp_cmd_comm_ext_opt_gpd_key_present = -1;
static int hf_zbee_nwk_gp_cmd_comm_ext_opt_key_type = -1;
static int hf_zbee_nwk_gp_cmd_comm_ext_opt_outgoing_counter = -1;
static int hf_zbee_nwk_gp_cmd_comm_ext_opt_sec_level_cap = -1;
+static int hf_zbee_nwk_gp_cmd_comm_security_key = -1;
static int hf_zbee_nwk_gp_cmd_comm_gpd_sec_key_mic = -1;
static int hf_zbee_nwk_gp_cmd_comm_opt_ext_opt = -1;
+static int hf_zbee_nwk_gp_cmd_comm_opt = -1;
static int hf_zbee_nwk_gp_cmd_comm_opt_fixed_location = -1;
static int hf_zbee_nwk_gp_cmd_comm_opt_mac_sec_num_cap = -1;
static int hf_zbee_nwk_gp_cmd_comm_opt_ms_ext_present = -1;
@@ -238,12 +243,14 @@ static int hf_zbee_nwk_gp_cmd_comm_opt_sec_key_req = -1;
static int hf_zbee_nwk_gp_cmd_comm_outgoing_counter = -1;
static int hf_zbee_nwk_gp_cmd_comm_manufacturer_greenpeak_dev_id = -1;
static int hf_zbee_nwk_gp_cmd_comm_manufacturer_id = -1;
+static int hf_zbee_nwk_gp_cmd_comm_ms_ext = -1;
static int hf_zbee_nwk_gp_cmd_comm_ms_ext_crp = -1;
static int hf_zbee_nwk_gp_cmd_comm_ms_ext_gclp = -1;
static int hf_zbee_nwk_gp_cmd_comm_ms_ext_mip = -1;
static int hf_zbee_nwk_gp_cmd_comm_ms_ext_mmip = -1;
/* Commissioning reply. */
+static int hf_zbee_nwk_gp_cmd_comm_rep_opt = -1;
static int hf_zbee_nwk_gp_cmd_comm_rep_opt_key_encr = -1;
static int hf_zbee_nwk_gp_cmd_comm_rep_opt_panid_present = -1;
static int hf_zbee_nwk_gp_cmd_comm_rep_opt_sec_key_present = -1;
@@ -255,10 +262,12 @@ static int hf_zbee_nwk_gp_cmd_comm_rep_pan_id = -1;
static int hf_zbee_nwk_gp_cmd_attr_report_cluster_id = -1;
/* Channel request. */
+static int hf_zbee_nwk_gp_cmd_channel_request_toggling_behaviour = -1;
static int hf_zbee_nwk_gp_cmd_channel_request_toggling_behaviour_1st = -1;
static int hf_zbee_nwk_gp_cmd_channel_request_toggling_behaviour_2nd = -1;
/* Channel Configuration command. */
+static int hf_zbee_nwk_gp_cmd_operational_channel = -1;
static int hf_zbee_nwk_gp_cmd_channel_configuration = -1;
/* Move Color command. */
@@ -649,47 +658,51 @@ static guint
dissect_zbee_nwk_gp_cmd_commissioning(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
zbee_nwk_green_power_packet *packet _U_, guint offset)
{
- guint8 comm_options = 0;
+ guint8 comm_options;
guint8 comm_ext_options = 0;
guint8 ms_ext_options = 0;
guint16 manufacturer_id = 0;
- proto_item *ti = NULL;
- proto_tree *field_tree = NULL;
+ static const int * options[] = {
+ &hf_zbee_nwk_gp_cmd_comm_opt_mac_sec_num_cap,
+ &hf_zbee_nwk_gp_cmd_comm_opt_rx_on_cap,
+ &hf_zbee_nwk_gp_cmd_comm_opt_ms_ext_present,
+ &hf_zbee_nwk_gp_cmd_comm_opt_panid_req,
+ &hf_zbee_nwk_gp_cmd_comm_opt_sec_key_req,
+ &hf_zbee_nwk_gp_cmd_comm_opt_fixed_location,
+ &hf_zbee_nwk_gp_cmd_comm_opt_ext_opt,
+ NULL
+ };
+ static const int * ext_options[] = {
+ &hf_zbee_nwk_gp_cmd_comm_ext_opt_sec_level_cap,
+ &hf_zbee_nwk_gp_cmd_comm_ext_opt_key_type,
+ &hf_zbee_nwk_gp_cmd_comm_ext_opt_gpd_key_present,
+ &hf_zbee_nwk_gp_cmd_comm_ext_opt_gpd_key_encr,
+ &hf_zbee_nwk_gp_cmd_comm_ext_opt_outgoing_counter,
+ NULL
+ };
+ static const int * ms_ext[] = {
+ &hf_zbee_nwk_gp_cmd_comm_ms_ext_mip,
+ &hf_zbee_nwk_gp_cmd_comm_ms_ext_mmip,
+ &hf_zbee_nwk_gp_cmd_comm_ms_ext_gclp,
+ &hf_zbee_nwk_gp_cmd_comm_ms_ext_crp,
+ NULL
+ };
/* Get Device ID and display it. */
proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_comm_device_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
/* Get Options Field, build subtree and display the results. */
comm_options = tvb_get_guint8(tvb, offset);
- if (tree) {
- ti = proto_tree_add_text(tree, tvb, offset, 1, "Options Field: 0x%02x", comm_options);
- field_tree = proto_item_add_subtree(ti, ett_zbee_nwk_cmd_options);
- proto_tree_add_item(field_tree, hf_zbee_nwk_gp_cmd_comm_opt_mac_sec_num_cap, tvb, offset, 1, ENC_NA);
- proto_tree_add_item(field_tree, hf_zbee_nwk_gp_cmd_comm_opt_rx_on_cap, tvb, offset, 1, ENC_NA);
- proto_tree_add_item(field_tree, hf_zbee_nwk_gp_cmd_comm_opt_ms_ext_present, tvb, offset, 1, ENC_NA);
- proto_tree_add_item(field_tree, hf_zbee_nwk_gp_cmd_comm_opt_panid_req, tvb, offset, 1, ENC_NA);
- proto_tree_add_item(field_tree, hf_zbee_nwk_gp_cmd_comm_opt_sec_key_req, tvb, offset, 1, ENC_NA);
- proto_tree_add_item(field_tree, hf_zbee_nwk_gp_cmd_comm_opt_fixed_location, tvb, offset, 1, ENC_NA);
- proto_tree_add_item(field_tree, hf_zbee_nwk_gp_cmd_comm_opt_ext_opt, tvb, offset, 1, ENC_NA);
- }
- offset += 1;
+ proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_cmd_comm_opt, ett_zbee_nwk_cmd_options, options, ENC_NA);
+
if (comm_options & ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_EXT_OPTIONS) {
/* Get extended Options Field, build subtree and display the results. */
comm_ext_options = tvb_get_guint8(tvb, offset);
- if (tree) {
- ti = proto_tree_add_text(tree, tvb, offset, 1, "Extended Options Field: 0x%02x", comm_ext_options);
- field_tree = proto_item_add_subtree(ti, ett_zbee_nwk_cmd_options);
- proto_tree_add_item(field_tree, hf_zbee_nwk_gp_cmd_comm_ext_opt_sec_level_cap, tvb, offset, 1, ENC_LITTLE_ENDIAN);
- proto_tree_add_item(field_tree, hf_zbee_nwk_gp_cmd_comm_ext_opt_key_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
- proto_tree_add_item(field_tree, hf_zbee_nwk_gp_cmd_comm_ext_opt_gpd_key_present, tvb, offset, 1, ENC_NA);
- proto_tree_add_item(field_tree, hf_zbee_nwk_gp_cmd_comm_ext_opt_gpd_key_encr, tvb, offset, 1, ENC_NA);
- proto_tree_add_item(field_tree, hf_zbee_nwk_gp_cmd_comm_ext_opt_outgoing_counter, tvb, offset, 1, ENC_NA);
- }
+ proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_cmd_comm_ext_opt, ett_zbee_nwk_cmd_options, ext_options, ENC_NA);
offset += 1;
if (comm_ext_options & ZBEE_NWK_GP_CMD_COMMISSIONING_EXT_OPT_GPD_KEY_PRESENT) {
/* Get security key and display it. */
- proto_tree_add_text(tree, tvb, offset, NWK_CMD_SECURITY_KEY_LEN, "Security Key: %s",
- tvb_get_string_enc(wmem_packet_scope(), tvb, offset, NWK_CMD_SECURITY_KEY_LEN, ENC_ASCII));
+ proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_comm_security_key, tvb, offset, NWK_CMD_SECURITY_KEY_LEN, ENC_ASCII|ENC_NA);
offset += NWK_CMD_SECURITY_KEY_LEN;
}
if (comm_ext_options & ZBEE_NWK_GP_CMD_COMMISSIONING_EXT_OPT_GPD_KEY_ENCR) {
@@ -707,14 +720,7 @@ dissect_zbee_nwk_gp_cmd_commissioning(tvbuff_t *tvb, packet_info *pinfo _U_, pro
if (comm_options & ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_MANUFACTURER_INFO) {
/* Display MS extensions. */
ms_ext_options = tvb_get_guint8(tvb, offset);
- if (tree) {
- ti = proto_tree_add_text(tree, tvb, offset, 1, "MS Extensions Field: 0x%02x", ms_ext_options);
- field_tree = proto_item_add_subtree(ti, ett_zbee_nwk_cmd_ms_ext);
- proto_tree_add_item(field_tree, hf_zbee_nwk_gp_cmd_comm_ms_ext_mip, tvb, offset, 1, ENC_NA);
- proto_tree_add_item(field_tree, hf_zbee_nwk_gp_cmd_comm_ms_ext_mmip, tvb, offset, 1, ENC_NA);
- proto_tree_add_item(field_tree, hf_zbee_nwk_gp_cmd_comm_ms_ext_gclp, tvb, offset, 1, ENC_NA);
- proto_tree_add_item(field_tree, hf_zbee_nwk_gp_cmd_comm_ms_ext_crp, tvb, offset, 1, ENC_NA);
- }
+ proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_cmd_comm_ms_ext, ett_zbee_nwk_cmd_ms_ext, ms_ext, ENC_NA);
offset += 1;
if (ms_ext_options & ZBEE_NWK_GP_CMD_COMMISSIONING_MS_EXT_MIP) {
/* Get Manufacturer ID. */
@@ -755,19 +761,14 @@ static guint
dissect_zbee_nwk_gp_cmd_channel_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
zbee_nwk_green_power_packet *packet _U_, guint offset)
{
- proto_item *ti;
- proto_tree *field_tree;
+ static const int * channels[] = {
+ &hf_zbee_nwk_gp_cmd_channel_request_toggling_behaviour_1st,
+ &hf_zbee_nwk_gp_cmd_channel_request_toggling_behaviour_2nd,
+ NULL
+ };
/* Get Command Options Field, build subtree and display the results. */
- if (tree) {
- ti = proto_tree_add_text(tree, tvb, offset, 1, "Channel Toggling Behaviour: 0x%02x", tvb_get_guint8(tvb,
- offset));
- field_tree = proto_item_add_subtree(ti, ett_zbee_nwk_cmd_options);
- proto_tree_add_item(field_tree, hf_zbee_nwk_gp_cmd_channel_request_toggling_behaviour_1st, tvb, offset, 1,
- ENC_LITTLE_ENDIAN);
- proto_tree_add_item(field_tree, hf_zbee_nwk_gp_cmd_channel_request_toggling_behaviour_2nd, tvb, offset, 1,
- ENC_LITTLE_ENDIAN);
- }
+ proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_cmd_channel_request_toggling_behaviour, ett_zbee_nwk_cmd_options, channels, ENC_NA);
offset += 1;
return offset;
} /* dissect_zbee_nwk_gp_cmd_channel_request */
@@ -791,15 +792,14 @@ static guint
dissect_zbee_nwk_gp_cmd_channel_configuration(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
zbee_nwk_green_power_packet *packet _U_, guint offset)
{
- proto_item *ti;
- proto_tree *field_tree;
+ static const int * channels[] = {
+ &hf_zbee_nwk_gp_cmd_channel_configuration,
+ NULL
+ };
/* Get Command Options Field, build subtree and display the results. */
- if (tree) {
- ti = proto_tree_add_text(tree, tvb, offset, 1, "Operational Channel: 0x%02x", tvb_get_guint8(tvb, offset));
- field_tree = proto_item_add_subtree(ti, ett_zbee_nwk_cmd_options);
- proto_tree_add_item(field_tree, hf_zbee_nwk_gp_cmd_channel_configuration, tvb, offset, 1, ENC_LITTLE_ENDIAN);
- }
+ proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_cmd_operational_channel, ett_zbee_nwk_cmd_options, channels, ENC_NA);
+
offset += 1;
return offset;
} /* dissect_zbee_nwk_gp_cmd_channel_configuration */
@@ -858,22 +858,22 @@ static guint
dissect_zbee_nwk_gp_cmd_commissioning_reply(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
zbee_nwk_green_power_packet *packet _U_, guint offset)
{
- guint8 cr_options = 0;
- proto_item *ti = NULL;
- proto_tree *field_tree = NULL;
+ guint8 cr_options;
+
+ static const int * options[] = {
+ &hf_zbee_nwk_gp_cmd_comm_rep_opt_panid_present,
+ &hf_zbee_nwk_gp_cmd_comm_rep_opt_sec_key_present,
+ &hf_zbee_nwk_gp_cmd_comm_rep_opt_key_encr,
+ &hf_zbee_nwk_gp_cmd_comm_rep_opt_sec_level,
+ &hf_zbee_nwk_gp_cmd_comm_rep_opt_sec_type,
+ NULL
+ };
/* Get Options Field, build subtree and display the results. */
cr_options = tvb_get_guint8(tvb, offset);
- if (tree) {
- ti = proto_tree_add_text(tree, tvb, offset, 1, "Options Field: 0x%02x", cr_options);
- field_tree = proto_item_add_subtree(ti, ett_zbee_nwk_cmd_options);
- proto_tree_add_item(field_tree, hf_zbee_nwk_gp_cmd_comm_rep_opt_panid_present, tvb, offset, 1, ENC_NA);
- proto_tree_add_item(field_tree, hf_zbee_nwk_gp_cmd_comm_rep_opt_sec_key_present, tvb, offset, 1, ENC_NA);
- proto_tree_add_item(field_tree, hf_zbee_nwk_gp_cmd_comm_rep_opt_key_encr, tvb, offset, 1, ENC_NA);
- proto_tree_add_item(field_tree, hf_zbee_nwk_gp_cmd_comm_rep_opt_sec_level, tvb, offset, 1, ENC_LITTLE_ENDIAN);
- proto_tree_add_item(field_tree, hf_zbee_nwk_gp_cmd_comm_rep_opt_sec_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
- }
+ proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_cmd_comm_rep_opt, ett_zbee_nwk_cmd_options, options, ENC_NA);
offset += 1;
+
/* Parse and display security Pan ID value. */
if (cr_options & ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_PAN_ID_PRESENT) {
proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_comm_rep_pan_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
@@ -881,8 +881,7 @@ dissect_zbee_nwk_gp_cmd_commissioning_reply(tvbuff_t *tvb, packet_info *pinfo _U
}
/* Parse and display security key. */
if (cr_options & ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_SEC_KEY_PRESENT) {
- proto_tree_add_text(tree, tvb, offset, NWK_CMD_SECURITY_KEY_LEN, "Security Key: %s",
- tvb_get_string_enc(wmem_packet_scope(), tvb, offset, NWK_CMD_SECURITY_KEY_LEN, ENC_ASCII));
+ proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_comm_security_key, tvb, offset, NWK_CMD_SECURITY_KEY_LEN, ENC_ASCII|ENC_NA);
offset += NWK_CMD_SECURITY_KEY_LEN;
}
/* Parse and display security MIC. */
@@ -1247,12 +1246,26 @@ dissect_zbee_nwk_gp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d
guint8 *dec_buffer;
guint8 *enc_buffer;
guint8 fcf;
- proto_tree *field_tree = NULL;
proto_tree *nwk_tree = NULL;
proto_item *proto_root = NULL;
proto_item *ti = NULL;
tvbuff_t *payload_tvb;
zbee_nwk_green_power_packet packet;
+ static const int * fields[] = {
+ &hf_zbee_nwk_gp_frame_type,
+ &hf_zbee_nwk_gp_proto_version,
+ &hf_zbee_nwk_gp_auto_commissioning,
+ &hf_zbee_nwk_gp_fc_ext,
+ NULL
+ };
+ static const int * ext_fields[] = {
+ &hf_zbee_nwk_gp_fc_ext_app_id,
+ &hf_zbee_nwk_gp_fc_ext_sec_level,
+ &hf_zbee_nwk_gp_fc_ext_sec_key,
+ &hf_zbee_nwk_gp_fc_ext_rx_after_tx,
+ &hf_zbee_nwk_gp_fc_ext_direction,
+ NULL
+ };
memset(&packet, 0, sizeof(packet));
/* Add ourself to the protocol column, clear the info column and create the protocol tree. */
@@ -1268,44 +1281,25 @@ dissect_zbee_nwk_gp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d
fcf = tvb_get_guint8(tvb, offset);
packet.frame_type = zbee_get_bit_field(fcf, ZBEE_NWK_GP_FCF_FRAME_TYPE);
packet.nwk_frame_control_extension = zbee_get_bit_field(fcf, ZBEE_NWK_GP_FCF_CONTROL_EXTENSION);
+
/* Display the FCF. */
- if (tree) {
- /* Create a subtree for the FCF. */
- ti = proto_tree_add_text(nwk_tree, tvb, offset, 1, "Frame Control Field: %s (0x%02x)",
- val_to_str(packet.frame_type, zbee_nwk_gp_frame_types, "Unknown Frame Type"), fcf);
- field_tree = proto_item_add_subtree(ti, ett_zbee_nwk_fcf);
- proto_tree_add_uint(field_tree, hf_zbee_nwk_gp_frame_type, tvb, offset, 1, fcf & ZBEE_NWK_GP_FCF_FRAME_TYPE);
- proto_tree_add_uint(field_tree, hf_zbee_nwk_gp_proto_version, tvb, offset, 1, fcf & ZBEE_NWK_GP_FCF_VERSION);
- proto_tree_add_boolean(field_tree, hf_zbee_nwk_gp_auto_commissioning, tvb, offset, 1, fcf &
- ZBEE_NWK_GP_FCF_AUTO_COMMISSIONING);
- proto_tree_add_boolean(field_tree, hf_zbee_nwk_gp_fc_ext, tvb, offset, 1, fcf &
- ZBEE_NWK_GP_FCF_CONTROL_EXTENSION);
- }
+ ti = proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_fcf, ett_zbee_nwk_fcf, fields, ENC_NA);
+ proto_item_append_text(ti, " %s", val_to_str(packet.frame_type, zbee_nwk_gp_frame_types, "Unknown Frame Type"));
offset += 1;
+
/* Add the frame type to the info column and protocol root. */
- if (tree) {
- proto_item_append_text(proto_root, " %s", val_to_str(packet.frame_type, zbee_nwk_gp_frame_types,
- "Unknown type"));
- }
- col_set_str(pinfo->cinfo, COL_INFO, val_to_str_const(packet.frame_type, zbee_nwk_gp_frame_types,
- "Reserved frame type"));
+ proto_item_append_text(proto_root, " %s", val_to_str(packet.frame_type, zbee_nwk_gp_frame_types, "Unknown type"));
+ col_set_str(pinfo->cinfo, COL_INFO, val_to_str_const(packet.frame_type, zbee_nwk_gp_frame_types, "Reserved frame type"));
+
if (packet.nwk_frame_control_extension) {
/* Display ext FCF. */
fcf = tvb_get_guint8(tvb, offset);
packet.application_id = zbee_get_bit_field(fcf, ZBEE_NWK_GP_FCF_EXT_APP_ID);
packet.security_level = zbee_get_bit_field(fcf, ZBEE_NWK_GP_FCF_EXT_SECURITY_LEVEL);
packet.direction = zbee_get_bit_field(fcf, ZBEE_NWK_GP_FCF_EXT_DIRECTION);
+
/* Create a subtree for the extended FCF. */
- if (tree) {
- ti = proto_tree_add_text(nwk_tree, tvb, offset, 1, "Extended NWK Frame Control Field");
- field_tree = proto_item_add_subtree(ti, ett_zbee_nwk_fcf_ext);
- /* Add the fields. */
- proto_tree_add_item(field_tree, hf_zbee_nwk_gp_fc_ext_app_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
- proto_tree_add_item(field_tree, hf_zbee_nwk_gp_fc_ext_sec_level, tvb, offset, 1, ENC_LITTLE_ENDIAN);
- proto_tree_add_item(field_tree, hf_zbee_nwk_gp_fc_ext_sec_key, tvb, offset, 1, ENC_NA);
- proto_tree_add_item(field_tree, hf_zbee_nwk_gp_fc_ext_rx_after_tx, tvb, offset, 1, ENC_NA);
- proto_tree_add_item(field_tree, hf_zbee_nwk_gp_fc_ext_direction, tvb, offset, 1, ENC_LITTLE_ENDIAN);
- }
+ proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_fc_ext_field, ett_zbee_nwk_fcf_ext, ext_fields, ENC_NA);
offset += 1;
}
if ((packet.frame_type == ZBEE_NWK_GP_FCF_DATA && !packet.nwk_frame_control_extension) || (packet.frame_type ==
@@ -1493,6 +1487,10 @@ proto_register_zbee_nwk_gp(void)
{ "NWK Frame Extension", "zbee_nwk_gp.fc_extension", FT_BOOLEAN, 8, NULL, ZBEE_NWK_GP_FCF_CONTROL_EXTENSION,
NULL, HFILL }},
+ { &hf_zbee_nwk_gp_fcf,
+ { "Frame Control Field", "zbee_nwk_gp.fcf", FT_UINT8, BASE_HEX, NULL,
+ 0x0, NULL, HFILL }},
+
{ &hf_zbee_nwk_gp_frame_type,
{ "Frame Type", "zbee_nwk_gp.frame_type", FT_UINT8, BASE_HEX, VALS(zbee_nwk_gp_frame_types),
ZBEE_NWK_GP_FCF_FRAME_TYPE, NULL, HFILL }},
@@ -1501,6 +1499,10 @@ proto_register_zbee_nwk_gp(void)
{ "Protocol Version", "zbee_nwk_gp.proto_version", FT_UINT8, BASE_DEC, NULL, ZBEE_NWK_GP_FCF_VERSION, NULL,
HFILL }},
+ { &hf_zbee_nwk_gp_fc_ext_field,
+ { "Extended NWK Frame Control Field", "zbee_nwk_gp.fc_ext", FT_UINT8, BASE_HEX, NULL,
+ 0x0, NULL, HFILL }},
+
{ &hf_zbee_nwk_gp_fc_ext_app_id,
{ "Application ID", "zbee_nwk_gp.fc_ext_app_id", FT_UINT8, BASE_HEX, VALS(zbee_nwk_gp_app_id_names),
ZBEE_NWK_GP_FCF_EXT_APP_ID, NULL, HFILL }},
@@ -1564,6 +1566,9 @@ proto_register_zbee_nwk_gp(void)
{ "Security Level Capabilities", "zbee_nwk_gp.cmd.comm.ext_opt.seclevel_cap", FT_UINT8, BASE_HEX, NULL,
ZBEE_NWK_GP_CMD_COMMISSIONING_EXT_OPT_SEC_LEVEL_CAP, NULL, HFILL }},
+ { &hf_zbee_nwk_gp_cmd_comm_security_key,
+ { "Security Key", "zbee_nwk_gp.cmd.comm.security_key", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
+
{ &hf_zbee_nwk_gp_cmd_comm_gpd_sec_key_mic,
{ "GPD Key MIC", "zbee_nwk_gp.cmd.comm.gpd_key_mic", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
@@ -1571,6 +1576,10 @@ proto_register_zbee_nwk_gp(void)
{ "Extended Option Field", "zbee_nwk_gp.cmd.comm.opt.ext_opt_field", FT_BOOLEAN, 8, NULL,
ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_EXT_OPTIONS, NULL, HFILL }},
+ { &hf_zbee_nwk_gp_cmd_comm_opt,
+ { "Options Field", "zbee_nwk_gp.cmd.comm.opt", FT_UINT8, BASE_HEX, NULL,
+ 0x0, NULL, HFILL }},
+
{ &hf_zbee_nwk_gp_cmd_comm_opt_fixed_location,
{ "Fixed Location", "zbee_nwk_gp.cmd.comm.opt.fixed_location", FT_BOOLEAN, 8, NULL,
ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_FIXED_LOCATION, NULL, HFILL }},
@@ -1595,6 +1604,10 @@ proto_register_zbee_nwk_gp(void)
{ "GP Security Key Request", "zbee_nwk_gp.cmd.comm.opt.seq_key_req", FT_BOOLEAN, 8, NULL,
ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_GP_SEC_KEY_REQ, NULL, HFILL }},
+ { &hf_zbee_nwk_gp_cmd_comm_ext_opt,
+ { "Extended Options Field", "zbee_nwk_gp.cmd.comm.ext_opt", FT_UINT8, BASE_HEX, NULL,
+ 0x0, NULL, HFILL }},
+
{ &hf_zbee_nwk_gp_cmd_comm_ext_opt_outgoing_counter,
{ "GPD Outgoing present", "zbee_nwk_gp.cmd.comm.ext_opt.outgoing_counter", FT_BOOLEAN, 8, NULL,
ZBEE_NWK_GP_CMD_COMMISSIONING_EXT_OPT_OUT_COUNTER, NULL, HFILL }},
@@ -1615,6 +1628,10 @@ proto_register_zbee_nwk_gp(void)
{ "GP commands list present", "zbee_nwk_gp.cmd.comm.ms_ext.gclp", FT_BOOLEAN, 8, NULL,
ZBEE_NWK_GP_CMD_COMMISSIONING_MS_EXT_GCLP , NULL, HFILL }},
+ { &hf_zbee_nwk_gp_cmd_comm_ms_ext,
+ { "MS Extensions Field", "zbee_nwk_gp.cmd.comm.ms_ext", FT_UINT8, BASE_HEX, NULL,
+ 0x0, NULL, HFILL }},
+
{ &hf_zbee_nwk_gp_cmd_comm_ms_ext_mip,
{ "Manufacturer ID present", "zbee_nwk_gp.cmd.comm.ms_ext.mip", FT_BOOLEAN, 8, NULL,
ZBEE_NWK_GP_CMD_COMMISSIONING_MS_EXT_MIP , NULL, HFILL }},
@@ -1627,6 +1644,10 @@ proto_register_zbee_nwk_gp(void)
{ "GPD Key Encryption", "zbee_nwk_gp.cmd.comm_reply.opt.sec_key_encr", FT_BOOLEAN, 8, NULL,
ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_KEY_ENCR, NULL, HFILL }},
+ { &hf_zbee_nwk_gp_cmd_comm_rep_opt,
+ { "Options Field", "zbee_nwk_gp.cmd.comm_reply.opt", FT_UINT8, BASE_HEX, NULL,
+ 0x0, NULL, HFILL }},
+
{ &hf_zbee_nwk_gp_cmd_comm_rep_opt_panid_present,
{ "PANID Present", "zbee_nwk_gp.cmd.comm_reply.opt.pan_id_present", FT_BOOLEAN, 8, NULL,
ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_PAN_ID_PRESENT, NULL, HFILL }},
@@ -1650,6 +1671,10 @@ proto_register_zbee_nwk_gp(void)
{ "ZigBee Cluster ID", "zbee_nwk_gp.cmd.comm.attr_report", FT_UINT16, BASE_HEX, VALS(zbee_aps_cid_names),
0x0, NULL, HFILL }},
+ { &hf_zbee_nwk_gp_cmd_channel_request_toggling_behaviour,
+ { "Channel Toggling Behaviour", "zbee_nwk_gp.cmd.ch_req", FT_UINT8, BASE_HEX, NULL,
+ 0x0, NULL, HFILL }},
+
{ &hf_zbee_nwk_gp_cmd_channel_request_toggling_behaviour_1st,
{ "Rx channel in the next attempt", "zbee_nwk_gp.cmd.ch_req.1st", FT_UINT8, BASE_HEX, NULL,
ZBEE_NWK_GP_CMD_CHANNEL_REQUEST_1ST, NULL, HFILL }},
@@ -1658,6 +1683,10 @@ proto_register_zbee_nwk_gp(void)
{ "Rx channel in the second next attempt", "zbee_nwk_gp.ch_req.2nd", FT_UINT8, BASE_HEX, NULL,
ZBEE_NWK_GP_CMD_CHANNEL_REQUEST_2ND, NULL, HFILL }},
+ { &hf_zbee_nwk_gp_cmd_operational_channel,
+ { "Operational Channel", "zbee_nwk_gp.cmd.configuration_ch", FT_UINT8, BASE_HEX, NULL,
+ 0x0, NULL, HFILL }},
+
{ &hf_zbee_nwk_gp_cmd_channel_configuration,
{ "Operation channel", "zbee_nwk_gp.cmd.configuration_ch.operation_ch", FT_UINT8, BASE_HEX, NULL,
ZBEE_NWK_GP_CMD_CHANNEL_CONFIGURATION_OPERATION_CH, NULL, HFILL }},
diff --git a/epan/dissectors/packet-zbee-nwk.c b/epan/dissectors/packet-zbee-nwk.c
index 35eaa4d907..9053efd02f 100644
--- a/epan/dissectors/packet-zbee-nwk.c
+++ b/epan/dissectors/packet-zbee-nwk.c
@@ -69,6 +69,7 @@ void proto_reg_handoff_zbee_nwk(void);
static int proto_zbee_nwk = -1;
static int proto_zbee_beacon = -1;
static int proto_zbip_beacon = -1;
+static int hf_zbee_nwk_fcf = -1;
static int hf_zbee_nwk_frame_type = -1;
static int hf_zbee_nwk_proto_version = -1;
static int hf_zbee_nwk_discover_route = -1;
@@ -81,6 +82,7 @@ static int hf_zbee_nwk_dst = -1;
static int hf_zbee_nwk_src = -1;
static int hf_zbee_nwk_radius = -1;
static int hf_zbee_nwk_seqno = -1;
+static int hf_zbee_nwk_mcast = -1;
static int hf_zbee_nwk_mcast_mode = -1;
static int hf_zbee_nwk_mcast_radius = -1;
static int hf_zbee_nwk_mcast_max_radius = -1;
@@ -89,6 +91,7 @@ static int hf_zbee_nwk_src64 = -1;
static int hf_zbee_nwk_src64_origin = -1;
static int hf_zbee_nwk_relay_count = -1;
static int hf_zbee_nwk_relay_index = -1;
+static int hf_zbee_nwk_relay = -1;
static int hf_zbee_nwk_cmd_id = -1;
static int hf_zbee_nwk_cmd_addr = -1;
@@ -100,6 +103,7 @@ static int hf_zbee_nwk_cmd_route_dest_ext = -1;
static int hf_zbee_nwk_cmd_route_orig_ext = -1;
static int hf_zbee_nwk_cmd_route_resp_ext = -1;
static int hf_zbee_nwk_cmd_route_cost = -1;
+static int hf_zbee_nwk_cmd_route_options = -1;
static int hf_zbee_nwk_cmd_route_opt_repair = -1;
static int hf_zbee_nwk_cmd_route_opt_multicast = -1;
static int hf_zbee_nwk_cmd_route_opt_dest_ext = -1;
@@ -111,6 +115,7 @@ static int hf_zbee_nwk_cmd_leave_rejoin = -1;
static int hf_zbee_nwk_cmd_leave_request = -1;
static int hf_zbee_nwk_cmd_leave_children = -1;
static int hf_zbee_nwk_cmd_relay_count = -1;
+static int hf_zbee_nwk_cmd_relay_device = -1;
static int hf_zbee_nwk_cmd_cinfo = -1;
static int hf_zbee_nwk_cmd_cinfo_alt_coord = -1;
static int hf_zbee_nwk_cmd_cinfo_type = -1;
@@ -122,11 +127,15 @@ static int hf_zbee_nwk_cmd_rejoin_status = -1;
static int hf_zbee_nwk_cmd_link_last = -1;
static int hf_zbee_nwk_cmd_link_first = -1;
static int hf_zbee_nwk_cmd_link_count = -1;
+static int hf_zbee_nwk_cmd_link_address = -1;
+static int hf_zbee_nwk_cmd_link_incoming_cost = -1;
+static int hf_zbee_nwk_cmd_link_outgoing_cost = -1;
static int hf_zbee_nwk_cmd_report_type = -1;
static int hf_zbee_nwk_cmd_report_count = -1;
static int hf_zbee_nwk_cmd_update_type = -1;
static int hf_zbee_nwk_cmd_update_count = -1;
static int hf_zbee_nwk_cmd_update_id = -1;
+static int hf_zbee_nwk_panid = -1;
static int hf_zbee_nwk_cmd_epid = -1;
/* ZigBee Beacons */
@@ -155,6 +164,7 @@ static gint ett_zbee_nwk_route = -1;
static gint ett_zbee_nwk_cmd = -1;
static gint ett_zbee_nwk_cmd_options = -1;
static gint ett_zbee_nwk_cmd_cinfo = -1;
+static gint ett_zbee_nwk_cmd_link = -1;
static expert_field ei_zbee_nwk_missing_payload = EI_INIT;
@@ -356,7 +366,7 @@ dissect_zbee_nwk_full(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
ieee802154_packet *ieee_packet;
guint offset = 0;
- static gchar src_addr[32], dst_addr[32]; /* has to be static due to SET_ADDRESS */
+ gchar *src_addr, *dst_addr;
guint16 fcf;
@@ -367,6 +377,26 @@ dissect_zbee_nwk_full(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
zbee_nwk_hints_t *nwk_hints;
gboolean unicast_src;
+ static const int * fcf_flags_2007[] = {
+ &hf_zbee_nwk_frame_type,
+ &hf_zbee_nwk_proto_version,
+ &hf_zbee_nwk_discover_route,
+ &hf_zbee_nwk_multicast,
+ &hf_zbee_nwk_security,
+ &hf_zbee_nwk_source_route,
+ &hf_zbee_nwk_ext_dst,
+ &hf_zbee_nwk_ext_src,
+ NULL
+ };
+
+ static const int * fcf_flags[] = {
+ &hf_zbee_nwk_frame_type,
+ &hf_zbee_nwk_proto_version,
+ &hf_zbee_nwk_discover_route,
+ &hf_zbee_nwk_security,
+ NULL
+ };
+
/* Reject the packet if data is NULL */
if (data == NULL)
return 0;
@@ -405,32 +435,16 @@ dissect_zbee_nwk_full(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
packet.ext_src = zbee_get_bit_field(fcf, ZBEE_NWK_FCF_EXT_SOURCE);
/* Display the FCF. */
- if (tree) {
- /* Create a subtree for the FCF. */
- ti = proto_tree_add_text(nwk_tree, tvb, offset, 2, "Frame Control Field: %s (0x%04x)",
- val_to_str_const(packet.type, zbee_nwk_frame_types, "Unknown"), fcf);
- field_tree = proto_item_add_subtree(ti, ett_zbee_nwk_fcf);
- proto_tree_add_item(field_tree, hf_zbee_nwk_frame_type, tvb, offset, 2, ENC_LITTLE_ENDIAN);
-
- /* Add the rest of the fcf fields to the subtree */
- proto_tree_add_item(field_tree, hf_zbee_nwk_proto_version, tvb, offset, 2, ENC_LITTLE_ENDIAN);
- proto_tree_add_item(field_tree, hf_zbee_nwk_discover_route, tvb, offset, 2, ENC_LITTLE_ENDIAN);
- if (packet.version >= ZBEE_VERSION_2007) {
- proto_tree_add_item(field_tree, hf_zbee_nwk_multicast, tvb, offset, 2, ENC_LITTLE_ENDIAN);
- }
- proto_tree_add_item(field_tree, hf_zbee_nwk_security, tvb, offset, 2, ENC_LITTLE_ENDIAN);
- if (packet.version >= ZBEE_VERSION_2007) {
- proto_tree_add_item(field_tree, hf_zbee_nwk_source_route, tvb, offset, 2, ENC_LITTLE_ENDIAN);
- proto_tree_add_item(field_tree, hf_zbee_nwk_ext_dst, tvb, offset, 2, ENC_LITTLE_ENDIAN);
- proto_tree_add_item(field_tree, hf_zbee_nwk_ext_src, tvb, offset, 2, ENC_LITTLE_ENDIAN);
- }
+ if (packet.version >= ZBEE_VERSION_2007) {
+ ti = proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_fcf, ett_zbee_nwk_fcf, fcf_flags_2007, ENC_LITTLE_ENDIAN);
+ } else {
+ ti = proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_fcf, ett_zbee_nwk_fcf, fcf_flags, ENC_LITTLE_ENDIAN);
}
+ proto_item_append_text(ti, " %s", val_to_str_const(packet.type, zbee_nwk_frame_types, "Unknown"));
offset += 2;
/* Add the frame type to the info column and protocol root. */
- if (tree) {
- proto_item_append_text(proto_root, " %s", val_to_str_const(packet.type, zbee_nwk_frame_types, "Unknown Type"));
- }
+ proto_item_append_text(proto_root, " %s", val_to_str_const(packet.type, zbee_nwk_frame_types, "Unknown Type"));
col_set_str(pinfo->cinfo, COL_INFO, val_to_str_const(packet.type, zbee_nwk_frame_types, "Reserved Frame Type"));
/* Get the destination address. */
@@ -443,27 +457,24 @@ dissect_zbee_nwk_full(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
if ( (packet.dst == ZBEE_BCAST_ALL)
|| (packet.dst == ZBEE_BCAST_ACTIVE)
|| (packet.dst == ZBEE_BCAST_ROUTERS)){
- g_snprintf(dst_addr, 32, "Broadcast");
+ dst_addr = wmem_strdup_printf(pinfo->pool, "Broadcast");
}
else {
- g_snprintf(dst_addr, 32, "0x%04x", packet.dst);
+ dst_addr = wmem_strdup_printf(pinfo->pool, "0x%04x", packet.dst);
}
SET_ADDRESS(&pinfo->dst, AT_STRINGZ, (int)strlen(dst_addr)+1, dst_addr);
SET_ADDRESS(&pinfo->net_dst, AT_STRINGZ, (int)strlen(dst_addr)+1, dst_addr);
- if (tree) {
- proto_item_append_text(proto_root, ", Dst: %s", dst_addr);
- }
+ proto_item_append_text(proto_root, ", Dst: %s", dst_addr);
col_append_fstr(pinfo->cinfo, COL_INFO, ", Dst: %s", dst_addr);
/* Get the short nwk source address and pass it to upper layers */
packet.src = tvb_get_letohs(tvb, offset);
- if (nwk_hints) nwk_hints->src = packet.src;
- if (tree) {
- proto_tree_add_uint(nwk_tree, hf_zbee_nwk_src, tvb, offset, 2, packet.src);
- }
+ if (nwk_hints)
+ nwk_hints->src = packet.src;
+ proto_tree_add_uint(nwk_tree, hf_zbee_nwk_src, tvb, offset, 2, packet.src);
offset += 2;
/* Display the source address. */
@@ -471,42 +482,34 @@ dissect_zbee_nwk_full(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
|| (packet.src == ZBEE_BCAST_ACTIVE)
|| (packet.src == ZBEE_BCAST_ROUTERS)){
/* Source Broadcast doesn't make much sense. */
- g_snprintf(src_addr, 32, "Unexpected Source Broadcast");
+ src_addr = wmem_strdup_printf(pinfo->pool, "Unexpected Source Broadcast");
unicast_src = FALSE;
}
else {
- g_snprintf(src_addr, 32, "0x%04x", packet.src);
+ src_addr = wmem_strdup_printf(pinfo->pool, "0x%04x", packet.src);
unicast_src = TRUE;
}
SET_ADDRESS(&pinfo->src, AT_STRINGZ, (int)strlen(src_addr)+1, src_addr);
SET_ADDRESS(&pinfo->net_src, AT_STRINGZ, (int)strlen(src_addr)+1, src_addr);
- if (tree) {
- proto_item_append_text(proto_root, ", Src: %s", src_addr);
- }
+ proto_item_append_text(proto_root, ", Src: %s", src_addr);
col_append_fstr(pinfo->cinfo, COL_INFO, ", Src: %s", src_addr);
/* Get and display the radius. */
packet.radius = tvb_get_guint8(tvb, offset);
- if (tree) {
- proto_tree_add_uint(nwk_tree, hf_zbee_nwk_radius, tvb, offset, 1, packet.radius);
- }
+ proto_tree_add_uint(nwk_tree, hf_zbee_nwk_radius, tvb, offset, 1, packet.radius);
offset += 1;
/* Get and display the sequence number. */
packet.seqno = tvb_get_guint8(tvb, offset);
- if (tree) {
- proto_tree_add_uint(nwk_tree, hf_zbee_nwk_seqno, tvb, offset, 1, packet.seqno);
- }
+ proto_tree_add_uint(nwk_tree, hf_zbee_nwk_seqno, tvb, offset, 1, packet.seqno);
offset += 1;
/* Add the extended destination address (ZigBee 2006 and later). */
if ((packet.version >= ZBEE_VERSION_2007) && packet.ext_dst) {
packet.dst64 = tvb_get_letoh64(tvb, offset);
- if (tree) {
- proto_tree_add_item(nwk_tree, hf_zbee_nwk_dst64, tvb, offset, 8, ENC_LITTLE_ENDIAN);
- }
+ proto_tree_add_item(nwk_tree, hf_zbee_nwk_dst64, tvb, offset, 8, ENC_LITTLE_ENDIAN);
offset += 8;
}
@@ -559,7 +562,7 @@ dissect_zbee_nwk_full(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
nwk_hints->map_rec->start_fnum);
}
else {
- ti = proto_tree_add_text(nwk_tree, tvb, 0, 0, "Origin: Pre-configured");
+ ti = proto_tree_add_uint_format_value(nwk_tree, hf_zbee_nwk_src64_origin, tvb, 0, 0, 0, "Pre-configured");
}
PROTO_ITEM_SET_GENERATED(ti);
}
@@ -584,26 +587,25 @@ dissect_zbee_nwk_full(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
/* Add multicast control field (ZigBee 2006 and later). */
if ((packet.version >= ZBEE_VERSION_2007) && packet.multicast) {
+ static const int * multicast_flags[] = {
+ &hf_zbee_nwk_mcast_mode,
+ &hf_zbee_nwk_mcast_radius,
+ &hf_zbee_nwk_mcast_max_radius,
+ NULL
+ };
+
guint8 mcast_control = tvb_get_guint8(tvb, offset);
packet.mcast_mode = zbee_get_bit_field(mcast_control, ZBEE_NWK_MCAST_MODE);
packet.mcast_radius = zbee_get_bit_field(mcast_control, ZBEE_NWK_MCAST_RADIUS);
packet.mcast_max_radius = zbee_get_bit_field(mcast_control, ZBEE_NWK_MCAST_MAX_RADIUS);
- if (tree) {
- /* Create a subtree for the multicast control field. */
- ti = proto_tree_add_text(nwk_tree, tvb, offset, 1, "Multicast Control Field");
- field_tree = proto_item_add_subtree(ti, ett_zbee_nwk_mcast);
- /* Add the fields. */
- proto_tree_add_item(field_tree, hf_zbee_nwk_mcast_mode, tvb, offset, 1, ENC_NA);
- proto_tree_add_item(field_tree, hf_zbee_nwk_mcast_radius, tvb, offset, 1, ENC_NA);
- proto_tree_add_item(field_tree, hf_zbee_nwk_mcast_max_radius, tvb, offset, 1, ENC_NA);
- }
+
+ proto_tree_add_bitmask(nwk_tree, tvb, offset, hf_zbee_nwk_mcast, ett_zbee_nwk_mcast, multicast_flags, ENC_NA);
offset += 1;
}
/* Add the Source Route field. (ZigBee 2006 and later). */
if ((packet.version >= ZBEE_VERSION_2007) && packet.route) {
guint8 relay_count;
- guint8 relay_index;
guint16 relay_addr;
guint i;
@@ -612,29 +614,21 @@ dissect_zbee_nwk_full(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
/* Get and display the relay count. */
relay_count = tvb_get_guint8(tvb, offset);
- if (tree) {
- proto_tree_add_uint(field_tree, hf_zbee_nwk_relay_count, tvb, offset, 1, relay_count);
- proto_item_append_text(ti, ", Length: %d", relay_count);
- }
+ proto_tree_add_uint(field_tree, hf_zbee_nwk_relay_count, tvb, offset, 1, relay_count);
+ proto_item_append_text(ti, ", Length: %d", relay_count);
offset += 1;
- if (tree) {
- /* Correct the length of the source route fields. */
- proto_item_set_len(ti, 1 + relay_count*2);
- }
+ /* Correct the length of the source route fields. */
+ proto_item_set_len(ti, 1 + relay_count*2);
/* Get and display the relay index. */
- relay_index = tvb_get_guint8(tvb, offset);
- proto_tree_add_uint(field_tree, hf_zbee_nwk_relay_index, tvb, offset, 1, relay_index);
-
+ proto_tree_add_item(field_tree, hf_zbee_nwk_relay_index, tvb, offset, 1, ENC_NA);
offset += 1;
/* Get and display the relay list. */
for (i=0; i<relay_count; i++) {
relay_addr = tvb_get_letohs(tvb, offset);
- if (tree) {
- proto_tree_add_text(field_tree, tvb, offset, 2, "Relay %d: 0x%04x", i+1, relay_addr);
- }
+ proto_tree_add_uint_format(field_tree, hf_zbee_nwk_relay, tvb, offset, 2, relay_addr, "Relay %d: 0x%04x", i+1, relay_addr);
offset += 2;
} /* for */
}
@@ -835,62 +829,46 @@ static void dissect_zbee_nwk_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
static guint
dissect_zbee_nwk_route_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, zbee_nwk_packet * packet, guint offset)
{
- proto_tree *field_tree;
- proto_item *ti;
-
guint8 route_options;
- guint8 route_id;
guint16 dest_addr;
- guint8 path_cost;
+
+ static const int * nwk_route_command_options_2007[] = {
+ &hf_zbee_nwk_cmd_route_opt_multicast,
+ &hf_zbee_nwk_cmd_route_opt_dest_ext,
+ &hf_zbee_nwk_cmd_route_opt_many_to_one,
+ NULL
+ };
+
+ static const int * nwk_route_command_options[] = {
+ &hf_zbee_nwk_cmd_route_opt_repair,
+ NULL
+ };
/* Get and display the route options field. */
route_options = tvb_get_guint8(tvb, offset);
- if (tree) {
- /* Create a subtree for the command options. */
- ti = proto_tree_add_text(tree, tvb, offset, 1, "Command Options (0x%02x)", route_options);
- field_tree = proto_item_add_subtree(ti, ett_zbee_nwk_cmd_options);
-
- if (packet->version >= ZBEE_VERSION_2007) {
- proto_tree_add_boolean(field_tree, hf_zbee_nwk_cmd_route_opt_multicast, tvb, offset,
- 1, route_options & ZBEE_NWK_CMD_ROUTE_OPTION_MCAST);
- proto_tree_add_boolean(field_tree, hf_zbee_nwk_cmd_route_opt_dest_ext, tvb, offset,
- 1, route_options & ZBEE_NWK_CMD_ROUTE_OPTION_DEST_EXT);
- proto_tree_add_uint(field_tree, hf_zbee_nwk_cmd_route_opt_many_to_one, tvb, offset,
- 1, route_options & ZBEE_NWK_CMD_ROUTE_OPTION_MANY_MASK);
- }
- else {
- proto_tree_add_boolean(tree, hf_zbee_nwk_cmd_route_opt_repair, tvb, offset, 1,
- route_options & ZBEE_NWK_CMD_ROUTE_OPTION_REPAIR);
- }
+ if (packet->version >= ZBEE_VERSION_2007) {
+ proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_cmd_route_options, ett_zbee_nwk_cmd_options, nwk_route_command_options_2007, ENC_NA);
+ } else {
+ proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_cmd_route_options, ett_zbee_nwk_cmd_options, nwk_route_command_options, ENC_NA);
}
offset += 1;
/* Get and display the route request ID. */
- route_id = tvb_get_guint8(tvb, offset);
- if (tree) {
- proto_tree_add_uint(tree, hf_zbee_nwk_cmd_route_id, tvb, offset, 1, route_id);
- }
+ proto_tree_add_item(tree, hf_zbee_nwk_cmd_route_id, tvb, offset, 1, ENC_NA);
offset += 1;
/* Get and display the destination address. */
dest_addr = tvb_get_letohs(tvb, offset);
- if (tree) {
- proto_tree_add_uint(tree, hf_zbee_nwk_cmd_route_dest, tvb, offset, 2, dest_addr);
- }
+ proto_tree_add_uint(tree, hf_zbee_nwk_cmd_route_dest, tvb, offset, 2, dest_addr);
offset += 2;
/* Get and display the path cost. */
- path_cost = tvb_get_guint8(tvb, offset);
- if (tree) {
- proto_tree_add_uint(tree, hf_zbee_nwk_cmd_route_cost, tvb, offset, 1, path_cost);
- }
+ proto_tree_add_item(tree, hf_zbee_nwk_cmd_route_cost, tvb, offset, 1, ENC_NA);
offset += 1;
/* Get and display the extended destination address. */
if (route_options & ZBEE_NWK_CMD_ROUTE_OPTION_DEST_EXT) {
- if (tree) {
- proto_tree_add_item(tree, hf_zbee_nwk_cmd_route_dest_ext, tvb, offset, 8, ENC_LITTLE_ENDIAN);
- }
+ proto_tree_add_item(tree, hf_zbee_nwk_cmd_route_dest_ext, tvb, offset, 8, ENC_LITTLE_ENDIAN);
offset += 8;
}
@@ -918,74 +896,58 @@ dissect_zbee_nwk_route_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
static guint
dissect_zbee_nwk_route_rep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, guint8 version)
{
- proto_tree *field_tree;
- proto_item *ti;
-
guint8 route_options;
- guint8 route_id;
guint16 orig_addr;
guint16 resp_addr;
- guint8 path_cost;
+
+ static const int * nwk_route_command_options_2007[] = {
+ &hf_zbee_nwk_cmd_route_opt_multicast,
+ &hf_zbee_nwk_cmd_route_opt_resp_ext,
+ &hf_zbee_nwk_cmd_route_opt_orig_ext,
+ NULL
+ };
+
+ static const int * nwk_route_command_options[] = {
+ &hf_zbee_nwk_cmd_route_opt_repair,
+ NULL
+ };
/* Get and display the route options field. */
route_options = tvb_get_guint8(tvb, offset);
- if (tree) {
- /* Create a subtree for the command options. */
- ti = proto_tree_add_text(tree, tvb, offset, 1, "Command Options (0x%02x)", route_options);
- field_tree = proto_item_add_subtree(ti, ett_zbee_nwk_cmd_options);
-
- if (version >= ZBEE_VERSION_2007) {
- proto_tree_add_boolean(field_tree, hf_zbee_nwk_cmd_route_opt_multicast, tvb, offset, 1, route_options & ZBEE_NWK_CMD_ROUTE_OPTION_MCAST);
- proto_tree_add_boolean(field_tree, hf_zbee_nwk_cmd_route_opt_resp_ext, tvb, offset, 1, route_options & ZBEE_NWK_CMD_ROUTE_OPTION_RESP_EXT);
- proto_tree_add_boolean(field_tree, hf_zbee_nwk_cmd_route_opt_orig_ext, tvb, offset, 1, route_options & ZBEE_NWK_CMD_ROUTE_OPTION_ORIG_EXT);
- }
- else {
- proto_tree_add_boolean(tree, hf_zbee_nwk_cmd_route_opt_repair, tvb, offset, 1, route_options & ZBEE_NWK_CMD_ROUTE_OPTION_REPAIR);
- }
+ if (version >= ZBEE_VERSION_2007) {
+ proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_cmd_route_options, ett_zbee_nwk_cmd_options, nwk_route_command_options_2007, ENC_NA);
+ } else {
+ proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_cmd_route_options, ett_zbee_nwk_cmd_options, nwk_route_command_options, ENC_NA);
}
offset += 1;
/* Get and display the route request ID. */
- route_id = tvb_get_guint8(tvb, offset);
- if (tree) {
- proto_tree_add_uint(tree, hf_zbee_nwk_cmd_route_id, tvb, offset, 1, route_id);
- }
+ proto_tree_add_item(tree, hf_zbee_nwk_cmd_route_id, tvb, offset, 1, ENC_NA);
offset += 1;
/* Get and display the originator address. */
orig_addr = tvb_get_letohs(tvb, offset);
- if (tree) {
- proto_tree_add_uint(tree, hf_zbee_nwk_cmd_route_orig, tvb, offset, 2, orig_addr);
- }
+ proto_tree_add_uint(tree, hf_zbee_nwk_cmd_route_orig, tvb, offset, 2, orig_addr);
offset += 2;
/* Get and display the responder address. */
resp_addr = tvb_get_letohs(tvb, offset);
- if (tree) {
- proto_tree_add_uint(tree, hf_zbee_nwk_cmd_route_resp, tvb, offset, 2, resp_addr);
- }
+ proto_tree_add_uint(tree, hf_zbee_nwk_cmd_route_resp, tvb, offset, 2, resp_addr);
offset += 2;
/* Get and display the path cost. */
- path_cost = tvb_get_guint8(tvb, offset);
- if (tree) {
- proto_tree_add_uint(tree, hf_zbee_nwk_cmd_route_cost, tvb, offset, 1, path_cost);
- }
+ proto_tree_add_item(tree, hf_zbee_nwk_cmd_route_cost, tvb, offset, 1, ENC_NA);
offset += 1;
/* Get and display the originator extended address. */
if (route_options & ZBEE_NWK_CMD_ROUTE_OPTION_ORIG_EXT) {
- if (tree) {
- proto_tree_add_item(tree, hf_zbee_nwk_cmd_route_orig_ext, tvb, offset, 8, ENC_LITTLE_ENDIAN);
- }
+ proto_tree_add_item(tree, hf_zbee_nwk_cmd_route_orig_ext, tvb, offset, 8, ENC_LITTLE_ENDIAN);
offset += 8;
}
/* Get and display the responder extended address. */
if (route_options & ZBEE_NWK_CMD_ROUTE_OPTION_RESP_EXT) {
- if (tree) {
- proto_tree_add_item(tree, hf_zbee_nwk_cmd_route_resp_ext, tvb, offset, 8, ENC_LITTLE_ENDIAN);
- }
+ proto_tree_add_item(tree, hf_zbee_nwk_cmd_route_resp_ext, tvb, offset, 8, ENC_LITTLE_ENDIAN);
offset += 8;
}
@@ -1103,9 +1065,8 @@ dissect_zbee_nwk_route_rec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* Get and display the relay addresses. */
for (i=0; i<relay_count; i++) {
relay_addr = tvb_get_letohs(tvb, offset);
- if (tree) {
- proto_tree_add_text(tree, tvb, offset, 2, "Relay Device %d: 0x%04x", i+1, relay_addr);
- }
+ proto_tree_add_uint_format(tree, hf_zbee_nwk_cmd_relay_device, tvb, offset, 2, relay_addr,
+ "Relay Device %d: 0x%04x", i+1, relay_addr);
offset += 2;
} /* for */
@@ -1173,21 +1134,15 @@ dissect_zbee_nwk_rejoin_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
static guint
dissect_zbee_nwk_rejoin_resp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, zbee_nwk_packet * packet, guint offset)
{
- guint16 addr;
guint8 status;
/* Get and display the short address. */
- addr = tvb_get_letohs(tvb, offset);
- if (tree) {
- proto_tree_add_uint(tree, hf_zbee_nwk_cmd_addr, tvb, offset, 2, addr);
- }
+ proto_tree_add_item(tree, hf_zbee_nwk_cmd_addr, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
/* Get and display the rejoin status. */
status = tvb_get_guint8(tvb, offset);
- if (tree) {
- proto_tree_add_uint(tree, hf_zbee_nwk_cmd_rejoin_status, tvb, offset, 1, status);
- }
+ proto_tree_add_uint(tree, hf_zbee_nwk_cmd_rejoin_status, tvb, offset, 1, status);
offset += 1;
/* Update the info column. */
@@ -1219,8 +1174,8 @@ static guint
dissect_zbee_nwk_link_status(tvbuff_t *tvb, proto_tree *tree, guint offset)
{
guint8 options;
- guint16 addr;
int i, link_count;
+ proto_tree *subtree;
/* Get and Display the link status options. */
options = tvb_get_guint8(tvb, offset);
@@ -1237,14 +1192,10 @@ dissect_zbee_nwk_link_status(tvbuff_t *tvb, proto_tree *tree, guint offset)
/* Get and Display the link status list. */
for (i=0; i<link_count; i++) {
/* Get the address and link status. */
- addr = tvb_get_letohs(tvb, offset);
- options = tvb_get_guint8(tvb, offset+2);
- if (tree) {
- proto_tree_add_text(tree, tvb, offset, 2+1,
- "0x%04x, Incoming Cost: %d Outgoing Cost: %d", addr,
- options & ZBEE_NWK_CMD_LINK_INCOMMING_COST_MASK,
- (options & ZBEE_NWK_CMD_LINK_OUTGOING_COST_MASK)>>4);
- }
+ subtree = proto_tree_add_subtree_format(tree, tvb, offset, 3, ett_zbee_nwk_cmd_link, NULL, "Link %d", i+1);
+ proto_tree_add_item(subtree, hf_zbee_nwk_cmd_link_address, tvb, offset, 2, ENC_LITTLE_ENDIAN);
+ proto_tree_add_item(subtree, hf_zbee_nwk_cmd_link_incoming_cost, tvb, offset+2, 1, ENC_NA);
+ proto_tree_add_item(subtree, hf_zbee_nwk_cmd_link_outgoing_cost, tvb, offset+2, 1, ENC_NA);
offset += (2+1);
} /* for */
@@ -1291,14 +1242,10 @@ dissect_zbee_nwk_report(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui
offset += 8;
if (report_type == ZBEE_NWK_CMD_NWK_REPORT_ID_PAN_CONFLICT) {
- guint16 panId;
/* Report information contains a list of PANS with range of the sender. */
for (i=0; i<report_count; i++) {
- panId = tvb_get_letohs(tvb, offset);
- if (tree) {
- proto_tree_add_text(tree, tvb, offset, 2, "PANID: 0x%04x", panId);
- }
+ proto_tree_add_item(tree, hf_zbee_nwk_panid, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
} /* for */
}
@@ -1357,14 +1304,10 @@ dissect_zbee_nwk_update(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui
offset += 1;
if (update_type == ZBEE_NWK_CMD_NWK_UPDATE_ID_PAN_UPDATE) {
- guint16 panId;
/* Report information contains a list of PANS with range of the sender. */
for (i=0; i<update_count; i++) {
- panId = tvb_get_letohs(tvb, offset);
- if (tree) {
- proto_tree_add_text(tree, tvb, offset, 2, "PANID: 0x%04x", panId);
- }
+ proto_tree_add_item(tree, hf_zbee_nwk_panid, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
} /* for */
}
@@ -1639,6 +1582,10 @@ void proto_register_zbee_nwk(void)
{
static hf_register_info hf[] = {
+ { &hf_zbee_nwk_fcf,
+ { "Frame Control Field", "zbee_nwk.fcf", FT_UINT16, BASE_HEX, NULL,
+ 0x0, NULL, HFILL }},
+
{ &hf_zbee_nwk_frame_type,
{ "Frame Type", "zbee_nwk.frame_type", FT_UINT16, BASE_HEX, VALS(zbee_nwk_frame_types),
ZBEE_NWK_FCF_FRAME_TYPE, NULL, HFILL }},
@@ -1688,6 +1635,10 @@ void proto_register_zbee_nwk(void)
{ "Sequence Number", "zbee_nwk.seqno", FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
+ { &hf_zbee_nwk_mcast,
+ { "Multicast Control Field", "zbee_nwk.multicast", FT_UINT8, BASE_HEX, NULL, 0x0,
+ NULL, HFILL }},
+
{ &hf_zbee_nwk_mcast_mode,
{ "Multicast Mode", "zbee_nwk.multicast.mode", FT_UINT8, BASE_DEC, NULL, ZBEE_NWK_MCAST_MODE,
"Controls whether this packet is permitted to be routed through non-members of the multicast group.",
@@ -1721,6 +1672,10 @@ void proto_register_zbee_nwk(void)
{ "Relay Index", "zbee_nwk.relay.index", FT_UINT8, BASE_DEC, NULL, 0x0,
"Number of relays required to route to the source device.", HFILL }},
+ { &hf_zbee_nwk_relay,
+ { "Relay", "zbee_nwk.relay", FT_UINT16, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }},
+
{ &hf_zbee_nwk_cmd_id,
{ "Command Identifier", "zbee_nwk.cmd.id", FT_UINT8, BASE_HEX, VALS(zbee_nwk_cmd_names), 0x0,
NULL, HFILL }},
@@ -1761,6 +1716,10 @@ void proto_register_zbee_nwk(void)
{ "Path Cost", "zbee_nwk.cmd.route.cost", FT_UINT8, BASE_DEC, NULL, 0x0,
"A value specifying the efficiency of this route.", HFILL }},
+ { &hf_zbee_nwk_cmd_route_options,
+ { "Command Options", "zbee_nwk.cmd.route.opts", FT_UINT8, BASE_HEX, NULL, 0x0,
+ NULL, HFILL }},
+
{ &hf_zbee_nwk_cmd_route_opt_repair,
{ "Route Repair", "zbee_nwk.cmd.route.opts.repair", FT_BOOLEAN, 8, NULL,
ZBEE_NWK_CMD_ROUTE_OPTION_REPAIR,
@@ -1810,6 +1769,10 @@ void proto_register_zbee_nwk(void)
{ "Relay Count", "zbee_nwk.cmd.relay_count", FT_UINT8, BASE_DEC, NULL, 0x0,
"Number of relays required to route to the destination.", HFILL }},
+ { &hf_zbee_nwk_cmd_relay_device,
+ { "Relay Device", "zbee_nwk.cmd.relay_device", FT_UINT16, BASE_HEX, NULL, 0x0,
+ NULL, HFILL }},
+
{ &hf_zbee_nwk_cmd_cinfo,
{ "Capability Information", "zbee_nwk.cmd.cinfo", FT_UINT8, BASE_HEX, NULL,
0x0, NULL, HFILL }},
@@ -1860,6 +1823,18 @@ void proto_register_zbee_nwk(void)
{ "Link Status Count", "zbee_nwk.cmd.link.count", FT_UINT8, BASE_DEC, NULL,
ZBEE_NWK_CMD_LINK_OPTION_COUNT_MASK, NULL, HFILL }},
+ { &hf_zbee_nwk_cmd_link_address,
+ { "Address", "zbee_nwk.cmd.link.address", FT_UINT16, BASE_HEX, NULL,
+ ZBEE_NWK_CMD_LINK_OPTION_COUNT_MASK, NULL, HFILL }},
+
+ { &hf_zbee_nwk_cmd_link_incoming_cost,
+ { "Incoming Cost", "zbee_nwk.cmd.link.incoming_cost", FT_UINT8, BASE_DEC, NULL,
+ ZBEE_NWK_CMD_LINK_INCOMMING_COST_MASK, NULL, HFILL }},
+
+ { &hf_zbee_nwk_cmd_link_outgoing_cost,
+ { "Outgoing Cost", "zbee_nwk.cmd.link.outgoing_cost", FT_UINT8, BASE_DEC, NULL,
+ ZBEE_NWK_CMD_LINK_OUTGOING_COST_MASK, NULL, HFILL }},
+
{ &hf_zbee_nwk_cmd_report_type,
{ "Report Type", "zbee_nwk.cmd.report.type", FT_UINT8, BASE_HEX,
VALS(zbee_nwk_report_types), ZBEE_NWK_CMD_NWK_REPORT_ID_MASK, NULL, HFILL }},
@@ -1880,6 +1855,10 @@ void proto_register_zbee_nwk(void)
{ "Update ID", "zbee_nwk.cmd.update.id", FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
+ { &hf_zbee_nwk_panid,
+ { "PAN ID", "zbee_nwk.panid", FT_UINT16, BASE_HEX, NULL, 0x0,
+ NULL, HFILL }},
+
{ &hf_zbee_nwk_cmd_epid,
{ "Extended PAN ID", "zbee_nwk.cmd.epid", FT_EUI64, BASE_NONE, NULL, 0x0,
NULL, HFILL }},
@@ -1952,7 +1931,8 @@ void proto_register_zbee_nwk(void)
&ett_zbee_nwk_route,
&ett_zbee_nwk_cmd,
&ett_zbee_nwk_cmd_options,
- &ett_zbee_nwk_cmd_cinfo
+ &ett_zbee_nwk_cmd_cinfo,
+ &ett_zbee_nwk_cmd_link
};
static ei_register_info ei[] = {
diff --git a/epan/dissectors/packet-zbee-zcl-general.c b/epan/dissectors/packet-zbee-zcl-general.c
index ee3c1452cd..7ef8a72253 100644
--- a/epan/dissectors/packet-zbee-zcl-general.c
+++ b/epan/dissectors/packet-zbee-zcl-general.c
@@ -1649,10 +1649,12 @@ static int hf_zbee_zcl_ota_payload_type = -1;
static int hf_zbee_zcl_ota_query_jitter = -1;
static int hf_zbee_zcl_ota_manufacturer_code = -1;
static int hf_zbee_zcl_ota_image_type = -1;
+static int hf_zbee_zcl_ota_file_version = -1;
static int hf_zbee_zcl_ota_file_version_appl_release = -1;
static int hf_zbee_zcl_ota_file_version_appl_build = -1;
static int hf_zbee_zcl_ota_file_version_stack_release = -1;
static int hf_zbee_zcl_ota_file_version_stack_build = -1;
+static int hf_zbee_zcl_ota_field_ctrl = -1;
static int hf_zbee_zcl_ota_field_ctrl_hw_ver_present = -1;
static int hf_zbee_zcl_ota_field_ctrl_reserved = -1;
static int hf_zbee_zcl_ota_hw_version = -1;
@@ -1850,18 +1852,16 @@ decode_zcl_ota_size_in_bytes(gchar *s, guint32 value)
static void
dissect_zcl_ota_file_version_field(tvbuff_t *tvb, proto_tree *tree, guint *offset)
{
- proto_tree *sub_tree = NULL;
- proto_item *ti;
- guint32 file_version;
+ static const int * file_version[] = {
+ &hf_zbee_zcl_ota_file_version_appl_release,
+ &hf_zbee_zcl_ota_file_version_appl_build,
+ &hf_zbee_zcl_ota_file_version_stack_release,
+ &hf_zbee_zcl_ota_file_version_stack_build,
+ NULL
+ };
/* 'File Version' field present, retrieves it */
- file_version = tvb_get_ntohl(tvb, *offset);
- ti = proto_tree_add_text(tree, tvb, *offset, 4, "File Version: 0x%08x", file_version);
- sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_ota_file_version);
- proto_tree_add_item(sub_tree, hf_zbee_zcl_ota_file_version_appl_release, tvb, *offset, 4, ENC_BIG_ENDIAN);
- proto_tree_add_item(sub_tree, hf_zbee_zcl_ota_file_version_appl_build, tvb, *offset, 4, ENC_BIG_ENDIAN);
- proto_tree_add_item(sub_tree, hf_zbee_zcl_ota_file_version_stack_release, tvb, *offset, 4, ENC_BIG_ENDIAN);
- proto_tree_add_item(sub_tree, hf_zbee_zcl_ota_file_version_stack_build, tvb, *offset, 4, ENC_BIG_ENDIAN);
+ proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_ota_file_version, ett_zbee_zcl_ota_file_version, file_version, ENC_BIG_ENDIAN);
*offset += 4;
} /*dissect_zcl_ota_file_version_field*/
@@ -1881,19 +1881,19 @@ dissect_zcl_ota_file_version_field(tvbuff_t *tvb, proto_tree *tree, guint *offse
static guint8
dissect_zcl_ota_field_ctrl_field(tvbuff_t *tvb, proto_tree *tree, guint *offset)
{
- proto_tree *sub_tree = NULL;
- proto_item *ti;
- guint8 field_ctrl;
+ guint8 field;
+ static const int * field_ctrl[] = {
+ &hf_zbee_zcl_ota_field_ctrl_hw_ver_present,
+ &hf_zbee_zcl_ota_field_ctrl_reserved,
+ NULL
+ };
/* Retrieve 'Field Control' field */
- field_ctrl = tvb_get_guint8(tvb, *offset);
- ti = proto_tree_add_text(tree, tvb, *offset, 1, "Field Control: 0x%02x", field_ctrl);
- sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_ota_field_ctrl);
- proto_tree_add_item(sub_tree, hf_zbee_zcl_ota_field_ctrl_hw_ver_present, tvb, *offset, 1, ENC_NA);
- proto_tree_add_item(sub_tree, hf_zbee_zcl_ota_field_ctrl_reserved, tvb, *offset, 1, ENC_NA);
+ field = tvb_get_guint8(tvb, *offset);
+ proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_ota_field_ctrl, ett_zbee_zcl_ota_field_ctrl, field_ctrl, ENC_BIG_ENDIAN);
*offset += 1;
- return field_ctrl;
+ return field;
} /*dissect_zcl_ota_field_ctrl_field*/
/*FUNCTION:------------------------------------------------------
@@ -2581,6 +2581,11 @@ void proto_register_zbee_zcl_ota(void)
RVALS(zbee_zcl_ota_image_type_names), 0x0, NULL, HFILL } },
/* Begin FileVersion fields */
+
+ { &hf_zbee_zcl_ota_file_version,
+ { "File Version", "zbee_zcl_general.ota.file.version", FT_UINT32, BASE_HEX, NULL,
+ 0x0, NULL, HFILL } },
+
{ &hf_zbee_zcl_ota_file_version_appl_release,
{ "Application Release", "zbee_zcl_general.ota.file.version.appl.release", FT_UINT32, BASE_DEC, NULL,
ZBEE_ZCL_OTA_FILE_VERS_APPL_RELEASE, NULL, HFILL } },
@@ -2599,6 +2604,11 @@ void proto_register_zbee_zcl_ota(void)
/* End FileVersion fields */
/* Begin FieldControl fields */
+
+ { &hf_zbee_zcl_ota_field_ctrl,
+ { "Field Control", "zbee_zcl_general.ota.field_ctrl",
+ FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
+
{ &hf_zbee_zcl_ota_field_ctrl_hw_ver_present,
{ "Hardware Version", "zbee_zcl_general.ota.field_ctrl_hw_ver_present",
FT_BOOLEAN, 8, TFS(&tfs_present_not_present), ZBEE_ZCL_OTA_FIELD_CTRL_HW_VER_PRESENT, NULL, HFILL } },
@@ -2815,10 +2825,12 @@ static int proto_zbee_zcl_pwr_prof = -1;
static int hf_zbee_zcl_pwr_prof_attr_id = -1;
static int hf_zbee_zcl_pwr_prof_tot_prof_num = -1;
static int hf_zbee_zcl_pwr_prof_multiple_sched = -1;
+static int hf_zbee_zcl_pwr_prof_energy_format = -1;
static int hf_zbee_zcl_pwr_prof_energy_format_rdigit = -1;
static int hf_zbee_zcl_pwr_prof_energy_format_ldigit = -1;
static int hf_zbee_zcl_pwr_prof_energy_format_noleadingzero = -1;
static int hf_zbee_zcl_pwr_prof_energy_remote = -1;
+static int hf_zbee_zcl_pwr_prof_sched_mode = -1;
static int hf_zbee_zcl_pwr_prof_sched_mode_cheapest = -1;
static int hf_zbee_zcl_pwr_prof_sched_mode_greenest = -1;
static int hf_zbee_zcl_pwr_prof_sched_mode_reserved = -1;
@@ -2842,6 +2854,7 @@ static int hf_zbee_zcl_pwr_prof_pwr_prof_rem_ctrl = -1;
static int hf_zbee_zcl_pwr_prof_pwr_prof_state = -1;
static int hf_zbee_zcl_pwr_prof_start_after = -1;
static int hf_zbee_zcl_pwr_prof_stop_before = -1;
+static int hf_zbee_zcl_pwr_prof_options = -1;
static int hf_zbee_zcl_pwr_prof_options_01 = -1;
static int hf_zbee_zcl_pwr_prof_options_res = -1;
static int hf_zbee_zcl_pwr_prof_pwr_prof_stime = -1;
@@ -3425,16 +3438,14 @@ dissect_zcl_pwr_prof_pwrprofschedcontrsnotif(tvbuff_t *tvb, proto_tree *tree, gu
static void
dissect_zcl_pwr_prof_pwrprofpriceext(tvbuff_t *tvb, proto_tree *tree, guint *offset)
{
- proto_tree *sub_tree = NULL;
- proto_item *ti;
- guint8 options;
+ static const int * options[] = {
+ &hf_zbee_zcl_pwr_prof_options_01,
+ &hf_zbee_zcl_pwr_prof_options_res,
+ NULL
+ };
/* Retrieve "Options" field */
- options = tvb_get_guint8(tvb, *offset);
- ti = proto_tree_add_text(tree, tvb, *offset, 1, "Options: 0x%02x", options);
- sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_pwr_prof_options);
- proto_tree_add_item(sub_tree, hf_zbee_zcl_pwr_prof_options_01, tvb, *offset, 1, ENC_NA);
- proto_tree_add_item(sub_tree, hf_zbee_zcl_pwr_prof_options_res, tvb, *offset, 1, ENC_NA);
+ proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_pwr_prof_options, ett_zbee_zcl_pwr_prof_options, options, ENC_NA);
*offset += 1;
/* Retrieve "Power Profile Id" field */
@@ -3467,9 +3478,18 @@ dissect_zcl_pwr_prof_pwrprofpriceext(tvbuff_t *tvb, proto_tree *tree, guint *off
static void
dissect_zcl_pwr_prof_attr_data(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type)
{
- proto_item *ti = NULL;
- proto_tree *sub_tree = NULL;
- guint8 value8;
+ static const int * format_fields[] = {
+ &hf_zbee_zcl_pwr_prof_energy_format_rdigit,
+ &hf_zbee_zcl_pwr_prof_energy_format_ldigit,
+ &hf_zbee_zcl_pwr_prof_energy_format_noleadingzero,
+ NULL
+ };
+ static const int * modes[] = {
+ &hf_zbee_zcl_pwr_prof_sched_mode_cheapest,
+ &hf_zbee_zcl_pwr_prof_sched_mode_greenest,
+ &hf_zbee_zcl_pwr_prof_sched_mode_reserved,
+ NULL
+ };
/* Dissect attribute data type and data */
switch ( attr_id )
@@ -3485,12 +3505,7 @@ dissect_zcl_pwr_prof_attr_data(proto_tree *tree, tvbuff_t *tvb, guint *offset, g
break;
case ZBEE_ZCL_ATTR_ID_PWR_PROF_ENERGY_FORMAT:
- value8 = tvb_get_guint8(tvb, *offset);
- ti = proto_tree_add_text(tree, tvb, *offset, 1, "Data: 0x%02x", value8);
- sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_pwr_prof_en_format);
- proto_tree_add_item(sub_tree, hf_zbee_zcl_pwr_prof_energy_format_rdigit, tvb, *offset, 1, ENC_NA);
- proto_tree_add_item(sub_tree, hf_zbee_zcl_pwr_prof_energy_format_ldigit, tvb, *offset, 1, ENC_NA);
- proto_tree_add_item(sub_tree, hf_zbee_zcl_pwr_prof_energy_format_noleadingzero, tvb, *offset, 1, ENC_NA);
+ proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_pwr_prof_energy_format, ett_zbee_zcl_pwr_prof_en_format, format_fields, ENC_NA);
*offset += 1;
break;
@@ -3500,12 +3515,7 @@ dissect_zcl_pwr_prof_attr_data(proto_tree *tree, tvbuff_t *tvb, guint *offset, g
break;
case ZBEE_ZCL_ATTR_ID_PWR_PROF_SCHED_MODE:
- value8 = tvb_get_guint8(tvb, *offset);
- ti = proto_tree_add_text(tree, tvb, *offset, 1, "Schedule Mode: 0x%02x", value8);
- sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_pwr_prof_sched_mode);
- proto_tree_add_item(sub_tree, hf_zbee_zcl_pwr_prof_sched_mode_cheapest, tvb, *offset, 1, ENC_NA);
- proto_tree_add_item(sub_tree, hf_zbee_zcl_pwr_prof_sched_mode_greenest, tvb, *offset, 1, ENC_NA);
- proto_tree_add_item(sub_tree, hf_zbee_zcl_pwr_prof_sched_mode_reserved, tvb, *offset, 1, ENC_NA);
+ proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_pwr_prof_sched_mode, ett_zbee_zcl_pwr_prof_sched_mode, modes, ENC_NA);
*offset += 1;
break;
@@ -3647,6 +3657,10 @@ proto_register_zbee_zcl_pwr_prof(void)
TFS(&tfs_supported_not_supported), 0x0, NULL, HFILL } },
/* Begin EnergyFormatting fields */
+ { &hf_zbee_zcl_pwr_prof_energy_format,
+ { "Data", "zbee_zcl_general.pwrprof.attr.energyformat",
+ FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
+
{ &hf_zbee_zcl_pwr_prof_energy_format_rdigit,
{ "Number of Digits to the right of the Decimal Point", "zbee_zcl_general.pwrprof.attr.energyformat.rdigit",
FT_UINT8, BASE_DEC, NULL, ZBEE_ZCL_OPT_PWRPROF_NUM_R_DIGIT, NULL, HFILL } },
@@ -3665,6 +3679,10 @@ proto_register_zbee_zcl_pwr_prof(void)
TFS(&tfs_enabled_disabled), 0x0, NULL, HFILL } },
/* Begin ScheduleMode fields */
+ { &hf_zbee_zcl_pwr_prof_sched_mode,
+ { "Schedule Mode", "zbee_zcl_general.pwrprof.attr.schedmode",
+ FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
+
{ &hf_zbee_zcl_pwr_prof_sched_mode_cheapest,
{ "Schedule Mode Cheapest", "zbee_zcl_general.pwrprof.attr.schedmode.cheapest",
FT_BOOLEAN, 8, TFS(&tfs_active_inactive), ZBEE_ZCL_OPT_PWRPROF_SCHED_CHEAPEST, NULL, HFILL } },
@@ -3763,6 +3781,10 @@ proto_register_zbee_zcl_pwr_prof(void)
NULL, HFILL } },
/* Begin Options fields */
+ { &hf_zbee_zcl_pwr_prof_options,
+ { "Options", "zbee_zcl_general.pwrprof.options", FT_UINT8, BASE_HEX, NULL,
+ 0x0, NULL, HFILL } },
+
{ &hf_zbee_zcl_pwr_prof_options_01,
{ "PowerProfileStartTime Field Present", "zbee_zcl_general.pwrprof.options.01", FT_BOOLEAN, 8, TFS(&tfs_true_false),
ZBEE_ZCL_OPT_PWRPROF_STIME_PRESENT, NULL, HFILL } },
@@ -3953,6 +3975,7 @@ static void dissect_zcl_appl_ctrl_attr_data (proto_tree *tree, tvbuf
static int proto_zbee_zcl_appl_ctrl = -1;
static int hf_zbee_zcl_appl_ctrl_attr_id = -1;
+static int hf_zbee_zcl_appl_ctrl_time = -1;
static int hf_zbee_zcl_appl_ctrl_time_mm = -1;
static int hf_zbee_zcl_appl_ctrl_time_encoding_type = -1;
static int hf_zbee_zcl_appl_ctrl_time_hh = -1;
@@ -3963,6 +3986,7 @@ static int hf_zbee_zcl_appl_ctrl_attr_func_id = -1;
static int hf_zbee_zcl_appl_ctrl_attr_func_data_type = -1;
static int hf_zbee_zcl_appl_ctrl_warning_id = -1;
static int hf_zbee_zcl_appl_ctrl_appl_status = -1;
+static int hf_zbee_zcl_appl_ctrl_rem_en_flags_raw = -1;
static int hf_zbee_zcl_appl_ctrl_rem_en_flags = -1;
static int hf_zbee_zcl_appl_ctrl_status2 = -1;
static int hf_zbee_zcl_appl_ctrl_status2_array = -1;
@@ -4310,20 +4334,18 @@ dissect_zcl_appl_ctrl_ovrl_warning(tvbuff_t *tvb, proto_tree *tree, guint *offse
static void
dissect_zcl_appl_ctrl_signal_state_rsp(tvbuff_t *tvb, proto_tree *tree, guint *offset)
{
- proto_item *ti = NULL;
- proto_tree *sub_tree = NULL;
- guint8 flags;
+ static const int * flags[] = {
+ &hf_zbee_zcl_appl_ctrl_rem_en_flags,
+ &hf_zbee_zcl_appl_ctrl_status2,
+ NULL
+ };
/* Retrieve "Appliance Status" field */
proto_tree_add_item(tree, hf_zbee_zcl_appl_ctrl_appl_status, tvb, *offset, 1, ENC_NA);
*offset += 1;
/* Retrieve "Remote Enable" field */
- flags = tvb_get_guint8(tvb, *offset);
- ti = proto_tree_add_text(tree, tvb, *offset, 1, "Remote Enable Flags: 0x%02x", flags);
- sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_appl_ctrl_flags);
- proto_tree_add_item(sub_tree, hf_zbee_zcl_appl_ctrl_rem_en_flags, tvb, *offset, 1, ENC_NA);
- proto_tree_add_item(sub_tree, hf_zbee_zcl_appl_ctrl_status2, tvb, *offset, 1, ENC_NA);
+ proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_appl_ctrl_rem_en_flags_raw, ett_zbee_zcl_appl_ctrl_flags, flags, ENC_NA);
*offset += 1;
/* Retrieve "Appliance Status 2" field */
@@ -4349,9 +4371,12 @@ dissect_zcl_appl_ctrl_signal_state_rsp(tvbuff_t *tvb, proto_tree *tree, guint *o
static void
dissect_zcl_appl_ctrl_attr_data(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type)
{
- proto_item *ti = NULL;
- proto_tree *sub_tree = NULL;
- guint16 raw_time;
+ static const int * flags[] = {
+ &hf_zbee_zcl_appl_ctrl_time_mm,
+ &hf_zbee_zcl_appl_ctrl_time_encoding_type,
+ &hf_zbee_zcl_appl_ctrl_time_hh,
+ NULL
+ };
/* Dissect attribute data type and data */
switch (attr_id) {
@@ -4359,13 +4384,7 @@ dissect_zcl_appl_ctrl_attr_data(proto_tree *tree, tvbuff_t *tvb, guint *offset,
case ZBEE_ZCL_ATTR_ID_APPL_CTRL_START_TIME:
case ZBEE_ZCL_ATTR_ID_APPL_CTRL_FINISH_TIME:
case ZBEE_ZCL_ATTR_ID_APPL_CTRL_REMAINING_TIME:
- raw_time = tvb_get_letohs(tvb, *offset);
- ti = proto_tree_add_text(tree, tvb, *offset, 2, "Data: 0x%04x", raw_time);
- sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_appl_ctrl_time);
-
- proto_tree_add_item(sub_tree, hf_zbee_zcl_appl_ctrl_time_mm, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
- proto_tree_add_item(sub_tree, hf_zbee_zcl_appl_ctrl_time_encoding_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
- proto_tree_add_item(sub_tree, hf_zbee_zcl_appl_ctrl_time_hh, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
+ proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_appl_ctrl_time, ett_zbee_zcl_appl_ctrl_time, flags, ENC_LITTLE_ENDIAN);
*offset += 2;
break;
@@ -4399,6 +4418,10 @@ proto_register_zbee_zcl_appl_ctrl(void)
{ "Attribute", "zbee_zcl_general.applctrl.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_appl_ctrl_attr_names),
0x0, NULL, HFILL } },
+ { &hf_zbee_zcl_appl_ctrl_time,
+ { "Data", "zbee_zcl_general.applctrl.time", FT_UINT16, BASE_HEX, NULL, 0x0,
+ NULL, HFILL } },
+
{ &hf_zbee_zcl_appl_ctrl_time_mm,
{ "Minutes", "zbee_zcl_general.applctrl.time.mm", FT_UINT16, BASE_DEC, NULL, ZBEE_ZCL_APPL_CTRL_TIME_MM,
NULL, HFILL } },
@@ -4423,6 +4446,10 @@ proto_register_zbee_zcl_appl_ctrl(void)
{ "Appliance Status", "zbee_zcl_general.applctrl.status", FT_UINT8, BASE_HEX, VALS(zbee_zcl_appl_ctrl_appl_status_names),
0x0, NULL, HFILL } },
+ { &hf_zbee_zcl_appl_ctrl_rem_en_flags_raw,
+ { "Remote Enable Flags", "zbee_zcl_general.applctrl.remote_enable_flags", FT_UINT8, BASE_HEX, NULL,
+ 0x0, NULL, HFILL } },
+
{ &hf_zbee_zcl_appl_ctrl_rem_en_flags,
{ "Remote Enable Flags", "zbee_zcl_general.applctrl.remenflags", FT_UINT8, BASE_HEX, VALS(zbee_zcl_appl_ctrl_rem_flags_names),
ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_FLAGS, NULL, HFILL } },
diff --git a/epan/dissectors/packet-zbee-zdp-binding.c b/epan/dissectors/packet-zbee-zdp-binding.c
index c40dc26f92..67c03515cf 100644
--- a/epan/dissectors/packet-zbee-zdp-binding.c
+++ b/epan/dissectors/packet-zbee-zdp-binding.c
@@ -52,42 +52,35 @@
void
zdp_parse_bind_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint8 version)
{
- proto_item *ti = NULL;
+ proto_tree *bind_tree;
+ proto_item *ti;
guint len = 0;
- guint64 src64;
- guint8 src_ep;
- guint16 cluster;
guint8 mode;
- guint64 dst64;
- guint16 dst;
- guint8 dst_ep;
/* Add the source address. */
- src64 = tvb_get_letoh64(tvb, *offset + len);
- if (tree) ti = proto_tree_add_text(tree, tvb, *offset, 0, "Bind {Src: %s", ep_eui64_to_display(src64));
- len += (int)sizeof(guint64);
+ bind_tree = proto_tree_add_subtree(tree, tvb, *offset, 0, ett_zbee_zdp_bind_entry, &ti, "Bind");
+ proto_tree_add_item(bind_tree, hf_zbee_zdp_bind_src64, tvb, *offset, 8, ENC_LITTLE_ENDIAN);
+ len += 8;
/* Add the source endpoint. */
- src_ep = tvb_get_guint8(tvb, *offset + len);
- if (tree) proto_item_append_text(ti, ", Src Endpoint: %d", src_ep);
- len += (int)sizeof(guint8);
+ proto_tree_add_item(bind_tree, hf_zbee_zdp_bind_src_ep, tvb, *offset + len, 1, ENC_LITTLE_ENDIAN);
+ len += 1;
/* Add the cluster ID. */
if (version >= ZBEE_VERSION_2007) {
- cluster = tvb_get_letohs(tvb, *offset + len);
- len += (int)sizeof(guint16);
+ proto_tree_add_item(bind_tree, hf_zbee_zdp_cluster, tvb, *offset + len, 2, ENC_LITTLE_ENDIAN);
+ len += 2;
}
else {
- cluster = tvb_get_guint8(tvb, *offset + len);
- len += (int)sizeof(guint8);
+ proto_tree_add_item(bind_tree, hf_zbee_zdp_cluster, tvb, *offset + len, 1, ENC_LITTLE_ENDIAN);
+ len += 1;
}
- if (tree) proto_item_append_text(ti, ", Cluster: %d", cluster);
/* Get the destination address mode. */
if (version >= ZBEE_VERSION_2007) {
mode = tvb_get_guint8(tvb, *offset + len);
- len += (int)sizeof(guint8);
+ len += 1;
}
else {
/* Mode field doesn't exist and always uses unicast in 2003 & earlier. */
@@ -96,26 +89,17 @@ zdp_parse_bind_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint
/* Add the destination address. */
if (mode == ZBEE_ZDP_ADDR_MODE_GROUP) {
- dst = tvb_get_letohs(tvb, *offset + len);
- if (tree) proto_item_append_text(ti, ", Dst: 0x%04x}", dst);
- len += (int)sizeof(guint16);
+ proto_tree_add_item(bind_tree, hf_zbee_zdp_bind_dst, tvb, *offset + len, 2, ENC_LITTLE_ENDIAN);
+ len += 2;
}
else if (mode == ZBEE_ZDP_ADDR_MODE_UNICAST) {
- dst64 = tvb_get_letoh64(tvb, *offset + len);
- if (tree) proto_item_append_text(ti, ", Dst: %s", ep_eui64_to_display(dst64));
- len += (int)sizeof(guint64);
-
- dst_ep = tvb_get_guint8(tvb, *offset + len);
- if (tree) proto_item_append_text(ti, ", Dst Endpoint: %d}", dst_ep);
- len += (int)sizeof(guint8);
- }
- else {
- if (tree) proto_item_append_text(ti, "}");
+ proto_tree_add_item(bind_tree, hf_zbee_zdp_bind_dst64, tvb, *offset + len, 8, ENC_LITTLE_ENDIAN);
+ len += 8;
+ proto_tree_add_item(bind_tree, hf_zbee_zdp_bind_dst_ep, tvb, *offset + len, 1, ENC_LITTLE_ENDIAN);
+ len += 1;
}
- if (tree) {
- proto_item_set_len(ti, len);
- }
+ proto_item_set_len(ti, len);
*offset += len;
} /* zdp_parse_bind_table_entry */
@@ -242,7 +226,7 @@ dissect_zbee_zdp_req_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
zbee_append_info(tree, pinfo, ", Dst: 0x%04x", dst);
}
else {
- zbee_append_info(tree, pinfo, ", Dst: %s", eui64_to_str(dst64));
+ zbee_append_info(tree, pinfo, ", Dst: %s", ep_eui64_to_display(dst64));
}
/* Dump any leftover bytes. */
@@ -308,7 +292,7 @@ dissect_zbee_zdp_req_unbind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
zbee_append_info(tree, pinfo, ", Dst: 0x%04x", dst);
}
else {
- zbee_append_info(tree, pinfo, ", Dst: %s", eui64_to_str(dst64));
+ zbee_append_info(tree, pinfo, ", Dst: %s", ep_eui64_to_display(dst64));
}
/* Dump any leftover bytes. */
diff --git a/epan/dissectors/packet-zbee-zdp-management.c b/epan/dissectors/packet-zbee-zdp-management.c
index 3bf1d00e8d..c4d9ae7c32 100644
--- a/epan/dissectors/packet-zbee-zdp-management.c
+++ b/epan/dissectors/packet-zbee-zdp-management.c
@@ -51,56 +51,42 @@
static void
zdp_parse_nwk_desc(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint8 version)
{
- proto_item *ti = NULL;
- guint len = 0;
+ proto_tree *network_tree;
+ proto_item *ti;
- guint64 ext_pan;
- guint16 pan;
- guint8 channel;
- guint8 profile;
- guint8 profile_version;
guint8 beacon;
- guint8 superframe;
- gboolean permit;
if (version >= ZBEE_VERSION_2007) {
+ network_tree = proto_tree_add_subtree(tree, tvb, *offset, 12, ett_zbee_zdp_nwk_desc, NULL, "Network descriptor");
/* Extended PAN Identifiers are used in ZigBee 2006 & later. */
- ext_pan = tvb_get_letoh64(tvb, *offset + len);
- if (tree) ti = proto_tree_add_text(tree, tvb, *offset, 0, "{Pan: %s", eui64_to_str(ext_pan));
- len += 8;
+ proto_tree_add_item(network_tree, hf_zbee_zdp_pan_eui64, tvb, *offset, 8, ENC_LITTLE_ENDIAN);
+ *offset += 8;
}
else {
+ network_tree = proto_tree_add_subtree(tree, tvb, *offset, 6, ett_zbee_zdp_nwk_desc, NULL, "Network descriptor");
/* Short PAN Identifiers are used in ZigBee 2003 and earlier. */
- pan = tvb_get_letohs(tvb, *offset + len);
- if (tree) ti = proto_tree_add_text(tree, tvb, *offset, 0, "{Pan: 0x%04x", pan);
- len += 2;
+ proto_tree_add_item(network_tree, hf_zbee_zdp_pan_uint, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
+ *offset += 2;
}
- channel = tvb_get_guint8(tvb, *offset + len);
- if (tree) proto_item_append_text(ti, ", Channel: %d", channel);
- len += 1;
+ proto_tree_add_item(network_tree, hf_zbee_zdp_channel, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
+ *offset += 1;
- profile = (tvb_get_guint8(tvb, *offset + len) & 0x0f) >> 0;
- profile_version = (tvb_get_guint8(tvb, *offset + len) & 0xf0) >> 4;
- if (tree) proto_item_append_text(ti, ", Profile: 0x%01x, Version: %d", profile, profile_version);
- len += 1;
+ proto_tree_add_item(network_tree, hf_zbee_zdp_profile, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
+ proto_tree_add_item(network_tree, hf_zbee_zdp_profile_version, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
+ *offset += 1;
- beacon = (tvb_get_guint8(tvb, *offset + len) & 0x0f) >> 0;
- superframe = (tvb_get_guint8(tvb, *offset + len) & 0xf0) >> 4;
- if ((tree) && (beacon == 0xf)) {
- proto_item_append_text(ti, ", Beacons Disabled");
- }
- else if (tree) {
- proto_item_append_text(ti, ", BeaconOrder: %d, SuperframeOrder: %d", beacon, superframe);
+ ti = proto_tree_add_item(network_tree, hf_zbee_zdp_beacon, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
+ proto_tree_add_item(network_tree, hf_zbee_zdp_superframe, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
+ beacon = tvb_get_guint8(tvb, *offset) & 0x0f;
+ if (beacon == 0xf) {
+ proto_item_append_text(ti, " (Beacons Disabled)");
}
- len += 1;
+ *offset += 1;
- permit = tvb_get_guint8(tvb, *offset) & 0x01;
- if (tree) proto_item_append_text(ti, ", PermitJoining: %s}", permit?"True":"False");
- len += 1;
+ proto_tree_add_item(network_tree, hf_zbee_zdp_permit_joining, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
+ *offset += 1;
- if (tree) proto_item_set_len(ti, len);
- *offset += len;
} /* zdp_parse_nwk_desc */
/*FUNCTION:------------------------------------------------------
@@ -119,94 +105,57 @@ zdp_parse_nwk_desc(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint8 versio
static void
zdp_parse_neighbor_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint8 version)
{
+ proto_tree *table_tree;
proto_item *ti = NULL;
guint len = 0;
- guint64 ext_pan;
- guint16 pan;
- guint64 ext_addr;
- guint16 device;
- guint8 type;
- guint8 idle_rx;
- guint8 rel;
- guint8 permit_joining;
- guint8 depth;
- guint8 lqi;
-
if (version >= ZBEE_VERSION_2007) {
+ table_tree = proto_tree_add_subtree(tree, tvb, *offset, 8, ett_zbee_zdp_table_entry, &ti, "Table Entry");
/* ZigBee 2006 & later use an extended PAN Identifier. */
- ext_pan = tvb_get_letoh64(tvb, *offset + len);
- if (tree) ti = proto_tree_add_text(tree, tvb, *offset, 0, "{Extended PAN: %s", eui64_to_str(ext_pan));
+ proto_tree_add_item(table_tree, hf_zbee_zdp_extended_pan, tvb, *offset, 8, ENC_LITTLE_ENDIAN);
len += 8;
}
else {
+ table_tree = proto_tree_add_subtree(tree, tvb, *offset, 2, ett_zbee_zdp_table_entry, &ti, "Table Entry");
/* ZigBee 2003 & earlier use a short PAN Identifier. */
- pan = tvb_get_letohs(tvb, *offset + len);
- if (tree) ti = proto_tree_add_text(tree, tvb, *offset, 0, "{PAN: 0x%04x", pan);
+ proto_tree_add_item(table_tree, hf_zbee_zdp_pan_uint, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
len += 2;
}
- ext_addr = tvb_get_letoh64(tvb, *offset + len);
- if (tree) proto_item_append_text(ti, ", Extended Addr: %s", ep_eui64_to_display(ext_addr));
+ proto_tree_add_item(table_tree, hf_zbee_zdp_ext_addr, tvb, *offset + len, 8, ENC_LITTLE_ENDIAN);
len += 8;
- device = tvb_get_letohs(tvb, *offset + len);
- if (tree) proto_item_append_text(ti, ", Addr: 0x%04x", device);
+ proto_tree_add_item(table_tree, hf_zbee_zdp_addr, tvb, *offset + len, 2, ENC_LITTLE_ENDIAN);
len += 2;
if (version >= ZBEE_VERSION_2007) {
- type = (tvb_get_guint8(tvb, *offset + len) & 0x03) >> 0;
- idle_rx = (tvb_get_guint8(tvb, *offset + len) & 0x0c) >> 2;
- rel = (tvb_get_guint8(tvb, *offset + len) & 0x70) >> 4;
+ proto_tree_add_item(table_tree, hf_zbee_zdp_table_entry_type, tvb, *offset + len, 1, ENC_NA);
+ proto_tree_add_item(table_tree, hf_zbee_zdp_table_entry_idle_rx_0c, tvb, *offset + len, 1, ENC_NA);
+ proto_tree_add_item(table_tree, hf_zbee_zdp_table_entry_relationship_70, tvb, *offset + len, 1, ENC_NA);
}
else {
- type = (tvb_get_guint8(tvb, *offset + len) & 0x03) >> 0;
- idle_rx = (tvb_get_guint8(tvb, *offset + len) & 0x04) >> 2;
- rel = (tvb_get_guint8(tvb, *offset + len) & 0x18) >> 3;
- }
- if (tree) {
- if (type == 0x00) proto_item_append_text(ti, ", Type: Coordinator");
- else if (type == 0x01) proto_item_append_text(ti, ", Type: Router");
- else if (type == 0x02) proto_item_append_text(ti, ", Type: End Device");
- else proto_item_append_text(ti, ", Type: Unknown");
-
- if (idle_rx == 0x00) proto_item_append_text(ti, ", Idle Rx: False");
- else if (idle_rx==0x01) proto_item_append_text(ti, ", Idle Rx: True");
- else proto_item_append_text(ti, ", Idle Rx: Unknown");
-
- if (rel == 0x00) proto_item_append_text(ti, ", Relationship: Parent");
- else if (rel == 0x01) proto_item_append_text(ti, ", Relationship: Child");
- else if (rel == 0x02) proto_item_append_text(ti, ", Relationship: Sibling");
- else if (rel == 0x03) proto_item_append_text(ti, ", Relationship: None");
- else if (rel == 0x04) proto_item_append_text(ti, ", Relationship: Previous Child");
- else proto_item_append_text(ti, ", Relationship: Unknown");
+ proto_tree_add_item(table_tree, hf_zbee_zdp_table_entry_type, tvb, *offset + len, 1, ENC_NA);
+ proto_tree_add_item(table_tree, hf_zbee_zdp_table_entry_idle_rx_04, tvb, *offset + len, 1, ENC_NA);
+ proto_tree_add_item(table_tree, hf_zbee_zdp_table_entry_relationship_18, tvb, *offset + len, 1, ENC_NA);
}
len += 1;
if (version <= ZBEE_VERSION_2004) {
/* In ZigBee 2003 & earlier, the depth field is before the permit joining field. */
- depth = tvb_get_guint8(tvb, *offset + len);
- if (tree) proto_item_append_text(ti, ", Depth: %d", depth);
+ proto_tree_add_item(table_tree, hf_zbee_zdp_depth, tvb, *offset + len, 1, ENC_NA);
len += 1;
}
- permit_joining = (tvb_get_guint8(tvb, *offset + len) & 0x03) >> 0;
- if (tree) {
- if (permit_joining == 0x00) proto_item_append_text(ti, ", Permit Joining: False");
- else if (permit_joining == 0x01)proto_item_append_text(ti, ", Permit Joining: True");
- else proto_item_append_text(ti, ", Permit Joining: Unknown");
- }
+ proto_tree_add_item(table_tree, hf_zbee_zdp_permit_joining_03, tvb, *offset + len, 1, ENC_NA);
len += 1;
if (version >= ZBEE_VERSION_2007) {
/* In ZigBee 2006 & later, the depth field is after the permit joining field. */
- depth = tvb_get_guint8(tvb, *offset + len);
- if (tree) proto_item_append_text(ti, ", Depth: %d", depth);
+ proto_tree_add_item(table_tree, hf_zbee_zdp_depth, tvb, *offset + len, 1, ENC_NA);
len += 1;
}
- lqi = tvb_get_guint8(tvb, *offset + len);
- if (tree) proto_item_append_text(ti, ", LQI: %d}", lqi);
+ proto_tree_add_item(table_tree, hf_zbee_zdp_lqi, tvb, *offset + len, 1, ENC_NA);
len += 1;
if (tree) proto_item_set_len(ti, len);
@@ -275,7 +224,7 @@ zdp_parse_routing_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset)
*---------------------------------------------------------------
*/
void
-dissect_zbee_zdp_req_mgmt_nwk_disc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+dissect_zbee_zdp_req_mgmt_nwk_disc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int hf_channel)
{
proto_item *ti;
guint i;
@@ -289,7 +238,7 @@ dissect_zbee_zdp_req_mgmt_nwk_disc(tvbuff_t *tvb, packet_info *pinfo, proto_tree
channels = tvb_get_letohl(tvb, offset);
if (tree) {
gboolean first = 1;
- ti = proto_tree_add_text(tree, tvb, offset, 4, "Scan Channels: ");
+ ti = proto_tree_add_uint_format(tree, hf_channel, tvb, offset, 4, channels, "Scan Channels: ");
for (i=0; i<27; i++) {
if (channels & (1<<i)) {
@@ -537,7 +486,7 @@ dissect_zbee_zdp_req_mgmt_nwkupdate(tvbuff_t *tvb, packet_info *pinfo, proto_tre
/*guint8 update_id;*/
/*guint16 manager;*/
- /*channels =*/ zdp_parse_chanmask(tree, tvb, &offset);
+ /*channels =*/ zdp_parse_chanmask(tree, tvb, &offset, hf_zbee_zdp_channel_mask);
duration = zbee_parse_uint(tree, hf_zbee_zdp_duration, tvb, &offset, 1, NULL);
if (duration == ZBEE_ZDP_NWKUPDATE_PARAMETERS) {
/*update_id =*/ zbee_parse_uint(tree, hf_zbee_zdp_update_id, tvb, &offset, 1, NULL);
@@ -633,12 +582,12 @@ dissect_zbee_zdp_rsp_mgmt_lqi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
/*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, 1, NULL);
table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, 1, NULL);
- if (tree && table_count) {
+ if (table_count) {
field_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_zbee_zdp_lqi, NULL, "Neighbor Table");
+ for (i=0; i<table_count; i++) {
+ zdp_parse_neighbor_table_entry(field_tree, tvb, &offset, version);
+ }
}
- for (i=0; i<table_count; i++) {
- zdp_parse_neighbor_table_entry(field_tree, tvb, &offset, version);
- } /* for */
zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
@@ -838,6 +787,7 @@ void
dissect_zbee_zdp_rsp_mgmt_cache(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_tree *field_tree = NULL;
+ proto_tree *ti;
guint offset = 0;
guint i;
@@ -851,20 +801,20 @@ dissect_zbee_zdp_rsp_mgmt_cache(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
/*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, 1, NULL);
table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, 1, NULL);
- if (tree && table_count) {
+ if (table_count) {
field_tree = proto_tree_add_subtree(tree, tvb, offset, table_count*(2+8),
ett_zbee_zdp_cache, NULL, "Discovery Cache");
- }
- for (i=0; i<table_count; i++) {
- guint64 addr64 = tvb_get_letoh64(tvb, offset);
- guint16 addr16 = tvb_get_letohs(tvb, offset+8);
+ for (i=0; i<table_count; i++) {
+ guint16 addr16 = tvb_get_letohs(tvb, offset+8);
- if (field_tree) {
- proto_tree_add_text(field_tree, tvb, offset, 2+8, "{%s = 0x%04x}", ep_eui64_to_display(addr64), addr16);
+ ti = proto_tree_add_item(field_tree, hf_zbee_zdp_cache_address, tvb, offset, 8, ENC_LITTLE_ENDIAN);
+ /* XXX - make 16-bit address filterable? */
+ proto_item_append_text(ti, " = 0x%04x", addr16);
+ proto_item_set_len(ti, 8+2);
+ offset += 2+8;
}
- offset += 2+8;
- } /* for */
+ }
zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
@@ -899,7 +849,7 @@ dissect_zbee_zdp_rsp_mgmt_nwkupdate(tvbuff_t *tvb, packet_info *pinfo, proto_tre
guint8 channel_count;
/*status =*/ zdp_parse_status(tree, tvb, &offset);
- channels = zdp_parse_chanmask(tree, tvb, &offset);
+ channels = zdp_parse_chanmask(tree, tvb, &offset, hf_zbee_zdp_channel_mask);
/*tx_total =*/ zbee_parse_uint(tree, hf_zbee_zdp_tx_total, tvb, &offset, 2, NULL);
/*tx_fail =*/ zbee_parse_uint(tree, hf_zbee_zdp_tx_fail, tvb, &offset, 2, NULL);
channel_count = zbee_parse_uint(tree, hf_zbee_zdp_channel_count, tvb, &offset, 1, NULL);
@@ -918,9 +868,7 @@ dissect_zbee_zdp_rsp_mgmt_nwkupdate(tvbuff_t *tvb, packet_info *pinfo, proto_tre
}
/* Get and display the channel energy. */
energy = tvb_get_guint8(tvb, offset);
- if (tree) {
- proto_tree_add_text(tree, tvb, offset, 1, "Channel %d Energy = 0x%02x", i, energy);
- }
+ proto_tree_add_uint_format(tree, hf_zbee_zdp_channel_energy, tvb, offset, 1, energy, "Channel %d Energy: 0x%02x", i, energy);
offset += 1;
/* Increment the number of channels we found energy values for. */
j++;
diff --git a/epan/dissectors/packet-zbee-zdp.c b/epan/dissectors/packet-zbee-zdp.c
index cba7d4b288..0a5fa44ad5 100644
--- a/epan/dissectors/packet-zbee-zdp.c
+++ b/epan/dissectors/packet-zbee-zdp.c
@@ -71,6 +71,7 @@ static int hf_zbee_zdp_status = -1;
int hf_zbee_zdp_out_cluster = -1;
int hf_zbee_zdp_assoc_device_count = -1;
int hf_zbee_zdp_assoc_device = -1;
+ int hf_zbee_zdp_cache_address = -1;
/* Capability information indicies. */
static int hf_zbee_zdp_cinfo_alloc = -1;
@@ -155,6 +156,27 @@ static int hf_zbee_zdp_complex = -1;
int hf_zbee_zdp_tx_total = -1;
int hf_zbee_zdp_tx_fail = -1;
int hf_zbee_zdp_channel_count = -1;
+ int hf_zbee_zdp_channel_mask = -1;
+ int hf_zbee_zdp_channel_energy = -1;
+ int hf_zbee_zdp_pan_eui64 = -1;
+ int hf_zbee_zdp_pan_uint = -1;
+ int hf_zbee_zdp_channel = -1;
+ int hf_zbee_zdp_nwk_desc_profile = -1;
+ int hf_zbee_zdp_profile_version = -1;
+ int hf_zbee_zdp_beacon = -1;
+ int hf_zbee_zdp_superframe = -1;
+ int hf_zbee_zdp_permit_joining = -1;
+ int hf_zbee_zdp_extended_pan = -1;
+ int hf_zbee_zdp_addr = -1;
+ int hf_zbee_zdp_table_entry_type = -1;
+ int hf_zbee_zdp_table_entry_idle_rx_0c = -1;
+ int hf_zbee_zdp_table_entry_relationship_70 = -1;
+ int hf_zbee_zdp_table_entry_idle_rx_04 = -1;
+ int hf_zbee_zdp_table_entry_relationship_18 = -1;
+ int hf_zbee_zdp_depth = -1;
+ int hf_zbee_zdp_permit_joining_03 = -1;
+ int hf_zbee_zdp_lqi = -1;
+static int hf_zbee_zdp_scan_channel = -1;
/* Routing Table */
int hf_zbee_zdp_rtg = -1;
@@ -177,6 +199,7 @@ static gint ett_zbee_zdp_node_out = -1;
gint ett_zbee_zdp_server = -1;
gint ett_zbee_zdp_simple_sizes = -1;
gint ett_zbee_zdp_bind = -1;
+ gint ett_zbee_zdp_bind_entry = -1;
gint ett_zbee_zdp_bind_end_in = -1;
gint ett_zbee_zdp_bind_end_out = -1;
static gint ett_zbee_zdp_bind_table = -1;
@@ -186,6 +209,8 @@ static gint ett_zbee_zdp_bind_table = -1;
gint ett_zbee_zdp_lqi = -1;
gint ett_zbee_zdp_rtg = -1;
gint ett_zbee_zdp_cache = -1;
+ gint ett_zbee_zdp_nwk_desc = -1;
+ gint ett_zbee_zdp_table_entry = -1;
gint ett_zbee_zdp_descriptor_capability_field = -1;
/* Data dissector handle. */
@@ -314,6 +339,53 @@ const value_string zbee_zdp_rtg_status_vals[] = {
{ 0, NULL }
};
+/* The reason this has it's own value_string and doesn't use
+ tfs_true_false, is that some hf_ fields use bitmasks larger
+ than 0x01, and it's intentional that those other values be
+ "Unknown" (which is what value_string will give us)
+ */
+const value_string zbee_zdp_true_false_plus_vals[] = {
+ { 0x00, "False" },
+ { 0x01, "True" },
+ { 0, NULL }
+};
+
+const value_string zbee_zdp_table_entry_type_vals[] = {
+ { 0x00, "Coordinator" },
+ { 0x01, "Router" },
+ { 0x02, "End Device" },
+ { 0, NULL }
+};
+
+const value_string zbee_zdp_relationship_vals[] = {
+ { 0x00, "Parent" },
+ { 0x01, "Child" },
+ { 0x02, "Sibling" },
+ { 0x03, "None" },
+ { 0x04, "Previous Child" },
+ { 0, NULL }
+};
+
+/*
+ if (tree) {
+ if (type == 0x00) proto_item_append_text(ti, ", Type: Coordinator");
+ else if (type == 0x01) proto_item_append_text(ti, ", Type: Router");
+ else if (type == 0x02) proto_item_append_text(ti, ", Type: End Device");
+ else proto_item_append_text(ti, ", Type: Unknown");
+
+ if (idle_rx == 0x00) proto_item_append_text(ti, ", Idle Rx: False");
+ else if (idle_rx==0x01) proto_item_append_text(ti, ", Idle Rx: True");
+ else proto_item_append_text(ti, ", Idle Rx: Unknown");
+
+ if (rel == 0x00) proto_item_append_text(ti, ", Relationship: Parent");
+ else if (rel == 0x01) proto_item_append_text(ti, ", Relationship: Child");
+ else if (rel == 0x02) proto_item_append_text(ti, ", Relationship: Sibling");
+ else if (rel == 0x03) proto_item_append_text(ti, ", Relationship: None");
+ else if (rel == 0x04) proto_item_append_text(ti, ", Relationship: Previous Child");
+ else proto_item_append_text(ti, ", Relationship: Unknown");
+ }
+*/
+
/*FUNCTION:------------------------------------------------------
* NAME
* zdp_status_name
@@ -556,7 +628,7 @@ zdp_parse_status(proto_tree *tree, tvbuff_t *tvb, guint *offset)
*---------------------------------------------------------------
*/
guint32
-zdp_parse_chanmask(proto_tree *tree, tvbuff_t *tvb, guint *offset)
+zdp_parse_chanmask(proto_tree *tree, tvbuff_t *tvb, guint *offset, int hf_channel)
{
int i;
guint32 mask;
@@ -565,7 +637,7 @@ zdp_parse_chanmask(proto_tree *tree, tvbuff_t *tvb, guint *offset)
/* Get and display the channel mask. */
mask = tvb_get_letohl(tvb, *offset);
if (tree) {
- ti = proto_tree_add_text(tree, tvb, *offset, (int)sizeof(guint32), "Channels: ");
+ ti = proto_tree_add_uint_format(tree, hf_channel, tvb, *offset, 4, mask, "Channels: ");
/* Check if there are any channels to display. */
if (mask==0) {
@@ -1155,7 +1227,7 @@ dissect_zbee_zdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
dissect_zbee_zdp_req_recover_source_bind(zdp_tvb, pinfo, zdp_tree);
break;
case ZBEE_ZDP_REQ_MGMT_NWK_DISC:
- dissect_zbee_zdp_req_mgmt_nwk_disc(zdp_tvb, pinfo, zdp_tree);
+ dissect_zbee_zdp_req_mgmt_nwk_disc(zdp_tvb, pinfo, zdp_tree, hf_zbee_zdp_scan_channel);
break;
case ZBEE_ZDP_REQ_MGMT_LQI:
dissect_zbee_zdp_req_mgmt_lqi(zdp_tvb, pinfo, zdp_tree);
@@ -1385,6 +1457,10 @@ void proto_register_zbee_zdp(void)
{ "Table Count", "zbee_zdp.table_count", FT_UINT16, BASE_DEC, NULL, 0x0,
"Number of table entries included in this message.", HFILL }},
+ { &hf_zbee_zdp_cache_address,
+ { "Cache Address", "zbee_zdp.cache_address", FT_EUI64, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }},
+
{ &hf_zbee_zdp_in_count,
{ "Input Cluster Count", "zbee_zdp.in_count", FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
@@ -1665,6 +1741,90 @@ void proto_register_zbee_zdp(void)
{ "Channel List Count", "zbee_zdp.channel_count", FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
+ { &hf_zbee_zdp_channel_mask,
+ { "Channels", "zbee_zdp.channel_mask", FT_UINT32, BASE_HEX, NULL, 0x0,
+ NULL, HFILL }},
+
+ { &hf_zbee_zdp_channel_energy,
+ { "Channel Energy", "zbee_zdp.channel_energy", FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }},
+
+ { &hf_zbee_zdp_pan_eui64,
+ { "Pan", "zbee_zdp.pan.eui64", FT_EUI64, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }},
+
+ { &hf_zbee_zdp_pan_uint,
+ { "Pan", "zbee_zdp.pan.uint", FT_UINT16, BASE_HEX, NULL, 0x0,
+ NULL, HFILL }},
+
+ { &hf_zbee_zdp_channel,
+ { "Channel", "zbee_zdp.channel", FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }},
+
+ { &hf_zbee_zdp_nwk_desc_profile,
+ { "Profile", "zbee_zdp.profile", FT_UINT8, BASE_HEX, NULL, 0x0F,
+ NULL, HFILL }},
+
+ { &hf_zbee_zdp_profile_version,
+ { "Version", "zbee_zdp.profile_version", FT_UINT8, BASE_DEC, NULL, 0xF0,
+ NULL, HFILL }},
+
+ { &hf_zbee_zdp_beacon,
+ { "Beacon Order", "zbee_zdp.beacon", FT_UINT8, BASE_DEC, NULL, 0x0F,
+ NULL, HFILL }},
+
+ { &hf_zbee_zdp_superframe,
+ { "Superframe Order", "zbee_zdp.superframe", FT_UINT8, BASE_DEC, NULL, 0xF0,
+ NULL, HFILL }},
+
+ { &hf_zbee_zdp_permit_joining,
+ { "Permit Joining", "zbee_zdp.permit_joining", FT_UINT8, BASE_DEC, VALS(zbee_zdp_true_false_plus_vals), 0x01,
+ NULL, HFILL }},
+
+ { &hf_zbee_zdp_permit_joining_03,
+ { "Permit Joining", "zbee_zdp.permit_joining", FT_UINT8, BASE_DEC, VALS(zbee_zdp_true_false_plus_vals), 0x03,
+ NULL, HFILL }},
+
+ { &hf_zbee_zdp_extended_pan,
+ { "Extended Pan", "zbee_zdp.extended_pan", FT_EUI64, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }},
+
+ { &hf_zbee_zdp_addr,
+ { "Addr", "zbee_zdp.addr", FT_UINT16, BASE_HEX, NULL, 0x0,
+ NULL, HFILL }},
+
+ { &hf_zbee_zdp_depth,
+ { "Depth", "zbee_zdp.depth", FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }},
+
+ { &hf_zbee_zdp_lqi,
+ { "LQI", "zbee_zdp.lqi", FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }},
+
+ { &hf_zbee_zdp_scan_channel,
+ { "Scan Channels", "zbee_zdp.scan_channel", FT_UINT32, BASE_HEX, NULL, 0x0,
+ NULL, HFILL }},
+
+ { &hf_zbee_zdp_table_entry_type,
+ { "Type", "zbee_zdp.table_entry_type", FT_UINT8, BASE_DEC, VALS(zbee_zdp_table_entry_type_vals), 0x03,
+ NULL, HFILL }},
+
+ { &hf_zbee_zdp_table_entry_idle_rx_0c,
+ { "Idle Rx", "zbee_zdp.idle_rx", FT_UINT8, BASE_DEC, VALS(zbee_zdp_true_false_plus_vals), 0x0c,
+ NULL, HFILL }},
+
+ { &hf_zbee_zdp_table_entry_idle_rx_04,
+ { "Idle Rx", "zbee_zdp.idle_rx", FT_UINT8, BASE_DEC, VALS(zbee_zdp_true_false_plus_vals), 0x04,
+ NULL, HFILL }},
+
+ { &hf_zbee_zdp_table_entry_relationship_18,
+ { "Relationship", "zbee_zdp.relationship", FT_UINT8, BASE_DEC, VALS(zbee_zdp_relationship_vals), 0x18,
+ NULL, HFILL }},
+
+ { &hf_zbee_zdp_table_entry_relationship_70,
+ { "Relationship", "zbee_zdp.relationship", FT_UINT8, BASE_DEC, VALS(zbee_zdp_relationship_vals), 0x70,
+ NULL, HFILL }},
+
{ &hf_zbee_zdp_rtg,
{ "Routing Table", "zbee_zdp.routing", FT_NONE, BASE_NONE, NULL, 0x0,
NULL, HFILL }},
@@ -1698,6 +1858,7 @@ void proto_register_zbee_zdp(void)
&ett_zbee_zdp_server,
&ett_zbee_zdp_simple_sizes,
&ett_zbee_zdp_bind,
+ &ett_zbee_zdp_bind_entry,
&ett_zbee_zdp_bind_end_in,
&ett_zbee_zdp_bind_end_out,
&ett_zbee_zdp_bind_table,
@@ -1707,6 +1868,8 @@ void proto_register_zbee_zdp(void)
&ett_zbee_zdp_lqi,
&ett_zbee_zdp_rtg,
&ett_zbee_zdp_cache,
+ &ett_zbee_zdp_nwk_desc,
+ &ett_zbee_zdp_table_entry,
&ett_zbee_zdp_descriptor_capability_field,
};
diff --git a/epan/dissectors/packet-zbee-zdp.h b/epan/dissectors/packet-zbee-zdp.h
index 35bf77a806..8ef980927e 100644
--- a/epan/dissectors/packet-zbee-zdp.h
+++ b/epan/dissectors/packet-zbee-zdp.h
@@ -208,6 +208,7 @@ extern int hf_zbee_zdp_table_size;
extern int hf_zbee_zdp_table_count;
extern int hf_zbee_zdp_assoc_device_count;
extern int hf_zbee_zdp_assoc_device;
+extern int hf_zbee_zdp_cache_address;
/* Discovery indicies. */
extern int hf_zbee_zdp_cache;
@@ -245,6 +246,27 @@ extern int hf_zbee_zdp_manager;
extern int hf_zbee_zdp_tx_total;
extern int hf_zbee_zdp_tx_fail;
extern int hf_zbee_zdp_channel_count;
+extern int hf_zbee_zdp_channel_mask;
+extern int hf_zbee_zdp_channel_energy;
+extern int hf_zbee_zdp_pan_eui64;
+extern int hf_zbee_zdp_pan_uint;
+extern int hf_zbee_zdp_channel;
+extern int hf_zbee_zdp_nwk_desc_profile;
+extern int hf_zbee_zdp_profile_version;
+extern int hf_zbee_zdp_beacon;
+extern int hf_zbee_zdp_superframe;
+extern int hf_zbee_zdp_permit_joining;
+extern int hf_zbee_zdp_extended_pan;
+extern int hf_zbee_zdp_addr;
+extern int hf_zbee_zdp_table_entry_type;
+extern int hf_zbee_zdp_table_entry_idle_rx_0c;
+extern int hf_zbee_zdp_table_entry_relationship_70;
+extern int hf_zbee_zdp_table_entry_idle_rx_04;
+extern int hf_zbee_zdp_table_entry_relationship_18;
+extern int hf_zbee_zdp_depth;
+extern int hf_zbee_zdp_permit_joining_03;
+extern int hf_zbee_zdp_lqi;
+
/* Routing Table */
extern int hf_zbee_zdp_rtg;
@@ -265,6 +287,7 @@ extern gint ett_zbee_zdp_cinfo;
extern gint ett_zbee_zdp_server;
extern gint ett_zbee_zdp_simple_sizes;
extern gint ett_zbee_zdp_bind;
+extern gint ett_zbee_zdp_bind_entry;
extern gint ett_zbee_zdp_bind_end_in;
extern gint ett_zbee_zdp_bind_end_out;
extern gint ett_zbee_zdp_bind_source;
@@ -273,6 +296,8 @@ extern gint ett_zbee_zdp_nwk;
extern gint ett_zbee_zdp_lqi;
extern gint ett_zbee_zdp_rtg;
extern gint ett_zbee_zdp_cache;
+extern gint ett_zbee_zdp_nwk_desc;
+extern gint ett_zbee_zdp_table_entry;
/**************************************
* Helper Functions
@@ -290,7 +315,7 @@ extern void zdp_parse_simple_desc (proto_tree *tree, gint ettindex, tvbuff
extern void zdp_parse_complex_desc (proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *offset, guint length);
extern guint8 zdp_parse_status (proto_tree *tree, tvbuff_t *tvb, guint *offset);
-extern guint32 zdp_parse_chanmask (proto_tree *tree, tvbuff_t *tvb, guint *offset);
+extern guint32 zdp_parse_chanmask (proto_tree *tree, tvbuff_t *tvb, guint *offset, int hf_channel);
extern guint8 zdp_parse_cinfo (proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *offset);
extern guint16 zdp_parse_server_flags (proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *offset);
@@ -330,7 +355,7 @@ extern void dissect_zbee_zdp_req_recover_bind_table (tvbuff_t *tvb, packet_info
extern void dissect_zbee_zdp_req_backup_source_bind (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
extern void dissect_zbee_zdp_req_recover_source_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-extern void dissect_zbee_zdp_req_mgmt_nwk_disc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+extern void dissect_zbee_zdp_req_mgmt_nwk_disc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int hf_channel);
extern void dissect_zbee_zdp_req_mgmt_lqi (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
extern void dissect_zbee_zdp_req_mgmt_rtg (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
extern void dissect_zbee_zdp_req_mgmt_bind (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);