| File: | builds/wireshark/wireshark/epan/dissectors/packet-zbee-nwk-gp.c |
| Warning: | line 1175, column 13 Value stored to 'offset' is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
| 1 | /* packet-zbee-nwk-gp.c |
| 2 | * Dissector routines for the ZigBee Green Power profile (GP) |
| 3 | * Copyright 2013 DSR Corporation, http://dsr-wireless.com/ |
| 4 | * |
| 5 | * Wireshark - Network traffic analyzer |
| 6 | * By Gerald Combs <gerald@wireshark.org> |
| 7 | * Copyright 1998 Gerald Combs |
| 8 | * |
| 9 | * Used Owen Kirby's packet-zbee-aps module as a template. Based |
| 10 | * on ZigBee Cluster Library Specification document 075123r02ZB |
| 11 | * |
| 12 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 13 | */ |
| 14 | |
| 15 | /* Include files. */ |
| 16 | #include "config.h" |
| 17 | |
| 18 | #include <epan/packet.h> |
| 19 | #include <epan/exceptions.h> |
| 20 | #include <epan/expert.h> |
| 21 | #include <epan/prefs.h> |
| 22 | #include <epan/uat.h> |
| 23 | #include <wsutil/bits_ctz.h> |
| 24 | #include <wsutil/pint.h> |
| 25 | #include "packet-zbee.h" |
| 26 | #include "packet-zbee-nwk.h" |
| 27 | #include "packet-zbee-security.h" |
| 28 | #include "packet-zbee-aps.h" |
| 29 | #include "packet-zbee-zcl.h" |
| 30 | |
| 31 | void proto_register_zbee_nwk_gp(void); |
| 32 | void proto_reg_handoff_zbee_nwk_gp(void); |
| 33 | |
| 34 | /**************************/ |
| 35 | /* Defines. */ |
| 36 | /**************************/ |
| 37 | |
| 38 | /* ZigBee NWK GP FCF frame types. */ |
| 39 | #define ZBEE_NWK_GP_FCF_DATA0x00 0x00 |
| 40 | #define ZBEE_NWK_GP_FCF_MAINTENANCE0x01 0x01 |
| 41 | |
| 42 | /* ZigBee NWK GP FCF fields. */ |
| 43 | #define ZBEE_NWK_GP_FCF_AUTO_COMMISSIONING0x40 0x40 |
| 44 | #define ZBEE_NWK_GP_FCF_CONTROL_EXTENSION0x80 0x80 |
| 45 | #define ZBEE_NWK_GP_FCF_FRAME_TYPE0x03 0x03 |
| 46 | #define ZBEE_NWK_GP_FCF_VERSION0x3C 0x3C |
| 47 | |
| 48 | /* Extended NWK Frame Control field. */ |
| 49 | #define ZBEE_NWK_GP_FCF_EXT_APP_ID0x07 0x07 /* 0 - 2 b. */ |
| 50 | #define ZBEE_NWK_GP_FCF_EXT_SECURITY_LEVEL0x18 0x18 /* 3 - 4 b. */ |
| 51 | #define ZBEE_NWK_GP_FCF_EXT_SECURITY_KEY0x20 0x20 /* 5 b. */ |
| 52 | #define ZBEE_NWK_GP_FCF_EXT_RX_AFTER_TX0x40 0x40 /* 6 b. */ |
| 53 | #define ZBEE_NWK_GP_FCF_EXT_DIRECTION0x80 0x80 /* 7 b. */ |
| 54 | |
| 55 | /* Definitions for application IDs. */ |
| 56 | #define ZBEE_NWK_GP_APP_ID_DEFAULT0x00 0x00 |
| 57 | #define ZBEE_NWK_GP_APP_ID_LPED0x01 0x01 |
| 58 | #define ZBEE_NWK_GP_APP_ID_ZGP0x02 0x02 |
| 59 | |
| 60 | /* Definitions for GP directions. */ |
| 61 | #define ZBEE_NWK_GP_FC_EXT_DIRECTION_DEFAULT0x00 0x00 |
| 62 | #define ZBEE_NWK_GP_FC_EXT_DIRECTION_FROM_ZGPD0x00 0x00 |
| 63 | #define ZBEE_NWK_GP_FC_EXT_DIRECTION_FROM_ZGPP0x01 0x01 |
| 64 | |
| 65 | /* Definitions for ZGPD Source IDs. */ |
| 66 | #define ZBEE_NWK_GP_ZGPD_SRCID_ALL0xFFFFFFFF 0xFFFFFFFF |
| 67 | #define ZBEE_NWK_GP_ZGPD_SRCID_UNKNOWN0x00000000 0x00000000 |
| 68 | |
| 69 | /* Security level values. */ |
| 70 | #define ZBEE_NWK_GP_SECURITY_LEVEL_NO0x00 0x00 |
| 71 | #define ZBEE_NWK_GP_SECURITY_LEVEL_1LSB0x01 0x01 |
| 72 | #define ZBEE_NWK_GP_SECURITY_LEVEL_FULL0x02 0x02 |
| 73 | #define ZBEE_NWK_GP_SECURITY_LEVEL_FULLENCR0x03 0x03 |
| 74 | |
| 75 | /* GP Security key types. */ |
| 76 | #define ZBEE_NWK_GP_SECURITY_KEY_TYPE_NO_KEY0x00 0x00 |
| 77 | #define ZBEE_NWK_GP_SECURITY_KEY_TYPE_ZB_NWK_KEY0x01 0x01 |
| 78 | #define ZBEE_NWK_GP_SECURITY_KEY_TYPE_GPD_GROUP_KEY0x02 0x02 |
| 79 | #define ZBEE_NWK_GP_SECURITY_KEY_TYPE_NWK_KEY_DERIVED_GPD_KEY_GROUP_KEY0x03 0x03 |
| 80 | #define ZBEE_NWK_GP_SECURITY_KEY_TYPE_PRECONFIGURED_INDIVIDUAL_GPD_KEY0x04 0x04 |
| 81 | #define ZBEE_NWK_GP_SECURITY_KEY_TYPE_DERIVED_INDIVIDUAL_GPD_KEY0x07 0x07 |
| 82 | |
| 83 | typedef struct { |
| 84 | /* FCF Data. */ |
| 85 | uint8_t frame_type; |
| 86 | bool_Bool nwk_frame_control_extension; |
| 87 | |
| 88 | /* Ext FCF Data. */ |
| 89 | uint8_t application_id; |
| 90 | uint8_t security_level; |
| 91 | uint8_t direction; |
| 92 | |
| 93 | /* Src ID. */ |
| 94 | uint32_t source_id; |
| 95 | |
| 96 | /* GPD Endpoint */ |
| 97 | uint8_t endpoint; |
| 98 | |
| 99 | /* Security Frame Counter. */ |
| 100 | uint32_t security_frame_counter; |
| 101 | |
| 102 | /* MIC. */ |
| 103 | uint8_t mic_size; |
| 104 | uint32_t mic; |
| 105 | |
| 106 | /* Application Payload. */ |
| 107 | uint8_t payload_len; |
| 108 | |
| 109 | /* Source IEEE address from parent */ |
| 110 | uint64_t ieee_packet_src64; |
| 111 | } zbee_nwk_green_power_packet; |
| 112 | |
| 113 | /* Definitions for GP Commissioning command opt field (bitmask). */ |
| 114 | #define ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_MAC_SEQ0x01 0x01 |
| 115 | #define ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_RX_ON_CAP0x02 0x02 |
| 116 | #define ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_APPLICATION_INFO0x04 0x04 |
| 117 | #define ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_PAN_ID_REQ0x10 0x10 |
| 118 | #define ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_GP_SEC_KEY_REQ0x20 0x20 |
| 119 | #define ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_FIXED_LOCATION0x40 0x40 |
| 120 | #define ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_EXT_OPTIONS0x80 0x80 |
| 121 | |
| 122 | /* Definitions for GP Commissioning command ext_opt field (bitmask). */ |
| 123 | #define ZBEE_NWK_GP_CMD_COMMISSIONING_EXT_OPT_SEC_LEVEL_CAP0x03 0x03 |
| 124 | #define ZBEE_NWK_GP_CMD_COMMISSIONING_EXT_OPT_KEY_TYPE0x1C 0x1C |
| 125 | #define ZBEE_NWK_GP_CMD_COMMISSIONING_EXT_OPT_GPD_KEY_PRESENT0x20 0x20 |
| 126 | #define ZBEE_NWK_GP_CMD_COMMISSIONING_EXT_OPT_GPD_KEY_ENCR0x40 0x40 |
| 127 | #define ZBEE_NWK_GP_CMD_COMMISSIONING_EXT_OPT_OUT_COUNTER0x80 0x80 |
| 128 | |
| 129 | /* Definitions for GP Commissioning command application information field (bitmask). */ |
| 130 | #define ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_MIP0x01 0x01 |
| 131 | #define ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_MMIP0x02 0x02 |
| 132 | #define ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_GCLP0x04 0x04 |
| 133 | #define ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_CRP0x08 0x08 |
| 134 | #define ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_SIP0x10 0x10 |
| 135 | #define ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_ADCF0x20 0x20 |
| 136 | #define ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_RES0xC0 0xC0 |
| 137 | |
| 138 | /* Definitions for GP Commissioning command switch information field. */ |
| 139 | #define ZBEE_NWK_GP_CMD_COMMISSIONING_SWITCH_INFO_LEN0x02 0x02 |
| 140 | #define ZBEE_NWK_GP_CMD_COMMISSIONING_SWITCH_CONF_NUM_CONTACTS0x0F 0x0F |
| 141 | #define ZBEE_NWK_GP_CMD_COMMISSIONING_SWITCH_CONF_SWITCH_TYPE0x30 0x30 |
| 142 | #define ZBEE_NWK_GP_CMD_COMMISSIONING_SWITCH_CONF_RES0xC0 0xC0 |
| 143 | |
| 144 | /* Definitions for GP Commissioning command Number of server ClusterIDs (bitmask) */ |
| 145 | #define ZBEE_NWK_GP_CMD_COMMISSIONING_CLID_LIST_LEN_SRV0x0F 0x0F |
| 146 | #define ZBEE_NWK_GP_CMD_COMMISSIONING_CLID_LIST_LEN_CLI0xF0 0xF0 |
| 147 | |
| 148 | /* Definitions for GP Decommissioning command opt field (bitmask). */ |
| 149 | #define ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_PAN_ID_PRESENT0x01 0x01 |
| 150 | #define ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_SEC_KEY_PRESENT0x02 0x02 |
| 151 | #define ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_KEY_ENCR0x04 0x04 |
| 152 | #define ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_SEC_LEVEL0x18 0x18 |
| 153 | #define ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_KEY_TYPE0xE0 0xE0 |
| 154 | |
| 155 | /* Definition for GP read attributes command opt field (bitmask). */ |
| 156 | #define ZBEE_NWK_GP_CMD_READ_ATTRIBUTE_OPT_MULTI_RECORD0x01 0x01 |
| 157 | #define ZBEE_NWK_GP_CMD_READ_ATTRIBUTE_OPT_MAN_FIELD_PRESENT0x02 0x02 |
| 158 | |
| 159 | #define ZBEE_NWK_GP_CMD_ZCL_TUNNEL_OPT_FRAME_TYPE0x03 0x03 |
| 160 | #define ZBEE_NWK_GP_CMD_ZCL_TUNNEL_OPT_MAN_FIELD_PRESENT0x04 0x04 |
| 161 | #define ZBEE_NWK_GP_CMD_ZCL_TUNNEL_OPT_DIRECTION0x08 0x08 |
| 162 | |
| 163 | /* Definition for GP Application Description command opt fields bitmasks */ |
| 164 | #define ZBEE_NWK_GP_CMD_APP_DESC_REPORT_DESC_OPT_TIMEOUT_PRESENT0x01 0x01 |
| 165 | #define ZBEE_NWK_GP_CMD_APP_DESC_DATA_PT_DESC_OPT_ATTR_NUM0x07 0x07 |
| 166 | #define ZBEE_NWK_GP_CMD_APP_DESC_DATA_PT_DESC_OPT_SERVER0x08 0x08 |
| 167 | #define ZBEE_NWK_GP_CMD_APP_DESC_DATA_PT_DESC_OPT_MANU_ID_PRESENT0x10 0x10 |
| 168 | #define ZBEE_NWK_GP_CMD_APP_DESC_ATTR_REC_OPT_LEN_REMAIN0x0F 0x0F |
| 169 | #define ZBEE_NWK_GP_CMD_APP_DESC_ATTR_REC_OPT_REPORTED0x10 0x10 |
| 170 | #define ZBEE_NWK_GP_CMD_APP_DESC_ATTR_REC_OPT_VAL_PRESENT0x20 0x20 |
| 171 | |
| 172 | /* Definitions for GP Channel Request command. */ |
| 173 | #define ZBEE_NWK_GP_CMD_CHANNEL_REQUEST_1ST0x0F 0x0F |
| 174 | #define ZBEE_NWK_GP_CMD_CHANNEL_REQUEST_2ND0xF0 0xF0 |
| 175 | |
| 176 | /* GP Channel Configuration command. */ |
| 177 | #define ZBEE_NWK_GP_CMD_CHANNEL_CONFIGURATION_OPERATION_CH0x0F 0x0F |
| 178 | |
| 179 | /* GP GENERIC IDS. */ |
| 180 | #define GPD_DEVICE_ID_GENERIC_GP_SIMPLE_GENERIC_1STATE_SWITCH0x00 0x00 |
| 181 | #define GPD_DEVICE_ID_GENERIC_GP_SIMPLE_GENERIC_2STATE_SWITCH0x01 0x01 |
| 182 | #define GPD_DEVICE_ID_GENERIC_GP_ON_OFF_SWITCH0x02 0x02 |
| 183 | #define GPD_DEVICE_ID_GENERIC_GP_LEVEL_CONTROL_SWITCH0x03 0x03 |
| 184 | #define GPD_DEVICE_ID_GENERIC_GP_SIMPLE_SENSOR0x04 0x04 |
| 185 | #define GPD_DEVICE_ID_GENERIC_GP_ADVANCED_GENERIC_1STATE_SWITCH0x05 0x05 |
| 186 | #define GPD_DEVICE_ID_GENERIC_GP_ADVANCED_GENERIC_2STATE_SWITCH0x06 0x06 |
| 187 | |
| 188 | /* GP LIGHTING IDS. */ |
| 189 | #define GPD_DEVICE_ID_LIGHTING_GP_COLOR_DIMMER_SWITCH0x10 0x10 |
| 190 | #define GPD_DEVICE_ID_LIGHTING_GP_LIGHT_SENSOR0x11 0x11 |
| 191 | #define GPD_DEVICE_ID_LIGHTING_GP_OCCUPANCY_SENSOR0x12 0x12 |
| 192 | |
| 193 | /* GP CLOSURES IDS. */ |
| 194 | #define GPD_DEVICE_ID_CLOSURES_GP_DOOR_LOCK_CONTROLLER0x20 0x20 |
| 195 | |
| 196 | /* HVAC IDS. */ |
| 197 | #define GPD_DEVICE_ID_HVAC_GP_TEMPERATURE_SENSOR0x30 0x30 |
| 198 | #define GPD_DEVICE_ID_HVAC_GP_PRESSURE_SENSOR0x31 0x31 |
| 199 | #define GPD_DEVICE_ID_HVAC_GP_FLOW_SENSOR0x32 0x32 |
| 200 | #define GPD_DEVICE_ID_HVAC_GP_INDOOR_ENVIRONMENT_SENSOR0x33 0x33 |
| 201 | |
| 202 | /* Manufacturer specific device. */ |
| 203 | #define GPD_DEVICE_ID_MANUFACTURER_SPECIFIC0xFE 0xFE |
| 204 | |
| 205 | /* GPD manufacturers. */ |
| 206 | #define ZBEE_NWK_GP_MANUF_ID_GREENPEAK0x10D0 0x10D0 |
| 207 | |
| 208 | /* GPD devices by GreenPeak. */ |
| 209 | #define ZBEE_NWK_GP_MANUF_GREENPEAK_IZDS0x0000 0x0000 |
| 210 | #define ZBEE_NWK_GP_MANUF_GREENPEAK_IZDWS0x0001 0x0001 |
| 211 | #define ZBEE_NWK_GP_MANUF_GREENPEAK_IZLS0x0002 0x0002 |
| 212 | #define ZBEE_NWK_GP_MANUF_GREENPEAK_IZRHS0x0003 0x0003 |
| 213 | |
| 214 | /*********************/ |
| 215 | /* Global variables. */ |
| 216 | /*********************/ |
| 217 | |
| 218 | /* GP proto handle. */ |
| 219 | static int proto_zbee_nwk_gp; |
| 220 | |
| 221 | /* GP NWK FC. */ |
| 222 | static int hf_zbee_nwk_gp_auto_commissioning; |
| 223 | static int hf_zbee_nwk_gp_fc_ext; |
| 224 | static int hf_zbee_nwk_gp_fcf; |
| 225 | static int hf_zbee_nwk_gp_frame_type; |
| 226 | static int hf_zbee_nwk_gp_proto_version; |
| 227 | |
| 228 | /* GP NWK FC extension. */ |
| 229 | static int hf_zbee_nwk_gp_fc_ext_field; |
| 230 | static int hf_zbee_nwk_gp_fc_ext_app_id; |
| 231 | static int hf_zbee_nwk_gp_fc_ext_direction; |
| 232 | static int hf_zbee_nwk_gp_fc_ext_rx_after_tx; |
| 233 | static int hf_zbee_nwk_gp_fc_ext_sec_key; |
| 234 | static int hf_zbee_nwk_gp_fc_ext_sec_level; |
| 235 | |
| 236 | /* ZGPD Src ID. */ |
| 237 | static int hf_zbee_nwk_gp_zgpd_src_id; |
| 238 | |
| 239 | /* ZGPD Endpoint */ |
| 240 | static int hf_zbee_nwk_gp_zgpd_endpoint; |
| 241 | |
| 242 | /* Security frame counter. */ |
| 243 | static int hf_zbee_nwk_gp_security_frame_counter; |
| 244 | |
| 245 | /* Security MIC. */ |
| 246 | static int hf_zbee_nwk_gp_security_mic_2b; |
| 247 | static int hf_zbee_nwk_gp_security_mic_4b; |
| 248 | |
| 249 | /* Payload subframe. */ |
| 250 | static int hf_zbee_nwk_gp_command_id; |
| 251 | |
| 252 | /* Commissioning. */ |
| 253 | static int hf_zbee_nwk_gp_cmd_comm_device_id; |
| 254 | static int hf_zbee_nwk_gp_cmd_comm_ext_opt; |
| 255 | static int hf_zbee_nwk_gp_cmd_comm_ext_opt_gpd_key_encr; |
| 256 | static int hf_zbee_nwk_gp_cmd_comm_ext_opt_gpd_key_present; |
| 257 | static int hf_zbee_nwk_gp_cmd_comm_ext_opt_key_type; |
| 258 | static int hf_zbee_nwk_gp_cmd_comm_ext_opt_outgoing_counter; |
| 259 | static int hf_zbee_nwk_gp_cmd_comm_ext_opt_sec_level_cap; |
| 260 | static int hf_zbee_nwk_gp_cmd_comm_security_key; |
| 261 | static int hf_zbee_nwk_gp_cmd_comm_gpd_sec_key_mic; |
| 262 | static int hf_zbee_nwk_gp_cmd_comm_opt_ext_opt; |
| 263 | static int hf_zbee_nwk_gp_cmd_comm_opt; |
| 264 | static int hf_zbee_nwk_gp_cmd_comm_opt_fixed_location; |
| 265 | static int hf_zbee_nwk_gp_cmd_comm_opt_mac_sec_num_cap; |
| 266 | static int hf_zbee_nwk_gp_cmd_comm_opt_appli_info_present; |
| 267 | static int hf_zbee_nwk_gp_cmd_comm_opt_panid_req; |
| 268 | static int hf_zbee_nwk_gp_cmd_comm_opt_rx_on_cap; |
| 269 | static int hf_zbee_nwk_gp_cmd_comm_opt_sec_key_req; |
| 270 | static int hf_zbee_nwk_gp_cmd_comm_outgoing_counter; |
| 271 | static int hf_zbee_nwk_gp_cmd_comm_manufacturer_greenpeak_dev_id; |
| 272 | static int hf_zbee_nwk_gp_cmd_comm_manufacturer_dev_id; |
| 273 | static int hf_zbee_nwk_gp_cmd_comm_manufacturer_id; |
| 274 | static int hf_zbee_nwk_gp_cmd_comm_appli_info; |
| 275 | static int hf_zbee_nwk_gp_cmd_comm_appli_info_crp; |
| 276 | static int hf_zbee_nwk_gp_cmd_comm_appli_info_gclp; |
| 277 | static int hf_zbee_nwk_gp_cmd_comm_appli_info_mip; |
| 278 | static int hf_zbee_nwk_gp_cmd_comm_appli_info_mmip; |
| 279 | static int hf_zbee_nwk_gp_cmd_comm_appli_info_sip; |
| 280 | static int hf_zbee_nwk_gp_cmd_comm_appli_info_adcf; |
| 281 | static int hf_zbee_nwk_gp_cmd_comm_appli_info_res; |
| 282 | static int hf_zbee_nwk_gp_cmd_comm_gpd_cmd_num; |
| 283 | static int hf_zbee_nwk_gp_cmd_comm_gpd_cmd_id_list; |
| 284 | static int hf_zbee_nwk_gp_cmd_comm_length_of_clid_list; |
| 285 | static int hf_zbee_nwk_gp_cmd_comm_length_of_clid_list_server; |
| 286 | static int hf_zbee_nwk_gp_cmd_comm_length_of_clid_list_client; |
| 287 | static int hf_zbee_nwk_cmd_comm_clid_list_server; |
| 288 | static int hf_zbee_nwk_cmd_comm_clid_list_client; |
| 289 | static int hf_zbee_nwk_cmd_comm_cluster_id; |
| 290 | static int hf_zbee_nwk_gp_cmd_comm_switch_info; |
| 291 | static int hf_zbee_nwk_gp_cmd_comm_switch_info_length; |
| 292 | static int hf_zbee_nwk_gp_cmd_comm_switch_info_generic_switch_config; |
| 293 | static int hf_zbee_nwk_gp_cmd_comm_switch_info_num_contacts; |
| 294 | static int hf_zbee_nwk_gp_cmd_comm_switch_info_switch_type; |
| 295 | static int hf_zbee_nwk_gp_cmd_comm_switch_info_reserved; |
| 296 | static int hf_zbee_nwk_gp_cmd_comm_switch_info_current_contact_status; |
| 297 | |
| 298 | /* Commissioning reply. */ |
| 299 | static int hf_zbee_nwk_gp_cmd_comm_rep_opt; |
| 300 | static int hf_zbee_nwk_gp_cmd_comm_rep_opt_key_encr; |
| 301 | static int hf_zbee_nwk_gp_cmd_comm_rep_opt_panid_present; |
| 302 | static int hf_zbee_nwk_gp_cmd_comm_rep_opt_sec_key_present; |
| 303 | static int hf_zbee_nwk_gp_cmd_comm_rep_opt_sec_level; |
| 304 | static int hf_zbee_nwk_gp_cmd_comm_rep_opt_sec_type; |
| 305 | static int hf_zbee_nwk_gp_cmd_comm_rep_pan_id; |
| 306 | static int hf_zbee_nwk_gp_cmd_comm_rep_frame_counter; |
| 307 | |
| 308 | /* Read attribute and read attribute response. */ |
| 309 | static int hf_zbee_nwk_gp_cmd_read_att_opt_multi_rec; |
| 310 | static int hf_zbee_nwk_gp_cmd_read_att_opt_man_field_present; |
| 311 | static int hf_zbee_nwk_gp_cmd_read_att_opt; |
| 312 | static int hf_zbee_nwk_gp_cmd_read_att_record_len; |
| 313 | |
| 314 | /* ZCL Tunnel */ |
| 315 | static int hf_zbee_nwk_gp_cmd_zcl_tunnel_opt_frame_type; |
| 316 | static int hf_zbee_nwk_gp_cmd_zcl_tunnel_opt_man_field_present; |
| 317 | static int hf_zbee_nwk_gp_cmd_zcl_tunnel_opt_direction; |
| 318 | static int hf_zbee_nwk_gp_cmd_zcl_tunnel_opt; |
| 319 | static int hf_zbee_nwk_gp_cmd_zcl_tunnel_command_id; |
| 320 | static int hf_zbee_nwk_gp_cmd_zcl_tunnel_payload_len; |
| 321 | |
| 322 | /* Compact Attribute Reporting */ |
| 323 | static int hf_zbee_nwk_gp_cmd_compact_attr_report_report_id; |
| 324 | static int hf_zbee_nwk_gp_cmd_compact_attr_report_data_points; |
| 325 | |
| 326 | /* Application Description */ |
| 327 | static int hf_zbee_nwk_gp_cmd_app_desc_total_report; |
| 328 | static int hf_zbee_nwk_gp_cmd_app_desc_num_report; |
| 329 | static int hf_zbee_nwk_gp_cmd_app_desc_report_desc_id; |
| 330 | static int hf_zbee_nwk_gp_cmd_app_desc_report_desc_opt; |
| 331 | static int hf_zbee_nwk_gp_cmd_app_desc_report_desc_opt_timeout_present; |
| 332 | static int hf_zbee_nwk_gp_cmd_app_desc_report_desc_timeout; |
| 333 | static int hf_zbee_nwk_gp_cmd_app_desc_report_desc_len_remain; |
| 334 | static int hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_opt; |
| 335 | static int hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_opt_num_recs; |
| 336 | static int hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_opt_server; |
| 337 | static int hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_opt_manu_id_present; |
| 338 | static int hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_cluster_id; |
| 339 | static int hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_manu_id; |
| 340 | static int hf_zbee_nwk_gp_cmd_app_desc_attr_rec_id; |
| 341 | static int hf_zbee_nwk_gp_cmd_app_desc_attr_rec_data_type; |
| 342 | static int hf_zbee_nwk_gp_cmd_app_desc_attr_rec_opt; |
| 343 | static int hf_zbee_nwk_gp_cmd_app_desc_attr_rec_opt_len_remain; |
| 344 | static int hf_zbee_nwk_gp_cmd_app_desc_attr_rec_opt_reported; |
| 345 | static int hf_zbee_nwk_gp_cmd_app_desc_attr_rec_opt_val_present; |
| 346 | static int hf_zbee_nwk_gp_cmd_app_desc_attr_rec_offset; |
| 347 | static int hf_zbee_nwk_gp_cmd_app_desc_attr_rec_val; |
| 348 | |
| 349 | /* Common to commands returning data */ |
| 350 | static int hf_zbee_nwk_gp_zcl_attr_status; |
| 351 | static int hf_zbee_nwk_gp_zcl_attr_data_type; |
| 352 | static int hf_zbee_nwk_gp_zcl_attr_cluster_id; |
| 353 | |
| 354 | /* Common to all manufacturer specific commands */ |
| 355 | static int hf_zbee_zcl_gp_cmd_ms_manufacturer_code; |
| 356 | |
| 357 | /* Channel request. */ |
| 358 | static int hf_zbee_nwk_gp_cmd_channel_request_toggling_behaviour; |
| 359 | static int hf_zbee_nwk_gp_cmd_channel_request_toggling_behaviour_1st; |
| 360 | static int hf_zbee_nwk_gp_cmd_channel_request_toggling_behaviour_2nd; |
| 361 | |
| 362 | /* Channel Configuration command. */ |
| 363 | static int hf_zbee_nwk_gp_cmd_operational_channel; |
| 364 | static int hf_zbee_nwk_gp_cmd_channel_configuration; |
| 365 | |
| 366 | /* Move Color command. */ |
| 367 | static int hf_zbee_nwk_gp_cmd_move_color_ratex; |
| 368 | static int hf_zbee_nwk_gp_cmd_move_color_ratey; |
| 369 | |
| 370 | /* Move Up/Down command. */ |
| 371 | static int hf_zbee_nwk_gp_cmd_move_up_down_rate; |
| 372 | |
| 373 | /* Step Color command. */ |
| 374 | static int hf_zbee_nwk_gp_cmd_step_color_stepx; |
| 375 | static int hf_zbee_nwk_gp_cmd_step_color_stepy; |
| 376 | static int hf_zbee_nwk_gp_cmd_step_color_transition_time; |
| 377 | |
| 378 | /* Step Up/Down command. */ |
| 379 | static int hf_zbee_nwk_gp_cmd_step_up_down_step_size; |
| 380 | static int hf_zbee_nwk_gp_cmd_step_up_down_transition_time; |
| 381 | |
| 382 | static expert_field ei_zbee_nwk_gp_no_payload; |
| 383 | static expert_field ei_zbee_nwk_gp_inval_residual_data; |
| 384 | static expert_field ei_zbee_nwk_gp_com_rep_no_out_cnt; |
| 385 | |
| 386 | /* Proto tree elements. */ |
| 387 | static int ett_zbee_nwk; |
| 388 | static int ett_zbee_nwk_cmd; |
| 389 | static int ett_zbee_nwk_cmd_cinfo; |
| 390 | static int ett_zbee_nwk_cmd_appli_info; |
| 391 | static int ett_zbee_nwk_cmd_options; |
| 392 | static int ett_zbee_nwk_fcf; |
| 393 | static int ett_zbee_nwk_fcf_ext; |
| 394 | static int ett_zbee_nwk_clu_rec; |
| 395 | static int ett_zbee_nwk_att_rec; |
| 396 | static int ett_zbee_nwk_cmd_app_desc_report_desc; |
| 397 | static int ett_zbee_nwk_cmd_app_desc_data_pt_desc; |
| 398 | static int ett_zbee_nwk_cmd_app_desc_data_pt_options; |
| 399 | static int ett_zbee_nwk_cmd_app_desc_att_rec; |
| 400 | static int ett_zbee_nwk_cmd_comm_gpd_cmd_id_list; |
| 401 | static int ett_zbee_nwk_cmd_comm_length_of_clid_list; |
| 402 | static int ett_zbee_nwk_cmd_comm_clid_list_server; |
| 403 | static int ett_zbee_nwk_cmd_comm_clid_list_client; |
| 404 | static int ett_zbee_nwk_cmd_comm_switch_info; |
| 405 | static int ett_zbee_nwk_cmd_comm_switch_info_generic_switch_config; |
| 406 | |
| 407 | /* Common. */ |
| 408 | static GSList *zbee_gp_keyring; |
| 409 | static unsigned num_uat_key_records; |
| 410 | |
| 411 | typedef struct { |
| 412 | char *string; |
| 413 | uint8_t byte_order; |
| 414 | char *label; |
| 415 | uint8_t key[ZBEE_SEC_CONST_KEYSIZE16]; |
| 416 | } uat_key_record_t; |
| 417 | |
| 418 | static const uint8_t empty_key[ZBEE_SEC_CONST_KEYSIZE16] = { |
| 419 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 420 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 |
| 421 | }; |
| 422 | static uat_key_record_t *gp_uat_key_records; |
| 423 | static uat_t *zbee_gp_sec_key_table_uat; |
| 424 | |
| 425 | /* UAT. */ |
| 426 | UAT_CSTRING_CB_DEF(gp_uat_key_records, string, uat_key_record_t)static void gp_uat_key_records_string_set_cb(void* rec, const char* buf, unsigned len, const void* u1 __attribute__((unused )), const void* u2 __attribute__((unused))) { char* new_buf = g_strndup(buf,len); (__builtin_object_size (((((uat_key_record_t *)rec)->string)), 0) != ((size_t) - 1)) ? g_free_sized ((( (uat_key_record_t*)rec)->string), __builtin_object_size (( (((uat_key_record_t*)rec)->string)), 0)) : (g_free) ((((uat_key_record_t *)rec)->string)); (((uat_key_record_t*)rec)->string) = new_buf ; } static void gp_uat_key_records_string_tostr_cb(void* rec, char** out_ptr, unsigned* out_len, const void* u1 __attribute__ ((unused)), const void* u2 __attribute__((unused))) { if (((uat_key_record_t *)rec)->string ) { *out_ptr = g_strdup_inline ((((uat_key_record_t *)rec)->string)); *out_len = (unsigned)strlen((((uat_key_record_t *)rec)->string)); } else { *out_ptr = g_strdup_inline ("") ; *out_len = 0; } } |
| 427 | UAT_VS_DEF(gp_uat_key_records, byte_order, uat_key_record_t, uint8_t, 0, "Normal")static void gp_uat_key_records_byte_order_set_cb(void* rec, const char* buf, unsigned len, const void* vs, const void* u2 __attribute__ ((unused))) { unsigned i; char* str = g_strndup(buf,len); const char* cstr; ((uat_key_record_t*)rec)->byte_order = 0; for (i=0; ( cstr = ((const value_string*)vs)[i].strptr ) ;i++) { if ((strcmp ((const char *) (cstr), (const char *) (str)) == 0) ) { ((uat_key_record_t*)rec)->byte_order = (uint8_t)((const value_string*)vs)[i].value; (__builtin_object_size ((str), 0 ) != ((size_t) - 1)) ? g_free_sized (str, __builtin_object_size ((str), 0)) : (g_free) (str); return; } } (__builtin_object_size ((str), 0) != ((size_t) - 1)) ? g_free_sized (str, __builtin_object_size ((str), 0)) : (g_free) (str); } static void gp_uat_key_records_byte_order_tostr_cb (void* rec, char** out_ptr, unsigned* out_len, const void* vs , const void* u2 __attribute__((unused))) { unsigned i; for(i =0;((const value_string*)vs)[i].strptr;i++) { if ( ((const value_string *)vs)[i].value == ((uat_key_record_t*)rec)->byte_order ) { *out_ptr = g_strdup_inline (((const value_string*)vs)[i].strptr ); *out_len = (unsigned)strlen(*out_ptr); return; } } *out_ptr = g_strdup_inline ("Normal"); *out_len = (unsigned)strlen("Normal" ); } |
| 428 | UAT_CSTRING_CB_DEF(gp_uat_key_records, label, uat_key_record_t)static void gp_uat_key_records_label_set_cb(void* rec, const char * buf, unsigned len, const void* u1 __attribute__((unused)), const void* u2 __attribute__((unused))) { char* new_buf = g_strndup (buf,len); (__builtin_object_size (((((uat_key_record_t*)rec) ->label)), 0) != ((size_t) - 1)) ? g_free_sized ((((uat_key_record_t *)rec)->label), __builtin_object_size (((((uat_key_record_t *)rec)->label)), 0)) : (g_free) ((((uat_key_record_t*)rec) ->label)); (((uat_key_record_t*)rec)->label) = new_buf; } static void gp_uat_key_records_label_tostr_cb(void* rec, char ** out_ptr, unsigned* out_len, const void* u1 __attribute__(( unused)), const void* u2 __attribute__((unused))) { if (((uat_key_record_t *)rec)->label ) { *out_ptr = g_strdup_inline ((((uat_key_record_t *)rec)->label)); *out_len = (unsigned)strlen((((uat_key_record_t *)rec)->label)); } else { *out_ptr = g_strdup_inline (""); *out_len = 0; } } |
| 429 | |
| 430 | /****************/ |
| 431 | /* Field names. */ |
| 432 | /****************/ |
| 433 | |
| 434 | /* Byte order. */ |
| 435 | static const value_string byte_order_vals[] = { |
| 436 | { 0, "Normal"}, |
| 437 | { 1, "Reverse"}, |
| 438 | |
| 439 | { 0, NULL((void*)0) } |
| 440 | }; |
| 441 | |
| 442 | /* Application ID names. */ |
| 443 | static const value_string zbee_nwk_gp_app_id_names[] = { |
| 444 | { ZBEE_NWK_GP_APP_ID_LPED0x01, "LPED" }, |
| 445 | { ZBEE_NWK_GP_APP_ID_ZGP0x02, "ZGP" }, |
| 446 | |
| 447 | { 0, NULL((void*)0) } |
| 448 | }; |
| 449 | |
| 450 | /* Green Power commands. */ |
| 451 | |
| 452 | /* Abbreviations: |
| 453 | * GPDF commands sent: |
| 454 | * From GPD w/o payload: "F " |
| 455 | * From GPD w payload: "FP" |
| 456 | * To GPD: "T " |
| 457 | */ |
| 458 | |
| 459 | #define zbee_nwk_gp_cmd_names_VALUE_STRING_LIST(XXX)XXX( ZB_GP_CMD_ID_IDENTIFY , 0x00, "Identify" ) XXX( ZB_GP_CMD_ID_RECALL_SCENE0 , 0x10, "Recall Scene 0" ) XXX( ZB_GP_CMD_ID_RECALL_SCENE1 , 0x11, "Recall Scene 1" ) XXX( ZB_GP_CMD_ID_RECALL_SCENE2 , 0x12 , "Recall Scene 2" ) XXX( ZB_GP_CMD_ID_RECALL_SCENE3 , 0x13, "Recall Scene 3" ) XXX( ZB_GP_CMD_ID_RECALL_SCENE4 , 0x14, "Recall Scene 4" ) XXX( ZB_GP_CMD_ID_RECALL_SCENE5 , 0x15, "Recall Scene 5" ) XXX ( ZB_GP_CMD_ID_RECALL_SCENE6 , 0x16, "Recall Scene 6" ) XXX( ZB_GP_CMD_ID_RECALL_SCENE7 , 0x17, "Recall Scene 7" ) XXX( ZB_GP_CMD_ID_STORE_SCENE0 , 0x18 , "Store Scene 0" ) XXX( ZB_GP_CMD_ID_STORE_SCENE1 , 0x19, "Store Scene 1" ) XXX( ZB_GP_CMD_ID_STORE_SCENE2 , 0x1A, "Store Scene 2" ) XXX ( ZB_GP_CMD_ID_STORE_SCENE3 , 0x1B, "Store Scene 3" ) XXX( ZB_GP_CMD_ID_STORE_SCENE4 , 0x1C, "Store Scene 4" ) XXX( ZB_GP_CMD_ID_STORE_SCENE5 , 0x1D , "Store Scene 5" ) XXX( ZB_GP_CMD_ID_STORE_SCENE6 , 0x1E, "Store Scene 6" ) XXX( ZB_GP_CMD_ID_STORE_SCENE7 , 0x1F, "Store Scene 7" ) XXX ( ZB_GP_CMD_ID_OFF , 0x20, "Off" ) XXX( ZB_GP_CMD_ID_ON , 0x21 , "On" ) XXX( ZB_GP_CMD_ID_TOGGLE , 0x22, "Toggle" ) XXX( ZB_GP_CMD_ID_RELEASE , 0x23, "Release" ) XXX( ZB_GP_CMD_ID_MOVE_UP , 0x30, "Move Up" ) XXX( ZB_GP_CMD_ID_MOVE_DOWN , 0x31, "Move Down" ) XXX( ZB_GP_CMD_ID_STEP_UP , 0x32, "Step Up" ) XXX( ZB_GP_CMD_ID_STEP_DOWN , 0x33, "Step Down" ) XXX( ZB_GP_CMD_ID_LEVEL_CONTROL_STOP , 0x34, "Level Control/Stop" ) XXX( ZB_GP_CMD_ID_MOVE_UP_WITH_ON_OFF , 0x35, "Move Up (with On/Off)" ) XXX( ZB_GP_CMD_ID_MOVE_DOWN_WITH_ON_OFF , 0x36, "Move Down (with On/Off)" ) XXX( ZB_GP_CMD_ID_STEP_UP_WITH_ON_OFF , 0x37, "Step Up (with On/Off)" ) XXX( ZB_GP_CMD_ID_STEP_DOWN_WITH_ON_OFF , 0x38, "Step Down (with On/Off)" ) XXX( ZB_GP_CMD_ID_MOVE_HUE_STOP , 0x40, "Move Hue Stop" ) XXX ( ZB_GP_CMD_ID_MOVE_HUE_UP , 0x41, "Move Hue Up" ) XXX( ZB_GP_CMD_ID_MOVE_HUE_DOWN , 0x42, "Move Hue Down" ) XXX( ZB_GP_CMD_ID_STEP_HUE_UP , 0x43 , "Step Hue Up" ) XXX( ZB_GP_CMD_ID_STEP_HUW_DOWN , 0x44, "Step Hue Down" ) XXX( ZB_GP_CMD_ID_MOVE_SATURATION_STOP , 0x45, "Move Saturation Stop" ) XXX( ZB_GP_CMD_ID_MOVE_SATURATION_UP , 0x46, "Move Saturation Up" ) XXX( ZB_GP_CMD_ID_MOVE_SATURATION_DOWN , 0x47, "Move Saturation Down" ) XXX( ZB_GP_CMD_ID_STEP_SATURATION_UP , 0x48, "Step Saturation Up" ) XXX( ZB_GP_CMD_ID_STEP_SATURATION_DOWN , 0x49, "Step Saturation Down" ) XXX( ZB_GP_CMD_ID_MOVE_COLOR , 0x4A, "Move Color" ) XXX( ZB_GP_CMD_ID_STEP_COLOR , 0x4B, "Step Color" ) XXX( ZB_GP_CMD_ID_LOCK_DOOR , 0x50, "Lock Door" ) XXX( ZB_GP_CMD_ID_UNLOCK_DOOR , 0x51, "Unlock Door" ) XXX( ZB_GP_CMD_ID_PRESS11 , 0x60, "Press 1 of 1" ) XXX( ZB_GP_CMD_ID_RELEASE11 , 0x61, "Release 1 of 1" ) XXX( ZB_GP_CMD_ID_PRESS12 , 0x62, "Press 1 of 2" ) XXX( ZB_GP_CMD_ID_RELEASE12 , 0x63, "Release 1 of 2" ) XXX( ZB_GP_CMD_ID_PRESS22 , 0x64, "Press 2 of 2" ) XXX( ZB_GP_CMD_ID_RELEASE22 , 0x65, "Release 2 of 2" ) XXX( ZB_GP_CMD_ID_SHORT_PRESS11 , 0x66, "Short press 1 of 1" ) XXX( ZB_GP_CMD_ID_SHORT_PRESS12 , 0x67, "Short press 1 of 2" ) XXX( ZB_GP_CMD_ID_SHORT_PRESS22 , 0x68, "Short press 2 of 2" ) XXX( ZB_GP_CMD_ID_ATTRIBUTE_REPORTING , 0xA0, "Attribute reporting" ) XXX( ZB_GP_CMD_ID_MANUFACTURE_SPECIFIC_ATTR_REPORTING , 0xA1, "Manufacturer-specific attribute reporting" ) XXX( ZB_GP_CMD_ID_MULTI_CLUSTER_REPORTING , 0xA2, "Multi-cluster reporting" ) XXX( ZB_GP_CMD_ID_MANUFACTURER_SPECIFIC_MCLUSTER_REPORTING , 0xA3, "Manufacturer-specific multi-cluster reporting" ) XXX ( ZB_GP_CMD_ID_REQUEST_ATTRIBUTES , 0xA4, "Request Attributes" ) XXX( ZB_GP_CMD_ID_READ_ATTRIBUTES_RESPONSE , 0xA5, "Read Attributes Response" ) XXX( ZB_GP_CMD_ID_ZCL_TUNNELING , 0xA6, "ZCL Tunneling" ) XXX ( ZB_GP_CMD_ID_COMPACT_ATTR_REPORT , 0xA8, "Compact Attribute Reporting" ) XXX( ZB_GP_CMD_ID_ANY_SENSOR_COMMAND_A0_A3 , 0xAF, "Any GPD sensor command (0xA0 - 0xA3)" ) XXX( ZB_GP_CMD_ID_COMMISSIONING , 0xE0, "Commissioning" ) XXX ( ZB_GP_CMD_ID_DECOMMISSIONING , 0xE1, "Decommissioning" ) XXX ( ZB_GP_CMD_ID_SUCCESS , 0xE2, "Success" ) XXX( ZB_GP_CMD_ID_CHANNEL_REQUEST , 0xE3, "Channel Request" ) XXX( ZB_GP_CMD_ID_APPLICATION_DESC , 0xE4, "Application Description" ) XXX( ZB_GP_CMD_ID_COMMISSIONING_REPLY , 0xF0, "Commissioning Reply" ) XXX( ZB_GP_CMD_ID_WRITE_ATTRIBUTES , 0xF1, "Write Attributes" ) XXX( ZB_GP_CMD_ID_READ_ATTRIBUTES , 0xF2, "Read Attributes" ) XXX( ZB_GP_CMD_ID_CHANNEL_CONFIGURATION , 0xF3, "Channel Configuration" ) \ |
| 460 | XXX( /*F */ ZB_GP_CMD_ID_IDENTIFY , 0x00, "Identify" ) \ |
| 461 | XXX( /*F */ ZB_GP_CMD_ID_RECALL_SCENE0 , 0x10, "Recall Scene 0" ) \ |
| 462 | XXX( /*F */ ZB_GP_CMD_ID_RECALL_SCENE1 , 0x11, "Recall Scene 1" ) \ |
| 463 | XXX( /*F */ ZB_GP_CMD_ID_RECALL_SCENE2 , 0x12, "Recall Scene 2" ) \ |
| 464 | XXX( /*F */ ZB_GP_CMD_ID_RECALL_SCENE3 , 0x13, "Recall Scene 3" ) \ |
| 465 | XXX( /*F */ ZB_GP_CMD_ID_RECALL_SCENE4 , 0x14, "Recall Scene 4" ) \ |
| 466 | XXX( /*F */ ZB_GP_CMD_ID_RECALL_SCENE5 , 0x15, "Recall Scene 5" ) \ |
| 467 | XXX( /*F */ ZB_GP_CMD_ID_RECALL_SCENE6 , 0x16, "Recall Scene 6" ) \ |
| 468 | XXX( /*F */ ZB_GP_CMD_ID_RECALL_SCENE7 , 0x17, "Recall Scene 7" ) \ |
| 469 | XXX( /*F */ ZB_GP_CMD_ID_STORE_SCENE0 , 0x18, "Store Scene 0" ) \ |
| 470 | XXX( /*F */ ZB_GP_CMD_ID_STORE_SCENE1 , 0x19, "Store Scene 1" ) \ |
| 471 | XXX( /*F */ ZB_GP_CMD_ID_STORE_SCENE2 , 0x1A, "Store Scene 2" ) \ |
| 472 | XXX( /*F */ ZB_GP_CMD_ID_STORE_SCENE3 , 0x1B, "Store Scene 3" ) \ |
| 473 | XXX( /*F */ ZB_GP_CMD_ID_STORE_SCENE4 , 0x1C, "Store Scene 4" ) \ |
| 474 | XXX( /*F */ ZB_GP_CMD_ID_STORE_SCENE5 , 0x1D, "Store Scene 5" ) \ |
| 475 | XXX( /*F */ ZB_GP_CMD_ID_STORE_SCENE6 , 0x1E, "Store Scene 6" ) \ |
| 476 | XXX( /*F */ ZB_GP_CMD_ID_STORE_SCENE7 , 0x1F, "Store Scene 7" ) \ |
| 477 | XXX( /*F */ ZB_GP_CMD_ID_OFF , 0x20, "Off" ) \ |
| 478 | XXX( /*F */ ZB_GP_CMD_ID_ON , 0x21, "On" ) \ |
| 479 | XXX( /*F */ ZB_GP_CMD_ID_TOGGLE , 0x22, "Toggle" ) \ |
| 480 | XXX( /*F */ ZB_GP_CMD_ID_RELEASE , 0x23, "Release" ) \ |
| 481 | XXX( /*FP*/ ZB_GP_CMD_ID_MOVE_UP , 0x30, "Move Up" ) \ |
| 482 | XXX( /*FP*/ ZB_GP_CMD_ID_MOVE_DOWN , 0x31, "Move Down" ) \ |
| 483 | XXX( /*FP*/ ZB_GP_CMD_ID_STEP_UP , 0x32, "Step Up" ) \ |
| 484 | XXX( /*FP*/ ZB_GP_CMD_ID_STEP_DOWN , 0x33, "Step Down" ) \ |
| 485 | XXX( /*F */ ZB_GP_CMD_ID_LEVEL_CONTROL_STOP , 0x34, "Level Control/Stop" ) \ |
| 486 | XXX( /*FP*/ ZB_GP_CMD_ID_MOVE_UP_WITH_ON_OFF , 0x35, "Move Up (with On/Off)" ) \ |
| 487 | XXX( /*FP*/ ZB_GP_CMD_ID_MOVE_DOWN_WITH_ON_OFF , 0x36, "Move Down (with On/Off)" ) \ |
| 488 | XXX( /*FP*/ ZB_GP_CMD_ID_STEP_UP_WITH_ON_OFF , 0x37, "Step Up (with On/Off)" ) \ |
| 489 | XXX( /*FP*/ ZB_GP_CMD_ID_STEP_DOWN_WITH_ON_OFF , 0x38, "Step Down (with On/Off)" ) \ |
| 490 | XXX( /*F */ ZB_GP_CMD_ID_MOVE_HUE_STOP , 0x40, "Move Hue Stop" ) \ |
| 491 | XXX( /*FP*/ ZB_GP_CMD_ID_MOVE_HUE_UP , 0x41, "Move Hue Up" ) \ |
| 492 | XXX( /*FP*/ ZB_GP_CMD_ID_MOVE_HUE_DOWN , 0x42, "Move Hue Down" ) \ |
| 493 | XXX( /*FP*/ ZB_GP_CMD_ID_STEP_HUE_UP , 0x43, "Step Hue Up" ) \ |
| 494 | XXX( /*FP*/ ZB_GP_CMD_ID_STEP_HUW_DOWN , 0x44, "Step Hue Down" ) \ |
| 495 | XXX( /*F */ ZB_GP_CMD_ID_MOVE_SATURATION_STOP , 0x45, "Move Saturation Stop" ) \ |
| 496 | XXX( /*FP*/ ZB_GP_CMD_ID_MOVE_SATURATION_UP , 0x46, "Move Saturation Up" ) \ |
| 497 | XXX( /*FP*/ ZB_GP_CMD_ID_MOVE_SATURATION_DOWN , 0x47, "Move Saturation Down" ) \ |
| 498 | XXX( /*FP*/ ZB_GP_CMD_ID_STEP_SATURATION_UP , 0x48, "Step Saturation Up" ) \ |
| 499 | XXX( /*FP*/ ZB_GP_CMD_ID_STEP_SATURATION_DOWN , 0x49, "Step Saturation Down" ) \ |
| 500 | XXX( /*FP*/ ZB_GP_CMD_ID_MOVE_COLOR , 0x4A, "Move Color" ) \ |
| 501 | XXX( /*FP*/ ZB_GP_CMD_ID_STEP_COLOR , 0x4B, "Step Color" ) \ |
| 502 | XXX( /*F */ ZB_GP_CMD_ID_LOCK_DOOR , 0x50, "Lock Door" ) \ |
| 503 | XXX( /*F */ ZB_GP_CMD_ID_UNLOCK_DOOR , 0x51, "Unlock Door" ) \ |
| 504 | XXX( /*F */ ZB_GP_CMD_ID_PRESS11 , 0x60, "Press 1 of 1" ) \ |
| 505 | XXX( /*F */ ZB_GP_CMD_ID_RELEASE11 , 0x61, "Release 1 of 1" ) \ |
| 506 | XXX( /*F */ ZB_GP_CMD_ID_PRESS12 , 0x62, "Press 1 of 2" ) \ |
| 507 | XXX( /*F */ ZB_GP_CMD_ID_RELEASE12 , 0x63, "Release 1 of 2" ) \ |
| 508 | XXX( /*F */ ZB_GP_CMD_ID_PRESS22 , 0x64, "Press 2 of 2" ) \ |
| 509 | XXX( /*F */ ZB_GP_CMD_ID_RELEASE22 , 0x65, "Release 2 of 2" ) \ |
| 510 | XXX( /*F */ ZB_GP_CMD_ID_SHORT_PRESS11 , 0x66, "Short press 1 of 1" ) \ |
| 511 | XXX( /*F */ ZB_GP_CMD_ID_SHORT_PRESS12 , 0x67, "Short press 1 of 2" ) \ |
| 512 | XXX( /*F */ ZB_GP_CMD_ID_SHORT_PRESS22 , 0x68, "Short press 2 of 2" ) \ |
| 513 | XXX( /*FP*/ ZB_GP_CMD_ID_ATTRIBUTE_REPORTING , 0xA0, "Attribute reporting" ) \ |
| 514 | XXX( /*FP*/ ZB_GP_CMD_ID_MANUFACTURE_SPECIFIC_ATTR_REPORTING , 0xA1, "Manufacturer-specific attribute reporting" ) \ |
| 515 | XXX( /*FP*/ ZB_GP_CMD_ID_MULTI_CLUSTER_REPORTING , 0xA2, "Multi-cluster reporting" ) \ |
| 516 | XXX( /*FP*/ ZB_GP_CMD_ID_MANUFACTURER_SPECIFIC_MCLUSTER_REPORTING , 0xA3, "Manufacturer-specific multi-cluster reporting" ) \ |
| 517 | XXX( /*FP*/ ZB_GP_CMD_ID_REQUEST_ATTRIBUTES , 0xA4, "Request Attributes" ) \ |
| 518 | XXX( /*FP*/ ZB_GP_CMD_ID_READ_ATTRIBUTES_RESPONSE , 0xA5, "Read Attributes Response" ) \ |
| 519 | XXX( /*FP*/ ZB_GP_CMD_ID_ZCL_TUNNELING , 0xA6, "ZCL Tunneling" ) \ |
| 520 | XXX( /*FP*/ ZB_GP_CMD_ID_COMPACT_ATTR_REPORT , 0xA8, "Compact Attribute Reporting" ) \ |
| 521 | XXX( /*FP*/ ZB_GP_CMD_ID_ANY_SENSOR_COMMAND_A0_A3 , 0xAF, "Any GPD sensor command (0xA0 - 0xA3)" ) \ |
| 522 | XXX( /*FP*/ ZB_GP_CMD_ID_COMMISSIONING , 0xE0, "Commissioning" ) \ |
| 523 | XXX( /*F */ ZB_GP_CMD_ID_DECOMMISSIONING , 0xE1, "Decommissioning" ) \ |
| 524 | XXX( /*F */ ZB_GP_CMD_ID_SUCCESS , 0xE2, "Success" ) \ |
| 525 | XXX( /*FP*/ ZB_GP_CMD_ID_CHANNEL_REQUEST , 0xE3, "Channel Request" ) \ |
| 526 | XXX( /*FP*/ ZB_GP_CMD_ID_APPLICATION_DESC , 0xE4, "Application Description" ) \ |
| 527 | XXX( /*T */ ZB_GP_CMD_ID_COMMISSIONING_REPLY , 0xF0, "Commissioning Reply" ) \ |
| 528 | XXX( /*T */ ZB_GP_CMD_ID_WRITE_ATTRIBUTES , 0xF1, "Write Attributes" ) \ |
| 529 | XXX( /*T */ ZB_GP_CMD_ID_READ_ATTRIBUTES , 0xF2, "Read Attributes" ) \ |
| 530 | XXX( /*T */ ZB_GP_CMD_ID_CHANNEL_CONFIGURATION , 0xF3, "Channel Configuration" ) |
| 531 | |
| 532 | VALUE_STRING_ENUM(zbee_nwk_gp_cmd_names)enum { ZB_GP_CMD_ID_IDENTIFY = 0x00, ZB_GP_CMD_ID_RECALL_SCENE0 = 0x10, ZB_GP_CMD_ID_RECALL_SCENE1 = 0x11, ZB_GP_CMD_ID_RECALL_SCENE2 = 0x12, ZB_GP_CMD_ID_RECALL_SCENE3 = 0x13, ZB_GP_CMD_ID_RECALL_SCENE4 = 0x14, ZB_GP_CMD_ID_RECALL_SCENE5 = 0x15, ZB_GP_CMD_ID_RECALL_SCENE6 = 0x16, ZB_GP_CMD_ID_RECALL_SCENE7 = 0x17, ZB_GP_CMD_ID_STORE_SCENE0 = 0x18, ZB_GP_CMD_ID_STORE_SCENE1 = 0x19, ZB_GP_CMD_ID_STORE_SCENE2 = 0x1A, ZB_GP_CMD_ID_STORE_SCENE3 = 0x1B, ZB_GP_CMD_ID_STORE_SCENE4 = 0x1C, ZB_GP_CMD_ID_STORE_SCENE5 = 0x1D, ZB_GP_CMD_ID_STORE_SCENE6 = 0x1E, ZB_GP_CMD_ID_STORE_SCENE7 = 0x1F, ZB_GP_CMD_ID_OFF = 0x20, ZB_GP_CMD_ID_ON = 0x21, ZB_GP_CMD_ID_TOGGLE = 0x22, ZB_GP_CMD_ID_RELEASE = 0x23, ZB_GP_CMD_ID_MOVE_UP = 0x30, ZB_GP_CMD_ID_MOVE_DOWN = 0x31, ZB_GP_CMD_ID_STEP_UP = 0x32, ZB_GP_CMD_ID_STEP_DOWN = 0x33 , ZB_GP_CMD_ID_LEVEL_CONTROL_STOP = 0x34, ZB_GP_CMD_ID_MOVE_UP_WITH_ON_OFF = 0x35, ZB_GP_CMD_ID_MOVE_DOWN_WITH_ON_OFF = 0x36, ZB_GP_CMD_ID_STEP_UP_WITH_ON_OFF = 0x37, ZB_GP_CMD_ID_STEP_DOWN_WITH_ON_OFF = 0x38, ZB_GP_CMD_ID_MOVE_HUE_STOP = 0x40, ZB_GP_CMD_ID_MOVE_HUE_UP = 0x41, ZB_GP_CMD_ID_MOVE_HUE_DOWN = 0x42, ZB_GP_CMD_ID_STEP_HUE_UP = 0x43, ZB_GP_CMD_ID_STEP_HUW_DOWN = 0x44, ZB_GP_CMD_ID_MOVE_SATURATION_STOP = 0x45, ZB_GP_CMD_ID_MOVE_SATURATION_UP = 0x46, ZB_GP_CMD_ID_MOVE_SATURATION_DOWN = 0x47, ZB_GP_CMD_ID_STEP_SATURATION_UP = 0x48, ZB_GP_CMD_ID_STEP_SATURATION_DOWN = 0x49, ZB_GP_CMD_ID_MOVE_COLOR = 0x4A, ZB_GP_CMD_ID_STEP_COLOR = 0x4B, ZB_GP_CMD_ID_LOCK_DOOR = 0x50, ZB_GP_CMD_ID_UNLOCK_DOOR = 0x51, ZB_GP_CMD_ID_PRESS11 = 0x60, ZB_GP_CMD_ID_RELEASE11 = 0x61, ZB_GP_CMD_ID_PRESS12 = 0x62, ZB_GP_CMD_ID_RELEASE12 = 0x63, ZB_GP_CMD_ID_PRESS22 = 0x64 , ZB_GP_CMD_ID_RELEASE22 = 0x65, ZB_GP_CMD_ID_SHORT_PRESS11 = 0x66, ZB_GP_CMD_ID_SHORT_PRESS12 = 0x67, ZB_GP_CMD_ID_SHORT_PRESS22 = 0x68, ZB_GP_CMD_ID_ATTRIBUTE_REPORTING = 0xA0, ZB_GP_CMD_ID_MANUFACTURE_SPECIFIC_ATTR_REPORTING = 0xA1, ZB_GP_CMD_ID_MULTI_CLUSTER_REPORTING = 0xA2, ZB_GP_CMD_ID_MANUFACTURER_SPECIFIC_MCLUSTER_REPORTING = 0xA3, ZB_GP_CMD_ID_REQUEST_ATTRIBUTES = 0xA4, ZB_GP_CMD_ID_READ_ATTRIBUTES_RESPONSE = 0xA5, ZB_GP_CMD_ID_ZCL_TUNNELING = 0xA6, ZB_GP_CMD_ID_COMPACT_ATTR_REPORT = 0xA8, ZB_GP_CMD_ID_ANY_SENSOR_COMMAND_A0_A3 = 0xAF, ZB_GP_CMD_ID_COMMISSIONING = 0xE0, ZB_GP_CMD_ID_DECOMMISSIONING = 0xE1, ZB_GP_CMD_ID_SUCCESS = 0xE2, ZB_GP_CMD_ID_CHANNEL_REQUEST = 0xE3, ZB_GP_CMD_ID_APPLICATION_DESC = 0xE4, ZB_GP_CMD_ID_COMMISSIONING_REPLY = 0xF0, ZB_GP_CMD_ID_WRITE_ATTRIBUTES = 0xF1, ZB_GP_CMD_ID_READ_ATTRIBUTES = 0xF2, ZB_GP_CMD_ID_CHANNEL_CONFIGURATION = 0xF3, _zbee_nwk_gp_cmd_names_ENUM_DUMMY = 0 }; |
| 533 | |
| 534 | VALUE_STRING_ARRAY(zbee_nwk_gp_cmd_names)static const value_string zbee_nwk_gp_cmd_names[] = { { 0x00, "Identify" }, { 0x10, "Recall Scene 0" }, { 0x11, "Recall Scene 1" }, { 0x12, "Recall Scene 2" }, { 0x13, "Recall Scene 3" }, { 0x14, "Recall Scene 4" }, { 0x15, "Recall Scene 5" }, { 0x16 , "Recall Scene 6" }, { 0x17, "Recall Scene 7" }, { 0x18, "Store Scene 0" }, { 0x19, "Store Scene 1" }, { 0x1A, "Store Scene 2" }, { 0x1B , "Store Scene 3" }, { 0x1C, "Store Scene 4" }, { 0x1D, "Store Scene 5" }, { 0x1E, "Store Scene 6" }, { 0x1F, "Store Scene 7" }, { 0x20 , "Off" }, { 0x21, "On" }, { 0x22, "Toggle" }, { 0x23, "Release" }, { 0x30, "Move Up" }, { 0x31, "Move Down" }, { 0x32, "Step Up" }, { 0x33, "Step Down" }, { 0x34, "Level Control/Stop" }, { 0x35 , "Move Up (with On/Off)" }, { 0x36, "Move Down (with On/Off)" }, { 0x37, "Step Up (with On/Off)" }, { 0x38, "Step Down (with On/Off)" }, { 0x40, "Move Hue Stop" }, { 0x41, "Move Hue Up" }, { 0x42 , "Move Hue Down" }, { 0x43, "Step Hue Up" }, { 0x44, "Step Hue Down" }, { 0x45, "Move Saturation Stop" }, { 0x46, "Move Saturation Up" }, { 0x47, "Move Saturation Down" }, { 0x48, "Step Saturation Up" }, { 0x49, "Step Saturation Down" }, { 0x4A, "Move Color" }, { 0x4B, "Step Color" }, { 0x50, "Lock Door" }, { 0x51, "Unlock Door" }, { 0x60, "Press 1 of 1" }, { 0x61, "Release 1 of 1" }, { 0x62 , "Press 1 of 2" }, { 0x63, "Release 1 of 2" }, { 0x64, "Press 2 of 2" }, { 0x65, "Release 2 of 2" }, { 0x66, "Short press 1 of 1" } , { 0x67, "Short press 1 of 2" }, { 0x68, "Short press 2 of 2" }, { 0xA0, "Attribute reporting" }, { 0xA1, "Manufacturer-specific attribute reporting" }, { 0xA2, "Multi-cluster reporting" }, { 0xA3, "Manufacturer-specific multi-cluster reporting" }, { 0xA4, "Request Attributes" }, { 0xA5, "Read Attributes Response" }, { 0xA6, "ZCL Tunneling" }, { 0xA8, "Compact Attribute Reporting" }, { 0xAF, "Any GPD sensor command (0xA0 - 0xA3)" }, { 0xE0, "Commissioning" }, { 0xE1, "Decommissioning" }, { 0xE2, "Success" }, { 0xE3, "Channel Request" }, { 0xE4, "Application Description" }, { 0xF0, "Commissioning Reply" }, { 0xF1, "Write Attributes" }, { 0xF2, "Read Attributes" }, { 0xF3, "Channel Configuration" }, { 0, ((void*)0) } }; |
| 535 | value_string_ext zbee_nwk_gp_cmd_names_ext = VALUE_STRING_EXT_INIT(zbee_nwk_gp_cmd_names){ _try_val_to_str_ext_init, 0, (sizeof (zbee_nwk_gp_cmd_names ) / sizeof ((zbee_nwk_gp_cmd_names)[0]))-1, zbee_nwk_gp_cmd_names , "zbee_nwk_gp_cmd_names", ((void*)0) }; |
| 536 | |
| 537 | |
| 538 | /* Green Power devices. */ |
| 539 | const value_string zbee_nwk_gp_device_ids_names[] = { |
| 540 | |
| 541 | /* GP GENERIC */ |
| 542 | { GPD_DEVICE_ID_GENERIC_GP_SIMPLE_GENERIC_1STATE_SWITCH0x00, "Generic: GP Simple Generic 1-state Switch" }, |
| 543 | { GPD_DEVICE_ID_GENERIC_GP_SIMPLE_GENERIC_2STATE_SWITCH0x01, "Generic: GP Simple Generic 2-state Switch" }, |
| 544 | { GPD_DEVICE_ID_GENERIC_GP_ON_OFF_SWITCH0x02, "Generic: GP On/Off Switch" }, |
| 545 | { GPD_DEVICE_ID_GENERIC_GP_LEVEL_CONTROL_SWITCH0x03, "Generic: GP Level Control Switch" }, |
| 546 | { GPD_DEVICE_ID_GENERIC_GP_SIMPLE_SENSOR0x04, "Generic: GP Simple Sensor" }, |
| 547 | { GPD_DEVICE_ID_GENERIC_GP_ADVANCED_GENERIC_1STATE_SWITCH0x05, "Generic: GP Advanced Generic 1-state Switch" }, |
| 548 | { GPD_DEVICE_ID_GENERIC_GP_ADVANCED_GENERIC_2STATE_SWITCH0x06, "Generic: GP Advanced Generic 2-state Switch" }, |
| 549 | |
| 550 | /* GP LIGHTING */ |
| 551 | { GPD_DEVICE_ID_LIGHTING_GP_COLOR_DIMMER_SWITCH0x10, "Lighting: GP Color Dimmer Switch" }, |
| 552 | { GPD_DEVICE_ID_LIGHTING_GP_LIGHT_SENSOR0x11, "Lighting: GP Light Sensor" }, |
| 553 | { GPD_DEVICE_ID_LIGHTING_GP_OCCUPANCY_SENSOR0x12, "Lighting: GP Occupancy Sensor" }, |
| 554 | |
| 555 | /* GP CLOSURES */ |
| 556 | { GPD_DEVICE_ID_CLOSURES_GP_DOOR_LOCK_CONTROLLER0x20, "Closures: GP Door Lock Controller" }, |
| 557 | |
| 558 | /* HVAC */ |
| 559 | { GPD_DEVICE_ID_HVAC_GP_TEMPERATURE_SENSOR0x30, "HVAC: GP Temperature Sensor" }, |
| 560 | { GPD_DEVICE_ID_HVAC_GP_PRESSURE_SENSOR0x31, "HVAC: GP Pressure Sensor" }, |
| 561 | { GPD_DEVICE_ID_HVAC_GP_FLOW_SENSOR0x32, "HVAC: GP Flow Sensor" }, |
| 562 | { GPD_DEVICE_ID_HVAC_GP_INDOOR_ENVIRONMENT_SENSOR0x33, "HVAC: GP Indoor Environment Sensor" }, |
| 563 | |
| 564 | /* CUSTOM */ |
| 565 | { GPD_DEVICE_ID_MANUFACTURER_SPECIFIC0xFE, "Manufacturer Specific" }, |
| 566 | |
| 567 | { 0, NULL((void*)0) } |
| 568 | }; |
| 569 | static value_string_ext zbee_nwk_gp_device_ids_names_ext = VALUE_STRING_EXT_INIT(zbee_nwk_gp_device_ids_names){ _try_val_to_str_ext_init, 0, (sizeof (zbee_nwk_gp_device_ids_names ) / sizeof ((zbee_nwk_gp_device_ids_names)[0]))-1, zbee_nwk_gp_device_ids_names , "zbee_nwk_gp_device_ids_names", ((void*)0) }; |
| 570 | |
| 571 | /* GP directions. */ |
| 572 | static const value_string zbee_nwk_gp_directions[] = { |
| 573 | { ZBEE_NWK_GP_FC_EXT_DIRECTION_FROM_ZGPD0x00, "From ZGPD" }, |
| 574 | { ZBEE_NWK_GP_FC_EXT_DIRECTION_FROM_ZGPP0x01, "From ZGPP" }, |
| 575 | |
| 576 | { 0, NULL((void*)0) } |
| 577 | }; |
| 578 | |
| 579 | /* Frame types for Green Power profile. */ |
| 580 | static const value_string zbee_nwk_gp_frame_types[] = { |
| 581 | { ZBEE_NWK_GP_FCF_DATA0x00, "Data" }, |
| 582 | { ZBEE_NWK_GP_FCF_MAINTENANCE0x01, "Maintenance" }, |
| 583 | |
| 584 | { 0, NULL((void*)0) } |
| 585 | }; |
| 586 | |
| 587 | /* GreenPeak Green Power devices. */ |
| 588 | static const value_string zbee_nwk_gp_manufacturer_greenpeak_dev_names[] = { |
| 589 | { ZBEE_NWK_GP_MANUF_GREENPEAK_IZDS0x0000, "IAS Zone Door Sensor" }, |
| 590 | { ZBEE_NWK_GP_MANUF_GREENPEAK_IZDWS0x0001, "IAS Zone Door/Window Sensor" }, |
| 591 | { ZBEE_NWK_GP_MANUF_GREENPEAK_IZLS0x0002, "IAS Zone Leakage Sensor" }, |
| 592 | { ZBEE_NWK_GP_MANUF_GREENPEAK_IZRHS0x0003, "IAS Zone Relative Humidity Sensor" }, |
| 593 | |
| 594 | { 0, NULL((void*)0) } |
| 595 | }; |
| 596 | |
| 597 | /* GP Generic switch type names. */ |
| 598 | static const value_string zbee_nwk_gp_switch_type_names[] = { |
| 599 | { 0x00, "Unknown: exact configuration apart from number of contacts unknown" }, |
| 600 | { 0x01, "Button switch" }, |
| 601 | { 0x02, "Rocker switch" }, |
| 602 | { 0x03, "Reserved" }, |
| 603 | |
| 604 | { 0, NULL((void*)0) } |
| 605 | }; |
| 606 | |
| 607 | /* GP Src ID names. */ |
| 608 | static const value_string zbee_nwk_gp_src_id_names[] = { |
| 609 | { ZBEE_NWK_GP_ZGPD_SRCID_ALL0xFFFFFFFF, "All" }, |
| 610 | { ZBEE_NWK_GP_ZGPD_SRCID_UNKNOWN0x00000000, "Unspecified" }, |
| 611 | |
| 612 | { 0, NULL((void*)0) } |
| 613 | }; |
| 614 | |
| 615 | /* GP security key type names. */ |
| 616 | static const value_string zbee_nwk_gp_src_sec_keys_type_names[] = { |
| 617 | { ZBEE_NWK_GP_SECURITY_KEY_TYPE_NO_KEY0x00, "No key" }, |
| 618 | { ZBEE_NWK_GP_SECURITY_KEY_TYPE_ZB_NWK_KEY0x01, "ZigBee NWK key" }, |
| 619 | { ZBEE_NWK_GP_SECURITY_KEY_TYPE_GPD_GROUP_KEY0x02, "GPD group key" }, |
| 620 | { ZBEE_NWK_GP_SECURITY_KEY_TYPE_NWK_KEY_DERIVED_GPD_KEY_GROUP_KEY0x03, "NWK key derived GPD group key" }, |
| 621 | { ZBEE_NWK_GP_SECURITY_KEY_TYPE_PRECONFIGURED_INDIVIDUAL_GPD_KEY0x04, "Individual, out of the box GPD key" }, |
| 622 | { ZBEE_NWK_GP_SECURITY_KEY_TYPE_DERIVED_INDIVIDUAL_GPD_KEY0x07, "Derived individual GPD key" }, |
| 623 | |
| 624 | { 0, NULL((void*)0) } |
| 625 | }; |
| 626 | |
| 627 | /* GP security levels. */ |
| 628 | static const value_string zbee_nwk_gp_src_sec_levels_names[] = { |
| 629 | { ZBEE_NWK_GP_SECURITY_LEVEL_NO0x00, "No security" }, |
| 630 | { ZBEE_NWK_GP_SECURITY_LEVEL_1LSB0x01, "1 LSB of frame counter and short MIC only" }, |
| 631 | { ZBEE_NWK_GP_SECURITY_LEVEL_FULL0x02, "Full frame counter and full MIC only" }, |
| 632 | { ZBEE_NWK_GP_SECURITY_LEVEL_FULLENCR0x03, "Encryption with full frame counter and full MIC" }, |
| 633 | |
| 634 | { 0, NULL((void*)0) } |
| 635 | }; |
| 636 | |
| 637 | /*************************/ |
| 638 | /* Function definitions. */ |
| 639 | /*************************/ |
| 640 | |
| 641 | /* UAT record copy callback. */ |
| 642 | static void * |
| 643 | uat_key_record_copy_cb(void *n, const void *o, size_t siz _U___attribute__((unused))) |
| 644 | { |
| 645 | uat_key_record_t *new_key = (uat_key_record_t *)n; |
| 646 | const uat_key_record_t *old_key = (const uat_key_record_t *)o; |
| 647 | |
| 648 | new_key->string = g_strdup(old_key->string)g_strdup_inline (old_key->string); |
| 649 | new_key->label = g_strdup(old_key->label)g_strdup_inline (old_key->label); |
| 650 | |
| 651 | return new_key; |
| 652 | } |
| 653 | |
| 654 | /* UAT record free callback. */ |
| 655 | static void |
| 656 | uat_key_record_free_cb(void *r) |
| 657 | { |
| 658 | uat_key_record_t *key = (uat_key_record_t *)r; |
| 659 | g_free(key->string)(__builtin_object_size ((key->string), 0) != ((size_t) - 1 )) ? g_free_sized (key->string, __builtin_object_size ((key ->string), 0)) : (g_free) (key->string); |
| 660 | g_free(key->label)(__builtin_object_size ((key->label), 0) != ((size_t) - 1) ) ? g_free_sized (key->label, __builtin_object_size ((key-> label), 0)) : (g_free) (key->label); |
| 661 | } |
| 662 | |
| 663 | /** |
| 664 | *Parses a key string from left to right into a buffer with increasing (normal byte order) or decreasing (reverse |
| 665 | * |
| 666 | *@param key_str pointer to the string |
| 667 | *@param key_buf destination buffer in memory |
| 668 | *@param byte_order byte order |
| 669 | */ |
| 670 | static bool_Bool |
| 671 | zbee_gp_security_parse_key(const char *key_str, uint8_t *key_buf, bool_Bool byte_order) |
| 672 | { |
| 673 | bool_Bool string_mode = false0; |
| 674 | char temp; |
| 675 | int i, j; |
| 676 | |
| 677 | memset(key_buf, 0, ZBEE_SEC_CONST_KEYSIZE16); |
| 678 | if (key_str == NULL((void*)0)) { |
| 679 | return false0; |
| 680 | } |
| 681 | if ((temp = *key_str++) == '"') { |
| 682 | string_mode = true1; |
| 683 | temp = *key_str++; |
| 684 | } |
| 685 | j = byte_order ? ZBEE_SEC_CONST_KEYSIZE16 - 1 : 0; |
| 686 | for (i = ZBEE_SEC_CONST_KEYSIZE16 - 1; i >= 0; i--) { |
| 687 | if (string_mode) { |
| 688 | if (g_ascii_isprint(temp)((g_ascii_table[(guchar) (temp)] & G_ASCII_PRINT) != 0)) { |
| 689 | key_buf[j] = temp; |
| 690 | temp = *key_str++; |
| 691 | } else { |
| 692 | return false0; |
| 693 | } |
| 694 | } else { |
| 695 | if ((temp == ':') || (temp == '-') || (temp == ' ')) { |
| 696 | temp = *(key_str++); |
| 697 | } |
| 698 | if (g_ascii_isxdigit(temp)((g_ascii_table[(guchar) (temp)] & G_ASCII_XDIGIT) != 0)) { |
| 699 | key_buf[j] = g_ascii_xdigit_value(temp) << 4; |
| 700 | } else { |
| 701 | return false0; |
| 702 | } |
| 703 | temp = *(key_str++); |
| 704 | if (g_ascii_isxdigit(temp)((g_ascii_table[(guchar) (temp)] & G_ASCII_XDIGIT) != 0)) { |
| 705 | key_buf[j] |= g_ascii_xdigit_value(temp); |
| 706 | } else { |
| 707 | return false0; |
| 708 | } |
| 709 | temp = *(key_str++); |
| 710 | } |
| 711 | if (byte_order) { |
| 712 | j--; |
| 713 | } else { |
| 714 | j++; |
| 715 | } |
| 716 | } |
| 717 | return true1; |
| 718 | } |
| 719 | |
| 720 | /* UAT record update callback. */ |
| 721 | static bool_Bool |
| 722 | uat_key_record_update_cb(void *r, char **err) |
| 723 | { |
| 724 | uat_key_record_t *rec = (uat_key_record_t *)r; |
| 725 | |
| 726 | if (rec->string == NULL((void*)0)) { |
| 727 | *err = g_strdup("Key can't be blank.")g_strdup_inline ("Key can't be blank."); |
| 728 | return false0; |
| 729 | } else { |
| 730 | g_strstrip(rec->string)g_strchomp (g_strchug (rec->string)); |
| 731 | if (rec->string[0] != 0) { |
| 732 | *err = NULL((void*)0); |
| 733 | if (!zbee_gp_security_parse_key(rec->string, rec->key, rec->byte_order)) { |
| 734 | *err = ws_strdup_printf("Expecting %d hexadecimal bytes or a %d character double-quoted string",wmem_strdup_printf(((void*)0), "Expecting %d hexadecimal bytes or a %d character double-quoted string" , 16, 16) |
| 735 | ZBEE_SEC_CONST_KEYSIZE, ZBEE_SEC_CONST_KEYSIZE)wmem_strdup_printf(((void*)0), "Expecting %d hexadecimal bytes or a %d character double-quoted string" , 16, 16); |
| 736 | return false0; |
| 737 | } |
| 738 | } else { |
| 739 | *err = g_strdup("Key can't be blank.")g_strdup_inline ("Key can't be blank."); |
| 740 | return false0; |
| 741 | } |
| 742 | } |
| 743 | return true1; |
| 744 | } |
| 745 | |
| 746 | static void uat_key_record_post_update_cb(void) { |
| 747 | unsigned i; |
| 748 | |
| 749 | for (i = 0; i < num_uat_key_records; i++) { |
| 750 | if (memcmp(gp_uat_key_records[i].key, empty_key, ZBEE_SEC_CONST_KEYSIZE16) == 0) { |
| 751 | /* key was not loaded from string yet */ |
| 752 | zbee_gp_security_parse_key(gp_uat_key_records[i].string, gp_uat_key_records[i].key, |
| 753 | gp_uat_key_records[i].byte_order); |
| 754 | } |
| 755 | } |
| 756 | } |
| 757 | |
| 758 | /** |
| 759 | *Fills in ZigBee GP security nonce from the provided packet structure. |
| 760 | * |
| 761 | *@param packet ZigBee NWK packet. |
| 762 | *@param nonce nonce buffer. |
| 763 | */ |
| 764 | static void |
| 765 | zbee_gp_make_nonce(zbee_nwk_green_power_packet *packet, uint8_t *nonce) |
| 766 | { |
| 767 | memset(nonce, 0, ZBEE_SEC_CONST_NONCE_LEN(16 -2 -1)); |
| 768 | |
| 769 | /* Source address */ |
| 770 | if (packet->application_id == ZBEE_NWK_GP_APP_ID_DEFAULT0x00) |
| 771 | { |
| 772 | if (packet->direction == ZBEE_NWK_GP_FC_EXT_DIRECTION_FROM_ZGPD0x00) { |
| 773 | phtoleu32(nonce, packet->source_id); |
| 774 | } |
| 775 | phtoleu32(nonce+4, packet->source_id); |
| 776 | } |
| 777 | else if (packet->application_id == ZBEE_NWK_GP_APP_ID_ZGP0x02) |
| 778 | { |
| 779 | phtoleu64(nonce, packet->ieee_packet_src64); |
| 780 | } |
| 781 | |
| 782 | /* Frame counter */ |
| 783 | phtoleu32(nonce+8, packet->security_frame_counter); |
| 784 | |
| 785 | /* Security control */ |
| 786 | if ((packet->application_id == ZBEE_NWK_GP_APP_ID_ZGP0x02) && |
| 787 | (packet->direction != ZBEE_NWK_GP_FC_EXT_DIRECTION_FROM_ZGPD0x00)) { |
| 788 | nonce[12] = (char)0xc5; /* Security level = 0b101, Key Identifier = 0x00, |
| 789 | Extended nonce = 0b0, Reserved = 0b00 */ |
| 790 | } else { |
| 791 | nonce[12] = (char)0x05; /* Security level = 0b101, Key Identifier = 0x00, |
| 792 | Extended nonce = 0b0, Reserved = 0b11 */ |
| 793 | } |
| 794 | } |
| 795 | |
| 796 | /** |
| 797 | *Creates a nonce and decrypts secured ZigBee GP payload. |
| 798 | * |
| 799 | *@param packet ZigBee NWK packet. |
| 800 | *@param enc_buffer encoded payload buffer. |
| 801 | *@param offset payload offset. |
| 802 | *@param dec_buffer decoded payload buffer. |
| 803 | *@param payload_len payload length. |
| 804 | *@param mic_len MIC length. |
| 805 | *@param key key. |
| 806 | */ |
| 807 | static bool_Bool |
| 808 | zbee_gp_decrypt_payload(zbee_nwk_green_power_packet *packet, const uint8_t *enc_buffer, const unsigned offset, uint8_t |
| 809 | *dec_buffer, unsigned payload_len, unsigned mic_len, uint8_t *key) |
| 810 | { |
| 811 | uint8_t *key_buffer = key; |
| 812 | uint8_t nonce[ZBEE_SEC_CONST_NONCE_LEN(16 -2 -1)]; |
| 813 | |
| 814 | zbee_gp_make_nonce(packet, nonce); |
| 815 | if (zbee_sec_ccm_decrypt(key_buffer, nonce, enc_buffer, enc_buffer + offset, dec_buffer, offset, payload_len, |
| 816 | mic_len)) { |
| 817 | return true1; |
| 818 | } |
| 819 | |
| 820 | return false0; |
| 821 | } |
| 822 | |
| 823 | /** |
| 824 | *Dissector for ZigBee Green Power commissioning. |
| 825 | * |
| 826 | *@param tvb pointer to buffer containing raw packet. |
| 827 | *@param pinfo pointer to packet information fields. |
| 828 | *@param tree pointer to data tree Wireshark uses to display packet. |
| 829 | *@param packet packet data. |
| 830 | *@param offset current payload offset. |
| 831 | *@return payload processed offset. |
| 832 | */ |
| 833 | static unsigned |
| 834 | dissect_zbee_nwk_gp_cmd_commissioning(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, |
| 835 | zbee_nwk_green_power_packet *packet, unsigned offset) |
| 836 | { |
| 837 | uint8_t comm_options; |
| 838 | uint8_t comm_ext_options = 0; |
| 839 | uint8_t appli_info_options = 0; |
| 840 | uint16_t manufacturer_id = 0; |
| 841 | |
| 842 | uint8_t i; |
| 843 | uint8_t gpd_cmd_num = 0; |
| 844 | proto_item *gpd_cmd_list; |
| 845 | proto_tree *gpd_cmd_list_tree; |
| 846 | |
| 847 | uint8_t length_of_clid_list_bm; |
| 848 | uint8_t server_clid_num; |
| 849 | uint8_t client_clid_num; |
| 850 | proto_item *server_clid_list, *client_clid_list; |
| 851 | proto_tree *server_clid_list_tree, *client_clid_list_tree; |
| 852 | uint8_t switch_info_length; |
| 853 | proto_item *switch_info; |
| 854 | proto_tree *switch_info_tree; |
| 855 | |
| 856 | void *enc_buffer; |
| 857 | uint8_t *enc_buffer_withA; |
| 858 | uint8_t *dec_buffer; |
| 859 | bool_Bool gp_decrypted; |
| 860 | GSList *GSList_i; |
| 861 | tvbuff_t *payload_tvb; |
| 862 | |
| 863 | static int * const options[] = { |
| 864 | &hf_zbee_nwk_gp_cmd_comm_opt_mac_sec_num_cap, |
| 865 | &hf_zbee_nwk_gp_cmd_comm_opt_rx_on_cap, |
| 866 | &hf_zbee_nwk_gp_cmd_comm_opt_appli_info_present, |
| 867 | &hf_zbee_nwk_gp_cmd_comm_opt_panid_req, |
| 868 | &hf_zbee_nwk_gp_cmd_comm_opt_sec_key_req, |
| 869 | &hf_zbee_nwk_gp_cmd_comm_opt_fixed_location, |
| 870 | &hf_zbee_nwk_gp_cmd_comm_opt_ext_opt, |
| 871 | NULL((void*)0) |
| 872 | }; |
| 873 | static int * const ext_options[] = { |
| 874 | &hf_zbee_nwk_gp_cmd_comm_ext_opt_sec_level_cap, |
| 875 | &hf_zbee_nwk_gp_cmd_comm_ext_opt_key_type, |
| 876 | &hf_zbee_nwk_gp_cmd_comm_ext_opt_gpd_key_present, |
| 877 | &hf_zbee_nwk_gp_cmd_comm_ext_opt_gpd_key_encr, |
| 878 | &hf_zbee_nwk_gp_cmd_comm_ext_opt_outgoing_counter, |
| 879 | NULL((void*)0) |
| 880 | }; |
| 881 | static int * const appli_info[] = { |
| 882 | &hf_zbee_nwk_gp_cmd_comm_appli_info_mip, |
| 883 | &hf_zbee_nwk_gp_cmd_comm_appli_info_mmip, |
| 884 | &hf_zbee_nwk_gp_cmd_comm_appli_info_gclp, |
| 885 | &hf_zbee_nwk_gp_cmd_comm_appli_info_crp, |
| 886 | &hf_zbee_nwk_gp_cmd_comm_appli_info_sip, |
| 887 | &hf_zbee_nwk_gp_cmd_comm_appli_info_adcf, |
| 888 | &hf_zbee_nwk_gp_cmd_comm_appli_info_res, |
| 889 | NULL((void*)0) |
| 890 | }; |
| 891 | static int * const length_of_clid_list[] = { |
| 892 | &hf_zbee_nwk_gp_cmd_comm_length_of_clid_list_server, |
| 893 | &hf_zbee_nwk_gp_cmd_comm_length_of_clid_list_client, |
| 894 | NULL((void*)0) |
| 895 | }; |
| 896 | static int * const generic_switch_config[] = { |
| 897 | &hf_zbee_nwk_gp_cmd_comm_switch_info_num_contacts, |
| 898 | &hf_zbee_nwk_gp_cmd_comm_switch_info_switch_type, |
| 899 | &hf_zbee_nwk_gp_cmd_comm_switch_info_reserved, |
| 900 | NULL((void*)0) |
| 901 | }; |
| 902 | |
| 903 | /* Get Device ID and display it. */ |
| 904 | proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_comm_device_id, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000); |
| 905 | offset += 1; |
| 906 | /* Get Options Field, build subtree and display the results. */ |
| 907 | comm_options = tvb_get_uint8(tvb, offset); |
| 908 | proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_cmd_comm_opt, ett_zbee_nwk_cmd_options, options, ENC_NA0x00000000); |
| 909 | offset += 1; |
| 910 | |
| 911 | if (comm_options & ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_EXT_OPTIONS0x80) { |
| 912 | /* Get extended Options Field, build subtree and display the results. */ |
| 913 | comm_ext_options = tvb_get_uint8(tvb, offset); |
| 914 | proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_cmd_comm_ext_opt, ett_zbee_nwk_cmd_options, ext_options, ENC_NA0x00000000); |
| 915 | offset += 1; |
| 916 | if (comm_ext_options & ZBEE_NWK_GP_CMD_COMMISSIONING_EXT_OPT_GPD_KEY_PRESENT0x20) { |
| 917 | /* Get security key and display it. */ |
| 918 | proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_comm_security_key, tvb, offset, ZBEE_SEC_CONST_KEYSIZE16, ENC_NA0x00000000); |
| 919 | offset += ZBEE_SEC_CONST_KEYSIZE16; |
| 920 | |
| 921 | /* Key is encrypted */ |
| 922 | if (comm_ext_options & ZBEE_NWK_GP_CMD_COMMISSIONING_EXT_OPT_GPD_KEY_ENCR0x40) { |
| 923 | /* Get Security MIC and display it. */ |
| 924 | proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_comm_gpd_sec_key_mic, tvb, offset, 4, ENC_LITTLE_ENDIAN0x80000000); |
| 925 | offset += 4; |
| 926 | |
| 927 | if (packet != NULL((void*)0)) |
| 928 | { |
| 929 | /* Decrypt the security key */ |
| 930 | dec_buffer = (uint8_t *)wmem_alloc(pinfo->pool, ZBEE_SEC_CONST_KEYSIZE16); |
| 931 | enc_buffer_withA = (uint8_t *)wmem_alloc(pinfo->pool, 4 + ZBEE_SEC_CONST_KEYSIZE16 + 4); /* CCM* a (this is SrcID) + encKey + MIC */ |
| 932 | enc_buffer = tvb_memdup(pinfo->pool, tvb, offset - ZBEE_SEC_CONST_KEYSIZE16 - 4, ZBEE_SEC_CONST_KEYSIZE16 + 4); |
| 933 | phtoleu32(enc_buffer_withA, packet->source_id); |
| 934 | memcpy(enc_buffer_withA+4, enc_buffer, ZBEE_SEC_CONST_KEYSIZE16 + 4); |
| 935 | gp_decrypted = false0; |
| 936 | |
| 937 | for (GSList_i = zbee_gp_keyring; GSList_i && !gp_decrypted; GSList_i = g_slist_next(GSList_i)((GSList_i) ? (((GSList *)(GSList_i))->next) : ((void*)0))) { |
| 938 | packet->security_frame_counter = packet->source_id; /* for Nonce creation*/ |
| 939 | gp_decrypted = zbee_gp_decrypt_payload(packet, enc_buffer_withA, 4 |
| 940 | , dec_buffer, ZBEE_SEC_CONST_KEYSIZE16, 4, ((key_record_t *)(GSList_i->data))->key); |
| 941 | } |
| 942 | |
| 943 | if (gp_decrypted) { |
| 944 | key_record_t key_record; |
| 945 | |
| 946 | key_record.frame_num = 0; |
| 947 | key_record.label = NULL((void*)0); |
| 948 | memcpy(key_record.key, dec_buffer, ZBEE_SEC_CONST_KEYSIZE16); |
| 949 | zbee_gp_keyring = g_slist_prepend(zbee_gp_keyring, g_memdup2(&key_record, sizeof(key_record_t))); |
| 950 | |
| 951 | payload_tvb = tvb_new_child_real_data(tvb, dec_buffer, ZBEE_SEC_CONST_KEYSIZE16, ZBEE_SEC_CONST_KEYSIZE16); |
| 952 | add_new_data_source(pinfo, payload_tvb, "Decrypted security key"); |
| 953 | } |
| 954 | } |
| 955 | } |
| 956 | else |
| 957 | { |
| 958 | key_record_t key_record; |
| 959 | void *key; |
| 960 | |
| 961 | key_record.frame_num = 0; |
| 962 | key_record.label = NULL((void*)0); |
| 963 | key = tvb_memdup(pinfo->pool, tvb, offset - ZBEE_SEC_CONST_KEYSIZE16, ZBEE_SEC_CONST_KEYSIZE16); |
| 964 | memcpy(key_record.key, key, ZBEE_SEC_CONST_KEYSIZE16); |
| 965 | zbee_gp_keyring = g_slist_prepend(zbee_gp_keyring, g_memdup2(&key_record, sizeof(key_record_t))); |
| 966 | } |
| 967 | } |
| 968 | |
| 969 | if (comm_ext_options & ZBEE_NWK_GP_CMD_COMMISSIONING_EXT_OPT_OUT_COUNTER0x80) { |
| 970 | /* Get GPD Outgoing Frame Counter and display it. */ |
| 971 | proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_comm_outgoing_counter, tvb, offset, 4, ENC_LITTLE_ENDIAN0x80000000); |
| 972 | offset += 4; |
| 973 | } |
| 974 | } |
| 975 | /* Display manufacturer specific data. */ |
| 976 | if (comm_options & ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_APPLICATION_INFO0x04) { |
| 977 | /* Display application information. */ |
| 978 | appli_info_options = tvb_get_uint8(tvb, offset); |
| 979 | proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_cmd_comm_appli_info, ett_zbee_nwk_cmd_appli_info, appli_info, ENC_NA0x00000000); |
| 980 | offset += 1; |
| 981 | if (appli_info_options & ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_MIP0x01) { |
| 982 | /* Get Manufacturer ID. */ |
| 983 | proto_tree_add_item_ret_uint16(tree, hf_zbee_nwk_gp_cmd_comm_manufacturer_id, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000, &manufacturer_id); |
| 984 | offset += 2; |
| 985 | } |
| 986 | if (appli_info_options & ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_MMIP0x02) { |
| 987 | /* Get Manufacturer Device ID. */ |
| 988 | switch (manufacturer_id) { |
| 989 | case ZBEE_NWK_GP_MANUF_ID_GREENPEAK0x10D0: |
| 990 | proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_comm_manufacturer_greenpeak_dev_id, tvb, offset, 2, |
| 991 | ENC_LITTLE_ENDIAN0x80000000); |
| 992 | offset += 2; |
| 993 | break; |
| 994 | default: |
| 995 | proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_comm_manufacturer_dev_id, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000); |
| 996 | offset += 2; |
| 997 | break; |
| 998 | } |
| 999 | } |
| 1000 | if (appli_info_options & ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_GCLP0x04) { |
| 1001 | /* Get and display number of GPD commands */ |
| 1002 | proto_tree_add_item_ret_uint8(tree, hf_zbee_nwk_gp_cmd_comm_gpd_cmd_num, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000, &gpd_cmd_num); |
| 1003 | offset += 1; |
| 1004 | /* Display GPD command list */ |
| 1005 | if (gpd_cmd_num > 0) { |
| 1006 | gpd_cmd_list = proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_comm_gpd_cmd_id_list, |
| 1007 | tvb, offset, gpd_cmd_num, ENC_NA0x00000000); |
| 1008 | gpd_cmd_list_tree = proto_item_add_subtree(gpd_cmd_list, ett_zbee_nwk_cmd_comm_gpd_cmd_id_list); |
| 1009 | for (i = 0; i < gpd_cmd_num; i++, offset++) { |
| 1010 | /* Display command id */ |
| 1011 | proto_tree_add_item(gpd_cmd_list_tree, hf_zbee_nwk_gp_command_id, |
| 1012 | tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000); |
| 1013 | } |
| 1014 | } |
| 1015 | } |
| 1016 | if (appli_info_options & ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_CRP0x08) { |
| 1017 | /* Get and display Cluster List */ |
| 1018 | length_of_clid_list_bm = tvb_get_uint8(tvb, offset); |
| 1019 | server_clid_num = (length_of_clid_list_bm & ZBEE_NWK_GP_CMD_COMMISSIONING_CLID_LIST_LEN_SRV0x0F) >> |
| 1020 | ws_ctz(ZBEE_NWK_GP_CMD_COMMISSIONING_CLID_LIST_LEN_SRV0x0F); |
| 1021 | client_clid_num = (length_of_clid_list_bm & ZBEE_NWK_GP_CMD_COMMISSIONING_CLID_LIST_LEN_CLI0xF0 ) >> |
| 1022 | ws_ctz(ZBEE_NWK_GP_CMD_COMMISSIONING_CLID_LIST_LEN_CLI0xF0); |
| 1023 | |
| 1024 | proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_cmd_comm_length_of_clid_list, |
| 1025 | ett_zbee_nwk_cmd_comm_length_of_clid_list, length_of_clid_list, ENC_NA0x00000000); |
| 1026 | offset += 1; |
| 1027 | |
| 1028 | if (server_clid_num > 0) { |
| 1029 | /* Display server cluster list */ |
| 1030 | server_clid_list = proto_tree_add_item(tree, hf_zbee_nwk_cmd_comm_clid_list_server, |
| 1031 | tvb, offset, 2*server_clid_num, ENC_NA0x00000000); |
| 1032 | server_clid_list_tree = proto_item_add_subtree(server_clid_list, ett_zbee_nwk_cmd_comm_clid_list_server); |
| 1033 | /* Retrieve server clusters */ |
| 1034 | for (i = 0; i < server_clid_num; i++, offset += 2) { |
| 1035 | proto_tree_add_item(server_clid_list_tree, hf_zbee_nwk_cmd_comm_cluster_id, |
| 1036 | tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000); |
| 1037 | } |
| 1038 | } |
| 1039 | if (client_clid_num > 0) { |
| 1040 | /* Display client cluster list */ |
| 1041 | client_clid_list = proto_tree_add_item(tree, hf_zbee_nwk_cmd_comm_clid_list_client, |
| 1042 | tvb, offset, 2*client_clid_num, ENC_NA0x00000000); |
| 1043 | client_clid_list_tree = proto_item_add_subtree(client_clid_list, ett_zbee_nwk_cmd_comm_clid_list_client); |
| 1044 | /* Retrieve client clusters */ |
| 1045 | for (i = 0; i < client_clid_num; i++, offset += 2) { |
| 1046 | proto_tree_add_item(client_clid_list_tree, hf_zbee_nwk_cmd_comm_cluster_id, |
| 1047 | tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000); |
| 1048 | } |
| 1049 | } |
| 1050 | } |
| 1051 | if (appli_info_options & ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_SIP0x10) { |
| 1052 | /* Get and display Switch Information. */ |
| 1053 | switch_info_length = tvb_get_uint8(tvb, offset); |
| 1054 | switch_info = proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_comm_switch_info, |
| 1055 | tvb, offset, 1 + switch_info_length, ENC_NA0x00000000); |
| 1056 | switch_info_tree = proto_item_add_subtree(switch_info, ett_zbee_nwk_cmd_comm_switch_info); |
| 1057 | proto_tree_add_item(switch_info_tree, hf_zbee_nwk_gp_cmd_comm_switch_info_length, |
| 1058 | tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000); |
| 1059 | offset += 1; |
| 1060 | |
| 1061 | if (switch_info_length >= 1) { |
| 1062 | proto_tree_add_bitmask(switch_info_tree, tvb, offset, |
| 1063 | hf_zbee_nwk_gp_cmd_comm_switch_info_generic_switch_config, |
| 1064 | ett_zbee_nwk_cmd_comm_switch_info_generic_switch_config, generic_switch_config, ENC_NA0x00000000); |
| 1065 | offset += 1; |
| 1066 | } |
| 1067 | |
| 1068 | if (switch_info_length >= ZBEE_NWK_GP_CMD_COMMISSIONING_SWITCH_INFO_LEN0x02) { |
| 1069 | proto_tree_add_item(switch_info_tree, |
| 1070 | hf_zbee_nwk_gp_cmd_comm_switch_info_current_contact_status, |
| 1071 | tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000); |
| 1072 | offset += 1; |
| 1073 | } |
| 1074 | |
| 1075 | /* Guard against future spec revisions that may increase Switch info length beyond the currently defined value of 0x02. */ |
| 1076 | if (switch_info_length > ZBEE_NWK_GP_CMD_COMMISSIONING_SWITCH_INFO_LEN0x02) { |
| 1077 | offset += switch_info_length - ZBEE_NWK_GP_CMD_COMMISSIONING_SWITCH_INFO_LEN0x02; |
| 1078 | } |
| 1079 | } |
| 1080 | } |
| 1081 | return offset; |
| 1082 | } /* dissect_zbee_nwk_gp_cmd_commissioning */ |
| 1083 | |
| 1084 | /** |
| 1085 | *Dissector for ZigBee Green Power channel request. |
| 1086 | * |
| 1087 | *@param tvb pointer to buffer containing raw packet. |
| 1088 | *@param pinfo pointer to packet information fields. |
| 1089 | *@param tree pointer to data tree Wireshark uses to display packet. |
| 1090 | *@param packet packet data. |
| 1091 | *@param offset current payload offset. |
| 1092 | *@return payload processed offset. |
| 1093 | */ |
| 1094 | static unsigned |
| 1095 | dissect_zbee_nwk_gp_cmd_channel_request(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree, |
| 1096 | zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset) |
| 1097 | { |
| 1098 | static int * const channels[] = { |
| 1099 | &hf_zbee_nwk_gp_cmd_channel_request_toggling_behaviour_1st, |
| 1100 | &hf_zbee_nwk_gp_cmd_channel_request_toggling_behaviour_2nd, |
| 1101 | NULL((void*)0) |
| 1102 | }; |
| 1103 | |
| 1104 | /* Get Command Options Field, build subtree and display the results. */ |
| 1105 | proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_cmd_channel_request_toggling_behaviour, ett_zbee_nwk_cmd_options, channels, ENC_NA0x00000000); |
| 1106 | offset += 1; |
| 1107 | return offset; |
| 1108 | } /* dissect_zbee_nwk_gp_cmd_channel_request */ |
| 1109 | |
| 1110 | /** |
| 1111 | * Dissector for ZigBee Green Power Application Description Attribute Records. |
| 1112 | * |
| 1113 | *@param tvb pointer to buffer containing raw packet. |
| 1114 | *@param pinfo pointer to packet information fields. |
| 1115 | *@param tree pointer to data tree Wireshark uses to display packet. |
| 1116 | *@param packet packet data. |
| 1117 | *@param offset current payload offset. |
| 1118 | *@param num_attr_recs number of attribute records to parse. |
| 1119 | *@return payload processed offset. |
| 1120 | */ |
| 1121 | static unsigned |
| 1122 | dissect_zbee_nwk_gp_report_desc_attr_rec(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree, |
| 1123 | zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset, unsigned num_attr_recs) |
| 1124 | { |
| 1125 | uint8_t attr_rec_opt, len_remain; |
| 1126 | proto_tree *subtree = NULL((void*)0); |
| 1127 | unsigned i, end; |
| 1128 | |
| 1129 | static int * const options[] = { |
| 1130 | &hf_zbee_nwk_gp_cmd_app_desc_attr_rec_opt_len_remain, |
| 1131 | &hf_zbee_nwk_gp_cmd_app_desc_attr_rec_opt_reported, |
| 1132 | &hf_zbee_nwk_gp_cmd_app_desc_attr_rec_opt_val_present, |
| 1133 | NULL((void*)0) |
| 1134 | }; |
| 1135 | |
| 1136 | for (i = 0; i < num_attr_recs; i++) { |
| 1137 | subtree = proto_tree_add_subtree_format(tree, tvb, offset, -1, ett_zbee_nwk_cmd_app_desc_att_rec, |
| 1138 | NULL((void*)0), "Attribute Record %u", i); |
| 1139 | |
| 1140 | /* Attribute ID */ |
| 1141 | proto_tree_add_item(subtree, hf_zbee_nwk_gp_cmd_app_desc_attr_rec_id, tvb, offset, |
| 1142 | 2, ENC_LITTLE_ENDIAN0x80000000); |
| 1143 | offset += 2; |
| 1144 | |
| 1145 | /* Attribute Data Type */ |
| 1146 | proto_tree_add_item(subtree, hf_zbee_nwk_gp_cmd_app_desc_attr_rec_data_type, tvb, |
| 1147 | offset, 1, ENC_LITTLE_ENDIAN0x80000000); |
| 1148 | offset++; |
| 1149 | |
| 1150 | /* Attribute Options */ |
| 1151 | attr_rec_opt = tvb_get_uint8(tvb, offset); |
| 1152 | proto_tree_add_bitmask(subtree, tvb, offset, hf_zbee_nwk_gp_cmd_app_desc_attr_rec_opt, |
| 1153 | ett_zbee_nwk_cmd_options, options, ENC_NA0x00000000); |
| 1154 | |
| 1155 | /* Extract remaining attribute record length (add 1 since stored value is decremented by 1) */ |
| 1156 | len_remain = (attr_rec_opt & ZBEE_NWK_GP_CMD_APP_DESC_ATTR_REC_OPT_LEN_REMAIN0x0F) + 1; |
| 1157 | offset++; |
| 1158 | |
| 1159 | /* Determine the offset at the end of the packet so we can calculate the attribute value length later */ |
| 1160 | end = offset + len_remain; |
| 1161 | |
| 1162 | /* Attribute Offset within Report */ |
| 1163 | if (attr_rec_opt & ZBEE_NWK_GP_CMD_APP_DESC_ATTR_REC_OPT_REPORTED0x10) { |
| 1164 | proto_tree_add_item(subtree, hf_zbee_nwk_gp_cmd_app_desc_attr_rec_offset, |
| 1165 | tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000); |
| 1166 | offset++; |
| 1167 | } |
| 1168 | |
| 1169 | /* Optional Attribute Value */ |
| 1170 | if (attr_rec_opt & ZBEE_NWK_GP_CMD_APP_DESC_ATTR_REC_OPT_VAL_PRESENT0x20) { |
| 1171 | unsigned val_len = end - offset; |
| 1172 | |
| 1173 | proto_tree_add_item(subtree, hf_zbee_nwk_gp_cmd_app_desc_attr_rec_val, |
| 1174 | tvb, offset, val_len, ENC_NA0x00000000); |
| 1175 | offset += val_len; |
Value stored to 'offset' is never read | |
| 1176 | } |
| 1177 | offset = end; |
| 1178 | } |
| 1179 | |
| 1180 | return offset; |
| 1181 | } /* dissect_zbee_nwk_gp_report_desc_attr_rec */ |
| 1182 | |
| 1183 | /** |
| 1184 | * Dissector for ZigBee Green Power Application Description Data Point Descriptors. |
| 1185 | * |
| 1186 | *@param tvb pointer to buffer containing raw packet. |
| 1187 | *@param pinfo pointer to packet information fields. |
| 1188 | *@param tree pointer to data tree Wireshark uses to display packet. |
| 1189 | *@param packet packet data. |
| 1190 | *@param offset current payload offset. |
| 1191 | *@param len_remain remaining length of report descriptor containing data point descriptors |
| 1192 | *@return payload processed offset. |
| 1193 | */ |
| 1194 | static unsigned |
| 1195 | dissect_zbee_nwk_gp_report_desc_data_pt_desc(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree, |
| 1196 | zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset, uint8_t len_remain) |
| 1197 | { |
| 1198 | uint8_t data_pt_opt, raw_recs; |
| 1199 | proto_item *ti, *opt_item; |
| 1200 | proto_tree *subtree, *mask_tree; |
| 1201 | unsigned i = 0; |
| 1202 | unsigned end = offset + len_remain; |
| 1203 | static int * const options[] = { |
| 1204 | /* We are manually adding the 'number of attribute records' field */ |
| 1205 | &hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_opt_server, |
| 1206 | &hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_opt_manu_id_present, |
| 1207 | NULL((void*)0) |
| 1208 | }; |
| 1209 | |
| 1210 | while (offset < end) |
| 1211 | { |
| 1212 | unsigned start_offset = offset; |
| 1213 | |
| 1214 | /* Create the container for this descriptor */ |
| 1215 | subtree = proto_tree_add_subtree_format(tree, tvb, offset, -1, ett_zbee_nwk_cmd_app_desc_data_pt_desc, |
| 1216 | &ti, "Data Point Descriptor %u", i++); |
| 1217 | |
| 1218 | data_pt_opt = tvb_get_uint8(tvb, offset); |
| 1219 | raw_recs = data_pt_opt & ZBEE_NWK_GP_CMD_APP_DESC_DATA_PT_DESC_OPT_ATTR_NUM0x07; |
| 1220 | |
| 1221 | /** Options */ |
| 1222 | opt_item = proto_tree_add_item(subtree, hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_opt, |
| 1223 | tvb, offset, 1, ENC_NA0x00000000); |
| 1224 | |
| 1225 | mask_tree = proto_item_add_subtree(opt_item, ett_zbee_nwk_cmd_app_desc_data_pt_options); |
| 1226 | |
| 1227 | proto_tree_add_uint_format_value(mask_tree, hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_opt_num_recs, |
| 1228 | tvb, offset, 1, raw_recs, "%u", raw_recs + 1); |
| 1229 | |
| 1230 | proto_tree_add_bitmask_list(mask_tree, tvb, offset, 1, options, ENC_NA0x00000000); |
| 1231 | |
| 1232 | offset++; |
| 1233 | |
| 1234 | /* Cluster ID */ |
| 1235 | proto_tree_add_item(subtree, hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_cluster_id, |
| 1236 | tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000); |
| 1237 | offset += 2; |
| 1238 | |
| 1239 | /* Optional Manufacturer ID */ |
| 1240 | if (data_pt_opt & ZBEE_NWK_GP_CMD_APP_DESC_DATA_PT_DESC_OPT_MANU_ID_PRESENT0x10) { |
| 1241 | proto_tree_add_item(subtree, hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_manu_id, |
| 1242 | tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000); |
| 1243 | offset += 2; |
| 1244 | } |
| 1245 | |
| 1246 | /* Logic for the next function call remains the same */ |
| 1247 | offset = dissect_zbee_nwk_gp_report_desc_attr_rec(tvb, pinfo, subtree, packet, offset, raw_recs + 1); |
| 1248 | |
| 1249 | if (ti) { |
| 1250 | proto_item_set_len(ti, offset - start_offset); |
| 1251 | } |
| 1252 | } |
| 1253 | |
| 1254 | return offset; |
| 1255 | } /* dissect_zbee_nwk_gp_report_desc_data_pt_desc */ |
| 1256 | |
| 1257 | /** |
| 1258 | * Dissector for ZigBee Green Power Application Description Report Descriptors. |
| 1259 | * |
| 1260 | *@param tvb pointer to buffer containing raw packet. |
| 1261 | *@param pinfo pointer to packet information fields. |
| 1262 | *@param tree pointer to data tree Wireshark uses to display packet. |
| 1263 | *@param packet packet data. |
| 1264 | *@param offset current payload offset. |
| 1265 | *@param num_reports number of report descriptors to parse. |
| 1266 | *@return payload processed offset. |
| 1267 | */ |
| 1268 | static unsigned |
| 1269 | dissect_zbee_nwk_gp_report_desc(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree, |
| 1270 | zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset, unsigned num_reports) |
| 1271 | { |
| 1272 | uint8_t report_opt, len_remain; |
| 1273 | proto_tree *subtree = NULL((void*)0); |
| 1274 | unsigned i; |
| 1275 | |
| 1276 | static int * const options[] = { |
| 1277 | &hf_zbee_nwk_gp_cmd_app_desc_report_desc_opt_timeout_present, |
| 1278 | NULL((void*)0) |
| 1279 | }; |
| 1280 | |
| 1281 | for (i = 0; i < num_reports; i++) { |
| 1282 | subtree = proto_tree_add_subtree_format(tree, tvb, offset, -1, ett_zbee_nwk_cmd_app_desc_report_desc, |
| 1283 | NULL((void*)0), "Report Descriptor %u", i); |
| 1284 | |
| 1285 | /* Report Identifier */ |
| 1286 | proto_tree_add_item(subtree, hf_zbee_nwk_gp_cmd_app_desc_report_desc_id, tvb, |
| 1287 | offset, 1, ENC_LITTLE_ENDIAN0x80000000); |
| 1288 | offset++; |
| 1289 | |
| 1290 | /* Report Options */ |
| 1291 | report_opt = tvb_get_uint8(tvb, offset); |
| 1292 | proto_tree_add_bitmask(subtree, tvb, offset, hf_zbee_nwk_gp_cmd_app_desc_report_desc_opt, |
| 1293 | ett_zbee_nwk_cmd_options, options, ENC_NA0x00000000); |
| 1294 | offset++; |
| 1295 | |
| 1296 | /* Optional Timeout Period */ |
| 1297 | if (report_opt & ZBEE_NWK_GP_CMD_APP_DESC_REPORT_DESC_OPT_TIMEOUT_PRESENT0x01) { |
| 1298 | proto_tree_add_item(subtree, hf_zbee_nwk_gp_cmd_app_desc_report_desc_timeout, |
| 1299 | tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000); |
| 1300 | offset += 2; |
| 1301 | } |
| 1302 | |
| 1303 | /* Remaining Length */ |
| 1304 | len_remain = tvb_get_uint8(tvb, offset); |
| 1305 | proto_tree_add_item(subtree, hf_zbee_nwk_gp_cmd_app_desc_report_desc_len_remain, |
| 1306 | tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000); |
| 1307 | offset++; |
| 1308 | |
| 1309 | /* Dissect the data point descriptors */ |
| 1310 | offset = dissect_zbee_nwk_gp_report_desc_data_pt_desc(tvb, pinfo, subtree, packet, offset, len_remain); |
| 1311 | } |
| 1312 | |
| 1313 | return offset; |
| 1314 | } /* dissect_zbee_nwk_gp_report_desc */ |
| 1315 | |
| 1316 | |
| 1317 | /** |
| 1318 | * Dissector for ZigBee Green Power Application Description. |
| 1319 | * |
| 1320 | *@param tvb pointer to buffer containing raw packet. |
| 1321 | *@param pinfo pointer to packet information fields. |
| 1322 | *@param tree pointer to data tree Wireshark uses to display packet. |
| 1323 | *@param packet packet data. |
| 1324 | *@param offset current payload offset. |
| 1325 | *@return payload processed offset. |
| 1326 | */ |
| 1327 | static unsigned |
| 1328 | dissect_zbee_nwk_gp_cmd_application_desc(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree, |
| 1329 | zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset) |
| 1330 | { |
| 1331 | uint8_t num_reports; |
| 1332 | |
| 1333 | /* Total number of reports */ |
| 1334 | proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_app_desc_total_report, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000); |
| 1335 | offset++; |
| 1336 | |
| 1337 | /* Number of reports */ |
| 1338 | num_reports = tvb_get_uint8(tvb, offset); |
| 1339 | proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_app_desc_num_report, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000); |
| 1340 | offset++; |
| 1341 | |
| 1342 | /* Dissect the report descriptors */ |
| 1343 | offset = dissect_zbee_nwk_gp_report_desc(tvb, pinfo, tree, packet, offset, num_reports); |
| 1344 | |
| 1345 | return offset; |
| 1346 | } /* dissect_zbee_nwk_gp_cmd_application_desc */ |
| 1347 | |
| 1348 | /** |
| 1349 | *Dissector for ZigBee Green Power channel configuration. |
| 1350 | * |
| 1351 | *@param tvb pointer to buffer containing raw packet. |
| 1352 | *@param pinfo pointer to packet information fields. |
| 1353 | *@param tree pointer to data tree Wireshark uses to display packet. |
| 1354 | *@param packet packet data. |
| 1355 | *@param offset current payload offset. |
| 1356 | *@return payload processed offset. |
| 1357 | */ |
| 1358 | static unsigned |
| 1359 | dissect_zbee_nwk_gp_cmd_channel_configuration(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree, |
| 1360 | zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset) |
| 1361 | { |
| 1362 | static int * const channels[] = { |
| 1363 | &hf_zbee_nwk_gp_cmd_channel_configuration, |
| 1364 | NULL((void*)0) |
| 1365 | }; |
| 1366 | |
| 1367 | /* Get Command Options Field, build subtree and display the results. */ |
| 1368 | proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_cmd_operational_channel, ett_zbee_nwk_cmd_options, channels, ENC_NA0x00000000); |
| 1369 | |
| 1370 | offset += 1; |
| 1371 | return offset; |
| 1372 | } /* dissect_zbee_nwk_gp_cmd_channel_configuration */ |
| 1373 | |
| 1374 | /** |
| 1375 | *Dissector for ZigBee Green Power commands attrib reporting. |
| 1376 | * |
| 1377 | *@param tvb pointer to buffer containing raw packet. |
| 1378 | *@param pinfo pointer to packet information fields. |
| 1379 | *@param tree pointer to data tree Wireshark uses to display packet. |
| 1380 | *@param packet packet data. |
| 1381 | *@param offset current payload offset. |
| 1382 | *@param mfr_code manufacturer code. |
| 1383 | *@return payload processed offset. |
| 1384 | */ |
| 1385 | static unsigned |
| 1386 | dissect_zbee_nwk_gp_cmd_attr_reporting(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree, |
| 1387 | zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset, uint16_t mfr_code) |
| 1388 | { |
| 1389 | uint16_t cluster_id; |
| 1390 | proto_tree *field_tree; |
| 1391 | |
| 1392 | /* Get cluster ID and add it into the tree. */ |
| 1393 | proto_tree_add_item_ret_uint16(tree, hf_zbee_nwk_gp_zcl_attr_cluster_id, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000, &cluster_id); |
| 1394 | |
| 1395 | offset += 2; |
| 1396 | /* Create subtree and parse ZCL Write Attribute Payload. */ |
| 1397 | field_tree = proto_tree_add_subtree_format(tree, tvb, offset, 2, ett_zbee_nwk_cmd_options, NULL((void*)0), |
| 1398 | "Attribute reporting command for cluster: 0x%04X", cluster_id); |
| 1399 | |
| 1400 | dissect_zcl_report_attr(tvb, pinfo, field_tree, &offset, cluster_id, mfr_code, ZBEE_ZCL_FCF_TO_CLIENT0x01); |
| 1401 | |
| 1402 | return offset; |
| 1403 | } /* dissect_zbee_nwk_gp_cmd_attr_reporting */ |
| 1404 | |
| 1405 | |
| 1406 | /** |
| 1407 | * Dissector for ZigBee Green Power manufacturer specific attribute reporting. |
| 1408 | * |
| 1409 | *@param tvb pointer to buffer containing raw packet. |
| 1410 | *@param pinfo pointer to packet information fields. |
| 1411 | *@param tree pointer to data tree Wireshark uses to display packet. |
| 1412 | *@param packet packet data. |
| 1413 | *@param offset current payload offset. |
| 1414 | *@return payload processed offset. |
| 1415 | */ |
| 1416 | static unsigned |
| 1417 | dissect_zbee_nwk_gp_cmd_MS_attr_reporting(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree, |
| 1418 | zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset) |
| 1419 | { |
| 1420 | uint16_t mfr_code; |
| 1421 | |
| 1422 | /*dissect manufacturer ID*/ |
| 1423 | proto_tree_add_item_ret_uint16(tree, hf_zbee_zcl_gp_cmd_ms_manufacturer_code, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000, &mfr_code); |
| 1424 | offset += 2; |
| 1425 | |
| 1426 | offset = dissect_zbee_nwk_gp_cmd_attr_reporting(tvb, pinfo, tree, packet, offset, mfr_code); |
| 1427 | |
| 1428 | return offset; |
| 1429 | }/*dissect_zbee_nwk_gp_cmd_MS_attr_reporting*/ |
| 1430 | |
| 1431 | |
| 1432 | |
| 1433 | |
| 1434 | /** |
| 1435 | *Dissector for ZigBee Green Power commissioning reply. |
| 1436 | * |
| 1437 | *@param tvb pointer to buffer containing raw packet. |
| 1438 | *@param pinfo pointer to packet information fields. |
| 1439 | *@param tree pointer to data tree Wireshark uses to display packet. |
| 1440 | *@param packet packet data. |
| 1441 | *@param offset current payload offset. |
| 1442 | *@return payload processed offset. |
| 1443 | */ |
| 1444 | static unsigned |
| 1445 | dissect_zbee_nwk_gp_cmd_commissioning_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, |
| 1446 | zbee_nwk_green_power_packet *packet, unsigned offset) |
| 1447 | { |
| 1448 | uint8_t cr_options; |
| 1449 | uint8_t cr_sec_level; |
| 1450 | |
| 1451 | void *enc_buffer; |
| 1452 | uint8_t *enc_buffer_withA; |
| 1453 | uint8_t *dec_buffer; |
| 1454 | bool_Bool gp_decrypted; |
| 1455 | GSList *GSList_i; |
| 1456 | tvbuff_t *payload_tvb; |
| 1457 | |
| 1458 | static int * const options[] = { |
| 1459 | &hf_zbee_nwk_gp_cmd_comm_rep_opt_panid_present, |
| 1460 | &hf_zbee_nwk_gp_cmd_comm_rep_opt_sec_key_present, |
| 1461 | &hf_zbee_nwk_gp_cmd_comm_rep_opt_key_encr, |
| 1462 | &hf_zbee_nwk_gp_cmd_comm_rep_opt_sec_level, |
| 1463 | &hf_zbee_nwk_gp_cmd_comm_rep_opt_sec_type, |
| 1464 | NULL((void*)0) |
| 1465 | }; |
| 1466 | |
| 1467 | /* Get Options Field, build subtree and display the results. */ |
| 1468 | cr_options = tvb_get_uint8(tvb, offset); |
| 1469 | proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_cmd_comm_rep_opt, ett_zbee_nwk_cmd_options, options, ENC_NA0x00000000); |
| 1470 | offset += 1; |
| 1471 | |
| 1472 | /* Parse and display security Pan ID value. */ |
| 1473 | if (cr_options & ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_PAN_ID_PRESENT0x01) { |
| 1474 | proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_comm_rep_pan_id, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000); |
| 1475 | offset += 2; |
| 1476 | } |
| 1477 | |
| 1478 | cr_sec_level = (cr_options & ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_SEC_LEVEL0x18) >> |
| 1479 | ws_ctz(ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_SEC_LEVEL0x18); |
| 1480 | |
| 1481 | /* Parse and display security key. */ |
| 1482 | if (cr_options & ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_SEC_KEY_PRESENT0x02) { |
| 1483 | proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_comm_security_key, tvb, offset, ZBEE_SEC_CONST_KEYSIZE16, ENC_NA0x00000000); |
| 1484 | offset += ZBEE_SEC_CONST_KEYSIZE16; |
| 1485 | |
| 1486 | /* Key is present clear, add to the key ring */ |
| 1487 | if (!(cr_options & ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_KEY_ENCR0x04)) { |
| 1488 | key_record_t key_record; |
| 1489 | void *key; |
| 1490 | |
| 1491 | key_record.frame_num = 0; |
| 1492 | key_record.label = NULL((void*)0); |
| 1493 | key = tvb_memdup(pinfo->pool, tvb, offset - ZBEE_SEC_CONST_KEYSIZE16, ZBEE_SEC_CONST_KEYSIZE16); |
| 1494 | memcpy(key_record.key, key, ZBEE_SEC_CONST_KEYSIZE16); |
| 1495 | zbee_gp_keyring = g_slist_prepend(zbee_gp_keyring, g_memdup2(&key_record, sizeof(key_record_t))); |
| 1496 | } |
| 1497 | } |
| 1498 | /* Parse and display security MIC. */ |
| 1499 | if ((cr_options & ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_KEY_ENCR0x04) && |
| 1500 | (cr_options & ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_SEC_KEY_PRESENT0x02)) { |
| 1501 | proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_comm_gpd_sec_key_mic, tvb, offset, 4, ENC_LITTLE_ENDIAN0x80000000); |
| 1502 | offset += 4; |
| 1503 | } |
| 1504 | |
| 1505 | /* Parse and display Frame Counter and decrypt key */ |
| 1506 | if ((cr_options & ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_KEY_ENCR0x04) && |
| 1507 | (cr_options & ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_SEC_KEY_PRESENT0x02) && |
| 1508 | ((cr_sec_level == ZBEE_NWK_GP_SECURITY_LEVEL_FULL0x02) || |
| 1509 | (cr_sec_level == ZBEE_NWK_GP_SECURITY_LEVEL_FULLENCR0x03))) { |
| 1510 | if (offset + 4 <= tvb_captured_length(tvb)){ |
| 1511 | proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_comm_rep_frame_counter, tvb, offset, 4, ENC_LITTLE_ENDIAN0x80000000); |
| 1512 | offset += 4; |
| 1513 | |
| 1514 | if (packet != NULL((void*)0)) |
| 1515 | { |
| 1516 | /* decrypt the security key*/ |
| 1517 | dec_buffer = (uint8_t *)wmem_alloc(pinfo->pool, ZBEE_SEC_CONST_KEYSIZE16); |
| 1518 | enc_buffer_withA = (uint8_t *)wmem_alloc(pinfo->pool, 4 + ZBEE_SEC_CONST_KEYSIZE16 + 4); /* CCM* a (this is SrcID) + encKey + MIC */ |
| 1519 | enc_buffer = tvb_memdup(pinfo->pool, tvb, offset - ZBEE_SEC_CONST_KEYSIZE16 - 4 - 4, ZBEE_SEC_CONST_KEYSIZE16 + 4); |
| 1520 | phtoleu32(enc_buffer_withA, packet->source_id); /* enc_buffer_withA = CCM* a (srcID) | enc_buffer */ |
| 1521 | memcpy(enc_buffer_withA+4, enc_buffer, ZBEE_SEC_CONST_KEYSIZE16 + 4); |
| 1522 | gp_decrypted = false0; |
| 1523 | |
| 1524 | for (GSList_i = zbee_gp_keyring; GSList_i && !gp_decrypted; GSList_i = g_slist_next(GSList_i)((GSList_i) ? (((GSList *)(GSList_i))->next) : ((void*)0))) { |
| 1525 | packet->security_frame_counter = tvb_get_uint32(tvb, offset - 4, ENC_LITTLE_ENDIAN0x80000000); /*for Nonce creation */ |
| 1526 | gp_decrypted = zbee_gp_decrypt_payload(packet, enc_buffer_withA, 4 |
| 1527 | , dec_buffer, ZBEE_SEC_CONST_KEYSIZE16, 4, ((key_record_t *)(GSList_i->data))->key); |
| 1528 | } |
| 1529 | |
| 1530 | if (gp_decrypted) { |
| 1531 | key_record_t key_record; |
| 1532 | |
| 1533 | key_record.frame_num = 0; |
| 1534 | key_record.label = NULL((void*)0); |
| 1535 | memcpy(key_record.key, dec_buffer, ZBEE_SEC_CONST_KEYSIZE16); |
| 1536 | zbee_gp_keyring = g_slist_prepend(zbee_gp_keyring, g_memdup2(&key_record, sizeof(key_record_t))); |
| 1537 | |
| 1538 | payload_tvb = tvb_new_child_real_data(tvb, dec_buffer, ZBEE_SEC_CONST_KEYSIZE16, ZBEE_SEC_CONST_KEYSIZE16); |
| 1539 | add_new_data_source(pinfo, payload_tvb, "Decrypted security key"); |
| 1540 | } |
| 1541 | } |
| 1542 | } |
| 1543 | else{ |
| 1544 | /* This field is new in 2016 specification, older implementation may exist without it */ |
| 1545 | proto_tree_add_expert_remaining(tree, pinfo, &ei_zbee_nwk_gp_com_rep_no_out_cnt, tvb, 0); |
| 1546 | } |
| 1547 | } |
| 1548 | return offset; |
| 1549 | } /* dissect_zbee_nwk_gp_cmd_commissioning_reply */ |
| 1550 | |
| 1551 | /** |
| 1552 | * Dissector for ZigBee Green Power read attributes and request attributes commands. |
| 1553 | * |
| 1554 | *@param tvb pointer to buffer containing raw packet. |
| 1555 | *@param pinfo pointer to packet information fields. |
| 1556 | *@param tree pointer to data tree Wireshark uses to display packet. |
| 1557 | *@param packet packet data. |
| 1558 | *@param offset current payload offset. |
| 1559 | *@return payload processed offset. |
| 1560 | */ |
| 1561 | static unsigned |
| 1562 | dissect_zbee_nwk_gp_cmd_read_attributes(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree, |
| 1563 | zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset) |
| 1564 | { |
| 1565 | uint8_t cr_options = 0; |
| 1566 | proto_tree *subtree = NULL((void*)0); |
| 1567 | uint16_t cluster_id; |
| 1568 | uint16_t mfr_code = ZBEE_MFG_CODE_NONE0x0000; |
| 1569 | uint8_t record_list_len; |
| 1570 | unsigned tvb_len; |
| 1571 | uint8_t i; |
| 1572 | |
| 1573 | static int * const options[] = { |
| 1574 | &hf_zbee_nwk_gp_cmd_read_att_opt_multi_rec, |
| 1575 | &hf_zbee_nwk_gp_cmd_read_att_opt_man_field_present, |
| 1576 | NULL((void*)0) |
| 1577 | }; |
| 1578 | |
| 1579 | /* Get Options Field, build subtree and display the results. */ |
| 1580 | cr_options = tvb_get_uint8(tvb, offset); |
| 1581 | proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_cmd_read_att_opt, ett_zbee_nwk_cmd_options, options, ENC_NA0x00000000); |
| 1582 | |
| 1583 | offset += 1; |
| 1584 | /* Parse and display manufacturer ID value. */ |
| 1585 | if (cr_options & ZBEE_NWK_GP_CMD_READ_ATTRIBUTE_OPT_MAN_FIELD_PRESENT0x02) { |
| 1586 | proto_tree_add_item_ret_uint16(tree, hf_zbee_zcl_gp_cmd_ms_manufacturer_code, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000, &mfr_code); |
| 1587 | offset += 2; |
| 1588 | } |
| 1589 | |
| 1590 | tvb_len = tvb_captured_length(tvb); |
| 1591 | while (offset < tvb_len) |
| 1592 | { |
| 1593 | /* Create subtree and parse attributes list. */ |
| 1594 | subtree = proto_tree_add_subtree_format(tree, tvb, offset, -1, ett_zbee_nwk_clu_rec, NULL((void*)0), "Cluster Record Request"); |
| 1595 | |
| 1596 | /* Get cluster ID and add it into the subtree. */ |
| 1597 | proto_tree_add_item_ret_uint16(subtree, hf_zbee_nwk_gp_zcl_attr_cluster_id, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000, &cluster_id); |
| 1598 | offset += 2; |
| 1599 | /* Get length of record list (number of attributes * 2). */ |
| 1600 | proto_tree_add_item_ret_uint8(subtree, hf_zbee_nwk_gp_cmd_read_att_record_len, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000, &record_list_len); |
| 1601 | offset += 1; |
| 1602 | |
| 1603 | for(i=0 ; i<record_list_len ; i+=2) |
| 1604 | { |
| 1605 | /* Dissect the attribute identifier */ |
| 1606 | dissect_zcl_attr_id(tvb, subtree, &offset, cluster_id, mfr_code, ZBEE_ZCL_FCF_TO_CLIENT0x01); |
| 1607 | } |
| 1608 | } |
| 1609 | return offset; |
| 1610 | } /* dissect_zbee_nwk_gp_cmd_read_attributes */ |
| 1611 | /** |
| 1612 | * Dissector for ZigBee Green Power write attributes commands. |
| 1613 | * |
| 1614 | *@param tvb pointer to buffer containing raw packet. |
| 1615 | *@param pinfo pointer to packet information fields. |
| 1616 | *@param tree pointer to data tree Wireshark uses to display packet. |
| 1617 | *@param packet packet data. |
| 1618 | *@param offset current payload offset. |
| 1619 | *@return payload processed offset. |
| 1620 | */ |
| 1621 | static unsigned |
| 1622 | dissect_zbee_nwk_gp_cmd_write_attributes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, |
| 1623 | zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset) |
| 1624 | { |
| 1625 | uint8_t cr_options = 0; |
| 1626 | proto_tree *subtree = NULL((void*)0); |
| 1627 | proto_tree *att_tree = NULL((void*)0); |
| 1628 | uint16_t mfr_code = ZBEE_MFG_CODE_NONE0x0000; |
| 1629 | uint16_t cluster_id; |
| 1630 | uint8_t record_list_len; |
| 1631 | unsigned tvb_len; |
| 1632 | uint16_t attr_id; |
| 1633 | unsigned end_byte; |
| 1634 | //uint8_t i; |
| 1635 | |
| 1636 | static int * const options[] = { |
| 1637 | &hf_zbee_nwk_gp_cmd_read_att_opt_multi_rec, |
| 1638 | &hf_zbee_nwk_gp_cmd_read_att_opt_man_field_present, |
| 1639 | NULL((void*)0) |
| 1640 | }; |
| 1641 | |
| 1642 | /* Get Options Field, build subtree and display the results. */ |
| 1643 | cr_options = tvb_get_uint8(tvb, offset); |
| 1644 | proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_cmd_read_att_opt, ett_zbee_nwk_cmd_options, options, ENC_NA0x00000000); |
| 1645 | |
| 1646 | offset += 1; |
| 1647 | /* Parse and display manufacturer ID value. */ |
| 1648 | if (cr_options & ZBEE_NWK_GP_CMD_READ_ATTRIBUTE_OPT_MAN_FIELD_PRESENT0x02) { |
| 1649 | proto_tree_add_item_ret_uint16(tree, hf_zbee_zcl_gp_cmd_ms_manufacturer_code, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000, &mfr_code); |
| 1650 | offset += 2; |
| 1651 | } |
| 1652 | |
| 1653 | tvb_len = tvb_captured_length(tvb); |
| 1654 | while (offset < tvb_len) |
| 1655 | { |
| 1656 | /* Create subtree and parse attributes list. */ |
| 1657 | subtree = proto_tree_add_subtree_format(tree, tvb, offset, -1, ett_zbee_nwk_clu_rec, NULL((void*)0), "Write Cluster Record"); |
| 1658 | |
| 1659 | /* Get cluster ID and add it into the subtree. */ |
| 1660 | proto_tree_add_item_ret_uint16(subtree, hf_zbee_nwk_gp_zcl_attr_cluster_id, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000, &cluster_id); |
| 1661 | offset += 2; |
| 1662 | /* Get length of record list. */ |
| 1663 | record_list_len = tvb_get_uint8(tvb, offset); |
| 1664 | proto_tree_add_item(subtree, hf_zbee_nwk_gp_cmd_read_att_record_len, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000); |
| 1665 | offset += 1; |
| 1666 | |
| 1667 | end_byte = offset + record_list_len; |
| 1668 | while ( offset < end_byte) |
| 1669 | { |
| 1670 | /* Create subtree for attribute status field */ |
| 1671 | att_tree = proto_tree_add_subtree_format(subtree, tvb, offset, 0, ett_zbee_nwk_att_rec, NULL((void*)0), "Write Attribute record"); |
| 1672 | |
| 1673 | /* Dissect the attribute identifier */ |
| 1674 | attr_id = tvb_get_letohs(tvb, offset); |
| 1675 | dissect_zcl_attr_id(tvb, att_tree, &offset, cluster_id, mfr_code, ZBEE_ZCL_FCF_TO_CLIENT0x01); |
| 1676 | |
| 1677 | /* Dissect the attribute data type and data */ |
| 1678 | dissect_zcl_attr_data_type_val(tvb, pinfo, att_tree, &offset, attr_id, cluster_id, mfr_code, ZBEE_ZCL_FCF_TO_CLIENT0x01); |
| 1679 | } |
| 1680 | } |
| 1681 | return offset; |
| 1682 | } /* dissect_zbee_nwk_gp_cmd_write_attributes */ |
| 1683 | |
| 1684 | |
| 1685 | /** |
| 1686 | * Dissector for ZigBee Green Power read attribute response command. |
| 1687 | * |
| 1688 | *@param tvb pointer to buffer containing raw packet. |
| 1689 | *@param pinfo pointer to packet information fields. |
| 1690 | *@param tree pointer to data tree Wireshark uses to display packet. |
| 1691 | *@param packet packet data. |
| 1692 | *@param offset current payload offset. |
| 1693 | *@return payload processed offset. |
| 1694 | */ |
| 1695 | static unsigned |
| 1696 | dissect_zbee_nwk_gp_cmd_read_attributes_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, |
| 1697 | zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset) |
| 1698 | { |
| 1699 | uint8_t cr_options; |
| 1700 | proto_tree *subtree = NULL((void*)0); |
| 1701 | proto_tree *att_tree = NULL((void*)0); |
| 1702 | uint16_t cluster_id; |
| 1703 | uint16_t attr_id; |
| 1704 | uint16_t mfr_code = ZBEE_MFG_CODE_NONE0x0000; |
| 1705 | uint8_t record_list_len; |
| 1706 | unsigned tvb_len; |
| 1707 | unsigned end_byte; |
| 1708 | |
| 1709 | static int * const options[] = { |
| 1710 | &hf_zbee_nwk_gp_cmd_read_att_opt_multi_rec, |
| 1711 | &hf_zbee_nwk_gp_cmd_read_att_opt_man_field_present, |
| 1712 | NULL((void*)0) |
| 1713 | }; |
| 1714 | |
| 1715 | /* Get Options Field, build subtree and display the results. */ |
| 1716 | cr_options = tvb_get_uint8(tvb, offset); |
| 1717 | proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_cmd_read_att_opt, ett_zbee_nwk_cmd_options, options, ENC_NA0x00000000); |
| 1718 | offset += 1; |
| 1719 | |
| 1720 | /* Parse and display manufacturer ID value. */ |
| 1721 | if (cr_options & ZBEE_NWK_GP_CMD_READ_ATTRIBUTE_OPT_MAN_FIELD_PRESENT0x02) { |
| 1722 | proto_tree_add_item_ret_uint16(tree, hf_zbee_zcl_gp_cmd_ms_manufacturer_code, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000, &mfr_code); |
| 1723 | offset += 2; |
| 1724 | } |
| 1725 | |
| 1726 | tvb_len = tvb_captured_length(tvb); |
| 1727 | while (offset < tvb_len) |
| 1728 | { |
| 1729 | /* Create subtree and parse attributes list. */ |
| 1730 | subtree = proto_tree_add_subtree_format(tree, tvb, offset,0, ett_zbee_nwk_clu_rec, NULL((void*)0), "Cluster record"); |
| 1731 | |
| 1732 | /* Get cluster ID and add it into the subtree. */ |
| 1733 | proto_tree_add_item_ret_uint16(subtree, hf_zbee_nwk_gp_zcl_attr_cluster_id, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000, &cluster_id); |
| 1734 | offset += 2; |
| 1735 | /* Get length of record list in bytes. */ |
| 1736 | record_list_len = tvb_get_uint8(tvb, offset); |
| 1737 | proto_tree_add_item(subtree, hf_zbee_nwk_gp_cmd_read_att_record_len, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000); |
| 1738 | offset += 1; |
| 1739 | |
| 1740 | end_byte = offset + record_list_len; |
| 1741 | while ( offset < end_byte) |
| 1742 | { |
| 1743 | /* Create subtree for attribute status field */ |
| 1744 | /* TODO ett_ could be an array to permit not to unroll all always */ |
| 1745 | att_tree = proto_tree_add_subtree_format(subtree, tvb, offset, 0, ett_zbee_nwk_att_rec, NULL((void*)0), "Read Attribute record"); |
| 1746 | |
| 1747 | /* Dissect the attribute identifier */ |
| 1748 | attr_id = tvb_get_letohs(tvb, offset); |
| 1749 | dissect_zcl_attr_id(tvb, att_tree, &offset, cluster_id, mfr_code, ZBEE_ZCL_FCF_TO_CLIENT0x01); |
| 1750 | |
| 1751 | /* Dissect the status and optionally the data type and value */ |
| 1752 | if (dissect_zcl_attr_uint8(tvb, att_tree, &offset, &hf_zbee_nwk_gp_zcl_attr_status) |
| 1753 | == ZBEE_ZCL_STAT_SUCCESS0x00) |
| 1754 | { |
| 1755 | /* Dissect the attribute data type and data */ |
| 1756 | dissect_zcl_attr_data_type_val(tvb, pinfo, att_tree, &offset, attr_id, cluster_id, mfr_code, ZBEE_ZCL_FCF_TO_CLIENT0x01); |
| 1757 | } |
| 1758 | else |
| 1759 | { |
| 1760 | /* Data type field is always present (not like in ZCL read attribute response command) */ |
| 1761 | dissect_zcl_attr_data(tvb, pinfo, att_tree, &offset, |
| 1762 | dissect_zcl_attr_uint8(tvb, att_tree, &offset, &hf_zbee_nwk_gp_zcl_attr_data_type), ZBEE_ZCL_FCF_TO_CLIENT0x01 ); |
| 1763 | } |
| 1764 | } |
| 1765 | } |
| 1766 | return offset; |
| 1767 | } /* dissect_zbee_nwk_gp_cmd_read_attributes_response */ |
| 1768 | |
| 1769 | /** |
| 1770 | * Dissector for ZigBee Green Power ZCL tunneling command. |
| 1771 | * |
| 1772 | *@param tvb pointer to buffer containing raw packet. |
| 1773 | *@param pinfo pointer to packet information fields. |
| 1774 | *@param tree pointer to data tree Wireshark uses to display packet. |
| 1775 | *@param packet packet data. |
| 1776 | *@param offset current payload offset. |
| 1777 | *@return payload processed offset. |
| 1778 | */ |
| 1779 | static unsigned |
| 1780 | dissect_zbee_nwk_gp_cmd_zcl_tunneling(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree, |
| 1781 | zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset) |
| 1782 | { |
| 1783 | uint8_t tun_options; |
| 1784 | |
| 1785 | static int * const options[] = { |
| 1786 | &hf_zbee_nwk_gp_cmd_zcl_tunnel_opt_frame_type, |
| 1787 | &hf_zbee_nwk_gp_cmd_zcl_tunnel_opt_man_field_present, |
| 1788 | &hf_zbee_nwk_gp_cmd_zcl_tunnel_opt_direction, |
| 1789 | NULL((void*)0) |
| 1790 | }; |
| 1791 | |
| 1792 | /* Get Options Field, build subtree and display the results. */ |
| 1793 | tun_options = tvb_get_uint8(tvb, offset); |
| 1794 | proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_cmd_zcl_tunnel_opt, ett_zbee_nwk_cmd_options, options, ENC_NA0x00000000); |
| 1795 | offset += 1; |
| 1796 | |
| 1797 | /* Parse and display manufacturer ID value. */ |
| 1798 | if (tun_options & ZBEE_NWK_GP_CMD_ZCL_TUNNEL_OPT_MAN_FIELD_PRESENT0x04) { |
| 1799 | proto_tree_add_item(tree, hf_zbee_zcl_gp_cmd_ms_manufacturer_code, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000); |
| 1800 | offset += 2; |
| 1801 | } |
| 1802 | |
| 1803 | proto_tree_add_item(tree, hf_zbee_nwk_gp_zcl_attr_cluster_id, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000); |
| 1804 | offset += 2; |
| 1805 | |
| 1806 | proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_zcl_tunnel_command_id, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000); |
| 1807 | offset += 1; |
| 1808 | |
| 1809 | proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_zcl_tunnel_payload_len, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000); |
| 1810 | offset += 1; |
| 1811 | |
| 1812 | /* We're not parsing the ZCL payload, as it's non-trivial and will require a lot of refactoring of the |
| 1813 | * ZCL data parsers to make work. For now, let it just show up as raw data. */ |
| 1814 | |
| 1815 | return offset; |
| 1816 | } /* dissect_zbee_nwk_gp_cmd_zcl_tunneling */ |
| 1817 | |
| 1818 | /** |
| 1819 | * Dissector for ZigBee Green Power Compact Attribute Reporting command. |
| 1820 | * |
| 1821 | *@param tvb pointer to buffer containing raw packet. |
| 1822 | *@param pinfo pointer to packet information fields. |
| 1823 | *@param tree pointer to data tree Wireshark uses to display packet. |
| 1824 | *@param packet packet data. |
| 1825 | *@param offset current payload offset. |
| 1826 | *@return payload processed offset. |
| 1827 | */ |
| 1828 | static unsigned |
| 1829 | dissect_zbee_nwk_gp_cmd_compact_attr_report(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree, |
| 1830 | zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset) |
| 1831 | { |
| 1832 | int len_remaining; |
| 1833 | |
| 1834 | /* Report Identifier */ |
| 1835 | proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_compact_attr_report_report_id, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000); |
| 1836 | offset++; |
| 1837 | |
| 1838 | /* Data points */ |
| 1839 | len_remaining = tvb_reported_length_remaining(tvb, offset); |
| 1840 | if (len_remaining > 0) { |
| 1841 | proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_compact_attr_report_data_points, |
| 1842 | tvb, offset, len_remaining, ENC_NA0x00000000); |
| 1843 | offset += len_remaining; |
| 1844 | } |
| 1845 | |
| 1846 | return offset; |
| 1847 | } /* dissect_zbee_nwk_gp_cmd_compact_attr_report */ |
| 1848 | |
| 1849 | /** |
| 1850 | *Dissector for ZigBee Green Power multi-cluster reporting command. |
| 1851 | * |
| 1852 | *@param tvb pointer to buffer containing raw packet. |
| 1853 | *@param pinfo pointer to packet information fields. |
| 1854 | *@param tree pointer to data tree Wireshark uses to display packet. |
| 1855 | *@param packet packet data. |
| 1856 | *@param offset current payload offset. |
| 1857 | *@param mfr_code manufacturer code. |
| 1858 | *@return payload processed offset. |
| 1859 | */ |
| 1860 | static unsigned |
| 1861 | dissect_zbee_nwk_gp_cmd_multi_cluster_reporting(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree, |
| 1862 | zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset, uint16_t mfr_code) |
| 1863 | { |
| 1864 | proto_tree *subtree = NULL((void*)0); |
| 1865 | uint16_t cluster_id; |
| 1866 | uint16_t attr_id; |
| 1867 | unsigned tvb_len; |
| 1868 | |
| 1869 | tvb_len = tvb_captured_length(tvb); |
| 1870 | while (offset < tvb_len) |
| 1871 | { |
| 1872 | /* Create subtree and parse attributes list. */ |
| 1873 | subtree = proto_tree_add_subtree_format(tree, tvb, offset, 0, ett_zbee_nwk_clu_rec, NULL((void*)0), "Cluster record"); //TODO for cluster %% blabla |
| 1874 | |
| 1875 | /* Get cluster ID and add it into the subtree. */ |
| 1876 | proto_tree_add_item_ret_uint16(subtree, hf_zbee_nwk_gp_zcl_attr_cluster_id, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000, &cluster_id); |
| 1877 | offset += 2; |
| 1878 | |
| 1879 | /* Dissect the attribute identifier */ |
| 1880 | attr_id = tvb_get_letohs(tvb, offset); |
| 1881 | dissect_zcl_attr_id(tvb, subtree, &offset, cluster_id, mfr_code, ZBEE_ZCL_FCF_TO_CLIENT0x01); |
| 1882 | |
| 1883 | /* Dissect the attribute data type and data */ |
| 1884 | dissect_zcl_attr_data_type_val(tvb, pinfo, subtree, &offset, attr_id, cluster_id, mfr_code, ZBEE_ZCL_FCF_TO_CLIENT0x01); |
| 1885 | // TODO how to dissect when data type is different from expected one for this attribute ? this shouldn't happen |
| 1886 | } |
| 1887 | return offset; |
| 1888 | } /* dissect_zbee_nwk_gp_cmd_multi_cluster_reporting */ |
| 1889 | |
| 1890 | |
| 1891 | /** |
| 1892 | *Dissector for ZigBee Green Power commands manufacturer specific attrib reporting. |
| 1893 | * |
| 1894 | *@param tvb pointer to buffer containing raw packet. |
| 1895 | *@param pinfo pointer to packet information fields. |
| 1896 | *@param tree pointer to data tree Wireshark uses to display packet. |
| 1897 | *@param packet packet data. |
| 1898 | *@param offset current payload offset. |
| 1899 | *@return payload processed offset. |
| 1900 | */ |
| 1901 | static unsigned |
| 1902 | dissect_zbee_nwk_gp_cmd_MS_multi_cluster_reporting(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree, |
| 1903 | zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset) |
| 1904 | { |
| 1905 | uint16_t mfr_code; |
| 1906 | |
| 1907 | /*dissect manufacturer ID*/ |
| 1908 | proto_tree_add_item_ret_uint16(tree, hf_zbee_zcl_gp_cmd_ms_manufacturer_code, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000, &mfr_code); |
| 1909 | offset += 2; |
| 1910 | |
| 1911 | offset = dissect_zbee_nwk_gp_cmd_multi_cluster_reporting(tvb, pinfo, tree, packet, offset, mfr_code); |
| 1912 | |
| 1913 | return offset; |
| 1914 | }/*dissect_zbee_nwk_gp_cmd_MS_multi_cluster_reporting*/ |
| 1915 | |
| 1916 | /** |
| 1917 | *Dissector for ZigBee Green Power Move Color. |
| 1918 | * |
| 1919 | *@param tvb pointer to buffer containing raw packet. |
| 1920 | *@param pinfo pointer to packet information fields. |
| 1921 | *@param tree pointer to data tree Wireshark uses to display packet. |
| 1922 | *@param packet packet data. |
| 1923 | *@param offset current payload offset. |
| 1924 | *@return payload processed offset. |
| 1925 | */ |
| 1926 | static unsigned |
| 1927 | dissect_zbee_nwk_gp_cmd_move_color(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree, |
| 1928 | zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset) |
| 1929 | { |
| 1930 | proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_move_color_ratex, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000); |
| 1931 | offset += 2; |
| 1932 | proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_move_color_ratey, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000); |
| 1933 | offset += 2; |
| 1934 | return offset; |
| 1935 | } /* dissect_zbee_nwk_gp_cmd_move_color */ |
| 1936 | |
| 1937 | /** |
| 1938 | *Dissector for ZigBee Green Power Move Up/Down. |
| 1939 | * |
| 1940 | *@param tvb pointer to buffer containing raw packet. |
| 1941 | *@param pinfo pointer to packet information fields. |
| 1942 | *@param tree pointer to data tree Wireshark uses to display packet. |
| 1943 | *@param packet packet data. |
| 1944 | *@param offset current payload offset. |
| 1945 | *@return payload processed offset. |
| 1946 | */ |
| 1947 | static unsigned |
| 1948 | dissect_zbee_nwk_gp_cmd_move_up_down(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree, |
| 1949 | zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset) |
| 1950 | { |
| 1951 | /* Optional rate field. */ |
| 1952 | if (tvb_reported_length(tvb) - offset >= 1) { |
| 1953 | proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_move_up_down_rate, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000); |
| 1954 | offset += 1; |
| 1955 | } |
| 1956 | return offset; |
| 1957 | } /* dissect_zbee_nwk_gp_cmd_move_up_down */ |
| 1958 | |
| 1959 | /** |
| 1960 | *Dissector for ZigBee Green Power Step Color. |
| 1961 | * |
| 1962 | *@param tvb pointer to buffer containing raw packet. |
| 1963 | *@param pinfo pointer to packet information fields. |
| 1964 | *@param tree pointer to data tree Wireshark uses to display packet. |
| 1965 | *@param packet packet data. |
| 1966 | *@param offset current payload offset. |
| 1967 | *@return payload processed offset. |
| 1968 | */ |
| 1969 | static unsigned |
| 1970 | dissect_zbee_nwk_gp_cmd_step_color(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree, |
| 1971 | zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset) |
| 1972 | { |
| 1973 | proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_step_color_stepx, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000); |
| 1974 | offset += 2; |
| 1975 | proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_step_color_stepy, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000); |
| 1976 | offset += 2; |
| 1977 | /* Optional time field. */ |
| 1978 | if (tvb_reported_length(tvb) - offset >= 2) { |
| 1979 | proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_step_color_transition_time, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000); |
| 1980 | offset += 2; |
| 1981 | } |
| 1982 | return offset; |
| 1983 | } /* dissect_zbee_nwk_gp_cmd_step_color */ |
| 1984 | |
| 1985 | /** |
| 1986 | *Dissector for ZigBee Green Power Step Up/Down. |
| 1987 | * |
| 1988 | *@param tvb pointer to buffer containing raw packet. |
| 1989 | *@param pinfo pointer to packet information fields. |
| 1990 | *@param tree pointer to data tree Wireshark uses to display packet. |
| 1991 | *@param packet packet data. |
| 1992 | *@param offset current payload offset. |
| 1993 | *@return payload processed offset. |
| 1994 | */ |
| 1995 | static unsigned |
| 1996 | dissect_zbee_nwk_gp_cmd_step_up_down(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree, |
| 1997 | zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset) |
| 1998 | { |
| 1999 | proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_step_up_down_step_size, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000); |
| 2000 | offset += 1; |
| 2001 | /* Optional time field. */ |
| 2002 | if (tvb_reported_length(tvb) - offset >= 2) { |
| 2003 | proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_step_up_down_transition_time, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000); |
| 2004 | offset += 2; |
| 2005 | } |
| 2006 | return offset; |
| 2007 | } /* dissect_zbee_nwk_gp_cmd_step_up_down */ |
| 2008 | |
| 2009 | /** |
| 2010 | *Dissector for ZigBee Green Power commands. |
| 2011 | * |
| 2012 | *@param tvb pointer to buffer containing raw packet. |
| 2013 | *@param pinfo pointer to packet information fields. |
| 2014 | *@param tree pointer to data tree Wireshark uses to display packet. |
| 2015 | *@param data raw packet private data. |
| 2016 | *@return payload processed offset |
| 2017 | */ |
| 2018 | static int |
| 2019 | dissect_zbee_nwk_gp_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) |
| 2020 | { |
| 2021 | unsigned offset = 0; |
| 2022 | uint8_t cmd_id = tvb_get_uint8(tvb, offset); |
| 2023 | proto_item *cmd_root; |
| 2024 | proto_tree *cmd_tree; |
| 2025 | zbee_nwk_green_power_packet *packet = (zbee_nwk_green_power_packet *)data; |
| 2026 | |
| 2027 | /* Create a subtree for the command. */ |
| 2028 | cmd_tree = proto_tree_add_subtree_format(tree, tvb, offset, -1, ett_zbee_nwk_cmd, &cmd_root, |
| 2029 | "Command Frame: %s", val_to_str_ext_const(cmd_id, |
| 2030 | &zbee_nwk_gp_cmd_names_ext, |
| 2031 | "Unknown Command Frame")); |
| 2032 | /* Add the command ID. */ |
| 2033 | proto_tree_add_uint(cmd_tree, hf_zbee_nwk_gp_command_id, tvb, offset, 1, cmd_id); |
| 2034 | |
| 2035 | offset += 1; |
| 2036 | /* Add the command name to the info column. */ |
| 2037 | col_set_str(pinfo->cinfo, COL_INFO, val_to_str_ext_const(cmd_id, &zbee_nwk_gp_cmd_names_ext, "Unknown command")); |
| 2038 | /* Handle the command for one of the following devices: |
| 2039 | * - Door Lock Controller (IDs: 0x50 - 0x51); |
| 2040 | * - GP Flow Sensor (IDs: 0xE0, 0xA0 - 0xA3); |
| 2041 | * - GP Temperature Sensor (IDs: 0xE0, 0xA0 - 0xA3); */ |
| 2042 | switch(cmd_id) { |
| 2043 | /* Payloadless GPDF commands sent by GPD. */ |
| 2044 | case ZB_GP_CMD_ID_IDENTIFY: |
| 2045 | case ZB_GP_CMD_ID_RECALL_SCENE0: |
| 2046 | case ZB_GP_CMD_ID_RECALL_SCENE1: |
| 2047 | case ZB_GP_CMD_ID_RECALL_SCENE2: |
| 2048 | case ZB_GP_CMD_ID_RECALL_SCENE3: |
| 2049 | case ZB_GP_CMD_ID_RECALL_SCENE4: |
| 2050 | case ZB_GP_CMD_ID_RECALL_SCENE5: |
| 2051 | case ZB_GP_CMD_ID_RECALL_SCENE6: |
| 2052 | case ZB_GP_CMD_ID_RECALL_SCENE7: |
| 2053 | case ZB_GP_CMD_ID_STORE_SCENE0: |
| 2054 | case ZB_GP_CMD_ID_STORE_SCENE1: |
| 2055 | case ZB_GP_CMD_ID_STORE_SCENE2: |
| 2056 | case ZB_GP_CMD_ID_STORE_SCENE3: |
| 2057 | case ZB_GP_CMD_ID_STORE_SCENE4: |
| 2058 | case ZB_GP_CMD_ID_STORE_SCENE5: |
| 2059 | case ZB_GP_CMD_ID_STORE_SCENE6: |
| 2060 | case ZB_GP_CMD_ID_STORE_SCENE7: |
| 2061 | case ZB_GP_CMD_ID_OFF: |
| 2062 | case ZB_GP_CMD_ID_ON: |
| 2063 | case ZB_GP_CMD_ID_TOGGLE: |
| 2064 | case ZB_GP_CMD_ID_RELEASE: |
| 2065 | case ZB_GP_CMD_ID_LEVEL_CONTROL_STOP: |
| 2066 | case ZB_GP_CMD_ID_MOVE_HUE_STOP: |
| 2067 | case ZB_GP_CMD_ID_MOVE_SATURATION_STOP: |
| 2068 | case ZB_GP_CMD_ID_LOCK_DOOR: |
| 2069 | case ZB_GP_CMD_ID_UNLOCK_DOOR: |
| 2070 | case ZB_GP_CMD_ID_PRESS11: |
| 2071 | case ZB_GP_CMD_ID_RELEASE11: |
| 2072 | case ZB_GP_CMD_ID_PRESS12: |
| 2073 | case ZB_GP_CMD_ID_RELEASE12: |
| 2074 | case ZB_GP_CMD_ID_PRESS22: |
| 2075 | case ZB_GP_CMD_ID_RELEASE22: |
| 2076 | case ZB_GP_CMD_ID_SHORT_PRESS11: |
| 2077 | case ZB_GP_CMD_ID_SHORT_PRESS12: |
| 2078 | case ZB_GP_CMD_ID_SHORT_PRESS22: |
| 2079 | case ZB_GP_CMD_ID_DECOMMISSIONING: |
| 2080 | case ZB_GP_CMD_ID_SUCCESS: |
| 2081 | break; |
| 2082 | /* GPDF commands with payload sent by GPD. */ |
| 2083 | case ZB_GP_CMD_ID_MOVE_UP: |
| 2084 | case ZB_GP_CMD_ID_MOVE_DOWN: |
| 2085 | case ZB_GP_CMD_ID_MOVE_UP_WITH_ON_OFF: |
| 2086 | case ZB_GP_CMD_ID_MOVE_DOWN_WITH_ON_OFF: |
| 2087 | case ZB_GP_CMD_ID_MOVE_HUE_UP: |
| 2088 | case ZB_GP_CMD_ID_MOVE_HUE_DOWN: |
| 2089 | case ZB_GP_CMD_ID_MOVE_SATURATION_UP: |
| 2090 | case ZB_GP_CMD_ID_MOVE_SATURATION_DOWN: |
| 2091 | offset = dissect_zbee_nwk_gp_cmd_move_up_down(tvb, pinfo, cmd_tree, packet, offset); |
| 2092 | break; |
| 2093 | case ZB_GP_CMD_ID_STEP_UP: |
| 2094 | case ZB_GP_CMD_ID_STEP_DOWN: |
| 2095 | case ZB_GP_CMD_ID_STEP_UP_WITH_ON_OFF: |
| 2096 | case ZB_GP_CMD_ID_STEP_DOWN_WITH_ON_OFF: |
| 2097 | case ZB_GP_CMD_ID_STEP_HUE_UP: |
| 2098 | case ZB_GP_CMD_ID_STEP_HUW_DOWN: |
| 2099 | case ZB_GP_CMD_ID_STEP_SATURATION_UP: |
| 2100 | case ZB_GP_CMD_ID_STEP_SATURATION_DOWN: |
| 2101 | offset = dissect_zbee_nwk_gp_cmd_step_up_down(tvb, pinfo, cmd_tree, packet, offset); |
| 2102 | break; |
| 2103 | case ZB_GP_CMD_ID_MOVE_COLOR: |
| 2104 | offset = dissect_zbee_nwk_gp_cmd_move_color(tvb, pinfo, cmd_tree, packet, offset); |
| 2105 | break; |
| 2106 | case ZB_GP_CMD_ID_STEP_COLOR: |
| 2107 | offset = dissect_zbee_nwk_gp_cmd_step_color(tvb, pinfo, cmd_tree, packet, offset); |
| 2108 | break; |
| 2109 | case ZB_GP_CMD_ID_ATTRIBUTE_REPORTING: |
| 2110 | offset = dissect_zbee_nwk_gp_cmd_attr_reporting(tvb, pinfo, cmd_tree, packet, offset, ZBEE_MFG_CODE_NONE0x0000); |
| 2111 | break; |
| 2112 | case ZB_GP_CMD_ID_MANUFACTURE_SPECIFIC_ATTR_REPORTING: |
| 2113 | offset = dissect_zbee_nwk_gp_cmd_MS_attr_reporting(tvb, pinfo, cmd_tree, packet, offset); |
| 2114 | break; |
| 2115 | case ZB_GP_CMD_ID_MULTI_CLUSTER_REPORTING: |
| 2116 | offset = dissect_zbee_nwk_gp_cmd_multi_cluster_reporting(tvb, pinfo, cmd_tree, packet, offset, ZBEE_MFG_CODE_NONE0x0000); |
| 2117 | break; |
| 2118 | case ZB_GP_CMD_ID_MANUFACTURER_SPECIFIC_MCLUSTER_REPORTING: |
| 2119 | offset = dissect_zbee_nwk_gp_cmd_MS_multi_cluster_reporting(tvb, pinfo, cmd_tree, packet, offset); |
| 2120 | break; |
| 2121 | case ZB_GP_CMD_ID_READ_ATTRIBUTES_RESPONSE: |
| 2122 | offset = dissect_zbee_nwk_gp_cmd_read_attributes_response(tvb, pinfo, cmd_tree, packet, offset); |
| 2123 | break; |
| 2124 | case ZB_GP_CMD_ID_ZCL_TUNNELING: |
| 2125 | offset = dissect_zbee_nwk_gp_cmd_zcl_tunneling(tvb, pinfo, cmd_tree, packet, offset); |
| 2126 | break; |
| 2127 | case ZB_GP_CMD_ID_COMPACT_ATTR_REPORT: |
| 2128 | offset = dissect_zbee_nwk_gp_cmd_compact_attr_report(tvb, pinfo, cmd_tree, packet, offset); |
| 2129 | break; |
| 2130 | case ZB_GP_CMD_ID_ANY_SENSOR_COMMAND_A0_A3: |
| 2131 | /* TODO: implement it. */ |
| 2132 | break; |
| 2133 | case ZB_GP_CMD_ID_COMMISSIONING: |
| 2134 | offset = dissect_zbee_nwk_gp_cmd_commissioning(tvb, pinfo, cmd_tree, packet, offset); |
| 2135 | break; |
| 2136 | case ZB_GP_CMD_ID_CHANNEL_REQUEST: |
| 2137 | offset = dissect_zbee_nwk_gp_cmd_channel_request(tvb, pinfo, cmd_tree, packet, offset); |
| 2138 | break; |
| 2139 | case ZB_GP_CMD_ID_APPLICATION_DESC: |
| 2140 | offset = dissect_zbee_nwk_gp_cmd_application_desc(tvb, pinfo, cmd_tree, packet, offset); |
| 2141 | break; |
| 2142 | case ZB_GP_CMD_ID_REQUEST_ATTRIBUTES: |
| 2143 | /* GPDF commands sent to GPD. */ |
| 2144 | case ZB_GP_CMD_ID_READ_ATTRIBUTES: |
| 2145 | offset = dissect_zbee_nwk_gp_cmd_read_attributes(tvb, pinfo, cmd_tree, packet, offset); |
| 2146 | break; |
| 2147 | case ZB_GP_CMD_ID_COMMISSIONING_REPLY: |
| 2148 | offset = dissect_zbee_nwk_gp_cmd_commissioning_reply(tvb, pinfo, cmd_tree, packet, offset); |
| 2149 | break; |
| 2150 | case ZB_GP_CMD_ID_WRITE_ATTRIBUTES: |
| 2151 | offset = dissect_zbee_nwk_gp_cmd_write_attributes(tvb, pinfo, cmd_tree, packet, offset); |
| 2152 | break; |
| 2153 | case ZB_GP_CMD_ID_CHANNEL_CONFIGURATION: |
| 2154 | offset = dissect_zbee_nwk_gp_cmd_channel_configuration(tvb, pinfo, cmd_tree, packet, offset); |
| 2155 | break; |
| 2156 | } |
| 2157 | if (offset < tvb_reported_length(tvb)) { |
| 2158 | /* There are leftover bytes! */ |
| 2159 | proto_tree *root; |
| 2160 | tvbuff_t *leftover_tvb = tvb_new_subset_remaining(tvb, offset); |
| 2161 | |
| 2162 | /* Correct the length of the command tree. */ |
| 2163 | root = proto_tree_get_root(tree); |
| 2164 | proto_item_set_len(cmd_root, offset); |
| 2165 | |
| 2166 | /* Dump the tail. */ |
| 2167 | call_data_dissector(leftover_tvb, pinfo, root); |
| 2168 | } |
| 2169 | return offset; |
| 2170 | } /* dissect_zbee_nwk_gp_cmd */ |
| 2171 | |
| 2172 | /** |
| 2173 | *ZigBee NWK packet dissection routine for Green Power profile. |
| 2174 | * |
| 2175 | *@param tvb pointer to buffer containing raw packet. |
| 2176 | *@param pinfo pointer to packet information fields. |
| 2177 | *@param tree pointer to data tree Wireshark uses to display packet. |
| 2178 | *@param data raw packet private data. |
| 2179 | */ |
| 2180 | static int |
| 2181 | dissect_zbee_nwk_gp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) |
| 2182 | { |
| 2183 | ieee802154_packet *ieee_packet = (ieee802154_packet *)data; |
| 2184 | bool_Bool gp_decrypted; |
| 2185 | GSList *GSList_i; |
| 2186 | unsigned offset = 0; |
| 2187 | uint8_t *dec_buffer; |
| 2188 | uint8_t *enc_buffer; |
| 2189 | uint8_t fcf; |
| 2190 | proto_tree *nwk_tree; |
| 2191 | proto_item *proto_root; |
| 2192 | proto_item *ti = NULL((void*)0); |
| 2193 | tvbuff_t *payload_tvb; |
| 2194 | zbee_nwk_green_power_packet packet; |
| 2195 | static int * const fields[] = { |
| 2196 | &hf_zbee_nwk_gp_frame_type, |
| 2197 | &hf_zbee_nwk_gp_proto_version, |
| 2198 | &hf_zbee_nwk_gp_auto_commissioning, |
| 2199 | &hf_zbee_nwk_gp_fc_ext, |
| 2200 | NULL((void*)0) |
| 2201 | }; |
| 2202 | static int * const ext_fields[] = { |
| 2203 | &hf_zbee_nwk_gp_fc_ext_app_id, |
| 2204 | &hf_zbee_nwk_gp_fc_ext_sec_level, |
| 2205 | &hf_zbee_nwk_gp_fc_ext_sec_key, |
| 2206 | &hf_zbee_nwk_gp_fc_ext_rx_after_tx, |
| 2207 | &hf_zbee_nwk_gp_fc_ext_direction, |
| 2208 | NULL((void*)0) |
| 2209 | }; |
| 2210 | |
| 2211 | if (data == NULL((void*)0)) |
| 2212 | return 0; |
| 2213 | |
| 2214 | memset(&packet, 0, sizeof(packet)); |
| 2215 | packet.ieee_packet_src64 = ieee_packet->src64; |
| 2216 | /* Add ourself to the protocol column, clear the info column and create the protocol tree. */ |
| 2217 | col_set_str(pinfo->cinfo, COL_PROTOCOL, "ZigBee Green Power"); |
| 2218 | col_clear(pinfo->cinfo, COL_INFO); |
| 2219 | |
| 2220 | proto_root = proto_tree_add_protocol_format(tree, proto_zbee_nwk_gp, tvb, offset, tvb_captured_length(tvb), |
| 2221 | "ZGP stub NWK header"); |
| 2222 | nwk_tree = proto_item_add_subtree(proto_root, ett_zbee_nwk); |
| 2223 | |
| 2224 | enc_buffer = (uint8_t *)tvb_memdup(pinfo->pool, tvb, 0, tvb_captured_length(tvb)); |
| 2225 | /* Get and parse the FCF. */ |
| 2226 | fcf = tvb_get_uint8(tvb, offset); |
| 2227 | packet.frame_type = zbee_get_bit_field(fcf, ZBEE_NWK_GP_FCF_FRAME_TYPE0x03); |
| 2228 | packet.nwk_frame_control_extension = zbee_get_bit_field(fcf, ZBEE_NWK_GP_FCF_CONTROL_EXTENSION0x80); |
| 2229 | |
| 2230 | /* Display the FCF. */ |
| 2231 | ti = proto_tree_add_bitmask(nwk_tree, tvb, offset, hf_zbee_nwk_gp_fcf, ett_zbee_nwk_fcf, fields, ENC_NA0x00000000); |
| 2232 | proto_item_append_text(ti, " %s", val_to_str_const(packet.frame_type, zbee_nwk_gp_frame_types, "Unknown Frame Type")); |
| 2233 | offset += 1; |
| 2234 | |
| 2235 | /* Add the frame type to the info column and protocol root. */ |
| 2236 | proto_item_append_text(proto_root, " %s", val_to_str_const(packet.frame_type, zbee_nwk_gp_frame_types, "Unknown type")); |
| 2237 | col_set_str(pinfo->cinfo, COL_INFO, val_to_str_const(packet.frame_type, zbee_nwk_gp_frame_types, "Reserved frame type")); |
| 2238 | |
| 2239 | if (packet.nwk_frame_control_extension) { |
| 2240 | /* Display ext FCF. */ |
| 2241 | fcf = tvb_get_uint8(tvb, offset); |
| 2242 | packet.application_id = zbee_get_bit_field(fcf, ZBEE_NWK_GP_FCF_EXT_APP_ID0x07); |
| 2243 | packet.security_level = zbee_get_bit_field(fcf, ZBEE_NWK_GP_FCF_EXT_SECURITY_LEVEL0x18); |
| 2244 | packet.direction = zbee_get_bit_field(fcf, ZBEE_NWK_GP_FCF_EXT_DIRECTION0x80); |
| 2245 | |
| 2246 | /* Create a subtree for the extended FCF. */ |
| 2247 | proto_tree_add_bitmask(nwk_tree, tvb, offset, hf_zbee_nwk_gp_fc_ext_field, ett_zbee_nwk_fcf_ext, ext_fields, ENC_NA0x00000000); |
| 2248 | offset += 1; |
| 2249 | } |
| 2250 | if ((packet.frame_type == ZBEE_NWK_GP_FCF_DATA0x00 && !packet.nwk_frame_control_extension) || (packet.frame_type == |
| 2251 | ZBEE_NWK_GP_FCF_DATA0x00 && packet.nwk_frame_control_extension && packet.application_id == |
| 2252 | ZBEE_NWK_GP_APP_ID_DEFAULT0x00) || (packet.frame_type == ZBEE_NWK_GP_FCF_MAINTENANCE0x01 && |
| 2253 | packet.nwk_frame_control_extension && packet.application_id == ZBEE_NWK_GP_APP_ID_DEFAULT0x00 && tvb_get_uint8(tvb, |
| 2254 | offset) != ZB_GP_CMD_ID_CHANNEL_CONFIGURATION)) { |
| 2255 | /* Display GPD Src ID. */ |
| 2256 | packet.source_id = tvb_get_letohl(tvb, offset); |
| 2257 | proto_tree_add_item(nwk_tree, hf_zbee_nwk_gp_zgpd_src_id, tvb, offset, 4, ENC_LITTLE_ENDIAN0x80000000); |
| 2258 | proto_item_append_text(proto_root, ", GPD Src ID: 0x%08x", packet.source_id); |
| 2259 | |
| 2260 | col_append_fstr(pinfo->cinfo, COL_INFO, ", GPD Src ID: 0x%08x", packet.source_id); |
| 2261 | |
| 2262 | col_clear(pinfo->cinfo, COL_DEF_SRC); |
| 2263 | col_append_fstr(pinfo->cinfo, COL_DEF_SRC, "0x%08x", packet.source_id); |
| 2264 | |
| 2265 | offset += 4; |
| 2266 | } |
| 2267 | if (packet.application_id == ZBEE_NWK_GP_APP_ID_ZGP0x02) { |
| 2268 | /* Display GPD endpoint */ |
| 2269 | packet.endpoint = tvb_get_uint8(tvb, offset); |
| 2270 | proto_tree_add_item(nwk_tree, hf_zbee_nwk_gp_zgpd_endpoint, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000); |
| 2271 | proto_item_append_text(proto_root, ", Endpoint: %d", packet.endpoint); |
| 2272 | |
| 2273 | col_append_fstr(pinfo->cinfo, COL_INFO, ", Endpoint: %d", packet.endpoint); |
| 2274 | offset += 1; |
| 2275 | } |
| 2276 | /* Display Security Frame Counter. */ |
| 2277 | packet.mic_size = 0; |
| 2278 | if (packet.nwk_frame_control_extension) { |
| 2279 | if (packet.application_id == ZBEE_NWK_GP_APP_ID_DEFAULT0x00 || packet.application_id == ZBEE_NWK_GP_APP_ID_ZGP0x02 |
| 2280 | || packet.application_id == ZBEE_NWK_GP_APP_ID_LPED0x01) { |
| 2281 | if (packet.security_level == ZBEE_NWK_GP_SECURITY_LEVEL_1LSB0x01 |
| 2282 | && packet.application_id != ZBEE_NWK_GP_APP_ID_LPED0x01) { |
| 2283 | packet.mic_size = 2; |
| 2284 | } else if (packet.security_level == ZBEE_NWK_GP_SECURITY_LEVEL_FULL0x02 || packet.security_level == |
| 2285 | ZBEE_NWK_GP_SECURITY_LEVEL_FULLENCR0x03) { |
| 2286 | /* Get Security Frame Counter and display it. */ |
| 2287 | packet.mic_size = 4; |
| 2288 | packet.security_frame_counter = tvb_get_letohl(tvb, offset); |
| 2289 | proto_tree_add_item(nwk_tree, hf_zbee_nwk_gp_security_frame_counter, tvb, offset, 4, |
| 2290 | ENC_LITTLE_ENDIAN0x80000000); |
| 2291 | offset += 4; |
| 2292 | } |
| 2293 | } |
| 2294 | } |
| 2295 | /* Parse application payload. */ |
| 2296 | /* This is a uint8_t, but tvb_reported_length might be larger; e.g., |
| 2297 | * SCOP over TCP, presumably with errors. It's bogus either way; perhaps |
| 2298 | * we should warn. |
| 2299 | */ |
| 2300 | packet.payload_len = tvb_reported_length(tvb) - offset - packet.mic_size; |
| 2301 | /* Ensure that the payload exists. */ |
| 2302 | if (packet.payload_len <= 0) { |
| 2303 | proto_tree_add_expert_remaining(nwk_tree, pinfo, &ei_zbee_nwk_gp_no_payload, tvb, 0); |
| 2304 | return offset; |
| 2305 | } |
| 2306 | /* OK, payload exists. Parse MIC field if needed. */ |
| 2307 | if (packet.mic_size == 2) { |
| 2308 | packet.mic = tvb_get_letohs(tvb, offset + packet.payload_len); |
| 2309 | } else if (packet.mic_size == 4) { |
| 2310 | packet.mic = tvb_get_letohl(tvb, offset + packet.payload_len); |
| 2311 | } |
| 2312 | /* Save packet private data. */ |
| 2313 | data = (void *)&packet; |
| 2314 | payload_tvb = tvb_new_subset_length(tvb, offset, packet.payload_len); |
| 2315 | if (packet.security_level != ZBEE_NWK_GP_SECURITY_LEVEL_FULLENCR0x03) { |
| 2316 | dissect_zbee_nwk_gp_cmd(payload_tvb, pinfo, nwk_tree, data); |
| 2317 | } |
| 2318 | offset += packet.payload_len; |
| 2319 | /* Display MIC field. */ |
| 2320 | if (packet.mic_size) { |
| 2321 | proto_tree_add_uint(nwk_tree, packet.mic_size == 4 ? hf_zbee_nwk_gp_security_mic_4b : |
| 2322 | hf_zbee_nwk_gp_security_mic_2b, tvb, offset, packet.mic_size, packet.mic); |
| 2323 | offset += packet.mic_size; |
| 2324 | } |
| 2325 | if ((offset < tvb_captured_length(tvb)) && (packet.security_level != ZBEE_NWK_GP_SECURITY_LEVEL_FULLENCR0x03)) { |
| 2326 | proto_tree_add_expert_remaining(nwk_tree, pinfo, &ei_zbee_nwk_gp_inval_residual_data, tvb, offset); |
| 2327 | return offset; |
| 2328 | } |
| 2329 | if (packet.security_level == ZBEE_NWK_GP_SECURITY_LEVEL_FULLENCR0x03) { |
| 2330 | gp_decrypted = false0; |
| 2331 | |
| 2332 | if (tvb_captured_length(tvb) >= tvb_reported_length(tvb)) { |
| 2333 | dec_buffer = (uint8_t *)wmem_alloc(pinfo->pool, packet.payload_len); |
| 2334 | for (GSList_i = zbee_gp_keyring; GSList_i && !gp_decrypted; GSList_i = g_slist_next(GSList_i)((GSList_i) ? (((GSList *)(GSList_i))->next) : ((void*)0))) { |
| 2335 | gp_decrypted = zbee_gp_decrypt_payload(&packet, enc_buffer, offset - packet.payload_len - |
| 2336 | packet.mic_size, dec_buffer, packet.payload_len, packet.mic_size, |
| 2337 | ((key_record_t *)(GSList_i->data))->key); |
| 2338 | } |
| 2339 | } |
| 2340 | |
| 2341 | if (gp_decrypted) { |
| 2342 | payload_tvb = tvb_new_child_real_data(tvb, dec_buffer, packet.payload_len, packet.payload_len); |
| 2343 | add_new_data_source(pinfo, payload_tvb, "Decrypted GP Payload"); |
| 2344 | dissect_zbee_nwk_gp_cmd(payload_tvb, pinfo, nwk_tree, data); |
| 2345 | } else { |
| 2346 | payload_tvb = tvb_new_subset_length(tvb, offset - packet.payload_len - packet.mic_size, packet.payload_len); |
| 2347 | call_data_dissector(payload_tvb, pinfo, tree); |
| 2348 | } |
| 2349 | } |
| 2350 | return tvb_captured_length(tvb); |
| 2351 | } /* dissect_zbee_nwk_gp */ |
| 2352 | |
| 2353 | /** |
| 2354 | *Heuristic interpreter for the ZigBee Green Power dissectors. |
| 2355 | * |
| 2356 | *@param tvb pointer to buffer containing raw packet. |
| 2357 | *@param pinfo pointer to packet information fields. |
| 2358 | *@param tree pointer to data tree Wireshark uses to display packet. |
| 2359 | *@param data raw packet private data. |
| 2360 | */ |
| 2361 | static bool_Bool |
| 2362 | dissect_zbee_nwk_heur_gp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) |
| 2363 | { |
| 2364 | ieee802154_packet *packet = (ieee802154_packet *)data; |
| 2365 | uint8_t fcf; |
| 2366 | |
| 2367 | /* We must have the IEEE 802.15.4 headers. */ |
| 2368 | if (packet == NULL((void*)0)) return false0; |
| 2369 | |
| 2370 | /* If the frame type and version are not sane, then it's probably not ZGP. */ |
| 2371 | fcf = tvb_get_uint8(tvb, 0); |
| 2372 | if (zbee_get_bit_field(fcf, ZBEE_NWK_GP_FCF_VERSION0x3C) != ZBEE_VERSION_GREEN_POWER3) return false0; |
| 2373 | if (!try_val_to_str(zbee_get_bit_field(fcf, ZBEE_NWK_FCF_FRAME_TYPE0x0003), zbee_nwk_gp_frame_types)) return false0; |
| 2374 | |
| 2375 | /* ZigBee greenpower frames are either sent to broadcast or the extended address. */ |
| 2376 | if (packet->dst_addr_mode == IEEE802154_FCF_ADDR_SHORT0x2 && packet->dst16 == IEEE802154_BCAST_ADDR0xFFFF) { |
| 2377 | dissect_zbee_nwk_gp(tvb, pinfo, tree, data); |
| 2378 | return true1; |
| 2379 | } |
| 2380 | /* 64-bit destination addressing mode support. */ |
| 2381 | if (packet->dst_addr_mode == IEEE802154_FCF_ADDR_EXT0x3) { |
| 2382 | dissect_zbee_nwk_gp(tvb, pinfo, tree, data); |
| 2383 | return true1; |
| 2384 | } |
| 2385 | |
| 2386 | return false0; |
| 2387 | } /* dissect_zbee_nwk_heur_gp */ |
| 2388 | |
| 2389 | /** |
| 2390 | *Init routine for the ZigBee GP profile security. |
| 2391 | * |
| 2392 | */ |
| 2393 | static void |
| 2394 | gp_init_zbee_security(void) |
| 2395 | { |
| 2396 | unsigned i; |
| 2397 | key_record_t key_record; |
| 2398 | |
| 2399 | for (i = 0; gp_uat_key_records && (i < num_uat_key_records); i++) { |
| 2400 | key_record.frame_num = 0; |
| 2401 | key_record.label = g_strdup(gp_uat_key_records[i].label)g_strdup_inline (gp_uat_key_records[i].label); |
| 2402 | memcpy(key_record.key, gp_uat_key_records[i].key, ZBEE_SEC_CONST_KEYSIZE16); |
| 2403 | zbee_gp_keyring = g_slist_prepend(zbee_gp_keyring, g_memdup2(&key_record, sizeof(key_record_t))); |
| 2404 | } |
| 2405 | } |
| 2406 | |
| 2407 | static void zbee_free_key_record(void *ptr) |
| 2408 | { |
| 2409 | key_record_t *k; |
| 2410 | |
| 2411 | k = (key_record_t *)ptr; |
| 2412 | if (!k) |
| 2413 | return; |
| 2414 | |
| 2415 | g_free(k->label)(__builtin_object_size ((k->label), 0) != ((size_t) - 1)) ? g_free_sized (k->label, __builtin_object_size ((k->label ), 0)) : (g_free) (k->label); |
| 2416 | g_free(k)(__builtin_object_size ((k), 0) != ((size_t) - 1)) ? g_free_sized (k, __builtin_object_size ((k), 0)) : (g_free) (k); |
| 2417 | } |
| 2418 | |
| 2419 | static void |
| 2420 | gp_cleanup_zbee_security(void) |
| 2421 | { |
| 2422 | if (!zbee_gp_keyring) |
| 2423 | return; |
| 2424 | |
| 2425 | g_slist_free_full(zbee_gp_keyring, zbee_free_key_record); |
| 2426 | zbee_gp_keyring = NULL((void*)0); |
| 2427 | } |
| 2428 | |
| 2429 | /** |
| 2430 | *ZigBee NWK GP protocol registration routine. |
| 2431 | * |
| 2432 | */ |
| 2433 | void |
| 2434 | proto_register_zbee_nwk_gp(void) |
| 2435 | { |
| 2436 | module_t *gp_zbee_prefs; |
| 2437 | expert_module_t* expert_zbee_nwk_gp; |
| 2438 | |
| 2439 | static hf_register_info hf[] = { |
| 2440 | { &hf_zbee_nwk_gp_auto_commissioning, |
| 2441 | { "Auto Commissioning", "zbee_nwk_gp.auto_commissioning", FT_BOOLEAN, 8, NULL((void*)0), |
| 2442 | ZBEE_NWK_GP_FCF_AUTO_COMMISSIONING0x40, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2443 | |
| 2444 | { &hf_zbee_nwk_gp_fc_ext, |
| 2445 | { "NWK Frame Extension", "zbee_nwk_gp.fc_extension", FT_BOOLEAN, 8, NULL((void*)0), ZBEE_NWK_GP_FCF_CONTROL_EXTENSION0x80, |
| 2446 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2447 | |
| 2448 | { &hf_zbee_nwk_gp_fcf, |
| 2449 | { "Frame Control Field", "zbee_nwk_gp.fcf", FT_UINT8, BASE_HEX, NULL((void*)0), |
| 2450 | 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2451 | |
| 2452 | { &hf_zbee_nwk_gp_frame_type, |
| 2453 | { "Frame Type", "zbee_nwk_gp.frame_type", FT_UINT8, BASE_HEX, VALS(zbee_nwk_gp_frame_types)((0 ? (const struct _value_string*)0 : ((zbee_nwk_gp_frame_types )))), |
| 2454 | ZBEE_NWK_GP_FCF_FRAME_TYPE0x03, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2455 | |
| 2456 | { &hf_zbee_nwk_gp_proto_version, |
| 2457 | { "Protocol Version", "zbee_nwk_gp.proto_version", FT_UINT8, BASE_DEC, NULL((void*)0), ZBEE_NWK_GP_FCF_VERSION0x3C, NULL((void*)0), |
| 2458 | HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2459 | |
| 2460 | { &hf_zbee_nwk_gp_fc_ext_field, |
| 2461 | { "Extended NWK Frame Control Field", "zbee_nwk_gp.fc_ext", FT_UINT8, BASE_HEX, NULL((void*)0), |
| 2462 | 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2463 | |
| 2464 | { &hf_zbee_nwk_gp_fc_ext_app_id, |
| 2465 | { "Application ID", "zbee_nwk_gp.fc_ext_app_id", FT_UINT8, BASE_HEX, VALS(zbee_nwk_gp_app_id_names)((0 ? (const struct _value_string*)0 : ((zbee_nwk_gp_app_id_names )))), |
| 2466 | ZBEE_NWK_GP_FCF_EXT_APP_ID0x07, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2467 | |
| 2468 | { &hf_zbee_nwk_gp_fc_ext_direction, |
| 2469 | { "Direction", "zbee_nwk_gp.fc_ext_direction", FT_UINT8, BASE_HEX, VALS(zbee_nwk_gp_directions)((0 ? (const struct _value_string*)0 : ((zbee_nwk_gp_directions )))), |
| 2470 | ZBEE_NWK_GP_FCF_EXT_DIRECTION0x80, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2471 | |
| 2472 | { &hf_zbee_nwk_gp_fc_ext_rx_after_tx, |
| 2473 | { "Rx After Tx", "zbee_nwk_gp.fc_ext_rxaftertx", FT_BOOLEAN, 8, NULL((void*)0), ZBEE_NWK_GP_FCF_EXT_RX_AFTER_TX0x40, NULL((void*)0), |
| 2474 | HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2475 | |
| 2476 | { &hf_zbee_nwk_gp_fc_ext_sec_key, |
| 2477 | { "Security Key", "zbee_nwk_gp.fc_ext_security_key", FT_BOOLEAN, 8, NULL((void*)0), ZBEE_NWK_GP_FCF_EXT_SECURITY_KEY0x20, |
| 2478 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2479 | |
| 2480 | { &hf_zbee_nwk_gp_fc_ext_sec_level, |
| 2481 | { "Security Level", "zbee_nwk_gp.fc_ext_security_level", FT_UINT8, BASE_HEX, |
| 2482 | VALS(zbee_nwk_gp_src_sec_levels_names)((0 ? (const struct _value_string*)0 : ((zbee_nwk_gp_src_sec_levels_names )))), ZBEE_NWK_GP_FCF_EXT_SECURITY_LEVEL0x18, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2483 | |
| 2484 | { &hf_zbee_nwk_gp_zgpd_src_id, |
| 2485 | { "Src ID", "zbee_nwk_gp.source_id", FT_UINT32, BASE_HEX, VALS(zbee_nwk_gp_src_id_names)((0 ? (const struct _value_string*)0 : ((zbee_nwk_gp_src_id_names )))), 0x0, NULL((void*)0), |
| 2486 | HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2487 | |
| 2488 | { &hf_zbee_nwk_gp_zgpd_endpoint, |
| 2489 | { "Endpoint", "zbee_nwk_gp.endpoint", FT_UINT8, BASE_DEC, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2490 | |
| 2491 | { &hf_zbee_nwk_gp_security_frame_counter, |
| 2492 | { "Security Frame Counter", "zbee_nwk_gp.security_frame_counter", FT_UINT32, BASE_DEC, NULL((void*)0), 0x0, NULL((void*)0), |
| 2493 | HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2494 | |
| 2495 | { &hf_zbee_nwk_gp_security_mic_2b, |
| 2496 | { "Security MIC", "zbee_nwk_gp.security_mic2", FT_UINT16, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2497 | |
| 2498 | { &hf_zbee_nwk_gp_security_mic_4b, |
| 2499 | { "Security MIC", "zbee_nwk_gp.security_mic4", FT_UINT32, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2500 | |
| 2501 | { &hf_zbee_nwk_gp_command_id, |
| 2502 | { "ZGPD Command ID", "zbee_nwk_gp.command_id", FT_UINT8, BASE_HEX | BASE_EXT_STRING0x00000200, &zbee_nwk_gp_cmd_names_ext, 0x0, NULL((void*)0), |
| 2503 | HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2504 | |
| 2505 | { &hf_zbee_nwk_gp_cmd_comm_device_id, |
| 2506 | { "ZGPD Device ID", "zbee_nwk_gp.cmd.comm.dev_id", FT_UINT8, BASE_HEX | BASE_EXT_STRING0x00000200, &zbee_nwk_gp_device_ids_names_ext, |
| 2507 | 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2508 | |
| 2509 | { &hf_zbee_nwk_gp_cmd_comm_ext_opt_gpd_key_encr, |
| 2510 | { "GPD Key Encryption", "zbee_nwk_gp.cmd.comm.ext_opt.gpd_key_encr", FT_BOOLEAN, 8, NULL((void*)0), |
| 2511 | ZBEE_NWK_GP_CMD_COMMISSIONING_EXT_OPT_GPD_KEY_ENCR0x40, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2512 | |
| 2513 | { &hf_zbee_nwk_gp_cmd_comm_ext_opt_gpd_key_present, |
| 2514 | { "GPD Key Present", "zbee_nwk_gp.cmd.comm.ext_opt.gpd_key_present", FT_BOOLEAN, 8, NULL((void*)0), |
| 2515 | ZBEE_NWK_GP_CMD_COMMISSIONING_EXT_OPT_GPD_KEY_PRESENT0x20, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2516 | |
| 2517 | { &hf_zbee_nwk_gp_cmd_comm_ext_opt_key_type, |
| 2518 | { "Key Type", "zbee_nwk_gp.cmd.comm.ext_opt.key_type", FT_UINT8, BASE_HEX, |
| 2519 | VALS(zbee_nwk_gp_src_sec_keys_type_names)((0 ? (const struct _value_string*)0 : ((zbee_nwk_gp_src_sec_keys_type_names )))), ZBEE_NWK_GP_CMD_COMMISSIONING_EXT_OPT_KEY_TYPE0x1C, NULL((void*)0), |
| 2520 | HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2521 | |
| 2522 | { &hf_zbee_nwk_gp_cmd_comm_outgoing_counter, |
| 2523 | { "GPD Outgoing Counter", "zbee_nwk_gp.cmd.comm.out_counter", FT_UINT32, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), |
| 2524 | HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2525 | |
| 2526 | { &hf_zbee_nwk_gp_cmd_comm_ext_opt_sec_level_cap, |
| 2527 | { "Security Level Capabilities", "zbee_nwk_gp.cmd.comm.ext_opt.seclevel_cap", FT_UINT8, BASE_HEX, NULL((void*)0), |
| 2528 | ZBEE_NWK_GP_CMD_COMMISSIONING_EXT_OPT_SEC_LEVEL_CAP0x03, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2529 | |
| 2530 | { &hf_zbee_nwk_gp_cmd_comm_security_key, |
| 2531 | { "Security Key", "zbee_nwk_gp.cmd.comm.security_key", FT_BYTES, BASE_NONE, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2532 | |
| 2533 | { &hf_zbee_nwk_gp_cmd_comm_gpd_sec_key_mic, |
| 2534 | { "GPD Key MIC", "zbee_nwk_gp.cmd.comm.gpd_key_mic", FT_UINT32, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2535 | |
| 2536 | { &hf_zbee_nwk_gp_cmd_comm_opt_ext_opt, |
| 2537 | { "Extended Option Field", "zbee_nwk_gp.cmd.comm.opt.ext_opt_field", FT_BOOLEAN, 8, NULL((void*)0), |
| 2538 | ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_EXT_OPTIONS0x80, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2539 | |
| 2540 | { &hf_zbee_nwk_gp_cmd_comm_opt, |
| 2541 | { "Options Field", "zbee_nwk_gp.cmd.comm.opt", FT_UINT8, BASE_HEX, NULL((void*)0), |
| 2542 | 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2543 | |
| 2544 | { &hf_zbee_nwk_gp_cmd_comm_opt_fixed_location, |
| 2545 | { "Fixed Location", "zbee_nwk_gp.cmd.comm.opt.fixed_location", FT_BOOLEAN, 8, NULL((void*)0), |
| 2546 | ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_FIXED_LOCATION0x40, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2547 | |
| 2548 | { &hf_zbee_nwk_gp_cmd_comm_opt_mac_sec_num_cap, |
| 2549 | { "MAC Sequence number capability", "zbee_nwk_gp.cmd.comm.opt.mac_seq_num_cap", FT_BOOLEAN, 8, NULL((void*)0), |
| 2550 | ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_MAC_SEQ0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2551 | |
| 2552 | { &hf_zbee_nwk_gp_cmd_comm_opt_appli_info_present, |
| 2553 | { "Application information present", "zbee_nwk_gp.cmd.comm.opt.appli_info_present", FT_BOOLEAN, 8, NULL((void*)0), |
| 2554 | ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_APPLICATION_INFO0x04, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2555 | |
| 2556 | { &hf_zbee_nwk_gp_cmd_comm_opt_panid_req, |
| 2557 | { "PANId request", "zbee_nwk_gp.cmd.comm.opt.panid_req", FT_BOOLEAN, 8, NULL((void*)0), |
| 2558 | ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_PAN_ID_REQ0x10, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2559 | |
| 2560 | { &hf_zbee_nwk_gp_cmd_comm_opt_rx_on_cap, |
| 2561 | { "RxOnCapability", "zbee_nwk_gp.cmd.comm.opt.rxon_cap", FT_BOOLEAN, 8, NULL((void*)0), |
| 2562 | ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_RX_ON_CAP0x02, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2563 | |
| 2564 | { &hf_zbee_nwk_gp_cmd_comm_opt_sec_key_req, |
| 2565 | { "GP Security Key Request", "zbee_nwk_gp.cmd.comm.opt.seq_key_req", FT_BOOLEAN, 8, NULL((void*)0), |
| 2566 | ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_GP_SEC_KEY_REQ0x20, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2567 | |
| 2568 | { &hf_zbee_nwk_gp_cmd_comm_ext_opt, |
| 2569 | { "Extended Options Field", "zbee_nwk_gp.cmd.comm.ext_opt", FT_UINT8, BASE_HEX, NULL((void*)0), |
| 2570 | 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2571 | |
| 2572 | { &hf_zbee_nwk_gp_cmd_comm_ext_opt_outgoing_counter, |
| 2573 | { "GPD Outgoing present", "zbee_nwk_gp.cmd.comm.ext_opt.outgoing_counter", FT_BOOLEAN, 8, NULL((void*)0), |
| 2574 | ZBEE_NWK_GP_CMD_COMMISSIONING_EXT_OPT_OUT_COUNTER0x80, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2575 | |
| 2576 | { &hf_zbee_nwk_gp_cmd_comm_manufacturer_greenpeak_dev_id, |
| 2577 | { "Manufacturer Model ID", "zbee_nwk_gp.cmd.comm.manufacturer_model_id", FT_UINT16, BASE_HEX, |
| 2578 | VALS(zbee_nwk_gp_manufacturer_greenpeak_dev_names)((0 ? (const struct _value_string*)0 : ((zbee_nwk_gp_manufacturer_greenpeak_dev_names )))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2579 | |
| 2580 | { &hf_zbee_nwk_gp_cmd_comm_manufacturer_dev_id, |
| 2581 | { "Manufacturer Model ID", "zbee_nwk_gp.cmd.comm.manufacturer_model_id", FT_UINT16, BASE_HEX, |
| 2582 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2583 | |
| 2584 | { &hf_zbee_nwk_gp_cmd_comm_manufacturer_id, |
| 2585 | { "Manufacturer ID", "zbee_nwk_gp.cmd.comm.manufacturer_id", FT_UINT16, BASE_HEX, |
| 2586 | VALS(zbee_mfr_code_names)((0 ? (const struct _value_string*)0 : ((zbee_mfr_code_names) ))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2587 | |
| 2588 | { &hf_zbee_nwk_gp_cmd_comm_appli_info_crp, |
| 2589 | { "Cluster reports present", "zbee_nwk_gp.cmd.comm.appli_info.crp", FT_BOOLEAN, 8, NULL((void*)0), |
| 2590 | ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_CRP0x08 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2591 | |
| 2592 | { &hf_zbee_nwk_gp_cmd_comm_appli_info_gclp, |
| 2593 | { "GP commands list present", "zbee_nwk_gp.cmd.comm.appli_info.gclp", FT_BOOLEAN, 8, NULL((void*)0), |
| 2594 | ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_GCLP0x04 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2595 | |
| 2596 | { &hf_zbee_nwk_gp_cmd_comm_appli_info, |
| 2597 | { "Application information Field", "zbee_nwk_gp.cmd.comm.appli_info", FT_UINT8, BASE_HEX, NULL((void*)0), |
| 2598 | 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2599 | |
| 2600 | { &hf_zbee_nwk_gp_cmd_comm_appli_info_mip, |
| 2601 | { "Manufacturer ID present", "zbee_nwk_gp.cmd.comm.appli_info.mip", FT_BOOLEAN, 8, NULL((void*)0), |
| 2602 | ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_MIP0x01 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2603 | |
| 2604 | { &hf_zbee_nwk_gp_cmd_comm_appli_info_mmip, |
| 2605 | { "Manufacturer Model ID present", "zbee_nwk_gp.cmd.comm.appli_info.mmip", FT_BOOLEAN, 8, NULL((void*)0), |
| 2606 | ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_MMIP0x02 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2607 | |
| 2608 | { &hf_zbee_nwk_gp_cmd_comm_appli_info_sip, |
| 2609 | { "Switch information present", "zbee_nwk_gp.cmd.comm.appli_info.sip", FT_BOOLEAN, 8, NULL((void*)0), |
| 2610 | ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_SIP0x10 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2611 | |
| 2612 | { &hf_zbee_nwk_gp_cmd_comm_appli_info_adcf, |
| 2613 | { "GPD Application Description command follows", "zbee_nwk_gp.cmd.comm.appli_info.adcf", FT_BOOLEAN, 8, NULL((void*)0), |
| 2614 | ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_ADCF0x20 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2615 | |
| 2616 | { &hf_zbee_nwk_gp_cmd_comm_appli_info_res, |
| 2617 | { "Reserved", "zbee_nwk_gp.cmd.comm.appli_info.reserved", FT_UINT8, BASE_HEX, NULL((void*)0), |
| 2618 | ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_RES0xC0 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2619 | |
| 2620 | { &hf_zbee_nwk_gp_cmd_comm_gpd_cmd_num, |
| 2621 | { "Number of GPD commands", "zbee_nwk_gp.cmd.comm.gpd_cmd_num", FT_UINT8, BASE_DEC, NULL((void*)0), |
| 2622 | 0x0 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2623 | |
| 2624 | { &hf_zbee_nwk_gp_cmd_comm_gpd_cmd_id_list, |
| 2625 | { "GPD CommandID list", "zbee_nwk_gp.cmd.comm.gpd_cmd_id_list", FT_NONE, BASE_NONE, NULL((void*)0), |
| 2626 | 0x0 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2627 | |
| 2628 | { &hf_zbee_nwk_gp_cmd_comm_length_of_clid_list, |
| 2629 | { "Length of ClusterID list", "zbee_nwk_gp.cmd.comm.length_of_clid_list", FT_UINT8, BASE_HEX, NULL((void*)0), |
| 2630 | 0x0 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2631 | |
| 2632 | { &hf_zbee_nwk_gp_cmd_comm_length_of_clid_list_server, |
| 2633 | { "Number of server ClusterIDs", "zbee_nwk_gp.cmd.comm.length_of_clid_list_srv", FT_UINT8, BASE_DEC, NULL((void*)0), |
| 2634 | ZBEE_NWK_GP_CMD_COMMISSIONING_CLID_LIST_LEN_SRV0x0F, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2635 | |
| 2636 | { &hf_zbee_nwk_gp_cmd_comm_length_of_clid_list_client, |
| 2637 | { "Number of client ClusterIDs", "zbee_nwk_gp.cmd.comm.length_of_clid_list_cli", FT_UINT8, BASE_DEC, NULL((void*)0), |
| 2638 | ZBEE_NWK_GP_CMD_COMMISSIONING_CLID_LIST_LEN_CLI0xF0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2639 | |
| 2640 | { &hf_zbee_nwk_cmd_comm_clid_list_server, |
| 2641 | { "Cluster ID List Server", "zbee_nwk_gp.cmd.comm.clid_list_server", FT_NONE, BASE_NONE, NULL((void*)0), |
| 2642 | 0x0 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2643 | |
| 2644 | { &hf_zbee_nwk_cmd_comm_clid_list_client, |
| 2645 | { "ClusterID List Client", "zbee_nwk_gp.cmd.comm.clid_list_client", FT_NONE, BASE_NONE, NULL((void*)0), |
| 2646 | 0x0 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2647 | |
| 2648 | { &hf_zbee_nwk_cmd_comm_cluster_id, |
| 2649 | { "Cluster ID", "zbee_nwk_gp.cmd.comm.cluster_id", FT_UINT16, BASE_HEX | BASE_RANGE_STRING0x00000100, RVALS(zbee_aps_cid_names)((0 ? (const struct _range_string*)0 : ((zbee_aps_cid_names)) )), |
| 2650 | 0x0 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2651 | |
| 2652 | { &hf_zbee_nwk_gp_cmd_comm_switch_info, |
| 2653 | { "Switch information", "zbee_nwk_gp.cmd.comm.switch_info", FT_NONE, BASE_NONE, NULL((void*)0), |
| 2654 | 0x0 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2655 | |
| 2656 | { &hf_zbee_nwk_gp_cmd_comm_switch_info_length, |
| 2657 | { "Switch info length", "zbee_nwk_gp.cmd.comm.switch_info.length", FT_UINT8, BASE_DEC, NULL((void*)0), |
| 2658 | 0x0 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2659 | |
| 2660 | { &hf_zbee_nwk_gp_cmd_comm_switch_info_generic_switch_config, |
| 2661 | { "Generic switch configuration", "zbee_nwk_gp.cmd.comm.switch_info.generic_switch_config", FT_UINT8, BASE_HEX, NULL((void*)0), |
| 2662 | 0x0 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2663 | |
| 2664 | { &hf_zbee_nwk_gp_cmd_comm_switch_info_num_contacts, |
| 2665 | { "Number of contacts", "zbee_nwk_gp.cmd.comm.switch_info.num_contacts", FT_UINT8, BASE_DEC, NULL((void*)0), |
| 2666 | ZBEE_NWK_GP_CMD_COMMISSIONING_SWITCH_CONF_NUM_CONTACTS0x0F , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2667 | |
| 2668 | { &hf_zbee_nwk_gp_cmd_comm_switch_info_switch_type, |
| 2669 | { "Switch type", "zbee_nwk_gp.cmd.comm.switch_info.switch_type", FT_UINT8, BASE_HEX, VALS(zbee_nwk_gp_switch_type_names)((0 ? (const struct _value_string*)0 : ((zbee_nwk_gp_switch_type_names )))), |
| 2670 | ZBEE_NWK_GP_CMD_COMMISSIONING_SWITCH_CONF_SWITCH_TYPE0x30 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2671 | |
| 2672 | { &hf_zbee_nwk_gp_cmd_comm_switch_info_reserved, |
| 2673 | { "Reserved", "zbee_nwk_gp.cmd.comm.switch_info.reserved", FT_UINT8, BASE_HEX, NULL((void*)0), |
| 2674 | ZBEE_NWK_GP_CMD_COMMISSIONING_SWITCH_CONF_RES0xC0 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2675 | |
| 2676 | { &hf_zbee_nwk_gp_cmd_comm_switch_info_current_contact_status, |
| 2677 | { "Current contact status", "zbee_nwk_gp.cmd.comm.switch_info.current_contact_status", FT_UINT8, BASE_HEX, NULL((void*)0), |
| 2678 | 0x0 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2679 | |
| 2680 | { &hf_zbee_nwk_gp_cmd_comm_rep_opt_key_encr, |
| 2681 | { "GPD Key Encryption", "zbee_nwk_gp.cmd.comm_reply.opt.sec_key_encr", FT_BOOLEAN, 8, NULL((void*)0), |
| 2682 | ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_KEY_ENCR0x04, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2683 | |
| 2684 | { &hf_zbee_nwk_gp_cmd_comm_rep_opt, |
| 2685 | { "Options Field", "zbee_nwk_gp.cmd.comm_reply.opt", FT_UINT8, BASE_HEX, NULL((void*)0), |
| 2686 | 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2687 | |
| 2688 | { &hf_zbee_nwk_gp_cmd_comm_rep_opt_panid_present, |
| 2689 | { "PANID Present", "zbee_nwk_gp.cmd.comm_reply.opt.pan_id_present", FT_BOOLEAN, 8, NULL((void*)0), |
| 2690 | ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_PAN_ID_PRESENT0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2691 | |
| 2692 | { &hf_zbee_nwk_gp_cmd_comm_rep_opt_sec_key_present, |
| 2693 | { "GPD Security Key Present", "zbee_nwk_gp.cmd.comm_reply.opt.sec_key_present", FT_BOOLEAN, 8, NULL((void*)0), |
| 2694 | ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_SEC_KEY_PRESENT0x02, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2695 | |
| 2696 | { &hf_zbee_nwk_gp_cmd_comm_rep_opt_sec_level, |
| 2697 | { "Security Level", "zbee_nwk_gp.cmd.comm_reply.opt.sec_level", FT_UINT8, BASE_HEX, NULL((void*)0), |
| 2698 | ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_SEC_LEVEL0x18, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2699 | |
| 2700 | { &hf_zbee_nwk_gp_cmd_comm_rep_opt_sec_type, |
| 2701 | { "Key Type", "zbee_nwk_gp.cmd.comm_reply.opt.key_type", FT_UINT8, BASE_HEX, NULL((void*)0), |
| 2702 | ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_KEY_TYPE0xE0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2703 | |
| 2704 | { &hf_zbee_nwk_gp_cmd_comm_rep_pan_id, |
| 2705 | { "PAN ID", "zbee_nwk_gp.cmd.comm_reply.pan_id", FT_UINT16, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2706 | |
| 2707 | { &hf_zbee_nwk_gp_cmd_comm_rep_frame_counter, |
| 2708 | { "Frame Counter", "zbee_nwk_gp.cmd.comm_reply.frame_counter", FT_UINT32, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2709 | |
| 2710 | { &hf_zbee_nwk_gp_cmd_read_att_opt_multi_rec, |
| 2711 | { "Multi-record", "zbee_nwk_gp.cmd.read_att.opt.multi_record", FT_BOOLEAN, 8, NULL((void*)0), |
| 2712 | ZBEE_NWK_GP_CMD_READ_ATTRIBUTE_OPT_MULTI_RECORD0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2713 | |
| 2714 | { &hf_zbee_nwk_gp_cmd_read_att_opt_man_field_present, |
| 2715 | { "Manufacturer field present", "zbee_nwk_gp.cmd.read_att.opt.man_field_present", FT_BOOLEAN, 8, NULL((void*)0), |
| 2716 | ZBEE_NWK_GP_CMD_READ_ATTRIBUTE_OPT_MAN_FIELD_PRESENT0x02, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2717 | |
| 2718 | { &hf_zbee_nwk_gp_cmd_read_att_opt, |
| 2719 | { "Option field", "zbee_nwk_gp.cmd.read_att.opt", FT_UINT8, BASE_HEX, NULL((void*)0), |
| 2720 | 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2721 | |
| 2722 | { &hf_zbee_nwk_gp_cmd_zcl_tunnel_opt_frame_type, |
| 2723 | { "Frame type", "zbee_nwk_gp.cmd.zcl_tunnel.opt.frame_type", FT_UINT8, BASE_HEX, NULL((void*)0), |
| 2724 | ZBEE_NWK_GP_CMD_ZCL_TUNNEL_OPT_FRAME_TYPE0x03, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2725 | |
| 2726 | { &hf_zbee_nwk_gp_cmd_zcl_tunnel_opt_man_field_present, |
| 2727 | { "Manufacturer field present", "zbee_nwk_gp.cmd.zcl_tunnel.opt.man_field_present", FT_BOOLEAN, 8, NULL((void*)0), |
| 2728 | ZBEE_NWK_GP_CMD_ZCL_TUNNEL_OPT_MAN_FIELD_PRESENT0x04, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2729 | |
| 2730 | { &hf_zbee_nwk_gp_cmd_zcl_tunnel_opt_direction, |
| 2731 | { "Direction", "zbee_nwk_gp.cmd.zcl_tunnel.opt.direction", FT_UINT8, BASE_HEX, NULL((void*)0), |
| 2732 | ZBEE_NWK_GP_CMD_ZCL_TUNNEL_OPT_DIRECTION0x08, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2733 | |
| 2734 | { &hf_zbee_nwk_gp_cmd_zcl_tunnel_opt, |
| 2735 | { "Option field", "zbee_nwk_gp.cmd.zcl_tunnel.opt", FT_UINT8, BASE_HEX, NULL((void*)0), |
| 2736 | 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2737 | |
| 2738 | { &hf_zbee_nwk_gp_cmd_zcl_tunnel_command_id, |
| 2739 | { "Zigbee Command ID", "zbee_nwk_gp.cmd.zcl_tunnel.command_id", FT_UINT8, BASE_HEX, NULL((void*)0), 0x0, |
| 2740 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2741 | |
| 2742 | { &hf_zbee_nwk_gp_cmd_zcl_tunnel_payload_len, |
| 2743 | { "Length of Payload", "zbee_nwk_gp.cmd.zcl_tunnel.payload_len", FT_UINT8, BASE_DEC, NULL((void*)0), 0x0, |
| 2744 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2745 | |
| 2746 | { &hf_zbee_nwk_gp_cmd_compact_attr_report_report_id, |
| 2747 | { "Report Identifier", "zbee_nwk_gp.cmd.compact_attr_report.report_id", FT_UINT8, BASE_HEX, NULL((void*)0), |
| 2748 | 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2749 | |
| 2750 | { &hf_zbee_nwk_gp_cmd_compact_attr_report_data_points, |
| 2751 | { "Data Points", "zbee_nwk_gp.cmd.compact_attr_report.data_points", FT_BYTES, BASE_NONE, NULL((void*)0), |
| 2752 | 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2753 | |
| 2754 | { &hf_zbee_nwk_gp_cmd_app_desc_total_report, |
| 2755 | { "Total Number of Reports", "zbee_nwk_gp.app_desc.total_report", FT_UINT8, BASE_DEC, NULL((void*)0), |
| 2756 | 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2757 | |
| 2758 | { &hf_zbee_nwk_gp_cmd_app_desc_num_report, |
| 2759 | { "Number of Reports", "zbee_nwk_gp.app_desc.num_report", FT_UINT8, BASE_DEC, NULL((void*)0), |
| 2760 | 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2761 | |
| 2762 | { &hf_zbee_nwk_gp_cmd_app_desc_report_desc_id, |
| 2763 | { "Report Identifier", "zbee_nwk_gp.app_desc.report_desc.id", FT_UINT8, BASE_HEX, NULL((void*)0), |
| 2764 | 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2765 | |
| 2766 | { &hf_zbee_nwk_gp_cmd_app_desc_report_desc_opt, |
| 2767 | { "Report Options", "zbee_nwk_gp.app_desc.report_desc.opt", FT_UINT8, BASE_HEX, NULL((void*)0), |
| 2768 | 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2769 | |
| 2770 | { &hf_zbee_nwk_gp_cmd_app_desc_report_desc_opt_timeout_present, |
| 2771 | { "Timeout Present", "zbee_nwk_gp.app_desc.report_desc.opt.timeout_present", FT_BOOLEAN, 8, NULL((void*)0), |
| 2772 | ZBEE_NWK_GP_CMD_APP_DESC_REPORT_DESC_OPT_TIMEOUT_PRESENT0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2773 | |
| 2774 | { &hf_zbee_nwk_gp_cmd_app_desc_report_desc_timeout, |
| 2775 | { "Timeout Period", "zbee_nwk_gp.app_desc.report_desc.timeout", FT_UINT16, BASE_DEC, NULL((void*)0), |
| 2776 | 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2777 | |
| 2778 | { &hf_zbee_nwk_gp_cmd_app_desc_report_desc_len_remain, |
| 2779 | { "Remaining Length", "zbee_nwk_gp.app_desc.report_desc.len_remain", FT_UINT8, BASE_DEC, NULL((void*)0), |
| 2780 | 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2781 | |
| 2782 | { &hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_opt, |
| 2783 | { "Data Point Options", "zbee_nwk_gp.app_desc.data_pt_desc.opt", FT_UINT8, BASE_HEX, NULL((void*)0), |
| 2784 | 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2785 | |
| 2786 | { &hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_opt_num_recs, |
| 2787 | { "Number of Attribute Records", "zbee_nwk_gp.app_desc.data_pt_desc.opt.num_recs", FT_UINT8, BASE_DEC, NULL((void*)0), |
| 2788 | ZBEE_NWK_GP_CMD_APP_DESC_DATA_PT_DESC_OPT_ATTR_NUM0x07, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2789 | |
| 2790 | { &hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_opt_server, |
| 2791 | { "Server", "zbee_nwk_gp.app_desc.data_pt_desc.opt.server", FT_BOOLEAN, 8, NULL((void*)0), |
| 2792 | ZBEE_NWK_GP_CMD_APP_DESC_DATA_PT_DESC_OPT_SERVER0x08, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2793 | |
| 2794 | { &hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_opt_manu_id_present, |
| 2795 | { "Manufacturer ID Present", "zbee_nwk_gp.app_desc.data_pt_desc.opt.manu_id_present", FT_BOOLEAN, 8, NULL((void*)0), |
| 2796 | ZBEE_NWK_GP_CMD_APP_DESC_DATA_PT_DESC_OPT_MANU_ID_PRESENT0x10, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2797 | |
| 2798 | { &hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_cluster_id, |
| 2799 | { "Cluster ID", "zbee_nwk_gp.app_desc.data_pt_desc.cluster_id", FT_UINT16, BASE_HEX | BASE_RANGE_STRING0x00000100, RVALS(zbee_aps_cid_names)((0 ? (const struct _range_string*)0 : ((zbee_aps_cid_names)) )), |
| 2800 | 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2801 | |
| 2802 | { &hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_manu_id, |
| 2803 | { "Manufacturer ID", "zbee_nwk_gp.app_desc.data_pt_desc.manu_id", FT_UINT16, BASE_HEX, VALS(zbee_mfr_code_names)((0 ? (const struct _value_string*)0 : ((zbee_mfr_code_names) ))), |
| 2804 | 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2805 | |
| 2806 | { &hf_zbee_nwk_gp_cmd_app_desc_attr_rec_id, |
| 2807 | { "Attribute ID", "zbee_nwk_gp.app_desc.attr_rec.id", FT_UINT16, BASE_HEX, NULL((void*)0), |
| 2808 | 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2809 | |
| 2810 | { &hf_zbee_nwk_gp_cmd_app_desc_attr_rec_data_type, |
| 2811 | { "Attribute Data Type", "zbee_nwk_gp.app_desc.attr_rec.data_type", FT_UINT8, BASE_HEX, VALS(zbee_zcl_short_data_type_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_short_data_type_names )))), |
| 2812 | 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2813 | |
| 2814 | { &hf_zbee_nwk_gp_cmd_app_desc_attr_rec_opt, |
| 2815 | { "Attribute Options", "zbee_nwk_gp.app_desc.attr_rec.opt", FT_UINT8, BASE_HEX, NULL((void*)0), |
| 2816 | 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2817 | |
| 2818 | { &hf_zbee_nwk_gp_cmd_app_desc_attr_rec_opt_len_remain, |
| 2819 | { "Remaining Attribute Record Length", "zbee_nwk_gp.app_desc.attr_rec.opt.len_remain", FT_UINT8, BASE_DEC, NULL((void*)0), |
| 2820 | ZBEE_NWK_GP_CMD_APP_DESC_ATTR_REC_OPT_LEN_REMAIN0x0F, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2821 | |
| 2822 | { &hf_zbee_nwk_gp_cmd_app_desc_attr_rec_opt_reported, |
| 2823 | { "Reported", "zbee_nwk_gp.app_desc.attr_rec.opt.reported", FT_BOOLEAN, 8, NULL((void*)0), |
| 2824 | ZBEE_NWK_GP_CMD_APP_DESC_ATTR_REC_OPT_REPORTED0x10, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2825 | |
| 2826 | { &hf_zbee_nwk_gp_cmd_app_desc_attr_rec_opt_val_present, |
| 2827 | { "Attribute Value Present", "zbee_nwk_gp.app_desc.attr_rec.opt.val_present", FT_BOOLEAN, 8, NULL((void*)0), |
| 2828 | ZBEE_NWK_GP_CMD_APP_DESC_ATTR_REC_OPT_VAL_PRESENT0x20, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2829 | |
| 2830 | { &hf_zbee_nwk_gp_cmd_app_desc_attr_rec_offset, |
| 2831 | { "Attribute Offset within Report", "zbee_nwk_gp.app_desc.attr_rec.offset", FT_UINT8, BASE_DEC, NULL((void*)0), |
| 2832 | 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2833 | |
| 2834 | { &hf_zbee_nwk_gp_cmd_app_desc_attr_rec_val, |
| 2835 | { "Attribute Value", "zbee_nwk_gp.app_desc.attr_rec.val", FT_BYTES, BASE_NONE, NULL((void*)0), |
| 2836 | 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2837 | |
| 2838 | { &hf_zbee_zcl_gp_cmd_ms_manufacturer_code, |
| 2839 | { "Manufacturer Code", "zbee_nwk_gp.cmd.manufacturer_code", FT_UINT16, BASE_HEX, VALS(zbee_mfr_code_names)((0 ? (const struct _value_string*)0 : ((zbee_mfr_code_names) ))), |
| 2840 | 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2841 | |
| 2842 | { &hf_zbee_nwk_gp_cmd_read_att_record_len, |
| 2843 | { "Length of Record List", "zbee_nwk_gp.cmd.read_att.record_len", FT_UINT8, BASE_DEC, NULL((void*)0), 0x0, |
| 2844 | NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2845 | |
| 2846 | { &hf_zbee_nwk_gp_zcl_attr_status, |
| 2847 | { "Status", "zbee_nwk_gp.zcl.attr.status", FT_UINT8, BASE_HEX, VALS(zbee_zcl_status_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_status_names )))), |
| 2848 | 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2849 | |
| 2850 | { &hf_zbee_nwk_gp_zcl_attr_data_type, |
| 2851 | { "Data Type", "zbee_nwk_gp.zcl.attr.datatype", FT_UINT8, BASE_HEX, VALS(zbee_zcl_short_data_type_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_short_data_type_names )))), |
| 2852 | 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
| 2853 | |
| 2854 | { &hf_zbee_nwk_gp_zcl_attr_cluster_id, |
| 2855 | { "ZigBee Cluster ID", "zbee_nwk_gp.zcl.attr.cluster_id", FT_UINT16, BASE_HEX | BASE_RANGE_STRING0x00000100, RVALS(zbee_aps_cid_names)((0 ? (const struct _range_string*)0 : ((zbee_aps_cid_names)) )), |
| 2856 | 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2857 | |
| 2858 | { &hf_zbee_nwk_gp_cmd_channel_request_toggling_behaviour, |
| 2859 | { "Channel Toggling Behaviour", "zbee_nwk_gp.cmd.ch_req", FT_UINT8, BASE_HEX, NULL((void*)0), |
| 2860 | 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2861 | |
| 2862 | { &hf_zbee_nwk_gp_cmd_channel_request_toggling_behaviour_1st, |
| 2863 | { "Rx channel in the next attempt", "zbee_nwk_gp.cmd.ch_req.1st", FT_UINT8, BASE_HEX, NULL((void*)0), |
| 2864 | ZBEE_NWK_GP_CMD_CHANNEL_REQUEST_1ST0x0F, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2865 | |
| 2866 | { &hf_zbee_nwk_gp_cmd_channel_request_toggling_behaviour_2nd, |
| 2867 | { "Rx channel in the second next attempt", "zbee_nwk_gp.ch_req.2nd", FT_UINT8, BASE_HEX, NULL((void*)0), |
| 2868 | ZBEE_NWK_GP_CMD_CHANNEL_REQUEST_2ND0xF0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2869 | |
| 2870 | { &hf_zbee_nwk_gp_cmd_operational_channel, |
| 2871 | { "Operational Channel", "zbee_nwk_gp.cmd.configuration_ch", FT_UINT8, BASE_HEX, NULL((void*)0), |
| 2872 | 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2873 | |
| 2874 | { &hf_zbee_nwk_gp_cmd_channel_configuration, |
| 2875 | { "Operation channel", "zbee_nwk_gp.cmd.configuration_ch.operation_ch", FT_UINT8, BASE_HEX, NULL((void*)0), |
| 2876 | ZBEE_NWK_GP_CMD_CHANNEL_CONFIGURATION_OPERATION_CH0x0F, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2877 | |
| 2878 | { &hf_zbee_nwk_gp_cmd_move_color_ratex, |
| 2879 | { "RateX", "zbee_nwk_gp.cmd.move_color.ratex", FT_UINT16, BASE_DEC, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2880 | |
| 2881 | { &hf_zbee_nwk_gp_cmd_move_color_ratey, |
| 2882 | { "RateY", "zbee_nwk_gp.cmd.move_color.ratey", FT_UINT16, BASE_DEC, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2883 | |
| 2884 | { &hf_zbee_nwk_gp_cmd_move_up_down_rate, |
| 2885 | { "Rate", "zbee_nwk_gp.cmd.move_up_down.rate", FT_UINT8, BASE_DEC, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2886 | |
| 2887 | { &hf_zbee_nwk_gp_cmd_step_color_stepx, |
| 2888 | { "StepX", "zbee_nwk_gp.cmd.step_color.stepx", FT_UINT16, BASE_DEC, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2889 | |
| 2890 | { &hf_zbee_nwk_gp_cmd_step_color_stepy, |
| 2891 | { "StepY", "zbee_nwk_gp.cmd.step_color.stepy", FT_UINT16, BASE_DEC, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2892 | |
| 2893 | { &hf_zbee_nwk_gp_cmd_step_color_transition_time, |
| 2894 | { "Transition Time", "zbee_nwk_gp.cmd.step_color.transition_time", FT_UINT16, BASE_DEC, NULL((void*)0), 0x0, NULL((void*)0), |
| 2895 | HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2896 | |
| 2897 | { &hf_zbee_nwk_gp_cmd_step_up_down_step_size, |
| 2898 | { "Step Size", "zbee_nwk_gp.cmd.step_up_down.step_size", FT_UINT8, BASE_DEC, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2899 | |
| 2900 | { &hf_zbee_nwk_gp_cmd_step_up_down_transition_time, |
| 2901 | { "Transition Time", "zbee_nwk_gp.cmd.step_up_down.transition_time", FT_UINT16, BASE_DEC, NULL((void*)0), 0x0, NULL((void*)0), |
| 2902 | HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }} |
| 2903 | }; |
| 2904 | |
| 2905 | static ei_register_info ei[] = { |
| 2906 | { &ei_zbee_nwk_gp_no_payload, |
| 2907 | { "zbee_nwk_gp.no_payload", PI_MALFORMED0x07000000, PI_ERROR0x00800000, |
| 2908 | "Payload is missing", EXPFILL0, ((void*)0), 0, ((void*)0), {0, {((void*)0), ((void*)0), FT_NONE , BASE_NONE, ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE , -1, ((void*)0)}} }}, |
| 2909 | { &ei_zbee_nwk_gp_inval_residual_data, |
| 2910 | { "zbee_nwk_gp.inval_residual_data", PI_MALFORMED0x07000000, PI_ERROR0x00800000, |
| 2911 | "Invalid residual data", EXPFILL0, ((void*)0), 0, ((void*)0), {0, {((void*)0), ((void*)0), FT_NONE , BASE_NONE, ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE , -1, ((void*)0)}} }}, |
| 2912 | { &ei_zbee_nwk_gp_com_rep_no_out_cnt, |
| 2913 | { "zbee_nwk_gp.com_rep_no_out_cnt", PI_DEBUG0x08000000, PI_WARN0x00600000, |
| 2914 | "Missing outgoing frame counter", EXPFILL0, ((void*)0), 0, ((void*)0), {0, {((void*)0), ((void*)0), FT_NONE , BASE_NONE, ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE , -1, ((void*)0)}} }} |
| 2915 | }; |
| 2916 | |
| 2917 | static int *ett[] = { |
| 2918 | &ett_zbee_nwk, |
| 2919 | &ett_zbee_nwk_cmd, |
| 2920 | &ett_zbee_nwk_cmd_cinfo, |
| 2921 | &ett_zbee_nwk_cmd_appli_info, |
| 2922 | &ett_zbee_nwk_cmd_options, |
| 2923 | &ett_zbee_nwk_fcf, |
| 2924 | &ett_zbee_nwk_fcf_ext, |
| 2925 | &ett_zbee_nwk_clu_rec, |
| 2926 | &ett_zbee_nwk_att_rec, |
| 2927 | &ett_zbee_nwk_cmd_app_desc_report_desc, |
| 2928 | &ett_zbee_nwk_cmd_app_desc_data_pt_desc, |
| 2929 | &ett_zbee_nwk_cmd_app_desc_data_pt_options, |
| 2930 | &ett_zbee_nwk_cmd_app_desc_att_rec, |
| 2931 | &ett_zbee_nwk_cmd_comm_gpd_cmd_id_list, |
| 2932 | &ett_zbee_nwk_cmd_comm_length_of_clid_list, |
| 2933 | &ett_zbee_nwk_cmd_comm_clid_list_server, |
| 2934 | &ett_zbee_nwk_cmd_comm_clid_list_client, |
| 2935 | &ett_zbee_nwk_cmd_comm_switch_info, |
| 2936 | &ett_zbee_nwk_cmd_comm_switch_info_generic_switch_config |
| 2937 | }; |
| 2938 | |
| 2939 | static uat_field_t key_uat_fields[] = { |
| 2940 | UAT_FLD_CSTRING(gp_uat_key_records, string, "Key", "A 16-byte key."){"string", "Key", PT_TXTMOD_STRING,{uat_fld_chk_str,gp_uat_key_records_string_set_cb ,gp_uat_key_records_string_tostr_cb},{0,0,0},0,"A 16-byte key." ,((void*)0)}, |
| 2941 | UAT_FLD_VS(gp_uat_key_records, byte_order, "Byte Order", byte_order_vals, "Byte order of a key."){"byte_order", "Byte Order", PT_TXTMOD_ENUM,{uat_fld_chk_enum ,gp_uat_key_records_byte_order_set_cb,gp_uat_key_records_byte_order_tostr_cb },{&(byte_order_vals),&(byte_order_vals),&(byte_order_vals )},&(byte_order_vals),"Byte order of a key.",((void*)0)}, |
| 2942 | UAT_FLD_LSTRING(gp_uat_key_records, label, "Label", "User label for a key."){"label", "Label", PT_TXTMOD_STRING,{0,gp_uat_key_records_label_set_cb ,gp_uat_key_records_label_tostr_cb},{0,0,0},0,"User label for a key." ,((void*)0)}, |
| 2943 | UAT_END_FIELDS{((void*)0),((void*)0),PT_TXTMOD_NONE,{0,0,0},{0,0,0},0,0,((void *)0)} |
| 2944 | }; |
| 2945 | |
| 2946 | proto_zbee_nwk_gp = proto_register_protocol("ZigBee Green Power Profile", "ZigBee Green Power", |
| 2947 | ZBEE_PROTOABBREV_NWK_GP"zbee_nwk_gp"); |
| 2948 | |
| 2949 | gp_zbee_prefs = prefs_register_protocol(proto_zbee_nwk_gp, NULL((void*)0)); |
| 2950 | |
| 2951 | zbee_gp_sec_key_table_uat = uat_new("ZigBee GP Security Keys", sizeof(uat_key_record_t), "zigbee_gp_keys", true1, |
| 2952 | &gp_uat_key_records, &num_uat_key_records, UAT_AFFECTS_DISSECTION0x00000001, NULL((void*)0), uat_key_record_copy_cb, |
| 2953 | uat_key_record_update_cb, uat_key_record_free_cb, uat_key_record_post_update_cb, NULL((void*)0), key_uat_fields); |
| 2954 | |
| 2955 | prefs_register_uat_preference(gp_zbee_prefs, "gp_key_table", "Pre-configured GP Security Keys", |
| 2956 | "Pre-configured GP Security Keys.", zbee_gp_sec_key_table_uat); |
| 2957 | |
| 2958 | register_init_routine(gp_init_zbee_security); |
| 2959 | register_cleanup_routine(gp_cleanup_zbee_security); |
| 2960 | |
| 2961 | /* Register the Wireshark protocol. */ |
| 2962 | proto_register_field_array(proto_zbee_nwk_gp, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0])); |
| 2963 | proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0])); |
| 2964 | |
| 2965 | expert_zbee_nwk_gp = expert_register_protocol(proto_zbee_nwk_gp); |
| 2966 | expert_register_field_array(expert_zbee_nwk_gp, ei, array_length(ei)(sizeof (ei) / sizeof (ei)[0])); |
| 2967 | |
| 2968 | /* Register the dissectors. */ |
| 2969 | register_dissector(ZBEE_PROTOABBREV_NWK_GP"zbee_nwk_gp", dissect_zbee_nwk_gp, proto_zbee_nwk_gp); |
| 2970 | register_dissector(ZBEE_PROTOABBREV_NWK_GP_CMD"zbee_nwk_gp_cmd", dissect_zbee_nwk_gp_cmd, proto_zbee_nwk_gp); |
| 2971 | } /* proto_register_zbee_nwk_gp */ |
| 2972 | |
| 2973 | /** |
| 2974 | *Registers the ZigBee dissector with Wireshark. |
| 2975 | * |
| 2976 | */ |
| 2977 | void |
| 2978 | proto_reg_handoff_zbee_nwk_gp(void) |
| 2979 | { |
| 2980 | /* Register our dissector with IEEE 802.15.4. */ |
| 2981 | dissector_add_for_decode_as(IEEE802154_PROTOABBREV_WPAN_PANID"wpan.panid", find_dissector(ZBEE_PROTOABBREV_NWK_GP"zbee_nwk_gp")); |
| 2982 | heur_dissector_add(IEEE802154_PROTOABBREV_WPAN"wpan", dissect_zbee_nwk_heur_gp, "ZigBee Green Power over IEEE 802.15.4", "zbee_nwk_gp_wlan", proto_zbee_nwk_gp, HEURISTIC_ENABLE); |
| 2983 | } /* proto_reg_handoff_zbee */ |
| 2984 | |
| 2985 | /* |
| 2986 | * Editor modelines |
| 2987 | * |
| 2988 | * Local Variables: |
| 2989 | * c-basic-offset: 4 |
| 2990 | * tab-width: 8 |
| 2991 | * indent-tabs-mode: nil |
| 2992 | * End: |
| 2993 | * |
| 2994 | * ex: set shiftwidth=4 tabstop=8 expandtab: |
| 2995 | * :indentSize=4:tabSize=8:noTabs=true: |
| 2996 | */ |