/* Global Variables */
/*************************/
+/* ########################################################################## */
+/* #### (0x0700) PRICE CLUSTER ############################################## */
+/* ########################################################################## */
+
+/* Attributes */
+#define zbee_zcl_price_attr_names_VALUE_STRING_LIST(XXX) \
+/* Block Threshold (Delivered) Set */ \
+ XXX(ZBEE_ZCL_ATTR_ID_PRICE_BLOCK_1_THRESHOLD, 0x0100, "Block 1 Threshold" ) \
+ XXX(ZBEE_ZCL_ATTR_ID_PRICE_BLOCK_2_THRESHOLD, 0x0101, "Block 2 Threshold" ) \
+ XXX(ZBEE_ZCL_ATTR_ID_PRICE_BLOCK_3_THRESHOLD, 0x0102, "Block 3 Threshold" ) \
+/* Block Period (Delivered) Set */ \
+ XXX(ZBEE_ZCL_ATTR_ID_PRICE_THRESHOLD_MULTIPLIER, 0x0202, "Threshold Multiplier" ) \
+ XXX(ZBEE_ZCL_ATTR_ID_PRICE_THRESHOLD_DIVISOR, 0x0203, "Threshold Divisor" ) \
+/* Commodity */ \
+ XXX(ZBEE_ZCL_ATTR_ID_PRICE_COMMODITY_TYPE, 0x0300, "Commodity Type" ) \
+ XXX(ZBEE_ZCL_ATTR_ID_PRICE_STANDING_CHARGE, 0x0301, "Standing Charge" ) \
+ XXX(ZBEE_ZCL_ATTR_ID_PRICE_CONVERSION_FACTOR, 0x0302, "Conversion Factor" ) \
+ XXX(ZBEE_ZCL_ATTR_ID_PRICE_CONVERSION_FACTOR_TRAILING_DIGIT,0x0303, "Conversion Factor TrailingDigit" ) \
+ XXX(ZBEE_ZCL_ATTR_ID_PRICE_CALORIFIC_VALUE, 0x0304, "Calorific Value" ) \
+ XXX(ZBEE_ZCL_ATTR_ID_PRICE_CALORIFIC_VALUE_UNIT, 0x0305, "Calorific Value Unit" ) \
+ XXX(ZBEE_ZCL_ATTR_ID_PRICE_CALORIFIC_VALUE_TRAILING_DIGIT, 0x0306, "Calorific Value Trailing Digit" ) \
+/* Block Price Information (Delivered) */ \
+ XXX(ZBEE_ZCL_ATTR_ID_PRICE_NO_TIER_BLOCK_1_PRICE, 0x0400, "No Tier Block 1 Price" ) \
+ XXX(ZBEE_ZCL_ATTR_ID_PRICE_NO_TIER_BLOCK_2_PRICE, 0x0401, "No Tier Block 2 Price" ) \
+ XXX(ZBEE_ZCL_ATTR_ID_PRICE_NO_TIER_BLOCK_3_PRICE, 0x0402, "No Tier Block 3 Price" ) \
+ XXX(ZBEE_ZCL_ATTR_ID_PRICE_NO_TIER_BLOCK_4_PRICE, 0x0403, "No Tier Block 4 Price" ) \
+ XXX(ZBEE_ZCL_ATTR_ID_PRICE_TIER_1_BLOCK_1_PRICE, 0x0410, "Tier 1 Block 1 Price" ) \
+ XXX(ZBEE_ZCL_ATTR_ID_PRICE_TIER_2_BLOCK_1_PRICE, 0x0420, "Tier 2 Block 1 Price" ) \
+ XXX(ZBEE_ZCL_ATTR_ID_PRICE_TIER_3_BLOCK_1_PRICE, 0x0430, "Tier 3 Block 1 Price" ) \
+ XXX(ZBEE_ZCL_ATTR_ID_PRICE_TIER_4_BLOCK_1_PRICE, 0x0440, "Tier 4 Block 1 Price" ) \
+/* Tariff Information Set (Delivered) */ \
+ XXX(ZBEE_ZCL_ATTR_ID_PRICE_UNIT_OF_MEASURE, 0x0615, "Unit of Measure" ) \
+ XXX(ZBEE_ZCL_ATTR_ID_PRICE_CURRENCY, 0x0616, "Currency" ) \
+ XXX(ZBEE_ZCL_ATTR_ID_PRICE_PRICE_TRAILING_DIGIT, 0x0617, "Price Trailing Digit" ) \
+/* Smart Energy */ \
+ XXX(ZBEE_ZCL_ATTR_ID_SE_ATTR_REPORT_STATUS_PRICE, 0xFFFE, "Attribute Reporting Status" )
+
+VALUE_STRING_ENUM(zbee_zcl_price_attr_names);
+VALUE_STRING_ARRAY(zbee_zcl_price_attr_names);
+
+/* Server Commands Received */
+#define zbee_zcl_price_srv_rx_cmd_names_VALUE_STRING_LIST(XXX) \
+ XXX(ZBEE_ZCL_CMD_ID_PRICE_GET_CURRENT_PRICE, 0x00, "Get Current Price" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PRICE_GET_SCHEDULED_PRICES, 0x01, "Get Scheduled Prices" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PRICE_GET_PRICE_ACKNOWLEDGEMENT, 0x02, "Price Acknowledgement" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PRICE_GET_BLOCK_PERIOD, 0x03, "Get Block Period(s)" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PRICE_GET_CONVERSION_FACTOR, 0x04, "Get Conversion Factor" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PRICE_GET_CALORIFIC_VALUE, 0x05, "Get Calorific Value" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PRICE_GET_TARIFF_INFORMATION, 0x06, "Get Tariff Information" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PRICE_GET_PRICE_MATRIX, 0x07, "Get Price Matrix" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PRICE_GET_BLOCK_THRESHOLDS, 0x08, "Get Block Thresholds" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PRICE_GET_CO2_VALUE, 0x09, "Get CO2 Value" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PRICE_GET_TIER_LABELS, 0x0A, "Get Tier Labels" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PRICE_GET_BILLING_PERIOD, 0x0B, "Get Billing Period" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PRICE_GET_CONSOLIDATED_BILL, 0x0C, "Get Consolidated Bill" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PRICE_CPP_EVENT_RESPONSE, 0x0D, "CPP Event Response" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PRICE_GET_CREDIT_PAYMENT, 0x0E, "Get Credit Payment" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PRICE_GET_CURRENCY_CONVERSION, 0x0F, "Get Currency Conversion" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PRICE_GET_TARIFF_CANCELLATION, 0x10, "Get Tariff Cancellation" )
+
+VALUE_STRING_ENUM(zbee_zcl_price_srv_rx_cmd_names);
+VALUE_STRING_ARRAY(zbee_zcl_price_srv_rx_cmd_names);
+
+/* Server Commands Generated */
+#define zbee_zcl_price_srv_tx_cmd_names_VALUE_STRING_LIST(XXX) \
+ XXX(ZBEE_ZCL_CMD_ID_PRICE_PUBLISH_PRICE, 0x00, "Publish Price" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PRICE_PUBLISH_BLOCK_PERIOD, 0x01, "Publish Block Period" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PRICE_PUBLISH_CONVERSION_FACTOR, 0x02, "Publish Conversion Factor" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PRICE_PUBLISH_CALORIFIC_VALUE, 0x03, "Publish Calorific Value" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PRICE_PUBLISH_TARIFF_INFORMATION, 0x04, "Publish Tariff Information" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PRICE_PUBLISH_PRICE_MATRIX, 0x05, "Publish Price Matrix" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PRICE_PUBLISH_BLOCK_THRESHOLDS, 0x06, "Publish Block Thresholds" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PRICE_PUBLISH_CO2_VALUE, 0x07, "Publish CO2 Value" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PRICE_PUBLISH_TIER_LABELS, 0x08, "Publish Tier Labels" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PRICE_PUBLISH_BILLING_PERIOD, 0x09, "PublishBillingPeriod" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PRICE_PUBLISH_CONSOLIDATED_BILL, 0x0A, "Publish Consolidated Bill" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PRICE_PUBLISH_CPP_EVENT, 0x0B, "Publish CPP Event" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PRICE_PUBLISH_CREDIT_PAYMENT, 0x0C, "Publish Credit Payment" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PRICE_PUBLISH_CURRENCY_CONVERSION, 0x0D, "Publish Currency Conversion" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PRICE_CANCEL_TARIFF, 0x0E, "Cancel Tariff" )
+
+VALUE_STRING_ENUM(zbee_zcl_price_srv_tx_cmd_names);
+VALUE_STRING_ARRAY(zbee_zcl_price_srv_tx_cmd_names);
+
+/*************************/
+/* Function Declarations */
+/*************************/
+void proto_register_zbee_zcl_price(void);
+void proto_reg_handoff_zbee_zcl_price(void);
+
+/* Attribute Dissector Helpers */
+static void dissect_zcl_price_attr_data (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type);
+
+/*************************/
+/* Global Variables */
+/*************************/
+
+static dissector_handle_t price_handle;
+
+/* Initialize the protocol and registered fields */
+static int proto_zbee_zcl_price = -1;
+
+static int hf_zbee_zcl_price_srv_tx_cmd_id = -1;
+static int hf_zbee_zcl_price_srv_rx_cmd_id = -1;
+static int hf_zbee_zcl_price_attr_id = -1;
+static int hf_zbee_zcl_price_attr_reporting_status = -1;
+
+/* Initialize the subtree pointers */
+static gint ett_zbee_zcl_price = -1;
+
+/*************************/
+/* Function Bodies */
+/*************************/
+
+/**
+ *This function is called by ZCL foundation dissector in order to decode
+ *
+ *@param tree pointer to data tree Wireshark uses to display packet.
+ *@param tvb pointer to buffer containing raw packet.
+ *@param offset pointer to buffer offset
+ *@param attr_id attribute identifier
+ *@param data_type attribute data type
+*/
+static void
+dissect_zcl_price_attr_data(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type)
+{
+ switch (attr_id) {
+ /* applies to all SE clusters */
+ case ZBEE_ZCL_ATTR_ID_SE_ATTR_REPORT_STATUS_PRICE:
+ proto_tree_add_item(tree, hf_zbee_zcl_price_attr_reporting_status, tvb, *offset, 1, ENC_NA);
+ *offset += 1;
+ break;
+
+ default: /* Catch all */
+ dissect_zcl_attr_data(tvb, tree, offset, data_type);
+ break;
+ }
+} /*dissect_zcl_price_attr_data*/
+
+/**
+ *ZigBee ZCL Price cluster dissector for wireshark.
+ *
+ *@param tvb pointer to buffer containing raw packet.
+ *@param pinfo pointer to packet information fields
+ *@param tree pointer to data tree Wireshark uses to display packet.
+*/
+static int
+dissect_zbee_zcl_price(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
+{
+ 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_price_srv_rx_cmd_names, "Unknown Command"),
+ zcl->tran_seqno);
+
+ /* Add the command ID. */
+ proto_tree_add_uint(tree, hf_zbee_zcl_price_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) {
+ proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_price, NULL, "Payload");
+
+ /* Call the appropriate command dissector */
+ switch (cmd_id) {
+
+ case ZBEE_ZCL_CMD_ID_PRICE_GET_CURRENT_PRICE:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_PRICE_GET_SCHEDULED_PRICES:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_PRICE_GET_PRICE_ACKNOWLEDGEMENT:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_PRICE_GET_BLOCK_PERIOD:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_PRICE_GET_CONVERSION_FACTOR:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_PRICE_GET_CALORIFIC_VALUE:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_PRICE_GET_TARIFF_INFORMATION:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_PRICE_GET_PRICE_MATRIX:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_PRICE_GET_BLOCK_THRESHOLDS:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_PRICE_GET_CO2_VALUE:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_PRICE_GET_TIER_LABELS:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_PRICE_GET_BILLING_PERIOD:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_PRICE_GET_CONSOLIDATED_BILL:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_PRICE_CPP_EVENT_RESPONSE:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_PRICE_GET_CREDIT_PAYMENT:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_PRICE_GET_CURRENCY_CONVERSION:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_PRICE_GET_TARIFF_CANCELLATION:
+ /* Add function to dissect payload */
+ 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_price_srv_tx_cmd_names, "Unknown Command"),
+ zcl->tran_seqno);
+
+ /* Add the command ID. */
+ proto_tree_add_uint(tree, hf_zbee_zcl_price_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) {
+ proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_price, NULL, "Payload");
+
+ /* Call the appropriate command dissector */
+ switch (cmd_id) {
+
+ case ZBEE_ZCL_CMD_ID_PRICE_PUBLISH_PRICE:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_PRICE_PUBLISH_BLOCK_PERIOD:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_PRICE_PUBLISH_CONVERSION_FACTOR:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_PRICE_PUBLISH_CALORIFIC_VALUE:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_PRICE_PUBLISH_TARIFF_INFORMATION:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_PRICE_PUBLISH_PRICE_MATRIX:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_PRICE_PUBLISH_BLOCK_THRESHOLDS:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_PRICE_PUBLISH_CO2_VALUE:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_PRICE_PUBLISH_TIER_LABELS:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_PRICE_PUBLISH_BILLING_PERIOD:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_PRICE_PUBLISH_CONSOLIDATED_BILL:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_PRICE_PUBLISH_CPP_EVENT:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_PRICE_PUBLISH_CREDIT_PAYMENT:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_PRICE_PUBLISH_CURRENCY_CONVERSION:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_PRICE_CANCEL_TARIFF:
+ /* Add function to dissect payload */
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+
+ return tvb_captured_length(tvb);
+} /*dissect_zbee_zcl_price*/
+
+/**
+ *This function registers the ZCL Price dissector
+ *
+*/
+void
+proto_register_zbee_zcl_price(void)
+{
+ static hf_register_info hf[] = {
+
+ { &hf_zbee_zcl_price_attr_id,
+ { "Attribute", "zbee_zcl_se.price.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_price_attr_names),
+ 0x0, NULL, HFILL } },
+
+ { &hf_zbee_zcl_price_attr_reporting_status, /* common to all SE clusters */
+ { "Attribute Reporting Status", "zbee_zcl_se.price.attr.attr_reporting_status",
+ FT_UINT8, BASE_HEX, VALS(zbee_zcl_se_reporting_status_names), 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_price_srv_tx_cmd_id,
+ { "Command", "zbee_zcl_se.price.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_price_srv_tx_cmd_names),
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_price_srv_rx_cmd_id,
+ { "Command", "zbee_zcl_se.price.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_price_srv_rx_cmd_names),
+ 0x00, NULL, HFILL } },
+
+ };
+
+ /* ZCL Price subtrees */
+ gint *ett[] = {
+ &ett_zbee_zcl_price,
+ };
+
+ /* Register the ZigBee ZCL Price cluster protocol name and description */
+ proto_zbee_zcl_price = proto_register_protocol("ZigBee ZCL Price", "ZCL Price", ZBEE_PROTOABBREV_ZCL_PRICE);
+ proto_register_field_array(proto_zbee_zcl_price, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
+
+ /* Register the ZigBee ZCL Price dissector. */
+ price_handle = register_dissector(ZBEE_PROTOABBREV_ZCL_PRICE, dissect_zbee_zcl_price, proto_zbee_zcl_price);
+} /*proto_register_zbee_zcl_price*/
+
+/**
+ *Hands off the Zcl Price dissector.
+ *
+*/
+void
+proto_reg_handoff_zbee_zcl_price(void)
+{
+ /* Register our dissector with the ZigBee application dissectors. */
+ dissector_add_uint("zbee.zcl.cluster", ZBEE_ZCL_CID_PRICE, price_handle);
+
+ zbee_zcl_init_cluster( proto_zbee_zcl_price,
+ ett_zbee_zcl_price,
+ ZBEE_ZCL_CID_PRICE,
+ hf_zbee_zcl_price_attr_id,
+ hf_zbee_zcl_price_srv_rx_cmd_id,
+ hf_zbee_zcl_price_srv_tx_cmd_id,
+ (zbee_zcl_fn_attr_data)dissect_zcl_price_attr_data
+ );
+} /*proto_reg_handoff_zbee_zcl_price*/
+
/* ########################################################################## */
/* #### (0x0702) METERING CLUSTER ########################################## */
/* ########################################################################## */
/* Server Commands Received */
#define zbee_zcl_met_srv_rx_cmd_names_VALUE_STRING_LIST(XXX) \
+ XXX(ZBEE_ZCL_CMD_ID_MET_GET_PROFILE, 0x00, "Get Profile" ) \
XXX(ZBEE_ZCL_CMD_ID_MET_REQUEST_MIRROR_RSP, 0x01, "Request Mirror Response" ) \
+ XXX(ZBEE_ZCL_CMD_ID_MET_MIRROR_REMOVED, 0x02, "Mirror Removed" ) \
+ XXX(ZBEE_ZCL_CMD_ID_MET_REQUEST_FAST_POLL_MODE, 0x03, "Request Fast Poll Mode" ) \
+ XXX(ZBEE_ZCL_CMD_ID_MET_SCHEDULE_SNAPSHOT, 0x04, "Schedule Snapshot" ) \
+ XXX(ZBEE_ZCL_CMD_ID_MET_TAKE_SNAPSHOT, 0x05, "Take Snapshot" ) \
XXX(ZBEE_ZCL_CMD_ID_MET_GET_SNAPSHOT, 0x06, "Get Snapshot" ) \
+ XXX(ZBEE_ZCL_CMD_ID_MET_START_SAMPLING, 0x07, "Start Sampling" ) \
XXX(ZBEE_ZCL_CMD_ID_MET_GET_SAMPLED_DATA, 0x08, "Get Sampled Data" ) \
- XXX(ZBEE_ZCL_CMD_ID_MET_LOCAL_CHANGE_SUPPLY, 0x0C, "Local Change Supply" )
+ XXX(ZBEE_ZCL_CMD_ID_MET_MIRROR_REPORT_ATTRIBUTE_RESPONSE, 0x09, "Mirror Report Attribute Response" ) \
+ XXX(ZBEE_ZCL_CMD_ID_MET_RESET_LOAD_LIMIT_COUNTER, 0x0A, "Reset Load Limit Counter" ) \
+ XXX(ZBEE_ZCL_CMD_ID_MET_CHANGE_SUPPLY, 0x0B, "Change Supply" ) \
+ XXX(ZBEE_ZCL_CMD_ID_MET_LOCAL_CHANGE_SUPPLY, 0x0C, "Local Change Supply" ) \
+ XXX(ZBEE_ZCL_CMD_ID_MET_SET_SUPPLY_STATUS, 0x0D, "Set Supply Status" ) \
+ XXX(ZBEE_ZCL_CMD_ID_MET_SET_UNCONTROLLED_FLOW_THRESHOLD, 0x0E, "Set Uncontrolled Flow Threshold" )
VALUE_STRING_ENUM(zbee_zcl_met_srv_rx_cmd_names);
VALUE_STRING_ARRAY(zbee_zcl_met_srv_rx_cmd_names);
/* Server Commands Generated */
#define zbee_zcl_met_srv_tx_cmd_names_VALUE_STRING_LIST(XXX) \
+ XXX(ZBEE_ZCL_CMD_ID_MET_GET_PROFILE_RESPONSE, 0x00, "Get Profile Response" ) \
XXX(ZBEE_ZCL_CMD_ID_MET_REQUEST_MIRROR, 0x01, "Request Mirror" ) \
+ XXX(ZBEE_ZCL_CMD_ID_MET_REMOVE_MIRROR, 0x02, "Remove Mirror" ) \
+ XXX(ZBEE_ZCL_CMD_ID_MET_REQUEST_FAST_POLL_MODE_RESPONSE, 0x03, "Request Fast Poll Mode Response" ) \
+ XXX(ZBEE_ZCL_CMD_ID_MET_SCHEDULE_SNAPSHOT_RESPONSE, 0x04, "Schedule Snapshot Response" ) \
+ XXX(ZBEE_ZCL_CMD_ID_MET_TAKE_SNAPSHOT_RESPONSE, 0x05, "Take Snapshot Response" ) \
XXX(ZBEE_ZCL_CMD_ID_MET_PUBLISH_SNAPSHOT, 0x06, "Publish Snapshot" ) \
XXX(ZBEE_ZCL_CMD_ID_MET_GET_SAMPLED_DATA_RSP, 0x07, "Get Sampled Data Response" ) \
XXX(ZBEE_ZCL_CMD_ID_MET_CONFIGURE_MIRROR, 0x08, "Configure Mirror" ) \
- XXX(ZBEE_ZCL_CMD_ID_MET_GET_NOTIFIED_MESSAGE, 0x0B, "Get Notified Message" )
+ XXX(ZBEE_ZCL_CMD_ID_MET_CONFIGURE_NOTIFICATION_SCHEME, 0x09, "Configure Notification Scheme" ) \
+ XXX(ZBEE_ZCL_CMD_ID_MET_CONFIGURE_NOTIFICATION_FLAG, 0x0A, "Configure Notification Flag" ) \
+ XXX(ZBEE_ZCL_CMD_ID_MET_GET_NOTIFIED_MESSAGE, 0x0B, "Get Notified Message" ) \
+ XXX(ZBEE_ZCL_CMD_ID_MET_SUPPLY_STATUS_RESPONSE, 0x0C, "Supply Status Response" ) \
+ XXX(ZBEE_ZCL_CMD_ID_MET_START_SAMPLING_RESPONSE, 0x0D, "Start Sampling Response" )
VALUE_STRING_ENUM(zbee_zcl_met_srv_tx_cmd_names);
VALUE_STRING_ARRAY(zbee_zcl_met_srv_tx_cmd_names);
/* Attribute Dissector Helpers */
static void dissect_zcl_met_attr_data (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type);
+/* Command Dissector Helpers */
+static void dissect_zcl_met_request_mirror_rsp (tvbuff_t *tvb, proto_tree *tree, guint *offset);
+static void dissect_zcl_met_get_snapshot (tvbuff_t *tvb, proto_tree *tree, guint *offset);
+static void dissect_zcl_met_get_sampled_data (tvbuff_t *tvb, proto_tree *tree, guint *offset);
+static void dissect_zcl_met_local_change_supply (tvbuff_t *tvb, proto_tree *tree, guint *offset);
+static void dissect_zcl_met_publish_snapshot (tvbuff_t *tvb, proto_tree *tree, guint *offset);
+static void dissect_zcl_met_get_sampled_data_rsp (tvbuff_t *tvb, proto_tree *tree, guint *offset);
+static void dissect_zcl_met_configure_mirror (tvbuff_t *tvb, proto_tree *tree, guint *offset);
+static void dissect_zcl_met_get_notified_msg (tvbuff_t *tvb, proto_tree *tree, guint *offset);
+
/*************************/
/* Global Variables */
/*************************/
static int hf_zbee_zcl_met_srv_rx_cmd_id = -1;
static int hf_zbee_zcl_met_attr_id = -1;
static int hf_zbee_zcl_met_attr_reporting_status = -1;
+static int hf_zbee_zcl_met_request_mirror_rsp_endpoint_id = -1;
+static int hf_zbee_zcl_met_get_snapshot_start_time = -1;
+static int hf_zbee_zcl_met_get_snapshot_end_time = -1;
+static int hf_zbee_zcl_met_get_snapshot_snapshot_offset = -1;
+static int hf_zbee_zcl_met_get_snapshot_snapshot_cause = -1;
+static int hf_zbee_zcl_met_get_sampled_data_sample_id = -1;
+static int hf_zbee_zcl_met_get_sampled_data_sample_start_time = -1;
+static int hf_zbee_zcl_met_get_sampled_data_sample_type = -1;
+static int hf_zbee_zcl_met_get_sampled_data_number_of_samples = -1;
+static int hf_zbee_zcl_met_local_change_supply_supply_status = -1;
+static int hf_zbee_zcl_met_publish_snapshot_snapshot_id = -1;
+static int hf_zbee_zcl_met_publish_snapshot_snapshot_time = -1;
+static int hf_zbee_zcl_met_publish_snapshot_snapshots_found = -1;
+static int hf_zbee_zcl_met_publish_snapshot_cmd_index = -1;
+static int hf_zbee_zcl_met_publish_snapshot_total_commands = -1;
+static int hf_zbee_zcl_met_publish_snapshot_snapshot_cause = -1;
+static int hf_zbee_zcl_met_publish_snapshot_snapshot_payload_type = -1;
+static int hf_zbee_zcl_met_publish_snapshot_snapshot_sub_payload = -1;
+static int hf_zbee_zcl_met_get_sampled_data_rsp_sample_id = -1;
+static int hf_zbee_zcl_met_get_sampled_data_rsp_sample_start_time = -1;
+static int hf_zbee_zcl_met_get_sampled_data_rsp_sample_type = -1;
+static int hf_zbee_zcl_met_get_sampled_data_rsp_sample_request_interval = -1;
+static int hf_zbee_zcl_met_get_sampled_data_rsp_sample_number_of_samples = -1;
+static int hf_zbee_zcl_met_get_sampled_data_rsp_sample_samples = -1;
+static int hf_zbee_zcl_met_configure_mirror_issuer_event_id = -1;
+static int hf_zbee_zcl_met_configure_mirror_reporting_interval = -1;
+static int hf_zbee_zcl_met_configure_mirror_mirror_notification_reporting = -1;
+static int hf_zbee_zcl_met_configure_mirror_notification_scheme = -1;
+static int hf_zbee_zcl_met_get_notified_msg_notification_scheme = -1;
+static int hf_zbee_zcl_met_get_notified_msg_notification_flag_attribute_id = -1;
+static int hf_zbee_zcl_met_get_notified_msg_notification_flags = -1;
/* Initialize the subtree pointers */
static gint ett_zbee_zcl_met = -1;
static int
dissect_zbee_zcl_met(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
+ proto_tree *payload_tree;
zbee_zcl_packet *zcl;
guint offset = 0;
guint8 cmd_id;
zcl->tran_seqno);
/* Add the command ID. */
- proto_tree_add_item(tree, hf_zbee_zcl_met_srv_rx_cmd_id, tvb, offset, 1, cmd_id);
+ proto_tree_add_uint(tree, hf_zbee_zcl_met_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) {
- proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_met, NULL, "Payload");
+ payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_met, NULL, "Payload");
/* Call the appropriate command dissector */
switch (cmd_id) {
case ZBEE_ZCL_CMD_ID_MET_REQUEST_MIRROR_RSP:
- /* Add function to dissect payload */
+ dissect_zcl_met_request_mirror_rsp(tvb, payload_tree, &offset);
break;
case ZBEE_ZCL_CMD_ID_MET_GET_SNAPSHOT:
- /* Add function to dissect payload */
+ dissect_zcl_met_get_snapshot(tvb, payload_tree, &offset);
break;
case ZBEE_ZCL_CMD_ID_MET_GET_SAMPLED_DATA:
- /* Add function to dissect payload */
+ dissect_zcl_met_get_sampled_data(tvb, payload_tree, &offset);
break;
case ZBEE_ZCL_CMD_ID_MET_LOCAL_CHANGE_SUPPLY:
- /* Add function to dissect payload */
+ dissect_zcl_met_local_change_supply(tvb, payload_tree, &offset);
break;
default:
zcl->tran_seqno);
/* Add the command ID. */
- proto_tree_add_item(tree, hf_zbee_zcl_met_srv_tx_cmd_id, tvb, offset, 1, cmd_id);
+ proto_tree_add_uint(tree, hf_zbee_zcl_met_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) {
- proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_met, NULL, "Payload");
+ payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_met, NULL, "Payload");
/* Call the appropriate command dissector */
switch (cmd_id) {
break;
case ZBEE_ZCL_CMD_ID_MET_PUBLISH_SNAPSHOT:
- /* Add function to dissect payload */
+ dissect_zcl_met_publish_snapshot(tvb, payload_tree, &offset);
break;
case ZBEE_ZCL_CMD_ID_MET_GET_SAMPLED_DATA_RSP:
- /* Add function to dissect payload */
+ dissect_zcl_met_get_sampled_data_rsp(tvb, payload_tree, &offset);
break;
case ZBEE_ZCL_CMD_ID_MET_CONFIGURE_MIRROR:
- /* Add function to dissect payload */
+ dissect_zcl_met_configure_mirror(tvb, payload_tree, &offset);
break;
case ZBEE_ZCL_CMD_ID_MET_GET_NOTIFIED_MESSAGE:
- /* Add function to dissect payload */
+ dissect_zcl_met_get_notified_msg(tvb, payload_tree, &offset);
break;
default:
} /*dissect_zbee_zcl_met*/
/**
- *This function registers the ZCL Metering dissector
+ *This function manages the Request Mirror Response payload
*
+ *@param tvb pointer to buffer containing raw packet.
+ *@param tree pointer to data tree Wireshark uses to display packet.
+ *@param offset pointer to offset from caller
*/
-void
+static void
+dissect_zcl_met_request_mirror_rsp(tvbuff_t *tvb, proto_tree *tree, guint *offset)
+{
+ /* EndPoint ID */
+ proto_tree_add_item(tree, hf_zbee_zcl_met_request_mirror_rsp_endpoint_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
+ *offset += 2;
+} /*dissect_zcl_met_get_snapshot*/
+
+/**
+ *This function manages the Get Snapshot payload
+ *
+ *@param tvb pointer to buffer containing raw packet.
+ *@param tree pointer to data tree Wireshark uses to display packet.
+ *@param offset pointer to offset from caller
+*/
+static void
+dissect_zcl_met_get_snapshot(tvbuff_t *tvb, proto_tree *tree, guint *offset)
+{
+ nstime_t start_time;
+ nstime_t end_time;
+ gint rem_len = tvb_reported_length_remaining(tvb, *offset);
+
+ /* Start Time */
+ start_time.secs = (time_t)tvb_get_letohl(tvb, *offset) + ZBEE_ZCL_NSTIME_UTC_OFFSET;
+ start_time.nsecs = 0;
+ proto_tree_add_time(tree, hf_zbee_zcl_met_get_snapshot_start_time, tvb, *offset, 4, &start_time);
+ *offset += 4;
+
+ if (rem_len > 9) {
+ /* End Time - not part of SE 1.1b specification */
+ end_time.secs = (time_t)tvb_get_letohl(tvb, *offset) + ZBEE_ZCL_NSTIME_UTC_OFFSET;
+ end_time.nsecs = 0;
+ proto_tree_add_time(tree, hf_zbee_zcl_met_get_snapshot_end_time, tvb, *offset, 4, &end_time);
+ *offset += 4;
+ }
+
+ /* Snapshot Offset */
+ proto_tree_add_item(tree, hf_zbee_zcl_met_get_snapshot_snapshot_offset, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
+ *offset += 1;
+
+ /* Snapshot Cause */
+ proto_tree_add_item(tree, hf_zbee_zcl_met_get_snapshot_snapshot_cause, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
+ *offset += 4;
+} /*dissect_zcl_met_get_snapshot*/
+
+/**
+ *This function manages the Get Sampled Data payload
+ *
+ *@param tvb pointer to buffer containing raw packet.
+ *@param tree pointer to data tree Wireshark uses to display packet.
+ *@param offset pointer to offset from caller
+*/
+static void
+dissect_zcl_met_get_sampled_data(tvbuff_t *tvb, proto_tree *tree, guint *offset)
+{
+ nstime_t sample_time;
+
+ /* Sample ID */
+ proto_tree_add_item(tree, hf_zbee_zcl_met_get_sampled_data_sample_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
+ *offset += 2;
+
+ /* Sample Start Time */
+ sample_time.secs = (time_t)tvb_get_letohl(tvb, *offset) + ZBEE_ZCL_NSTIME_UTC_OFFSET;
+ sample_time.nsecs = 0;
+ proto_tree_add_time(tree, hf_zbee_zcl_met_get_sampled_data_sample_start_time, tvb, *offset, 4, &sample_time);
+ *offset += 4;
+
+ /* Sample Type */
+ proto_tree_add_item(tree, hf_zbee_zcl_met_get_sampled_data_sample_type, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
+ *offset += 1;
+
+ /* Number of Samples */
+ proto_tree_add_item(tree, hf_zbee_zcl_met_get_sampled_data_number_of_samples, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
+ *offset += 2;
+} /*dissect_zcl_met_get_sampled_data*/
+
+/**
+ *This function manages the Local Change Supply payload
+ *
+ *@param tvb pointer to buffer containing raw packet.
+ *@param tree pointer to data tree Wireshark uses to display packet.
+ *@param offset pointer to offset from caller
+*/
+static void
+dissect_zcl_met_local_change_supply(tvbuff_t *tvb, proto_tree *tree, guint *offset)
+{
+ /* Proposed Supply Status */
+ proto_tree_add_item(tree, hf_zbee_zcl_met_local_change_supply_supply_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
+ *offset += 1;
+} /*dissect_zcl_met_local_change_supply*/
+
+/**
+ *This function manages the Publish Snapshot payload
+ *
+ *@param tvb pointer to buffer containing raw packet.
+ *@param tree pointer to data tree Wireshark uses to display packet.
+ *@param offset pointer to offset from caller
+*/
+static void
+dissect_zcl_met_publish_snapshot(tvbuff_t *tvb, proto_tree *tree, guint *offset)
+{
+ nstime_t snapshot_time;
+ gint rem_len;
+
+ /* Snapshot ID */
+ proto_tree_add_item(tree, hf_zbee_zcl_met_publish_snapshot_snapshot_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
+ *offset += 4;
+
+ /* Snapshot Time */
+ snapshot_time.secs = (time_t)tvb_get_letohl(tvb, *offset) + ZBEE_ZCL_NSTIME_UTC_OFFSET;
+ snapshot_time.nsecs = 0;
+ proto_tree_add_time(tree, hf_zbee_zcl_met_publish_snapshot_snapshot_time, tvb, *offset, 4, &snapshot_time);
+ *offset += 4;
+
+ /* Total Snapshots Found */
+ proto_tree_add_item(tree, hf_zbee_zcl_met_publish_snapshot_snapshots_found, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
+ *offset += 1;
+
+ /* Command Index */
+ proto_tree_add_item(tree, hf_zbee_zcl_met_publish_snapshot_cmd_index, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
+ *offset += 1;
+
+ /* Total Number of Commands */
+ proto_tree_add_item(tree, hf_zbee_zcl_met_publish_snapshot_total_commands, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
+ *offset += 1;
+
+ /* Snapshot Cause */
+ proto_tree_add_item(tree, hf_zbee_zcl_met_publish_snapshot_snapshot_cause, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
+ *offset += 4;
+
+ /* Snapshot Payload Type */
+ proto_tree_add_item(tree, hf_zbee_zcl_met_publish_snapshot_snapshot_payload_type, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
+ *offset += 1;
+
+ /* Snapshot Sub-Payload */
+ rem_len = tvb_reported_length_remaining(tvb, *offset);
+ proto_tree_add_item(tree, hf_zbee_zcl_met_publish_snapshot_snapshot_sub_payload, tvb, *offset, rem_len, ENC_NA);
+ *offset += rem_len;
+} /*dissect_zcl_met_publish_snapshot*/
+
+/**
+ *This function manages the Get Sampled Data Response payload
+ *
+ *@param tvb pointer to buffer containing raw packet.
+ *@param tree pointer to data tree Wireshark uses to display packet.
+ *@param offset pointer to offset from caller
+*/
+static void
+dissect_zcl_met_get_sampled_data_rsp(tvbuff_t *tvb, proto_tree *tree, guint *offset)
+{
+ nstime_t sample_start_time;
+ gint rem_len;
+
+ /* Snapshot ID */
+ proto_tree_add_item(tree, hf_zbee_zcl_met_get_sampled_data_rsp_sample_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
+ *offset += 2;
+
+ /* Sample Start Time */
+ sample_start_time.secs = (time_t)tvb_get_letohl(tvb, *offset) + ZBEE_ZCL_NSTIME_UTC_OFFSET;
+ sample_start_time.nsecs = 0;
+ proto_tree_add_time(tree, hf_zbee_zcl_met_get_sampled_data_rsp_sample_start_time, tvb, *offset, 4, &sample_start_time);
+ *offset += 4;
+
+ /* Sample Type */
+ proto_tree_add_item(tree, hf_zbee_zcl_met_get_sampled_data_rsp_sample_type, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
+ *offset += 1;
+
+ /* Sample Request Interval */
+ proto_tree_add_item(tree, hf_zbee_zcl_met_get_sampled_data_rsp_sample_request_interval, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
+ *offset += 2;
+
+ /* Number of Samples */
+ proto_tree_add_item(tree, hf_zbee_zcl_met_get_sampled_data_rsp_sample_number_of_samples, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
+ *offset += 2;
+
+ /* Samples */
+ rem_len = tvb_reported_length_remaining(tvb, *offset);
+ while (rem_len >= 3) {
+ guint32 val = tvb_get_guint24(tvb, *offset, ENC_LITTLE_ENDIAN);
+ proto_tree_add_uint(tree, hf_zbee_zcl_met_get_sampled_data_rsp_sample_samples, tvb, *offset, 3, val);
+ *offset += 3;
+ rem_len -= 3;
+ }
+} /*dissect_zcl_met_get_sampled_data_rsp*/
+
+/**
+ *This function manages the Configure Mirror payload
+ *
+ *@param tvb pointer to buffer containing raw packet.
+ *@param tree pointer to data tree Wireshark uses to display packet.
+ *@param offset pointer to offset from caller
+*/
+static void
+dissect_zcl_met_configure_mirror(tvbuff_t *tvb, proto_tree *tree, guint *offset)
+{
+ /* Issuer Event ID */
+ proto_tree_add_item(tree, hf_zbee_zcl_met_configure_mirror_issuer_event_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
+ *offset += 4;
+
+ /* Reporting Interval */
+ proto_tree_add_item(tree, hf_zbee_zcl_met_configure_mirror_reporting_interval, tvb, *offset, 3, ENC_LITTLE_ENDIAN);
+ *offset += 3;
+
+ /* Mirror Notification Reporting */
+ proto_tree_add_item(tree, hf_zbee_zcl_met_configure_mirror_mirror_notification_reporting, tvb, *offset, 1, ENC_NA);
+ *offset += 1;
+
+ /* Notification Scheme */
+ proto_tree_add_item(tree, hf_zbee_zcl_met_configure_mirror_notification_scheme, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
+ *offset += 1;
+} /*dissect_zcl_met_configure_mirror*/
+
+/**
+ *This function manages the Get Notified Message payload
+ *
+ *@param tvb pointer to buffer containing raw packet.
+ *@param tree pointer to data tree Wireshark uses to display packet.
+ *@param offset pointer to offset from caller
+*/
+static void
+dissect_zcl_met_get_notified_msg(tvbuff_t *tvb, proto_tree *tree, guint *offset)
+{
+ /* Notification Scheme */
+ proto_tree_add_item(tree, hf_zbee_zcl_met_get_notified_msg_notification_scheme, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
+ *offset += 1;
+
+ /* Notification Flag attribute ID */
+ proto_tree_add_item(tree, hf_zbee_zcl_met_get_notified_msg_notification_flag_attribute_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
+ *offset += 2;
+
+ /* Notification Flags #N */
+ proto_tree_add_item(tree, hf_zbee_zcl_met_get_notified_msg_notification_flags, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
+ *offset += 4;
+} /*dissect_zcl_met_get_notified_msg*/
+
+/**
+ *This function registers the ZCL Metering dissector
+ *
+*/
+void
proto_register_zbee_zcl_met(void)
{
static hf_register_info hf[] = {
{ "Command", "zbee_zcl_se.met.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_met_srv_rx_cmd_names),
0x00, NULL, HFILL } },
+ { &hf_zbee_zcl_met_request_mirror_rsp_endpoint_id,
+ { "EndPoint ID", "zbee_zcl_se.met.request_mirror_rsp.endpoint_id", FT_UINT16, BASE_DEC, NULL,
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_met_get_snapshot_start_time,
+ { "Start Time", "zbee_zcl_se.met.get_snapshot.start_time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL,
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_met_get_snapshot_end_time,
+ { "End Time", "zbee_zcl_se.met.get_snapshot.end_time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL,
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_met_get_snapshot_snapshot_offset,
+ { "Snapshot Offset", "zbee_zcl_se.met.get_snapshot.snapshot_offset", FT_UINT8, BASE_DEC, NULL,
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_met_get_snapshot_snapshot_cause,
+ { "Snapshot Cause", "zbee_zcl_se.met.get_snapshot.snapshot_cause", FT_UINT32, BASE_HEX, NULL,
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_met_get_sampled_data_sample_id,
+ { "Sample ID", "zbee_zcl_se.met.get_sampled_data.sample_id", FT_UINT16, BASE_DEC, NULL,
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_met_get_sampled_data_sample_start_time,
+ { "Sample Start Time", "zbee_zcl_se.met.get_sampled_data.sample_start_time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL,
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_met_get_sampled_data_sample_type,
+ { "Sample Type", "zbee_zcl_se.met.get_sampled_data.sample_type", FT_UINT8, BASE_DEC, NULL,
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_met_get_sampled_data_number_of_samples,
+ { "Number of Samples", "zbee_zcl_se.met.get_sampled_data.number_of_samples", FT_UINT16, BASE_DEC, NULL,
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_met_local_change_supply_supply_status,
+ { "Proposed Supply Status", "zbee_zcl_se.met.local_change_supply.supply_status", FT_UINT8, BASE_DEC, NULL,
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_met_publish_snapshot_snapshot_id,
+ { "Snapshot ID", "zbee_zcl_se.met.publish_snapshot.snapshot_id", FT_UINT32, BASE_DEC, NULL,
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_met_publish_snapshot_snapshot_time,
+ { "Snapshot Time", "zbee_zcl_se.met.publish_snapshot.snapshot_time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL,
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_met_publish_snapshot_snapshots_found,
+ { "Total Snapshots Found", "zbee_zcl_se.met.publish_snapshot.snapshots_found", FT_UINT8, BASE_DEC, NULL,
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_met_publish_snapshot_cmd_index,
+ { "Command Index", "zbee_zcl_se.met.publish_snapshot.command_index", FT_UINT8, BASE_DEC, NULL,
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_met_publish_snapshot_total_commands,
+ { "Total Number of Commands", "zbee_zcl_se.met.publish_snapshot.total_commands", FT_UINT8, BASE_DEC, NULL,
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_met_publish_snapshot_snapshot_cause,
+ { "Snapshot Cause", "zbee_zcl_se.met.publish_snapshot.snapshot_cause", FT_UINT32, BASE_HEX, NULL,
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_met_publish_snapshot_snapshot_payload_type,
+ { "Snapshot Payload Type", "zbee_zcl_se.met.publish_snapshot.payload_type", FT_UINT8, BASE_DEC, NULL,
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_met_publish_snapshot_snapshot_sub_payload,
+ { "Snapshot Sub-Payload", "zbee_zcl_se.met.publish_snapshot.sub_payload", FT_BYTES, BASE_NONE, NULL,
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_met_get_sampled_data_rsp_sample_id,
+ { "Sample ID", "zbee_zcl_se.met.get_sampled_data_rsp.sample_id", FT_UINT16, BASE_DEC, NULL,
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_met_get_sampled_data_rsp_sample_start_time,
+ { "Sample Start Time", "zbee_zcl_se.met.get_sampled_data_rsp.sample_start_time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL,
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_met_get_sampled_data_rsp_sample_type,
+ { "Sample Type", "zbee_zcl_se.met.get_sampled_data_rsp.sample_type", FT_UINT8, BASE_DEC, NULL,
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_met_get_sampled_data_rsp_sample_request_interval,
+ { "Sample Request Interval", "zbee_zcl_se.met.get_sampled_data_rsp.sample_request_interval", FT_UINT16, BASE_DEC, NULL,
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_met_get_sampled_data_rsp_sample_number_of_samples,
+ { "Number of Samples", "zbee_zcl_se.met.get_sampled_data_rsp.number_of_samples", FT_UINT16, BASE_DEC, NULL,
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_met_get_sampled_data_rsp_sample_samples,
+ { "Samples", "zbee_zcl_se.met.get_sampled_data_rsp.samples", FT_UINT24, BASE_DEC, NULL,
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_met_configure_mirror_issuer_event_id,
+ { "Issuer Event ID", "zbee_zcl_se.met.configure_mirror.issuer_event_id", FT_UINT32, BASE_DEC, NULL,
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_met_configure_mirror_reporting_interval,
+ { "Reporting Interval", "zbee_zcl_se.met.configure_mirror.reporting_interval", FT_UINT24, BASE_DEC, NULL,
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_met_configure_mirror_mirror_notification_reporting,
+ { "Mirror Notification Reporting", "zbee_zcl_se.met.configure_mirror.mirror_notification_reporting", FT_BOOLEAN, BASE_NONE, NULL,
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_met_configure_mirror_notification_scheme,
+ { "Notification Scheme", "zbee_zcl_se.met.configure_mirror.notification_scheme", FT_UINT8, BASE_DEC, NULL,
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_met_get_notified_msg_notification_scheme,
+ { "Notification Scheme", "zbee_zcl_se.met.get_notified_msg.notification_scheme", FT_UINT8, BASE_DEC, NULL,
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_met_get_notified_msg_notification_flag_attribute_id,
+ { "Notification Flag attribute ID", "zbee_zcl_se.met.get_notified_msg.notification_flag_attribute_id", FT_UINT16, BASE_DEC, NULL,
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_met_get_notified_msg_notification_flags,
+ { "Notification Flags", "zbee_zcl_se.met.get_notified_msg.notification_flags", FT_UINT32, BASE_HEX, NULL,
+ 0x00, NULL, HFILL } }
};
/* ZCL Metering subtrees */
zcl->tran_seqno);
/* Add the command ID. */
- proto_tree_add_item(tree, hf_zbee_zcl_msg_srv_rx_cmd_id, tvb, offset, 1, cmd_id);
+ proto_tree_add_uint(tree, hf_zbee_zcl_msg_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);
zcl->tran_seqno);
/* Add the command ID. */
- proto_tree_add_item(tree, hf_zbee_zcl_msg_srv_tx_cmd_id, tvb, offset, 1, cmd_id);
+ proto_tree_add_uint(tree, hf_zbee_zcl_msg_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);
nstime_t impl_time;
/* Retrieve "Confirmation Time" field */
- impl_time.secs = tvb_get_letohl(tvb, *offset) + ZBEE_ZCL_NSTIME_UTC_OFFSET;
+ impl_time.secs = (time_t)tvb_get_letohl(tvb, *offset) + ZBEE_ZCL_NSTIME_UTC_OFFSET;
impl_time.nsecs = 0;
proto_tree_add_time(tree, hf_zbee_zcl_msg_implementation_time, tvb, *offset, 4, &impl_time);
*offset += 4;
nstime_t impl_time;
/* Earliest Implementation Time */
- impl_time.secs = tvb_get_letohl(tvb, *offset) + ZBEE_ZCL_NSTIME_UTC_OFFSET;
+ impl_time.secs = (time_t)tvb_get_letohl(tvb, *offset) + ZBEE_ZCL_NSTIME_UTC_OFFSET;
impl_time.nsecs = 0;
proto_tree_add_time(tree, hf_zbee_zcl_msg_earliest_time, tvb, *offset, 4, &impl_time);
*offset += 4;
*offset += 4;
/* Retrieve "Confirmation Time" field */
- confirm_time.secs = tvb_get_letohl(tvb, *offset) + ZBEE_ZCL_NSTIME_UTC_OFFSET;
+ confirm_time.secs = (time_t)tvb_get_letohl(tvb, *offset) + ZBEE_ZCL_NSTIME_UTC_OFFSET;
confirm_time.nsecs = 0;
proto_tree_add_time(tree, hf_zbee_zcl_msg_confirm_time, tvb, *offset, 4, &confirm_time);
*offset += 4;
} /*decode_zcl_msg_duration*/
/**
- *This function decodes start time, with peculiarity case for
+ * This function decodes start time, with a special case for
+ * ZBEE_ZCL_MSG_START_TIME_NOW.
*
- *@param s string to display
- *@param value value to decode
+ * @param s string to display
+ * @param value value to decode
*/
static void
decode_zcl_msg_start_time(gchar *s, guint32 value)
g_snprintf(s, ITEM_LABEL_LENGTH, "Now");
else {
gchar *start_time;
- value += ZBEE_ZCL_NSTIME_UTC_OFFSET;
- start_time = abs_time_secs_to_str (NULL, value, ABSOLUTE_TIME_LOCAL, TRUE);
+ time_t epoch_time = (time_t)value + ZBEE_ZCL_NSTIME_UTC_OFFSET;
+ start_time = abs_time_secs_to_str (NULL, epoch_time, ABSOLUTE_TIME_LOCAL, TRUE);
g_snprintf(s, ITEM_LABEL_LENGTH, "%s", start_time);
wmem_free(NULL, start_time);
}
zcl->tran_seqno);
/* Add the command ID. */
- proto_tree_add_item(tree, hf_zbee_zcl_tun_srv_rx_cmd_id, tvb, offset, 1, cmd_id);
+ proto_tree_add_uint(tree, hf_zbee_zcl_tun_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);
zcl->tran_seqno);
/* Add the command ID. */
- proto_tree_add_item(tree, hf_zbee_zcl_tun_srv_tx_cmd_id, tvb, offset, 1, cmd_id);
+ proto_tree_add_uint(tree, hf_zbee_zcl_tun_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);
/* Server Commands Received */
#define zbee_zcl_pp_srv_rx_cmd_names_VALUE_STRING_LIST(XXX) \
XXX(ZBEE_ZCL_CMD_ID_PP_SELECT_AVAILABLE_EMERGENCY_CREDIT, 0x00, "Select Available Emergency Credit" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PP_CHANGE_DEBT, 0x02, "Change Debt" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PP_EMERGENCY_CREDIT_SETUP, 0x03, "Emergency Credit Setup" ) \
XXX(ZBEE_ZCL_CMD_ID_PP_CONSUMER_TOP_UP, 0x04, "Consumer Top Up" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PP_CREDIT_ADJUSTMENT, 0x05, "Credit Adjustment" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PP_CHANGE_PAYMENT_MODE, 0x06, "Change Payment Mode" ) \
XXX(ZBEE_ZCL_CMD_ID_PP_GET_PREPAY_SNAPTSHOT, 0x07, "Get Prepay Snapshot" ) \
XXX(ZBEE_ZCL_CMD_ID_PP_GET_TOP_UP_LOG, 0x08, "Get Top Up Log" ) \
- XXX(ZBEE_ZCL_CMD_ID_PP_GET_DEBT_REPAYMENT_LOG, 0x0A, "Get Debt Repayment Log" )
+ XXX(ZBEE_ZCL_CMD_ID_PP_SET_LOW_CREDIT_WARNING_LEVEL, 0x09, "Set Low Credit Warning Level" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PP_GET_DEBT_REPAYMENT_LOG, 0x0A, "Get Debt Repayment Log" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PP_SET_MAXIMUM_CREDIT_LIMIT, 0x0B, "Set Maximum Credit Limit" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PP_SET_OVERALL_DEBT_CAP, 0x0C, "Set Overall Debt Cap" )
VALUE_STRING_ENUM(zbee_zcl_pp_srv_rx_cmd_names);
VALUE_STRING_ARRAY(zbee_zcl_pp_srv_rx_cmd_names);
/* Server Commands Generated */
#define zbee_zcl_pp_srv_tx_cmd_names_VALUE_STRING_LIST(XXX) \
XXX(ZBEE_ZCL_CMD_ID_PP_PUBLISH_PREPAY_SNAPSHOT, 0x01, "Publish Prepay Snapshot" ) \
+ XXX(ZBEE_ZCL_CMD_ID_PP_CHANGE_PAYMENT_MODE_RESPONSE, 0x02, "Change Payment Mode Response" ) \
XXX(ZBEE_ZCL_CMD_ID_PP_CONSUMER_TOP_UP_RESPONSE, 0x03, "Consumer Top Up Response" ) \
XXX(ZBEE_ZCL_CMD_ID_PP_PUBLISH_TOP_UP_LOG, 0x05, "Publish Top Up Log" ) \
XXX(ZBEE_ZCL_CMD_ID_PP_PUBLISH_DEBT_LOG, 0x06, "Publish Debt Log" )
zcl->tran_seqno);
/* Add the command ID. */
- proto_tree_add_item(tree, hf_zbee_zcl_pp_srv_rx_cmd_id, tvb, offset, 1, cmd_id);
+ proto_tree_add_uint(tree, hf_zbee_zcl_pp_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);
zcl->tran_seqno);
/* Add the command ID. */
- proto_tree_add_item(tree, hf_zbee_zcl_pp_srv_tx_cmd_id, tvb, offset, 1, cmd_id);
+ proto_tree_add_uint(tree, hf_zbee_zcl_pp_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);
);
} /*proto_reg_handoff_zbee_zcl_pp*/
+/* ########################################################################## */
+/* #### (0x0707) CALENDAR CLUSTER ########################################### */
+/* ########################################################################## */
+
+/* Attributes */
+#define zbee_zcl_calendar_attr_names_VALUE_STRING_LIST(XXX) \
+/* Auxiliary Switch Label Attribute Set */ \
+ XXX(ZBEE_ZCL_ATTR_ID_CAL_AUX_SWITCH_1_LABEL, 0x0000, "Aux Switch 1 Label" ) \
+ XXX(ZBEE_ZCL_ATTR_ID_CAL_AUX_SWITCH_2_LABEL, 0x0001, "Aux Switch 2 Label" ) \
+ XXX(ZBEE_ZCL_ATTR_ID_CAL_AUX_SWITCH_3_LABEL, 0x0002, "Aux Switch 3 Label" ) \
+ XXX(ZBEE_ZCL_ATTR_ID_CAL_AUX_SWITCH_4_LABEL, 0x0003, "Aux Switch 4 Label" ) \
+ XXX(ZBEE_ZCL_ATTR_ID_CAL_AUX_SWITCH_5_LABEL, 0x0004, "Aux Switch 5 Label" ) \
+ XXX(ZBEE_ZCL_ATTR_ID_CAL_AUX_SWITCH_6_LABEL, 0x0005, "Aux Switch 6 Label" ) \
+ XXX(ZBEE_ZCL_ATTR_ID_CAL_AUX_SWITCH_7_LABEL, 0x0006, "Aux Switch 7 Label" ) \
+ XXX(ZBEE_ZCL_ATTR_ID_CAL_AUX_SWITCH_8_LABEL, 0x0007, "Aux Switch 8 Label" ) \
+/* Smart Energy */ \
+ XXX(ZBEE_ZCL_ATTR_ID_SE_ATTR_REPORT_STATUS_CAL, 0xFFFE, "Attribute Reporting Status" )
+
+VALUE_STRING_ENUM(zbee_zcl_calendar_attr_names);
+VALUE_STRING_ARRAY(zbee_zcl_calendar_attr_names);
+
+/* Server Commands Received */
+#define zbee_zcl_calendar_srv_rx_cmd_names_VALUE_STRING_LIST(XXX) \
+ XXX(ZBEE_ZCL_CMD_ID_CAL_GET_CALENDAR, 0x00, "Get Calendar" ) \
+ XXX(ZBEE_ZCL_CMD_ID_CAL_GET_DAY_PROFILES, 0x01, "Get Day Profiles" ) \
+ XXX(ZBEE_ZCL_CMD_ID_CAL_GET_WEEK_PROFILES, 0x02, "Get Week Profiles" ) \
+ XXX(ZBEE_ZCL_CMD_ID_CAL_GET_SEASONS, 0x03, "Get Seasons" ) \
+ XXX(ZBEE_ZCL_CMD_ID_CAL_GET_SPECIAL_DAYS, 0x04, "Get Special Days" ) \
+ XXX(ZBEE_ZCL_CMD_ID_CAL_GET_CALENDAR_CANCELLATION, 0x05, "Get Calendar Cancellation" )
+
+VALUE_STRING_ENUM(zbee_zcl_calendar_srv_rx_cmd_names);
+VALUE_STRING_ARRAY(zbee_zcl_calendar_srv_rx_cmd_names);
+
+/* Server Commands Generated */
+#define zbee_zcl_calendar_srv_tx_cmd_names_VALUE_STRING_LIST(XXX) \
+ XXX(ZBEE_ZCL_CMD_ID_CAL_PUBLISH_CALENDAR, 0x00, "Publish Calendar" ) \
+ XXX(ZBEE_ZCL_CMD_ID_CAL_PUBLISH_DAY_PROFILE, 0x01, "Publish Day Profile" ) \
+ XXX(ZBEE_ZCL_CMD_ID_CAL_PUBLISH_WEEK_PROFILE, 0x02, "Publish Week Profile" ) \
+ XXX(ZBEE_ZCL_CMD_ID_CAL_PUBLISH_SEASONS, 0x03, "Publish Seasons" ) \
+ XXX(ZBEE_ZCL_CMD_ID_CAL_PUBLISH_SPECIAL_DAYS, 0x04, "Publish Special Days" ) \
+ XXX(ZBEE_ZCL_CMD_ID_CAL_CANCEL_CALENDAR, 0x05, "Cancel Calendar" )
+
+VALUE_STRING_ENUM(zbee_zcl_calendar_srv_tx_cmd_names);
+VALUE_STRING_ARRAY(zbee_zcl_calendar_srv_tx_cmd_names);
+
+/*************************/
+/* Function Declarations */
+/*************************/
+void proto_register_zbee_zcl_calendar(void);
+void proto_reg_handoff_zbee_zcl_calendar(void);
+
+/* Attribute Dissector Helpers */
+static void dissect_zcl_calendar_attr_data (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type);
+
+/*************************/
+/* Global Variables */
+/*************************/
+
+static dissector_handle_t calendar_handle;
+
+/* Initialize the protocol and registered fields */
+static int proto_zbee_zcl_calendar = -1;
+
+static int hf_zbee_zcl_calendar_srv_tx_cmd_id = -1;
+static int hf_zbee_zcl_calendar_srv_rx_cmd_id = -1;
+static int hf_zbee_zcl_calendar_attr_id = -1;
+static int hf_zbee_zcl_calendar_attr_reporting_status = -1;
+
+/* Initialize the subtree pointers */
+static gint ett_zbee_zcl_calendar = -1;
+
+/*************************/
+/* Function Bodies */
+/*************************/
+
+/**
+ *This function is called by ZCL foundation dissector in order to decode
+ *
+ *@param tree pointer to data tree Wireshark uses to display packet.
+ *@param tvb pointer to buffer containing raw packet.
+ *@param offset pointer to buffer offset
+ *@param attr_id attribute identifier
+ *@param data_type attribute data type
+*/
+static void
+dissect_zcl_calendar_attr_data(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type)
+{
+ switch (attr_id) {
+ /* applies to all SE clusters */
+ case ZBEE_ZCL_ATTR_ID_SE_ATTR_REPORT_STATUS_CAL:
+ proto_tree_add_item(tree, hf_zbee_zcl_calendar_attr_reporting_status, tvb, *offset, 1, ENC_NA);
+ *offset += 1;
+ break;
+
+ default: /* Catch all */
+ dissect_zcl_attr_data(tvb, tree, offset, data_type);
+ break;
+ }
+} /*dissect_zcl_calendar_attr_data*/
+
+/**
+ *ZigBee ZCL Calendar cluster dissector for wireshark.
+ *
+ *@param tvb pointer to buffer containing raw packet.
+ *@param pinfo pointer to packet information fields
+ *@param tree pointer to data tree Wireshark uses to display packet.
+*/
+static int
+dissect_zbee_zcl_calendar(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
+{
+ 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_calendar_srv_rx_cmd_names, "Unknown Command"),
+ zcl->tran_seqno);
+
+ /* Add the command ID. */
+ proto_tree_add_uint(tree, hf_zbee_zcl_calendar_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) {
+ proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_calendar, NULL, "Payload");
+
+ /* Call the appropriate command dissector */
+ switch (cmd_id) {
+
+ case ZBEE_ZCL_CMD_ID_CAL_GET_CALENDAR:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_CAL_GET_DAY_PROFILES:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_CAL_GET_WEEK_PROFILES:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_CAL_GET_SEASONS:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_CAL_GET_SPECIAL_DAYS:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_CAL_GET_CALENDAR_CANCELLATION:
+ /* Add function to dissect payload */
+ 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_calendar_srv_tx_cmd_names, "Unknown Command"),
+ zcl->tran_seqno);
+
+ /* Add the command ID. */
+ proto_tree_add_uint(tree, hf_zbee_zcl_calendar_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) {
+ proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_calendar, NULL, "Payload");
+
+ /* Call the appropriate command dissector */
+ switch (cmd_id) {
+
+ case ZBEE_ZCL_CMD_ID_CAL_PUBLISH_CALENDAR:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_CAL_PUBLISH_DAY_PROFILE:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_CAL_PUBLISH_WEEK_PROFILE:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_CAL_PUBLISH_SEASONS:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_CAL_PUBLISH_SPECIAL_DAYS:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_CAL_CANCEL_CALENDAR:
+ /* Add function to dissect payload */
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+
+ return tvb_captured_length(tvb);
+} /*dissect_zbee_zcl_calendar*/
+
+/**
+ *This function registers the ZCL Calendar dissector
+ *
+*/
+void
+proto_register_zbee_zcl_calendar(void)
+{
+ static hf_register_info hf[] = {
+
+ { &hf_zbee_zcl_calendar_attr_id,
+ { "Attribute", "zbee_zcl_se.calendar.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_calendar_attr_names),
+ 0x0, NULL, HFILL } },
+
+ { &hf_zbee_zcl_calendar_attr_reporting_status, /* common to all SE clusters */
+ { "Attribute Reporting Status", "zbee_zcl_se.calendar.attr.attr_reporting_status",
+ FT_UINT8, BASE_HEX, VALS(zbee_zcl_se_reporting_status_names), 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_calendar_srv_tx_cmd_id,
+ { "Command", "zbee_zcl_se.calendar.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_calendar_srv_tx_cmd_names),
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_calendar_srv_rx_cmd_id,
+ { "Command", "zbee_zcl_se.calendar.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_calendar_srv_rx_cmd_names),
+ 0x00, NULL, HFILL } },
+
+ };
+
+ /* ZCL Calendar subtrees */
+ gint *ett[] = {
+ &ett_zbee_zcl_calendar,
+ };
+
+ /* Register the ZigBee ZCL Calendar cluster protocol name and description */
+ proto_zbee_zcl_calendar = proto_register_protocol("ZigBee ZCL Calendar", "ZCL Calendar", ZBEE_PROTOABBREV_ZCL_CALENDAR);
+ proto_register_field_array(proto_zbee_zcl_calendar, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
+
+ /* Register the ZigBee ZCL Calendar dissector. */
+ calendar_handle = register_dissector(ZBEE_PROTOABBREV_ZCL_CALENDAR, dissect_zbee_zcl_calendar, proto_zbee_zcl_calendar);
+} /*proto_register_zbee_zcl_calendar*/
+
+/**
+ *Hands off the Zcl Calendar dissector.
+ *
+*/
+void
+proto_reg_handoff_zbee_zcl_calendar(void)
+{
+ /* Register our dissector with the ZigBee application dissectors. */
+ dissector_add_uint("zbee.zcl.cluster", ZBEE_ZCL_CID_CALENDAR, calendar_handle);
+
+ zbee_zcl_init_cluster( proto_zbee_zcl_calendar,
+ ett_zbee_zcl_calendar,
+ ZBEE_ZCL_CID_CALENDAR,
+ hf_zbee_zcl_calendar_attr_id,
+ hf_zbee_zcl_calendar_srv_rx_cmd_id,
+ hf_zbee_zcl_calendar_srv_tx_cmd_id,
+ (zbee_zcl_fn_attr_data)dissect_zcl_calendar_attr_data
+ );
+} /*proto_reg_handoff_zbee_zcl_calendar*/
+
+/* ########################################################################## */
+/* #### (0x0709) EVENTS CLUSTER ############################################# */
+/* ########################################################################## */
+
+/* Attributes */
+#define zbee_zcl_events_attr_names_VALUE_STRING_LIST(XXX) \
+/* Smart Energy */ \
+ XXX(ZBEE_ZCL_ATTR_ID_SE_ATTR_REPORT_STATUS_EVENTS, 0xFFFE, "Attribute Reporting Status" )
+
+VALUE_STRING_ENUM(zbee_zcl_events_attr_names);
+VALUE_STRING_ARRAY(zbee_zcl_events_attr_names);
+
+/* Server Commands Received */
+#define zbee_zcl_events_srv_rx_cmd_names_VALUE_STRING_LIST(XXX) \
+ XXX(ZBEE_ZCL_CMD_ID_EVENTS_GET_EVENT_LOG, 0x00, "Get Event Log" ) \
+ XXX(ZBEE_ZCL_CMD_ID_EVENTS_CLEAR_EVENT_LOG_REQUEST, 0x01, "Clear Event Log Request" )
+
+VALUE_STRING_ENUM(zbee_zcl_events_srv_rx_cmd_names);
+VALUE_STRING_ARRAY(zbee_zcl_events_srv_rx_cmd_names);
+
+/* Server Commands Generated */
+#define zbee_zcl_events_srv_tx_cmd_names_VALUE_STRING_LIST(XXX) \
+ XXX(ZBEE_ZCL_CMD_ID_EVENTS_PUBLISH_EVENT, 0x00, "Publish Event" ) \
+ XXX(ZBEE_ZCL_CMD_ID_EVENTS_PUBLISH_EVENT_LOG, 0x01, "Publish Event Log" ) \
+ XXX(ZBEE_ZCL_CMD_ID_EVENTS_CLEAR_EVENT_LOG_RESPONSE, 0x02, "Clear Event Log Response" )
+
+VALUE_STRING_ENUM(zbee_zcl_events_srv_tx_cmd_names);
+VALUE_STRING_ARRAY(zbee_zcl_events_srv_tx_cmd_names);
+
+/*************************/
+/* Function Declarations */
+/*************************/
+void proto_register_zbee_zcl_events(void);
+void proto_reg_handoff_zbee_zcl_events(void);
+
+/* Attribute Dissector Helpers */
+static void dissect_zcl_events_attr_data (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type);
+
+/*************************/
+/* Global Variables */
+/*************************/
+
+static dissector_handle_t events_handle;
+
+/* Initialize the protocol and registered fields */
+static int proto_zbee_zcl_events = -1;
+
+static int hf_zbee_zcl_events_srv_tx_cmd_id = -1;
+static int hf_zbee_zcl_events_srv_rx_cmd_id = -1;
+static int hf_zbee_zcl_events_attr_id = -1;
+static int hf_zbee_zcl_events_attr_reporting_status = -1;
+
+/* Initialize the subtree pointers */
+static gint ett_zbee_zcl_events = -1;
+
+/*************************/
+/* Function Bodies */
+/*************************/
+
+/**
+ *This function is called by ZCL foundation dissector in order to decode
+ *
+ *@param tree pointer to data tree Wireshark uses to display packet.
+ *@param tvb pointer to buffer containing raw packet.
+ *@param offset pointer to buffer offset
+ *@param attr_id attribute identifier
+ *@param data_type attribute data type
+*/
+static void
+dissect_zcl_events_attr_data(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type)
+{
+ switch (attr_id) {
+ /* applies to all SE clusters */
+ case ZBEE_ZCL_ATTR_ID_SE_ATTR_REPORT_STATUS_EVENTS:
+ proto_tree_add_item(tree, hf_zbee_zcl_events_attr_reporting_status, tvb, *offset, 1, ENC_NA);
+ *offset += 1;
+ break;
+
+ default: /* Catch all */
+ dissect_zcl_attr_data(tvb, tree, offset, data_type);
+ break;
+ }
+} /*dissect_zcl_events_attr_data*/
+
+/**
+ *ZigBee ZCL Events cluster dissector for wireshark.
+ *
+ *@param tvb pointer to buffer containing raw packet.
+ *@param pinfo pointer to packet information fields
+ *@param tree pointer to data tree Wireshark uses to display packet.
+*/
+static int
+dissect_zbee_zcl_events(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
+{
+ 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_events_srv_rx_cmd_names, "Unknown Command"),
+ zcl->tran_seqno);
+
+ /* Add the command ID. */
+ proto_tree_add_uint(tree, hf_zbee_zcl_events_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) {
+ proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_events, NULL, "Payload");
+
+ /* Call the appropriate command dissector */
+ switch (cmd_id) {
+
+ case ZBEE_ZCL_CMD_ID_EVENTS_GET_EVENT_LOG:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_EVENTS_CLEAR_EVENT_LOG_REQUEST:
+ /* Add function to dissect payload */
+ 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_events_srv_tx_cmd_names, "Unknown Command"),
+ zcl->tran_seqno);
+
+ /* Add the command ID. */
+ proto_tree_add_uint(tree, hf_zbee_zcl_events_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) {
+ proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_events, NULL, "Payload");
+
+ /* Call the appropriate command dissector */
+ switch (cmd_id) {
+
+ case ZBEE_ZCL_CMD_ID_EVENTS_PUBLISH_EVENT:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_EVENTS_PUBLISH_EVENT_LOG:
+ /* Add function to dissect payload */
+ break;
+
+ case ZBEE_ZCL_CMD_ID_EVENTS_CLEAR_EVENT_LOG_RESPONSE:
+ /* Add function to dissect payload */
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+
+ return tvb_captured_length(tvb);
+} /*dissect_zbee_zcl_events*/
+
+/**
+ *This function registers the ZCL Events dissector
+ *
+*/
+void
+proto_register_zbee_zcl_events(void)
+{
+ static hf_register_info hf[] = {
+
+ { &hf_zbee_zcl_events_attr_id,
+ { "Attribute", "zbee_zcl_se.events.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_events_attr_names),
+ 0x0, NULL, HFILL } },
+
+ { &hf_zbee_zcl_events_attr_reporting_status, /* common to all SE clusters */
+ { "Attribute Reporting Status", "zbee_zcl_se.events.attr.attr_reporting_status",
+ FT_UINT8, BASE_HEX, VALS(zbee_zcl_se_reporting_status_names), 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_events_srv_tx_cmd_id,
+ { "Command", "zbee_zcl_se.events.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_events_srv_tx_cmd_names),
+ 0x00, NULL, HFILL } },
+
+ { &hf_zbee_zcl_events_srv_rx_cmd_id,
+ { "Command", "zbee_zcl_se.events.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_events_srv_rx_cmd_names),
+ 0x00, NULL, HFILL } },
+
+ };
+
+ /* ZCL Events subtrees */
+ gint *ett[] = {
+ &ett_zbee_zcl_events,
+ };
+
+ /* Register the ZigBee ZCL Events cluster protocol name and description */
+ proto_zbee_zcl_events = proto_register_protocol("ZigBee ZCL Events", "ZCL Events", ZBEE_PROTOABBREV_ZCL_EVENTS);
+ proto_register_field_array(proto_zbee_zcl_events, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
+
+ /* Register the ZigBee ZCL Events dissector. */
+ events_handle = register_dissector(ZBEE_PROTOABBREV_ZCL_EVENTS, dissect_zbee_zcl_events, proto_zbee_zcl_events);
+} /*proto_register_zbee_zcl_events*/
+
+/**
+ *Hands off the Zcl Events dissector.
+ *
+*/
+void
+proto_reg_handoff_zbee_zcl_events(void)
+{
+ /* Register our dissector with the ZigBee application dissectors. */
+ dissector_add_uint("zbee.zcl.cluster", ZBEE_ZCL_CID_EVENTS, events_handle);
+
+ zbee_zcl_init_cluster( proto_zbee_zcl_events,
+ ett_zbee_zcl_events,
+ ZBEE_ZCL_CID_EVENTS,
+ hf_zbee_zcl_events_attr_id,
+ hf_zbee_zcl_events_srv_rx_cmd_id,
+ hf_zbee_zcl_events_srv_tx_cmd_id,
+ (zbee_zcl_fn_attr_data)dissect_zcl_events_attr_data
+ );
+} /*proto_reg_handoff_zbee_zcl_events*/
/* ########################################################################## */
/* #### (0x0800) KEY ESTABLISHMENT ########################################## */
zcl->tran_seqno);
/* Add the command ID. */
- proto_tree_add_item(tree, hf_zbee_zcl_ke_srv_rx_cmd_id, tvb, offset, 1, cmd_id);
+ proto_tree_add_uint(tree, hf_zbee_zcl_ke_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);
zcl->tran_seqno);
/* Add the command ID. */
- proto_tree_add_item(tree, hf_zbee_zcl_ke_srv_tx_cmd_id, tvb, offset, 1, cmd_id);
+ proto_tree_add_uint(tree, hf_zbee_zcl_ke_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);