From 105b4584a23f7f9af5e3511331c7b865ffcfdbf7 Mon Sep 17 00:00:00 2001 From: Kenneth Soerensen Date: Tue, 5 Jun 2018 15:27:37 +0200 Subject: [PATCH] ZigBee: Dissect remaining SE Metering cluster client commands and a few server commands Bug: 13360 Change-Id: I5a002dd45989b8ac1a492e527e22d764cf229a1b Reviewed-on: https://code.wireshark.org/review/29293 Petri-Dish: Anders Broman Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- epan/dissectors/packet-zbee-zcl-se.c | 682 ++++++++++++++++++++++++++- 1 file changed, 673 insertions(+), 9 deletions(-) diff --git a/epan/dissectors/packet-zbee-zcl-se.c b/epan/dissectors/packet-zbee-zcl-se.c index cbc1810f47..db033897ef 100644 --- a/epan/dissectors/packet-zbee-zcl-se.c +++ b/epan/dissectors/packet-zbee-zcl-se.c @@ -4841,14 +4841,27 @@ void proto_reg_handoff_zbee_zcl_met(void); static void dissect_zcl_met_attr_data (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type, gboolean client_attr); /* 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); +static void dissect_zcl_met_get_profile (tvbuff_t *tvb, proto_tree *tree, guint *offset); +static void dissect_zcl_met_request_mirror_rsp (tvbuff_t *tvb, proto_tree *tree, guint *offset); +static void dissect_zcl_met_mirror_removed (tvbuff_t *tvb, proto_tree *tree, guint *offset); +static void dissect_zcl_met_request_fast_poll_mode (tvbuff_t *tvb, proto_tree *tree, guint *offset); +static void dissect_zcl_met_schedule_snapshot (tvbuff_t *tvb, proto_tree *tree, guint *offset); +static void dissect_zcl_met_take_snapshot (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_start_sampling (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_mirror_report_attribute_response(tvbuff_t *tvb, proto_tree *tree, guint *offset); +static void dissect_zcl_met_reset_load_limit_counter (tvbuff_t *tvb, proto_tree *tree, guint *offset); +static void dissect_zcl_met_change_supply (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_set_supply_status (tvbuff_t *tvb, proto_tree *tree, guint *offset); +static void dissect_zcl_met_set_uncontrolled_flow_threshold (tvbuff_t *tvb, proto_tree *tree, guint *offset); +static void dissect_zcl_met_take_snapshot_response (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); +static void dissect_zcl_met_supply_status_response (tvbuff_t *tvb, proto_tree *tree, guint *offset); /*************************/ /* Global Variables */ @@ -4933,16 +4946,57 @@ static int hf_zbee_zcl_met_noti_flag_5_update_site_id = -1; static int hf_zbee_zcl_met_noti_flag_5_reset_battery_counter = -1; static int hf_zbee_zcl_met_noti_flag_5_update_cin = -1; static int hf_zbee_zcl_met_noti_flag_5_reserved = -1; +static int hf_zbee_zcl_met_get_profile_interval_channel = -1; +static int hf_zbee_zcl_met_get_profile_end_time = -1; +static int hf_zbee_zcl_met_get_profile_number_of_periods = -1; static int hf_zbee_zcl_met_request_mirror_rsp_endpoint_id = -1; +static int hf_zbee_zcl_met_mirror_removed_removed_endpoint_id = -1; +static int hf_zbee_zcl_met_request_fast_poll_mode_fast_poll_update_period = -1; +static int hf_zbee_zcl_met_request_fast_poll_mode_duration = -1; +static int hf_zbee_zcl_met_schedule_snapshot_issuer_event_id = -1; +static int hf_zbee_zcl_met_schedule_snapshot_command_index = -1; +static int hf_zbee_zcl_met_schedule_snapshot_total_number_of_commands = -1; +static int hf_zbee_zcl_met_schedule_snapshot_snapshot_schedule_payload = -1; +static int hf_zbee_zcl_met_take_snapshot_snapshot_cause = -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_start_sampling_issuer_event_id = -1; +static int hf_zbee_zcl_met_start_sampling_start_sampling_time = -1; +static int hf_zbee_zcl_met_start_sampling_sample_type = -1; +static int hf_zbee_zcl_met_start_sampling_sample_request_interval = -1; +static int hf_zbee_zcl_met_start_sampling_max_number_of_samples = -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_mirror_report_attribute_response_notification_scheme = -1; +static int hf_zbee_zcl_met_mirror_report_attribute_response_notification_flags_n = -1; +static int hf_zbee_zcl_met_reset_load_limit_counter_provider_id = -1; +static int hf_zbee_zcl_met_reset_load_limit_counter_issuer_event_id = -1; +static int hf_zbee_zcl_met_change_supply_provider_id = -1; +static int hf_zbee_zcl_met_change_supply_issuer_event_id = -1; +static int hf_zbee_zcl_met_change_supply_request_date_time = -1; +static int hf_zbee_zcl_met_change_supply_implementation_date_time = -1; +static int hf_zbee_zcl_met_change_supply_proposed_supply_status = -1; +static int hf_zbee_zcl_met_change_supply_supply_control_bits = -1; static int hf_zbee_zcl_met_local_change_supply_supply_status = -1; +static int hf_zbee_zcl_met_set_supply_status_issuer_event_id = -1; +static int hf_zbee_zcl_met_set_supply_status_supply_tamper_state = -1; +static int hf_zbee_zcl_met_set_supply_status_supply_depletion_state = -1; +static int hf_zbee_zcl_met_set_supply_status_supply_uncontrolled_flow_state = -1; +static int hf_zbee_zcl_met_set_supply_status_load_limit_supply_state = -1; +static int hf_zbee_zcl_met_set_uncontrolled_flow_threshold_provider_id = -1; +static int hf_zbee_zcl_met_set_uncontrolled_flow_threshold_issuer_event_id = -1; +static int hf_zbee_zcl_met_set_uncontrolled_flow_threshold_uncontrolled_flow_threshold = -1; +static int hf_zbee_zcl_met_set_uncontrolled_flow_threshold_unit_of_measure = -1; +static int hf_zbee_zcl_met_set_uncontrolled_flow_threshold_multiplier = -1; +static int hf_zbee_zcl_met_set_uncontrolled_flow_threshold_divisor = -1; +static int hf_zbee_zcl_met_set_uncontrolled_flow_threshold_stabilisation_period = -1; +static int hf_zbee_zcl_met_set_uncontrolled_flow_threshold_measurment_period = -1; +static int hf_zbee_zcl_met_take_snapshot_response_snapshot_id = -1; +static int hf_zbee_zcl_met_take_snapshot_response_snapshot_confirmation = -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; @@ -4964,6 +5018,11 @@ 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; +static int hf_zbee_zcl_met_supply_status_response_provider_id = -1; +static int hf_zbee_zcl_met_supply_status_response_issuer_event_id = -1; +static int hf_zbee_zcl_met_supply_status_response_implementation_date_time = -1; +static int hf_zbee_zcl_met_supply_status_response_supply_status_after_implementation = -1; + /* Initialize the subtree pointers */ static gint ett_zbee_zcl_met = -1; @@ -5179,22 +5238,66 @@ dissect_zbee_zcl_met(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* /* Call the appropriate command dissector */ switch (cmd_id) { + case ZBEE_ZCL_CMD_ID_MET_GET_PROFILE: + dissect_zcl_met_get_profile(tvb, payload_tree, &offset); + break; + case ZBEE_ZCL_CMD_ID_MET_REQUEST_MIRROR_RSP: dissect_zcl_met_request_mirror_rsp(tvb, payload_tree, &offset); break; + case ZBEE_ZCL_CMD_ID_MET_MIRROR_REMOVED: + dissect_zcl_met_mirror_removed(tvb, payload_tree, &offset); + break; + + case ZBEE_ZCL_CMD_ID_MET_REQUEST_FAST_POLL_MODE: + dissect_zcl_met_request_fast_poll_mode(tvb, payload_tree, &offset); + break; + + case ZBEE_ZCL_CMD_ID_MET_SCHEDULE_SNAPSHOT: + dissect_zcl_met_schedule_snapshot(tvb, payload_tree, &offset); + break; + + case ZBEE_ZCL_CMD_ID_MET_TAKE_SNAPSHOT: + dissect_zcl_met_take_snapshot(tvb, payload_tree, &offset); + break; + case ZBEE_ZCL_CMD_ID_MET_GET_SNAPSHOT: dissect_zcl_met_get_snapshot(tvb, payload_tree, &offset); break; + case ZBEE_ZCL_CMD_ID_MET_START_SAMPLING: + dissect_zcl_met_start_sampling(tvb, payload_tree, &offset); + break; + case ZBEE_ZCL_CMD_ID_MET_GET_SAMPLED_DATA: dissect_zcl_met_get_sampled_data(tvb, payload_tree, &offset); break; + case ZBEE_ZCL_CMD_ID_MET_MIRROR_REPORT_ATTRIBUTE_RESPONSE: + dissect_zcl_met_mirror_report_attribute_response(tvb, payload_tree, &offset); + break; + + case ZBEE_ZCL_CMD_ID_MET_RESET_LOAD_LIMIT_COUNTER: + dissect_zcl_met_reset_load_limit_counter(tvb, payload_tree, &offset); + break; + + case ZBEE_ZCL_CMD_ID_MET_CHANGE_SUPPLY: + dissect_zcl_met_change_supply(tvb, payload_tree, &offset); + break; + case ZBEE_ZCL_CMD_ID_MET_LOCAL_CHANGE_SUPPLY: dissect_zcl_met_local_change_supply(tvb, payload_tree, &offset); break; + case ZBEE_ZCL_CMD_ID_MET_SET_SUPPLY_STATUS: + dissect_zcl_met_set_supply_status(tvb, payload_tree, &offset); + break; + + case ZBEE_ZCL_CMD_ID_MET_SET_UNCONTROLLED_FLOW_THRESHOLD: + dissect_zcl_met_set_uncontrolled_flow_threshold(tvb, payload_tree, &offset); + break; + default: break; } @@ -5217,10 +5320,30 @@ dissect_zbee_zcl_met(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* /* Call the appropriate command dissector */ switch (cmd_id) { + case ZBEE_ZCL_CMD_ID_MET_GET_PROFILE_RESPONSE: + /* Add function to dissect payload */ + break; + case ZBEE_ZCL_CMD_ID_MET_REQUEST_MIRROR: /* No payload */ break; + case ZBEE_ZCL_CMD_ID_MET_REMOVE_MIRROR: + /* No payload */ + break; + + case ZBEE_ZCL_CMD_ID_MET_REQUEST_FAST_POLL_MODE_RESPONSE: + /* Add function to dissect payload */ + break; + + case ZBEE_ZCL_CMD_ID_MET_SCHEDULE_SNAPSHOT_RESPONSE: + /* Add function to dissect payload */ + break; + + case ZBEE_ZCL_CMD_ID_MET_TAKE_SNAPSHOT_RESPONSE: + dissect_zcl_met_take_snapshot_response(tvb, payload_tree, &offset); + break; + case ZBEE_ZCL_CMD_ID_MET_PUBLISH_SNAPSHOT: dissect_zcl_met_publish_snapshot(tvb, payload_tree, &offset); break; @@ -5233,10 +5356,26 @@ dissect_zbee_zcl_met(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* dissect_zcl_met_configure_mirror(tvb, payload_tree, &offset); break; + case ZBEE_ZCL_CMD_ID_MET_CONFIGURE_NOTIFICATION_SCHEME: + /* Add function to dissect payload */ + break; + + case ZBEE_ZCL_CMD_ID_MET_CONFIGURE_NOTIFICATION_FLAG: + /* Add function to dissect payload */ + break; + case ZBEE_ZCL_CMD_ID_MET_GET_NOTIFIED_MESSAGE: dissect_zcl_met_get_notified_msg(tvb, payload_tree, &offset); break; + case ZBEE_ZCL_CMD_ID_MET_SUPPLY_STATUS_RESPONSE: + dissect_zcl_met_supply_status_response(tvb, payload_tree, &offset); + break; + + case ZBEE_ZCL_CMD_ID_MET_START_SAMPLING_RESPONSE: + /* Add function to dissect payload */ + break; + default: break; } @@ -5246,6 +5385,33 @@ dissect_zbee_zcl_met(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* return tvb_captured_length(tvb); } /*dissect_zbee_zcl_met*/ +/** + *This function manages the Get Profile 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_profile(tvbuff_t *tvb, proto_tree *tree, guint *offset) +{ + nstime_t end_time; + + /* Interval Channel */ + proto_tree_add_item(tree, hf_zbee_zcl_met_get_profile_interval_channel, tvb, *offset, 1, ENC_LITTLE_ENDIAN); + *offset += 1; + + /* End Time */ + 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_profile_end_time, tvb, *offset, 4, &end_time); + *offset += 4; + + /* Number of Periods */ + proto_tree_add_item(tree, hf_zbee_zcl_met_get_profile_number_of_periods, tvb, *offset, 1, ENC_LITTLE_ENDIAN); + *offset += 1; +} /*dissect_zcl_met_get_profile*/ + /** *This function manages the Request Mirror Response payload * @@ -5259,7 +5425,86 @@ dissect_zcl_met_request_mirror_rsp(tvbuff_t *tvb, proto_tree *tree, guint *offse /* 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*/ +} /*dissect_zcl_met_request_mirror_rsp*/ + +/** + *This function manages the Mirror Removed 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_mirror_removed(tvbuff_t *tvb, proto_tree *tree, guint *offset) +{ + /* Removed EndPoint ID */ + proto_tree_add_item(tree, hf_zbee_zcl_met_mirror_removed_removed_endpoint_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; +} /*dissect_zcl_met_mirror_removed*/ + +/** + *This function manages the Request Fast Poll Mode 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_request_fast_poll_mode(tvbuff_t *tvb, proto_tree *tree, guint *offset) +{ + /* Fast Poll Update Period */ + proto_tree_add_item(tree, hf_zbee_zcl_met_request_fast_poll_mode_fast_poll_update_period, tvb, *offset, 1, ENC_LITTLE_ENDIAN); + *offset += 1; + + /* Duration */ + proto_tree_add_item(tree, hf_zbee_zcl_met_request_fast_poll_mode_duration, tvb, *offset, 1, ENC_LITTLE_ENDIAN); + *offset += 1; +} /*dissect_zcl_met_request_fast_poll_mode*/ + +/** + *This function manages the Schedule 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_schedule_snapshot(tvbuff_t *tvb, proto_tree *tree, guint *offset) +{ + gint rem_len; + + /* Issue Event ID */ + proto_tree_add_item(tree, hf_zbee_zcl_met_schedule_snapshot_issuer_event_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN); + *offset += 4; + + /* Command Index */ + proto_tree_add_item(tree, hf_zbee_zcl_met_schedule_snapshot_command_index, tvb, *offset, 1, ENC_LITTLE_ENDIAN); + *offset += 1; + + /* Total Number of Commands */ + proto_tree_add_item(tree, hf_zbee_zcl_met_schedule_snapshot_total_number_of_commands, tvb, *offset, 1, ENC_LITTLE_ENDIAN); + *offset += 1; + + /* Snapshot Schedule Payload */ + rem_len = tvb_reported_length_remaining(tvb, *offset); + proto_tree_add_item(tree, hf_zbee_zcl_met_schedule_snapshot_snapshot_schedule_payload, tvb, *offset, rem_len, ENC_NA); + *offset += rem_len; +} /*dissect_zcl_met_schedule_snapshot*/ + +/** + *This function manages the Take 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_take_snapshot(tvbuff_t *tvb, proto_tree *tree, guint *offset) +{ + /* Snapshot Cause */ + proto_tree_add_item(tree, hf_zbee_zcl_met_take_snapshot_snapshot_cause, tvb, *offset, 4, ENC_LITTLE_ENDIAN); + *offset += 4; +} /*dissect_zcl_met_take_snapshot*/ /** *This function manages the Get Snapshot payload @@ -5297,6 +5542,41 @@ dissect_zcl_met_get_snapshot(tvbuff_t *tvb, proto_tree *tree, guint *offset) *offset += 4; } /*dissect_zcl_met_get_snapshot*/ +/** + *This function manages the Start Sampling 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_start_sampling(tvbuff_t *tvb, proto_tree *tree, guint *offset) +{ + nstime_t sample_time; + + /* Issuer Event ID */ + proto_tree_add_item(tree, hf_zbee_zcl_met_start_sampling_issuer_event_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN); + *offset += 4; + + /* Start Sampling 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_start_sampling_start_sampling_time, tvb, *offset, 4, &sample_time); + *offset += 4; + + /* Sample Type */ + proto_tree_add_item(tree, hf_zbee_zcl_met_start_sampling_sample_type, tvb, *offset, 1, ENC_LITTLE_ENDIAN); + *offset += 1; + + /* Sample Request Interval */ + proto_tree_add_item(tree, hf_zbee_zcl_met_start_sampling_sample_request_interval, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; + + /* Max Number of Samples */ + proto_tree_add_item(tree, hf_zbee_zcl_met_start_sampling_max_number_of_samples, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; +} /*dissect_zcl_met_start_sampling*/ + /** *This function manages the Get Sampled Data payload * @@ -5328,6 +5608,86 @@ dissect_zcl_met_get_sampled_data(tvbuff_t *tvb, proto_tree *tree, guint *offset) *offset += 2; } /*dissect_zcl_met_get_sampled_data*/ +/** + *This function manages the Mirror Report Attribute 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_mirror_report_attribute_response(tvbuff_t *tvb, proto_tree *tree, guint *offset) +{ + /* Notification Scheme */ + proto_tree_add_item(tree, hf_zbee_zcl_met_mirror_report_attribute_response_notification_scheme, tvb, *offset, 1, ENC_LITTLE_ENDIAN); + *offset += 1; + + /* Notification Flags #N */ + proto_tree_add_item(tree, hf_zbee_zcl_met_mirror_report_attribute_response_notification_flags_n, tvb, *offset, 4, ENC_LITTLE_ENDIAN); + *offset += 4; +} /*dissect_zcl_met_mirror_report_attribute_response*/ + +/** + *This function manages the Reset Load Limit Counter 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_reset_load_limit_counter(tvbuff_t *tvb, proto_tree *tree, guint *offset) +{ + /* Provider ID */ + proto_tree_add_item(tree, hf_zbee_zcl_met_reset_load_limit_counter_provider_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN); + *offset += 4; + + /* Issuer Event ID */ + proto_tree_add_item(tree, hf_zbee_zcl_met_reset_load_limit_counter_issuer_event_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN); + *offset += 4; +} /*dissect_zcl_met_reset_load_limit_counter*/ + +/** + *This function manages the 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_change_supply(tvbuff_t *tvb, proto_tree *tree, guint *offset) +{ + nstime_t request_time; + nstime_t implementation_time; + + /* Provider ID */ + proto_tree_add_item(tree, hf_zbee_zcl_met_change_supply_provider_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN); + *offset += 4; + + /* Issuer Event ID */ + proto_tree_add_item(tree, hf_zbee_zcl_met_change_supply_issuer_event_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN); + *offset += 4; + + /* Request Date/Time */ + request_time.secs = (time_t)tvb_get_letohl(tvb, *offset) + ZBEE_ZCL_NSTIME_UTC_OFFSET; + request_time.nsecs = 0; + proto_tree_add_time(tree, hf_zbee_zcl_met_change_supply_request_date_time, tvb, *offset, 4, &request_time); + *offset += 4; + + /* Implementation Date/Time */ + implementation_time.secs = (time_t)tvb_get_letohl(tvb, *offset) + ZBEE_ZCL_NSTIME_UTC_OFFSET; + implementation_time.nsecs = 0; + proto_tree_add_time(tree, hf_zbee_zcl_met_change_supply_implementation_date_time, tvb, *offset, 4, &implementation_time); + *offset += 4; + + /* Proposed Supple Status */ + proto_tree_add_item(tree, hf_zbee_zcl_met_change_supply_proposed_supply_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN); + *offset += 1; + + /* Supple Control Bits */ + proto_tree_add_item(tree, hf_zbee_zcl_met_change_supply_supply_control_bits, tvb, *offset, 1, ENC_LITTLE_ENDIAN); + *offset += 1; +} /*dissect_zcl_met_change_supply*/ + /** *This function manages the Local Change Supply payload * @@ -5343,6 +5703,99 @@ dissect_zcl_met_local_change_supply(tvbuff_t *tvb, proto_tree *tree, guint *offs *offset += 1; } /*dissect_zcl_met_local_change_supply*/ +/** + *This function manages the Set Supply Status 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_set_supply_status(tvbuff_t *tvb, proto_tree *tree, guint *offset) +{ + /* Issuer Event ID */ + proto_tree_add_item(tree, hf_zbee_zcl_met_set_supply_status_issuer_event_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN); + *offset += 4; + + /* Supply Tamper State */ + proto_tree_add_item(tree, hf_zbee_zcl_met_set_supply_status_supply_tamper_state, tvb, *offset, 1, ENC_LITTLE_ENDIAN); + *offset += 1; + + /* Supply Depletion State */ + proto_tree_add_item(tree, hf_zbee_zcl_met_set_supply_status_supply_depletion_state, tvb, *offset, 1, ENC_LITTLE_ENDIAN); + *offset += 1; + + /* Supply Uncontrolled Flow State */ + proto_tree_add_item(tree, hf_zbee_zcl_met_set_supply_status_supply_uncontrolled_flow_state, tvb, *offset, 1, ENC_LITTLE_ENDIAN); + *offset += 1; + + /* Load Limit Supply State */ + proto_tree_add_item(tree, hf_zbee_zcl_met_set_supply_status_load_limit_supply_state, tvb, *offset, 1, ENC_LITTLE_ENDIAN); + *offset += 1; +} /*dissect_zcl_met_set_supply_status*/ + +/** + *This function manages the Set Uncontrolled Flow Threshold 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_set_uncontrolled_flow_threshold(tvbuff_t *tvb, proto_tree *tree, guint *offset) +{ + /* Provider ID */ + proto_tree_add_item(tree, hf_zbee_zcl_met_set_uncontrolled_flow_threshold_provider_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN); + *offset += 4; + + /* Issuer Event ID */ + proto_tree_add_item(tree, hf_zbee_zcl_met_set_uncontrolled_flow_threshold_issuer_event_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN); + *offset += 4; + + /* Uncontrolled Flow Threshold */ + proto_tree_add_item(tree, hf_zbee_zcl_met_set_uncontrolled_flow_threshold_uncontrolled_flow_threshold, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; + + /* Unit of Measure */ + proto_tree_add_item(tree, hf_zbee_zcl_met_set_uncontrolled_flow_threshold_unit_of_measure, tvb, *offset, 1, ENC_LITTLE_ENDIAN); + *offset += 1; + + /* Multiplier */ + proto_tree_add_item(tree, hf_zbee_zcl_met_set_uncontrolled_flow_threshold_multiplier, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; + + /* Divisor */ + proto_tree_add_item(tree, hf_zbee_zcl_met_set_uncontrolled_flow_threshold_divisor, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; + + /* Stabilisation Period */ + proto_tree_add_item(tree, hf_zbee_zcl_met_set_uncontrolled_flow_threshold_stabilisation_period, tvb, *offset, 1, ENC_LITTLE_ENDIAN); + *offset += 1; + + /* Measurement Period */ + proto_tree_add_item(tree, hf_zbee_zcl_met_set_uncontrolled_flow_threshold_measurment_period, tvb, *offset, 2, ENC_LITTLE_ENDIAN); + *offset += 2; +} /*dissect_zcl_met_set_uncontrolled_flow_threshold*/ + +/** + *This function manages the Take Snapshot 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_take_snapshot_response(tvbuff_t *tvb, proto_tree *tree, guint *offset) +{ + /* Snapshot ID */ + proto_tree_add_item(tree, hf_zbee_zcl_met_take_snapshot_response_snapshot_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN); + *offset += 4; + + /* Snapshot Confirmation */ + proto_tree_add_item(tree, hf_zbee_zcl_met_take_snapshot_response_snapshot_confirmation, tvb, *offset, 1, ENC_LITTLE_ENDIAN); + *offset += 1; +} /*dissect_zcl_met_take_snapshot_response*/ + /** *This function manages the Publish Snapshot payload * @@ -5487,6 +5940,37 @@ dissect_zcl_met_get_notified_msg(tvbuff_t *tvb, proto_tree *tree, guint *offset) *offset += 4; } /*dissect_zcl_met_get_notified_msg*/ +/** + *This function manages the Supply Status 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_supply_status_response(tvbuff_t *tvb, proto_tree *tree, guint *offset) +{ + nstime_t implementation_date_time; + + /* Provider ID */ + proto_tree_add_item(tree, hf_zbee_zcl_met_supply_status_response_provider_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN); + *offset += 4; + + /* Issuer Event ID */ + proto_tree_add_item(tree, hf_zbee_zcl_met_supply_status_response_issuer_event_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN); + *offset += 4; + + /* Implementation Date/Time */ + implementation_date_time.secs = (time_t)tvb_get_letohl(tvb, *offset) + ZBEE_ZCL_NSTIME_UTC_OFFSET; + implementation_date_time.nsecs = 0; + proto_tree_add_time(tree, hf_zbee_zcl_met_supply_status_response_implementation_date_time, tvb, *offset, 4, &implementation_date_time); + *offset += 4; + + /* Supply Status After Implementation */ + proto_tree_add_item(tree, hf_zbee_zcl_met_supply_status_response_supply_status_after_implementation, tvb, *offset, 1, ENC_LITTLE_ENDIAN); + *offset += 1; +} /*dissect_zcl_met_supply_status_response*/ + /** *This function registers the ZCL Metering dissector * @@ -5805,10 +6289,54 @@ proto_register_zbee_zcl_met(void) { "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_get_profile_interval_channel, + { "Interval Channel", "zbee_zcl_se.met.get_profile.interval_channel", FT_UINT8, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_get_profile_end_time, + { "End Time", "zbee_zcl_se.met.get_profile.end_time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_get_profile_number_of_periods, + { "Number of Periods", "zbee_zcl_se.met.get_profile.number_of_periods", FT_UINT8, BASE_DEC, NULL, + 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_mirror_removed_removed_endpoint_id, + { "Removed EndPoint ID", "zbee_zcl_se.met.mirror_removed.removed_endpoint_id", FT_UINT16, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_request_fast_poll_mode_fast_poll_update_period, + { "Fast Poll Update Period", "zbee_zcl_se.met.request_fast_poll_mode.fast_poll_update_period", FT_UINT8, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_request_fast_poll_mode_duration, + { "Duration", "zbee_zcl_se.met.request_fast_poll_mode.duration", FT_UINT8, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_schedule_snapshot_issuer_event_id, + { "Issuer Event ID", "zbee_zcl_se.met.schedule_snapshot.issuer_event_id", FT_UINT32, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_schedule_snapshot_command_index, + { "Command Index", "zbee_zcl_se.met.schedule_snapshot.command_index", FT_UINT8, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_schedule_snapshot_total_number_of_commands, + { "Total Number of Commands", "zbee_zcl_se.met.schedule_snapshot.total_number_of_commands", FT_UINT8, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_schedule_snapshot_snapshot_schedule_payload, + { "Snapshot Schedule Payload", "zbee_zcl_se.met.schedule_snapshot.snapshot_schedule_payload", FT_BYTES, BASE_NONE, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_take_snapshot_snapshot_cause, + { "Snapshot Cause", "zbee_zcl_se.met.take_snapshot.snapshot_cause", FT_UINT32, BASE_HEX, 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 } }, @@ -5825,6 +6353,26 @@ proto_register_zbee_zcl_met(void) { "Snapshot Cause", "zbee_zcl_se.met.get_snapshot.snapshot_cause", FT_UINT32, BASE_HEX, NULL, 0x00, NULL, HFILL } }, + { &hf_zbee_zcl_met_start_sampling_issuer_event_id, + { "Issuer Event ID", "zbee_zcl_se.met.start_sampling.issuer_event_id", FT_UINT32, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_start_sampling_start_sampling_time, + { "Start Sampling Time", "zbee_zcl_se.met.start_sampling.start_sampling_time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_start_sampling_sample_type, + { "Sample Type", "zbee_zcl_se.met.start_sampling.sample_type", FT_UINT8, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_start_sampling_sample_request_interval, + { "Sample Request Interval", "zbee_zcl_se.met.start_sampling.sample_request_interval", FT_UINT16, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_start_sampling_max_number_of_samples, + { "Max Number of Samples", "zbee_zcl_se.met.start_sampling.max_number_of_samples", FT_UINT16, BASE_DEC, 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 } }, @@ -5841,10 +6389,110 @@ proto_register_zbee_zcl_met(void) { "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_mirror_report_attribute_response_notification_scheme, + { "Notification Scheme", "zbee_zcl_se.met.mirror_report_attribute_response.notification_scheme", FT_UINT8, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_mirror_report_attribute_response_notification_flags_n, + { "Notification Flags #N", "zbee_zcl_se.met.mirror_report_attribute_response.notification_flags_n", FT_UINT32, BASE_HEX, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_reset_load_limit_counter_provider_id, + { "Provider ID", "zbee_zcl_se.met.reset_load_limit_counter.provider_id", FT_UINT32, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_reset_load_limit_counter_issuer_event_id, + { "Issuer Event ID", "zbee_zcl_se.met.reset_load_limit_counter.issuer_event_id", FT_UINT32, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_change_supply_provider_id, + { "Provider ID", "zbee_zcl_se.met.change_supply.provider_id", FT_UINT32, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_change_supply_issuer_event_id, + { "Issuer Event ID", "zbee_zcl_se.met.change_supply.issuer_event_id", FT_UINT32, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_change_supply_request_date_time, + { "Request Date/Time", "zbee_zcl_se.met.change_supply.request_date_time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_change_supply_implementation_date_time, + { "Implementation Date/Time", "zbee_zcl_se.met.change_supply.implementation_date_time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_change_supply_proposed_supply_status, + { "Proposed Supply Status", "zbee_zcl_se.met.change_supply.proposed_supply_status", FT_UINT8, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_change_supply_supply_control_bits, + { "Supply Control bits", "zbee_zcl_se.met.change_supply.supply_control_bits", FT_UINT8, BASE_HEX, 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_set_supply_status_issuer_event_id, + { "Issuer Event ID", "zbee_zcl_se.met.set_supply_status.issuer_event_id", FT_UINT32, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_set_supply_status_supply_tamper_state, + { "Supply Tamper State", "zbee_zcl_se.met.set_supply_status.supply_tamper_state", FT_UINT8, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_set_supply_status_supply_depletion_state, + { "Supply Depletion State", "zbee_zcl_se.met.set_supply_status.supply_depletion_state", FT_UINT8, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_set_supply_status_supply_uncontrolled_flow_state, + { "Supply Uncontrolled Flow State", "zbee_zcl_se.met.set_supply_status.supply_uncontrolled_flow_state", FT_UINT8, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_set_supply_status_load_limit_supply_state, + { "Load Limit Supply State", "zbee_zcl_se.met.set_supply_status.load_limit_supply_state", FT_UINT8, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_set_uncontrolled_flow_threshold_provider_id, + { "Provider ID", "zbee_zcl_se.met.set_uncontrolled_flow_threshold.provider_id", FT_UINT32, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_set_uncontrolled_flow_threshold_issuer_event_id, + { "Issuer Event ID", "zbee_zcl_se.met.set_uncontrolled_flow_threshold.issuer_event_id", FT_UINT32, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_set_uncontrolled_flow_threshold_uncontrolled_flow_threshold, + { "Uncontrolled Flow Threshold", "zbee_zcl_se.met.set_uncontrolled_flow_threshold.uncontrolled_flow_threshold", FT_UINT16, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_set_uncontrolled_flow_threshold_unit_of_measure, + { "Unit of Measure", "zbee_zcl_se.met.set_uncontrolled_flow_threshold.unit_of_measure", FT_UINT8, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_set_uncontrolled_flow_threshold_multiplier, + { "Multiplier", "zbee_zcl_se.met.set_uncontrolled_flow_threshold.multiplier", FT_UINT16, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_set_uncontrolled_flow_threshold_divisor, + { "Divisor", "zbee_zcl_se.met.set_uncontrolled_flow_threshold.divisor", FT_UINT16, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_set_uncontrolled_flow_threshold_stabilisation_period, + { "Stabilisation Period", "zbee_zcl_se.met.set_uncontrolled_flow_threshold.stabilisation_period", FT_UINT8, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_set_uncontrolled_flow_threshold_measurment_period, + { "Measurement Period", "zbee_zcl_se.met.set_uncontrolled_flow_threshold.measurment_period", FT_UINT16, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_take_snapshot_response_snapshot_id, + { "Snapshot ID", "zbee_zcl_se.met.take_snapshot_response.snapshot_id", FT_UINT32, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_take_snapshot_response_snapshot_confirmation, + { "Snapshot Confirmation", "zbee_zcl_se.met.take_snapshot_response.snapshot_confirmation", FT_UINT8, BASE_HEX, 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 } }, @@ -5927,6 +6575,22 @@ proto_register_zbee_zcl_met(void) { &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 } }, + + { &hf_zbee_zcl_met_supply_status_response_provider_id, + { "Provider ID", "zbee_zcl_se.met.supply_status_response.provider_id", FT_UINT32, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_supply_status_response_issuer_event_id, + { "Issuer Event ID", "zbee_zcl_se.met.supply_status_response.issuer_event_id", FT_UINT32, BASE_DEC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_supply_status_response_implementation_date_time, + { "Implementation Date/Time", "zbee_zcl_se.met.supply_status_response.implementation_date_time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, + 0x00, NULL, HFILL } }, + + { &hf_zbee_zcl_met_supply_status_response_supply_status_after_implementation, + { "Supply Status After Implementation", "zbee_zcl_se.met.supply_status_response.supply_status_after_implementation", FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL } } };