diff options
author | Michael Mann <mmann78@netscape.net> | 2014-01-12 03:17:51 +0000 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2014-01-12 03:17:51 +0000 |
commit | bdfabe5979358cc5b982421f760f54640e8e1cf8 (patch) | |
tree | f883f387f5acd8c96a6194858372819d815d55c3 /epan/dissectors | |
parent | 11a61d757d25c8e47b95c9dd2c1309df78ded7ed (diff) |
Zcl OTA Upgrade cluster dissector. Bug 9545 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9545)
From Fabio Tarabelloni
From me: Reorder function definitions so declarations aren't necessary
svn path=/trunk/; revision=54701
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/packet-zbee-zcl-general.c | 1216 | ||||
-rw-r--r-- | epan/dissectors/packet-zbee-zcl.c | 496 | ||||
-rw-r--r-- | epan/dissectors/packet-zbee-zcl.h | 29 | ||||
-rw-r--r-- | epan/dissectors/packet-zbee.h | 1 |
4 files changed, 1238 insertions, 504 deletions
diff --git a/epan/dissectors/packet-zbee-zcl-general.c b/epan/dissectors/packet-zbee-zcl-general.c index f1bde026a9..e0bba9e6f4 100644 --- a/epan/dissectors/packet-zbee-zcl-general.c +++ b/epan/dissectors/packet-zbee-zcl-general.c @@ -31,6 +31,7 @@ #include <string.h> #include <glib.h> #include <epan/packet.h> +#include <epan/to_str.h> #include "packet-zbee.h" #include "packet-zbee-aps.h" @@ -1685,7 +1686,7 @@ void proto_register_zbee_zcl_part(void) /* Register the ZigBee ZCL Partition dissector. */ new_register_dissector(ZBEE_PROTOABBREV_ZCL_PART, dissect_zbee_zcl_part, proto_zbee_zcl_part); -} /* proto_register_zbee_zcl_pwr_prof */ +} /* proto_register_zbee_zcl_part */ /*FUNCTION:------------------------------------------------------ @@ -1717,6 +1718,1219 @@ void proto_reg_handoff_zbee_zcl_part(void) } /*proto_reg_handoff_zbee_zcl_part*/ +/* ########################################################################## */ +/* #### (0x0019) OTA UPGRADE CLUSTER ######################################## */ +/* ########################################################################## */ + +/*************************/ +/* Defines */ +/*************************/ + +#define ZBEE_ZCL_OTA_NUM_GENERIC_ETT 3 +#define ZBEE_ZCL_OTA_NUM_ETT (ZBEE_ZCL_OTA_NUM_GENERIC_ETT) + +/* Attributes */ +#define ZBEE_ZCL_ATTR_ID_OTA_UPGRADE_SERVER_ID 0x0000 /* Upgrade Served ID */ +#define ZBEE_ZCL_ATTR_ID_OTA_FILE_OFFSET 0x0001 /* File Offset */ +#define ZBEE_ZCL_ATTR_ID_OTA_CURRENT_FILE_VERSION 0x0002 /* Current File Version */ +#define ZBEE_ZCL_ATTR_ID_OTA_CURRENT_ZB_STACK_VERSION 0x0003 /* Current ZigBee Stack Version */ +#define ZBEE_ZCL_ATTR_ID_OTA_DOWNLOADED_FILE_VERSION 0x0004 /* Downloaded File Version */ +#define ZBEE_ZCL_ATTR_ID_OTA_DOWNLOADED_ZB_STACK_VERSION 0x0005 /* Downloaded ZigBee Stack Version */ +#define ZBEE_ZCL_ATTR_ID_OTA_IMAGE_UPGRADE_STATUS 0x0006 /* Image Upgrade Status */ +#define ZBEE_ZCL_ATTR_ID_OTA_MANUFACTURER_ID 0x0007 /* Manufacturer ID */ +#define ZBEE_ZCL_ATTR_ID_OTA_IMAGE_TYPE_ID 0x0008 /* Image Type ID */ +#define ZBEE_ZCL_ATTR_ID_OTA_MIN_BLOCK_REQ_DELAY 0x0009 /* Minimum Block Request Delay */ + +/* Server Commands Generated */ +#define ZBEE_ZCL_CMD_ID_OTA_IMAGE_NOTIFY 0x00 /* Image Notify */ +#define ZBEE_ZCL_CMD_ID_OTA_QUERY_NEXT_IMAGE_RSP 0x02 /* Query Next Image Response */ +#define ZBEE_ZCL_CMD_ID_OTA_IMAGE_BLOCK_RSP 0x05 /* Image Block Response */ +#define ZBEE_ZCL_CMD_ID_OTA_UPGRADE_END_RSP 0x07 /* Upgrade End Response */ +#define ZBEE_ZCL_CMD_ID_OTA_QUERY_SPEC_FILE_RSP 0x09 /* Query Specific File Response */ + +/* Server Commands Received */ +#define ZBEE_ZCL_CMD_ID_OTA_QUERY_NEXT_IMAGE_REQ 0x01 /* Query Next Image Request */ +#define ZBEE_ZCL_CMD_ID_OTA_IMAGE_BLOCK_REQ 0x03 /* Image Block Request */ +#define ZBEE_ZCL_CMD_ID_OTA_IMAGE_PAGE_REQ 0x04 /* Image Page Request */ +#define ZBEE_ZCL_CMD_ID_OTA_UPGRADE_END_REQ 0x06 /* Upgrade End Request */ +#define ZBEE_ZCL_CMD_ID_OTA_QUERY_SPEC_FILE_REQ 0x08 /* Query Specific File Request */ + +/* Payload Type */ +#define ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ 0x00 /* Query Jitter */ +#define ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC 0x01 /* Query Jitter and Manufacturer Code */ +#define ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC_IT 0x02 /* Query Jitter, Manufacturer Code and Image Type */ +#define ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC_IT_FV 0x03 /* Query Jitter, Manufacturer Code, Image Type and File Version */ + +/* Image Type */ +#define ZBEE_ZCL_OTA_IMG_TYPE_MFR_LOW 0x0000 /* Manufacturer Specific (Low value) */ +#define ZBEE_ZCL_OTA_IMG_TYPE_MFR_HIGH 0xffbf /* Manufacturer Specific (High value) */ +#define ZBEE_ZCL_OTA_IMG_TYPE_SECURITY 0xffc0 /* Security Credential */ +#define ZBEE_ZCL_OTA_IMG_TYPE_CONFIG 0xffc1 /* Configuration */ +#define ZBEE_ZCL_OTA_IMG_TYPE_LOG 0xffc2 /* Log */ +#define ZBEE_ZCL_OTA_IMG_TYPE_UNASSIGNED_LOW 0xffc3 /* Reserved: Unassigned (Low value) */ +#define ZBEE_ZCL_OTA_IMG_TYPE_UNASSIGNED_HIGH 0xfffe /* Reserved: Unassigned (High value) */ +#define ZBEE_ZCL_OTA_IMG_TYPE_WILD_CARD 0xffff /* Reserved: Wild Card */ + +/* ZigBee Stack Version */ +#define ZBEE_ZCL_OTA_ZB_STACK_VER_2006 0x0000 /* ZigBee 2006 */ +#define ZBEE_ZCL_OTA_ZB_STACK_VER_2007 0x0001 /* ZigBee 2007 */ +#define ZBEE_ZCL_OTA_ZB_STACK_VER_PRO 0x0002 /* ZigBee Pro */ +#define ZBEE_ZCL_OTA_ZB_STACK_VER_IP 0x0003 /* ZigBee IP */ +#define ZBEE_ZCL_OTA_ZB_STACK_VER_RESERVED_LO 0x0004 /* Reserved Low */ +#define ZBEE_ZCL_OTA_ZB_STACK_VER_RESERVED_HI 0xffff /* Reserved High */ + +/* Image Upgrade Status */ +#define ZBEE_ZCL_OTA_STATUS_NORMAL 0x00 /* Normal */ +#define ZBEE_ZCL_OTA_STATUS_DOWNLOAD_IN_PROGRESS 0x01 /* Download in progress */ +#define ZBEE_ZCL_OTA_STATUS_DOWNLOAD_COMPLETE 0x02 /* Download complete */ +#define ZBEE_ZCL_OTA_STATUS_WAITING_TO_UPGRADE 0x03 /* Waiting to upgrade */ +#define ZBEE_ZCL_OTA_STATUS_COUNT_DOWN 0x04 /* Count down */ +#define ZBEE_ZCL_OTA_STATUS_WAIT_FOR_MORE 0x05 /* Wait for more */ + /* 0x06-0xff - Reserved */ +/* File Version mask */ +#define ZBEE_ZCL_OTA_FILE_VERS_APPL_RELEASE 0x000000FF /* Application Release */ +#define ZBEE_ZCL_OTA_FILE_VERS_APPL_BUILD 0x0000FF00 /* Application Build */ +#define ZBEE_ZCL_OTA_FILE_VERS_STACK_RELEASE 0x00FF0000 /* Stack Release */ +#define ZBEE_ZCL_OTA_FILE_VERS_STACK_BUILD 0xFF000000 /* Stack Build */ + +/* Field Control bitmask field list */ +#define ZBEE_ZCL_OTA_FIELD_CTRL_HW_VER_PRESENT 0x01 /* bit 0 */ +#define ZBEE_ZCL_OTA_FIELD_CTRL_RESERVED 0xfe /* bit 1-7 */ +#define ZBEE_ZCL_OTA_FIELD_CTRL_IEEE_ADDR_PRESENT 0x01 /* bit 0 - Request nodes IEEE address Present */ + +/* OTA Time */ +#define ZBEE_ZCL_OTA_TIME_NOW 0x00000000 /* Now */ +#define ZBEE_ZCL_OTA_TIME_UTC_LO 0x00000001 /* UTC Low Boundary */ +#define ZBEE_ZCL_OTA_TIME_UTC_HI 0xfffffffe /* UTC High Boundary */ +#define ZBEE_ZCL_OTA_TIME_WAIT 0xffffffff /* Wait for a Upgrade command (not used for RequesTime) */ + +/*************************/ +/* Function Declarations */ +/*************************/ + +void proto_register_zbee_zcl_ota(void); +void proto_reg_handoff_zbee_zcl_ota(void); + +/*************************/ +/* Global Variables */ +/*************************/ +/* Initialize the protocol and registered fields */ +static int proto_zbee_zcl_ota = -1; + +static int hf_zbee_zcl_ota_attr_id = -1; +static int hf_zbee_zcl_ota_srv_tx_cmd_id = -1; +static int hf_zbee_zcl_ota_srv_rx_cmd_id = -1; +static int hf_zbee_zcl_ota_image_upgrade_status = -1; +static int hf_zbee_zcl_ota_zb_stack_ver = -1; +static int hf_zbee_zcl_ota_file_offset = -1; +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_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_hw_ver_present = -1; +static int hf_zbee_zcl_ota_field_ctrl_reserved = -1; +static int hf_zbee_zcl_ota_hw_version = -1; +static int hf_zbee_zcl_ota_status = -1; +static int hf_zbee_zcl_ota_image_size = -1; +static int hf_zbee_zcl_ota_max_data_size = -1; +static int hf_zbee_zcl_ota_req_node_addr = -1; +static int hf_zbee_zcl_ota_current_time = -1; +static int hf_zbee_zcl_ota_request_time = -1; +static int hf_zbee_zcl_ota_upgrade_time = -1; +static int hf_zbee_zcl_ota_data_size = -1; +static int hf_zbee_zcl_ota_image_data = -1; +static int hf_zbee_zcl_ota_page_size = -1; +static int hf_zbee_zcl_ota_rsp_spacing = -1; + +/* Initialize the subtree pointers */ +static gint ett_zbee_zcl_ota = -1; +static gint ett_zbee_zcl_ota_field_ctrl = -1; +static gint ett_zbee_zcl_ota_file_version = -1; + +/* Attributes */ +static const value_string zbee_zcl_ota_attr_names[] = { + { ZBEE_ZCL_ATTR_ID_OTA_UPGRADE_SERVER_ID, "Upgrade Served ID" }, + { ZBEE_ZCL_ATTR_ID_OTA_FILE_OFFSET, "File Offset" }, + { ZBEE_ZCL_ATTR_ID_OTA_CURRENT_FILE_VERSION, "Current File Version" }, + { ZBEE_ZCL_ATTR_ID_OTA_CURRENT_ZB_STACK_VERSION, "Current ZigBee Stack Version" }, + { ZBEE_ZCL_ATTR_ID_OTA_DOWNLOADED_FILE_VERSION, "Downloaded File Version" }, + { ZBEE_ZCL_ATTR_ID_OTA_DOWNLOADED_ZB_STACK_VERSION, "Downloaded ZigBee Stack Version" }, + { ZBEE_ZCL_ATTR_ID_OTA_IMAGE_UPGRADE_STATUS, "Image Upgrade Status" }, + { ZBEE_ZCL_ATTR_ID_OTA_MANUFACTURER_ID, "Manufacturer ID" }, + { ZBEE_ZCL_ATTR_ID_OTA_IMAGE_TYPE_ID, "Image Type ID" }, + { ZBEE_ZCL_ATTR_ID_OTA_MIN_BLOCK_REQ_DELAY, "Minimum Block Request Delay" }, + { 0, NULL } +}; + +/* Server Commands Received */ +static const value_string zbee_zcl_ota_srv_rx_cmd_names[] = { + { ZBEE_ZCL_CMD_ID_OTA_QUERY_NEXT_IMAGE_REQ, "Query Next Image Request" }, + { ZBEE_ZCL_CMD_ID_OTA_IMAGE_BLOCK_REQ, "Image Block Request" }, + { ZBEE_ZCL_CMD_ID_OTA_IMAGE_PAGE_REQ, "Image Page Request" }, + { ZBEE_ZCL_CMD_ID_OTA_UPGRADE_END_REQ, "Upgrade End Request" }, + { ZBEE_ZCL_CMD_ID_OTA_QUERY_SPEC_FILE_REQ, "Query Specific File Request" }, + { 0, NULL } +}; + +/* Server Commands Generated */ +static const value_string zbee_zcl_ota_srv_tx_cmd_names[] = { + { ZBEE_ZCL_CMD_ID_OTA_IMAGE_NOTIFY, "Image Notify" }, + { ZBEE_ZCL_CMD_ID_OTA_QUERY_NEXT_IMAGE_RSP, "Query Next Image Response" }, + { ZBEE_ZCL_CMD_ID_OTA_IMAGE_BLOCK_RSP, "Image Block Response" }, + { ZBEE_ZCL_CMD_ID_OTA_UPGRADE_END_RSP, "Upgrade End Response" }, + { ZBEE_ZCL_CMD_ID_OTA_QUERY_SPEC_FILE_RSP, "Query Specific File Response" }, + { 0, NULL } +}; + +/* Payload Type */ +static const value_string zbee_zcl_ota_paylaod_type_names[] = { + { ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ, "Query Jitter" }, + { ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC, "Query Jitter and Manufacturer Code" }, + { ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC_IT, "Query Jitter, Manufacturer Code and Image Type" }, + { ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC_IT_FV, "Query Jitter, Manufacturer Code, Image Type and File Version" }, + { 0, NULL } +}; + +/* Image Upgrade Status */ +static const value_string zbee_zcl_ota_image_upgrade_attr_status_names[] = { + { ZBEE_ZCL_OTA_STATUS_NORMAL, "Normal" }, + { ZBEE_ZCL_OTA_STATUS_DOWNLOAD_IN_PROGRESS, "Download in progress" }, + { ZBEE_ZCL_OTA_STATUS_DOWNLOAD_COMPLETE, "Download complete" }, + { ZBEE_ZCL_OTA_STATUS_WAITING_TO_UPGRADE, "Waiting to upgrade" }, + { ZBEE_ZCL_OTA_STATUS_COUNT_DOWN, "Count down" }, + { ZBEE_ZCL_OTA_STATUS_WAIT_FOR_MORE, "Wait for more" }, + { 0, NULL } +}; + +/* ZigBee Stack Version */ +static const range_string zbee_zcl_ota_zb_stack_ver_names[] = { + { ZBEE_ZCL_OTA_ZB_STACK_VER_2006, ZBEE_ZCL_OTA_ZB_STACK_VER_2006, "ZigBee 2006" }, + { ZBEE_ZCL_OTA_ZB_STACK_VER_2007, ZBEE_ZCL_OTA_ZB_STACK_VER_2007, "ZigBee 2007" }, + { ZBEE_ZCL_OTA_ZB_STACK_VER_PRO, ZBEE_ZCL_OTA_ZB_STACK_VER_PRO, "ZigBee Pro" }, + { ZBEE_ZCL_OTA_ZB_STACK_VER_IP, ZBEE_ZCL_OTA_ZB_STACK_VER_IP, "ZigBee IP" }, + { ZBEE_ZCL_OTA_ZB_STACK_VER_RESERVED_LO, ZBEE_ZCL_OTA_ZB_STACK_VER_RESERVED_HI, "Reserved" }, + { 0, 0, NULL }, +}; + +/* Image Type */ +static const range_string zbee_zcl_ota_image_type_names[] = { + {ZBEE_ZCL_OTA_IMG_TYPE_MFR_LOW, ZBEE_ZCL_OTA_IMG_TYPE_MFR_HIGH, "Manufacturer Specific" }, + {ZBEE_ZCL_OTA_IMG_TYPE_SECURITY, ZBEE_ZCL_OTA_IMG_TYPE_SECURITY, "Security Credential" }, + {ZBEE_ZCL_OTA_IMG_TYPE_CONFIG, ZBEE_ZCL_OTA_IMG_TYPE_CONFIG, "Configuration" }, + {ZBEE_ZCL_OTA_IMG_TYPE_LOG, ZBEE_ZCL_OTA_IMG_TYPE_LOG, "Log" }, + {ZBEE_ZCL_OTA_IMG_TYPE_UNASSIGNED_LOW, ZBEE_ZCL_OTA_IMG_TYPE_UNASSIGNED_HIGH, "Reserved: Unassigned" }, + {ZBEE_ZCL_OTA_IMG_TYPE_WILD_CARD, ZBEE_ZCL_OTA_IMG_TYPE_WILD_CARD, "Reserved: Wild Card" }, + { 0, 0, NULL } +}; + +/*************************/ +/* Function Bodies */ +/*************************/ + +/*FUNCTION:------------------------------------------------------ + * NAME + * decode_zcl_ota_curr_time + * DESCRIPTION + * this function decode the current time field + * PARAMETERS + * RETURNS + * none + *--------------------------------------------------------------- + */ +static void +decode_zcl_ota_curr_time(gchar *s, guint32 value) +{ + if (value == ZBEE_ZCL_OTA_TIME_NOW) + g_snprintf(s, ITEM_LABEL_LENGTH, "Now"); + else + g_snprintf(s, ITEM_LABEL_LENGTH, "%s", abs_time_secs_to_ep_str(value, ABSOLUTE_TIME_LOCAL, 1)); + + return; +} /*decode_zcl_ota_curr_time*/ + +/*FUNCTION:------------------------------------------------------ + * NAME + * decode_zcl_ota_req_time + * DESCRIPTION + * this function decode the request time field + * PARAMETERS + * RETURNS + * none + *--------------------------------------------------------------- + */ +static void +decode_zcl_ota_req_time(gchar *s, guint32 value) +{ + if (value == ZBEE_ZCL_OTA_TIME_WAIT) + g_snprintf(s, ITEM_LABEL_LENGTH, "Wrong Value"); + else + /* offset from now */ + g_snprintf(s, ITEM_LABEL_LENGTH, "%s from now", time_secs_to_ep_str(value)); + + return; +} /*decode_zcl_ota_req_time*/ + +/*FUNCTION:------------------------------------------------------ + * NAME + * decode_zcl_ota_upgr_time + * DESCRIPTION + * this function decode the upgrade time field + * PARAMETERS + * RETURNS + * none + *--------------------------------------------------------------- + */ +static void +decode_zcl_ota_upgr_time(gchar *s, guint32 value) +{ + if (value == ZBEE_ZCL_OTA_TIME_WAIT) + g_snprintf(s, ITEM_LABEL_LENGTH, "Wait for upgrade command"); + else + /* offset from now */ + g_snprintf(s, ITEM_LABEL_LENGTH, "%s from now", time_secs_to_ep_str(value)); + + return; +} /*decode_zcl_ota_upgr_time*/ + +/*FUNCTION:------------------------------------------------------ + * NAME + * decode_zcl_ota_size_in_bytes + * DESCRIPTION + * this function decodes size in bytes + * PARAMETERS + * RETURNS + * none + *--------------------------------------------------------------- + */ +static void +decode_zcl_ota_size_in_bytes(gchar *s, guint32 value) +{ + g_snprintf(s, ITEM_LABEL_LENGTH, "%d [Bytes]", value); +} /*decode_zcl_ota_size_in_bytes*/ + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_ota_file_version_field + * DESCRIPTION + * this function is called in order to decode "FileVersion" field, + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * proto_tree *tree - pointer to data tree Wireshark uses to display packet. + * guint *offset - pointer to buffer offset + * RETURNS + * none + *--------------------------------------------------------------- + */ +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; + + /* '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_NA); + proto_tree_add_item(sub_tree, hf_zbee_zcl_ota_file_version_appl_build, tvb, *offset, 4, ENC_NA); + proto_tree_add_item(sub_tree, hf_zbee_zcl_ota_file_version_stack_release, tvb, *offset, 4, ENC_NA); + proto_tree_add_item(sub_tree, hf_zbee_zcl_ota_file_version_stack_build, tvb, *offset, 4, ENC_NA); + *offset += 4; +} /*dissect_zcl_ota_file_version_field*/ + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_ota_field_ctrl_field + * DESCRIPTION + * this function is called in order to decode "FileVersion" field, + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * proto_tree *tree - pointer to data tree Wireshark uses to display packet. + * guint *offset - pointer to buffer offset + * RETURNS + * none + *--------------------------------------------------------------- + */ +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; + + /* 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); + *offset += 1; + + return field_ctrl; +} /*dissect_zcl_ota_field_ctrl_field*/ + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_ota_imagenotify + * DESCRIPTION + * this function is called in order to decode "ImageNotify", + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * proto_tree *tree - pointer to data tree Wireshark uses to display packet. + * guint *offset - pointer to buffer offset + * RETURNS + * none + *--------------------------------------------------------------- + */ +static void +dissect_zcl_ota_imagenotify(tvbuff_t *tvb, proto_tree *tree, guint *offset) +{ + guint8 payload_type; + + /* Retrieve 'Payload type' field */ + payload_type = tvb_get_guint8(tvb, *offset); + proto_tree_add_item(tree, hf_zbee_zcl_ota_payload_type, tvb, *offset, 1, ENC_NA); + *offset += 1; + + /* Retrieve 'Query Jitter' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_query_jitter, tvb, *offset, 1, ENC_NA); + *offset += 1; + + /* Check if there are optional fields */ + + if (payload_type >= ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC) { + /* 'Manufacturer Code' field present, retrieves it */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; + } + + if (payload_type >= ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC_IT) { + /* 'Image Type' field present, retrieves it */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; + } + + if (payload_type >= ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC_IT_FV) { + /* 'File Version' field present, retrieves it */ + dissect_zcl_ota_file_version_field(tvb, tree, offset); + } + +} /*dissect_zcl_ota_imagenotify*/ + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_ota_querynextimagereq + * DESCRIPTION + * this function is called in order to decode "QueryNextImageRequest", + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * proto_tree *tree - pointer to data tree Wireshark uses to display packet. + * guint *offset - pointer to buffer offset + * RETURNS + * none + *--------------------------------------------------------------- + */ +static void +dissect_zcl_ota_querynextimagereq(tvbuff_t *tvb, proto_tree *tree, guint *offset) +{ + guint8 field_ctrl; + + /* Retrieve 'Field Control' field */ + field_ctrl = dissect_zcl_ota_field_ctrl_field(tvb, tree, offset); + + /* Retrieve 'Manufacturer Code' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; + + /* Retrieve 'Image Type' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; + + /* Retrieve 'File Version' field */ + dissect_zcl_ota_file_version_field(tvb, tree, offset); + + /* Check if there are optional fields */ + + if (field_ctrl & ZBEE_ZCL_OTA_FIELD_CTRL_HW_VER_PRESENT) { + /* 'Hardware Version' field present, retrieves it */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_hw_version, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; + } + +} /*dissect_zcl_ota_querynextimagereq*/ + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_ota_querynextimagersp + * DESCRIPTION + * this function is called in order to decode "QueryNextImageResponse", + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * proto_tree *tree - pointer to data tree Wireshark uses to display packet. + * guint *offset - pointer to buffer offset + * RETURNS + * none + *--------------------------------------------------------------- + */ +static void +dissect_zcl_ota_querynextimagersp(tvbuff_t *tvb, proto_tree *tree, guint *offset) +{ + guint8 status; + + /* Retrieve 'Status' field */ + status = tvb_get_guint8(tvb, *offset); + proto_tree_add_item(tree, hf_zbee_zcl_ota_status, tvb, *offset, 1, ENC_NA); + *offset += 1; + + /* Check if there are optional fields */ + if (status == ZBEE_ZCL_STAT_SUCCESS) { + /* Retrieve 'Manufacturer Code' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; + + /* Retrieve 'Image Type' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; + + /* Retrieve 'File Version' field */ + dissect_zcl_ota_file_version_field(tvb, tree, offset); + + /* Retrieve 'Image Size' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_image_size, tvb, *offset, 4, ENC_LITTLE_ENDIAN); + *offset += 4; + } + +} /*dissect_zcl_ota_querynextimagersp*/ + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_ota_imageblockreq + * DESCRIPTION + * this function is called in order to decode "ImageBlockRequest", + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * proto_tree *tree - pointer to data tree Wireshark uses to display packet. + * guint *offset - pointer to buffer offset + * RETURNS + * none + *--------------------------------------------------------------- + */ +static void +dissect_zcl_ota_imageblockreq(tvbuff_t *tvb, proto_tree *tree, guint *offset) +{ + guint8 field_ctrl; + + /* Retrieve 'Field Control' field */ + field_ctrl = dissect_zcl_ota_field_ctrl_field(tvb, tree, offset); + + /* Retrieve 'Manufacturer Code' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; + + /* Retrieve 'Image Type' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; + + /* Retrieve 'File Version' field */ + dissect_zcl_ota_file_version_field(tvb, tree, offset); + + /* Retrieve 'File Offset' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_file_offset, tvb, *offset, 4, ENC_LITTLE_ENDIAN); + *offset += 4; + + /* Retrieve 'Maximum Data Size' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_max_data_size, tvb, *offset, 1, ENC_NA); + *offset += 1; + + /* Check if there are optional fields */ + + if (field_ctrl & ZBEE_ZCL_OTA_FIELD_CTRL_IEEE_ADDR_PRESENT) { + /* 'Requerst Node Address' field present, retrieves it */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_req_node_addr, tvb, *offset, 8, ENC_LITTLE_ENDIAN); + *offset += 8; + } + +} /*dissect_zcl_ota_imageblockreq*/ + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_ota_imagepagereq + * DESCRIPTION + * this function is called in order to decode "ImagePageRequest", + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * proto_tree *tree - pointer to data tree Wireshark uses to display packet. + * guint *offset - pointer to buffer offset + * RETURNS + * none + *--------------------------------------------------------------- + */ +static void +dissect_zcl_ota_imagepagereq(tvbuff_t *tvb, proto_tree *tree, guint *offset) +{ + guint8 field_ctrl; + + /* Retrieve 'Field Control' field */ + field_ctrl = dissect_zcl_ota_field_ctrl_field(tvb, tree, offset); + + /* Retrieve 'Manufacturer Code' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; + + /* Retrieve 'Image Type' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; + + /* Retrieve 'File Version' field */ + dissect_zcl_ota_file_version_field(tvb, tree, offset); + + /* Retrieve 'File Offset' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_file_offset, tvb, *offset, 4, ENC_LITTLE_ENDIAN); + *offset += 4; + + /* Retrieve 'Maximum Data Size' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_max_data_size, tvb, *offset, 1, ENC_NA); + *offset += 1; + + /* Retrieve 'Page Size' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_page_size, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; + + /* Retrieve 'Response Spacing' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_rsp_spacing, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; + + /* Check if there are optional fields */ + + if (field_ctrl & ZBEE_ZCL_OTA_FIELD_CTRL_IEEE_ADDR_PRESENT) { + /* 'Requerst Node Address' field present, retrieves it */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_req_node_addr, tvb, *offset, 8, ENC_LITTLE_ENDIAN); + *offset += 8; + } + +} /*dissect_zcl_ota_imagepagereq*/ + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_ota_imageblockrsp + * DESCRIPTION + * this function is called in order to decode "ImageBlockResponse", + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * proto_tree *tree - pointer to data tree Wireshark uses to display packet. + * guint *offset - pointer to buffer offset + * RETURNS + * none + *--------------------------------------------------------------- + */ +static void +dissect_zcl_ota_imageblockrsp(tvbuff_t *tvb, proto_tree *tree, guint *offset) +{ + guint8 status; + guint8 data_size; + guint8 *image_data; + + /* Retrieve 'Status' field */ + status = tvb_get_guint8(tvb, *offset); + proto_tree_add_item(tree, hf_zbee_zcl_ota_status, tvb, *offset, 1, ENC_NA); + *offset += 1; + + if (status == ZBEE_ZCL_STAT_SUCCESS) { + /* Retrieve 'Manufacturer Code' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; + + /* Retrieve 'Image Type' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; + + /* Retrieve 'File Version' field */ + dissect_zcl_ota_file_version_field(tvb, tree, offset); + + /* Retrieve 'File Offset' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_file_offset, tvb, *offset, 4, ENC_LITTLE_ENDIAN); + *offset += 4; + + /* Retrieve 'Data Size' field */ + data_size = tvb_get_guint8(tvb, *offset); + proto_tree_add_item(tree, hf_zbee_zcl_ota_data_size, tvb, *offset, 1, ENC_NA); + *offset += 1; + + /* Retrieve 'Image Data' field */ + image_data = tvb_bytes_to_ep_str_punct(tvb, *offset, data_size, ':'); + proto_tree_add_string(tree, hf_zbee_zcl_ota_image_data, tvb, *offset, data_size, image_data); + *offset += data_size; + } + else if (status == ZBEE_ZCL_STAT_OTA_WAIT_FOR_DATA) { + /* Retrieve 'Current Time' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_current_time, tvb, *offset, 4, ENC_LITTLE_ENDIAN); + *offset += 4; + + /* Retrieve 'Request Time' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_request_time, tvb, *offset, 4, ENC_LITTLE_ENDIAN); + *offset += 4; + } + else { + /* */ + } + +} /*dissect_zcl_ota_imageblockrsp*/ + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_ota_upgradeendreq + * DESCRIPTION + * this function is called in order to decode "UpgradeEndRequest", + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * proto_tree *tree - pointer to data tree Wireshark uses to display packet. + * guint *offset - pointer to buffer offset + * RETURNS + * none + *--------------------------------------------------------------- + */ +static void +dissect_zcl_ota_upgradeendreq(tvbuff_t *tvb, proto_tree *tree, guint *offset) +{ + /* Retrieve 'Status' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_status, tvb, *offset, 1, ENC_NA); + *offset += 1; + + /* Retrieve 'Manufacturer Code' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; + + /* Retrieve 'Image Type' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; + + /* Retrieve 'File Version' field */ + dissect_zcl_ota_file_version_field(tvb, tree, offset); + +} /*dissect_zcl_ota_upgradeendreq*/ + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_ota_upgradeendrsp + * DESCRIPTION + * this function is called in order to decode "UpgradeEndResponse", + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * proto_tree *tree - pointer to data tree Wireshark uses to display packet. + * guint *offset - pointer to buffer offset + * RETURNS + * none + *--------------------------------------------------------------- + */ +static void +dissect_zcl_ota_upgradeendrsp(tvbuff_t *tvb, proto_tree *tree, guint *offset) +{ + /* Retrieve 'Manufacturer Code' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; + + /* Retrieve 'Image Type' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; + + /* Retrieve 'File Version' field */ + dissect_zcl_ota_file_version_field(tvb, tree, offset); + + /* Retrieve 'Current Time' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_current_time, tvb, *offset, 4, ENC_LITTLE_ENDIAN); + *offset += 4; + + /* Retrieve 'Upgrade Time' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_upgrade_time, tvb, *offset, 4, ENC_LITTLE_ENDIAN); + *offset += 4; + +} /*dissect_zcl_ota_upgradeendrsp*/ + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_ota_queryspecfilereq + * DESCRIPTION + * this function is called in order to decode "QuerySpecificFileRequest", + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * proto_tree *tree - pointer to data tree Wireshark uses to display packet. + * guint *offset - pointer to buffer offset + * RETURNS + * none + *--------------------------------------------------------------- + */ +static void +dissect_zcl_ota_queryspecfilereq(tvbuff_t *tvb, proto_tree *tree, guint *offset) +{ + /* 'Requerst Node Address' field present, retrieves it */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_req_node_addr, tvb, *offset, 8, ENC_LITTLE_ENDIAN); + *offset += 8; + + /* Retrieve 'Manufacturer Code' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; + + /* Retrieve 'Image Type' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; + + /* Retrieve 'File Version' field */ + dissect_zcl_ota_file_version_field(tvb, tree, offset); + + /* Retrieve 'ZigBee Stack Version' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_zb_stack_ver, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; + +} /*dissect_zcl_ota_queryspecfilereq*/ + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_ota_queryspecfilersp + * DESCRIPTION + * this function is called in order to decode "QuerySpecificFileResponse", + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * proto_tree *tree - pointer to data tree Wireshark uses to display packet. + * guint *offset - pointer to buffer offset + * RETURNS + * none + *--------------------------------------------------------------- + */ +static void +dissect_zcl_ota_queryspecfilersp(tvbuff_t *tvb, proto_tree *tree, guint *offset) +{ + guint8 status; + + /* Retrieve 'Status' field */ + status = tvb_get_guint8(tvb, *offset); + proto_tree_add_item(tree, hf_zbee_zcl_ota_status, tvb, *offset, 1, ENC_NA); + *offset += 1; + + if (status == ZBEE_ZCL_STAT_SUCCESS) { + /* Retrieve 'Manufacturer Code' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; + + /* Retrieve 'Image Type' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; + + /* Retrieve 'File Version' field */ + dissect_zcl_ota_file_version_field(tvb, tree, offset); + + /* Retrieve 'Image Size' field */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_image_size, tvb, *offset, 4, ENC_LITTLE_ENDIAN); + *offset += 4; + } + +} /*dissect_zcl_ota_queryspecfilersp*/ + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_ota_attr_id + * DESCRIPTION + * this function is called by ZCL foundation dissector in order to decode + * specific cluster attributes identifier. + * PARAMETERS + * proto_tree *tree - pointer to data tree Wireshark uses to display packet. + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * guint *offset - pointer to buffer offset + * + * RETURNS + * none + *--------------------------------------------------------------- + */ +static void +dissect_zcl_ota_attr_id(proto_tree *tree, tvbuff_t *tvb, guint *offset) +{ + proto_tree_add_item(tree, hf_zbee_zcl_ota_attr_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); +} /*dissect_zcl_ota_attr_id*/ + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_ota_attr_data + * DESCRIPTION + * this function is called by ZCL foundation dissector in order to decode + * specific cluster attributes data. + * PARAMETERS + * proto_tree *tree - pointer to data tree Wireshark uses to display packet. + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * guint *offset - pointer to buffer offset + * guint16 attr_id - attribute identifier + * guint data_type - attribute data type + * RETURNS + * none + *--------------------------------------------------------------- + */ +static void +dissect_zcl_ota_attr_data(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type) +{ + /* Dissect attribute data type and data */ + switch ( attr_id ) + { + case ZBEE_ZCL_ATTR_ID_OTA_CURRENT_FILE_VERSION: + case ZBEE_ZCL_ATTR_ID_OTA_DOWNLOADED_FILE_VERSION: + dissect_zcl_ota_file_version_field(tvb, tree, offset); + break; + + case ZBEE_ZCL_ATTR_ID_OTA_CURRENT_ZB_STACK_VERSION: + case ZBEE_ZCL_ATTR_ID_OTA_DOWNLOADED_ZB_STACK_VERSION: + proto_tree_add_item(tree, hf_zbee_zcl_ota_zb_stack_ver, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; + break; + + case ZBEE_ZCL_ATTR_ID_OTA_IMAGE_UPGRADE_STATUS: + proto_tree_add_item(tree, hf_zbee_zcl_ota_image_upgrade_status, tvb, *offset, 1, ENC_NA); + *offset += 1; + break; + + case ZBEE_ZCL_ATTR_ID_OTA_MANUFACTURER_ID: + proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; + break; + + case ZBEE_ZCL_ATTR_ID_OTA_IMAGE_TYPE_ID: + proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; + break; + + case ZBEE_ZCL_ATTR_ID_OTA_MIN_BLOCK_REQ_DELAY: + default: + dissect_zcl_attr_data(tvb, tree, offset, data_type); + break; + } +} /*dissect_zcl_ota_attr_data*/ + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_ota_cmd_id + * DESCRIPTION + * this function is called by ZCL foundation dissector in order to decode + * specific cluster command identifier. + * PARAMETERS + * proto_tree *tree - pointer to data tree Wireshark uses to display packet. + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * guint *offset - pointer to buffer offset + * guint8 cmd_dir - command direction + * + * RETURNS + * none + *--------------------------------------------------------------- + */ +static void +dissect_zcl_ota_cmd_id(proto_tree* tree, tvbuff_t* tvb, guint* offset, guint8 cmd_dir) +{ + if (cmd_dir == ZBEE_ZCL_FCF_TO_CLIENT) + proto_tree_add_item(tree, hf_zbee_zcl_ota_srv_rx_cmd_id, tvb, *offset, 1, ENC_NA); + else + proto_tree_add_item(tree, hf_zbee_zcl_ota_srv_tx_cmd_id, tvb, *offset, 1, ENC_NA); +} /*dissect_zcl_ota_cmd_id*/ + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zbee_zcl_ota + * DESCRIPTION + * ZigBee ZCL OTA cluster dissector for wireshark. + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * packet_info *pinfo - pointer to packet information fields + * proto_tree *tree - pointer to data tree Wireshark uses to display packet. + * RETURNS + * none + *--------------------------------------------------------------- + */ +static int +dissect_zbee_zcl_ota(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) +{ + proto_item *payload_root; + proto_tree *payload_tree; + zbee_zcl_packet *zcl; + guint offset = 0; + guint8 cmd_id; + gint rem_len; + + /* Reject the packet if data is NULL */ + if (data == NULL) + return 0; + zcl = (zbee_zcl_packet *)data; + cmd_id = zcl->cmd_id; + + /* Create a subtree for the ZCL Command frame, and add the command ID to it. */ + if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) { + /* Append the command name to the info column. */ + col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u", + val_to_str_const(cmd_id, zbee_zcl_ota_srv_rx_cmd_names, "Unknown Command"), + zcl->tran_seqno); + + /* Add the command ID. */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_srv_rx_cmd_id, tvb, offset, 1, cmd_id); + + /* Check is this command has a payload, than add the payload tree */ + rem_len = tvb_reported_length_remaining(tvb, ++offset); + if (rem_len > 0) { + payload_root = proto_tree_add_text(tree, tvb, offset, rem_len, "Payload"); + payload_tree = proto_item_add_subtree(payload_root, ett_zbee_zcl_ota); + + /* Call the appropriate command dissector */ + switch (cmd_id) { + case ZBEE_ZCL_CMD_ID_OTA_QUERY_NEXT_IMAGE_REQ: + dissect_zcl_ota_querynextimagereq(tvb, payload_tree, &offset); + break; + + case ZBEE_ZCL_CMD_ID_OTA_IMAGE_BLOCK_REQ: + dissect_zcl_ota_imageblockreq(tvb, payload_tree, &offset); + break; + + case ZBEE_ZCL_CMD_ID_OTA_IMAGE_PAGE_REQ: + dissect_zcl_ota_imagepagereq(tvb, payload_tree, &offset); + break; + + case ZBEE_ZCL_CMD_ID_OTA_UPGRADE_END_REQ: + dissect_zcl_ota_upgradeendreq(tvb, payload_tree, &offset); + break; + + case ZBEE_ZCL_CMD_ID_OTA_QUERY_SPEC_FILE_REQ: + dissect_zcl_ota_queryspecfilereq(tvb, payload_tree, &offset); + break; + + default: + break; + } + } + } + else { /* ZBEE_ZCL_FCF_TO_CLIENT */ + /* Append the command name to the info column. */ + col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u", + val_to_str_const(cmd_id, zbee_zcl_ota_srv_tx_cmd_names, "Unknown Command"), + zcl->tran_seqno); + + /* Add the command ID. */ + proto_tree_add_item(tree, hf_zbee_zcl_ota_srv_tx_cmd_id, tvb, offset, 1, cmd_id); + + /* Check is this command has a payload, than add the payload tree */ + rem_len = tvb_reported_length_remaining(tvb, ++offset); + if (rem_len > 0) { + payload_root = proto_tree_add_text(tree, tvb, offset, rem_len, "Payload"); + payload_tree = proto_item_add_subtree(payload_root, ett_zbee_zcl_ota); + + /* Call the appropriate command dissector */ + switch (cmd_id) { + case ZBEE_ZCL_CMD_ID_OTA_IMAGE_NOTIFY: + dissect_zcl_ota_imagenotify(tvb, payload_tree, &offset); + break; + + case ZBEE_ZCL_CMD_ID_OTA_QUERY_NEXT_IMAGE_RSP: + dissect_zcl_ota_querynextimagersp(tvb, payload_tree, &offset); + break; + + case ZBEE_ZCL_CMD_ID_OTA_IMAGE_BLOCK_RSP: + dissect_zcl_ota_imageblockrsp(tvb, payload_tree, &offset); + break; + + case ZBEE_ZCL_CMD_ID_OTA_UPGRADE_END_RSP: + dissect_zcl_ota_upgradeendrsp(tvb, payload_tree, &offset); + break; + + case ZBEE_ZCL_CMD_ID_OTA_QUERY_SPEC_FILE_RSP: + dissect_zcl_ota_queryspecfilersp(tvb, payload_tree, &offset); + break; + + default: + break; + } + } + } + + return tvb_length(tvb); +} /*dissect_zbee_zcl_ota*/ + +/*FUNCTION:------------------------------------------------------ + * NAME + * proto_register_zbee_zcl_ota + * DESCRIPTION + * this function is called by ZCL foundation dissector in order to decode + * specific cluster attributes data. + * PARAMETERS + * proto_tree *tree - pointer to data tree Wireshark uses to display packet. + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * guint *offset - pointer to buffer offset + * guint16 attr_id - attribute identifier + * guint data_type - attribute data type + * RETURNS + * none + *--------------------------------------------------------------- + */ +void proto_register_zbee_zcl_ota(void) +{ + static hf_register_info hf[] = { + + { &hf_zbee_zcl_ota_attr_id, + { "Attribute", "zbee_zcl_general.ota.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_ota_attr_names), + 0x0, NULL, HFILL } }, + + { &hf_zbee_zcl_ota_srv_tx_cmd_id, + { "Command", "zbee_zcl_general.ota.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_ota_srv_tx_cmd_names), + 0x0, NULL, HFILL } }, + + { &hf_zbee_zcl_ota_srv_rx_cmd_id, + { "Command", "zbee_zcl_general.ota.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_ota_srv_rx_cmd_names), + 0x0, NULL, HFILL } }, + + { &hf_zbee_zcl_ota_image_upgrade_status, + { "Image Upgrade Status", "zbee_zcl_general.ota.status_attr", FT_UINT8, BASE_HEX, VALS(zbee_zcl_ota_image_upgrade_attr_status_names), + 0x0, NULL, HFILL } }, + + { &hf_zbee_zcl_ota_zb_stack_ver, + { "ZigBee Stack Version", "zbee_zcl_general.ota.zb_stack.ver", FT_UINT16, BASE_HEX | BASE_RANGE_STRING, + RVALS(zbee_zcl_ota_zb_stack_ver_names), 0x0, NULL, HFILL } }, + + { &hf_zbee_zcl_ota_payload_type, + { "Payload Type", "zbee_zcl_general.ota.payload.type", FT_UINT8, BASE_HEX, VALS(zbee_zcl_ota_paylaod_type_names), + 0x0, NULL, HFILL } }, + + { &hf_zbee_zcl_ota_query_jitter, + { "Query Jitter", "zbee_zcl_general.ota.query_jitter", FT_UINT16, BASE_CUSTOM, decode_zcl_time_in_seconds, + 0x0, NULL, HFILL } }, + + { &hf_zbee_zcl_ota_manufacturer_code, + { "Manufacturer Code", "zbee_zcl_general.ota.manufacturer_code", FT_UINT16, BASE_HEX, VALS(zbee_mfr_code_names), + 0x0, NULL, HFILL } }, + + { &hf_zbee_zcl_ota_image_type, + { "Image Type", "zbee_zcl_general.ota.image.type", FT_UINT16, BASE_HEX | BASE_RANGE_STRING, + RVALS(zbee_zcl_ota_image_type_names), 0x0, NULL, HFILL } }, + +/* Begin FileVersion fields */ + { &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 } }, + + { &hf_zbee_zcl_ota_file_version_appl_build, + { "Application Build", "zbee_zcl_general.ota.file.version.appl.build", FT_UINT32, BASE_DEC, NULL, + ZBEE_ZCL_OTA_FILE_VERS_APPL_BUILD, NULL, HFILL } }, + + { &hf_zbee_zcl_ota_file_version_stack_release, + { "Stack Release", "zbee_zcl_general.ota.file.version.stack.release", FT_UINT32, BASE_DEC, NULL, + ZBEE_ZCL_OTA_FILE_VERS_STACK_RELEASE, NULL, HFILL } }, + + { &hf_zbee_zcl_ota_file_version_stack_build, + { "Stack Build", "zbee_zcl_general.ota.file.version.stack.build", FT_UINT32, BASE_DEC, NULL, + ZBEE_ZCL_OTA_FILE_VERS_STACK_BUILD, NULL, HFILL } }, +/* End FileVersion fields */ + +/* Begin FieldControl fields */ + { &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 } }, + + { &hf_zbee_zcl_ota_field_ctrl_reserved, + { "Reserved", "zbee_zcl_general.ota.field_ctrl_reserved", FT_UINT8, BASE_HEX, NULL, + ZBEE_ZCL_OTA_FIELD_CTRL_RESERVED, NULL, HFILL } }, +/* End FieldControl fields */ + + { &hf_zbee_zcl_ota_hw_version, + { "Hardware Version", "zbee_zcl_general.ota.hw_ver", FT_UINT16, BASE_HEX, NULL, + 0x0, NULL, HFILL } }, + + { &hf_zbee_zcl_ota_status, + { "Status", "zbee_zcl_general.ota.status", FT_UINT8, BASE_HEX, VALS(zbee_zcl_status_names), + 0x0, NULL, HFILL } }, + + { &hf_zbee_zcl_ota_image_size, + { "Image Size", "zbee_zcl_general.ota.image.size", FT_UINT32, BASE_CUSTOM, decode_zcl_ota_size_in_bytes, + 0x0, NULL, HFILL } }, + + { &hf_zbee_zcl_ota_file_offset, + { "File Offset", "zbee_zcl_general.ota.file.offset", FT_UINT32, BASE_HEX, NULL, + 0x0, NULL, HFILL } }, + + { &hf_zbee_zcl_ota_max_data_size, + { "Max Data Size", "zbee_zcl_general.ota.max_data_size", FT_UINT8, BASE_DEC, NULL, + 0x0, NULL, HFILL } }, + + { &hf_zbee_zcl_ota_req_node_addr, + { "Ieee Address", "zbee_zcl_general.ota.ieee_addr", FT_UINT64, BASE_HEX, NULL, + 0x0, NULL, HFILL } }, + + { &hf_zbee_zcl_ota_page_size, + { "Page Size", "zbee_zcl_general.ota.page.size", FT_UINT16, BASE_CUSTOM, decode_zcl_ota_size_in_bytes, + 0x0, NULL, HFILL } }, + + { &hf_zbee_zcl_ota_rsp_spacing, + { "Response Spacing", "zbee_zcl_general.ota.rsp_spacing", FT_UINT16, BASE_HEX, NULL, + 0x0, NULL, HFILL } }, + + { &hf_zbee_zcl_ota_current_time, + { "Current Time", "zbee_zcl_general.ota.current_time", FT_UINT32, BASE_CUSTOM, decode_zcl_ota_curr_time, + 0x0, NULL, HFILL }}, + + { &hf_zbee_zcl_ota_request_time, + { "Request Time", "zbee_zcl_general.ota.request_time", FT_UINT32, BASE_CUSTOM, decode_zcl_ota_req_time, + 0x0, NULL, HFILL }}, + + { &hf_zbee_zcl_ota_upgrade_time, + { "Upgrade Time", "zbee_zcl_general.ota.upgrade_time", FT_UINT32, BASE_CUSTOM, decode_zcl_ota_upgr_time, + 0x0, NULL, HFILL }}, + + { &hf_zbee_zcl_ota_data_size, + { "Data Size", "zbee_zcl_general.ota.data_size", FT_UINT8, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_ota_image_data, + { "Image Data", "zbee_zcl_general.ota.image.data", FT_STRING, BASE_NONE, NULL, + 0x00, NULL, HFILL } } + }; + + /* ZCL OTA subtrees */ + gint *ett[ZBEE_ZCL_OTA_NUM_ETT]; + ett[0] = &ett_zbee_zcl_ota; + ett[1] = &ett_zbee_zcl_ota_field_ctrl; + ett[2] = &ett_zbee_zcl_ota_file_version; + + /* Register ZigBee ZCL Ota protocol with Wireshark. */ + proto_zbee_zcl_ota = proto_register_protocol("ZigBee ZCL OTA", "ZCL OTA", ZBEE_PROTOABBREV_ZCL_OTA); + proto_register_field_array(proto_zbee_zcl_ota, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + + /* Register the ZigBee ZCL OTA dissector. */ + new_register_dissector(ZBEE_PROTOABBREV_ZCL_OTA, dissect_zbee_zcl_ota, proto_zbee_zcl_ota); + +} /* proto_register_zbee_zcl_ota */ + + +/*FUNCTION:------------------------------------------------------ + * NAME + * proto_reg_handoff_zbee_zcl_ota + * DESCRIPTION + * Registers the zigbee ZCL OTA cluster dissector with Wireshark. + * PARAMETERS + * none + * RETURNS + * void + *--------------------------------------------------------------- + */ +void proto_reg_handoff_zbee_zcl_ota(void) +{ + dissector_handle_t ota_handle; + + /* Register our dissector with the ZigBee application dissectors. */ + ota_handle = find_dissector(ZBEE_PROTOABBREV_ZCL_OTA); + dissector_add_uint("zbee.zcl.cluster", ZBEE_ZCL_CID_OTA_UPGRADE, ota_handle); + + zbee_zcl_init_cluster( proto_zbee_zcl_ota, + ett_zbee_zcl_ota, + ZBEE_ZCL_CID_OTA_UPGRADE, + (zbee_zcl_fn_attr_id)dissect_zcl_ota_attr_id, + (zbee_zcl_fn_attr_data)dissect_zcl_ota_attr_data, + (zbee_zcl_fn_cmd_id)dissect_zcl_ota_cmd_id + ); + +} /*proto_reg_handoff_zbee_zcl_ota*/ /* ########################################################################## */ /* #### (0x001A) POWER PROFILE CLUSTER ###################################### */ diff --git a/epan/dissectors/packet-zbee-zcl.c b/epan/dissectors/packet-zbee-zcl.c index 90b67cdc1c..70ea9e9301 100644 --- a/epan/dissectors/packet-zbee-zcl.c +++ b/epan/dissectors/packet-zbee-zcl.c @@ -136,53 +136,6 @@ static int hf_zbee_zcl_ias_zone_server_scn_tamper = -1; static int hf_zbee_zcl_ias_zone_server_scn_trouble = -1; static int hf_zbee_zcl_ias_zone_server_scn_zone_id = -1; static int hf_zbee_zcl_ias_zone_server_scn_zone_status = -1; -static int hf_zbee_zcl_ota_upgrade_client_cmd_id = -1; -static int hf_zbee_zcl_ota_upgrade_client_ibr_brd = -1; -static int hf_zbee_zcl_ota_upgrade_client_ibr_brdp = -1; -static int hf_zbee_zcl_ota_upgrade_client_ibr_field_control = -1; -static int hf_zbee_zcl_ota_upgrade_client_ibr_fo = -1; -static int hf_zbee_zcl_ota_upgrade_client_ibr_fv = -1; -static int hf_zbee_zcl_ota_upgrade_client_ibr_ieee = -1; -static int hf_zbee_zcl_ota_upgrade_client_ibr_ieee_address = -1; -static int hf_zbee_zcl_ota_upgrade_client_ibr_it = -1; -static int hf_zbee_zcl_ota_upgrade_client_ibr_mc = -1; -static int hf_zbee_zcl_ota_upgrade_client_ibr_mds = -1; -static int hf_zbee_zcl_ota_upgrade_client_qnir_cfv = -1; -static int hf_zbee_zcl_ota_upgrade_client_qnir_field_control = -1; -static int hf_zbee_zcl_ota_upgrade_client_qnir_hv = -1; -static int hf_zbee_zcl_ota_upgrade_client_qnir_hvp = -1; -static int hf_zbee_zcl_ota_upgrade_client_qnir_image_type = -1; -static int hf_zbee_zcl_ota_upgrade_client_qnir_manuf_code = -1; -static int hf_zbee_zcl_ota_upgrade_client_uer_fv = -1; -static int hf_zbee_zcl_ota_upgrade_client_uer_it = -1; -static int hf_zbee_zcl_ota_upgrade_client_uer_mc = -1; -static int hf_zbee_zcl_ota_upgrade_client_uer_status = -1; -static int hf_zbee_zcl_ota_upgrade_server_cmd_id = -1; -static int hf_zbee_zcl_ota_upgrade_server_ibr_ds = -1; -static int hf_zbee_zcl_ota_upgrade_server_ibr_fo = -1; -static int hf_zbee_zcl_ota_upgrade_server_ibr_fv = -1; -static int hf_zbee_zcl_ota_upgrade_server_ibr_image_data = -1; -static int hf_zbee_zcl_ota_upgrade_server_ibr_it = -1; -static int hf_zbee_zcl_ota_upgrade_server_ibr_mc = -1; -static int hf_zbee_zcl_ota_upgrade_server_ibr_status = -1; -static int hf_zbee_zcl_ota_upgrade_server_ibr_wfd_brd = -1; -static int hf_zbee_zcl_ota_upgrade_server_ibr_wfd_ct = -1; -static int hf_zbee_zcl_ota_upgrade_server_ibr_wfd_rt = -1; -static int hf_zbee_zcl_ota_upgrade_server_in_it = -1; -static int hf_zbee_zcl_ota_upgrade_server_in_mc = -1; -static int hf_zbee_zcl_ota_upgrade_server_in_nfv = -1; -static int hf_zbee_zcl_ota_upgrade_server_in_pt = -1; -static int hf_zbee_zcl_ota_upgrade_server_in_qj = -1; -static int hf_zbee_zcl_ota_upgrade_server_qnir_fv = -1; -static int hf_zbee_zcl_ota_upgrade_server_qnir_is = -1; -static int hf_zbee_zcl_ota_upgrade_server_qnir_it = -1; -static int hf_zbee_zcl_ota_upgrade_server_qnir_mc = -1; -static int hf_zbee_zcl_ota_upgrade_server_qnir_status = -1; -static int hf_zbee_zcl_ota_upgrade_server_uer_ct = -1; -static int hf_zbee_zcl_ota_upgrade_server_uer_fv = -1; -static int hf_zbee_zcl_ota_upgrade_server_uer_it = -1; -static int hf_zbee_zcl_ota_upgrade_server_uer_mc = -1; -static int hf_zbee_zcl_ota_upgrade_server_uer_ut = -1; static int hf_zbee_zcl_poll_control_client_cir_fpt = -1; static int hf_zbee_zcl_poll_control_client_cir_sfp = -1; static int hf_zbee_zcl_poll_control_client_cmd_id = -1; @@ -215,8 +168,6 @@ static gint ett_zbee_zcl_attr[ZBEE_ZCL_NUM_ATTR_ETT]; static gint ett_zbee_zcl_array_elements[ZBEE_ZCL_NUM_ARRAY_ELEM_ETT]; static gint ett_zbee_zcl_ias_zone_server_scn_zone_status = -1; -static gint ett_zbee_zcl_ota_upgrade_client_ibr_field_control = -1; -static gint ett_zbee_zcl_ota_upgrade_client_qnir_field_control = -1; static gint ett_zbee_zcl_thermostat_client_gws_days_to_return = -1; static gint ett_zbee_zcl_thermostat_client_gws_mtr = -1; static gint ett_zbee_zcl_thermostat_client_sws_dow_for_sequence = -1; @@ -279,7 +230,7 @@ static const value_string zbee_zcl_cs_cmd_names[] = { /* ZigBee Manufacturer Name Table */ /* Per: 053298r19, December 2011 */ -static const value_string zbee_mfr_code_names[] = { +const value_string zbee_mfr_code_names[] = { { ZBEE_MFG_CODE_SAMSUNG, ZBEE_MFG_SAMSUNG }, { ZBEE_MFG_CODE_CIRRONET, ZBEE_MFG_CIRRONET }, @@ -555,7 +506,7 @@ static const value_string zbee_mfr_code_names[] = { static value_string_ext zbee_mfr_code_names_ext = VALUE_STRING_EXT_INIT(zbee_mfr_code_names); /* ZCL Attribute Status Names */ -static const value_string zbee_zcl_status_names[] = { +const value_string zbee_zcl_status_names[] = { { ZBEE_ZCL_STAT_SUCCESS, "Success"}, { ZBEE_ZCL_STAT_FAILURE, "Failure"}, @@ -579,6 +530,11 @@ static const value_string zbee_zcl_status_names[] = { { ZBEE_ZCL_STAT_WRITE_ONLY, "Write Only"}, { ZBEE_ZCL_STAT_INCONSISTENT_STARTUP_STATE, "Inconsistent Startup State"}, { ZBEE_ZCL_STAT_DEFINED_OUT_OF_BAND, "Defined Out of Band"}, + { ZBEE_ZCL_STAT_OTA_ABORT, "Ota Abort"}, + { ZBEE_ZCL_STAT_OTA_INVALID_IMAGE, "Ota Invalid Image"}, + { ZBEE_ZCL_STAT_OTA_WAIT_FOR_DATA, "Ota Wait For Data"}, + { ZBEE_ZCL_STAT_OTA_NO_IMAGE_AVAILABLE, "Ota No Image Available"}, + { ZBEE_ZCL_STAT_OTA_REQUIRE_MORE_IMAGE, "Ota Require More Image"}, { ZBEE_ZCL_STAT_HARDWARE_FAILURE, "Hardware Failure"}, { ZBEE_ZCL_STAT_SOFTWARE_FAILURE, "Software Failure"}, { ZBEE_ZCL_STAT_CALIBRATION_ERROR, "Calibration Error"}, @@ -794,50 +750,6 @@ static const value_string zbee_zcl_ias_zone_server_cmd_names[] = { { 0, NULL } }; -/* ZCL OTA Upgrade Client Commands */ -static const value_string zbee_zcl_ota_upgrade_client_cmd_names[] = { - { ZBEE_ZCL_CSC_OTA_UPGRADE_C_IBR, "Image Block Request" }, - { ZBEE_ZCL_CSC_OTA_UPGRADE_C_QNIR, "Query Next Image Request" }, - { ZBEE_ZCL_CSC_OTA_UPGRADE_C_UER, "Upgrade End Request" }, - - { 0, NULL } -}; - -/* ZCL OTA Upgrade Server Commands */ -static const value_string zbee_zcl_ota_upgrade_server_cmd_names[] = { - { ZBEE_ZCL_CSC_OTA_UPGRADE_S_IBR, "Image Block Response" }, - { ZBEE_ZCL_CSC_OTA_UPGRADE_S_IN, "Image Notify" }, - { ZBEE_ZCL_CSC_OTA_UPGRADE_S_QNIR, "Query Next Image Response" }, - { ZBEE_ZCL_CSC_OTA_UPGRADE_S_UER, "Upgrade End Response" }, - - { 0, NULL } -}; - -/* ZCL OTA Upgrade Server Image Notify Payload Type */ -static const value_string zbee_zcl_ota_upgrade_server_in_pt[] = { - { ZBEE_ZCL_CSC_OTA_UPGRADE_S_IN_PT_J, "Query jitter" }, - { ZBEE_ZCL_CSC_OTA_UPGRADE_S_IN_PT_JM, "Query jitter and manufacturer code" }, - { ZBEE_ZCL_CSC_OTA_UPGRADE_S_IN_PT_JMI, "Query jitter, manufacturer code and image type" }, - { ZBEE_ZCL_CSC_OTA_UPGRADE_S_IN_PT_JMIN, "Query jitter, manufacturer code, image type and new file version" }, - - { 0, NULL } -}; - -/* ZCL OTA Upgrade Server Query Next Image Response Status */ -static const value_string zbee_zcl_ota_upgrade_server_qnir_status[] = { - { ZBEE_ZCL_CSC_OTA_UPGRADE_S_IBR_A, "Abort" }, - { ZBEE_ZCL_CSC_OTA_UPGRADE_S_IBR_II, "Invalid Image" }, - { ZBEE_ZCL_CSC_OTA_UPGRADE_S_IBR_MC, "Malformed Command" }, - { ZBEE_ZCL_CSC_OTA_UPGRADE_S_IBR_NA, "Not Authorised" }, - { ZBEE_ZCL_CSC_OTA_UPGRADE_S_IBR_NIA, "No Image Available" }, - { ZBEE_ZCL_CSC_OTA_UPGRADE_S_IBR_RMI, "Require More Image" }, - { ZBEE_ZCL_CSC_OTA_UPGRADE_S_IBR_S, "Success" }, - { ZBEE_ZCL_CSC_OTA_UPGRADE_S_IBR_UCC, "Unsup Cluster Command" }, - { ZBEE_ZCL_CSC_OTA_UPGRADE_S_IBR_WFD, "Wait For Data" }, - - { 0, NULL } -}; - /* ZCL Poll Control Client Commands */ static const value_string zbee_zcl_poll_control_client_cmd_names[] = { { ZBEE_ZCL_CSC_POLL_CONTROL_C_CIR, "Check-in Response" }, @@ -1023,8 +935,7 @@ static int dissect_zbee_zcl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, offset += 1; } else { /* Cluster-specific. */ - guint8 field_control, ibr_status, image_notify_payload_type, mode_for_sequence, number_of_transitions, - query_next_image_response; + guint8 mode_for_sequence, number_of_transitions; payload_tvb = tvb_new_subset_remaining(tvb, offset); if (cluster_handle != NULL) { @@ -1101,219 +1012,6 @@ static int dissect_zbee_zcl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } } break; - case ZBEE_ZCL_CID_OTA_UPGRADE: - if (packet.direction == ZBEE_ZCL_DIR_REPORTED) { - /* We have a client. */ - col_append_fstr(pinfo->cinfo, COL_INFO, "Client Command: %s, Seq: %u", val_to_str(packet.cmd_id, - zbee_zcl_ota_upgrade_client_cmd_names, "Unknown OTA Upgrade Client Command"), - packet.tran_seqno); - if (zcl_tree) { - proto_tree_add_uint(zcl_tree, hf_zbee_zcl_ota_upgrade_client_cmd_id, tvb, offset, 1, - packet.cmd_id); - offset += 1; - switch (packet.cmd_id) { - case ZBEE_ZCL_CSC_OTA_UPGRADE_C_IBR: - /* Image Block Request. */ - field_control = tvb_get_guint8(tvb, offset); - ti = proto_tree_add_uint_format(zcl_tree, - hf_zbee_zcl_ota_upgrade_client_ibr_field_control, tvb, offset, 1, field_control, - "Field Control"); - sub_tree = proto_item_add_subtree(ti, - ett_zbee_zcl_ota_upgrade_client_ibr_field_control); - proto_tree_add_item(sub_tree, hf_zbee_zcl_ota_upgrade_client_ibr_ieee, tvb, offset, 1, - ENC_NA); - proto_tree_add_item(sub_tree, hf_zbee_zcl_ota_upgrade_client_ibr_brdp, tvb, offset, 1, - ENC_NA); - offset += 1; - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_client_ibr_mc, tvb, offset, 2, - ENC_LITTLE_ENDIAN); - offset += 2; - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_client_ibr_it, tvb, offset, 2, - ENC_LITTLE_ENDIAN); - offset += 2; - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_client_ibr_fv, tvb, offset, 4, - ENC_LITTLE_ENDIAN); - offset += 4; - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_client_ibr_fo, tvb, offset, 4, - ENC_LITTLE_ENDIAN); - offset += 4; - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_client_ibr_mds, tvb, offset, 1, - ENC_LITTLE_ENDIAN); - offset += 1; - if (field_control & 0x01) { - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_client_ibr_ieee_address, tvb, - offset, 8, ENC_LITTLE_ENDIAN); - offset += 8; - } - if (field_control & 0x02) { - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_client_ibr_brd, tvb, offset, - 2, ENC_LITTLE_ENDIAN); - offset += 2; - } - break; - case ZBEE_ZCL_CSC_OTA_UPGRADE_C_QNIR: - /* Query Next Image Request. */ - field_control = tvb_get_guint8(tvb, offset); - ti = proto_tree_add_uint_format(zcl_tree, - hf_zbee_zcl_ota_upgrade_client_qnir_field_control, tvb, offset, 1, field_control, - "Field Control"); - sub_tree = proto_item_add_subtree(ti, - ett_zbee_zcl_ota_upgrade_client_qnir_field_control); - proto_tree_add_item(sub_tree, hf_zbee_zcl_ota_upgrade_client_qnir_hvp, tvb, offset, 1, - ENC_NA); - offset += 1; - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_client_qnir_manuf_code, tvb, - offset, 2, ENC_LITTLE_ENDIAN); - offset += 2; - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_client_qnir_image_type, tvb, - offset, 2, ENC_LITTLE_ENDIAN); - offset += 2; - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_client_qnir_cfv, tvb, offset, 4, - ENC_LITTLE_ENDIAN); - offset += 4; - if (field_control) { - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_client_qnir_hv, tvb, offset, - 2, ENC_LITTLE_ENDIAN); - offset += 2; - } - break; - case ZBEE_ZCL_CSC_OTA_UPGRADE_C_UER: - /* Upgrade End Request. */ - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_client_uer_status, tvb, offset, 1, - ENC_NA); - offset += 1; - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_client_uer_mc, tvb, offset, 2, - ENC_LITTLE_ENDIAN); - offset += 2; - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_client_uer_it, tvb, offset, 2, - ENC_LITTLE_ENDIAN); - offset += 2; - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_client_uer_fv, tvb, offset, 4, - ENC_LITTLE_ENDIAN); - offset += 4; - break; - } - } - } else { - /* We have a server. */ - col_append_fstr(pinfo->cinfo, COL_INFO, "Server Command: %s, Seq: %u", val_to_str(packet.cmd_id, - zbee_zcl_ota_upgrade_server_cmd_names, "Unknown OTA Upgrade Server Command"), - packet.tran_seqno); - if (zcl_tree) { - proto_tree_add_uint(zcl_tree, hf_zbee_zcl_ota_upgrade_server_cmd_id, tvb, offset, 1, - packet.cmd_id); - offset += 1; - switch (packet.cmd_id) { - case ZBEE_ZCL_CSC_OTA_UPGRADE_S_IBR: - /* Image Block Response. */ - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_server_ibr_status, tvb, offset, 1, - ENC_NA); - ibr_status = tvb_get_guint8(tvb, offset); - offset += 1; - switch (ibr_status) { - case ZBEE_ZCL_CSC_OTA_UPGRADE_S_IBR_S: - /* Success. */ - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_server_ibr_mc, tvb, - offset, 2, ENC_LITTLE_ENDIAN); - offset += 2; - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_server_ibr_it, tvb, - offset, 2, ENC_LITTLE_ENDIAN); - offset += 2; - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_server_ibr_fv, tvb, - offset, 4, ENC_LITTLE_ENDIAN); - offset += 4; - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_server_ibr_fo, tvb, - offset, 4, ENC_LITTLE_ENDIAN); - offset += 4; - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_server_ibr_ds, tvb, - offset, 1, ENC_NA); - offset += 1; - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_server_ibr_image_data, - tvb, offset, tvb_length_remaining(tvb, offset), ENC_NA); - offset += tvb_length_remaining(tvb, offset); - break; - case ZBEE_ZCL_CSC_OTA_UPGRADE_S_IBR_WFD: - /* Wait For Data. */ - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_server_ibr_wfd_ct, tvb, - offset, 4, ENC_LITTLE_ENDIAN); - offset += 4; - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_server_ibr_wfd_rt, tvb, - offset, 4, ENC_LITTLE_ENDIAN); - offset += 4; - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_server_ibr_wfd_brd, tvb, - offset, 2, ENC_LITTLE_ENDIAN); - offset += 2; - break; - } - break; - case ZBEE_ZCL_CSC_OTA_UPGRADE_S_IN: - /* Image Notify. */ - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_server_in_pt, tvb, offset, 1, - ENC_NA); - image_notify_payload_type = tvb_get_guint8(tvb, offset); - offset += 1; - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_server_in_qj, tvb, offset, 1, - ENC_NA); - offset += 1; - if (image_notify_payload_type > ZBEE_ZCL_CSC_OTA_UPGRADE_S_IN_PT_J) { - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_server_in_mc, tvb, offset, 2, - ENC_LITTLE_ENDIAN); - offset += 2; - } - if (image_notify_payload_type > ZBEE_ZCL_CSC_OTA_UPGRADE_S_IN_PT_JM) { - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_server_in_it, tvb, offset, 2, - ENC_LITTLE_ENDIAN); - offset += 2; - } - if (image_notify_payload_type > ZBEE_ZCL_CSC_OTA_UPGRADE_S_IN_PT_JMI) { - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_server_in_nfv, tvb, offset, 4, - ENC_LITTLE_ENDIAN); - offset += 4; - } - break; - case ZBEE_ZCL_CSC_OTA_UPGRADE_S_QNIR: - /* Query Next Image Response. */ - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_server_qnir_status, tvb, offset, - 1, ENC_NA); - query_next_image_response = tvb_get_guint8(tvb, offset); - offset += 1; - if (!query_next_image_response) { - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_server_qnir_mc, tvb, offset, - 2, ENC_LITTLE_ENDIAN); - offset += 2; - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_server_qnir_it, tvb, offset, - 2, ENC_LITTLE_ENDIAN); - offset += 2; - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_server_qnir_fv, tvb, offset, - 4, ENC_LITTLE_ENDIAN); - offset += 4; - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_server_qnir_is, tvb, offset, - 4, ENC_LITTLE_ENDIAN); - offset += 4; - } - break; - case ZBEE_ZCL_CSC_OTA_UPGRADE_S_UER: - /* Upgrade End Response. */ - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_server_uer_mc, tvb, offset, 2, - ENC_LITTLE_ENDIAN); - offset += 2; - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_server_uer_it, tvb, offset, 2, - ENC_LITTLE_ENDIAN); - offset += 2; - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_server_uer_fv, tvb, offset, 4, - ENC_LITTLE_ENDIAN); - offset += 4; - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_server_uer_ct, tvb, offset, 4, - ENC_LITTLE_ENDIAN); - offset += 4; - proto_tree_add_item(zcl_tree, hf_zbee_zcl_ota_upgrade_server_uer_ut, tvb, offset, 4, - ENC_LITTLE_ENDIAN); - offset += 4; - break; - } - } - } - break; case ZBEE_ZCL_CID_POLL_CONTROL: if (packet.direction == ZBEE_ZCL_DIR_REPORTED) { /* We have a client. */ @@ -3056,170 +2754,6 @@ void proto_register_zbee_zcl(void) { &hf_zbee_zcl_ias_zone_server_scn_zone_status, { "Zone Status", "zbee_zcl.ias_zone.server.scn.zone_status", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - { &hf_zbee_zcl_ota_upgrade_client_cmd_id, - { "Command", "zbee_zcl.ota_upgrade.client.cmd_id", FT_UINT8, BASE_HEX, - VALS(zbee_zcl_ota_upgrade_client_cmd_names), 0x0, NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_client_ibr_brd, - { "Block Request Delay", "zbee_zcl.ota_upgrade.client.ibr.brd", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, - HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_client_ibr_brdp, - { "Block Request Delay Presents", "zbee_zcl.ota_upgrade.client.ibr.brdp", FT_BOOLEAN, 8, NULL, 0x02, NULL, - HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_client_ibr_field_control, - { "Field Control", "zbee_zcl.ota_upgrade.client.ibr.field_control", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, - HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_client_ibr_fo, - { "File Offset (in bytes)", "zbee_zcl.ota_upgrade.client.ibr.fo", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, - HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_client_ibr_fv, - { "File Version", "zbee_zcl.ota_upgrade.client.ibr.fv", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_client_ibr_ieee, - { "Request Node's IEEE Address Presents", "zbee_zcl.ota_upgrade.client.ibr.ieee", FT_BOOLEAN, 8, NULL, 0x01, - NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_client_ibr_ieee_address, - { "IEEE Address", "zbee_zcl.ota_upgrade.client.ibr.ieee_address", FT_EUI64, BASE_NONE, NULL, 0x0, NULL, - HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_client_ibr_it, - { "Image Type", "zbee_zcl.ota_upgrade.client.ibr.it", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_client_ibr_mc, - { "Manufacturer Code", "zbee_zcl.ota_upgrade.client.ibr.mc", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_client_ibr_mds, - { "Maximum Data Size (in bytes)", "zbee_zcl.ota_upgrade.client.ibr.mds", FT_UINT8, BASE_DEC, NULL, 0x0, - NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_client_qnir_cfv, - { "Current File Version", "zbee_zcl.ota_upgrade.client.qnir.cfv", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, - HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_client_qnir_field_control, - { "Field Control", "zbee_zcl.ota_upgrade.client.qnir.field_control", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, - HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_client_qnir_hv, - { "Hardware Version", "zbee_zcl.ota_upgrade.client.qnir.hardware_version", FT_UINT16, BASE_HEX, NULL, 0x0, - NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_client_qnir_hvp, - { "Hardware Version Present", "zbee_zcl.ota_upgrade.client.qnir.hvp", FT_BOOLEAN, 8, NULL, 0x01, NULL, - HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_client_qnir_image_type, - { "Image Type", "zbee_zcl.ota_upgrade.client.qnir.image_type", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, - HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_client_qnir_manuf_code, - { "Manufacturer Code", "zbee_zcl.ota_upgrade.client.qnir.manufacturer_code", FT_UINT16, BASE_HEX, NULL, 0x0, - NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_client_uer_fv, - { "File Version", "zbee_zcl.ota_upgrade.client.uer.fv", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_client_uer_it, - { "Image Type", "zbee_zcl.ota_upgrade.client.uer.it", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_client_uer_mc, - { "Manufacturer Code", "zbee_zcl.ota_upgrade.client.uer.mc", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_client_uer_status, - { "Status", "zbee_zcl.ota_upgrade.client.uer.status", FT_UINT8, BASE_HEX, - VALS(zbee_zcl_ota_upgrade_server_qnir_status), 0x0, NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_server_cmd_id, - { "Command", "zbee_zcl.ota_upgrade.server.cmd_id", FT_UINT8, BASE_HEX, - VALS(zbee_zcl_ota_upgrade_server_cmd_names), 0x0, NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_server_ibr_ds, - { "Data Size", "zbee_zcl.ota_upgrade.server.ibr.ds", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_server_ibr_fo, - { "File Offset", "zbee_zcl.ota_upgrade.server.ibr.fo", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_server_ibr_fv, - { "File Version", "zbee_zcl.ota_upgrade.server.ibr.fv", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_server_ibr_image_data, - { "Image Data", "zbee_zcl.ota_upgrade.server.ibr.image_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, - HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_server_ibr_it, - { "Image Type", "zbee_zcl.ota_upgrade.server.ibr.it", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_server_ibr_mc, - { "Manufacturer Code", "zbee_zcl.ota_upgrade.server.ibr.mc", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_server_ibr_status, - { "Status", "zbee_zcl.ota_upgrade.server.ibr.status", FT_UINT8, BASE_HEX, - VALS(zbee_zcl_ota_upgrade_server_qnir_status), 0x0, NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_server_ibr_wfd_brd, - { "Block Request Delay", "zbee_zcl.ota_upgrade.server.ibr.wfd_brd", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, - HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_server_ibr_wfd_ct, - { "Current Time", "zbee_zcl.ota_upgrade.server.ibr.wfd_ct", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_server_ibr_wfd_rt, - { "Request Time", "zbee_zcl.ota_upgrade.server.ibr.wfd_rt", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_server_in_it, - { "Image Type", "zbee_zcl.ota_upgrade.server.in.it", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_server_in_mc, - { "Manufacturer Code", "zbee_zcl.ota_upgrade.server.in.mc", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_server_in_nfv, - { "New File Version", "zbee_zcl.ota_upgrade.server.in.nfv", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_server_in_pt, - { "Payload Type", "zbee_zcl.ota_upgrade.server.in.pt", FT_UINT8, BASE_HEX, - VALS(zbee_zcl_ota_upgrade_server_in_pt), 0x0, NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_server_in_qj, - { "Query Jitter", "zbee_zcl.ota_upgrade.server.in.qj", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_server_qnir_fv, - { "File Version", "zbee_zcl.ota_upgrade.server.qnir.fv", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_server_qnir_is, - { "Image Size (in bytes)", "zbee_zcl.ota_upgrade.server.qnir.is", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, - HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_server_qnir_it, - { "Image Type", "zbee_zcl.ota_upgrade.server.qnir.it", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_server_qnir_mc, - { "Manufacturer Code", "zbee_zcl.ota_upgrade.server.qnir.mc", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, - HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_server_qnir_status, - { "Status", "zbee_zcl.ota_upgrade.server.qnir.status", FT_UINT8, BASE_HEX, - VALS(zbee_zcl_ota_upgrade_server_qnir_status), 0x0, NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_server_uer_ct, - { "Current Time", "zbee_zcl.ota_upgrade.server.uer.ct", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_server_uer_fv, - { "File Version", "zbee_zcl.ota_upgrade.server.uer.fv", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_server_uer_it, - { "Image Type", "zbee_zcl.ota_upgrade.server.uer.it", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_server_uer_mc, - { "Manufacturer Code", "zbee_zcl.ota_upgrade.server.uer.mc", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - - { &hf_zbee_zcl_ota_upgrade_server_uer_ut, - { "Upgrade Time", "zbee_zcl.ota_upgrade.server.uer.ut", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_zbee_zcl_poll_control_client_cir_fpt, { "Fast Poll Timeout (quarterseconds)", "zbee_zcl.poll_control.client.cir.fpt", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, @@ -3320,14 +2854,12 @@ void proto_register_zbee_zcl(void) ett[0] = &ett_zbee_zcl; ett[1] = &ett_zbee_zcl_fcf; ett[2] = &ett_zbee_zcl_ias_zone_server_scn_zone_status; - ett[3] = &ett_zbee_zcl_ota_upgrade_client_ibr_field_control; - ett[4] = &ett_zbee_zcl_ota_upgrade_client_qnir_field_control; - ett[5] = &ett_zbee_zcl_thermostat_client_gws_days_to_return; - ett[6] = &ett_zbee_zcl_thermostat_client_gws_mtr; - ett[7] = &ett_zbee_zcl_thermostat_client_sws_dow_for_sequence; - ett[8] = &ett_zbee_zcl_thermostat_client_sws_mfs; - ett[9] = &ett_zbee_zcl_thermostat_server_gwsr_dow_for_sequence; - ett[10] = &ett_zbee_zcl_thermostat_server_gwsr_mfs; + ett[3] = &ett_zbee_zcl_thermostat_client_gws_days_to_return; + ett[4] = &ett_zbee_zcl_thermostat_client_gws_mtr; + ett[5] = &ett_zbee_zcl_thermostat_client_sws_dow_for_sequence; + ett[6] = &ett_zbee_zcl_thermostat_client_sws_mfs; + ett[7] = &ett_zbee_zcl_thermostat_server_gwsr_dow_for_sequence; + ett[8] = &ett_zbee_zcl_thermostat_server_gwsr_mfs; j = ZBEE_ZCL_NUM_INDIVIDUAL_ETT; diff --git a/epan/dissectors/packet-zbee-zcl.h b/epan/dissectors/packet-zbee-zcl.h index 915b2cb48b..399d1d11fa 100644 --- a/epan/dissectors/packet-zbee-zcl.h +++ b/epan/dissectors/packet-zbee-zcl.h @@ -135,7 +135,7 @@ typedef struct{ /* ZCL Miscellaneous */ #define ZBEE_ZCL_INVALID_STR_LENGTH 0xff #define ZBEE_ZCL_INVALID_LONG_STR_LENGTH 0xffff -#define ZBEE_ZCL_NUM_INDIVIDUAL_ETT 11 +#define ZBEE_ZCL_NUM_INDIVIDUAL_ETT 9 #define ZBEE_ZCL_NUM_ATTR_ETT 64 #define ZBEE_ZCL_NUM_ARRAY_ELEM_ETT 16 #define ZBEE_ZCL_NUM_TOTAL_ETT (ZBEE_ZCL_NUM_INDIVIDUAL_ETT + ZBEE_ZCL_NUM_ATTR_ETT + ZBEE_ZCL_NUM_ARRAY_ELEM_ETT) @@ -169,6 +169,11 @@ typedef struct{ #define ZBEE_ZCL_STAT_WRITE_ONLY 0x8f #define ZBEE_ZCL_STAT_INCONSISTENT_STARTUP_STATE 0x90 #define ZBEE_ZCL_STAT_DEFINED_OUT_OF_BAND 0x91 +#define ZBEE_ZCL_STAT_OTA_ABORT 0x95 +#define ZBEE_ZCL_STAT_OTA_INVALID_IMAGE 0x96 +#define ZBEE_ZCL_STAT_OTA_WAIT_FOR_DATA 0x97 +#define ZBEE_ZCL_STAT_OTA_NO_IMAGE_AVAILABLE 0x98 +#define ZBEE_ZCL_STAT_OTA_REQUIRE_MORE_IMAGE 0x99 #define ZBEE_ZCL_STAT_HARDWARE_FAILURE 0xc0 #define ZBEE_ZCL_STAT_SOFTWARE_FAILURE 0xc1 #define ZBEE_ZCL_STAT_CALIBRATION_ERROR 0xc2 @@ -194,6 +199,8 @@ typedef struct _zbee_zcl_cluster_desc { } zbee_zcl_cluster_desc; extern const value_string zbee_zcl_short_data_type_names[]; +extern const value_string zbee_mfr_code_names[]; +extern const value_string zbee_zcl_status_names[]; /* Dissector functions */ extern void dissect_zcl_read_attr (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset, guint16 cluster_id); @@ -215,26 +222,6 @@ zbee_zcl_cluster_desc *zbee_zcl_get_cluster_desc(guint16 cluster_id); #define ZBEE_ZCL_CSC_IAS_ZONE_C_ZER 0x00 #define ZBEE_ZCL_CSC_IAS_ZONE_S_ZER 0x01 #define ZBEE_ZCL_CSC_IAS_ZONE_S_ZSCN 0x00 -#define ZBEE_ZCL_CSC_OTA_UPGRADE_C_IBR 0x03 -#define ZBEE_ZCL_CSC_OTA_UPGRADE_C_QNIR 0x01 -#define ZBEE_ZCL_CSC_OTA_UPGRADE_C_UER 0x06 -#define ZBEE_ZCL_CSC_OTA_UPGRADE_S_IBR 0x05 -#define ZBEE_ZCL_CSC_OTA_UPGRADE_S_IBR_A 0x95 -#define ZBEE_ZCL_CSC_OTA_UPGRADE_S_IBR_II 0x96 -#define ZBEE_ZCL_CSC_OTA_UPGRADE_S_IBR_MC 0x80 -#define ZBEE_ZCL_CSC_OTA_UPGRADE_S_IBR_NA 0x7e -#define ZBEE_ZCL_CSC_OTA_UPGRADE_S_IBR_NIA 0x98 -#define ZBEE_ZCL_CSC_OTA_UPGRADE_S_IBR_RMI 0x99 -#define ZBEE_ZCL_CSC_OTA_UPGRADE_S_IBR_S 0x00 -#define ZBEE_ZCL_CSC_OTA_UPGRADE_S_IBR_UCC 0x81 -#define ZBEE_ZCL_CSC_OTA_UPGRADE_S_IBR_WFD 0x97 -#define ZBEE_ZCL_CSC_OTA_UPGRADE_S_IN 0x00 -#define ZBEE_ZCL_CSC_OTA_UPGRADE_S_IN_PT_J 0x00 -#define ZBEE_ZCL_CSC_OTA_UPGRADE_S_IN_PT_JM 0x01 -#define ZBEE_ZCL_CSC_OTA_UPGRADE_S_IN_PT_JMI 0x02 -#define ZBEE_ZCL_CSC_OTA_UPGRADE_S_IN_PT_JMIN 0x03 -#define ZBEE_ZCL_CSC_OTA_UPGRADE_S_QNIR 0x02 -#define ZBEE_ZCL_CSC_OTA_UPGRADE_S_UER 0x07 #define ZBEE_ZCL_CSC_POLL_CONTROL_C_CIR 0x00 #define ZBEE_ZCL_CSC_POLL_CONTROL_C_FPS 0x01 #define ZBEE_ZCL_CSC_POLL_CONTROL_C_SLPI 0x02 diff --git a/epan/dissectors/packet-zbee.h b/epan/dissectors/packet-zbee.h index 691b6ec420..214ee9fe64 100644 --- a/epan/dissectors/packet-zbee.h +++ b/epan/dissectors/packet-zbee.h @@ -797,6 +797,7 @@ #define ZBEE_PROTOABBREV_ZCL_APPLSTATS "zbee_zcl_ha.applstats" #define ZBEE_PROTOABBREV_ZCL_METIDT "zbee_zcl_ha.metidt" #define ZBEE_PROTOABBREV_ZCL_ONOFF "zbee_zcl_general.onoff" +#define ZBEE_PROTOABBREV_ZCL_OTA "zbee_zcl_general.ota" #define ZBEE_PROTOABBREV_ZCL_PART "zbee_zcl_general.part" #define ZBEE_PROTOABBREV_ZCL_PWRPROF "zbee_zcl_general.pwrprof" #define ZBEE_PROTOABBREV_ZCL_ILLUMMEAS "zbee_zcl_meas_sensing.illummeas" |