aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-zbee-aps.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/dissectors/packet-zbee-aps.c')
-rw-r--r--epan/dissectors/packet-zbee-aps.c186
1 files changed, 104 insertions, 82 deletions
diff --git a/epan/dissectors/packet-zbee-aps.c b/epan/dissectors/packet-zbee-aps.c
index f3594879d9..c6f0fbf45f 100644
--- a/epan/dissectors/packet-zbee-aps.c
+++ b/epan/dissectors/packet-zbee-aps.c
@@ -25,6 +25,7 @@
#include "packet-zbee-security.h"
#include "packet-zbee-aps.h"
#include "packet-zbee-zdp.h"
+#include "packet-zbee-tlv.h"
/*************************
* Function Declarations *
@@ -51,6 +52,7 @@ static guint dissect_zbee_t2 (tvbuff_t *tvb, proto_tree *tree,
/* Helper routine. */
static guint zbee_apf_transaction_len (tvbuff_t *tvb, guint offset, guint8 type);
+void dissect_zbee_aps_status_code(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset);
void proto_register_zbee_aps(void);
/********************
@@ -58,96 +60,96 @@ void proto_register_zbee_aps(void);
********************
*/
/* Field indices. */
-static int proto_zbee_aps = -1;
-static int hf_zbee_aps_fcf_frame_type = -1;
-static int hf_zbee_aps_fcf_delivery = -1;
-static int hf_zbee_aps_fcf_indirect_mode = -1; /* ZigBee 2004 and earlier. */
-static int hf_zbee_aps_fcf_ack_format = -1; /* ZigBee 2007 and later. */
-static int hf_zbee_aps_fcf_security = -1;
-static int hf_zbee_aps_fcf_ack_req = -1;
-static int hf_zbee_aps_fcf_ext_header = -1;
-static int hf_zbee_aps_dst = -1;
-static int hf_zbee_aps_group = -1;
-static int hf_zbee_aps_cluster = -1;
-static int hf_zbee_aps_profile = -1;
-static int hf_zbee_aps_src = -1;
-static int hf_zbee_aps_counter = -1;
-static int hf_zbee_aps_fragmentation = -1;
-static int hf_zbee_aps_block_number = -1;
-static int hf_zbee_aps_block_ack = -1;
-static int hf_zbee_aps_block_ack1 = -1;
-static int hf_zbee_aps_block_ack2 = -1;
-static int hf_zbee_aps_block_ack3 = -1;
-static int hf_zbee_aps_block_ack4 = -1;
-static int hf_zbee_aps_block_ack5 = -1;
-static int hf_zbee_aps_block_ack6 = -1;
-static int hf_zbee_aps_block_ack7 = -1;
-static int hf_zbee_aps_block_ack8 = -1;
-
-static int hf_zbee_aps_cmd_id = -1;
-static int hf_zbee_aps_cmd_initiator = -1;
-static int hf_zbee_aps_cmd_responder = -1;
-static int hf_zbee_aps_cmd_partner = -1;
-static int hf_zbee_aps_cmd_initiator_flag = -1;
-static int hf_zbee_aps_cmd_device = -1;
-static int hf_zbee_aps_cmd_challenge = -1;
-static int hf_zbee_aps_cmd_mac = -1;
-static int hf_zbee_aps_cmd_key = -1;
-static int hf_zbee_aps_cmd_key_hash = -1;
-static int hf_zbee_aps_cmd_key_type = -1;
-static int hf_zbee_aps_cmd_dst = -1;
-static int hf_zbee_aps_cmd_src = -1;
-static int hf_zbee_aps_cmd_seqno = -1;
-static int hf_zbee_aps_cmd_short_addr = -1;
-static int hf_zbee_aps_cmd_device_status = -1;
-static int hf_zbee_aps_cmd_status = -1;
-static int hf_zbee_aps_cmd_ea_key_type = -1;
-static int hf_zbee_aps_cmd_ea_data = -1;
+static int proto_zbee_aps;
+static int hf_zbee_aps_fcf_frame_type;
+static int hf_zbee_aps_fcf_delivery;
+static int hf_zbee_aps_fcf_indirect_mode; /* ZigBee 2004 and earlier. */
+static int hf_zbee_aps_fcf_ack_format; /* ZigBee 2007 and later. */
+static int hf_zbee_aps_fcf_security;
+static int hf_zbee_aps_fcf_ack_req;
+static int hf_zbee_aps_fcf_ext_header;
+static int hf_zbee_aps_dst;
+static int hf_zbee_aps_group;
+static int hf_zbee_aps_cluster;
+static int hf_zbee_aps_profile;
+static int hf_zbee_aps_src;
+static int hf_zbee_aps_counter;
+static int hf_zbee_aps_fragmentation;
+static int hf_zbee_aps_block_number;
+static int hf_zbee_aps_block_ack;
+static int hf_zbee_aps_block_ack1;
+static int hf_zbee_aps_block_ack2;
+static int hf_zbee_aps_block_ack3;
+static int hf_zbee_aps_block_ack4;
+static int hf_zbee_aps_block_ack5;
+static int hf_zbee_aps_block_ack6;
+static int hf_zbee_aps_block_ack7;
+static int hf_zbee_aps_block_ack8;
+
+static int hf_zbee_aps_cmd_id;
+static int hf_zbee_aps_cmd_initiator;
+static int hf_zbee_aps_cmd_responder;
+static int hf_zbee_aps_cmd_partner;
+static int hf_zbee_aps_cmd_initiator_flag;
+static int hf_zbee_aps_cmd_device;
+static int hf_zbee_aps_cmd_challenge;
+static int hf_zbee_aps_cmd_mac;
+static int hf_zbee_aps_cmd_key;
+static int hf_zbee_aps_cmd_key_hash;
+static int hf_zbee_aps_cmd_key_type;
+static int hf_zbee_aps_cmd_dst;
+static int hf_zbee_aps_cmd_src;
+static int hf_zbee_aps_cmd_seqno;
+static int hf_zbee_aps_cmd_short_addr;
+static int hf_zbee_aps_cmd_device_status;
+static int hf_zbee_aps_cmd_status;
+static int hf_zbee_aps_cmd_ea_key_type;
+static int hf_zbee_aps_cmd_ea_data;
/* Field indices for ZigBee 2003 & earlier Application Framework. */
-static int proto_zbee_apf = -1;
-static int hf_zbee_apf_count = -1;
-static int hf_zbee_apf_type = -1;
+static int proto_zbee_apf;
+static int hf_zbee_apf_count;
+static int hf_zbee_apf_type;
/* Subtree indices. */
-static gint ett_zbee_aps = -1;
-static gint ett_zbee_aps_fcf = -1;
-static gint ett_zbee_aps_ext = -1;
-static gint ett_zbee_aps_cmd = -1;
+static gint ett_zbee_aps;
+static gint ett_zbee_aps_fcf;
+static gint ett_zbee_aps_ext;
+static gint ett_zbee_aps_cmd;
/* Fragmentation indices. */
-static int hf_zbee_aps_fragments = -1;
-static int hf_zbee_aps_fragment = -1;
-static int hf_zbee_aps_fragment_overlap = -1;
-static int hf_zbee_aps_fragment_overlap_conflicts = -1;
-static int hf_zbee_aps_fragment_multiple_tails = -1;
-static int hf_zbee_aps_fragment_too_long_fragment = -1;
-static int hf_zbee_aps_fragment_error = -1;
-static int hf_zbee_aps_fragment_count = -1;
-static int hf_zbee_aps_reassembled_in = -1;
-static int hf_zbee_aps_reassembled_length = -1;
-static gint ett_zbee_aps_fragment = -1;
-static gint ett_zbee_aps_fragments = -1;
+static int hf_zbee_aps_fragments;
+static int hf_zbee_aps_fragment;
+static int hf_zbee_aps_fragment_overlap;
+static int hf_zbee_aps_fragment_overlap_conflicts;
+static int hf_zbee_aps_fragment_multiple_tails;
+static int hf_zbee_aps_fragment_too_long_fragment;
+static int hf_zbee_aps_fragment_error;
+static int hf_zbee_aps_fragment_count;
+static int hf_zbee_aps_reassembled_in;
+static int hf_zbee_aps_reassembled_length;
+static gint ett_zbee_aps_fragment;
+static gint ett_zbee_aps_fragments;
/* Test Profile #2 indices. */
-static int hf_zbee_aps_t2_cluster = -1;
-static int hf_zbee_aps_t2_btres_octet_sequence = -1;
-static int hf_zbee_aps_t2_btres_octet_sequence_length_requested = -1;
-static int hf_zbee_aps_t2_btres_status = -1;
-static int hf_zbee_aps_t2_btreq_octet_sequence_length = -1;
+static int hf_zbee_aps_t2_cluster;
+static int hf_zbee_aps_t2_btres_octet_sequence;
+static int hf_zbee_aps_t2_btres_octet_sequence_length_requested;
+static int hf_zbee_aps_t2_btres_status;
+static int hf_zbee_aps_t2_btreq_octet_sequence_length;
/* ZDP indices. */
-static int hf_zbee_aps_zdp_cluster = -1;
+static int hf_zbee_aps_zdp_cluster;
/* Subtree indices for the ZigBee 2004 & earlier Application Framework. */
-static gint ett_zbee_apf = -1;
-static gint ett_zbee_aps_frag_ack = -1;
+static gint ett_zbee_apf;
+static gint ett_zbee_aps_frag_ack;
/* Subtree indices for the ZigBee Test Profile #2. */
-static gint ett_zbee_aps_t2 = -1;
+static gint ett_zbee_aps_t2;
-static expert_field ei_zbee_aps_invalid_delivery_mode = EI_INIT;
-static expert_field ei_zbee_aps_missing_payload = EI_INIT;
+static expert_field ei_zbee_aps_invalid_delivery_mode;
+static expert_field ei_zbee_aps_missing_payload;
/* Dissector Handles. */
static dissector_handle_t zbee_aps_handle;
@@ -231,6 +233,8 @@ static const value_string zbee_aps_cmd_names[] = {
{ ZBEE_APS_CMD_TUNNEL, "Tunnel" },
{ ZBEE_APS_CMD_VERIFY_KEY, "Verify Key" },
{ ZBEE_APS_CMD_CONFIRM_KEY, "Confirm Key" },
+ { ZBEE_APS_CMD_RELAY_MSG_DOWNSTREAM, "Relay Message Downstream" },
+ { ZBEE_APS_CMD_RELAY_MSG_UPSTREAM, "Relay Message Upstream" },
{ 0, NULL }
};
@@ -569,6 +573,7 @@ const range_string zbee_aps_cid_names[] = {
/* Closures */
{ ZBEE_ZCL_CID_SHADE_CONFIG, ZBEE_ZCL_CID_SHADE_CONFIG, "Shade Configuration"},
{ ZBEE_ZCL_CID_DOOR_LOCK, ZBEE_ZCL_CID_DOOR_LOCK, "Door Lock"},
+ { ZBEE_ZCL_CID_WINDOW_COVERING, ZBEE_ZCL_CID_WINDOW_COVERING, "Window Covering"},
/* HVAC */
{ ZBEE_ZCL_CID_PUMP_CONFIG_CONTROL, ZBEE_ZCL_CID_PUMP_CONFIG_CONTROL, "Pump Configuration Control"},
@@ -944,8 +949,9 @@ dissect_zbee_aps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
switch (tvb_get_letohs(tvb, offset + 2)) {
case ZBEE_DEVICE_PROFILE:
proto_tree_add_uint_format(aps_tree, hf_zbee_aps_zdp_cluster, tvb, offset, 2, nwk->cluster_id,
- "%s (Cluster ID: 0x%04x)", val_to_str(nwk->cluster_id, zbee_zdp_cluster_names,
- "Unknown Device Profile Cluster"), nwk->cluster_id);
+ "%s (Cluster ID: 0x%04x)",
+ val_to_str_const(nwk->cluster_id, zbee_zdp_cluster_names, "Unknown Device Profile Cluster"),
+ nwk->cluster_id);
break;
case ZBEE_PROFILE_T2:
proto_tree_add_item(aps_tree, hf_zbee_aps_t2_cluster, tvb, offset, 2, ENC_LITTLE_ENDIAN);
@@ -1265,10 +1271,17 @@ static void dissect_zbee_aps_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
offset = dissect_zbee_aps_confirm_key(tvb, pinfo, cmd_tree, offset);
break;
+ case ZBEE_APS_CMD_RELAY_MSG_DOWNSTREAM:
+ case ZBEE_APS_CMD_RELAY_MSG_UPSTREAM:
+ break;
+
default:
break;
} /* switch */
+ /* Dissect any TLVs */
+ offset = dissect_zbee_tlvs(tvb, pinfo, tree, offset, data, ZBEE_TLV_SRC_TYPE_ZBEE_APS, cmd_id);
+
/* Check for any excess bytes. */
if (offset < tvb_captured_length(tvb)) {
/* There are leftover bytes! */
@@ -1711,6 +1724,7 @@ dissect_zbee_aps_tunnel(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui
return offset;
} /* dissect_zbee_aps_tunnel */
+
/**
*ZigBee Application Framework dissector for Wireshark. Note
*
@@ -1920,6 +1934,14 @@ static const enum_val_t zbee_zcl_protocol_version_enums[] = {
gint gPREF_zbee_se_protocol_version = ZBEE_SE_VERSION_1_4;
+void
+dissect_zbee_aps_status_code(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset)
+{
+ guint status = tvb_get_guint8(tvb, offset);
+ proto_tree_add_item(tree, hf_zbee_aps_cmd_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", val_to_str_const(status, zbee_aps_status_names, "Unknown Status"));
+}
+
/**
*ZigBee APS protocol registration routine.
*
@@ -1940,7 +1962,7 @@ void proto_register_zbee_aps(void)
NULL, HFILL }},
{ &hf_zbee_aps_fcf_ack_format,
- { "Acknowledgement Format", "zbee_aps.ack_format", FT_BOOLEAN, 8, NULL, ZBEE_APS_FCF_ACK_FORMAT,
+ { "Acknowledgement Format", "zbee_aps.ack_format", FT_BOOLEAN, 8, NULL, ZBEE_APS_FCF_ACK_FORMAT,
NULL, HFILL }},
{ &hf_zbee_aps_fcf_security,
@@ -2060,7 +2082,7 @@ void proto_register_zbee_aps(void)
NULL, HFILL }},
{ &hf_zbee_aps_cmd_key_hash,
- { "Key Hash", "zbee_aps.cmd.key_hash", FT_BYTES, BASE_NONE, NULL, 0x0,
+ { "Key Hash", "zbee_aps.cmd.key_hash", FT_BYTES, BASE_NONE, NULL, 0x0,
NULL, HFILL }},
{ &hf_zbee_aps_cmd_key_type,
@@ -2068,11 +2090,11 @@ void proto_register_zbee_aps(void)
VALS(zbee_aps_key_names), 0x0, NULL, HFILL }},
{ &hf_zbee_aps_cmd_dst,
- { "Extended Destination", "zbee_aps.cmd.dst", FT_EUI64, BASE_NONE, NULL, 0x0,
+ { "Extended Destination", "zbee_aps.cmd.dst", FT_EUI64, BASE_NONE, NULL, 0x0,
NULL, HFILL }},
{ &hf_zbee_aps_cmd_src,
- { "Extended Source", "zbee_aps.cmd.src", FT_EUI64, BASE_NONE, NULL, 0x0,
+ { "Extended Source", "zbee_aps.cmd.src", FT_EUI64, BASE_NONE, NULL, 0x0,
NULL, HFILL }},
{ &hf_zbee_aps_cmd_seqno,
@@ -2089,7 +2111,7 @@ void proto_register_zbee_aps(void)
"Update device status.", HFILL }},
{ &hf_zbee_aps_cmd_status,
- { "Status", "zbee_aps.cmd.status", FT_UINT8, BASE_HEX,
+ { "Status", "zbee_aps.cmd.status", FT_UINT8, BASE_HEX,
VALS(zbee_aps_status_names), 0x0,
"APS status.", HFILL }},