diff options
author | sahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7> | 2009-07-29 11:29:53 +0000 |
---|---|---|
committer | sahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7> | 2009-07-29 11:29:53 +0000 |
commit | e7b07750cccb9625e27c708521149224eee746a8 (patch) | |
tree | 68b4628ee7aecbf619d7e3004f9b31463598a239 | |
parent | 175ab03f38bc81c4f9a7a69536bed136f5cbb18d (diff) |
zigbee cluster dissector,
modified from entry in bug 3765 so it compiles cleanly
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@29232 f5534014-38df-0310-8fa8-9805f1628bb7
-rw-r--r-- | epan/dissectors/Makefile.common | 1 | ||||
-rw-r--r-- | epan/dissectors/packet-zbee-aps.c | 301 | ||||
-rw-r--r-- | epan/dissectors/packet-zbee-aps.h | 83 | ||||
-rw-r--r-- | epan/dissectors/packet-zbee-nwk.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-zbee-zcl.c | 2177 | ||||
-rw-r--r-- | epan/dissectors/packet-zbee-zcl.h | 178 | ||||
-rw-r--r-- | epan/dissectors/packet-zbee-zdp.c | 7 | ||||
-rw-r--r-- | epan/dissectors/packet-zbee.h | 550 |
8 files changed, 3259 insertions, 40 deletions
diff --git a/epan/dissectors/Makefile.common b/epan/dissectors/Makefile.common index 20bf1768f9..3dc54059bd 100644 --- a/epan/dissectors/Makefile.common +++ b/epan/dissectors/Makefile.common @@ -917,6 +917,7 @@ DISSECTOR_SRC = \ packet-zbee-aps.c \ packet-zbee-security.c \ packet-zbee-nwk.c \ + packet-zbee-zcl.c \ packet-zbee-zdp.c \ packet-zbee-zdp-binding.c \ packet-zbee-zdp-discovery.c \ diff --git a/epan/dissectors/packet-zbee-aps.c b/epan/dissectors/packet-zbee-aps.c index b25a81149f..b37fe77209 100644 --- a/epan/dissectors/packet-zbee-aps.c +++ b/epan/dissectors/packet-zbee-aps.c @@ -272,6 +272,262 @@ static const value_string zbee_apf_kvp_type_names[] = { { 0, NULL } }; +/* ZigBee Application Profile ID Names */ +const range_string zbee_aps_apid_names[] = { + { ZBEE_DEVICE_PROFILE, ZBEE_DEVICE_PROFILE, "ZigBee Device Profile" }, + + { ZBEE_PROFILE_IPM, ZBEE_PROFILE_IPM, "Industrial Plant Monitoring" }, + + { ZBEE_PROFILE_T1, ZBEE_PROFILE_T1, "Test Profile #1" }, + { ZBEE_PROFILE_HA, ZBEE_PROFILE_HA, "Home Automation" }, + { ZBEE_PROFILE_CBA, ZBEE_PROFILE_CBA, "Commercial Building Automation" }, + { ZBEE_PROFILE_WSN, ZBEE_PROFILE_WSN, "Wireless Sensor Network" }, + { ZBEE_PROFILE_TA, ZBEE_PROFILE_TA, "Telecom Automation" }, + { ZBEE_PROFILE_HC, ZBEE_PROFILE_HC, "Health Care" }, + { ZBEE_PROFILE_SE, ZBEE_PROFILE_SE, "Smart Energy" }, + { ZBEE_PROFILE_STD_MIN, ZBEE_PROFILE_STD_MAX, "Unknown ZigBee Standard" }, + + { ZBEE_PROFILE_T2, ZBEE_PROFILE_T2, "Test Profile #2" }, + { ZBEE_PROFILE_RSVD0_MIN, ZBEE_PROFILE_RSVD0_MAX, "Unknown ZigBee Reserved" }, + { ZBEE_PROFILE_RSVD1_MIN, ZBEE_PROFILE_RSVD1_MAX, "Unknown ZigBee Reserved" }, + + { ZBEE_PROFILE_IEEE_1451_5, ZBEE_PROFILE_IEEE_1451_5, "IEEE_1451_5" }, + + { ZBEE_PROFILE_MFR_SPEC_ORG_MIN, ZBEE_PROFILE_MFR_SPEC_ORG_MAX, + "Unallocated Manufacturer-Specific" }, + + { ZBEE_PROFILE_IEEE_1451_5, ZBEE_PROFILE_IEEE_1451_5, "IEEE_1451_5" }, + + /* Manufacturer Allocations */ + { ZBEE_PROFILE_CIRRONET_0_MIN, ZBEE_PROFILE_CIRRONET_0_MAX, ZBEE_MFG_CIRRONET }, + { ZBEE_PROFILE_CHIPCON_MIN, ZBEE_PROFILE_CHIPCON_MAX, ZBEE_MFG_CHIPCON }, + { ZBEE_PROFILE_EMBER_MIN, ZBEE_PROFILE_EMBER_MAX, ZBEE_MFG_EMBER }, + { ZBEE_PROFILE_NTS_MIN, ZBEE_PROFILE_NTS_MAX, ZBEE_MFG_CHIPCON }, + { ZBEE_PROFILE_FREESCALE_MIN, ZBEE_PROFILE_FREESCALE_MAX, ZBEE_MFG_FREESCALE }, + { ZBEE_PROFILE_IPCOM_MIN, ZBEE_PROFILE_IPCOM_MAX, ZBEE_MFG_IPCOM }, + { ZBEE_PROFILE_SAN_JUAN_MIN, ZBEE_PROFILE_SAN_JUAN_MAX, ZBEE_MFG_SAN_JUAN }, + { ZBEE_PROFILE_TUV_MIN, ZBEE_PROFILE_TUV_MAX, ZBEE_MFG_TUV }, + { ZBEE_PROFILE_COMPXS_MIN, ZBEE_PROFILE_COMPXS_MAX, ZBEE_MFG_COMPXS }, + { ZBEE_PROFILE_BM_MIN, ZBEE_PROFILE_BM_MAX, ZBEE_MFG_BM }, + { ZBEE_PROFILE_AWAREPOINT_MIN, ZBEE_PROFILE_AWAREPOINT_MAX, ZBEE_MFG_AWAREPOINT }, + { ZBEE_PROFILE_SAN_JUAN_1_MIN, ZBEE_PROFILE_SAN_JUAN_1_MAX, ZBEE_MFG_SAN_JUAN }, + { ZBEE_PROFILE_PHILIPS_MIN, ZBEE_PROFILE_PHILIPS_MAX, ZBEE_MFG_PHILIPS }, + { ZBEE_PROFILE_LUXOFT_MIN, ZBEE_PROFILE_LUXOFT_MAX, ZBEE_MFG_LUXOFT }, + { ZBEE_PROFILE_KORWIN_MIN, ZBEE_PROFILE_KORWIN_MAX, ZBEE_MFG_KORWIN }, + { ZBEE_PROFILE_1_RF_MIN, ZBEE_PROFILE_1_RF_MAX, ZBEE_MFG_1_RF }, + { ZBEE_PROFILE_STG_MIN, ZBEE_PROFILE_STG_MAX, ZBEE_MFG_STG }, + { ZBEE_PROFILE_TELEGESIS_MIN, ZBEE_PROFILE_TELEGESIS_MAX, ZBEE_MFG_TELEGESIS }, + { ZBEE_PROFILE_CIRRONET_1_MIN, ZBEE_PROFILE_CIRRONET_1_MAX, ZBEE_MFG_CIRRONET }, + { ZBEE_PROFILE_VISIONIC_MIN, ZBEE_PROFILE_VISIONIC_MAX, ZBEE_MFG_VISIONIC }, + { ZBEE_PROFILE_INSTA_MIN, ZBEE_PROFILE_INSTA_MAX, ZBEE_MFG_INSTA }, + { ZBEE_PROFILE_ATALUM_MIN, ZBEE_PROFILE_ATALUM_MAX, ZBEE_MFG_ATALUM }, + { ZBEE_PROFILE_ATMEL_MIN, ZBEE_PROFILE_ATMEL_MAX, ZBEE_MFG_ATMEL }, + { ZBEE_PROFILE_DEVELCO_MIN, ZBEE_PROFILE_DEVELCO_MAX, ZBEE_MFG_DEVELCO }, + { ZBEE_PROFILE_HONEYWELL_MIN, ZBEE_PROFILE_HONEYWELL_MAX, ZBEE_MFG_HONEYWELL }, + { ZBEE_PROFILE_NEC_MIN, ZBEE_PROFILE_NEC_MAX, ZBEE_MFG_NEC }, + { ZBEE_PROFILE_YAMATAKE_MIN, ZBEE_PROFILE_YAMATAKE_MAX, ZBEE_MFG_YAMATAKE }, + { ZBEE_PROFILE_TENDRIL_MIN, ZBEE_PROFILE_TENDRIL_MAX, ZBEE_MFG_TENDRIL }, + { ZBEE_PROFILE_ASSA_MIN, ZBEE_PROFILE_ASSA_MAX, ZBEE_MFG_ASSA }, + { ZBEE_PROFILE_MAXSTREAM_MIN, ZBEE_PROFILE_MAXSTREAM_MAX, ZBEE_MFG_MAXSTREAM }, + { ZBEE_PROFILE_XANADU_MIN, ZBEE_PROFILE_XANADU_MAX, ZBEE_MFG_XANADU }, + { ZBEE_PROFILE_NEUROCOM_MIN, ZBEE_PROFILE_NEUROCOM_MAX, ZBEE_MFG_NEUROCOM }, + { ZBEE_PROFILE_III_MIN, ZBEE_PROFILE_III_MAX, ZBEE_MFG_III }, + { ZBEE_PROFILE_VANTAGE_MIN, ZBEE_PROFILE_VANTAGE_MAX, ZBEE_MFG_VANTAGE }, + { ZBEE_PROFILE_ICONTROL_MIN, ZBEE_PROFILE_ICONTROL_MAX, ZBEE_MFG_ICONTROL }, + { ZBEE_PROFILE_RAYMARINE_MIN, ZBEE_PROFILE_RAYMARINE_MAX, ZBEE_MFG_RAYMARINE }, + { ZBEE_PROFILE_RENESAS_MIN, ZBEE_PROFILE_RENESAS_MAX, ZBEE_MFG_RENESAS }, + { ZBEE_PROFILE_LSR_MIN, ZBEE_PROFILE_LSR_MAX, ZBEE_MFG_LSR }, + { ZBEE_PROFILE_ONITY_MIN, ZBEE_PROFILE_ONITY_MAX, ZBEE_MFG_ONITY }, + { ZBEE_PROFILE_MONO_MIN, ZBEE_PROFILE_MONO_MAX, ZBEE_MFG_MONO }, + { ZBEE_PROFILE_RFT_MIN, ZBEE_PROFILE_RFT_MAX, ZBEE_MFG_RFT }, + { ZBEE_PROFILE_ITRON_MIN, ZBEE_PROFILE_ITRON_MAX, ZBEE_MFG_ITRON }, + { ZBEE_PROFILE_TRITECH_MIN, ZBEE_PROFILE_TRITECH_MAX, ZBEE_MFG_TRITECH }, + { ZBEE_PROFILE_EMBEDIT_MIN, ZBEE_PROFILE_EMBEDIT_MAX, ZBEE_MFG_EMBEDIT }, + { ZBEE_PROFILE_S3C_MIN, ZBEE_PROFILE_S3C_MAX, ZBEE_MFG_S3C }, + { ZBEE_PROFILE_SIEMENS_MIN, ZBEE_PROFILE_SIEMENS_MAX, ZBEE_MFG_SIEMENS }, + { ZBEE_PROFILE_MINDTECH_MIN, ZBEE_PROFILE_MINDTECH_MAX, ZBEE_MFG_MINDTECH }, + { ZBEE_PROFILE_LGE_MIN, ZBEE_PROFILE_LGE_MAX, ZBEE_MFG_LGE }, + { ZBEE_PROFILE_MITSUBISHI_MIN, ZBEE_PROFILE_MITSUBISHI_MAX, ZBEE_MFG_MITSUBISHI }, + { ZBEE_PROFILE_JOHNSON_MIN, ZBEE_PROFILE_JOHNSON_MAX, ZBEE_MFG_JOHNSON }, + { ZBEE_PROFILE_PRI_MIN, ZBEE_PROFILE_PRI_MAX, ZBEE_MFG_PRI }, + { ZBEE_PROFILE_KNICK_MIN, ZBEE_PROFILE_KNICK_MAX, ZBEE_MFG_KNICK }, + { ZBEE_PROFILE_VICONICS_MIN, ZBEE_PROFILE_VICONICS_MAX, ZBEE_MFG_VICONICS }, + { ZBEE_PROFILE_FLEXIPANEL_MIN, ZBEE_PROFILE_FLEXIPANEL_MAX, ZBEE_MFG_FLEXIPANEL }, + { ZBEE_PROFILE_TRANE_MIN, ZBEE_PROFILE_TRANE_MAX, ZBEE_MFG_TRANE }, + { ZBEE_PROFILE_JENNIC_MIN, ZBEE_PROFILE_JENNIC_MAX, ZBEE_MFG_JENNIC }, + { ZBEE_PROFILE_LIG_MIN, ZBEE_PROFILE_LIG_MAX, ZBEE_MFG_LIG }, + { ZBEE_PROFILE_ALERTME_MIN, ZBEE_PROFILE_ALERTME_MAX, ZBEE_MFG_ALERTME }, + { ZBEE_PROFILE_DAINTREE_MIN, ZBEE_PROFILE_DAINTREE_MAX, ZBEE_MFG_DAINTREE }, + { ZBEE_PROFILE_AIJI_MIN, ZBEE_PROFILE_AIJI_MAX, ZBEE_MFG_AIJI }, + { ZBEE_PROFILE_TEL_ITALIA_MIN, ZBEE_PROFILE_TEL_ITALIA_MAX, ZBEE_MFG_TEL_ITALIA }, + { ZBEE_PROFILE_MIKROKRETS_MIN, ZBEE_PROFILE_MIKROKRETS_MAX, ZBEE_MFG_MIKROKRETS }, + { ZBEE_PROFILE_OKI_MIN, ZBEE_PROFILE_OKI_MAX, ZBEE_MFG_OKI }, + { ZBEE_PROFILE_NEWPORT_MIN, ZBEE_PROFILE_NEWPORT_MAX, ZBEE_MFG_NEWPORT }, + + { ZBEE_PROFILE_C4_CL, ZBEE_PROFILE_C4_CL, ZBEE_MFG_C4 " Cluster Library"}, + { ZBEE_PROFILE_C4_MIN, ZBEE_PROFILE_C4_MAX, ZBEE_MFG_C4 }, + + { ZBEE_PROFILE_STM_MIN, ZBEE_PROFILE_STM_MAX, ZBEE_MFG_STM }, + { ZBEE_PROFILE_ASN_MIN, ZBEE_PROFILE_ASN_MAX, ZBEE_MFG_ASN }, + { ZBEE_PROFILE_DCSI_MIN, ZBEE_PROFILE_DCSI_MAX, ZBEE_MFG_DCSI }, + { ZBEE_PROFILE_FRANCE_TEL_MIN, ZBEE_PROFILE_FRANCE_TEL_MAX, ZBEE_MFG_FRANCE_TEL }, + { ZBEE_PROFILE_MUNET_MIN, ZBEE_PROFILE_MUNET_MAX, ZBEE_MFG_MUNET }, + { ZBEE_PROFILE_AUTANI_MIN, ZBEE_PROFILE_AUTANI_MAX, ZBEE_MFG_AUTANI }, + { ZBEE_PROFILE_COL_VNET_MIN, ZBEE_PROFILE_COL_VNET_MAX, ZBEE_MFG_COL_VNET }, + { ZBEE_PROFILE_AEROCOMM_MIN, ZBEE_PROFILE_AEROCOMM_MAX, ZBEE_MFG_AEROCOMM }, + { ZBEE_PROFILE_SI_LABS_MIN, ZBEE_PROFILE_SI_LABS_MAX, ZBEE_MFG_SI_LABS }, + { ZBEE_PROFILE_INNCOM_MIN, ZBEE_PROFILE_INNCOM_MAX, ZBEE_MFG_INNCOM }, + { ZBEE_PROFILE_CANNON_MIN, ZBEE_PROFILE_CANNON_MAX, ZBEE_MFG_CANNON }, + { ZBEE_PROFILE_SYNAPSE_MIN, ZBEE_PROFILE_SYNAPSE_MAX, ZBEE_MFG_SYNAPSE }, + { ZBEE_PROFILE_FPS_MIN, ZBEE_PROFILE_FPS_MAX, ZBEE_MFG_FPS }, + { ZBEE_PROFILE_CLS_MIN, ZBEE_PROFILE_CLS_MAX, ZBEE_MFG_CLS }, + { ZBEE_PROFILE_CRANE_MIN, ZBEE_PROFILE_CRANE_MAX, ZBEE_MFG_CRANE }, + { ZBEE_PROFILE_ASN_1_MIN, ZBEE_PROFILE_ASN_1_MAX, ZBEE_MFG_ASN }, + { ZBEE_PROFILE_MOBILARM_MIN, ZBEE_PROFILE_MOBILARM_MAX, ZBEE_MFG_MOBILARM }, + { ZBEE_PROFILE_IMONITOR_MIN, ZBEE_PROFILE_IMONITOR_MAX, ZBEE_MFG_IMONITOR }, + { ZBEE_PROFILE_BARTECH_MIN, ZBEE_PROFILE_BARTECH_MAX, ZBEE_MFG_BARTECH }, + { ZBEE_PROFILE_MESHNETICS_MIN, ZBEE_PROFILE_MESHNETICS_MAX, ZBEE_MFG_MESHNETICS }, + { ZBEE_PROFILE_LS_IND_MIN, ZBEE_PROFILE_LS_IND_MAX, ZBEE_MFG_LS_IND }, + { ZBEE_PROFILE_CASON_MIN, ZBEE_PROFILE_CASON_MAX, ZBEE_MFG_CASON }, + { ZBEE_PROFILE_WLESS_GLUE_MIN, ZBEE_PROFILE_WLESS_GLUE_MAX, ZBEE_MFG_WLESS_GLUE }, + { ZBEE_PROFILE_ELSTER_MIN, ZBEE_PROFILE_ELSTER_MAX, ZBEE_MFG_ELSTER }, + { ZBEE_PROFILE_ONSET_MIN, ZBEE_PROFILE_ONSET_MAX, ZBEE_MFG_ONSET }, + { ZBEE_PROFILE_RIGA_MIN, ZBEE_PROFILE_RIGA_MAX, ZBEE_MFG_RIGA }, + { ZBEE_PROFILE_ENERGATE_MIN, ZBEE_PROFILE_ENERGATE_MAX, ZBEE_MFG_ENERGATE }, + { ZBEE_PROFILE_VANTAGE_1_MIN, ZBEE_PROFILE_VANTAGE_1_MAX, ZBEE_MFG_VANTAGE }, + { ZBEE_PROFILE_CONMED_MIN, ZBEE_PROFILE_CONMED_MAX, ZBEE_MFG_CONMED }, + { ZBEE_PROFILE_SMS_TEC_MIN, ZBEE_PROFILE_SMS_TEC_MAX, ZBEE_MFG_SMS_TEC }, + { ZBEE_PROFILE_POWERMAND_MIN, ZBEE_PROFILE_POWERMAND_MAX, ZBEE_MFG_POWERMAND }, + { ZBEE_PROFILE_SCHNEIDER_MIN, ZBEE_PROFILE_SCHNEIDER_MAX, ZBEE_MFG_SCHNEIDER }, + { ZBEE_PROFILE_EATON_MIN, ZBEE_PROFILE_EATON_MAX, ZBEE_MFG_EATON }, + { ZBEE_PROFILE_TELULAR_MIN, ZBEE_PROFILE_TELULAR_MAX, ZBEE_MFG_TELULAR }, + { ZBEE_PROFILE_DELPHI_MIN, ZBEE_PROFILE_DELPHI_MAX, ZBEE_MFG_DELPHI }, + { ZBEE_PROFILE_EPISENSOR_MIN, ZBEE_PROFILE_EPISENSOR_MAX, ZBEE_MFG_EPISENSOR }, + { ZBEE_PROFILE_LANDIS_GYR_MIN, ZBEE_PROFILE_LANDIS_GYR_MAX, ZBEE_MFG_LANDIS_GYR }, + { ZBEE_PROFILE_SHURE_MIN, ZBEE_PROFILE_SHURE_MAX, ZBEE_MFG_SHURE }, + { ZBEE_PROFILE_COMVERGE_MIN, ZBEE_PROFILE_COMVERGE_MAX, ZBEE_MFG_COMVERGE }, + { ZBEE_PROFILE_KABA_MIN, ZBEE_PROFILE_KABA_MAX, ZBEE_MFG_KABA }, + { ZBEE_PROFILE_HIDALGO_MIN, ZBEE_PROFILE_HIDALGO_MAX, ZBEE_MFG_HIDALGO }, + { ZBEE_PROFILE_AIR2APP_MIN, ZBEE_PROFILE_AIR2APP_MAX, ZBEE_MFG_AIR2APP }, + { ZBEE_PROFILE_AMX_MIN, ZBEE_PROFILE_AMX_MAX, ZBEE_MFG_AMX }, + { ZBEE_PROFILE_EDMI_MIN, ZBEE_PROFILE_EDMI_MAX, ZBEE_MFG_EDMI }, + { ZBEE_PROFILE_CYAN_MIN, ZBEE_PROFILE_CYAN_MAX, ZBEE_MFG_CYAN }, + { ZBEE_PROFILE_SYS_SPA_MIN, ZBEE_PROFILE_SYS_SPA_MAX, ZBEE_MFG_SYS_SPA }, + { ZBEE_PROFILE_TELIT_MIN, ZBEE_PROFILE_TELIT_MAX, ZBEE_MFG_TELIT }, + { ZBEE_PROFILE_KAGA_MIN, ZBEE_PROFILE_KAGA_MAX, ZBEE_MFG_KAGA }, + { ZBEE_PROFILE_4_NOKS_MIN, ZBEE_PROFILE_4_NOKS_MAX, ZBEE_MFG_4_NOKS }, + + { 0, 0, NULL } +}; + +/* ZigBee Application Profile ID Abbreviations */ +const range_string zbee_aps_apid_abbrs[] = { + { ZBEE_DEVICE_PROFILE, ZBEE_DEVICE_PROFILE, "ZDP" }, + { ZBEE_PROFILE_IPM, ZBEE_PROFILE_IPM, "IPM" }, + { ZBEE_PROFILE_T1, ZBEE_PROFILE_T1, "T1" }, + { ZBEE_PROFILE_HA, ZBEE_PROFILE_HA, "HA" }, + { ZBEE_PROFILE_CBA, ZBEE_PROFILE_CBA, "CBA" }, + { ZBEE_PROFILE_WSN, ZBEE_PROFILE_WSN, "WSN" }, + { ZBEE_PROFILE_TA, ZBEE_PROFILE_TA, "TA" }, + { ZBEE_PROFILE_HC, ZBEE_PROFILE_HC, "HC" }, + { ZBEE_PROFILE_SE, ZBEE_PROFILE_SE, "SE" }, + { ZBEE_PROFILE_T2, ZBEE_PROFILE_T2, "T2" }, + + /* Manufacturer Allocations */ + { ZBEE_PROFILE_C4_MIN, ZBEE_PROFILE_C4_MAX, "C4" }, + + { 0, 0, NULL } +}; + +/* ZCL Cluster Names */ +/* BUGBUG: big enough to hash? */ +const value_string zbee_aps_cid_names[] = { + + /* General */ + { ZBEE_ZCL_CID_BASIC, "Basic"}, + { ZBEE_ZCL_CID_POWER_CONFIG, "Power Configuration"}, + { ZBEE_ZCL_CID_DEVICE_TEMP_CONFIG, "Device Temperature Configuration"}, + { ZBEE_ZCL_CID_IDENTIFY, "Identify"}, + { ZBEE_ZCL_CID_GROUPS, "Groups"}, + { ZBEE_ZCL_CID_SCENES, "Scenes"}, + { ZBEE_ZCL_CID_ON_OFF, "On/Off"}, + { ZBEE_ZCL_CID_ON_OFF_SWITCH_CONFIG, "On/Off Switch Configuration"}, + { ZBEE_ZCL_CID_LEVEL_CONTROL, "Level Control"}, + { ZBEE_ZCL_CID_ALARMS, "Alarms"}, + { ZBEE_ZCL_CID_TIME, "Time"}, + { ZBEE_ZCL_CID_RSSI_LOCATION, "RSSI Location"}, + { ZBEE_ZCL_CID_ANALOG_INPUT_BASIC, "Analog Input (Basic)"}, + { ZBEE_ZCL_CID_ANALOG_OUTPUT_BASIC, "Analog Output (Basic)"}, + { ZBEE_ZCL_CID_ANALOG_VALUE_BASIC, "Analog Value (Basic)"}, + { ZBEE_ZCL_CID_BINARY_INPUT_BASIC, "Binary Input (Basic)"}, + { ZBEE_ZCL_CID_BINARY_OUTPUT_BASIC, "Binary Output (Basic)"}, + { ZBEE_ZCL_CID_BINARY_VALUE_BASIC, "Binary Value (Basic)"}, + { ZBEE_ZCL_CID_MULTISTATE_INPUT_BASIC, "Multistate Input (Basic)"}, + { ZBEE_ZCL_CID_MULTISTATE_OUTPUT_BASIC, "Multistate Output (Basic)"}, + { ZBEE_ZCL_CID_MULTISTATE_VALUE_BASIC, "Multistate Value (Basic)"}, + { ZBEE_ZCL_CID_COMMISSIONING, "Commissioning"}, + +/* Closures */ + { ZBEE_ZCL_CID_SHADE_CONFIG, "Shade Configuration"}, + +/* HVAC */ + { ZBEE_ZCL_CID_PUMP_CONFIG_CONTROL, "Pump Configuration Control"}, + { ZBEE_ZCL_CID_THERMOSTAT, "Thermostat"}, + { ZBEE_ZCL_CID_FAN_CONTROL, "Fan Control"}, + { ZBEE_ZCL_CID_DEHUMIDIFICATION_CONTROL, "Dehumidification Control"}, + { ZBEE_ZCL_CID_THERMOSTAT_UI_CONFIG, "Thermostat User Interface Configuration"}, + +/* Lighting */ + { ZBEE_ZCL_CID_COLOR_CONTROL, "Color Control"}, + { ZBEE_ZCL_CID_BALLAST_CONFIG, "Ballast Configuration"}, + +/* Measurement and Sensing */ + { ZBEE_ZCL_CID_ILLUMINANCE_MEASUREMENT, "Illuminance Measurement"}, + { ZBEE_ZCL_CID_ILLUMINANCE_LEVEL_SENSING, "Illuminance Level Sensing"}, + { ZBEE_ZCL_CID_TEMPERATURE_MEASUREMENT, "Temperature Measurement"}, + { ZBEE_ZCL_CID_PRESSURE_MEASUREMENT, "Pressure Measurement"}, + { ZBEE_ZCL_CID_FLOW_MEASUREMENT, "Flow Measurement"}, + { ZBEE_ZCL_CID_REL_HUMIDITY_MEASUREMENT, "Relative Humidity Measurement"}, + { ZBEE_ZCL_CID_OCCUPANCY_SENSING, "Occupancy Sensing"}, + +/* Security and Safety */ + { ZBEE_ZCL_CID_IAS_ZONE, "Intruder Alarm System Zone"}, + { ZBEE_ZCL_CID_IAS_ACE, "Intruder Alarm System ACE"}, + { ZBEE_ZCL_CID_IAS_WD, "Intruder Alarm System WD"}, + +/* Protocol Interfaces */ + { ZBEE_ZCL_CID_GENERIC_TUNNEL, "BACnet Generic Tunnel"}, + { ZBEE_ZCL_CID_BACNET_PROTOCOL_TUNNEL, "BACnet Protocol Tunnel"}, + { ZBEE_ZCL_CID_BACNET_ANALOG_INPUT_REG, "BACnet Analog Input (Regular)"}, + { ZBEE_ZCL_CID_BACNET_ANALOG_INPUT_EXT, "BACnet Analog Input (Extended)"}, + { ZBEE_ZCL_CID_BACNET_ANALOG_OUTPUT_REG, "BACnet Analog Output (Regular)"}, + { ZBEE_ZCL_CID_BACNET_ANALOG_OUTPUT_EXT, "BACnet Analog Output (Extended)"}, + { ZBEE_ZCL_CID_BACNET_ANALOG_VALUE_REG, "BACnet Analog Value (Regular)"}, + { ZBEE_ZCL_CID_BACNET_ANALOG_VALUE_EXT, "BACnet Analog Value (Extended)"}, + { ZBEE_ZCL_CID_BACNET_BINARY_INPUT_REG, "BACnet Binary Input (Regular)"}, + { ZBEE_ZCL_CID_BACNET_BINARY_INPUT_EXT, "BACnet Binary Input (Extended)"}, + { ZBEE_ZCL_CID_BACNET_BINARY_OUTPUT_REG, "BACnet Binary Output (Regular)"}, + { ZBEE_ZCL_CID_BACNET_BINARY_OUTPUT_EXT, "BACnet Binary Output (Extended)"}, + { ZBEE_ZCL_CID_BACNET_BINARY_VALUE_REG, "BACnet Binary Value (Regular)"}, + { ZBEE_ZCL_CID_BACNET_BINARY_VALUE_EXT, "BACnet Binary Value (Extended)"}, + { ZBEE_ZCL_CID_BACNET_MULTISTATE_INPUT_REG, "BACnet Multistage Input (Regular)"}, + { ZBEE_ZCL_CID_BACNET_MULTISTATE_INPUT_EXT, "BACnet Multistage Input (Extended)"}, + { ZBEE_ZCL_CID_BACNET_MULTISTATE_OUTPUT_REG, "BACnet Multistage Output (Regular)"}, + { ZBEE_ZCL_CID_BACNET_MULTISTATE_OUTPUT_EXT, "BACnet Multistage Output (Extended)"}, + { ZBEE_ZCL_CID_BACNET_MULTISTATE_VALUE_REG, "BACnet Multistage Value (Regular)"}, + { ZBEE_ZCL_CID_BACNET_MULTISTATE_VALUE_EXT, "BACnet Multistage Value (Extended)"}, + +/* Smart Energy */ + { ZBEE_ZCL_CID_PRICE, "Price"}, + { ZBEE_ZCL_CID_DEMAND_RESPONSE_LOAD_CONTROL, "Demand Response and Load Control"}, + { ZBEE_ZCL_CID_SIMPLE_METERING, "Simple Metering"}, + { ZBEE_ZCL_CID_MESSAGE, "Message"}, + { ZBEE_ZCL_CID_SMART_ENERGY_TUNNELING, "Smart Energy Tunneling"}, + { ZBEE_ZCL_CID_PRE_PAYMENT, "Pre-Payment"}, + + { 0, NULL } +}; + /*FUNCTION:------------------------------------------------------ * NAME * dissect_zbee_aps @@ -462,10 +718,8 @@ dissect_zbee_aps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Cluster ID is 8-bits long in ZigBee 2004 and earlier. */ pinfo->zbee_cluster_id = packet.cluster = tvb_get_guint8(tvb, offset); if (tree) { -#if 0 - proto_tree_add_uint(aps_tree, hf_zbee_aps_cluster, tvb, offset, sizeof(guint8), packet.cluster); -#endif - proto_tree_add_uint_format_value(aps_tree, hf_zbee_aps_cluster, tvb, offset, sizeof(guint8), packet.cluster, "0x%02x", packet.cluster); + proto_tree_add_uint_format_value(aps_tree, hf_zbee_aps_cluster, tvb, offset, + sizeof(guint8), packet.cluster, "0x%02x", packet.cluster); } offset += sizeof(guint8); } @@ -474,11 +728,8 @@ dissect_zbee_aps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) packet.profile = tvb_get_letohs(tvb, offset); profile_handle = dissector_get_port_handle(zbee_aps_dissector_table, packet.profile); if (tree) { - ti = proto_tree_add_uint(aps_tree, hf_zbee_aps_profile, tvb, offset, sizeof(guint16), packet.profile); - if (profile_handle) { - int proto = dissector_handle_get_protocol_index(profile_handle); - proto_item_append_text(ti, " (%s)", proto_get_protocol_name(proto)); - } + ti = proto_tree_add_uint(aps_tree, hf_zbee_aps_profile, tvb, offset, sizeof(guint16), + packet.profile); offset += sizeof(guint16); /* Update the protocol root and info column later, after the source endpoint * so that the source and destination will be back-to-back in the text. @@ -502,11 +753,9 @@ dissect_zbee_aps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Display the profile ID now that the source endpoint was listed. */ if (packet.type == ZBEE_APS_FCF_DATA) { - if (tree) { - proto_item_append_text(proto_root, ", Profile: 0x%04x", packet.profile); - } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Profile: 0x%04x", packet.profile); + if (check_col(pinfo->cinfo, COL_PROTOCOL)) { + col_append_fstr(pinfo->cinfo, COL_PROTOCOL, " %s", + rval_to_str(packet.profile, zbee_aps_apid_abbrs, "")); } } @@ -584,7 +833,7 @@ dissect_zbee_aps_no_endpt: payload_tvb = tvb_new_subset(tvb, offset, -1, -1); } - /* If the payload exstists, and the packet is fragmented, attempt reassembly. */ + /* If the payload exists, and the packet is fragmented, attempt reassembly. */ if ((payload_tvb) && (packet.fragmentation != ZBEE_APS_EXT_FCF_FRAGMENT_NONE)) { guint32 msg_id; guint32 block_num; @@ -1552,12 +1801,12 @@ void proto_register_zbee_aps(void) NULL, HFILL }}, { &hf_zbee_aps_cluster, - { "Cluster", "zbee.aps.cluster", FT_UINT16, BASE_HEX, NULL, 0x0, - NULL, HFILL }}, + { "Cluster", "zbee.aps.cluster", FT_UINT16, BASE_HEX, + VALS(zbee_aps_cid_names), 0x0, NULL, HFILL }}, { &hf_zbee_aps_profile, - { "Profile", "zbee.aps.profile", FT_UINT16, BASE_HEX, NULL, 0x0, - NULL, HFILL }}, + { "Profile", "zbee.aps.profile", FT_UINT16, BASE_HEX | BASE_RANGE_STRING, + RVALS(zbee_aps_apid_names), 0x0, NULL, HFILL }}, { &hf_zbee_aps_src, { "Source Endpoint", "zbee.aps.src", FT_UINT8, BASE_DEC, NULL, 0x0, @@ -1612,8 +1861,8 @@ void proto_register_zbee_aps(void) NULL, HFILL }}, { &hf_zbee_aps_cmd_key_type, - { "Key Type", "zbee.aps.cmd.key_type", FT_UINT8, BASE_HEX, VALS(zbee_aps_key_names), 0x0, - NULL, HFILL }}, + { "Key Type", "zbee.aps.cmd.key_type", FT_UINT8, BASE_HEX, + VALS(zbee_aps_key_names), 0x0, NULL, HFILL }}, { &hf_zbee_aps_cmd_dst, { "Destination Address", "zbee.aps.cmd.dst", FT_UINT64, BASE_HEX, NULL, 0x0, @@ -1632,11 +1881,13 @@ void proto_register_zbee_aps(void) "The device whose status is being updated.", HFILL }}, { &hf_zbee_aps_cmd_device_status, - { "Device Status", "zbee.aps.cmd.status", FT_UINT8, BASE_HEX, VALS(zbee_aps_update_status_names), 0x0, + { "Device Status", "zbee.aps.cmd.status", FT_UINT8, BASE_HEX, + VALS(zbee_aps_update_status_names), 0x0, "Update device status.", HFILL }}, { &hf_zbee_aps_cmd_ea_key_type, - { "Key Type", "zbee.aps.cmd.ea.key_type", FT_UINT8, BASE_HEX, VALS(zbee_aps_ea_key_names), 0x0, + { "Key Type", "zbee.aps.cmd.ea.key_type", FT_UINT8, BASE_HEX, + VALS(zbee_aps_ea_key_names), 0x0, NULL, HFILL }}, { &hf_zbee_aps_cmd_ea_data, @@ -1682,8 +1933,8 @@ void proto_register_zbee_aps(void) NULL, HFILL }}, { &hf_zbee_apf_type, - { "Type", "zbee.app.type", FT_UINT8, BASE_HEX, VALS(zbee_apf_type_names), 0x0, - NULL, HFILL }} + { "Type", "zbee.app.type", FT_UINT8, BASE_HEX, + VALS(zbee_apf_type_names), 0x0, NULL, HFILL }} }; /* APS subtrees */ diff --git a/epan/dissectors/packet-zbee-aps.h b/epan/dissectors/packet-zbee-aps.h index 3b65bd5a80..eb106d81e2 100644 --- a/epan/dissectors/packet-zbee-aps.h +++ b/epan/dissectors/packet-zbee-aps.h @@ -55,6 +55,7 @@ typedef struct{ gboolean src_present; } zbee_aps_packet; +/* ZigBee APS */ #define ZBEE_APS_FCF_FRAME_TYPE 0x03 #define ZBEE_APS_FCF_DELIVERY_MODE 0x0c #define ZBEE_APS_FCF_INDIRECT_MODE 0x10 /* ZigBee 2004 and earlier. */ @@ -151,4 +152,86 @@ typedef struct{ #define ZBEE_APP_KVP_OVERHEAD 4 +/* ZCL Cluster IDs - General */ +#define ZBEE_ZCL_CID_BASIC 0x0000 +#define ZBEE_ZCL_CID_POWER_CONFIG 0x0001 +#define ZBEE_ZCL_CID_DEVICE_TEMP_CONFIG 0x0002 +#define ZBEE_ZCL_CID_IDENTIFY 0x0003 +#define ZBEE_ZCL_CID_GROUPS 0x0004 +#define ZBEE_ZCL_CID_SCENES 0x0005 +#define ZBEE_ZCL_CID_ON_OFF 0x0006 +#define ZBEE_ZCL_CID_ON_OFF_SWITCH_CONFIG 0x0007 +#define ZBEE_ZCL_CID_LEVEL_CONTROL 0x0008 +#define ZBEE_ZCL_CID_ALARMS 0x0009 +#define ZBEE_ZCL_CID_TIME 0x000a +#define ZBEE_ZCL_CID_RSSI_LOCATION 0x000b +#define ZBEE_ZCL_CID_ANALOG_INPUT_BASIC 0x000c +#define ZBEE_ZCL_CID_ANALOG_OUTPUT_BASIC 0x000d +#define ZBEE_ZCL_CID_ANALOG_VALUE_BASIC 0x000e +#define ZBEE_ZCL_CID_BINARY_INPUT_BASIC 0x000f +#define ZBEE_ZCL_CID_BINARY_OUTPUT_BASIC 0x0010 +#define ZBEE_ZCL_CID_BINARY_VALUE_BASIC 0x0011 +#define ZBEE_ZCL_CID_MULTISTATE_INPUT_BASIC 0x0012 +#define ZBEE_ZCL_CID_MULTISTATE_OUTPUT_BASIC 0x0013 +#define ZBEE_ZCL_CID_MULTISTATE_VALUE_BASIC 0x0014 +#define ZBEE_ZCL_CID_COMMISSIONING 0x0015 + +/* ZCL Cluster IDs - Closures */ +#define ZBEE_ZCL_CID_SHADE_CONFIG 0x0100 + +/* ZCL Cluster IDs - HVAC */ +#define ZBEE_ZCL_CID_PUMP_CONFIG_CONTROL 0x0200 +#define ZBEE_ZCL_CID_THERMOSTAT 0x0201 +#define ZBEE_ZCL_CID_FAN_CONTROL 0x0202 +#define ZBEE_ZCL_CID_DEHUMIDIFICATION_CONTROL 0x0203 +#define ZBEE_ZCL_CID_THERMOSTAT_UI_CONFIG 0x0204 + +/* ZCL Cluster IDs - Lighting */ +#define ZBEE_ZCL_CID_COLOR_CONTROL 0x0300 +#define ZBEE_ZCL_CID_BALLAST_CONFIG 0x0301 + +/* ZCL Cluster IDs - Measurement and Sensing */ +#define ZBEE_ZCL_CID_ILLUMINANCE_MEASUREMENT 0x0400 +#define ZBEE_ZCL_CID_ILLUMINANCE_LEVEL_SENSING 0x0401 +#define ZBEE_ZCL_CID_TEMPERATURE_MEASUREMENT 0x0402 +#define ZBEE_ZCL_CID_PRESSURE_MEASUREMENT 0x0403 +#define ZBEE_ZCL_CID_FLOW_MEASUREMENT 0x0404 +#define ZBEE_ZCL_CID_REL_HUMIDITY_MEASUREMENT 0x0405 +#define ZBEE_ZCL_CID_OCCUPANCY_SENSING 0x0406 + +/* ZCL Cluster IDs - Security and Safety */ +#define ZBEE_ZCL_CID_IAS_ZONE 0x0500 +#define ZBEE_ZCL_CID_IAS_ACE 0x0501 +#define ZBEE_ZCL_CID_IAS_WD 0x0502 + +/* ZCL Cluster IDs - Protocol Interfaces */ +#define ZBEE_ZCL_CID_GENERIC_TUNNEL 0x0600 +#define ZBEE_ZCL_CID_BACNET_PROTOCOL_TUNNEL 0x0601 +#define ZBEE_ZCL_CID_BACNET_ANALOG_INPUT_REG 0x0602 +#define ZBEE_ZCL_CID_BACNET_ANALOG_INPUT_EXT 0x0603 +#define ZBEE_ZCL_CID_BACNET_ANALOG_OUTPUT_REG 0x0604 +#define ZBEE_ZCL_CID_BACNET_ANALOG_OUTPUT_EXT 0x0605 +#define ZBEE_ZCL_CID_BACNET_ANALOG_VALUE_REG 0x0606 +#define ZBEE_ZCL_CID_BACNET_ANALOG_VALUE_EXT 0x0607 +#define ZBEE_ZCL_CID_BACNET_BINARY_INPUT_REG 0x0608 +#define ZBEE_ZCL_CID_BACNET_BINARY_INPUT_EXT 0x0609 +#define ZBEE_ZCL_CID_BACNET_BINARY_OUTPUT_REG 0x060a +#define ZBEE_ZCL_CID_BACNET_BINARY_OUTPUT_EXT 0x060b +#define ZBEE_ZCL_CID_BACNET_BINARY_VALUE_REG 0x060c +#define ZBEE_ZCL_CID_BACNET_BINARY_VALUE_EXT 0x060d +#define ZBEE_ZCL_CID_BACNET_MULTISTATE_INPUT_REG 0x060e +#define ZBEE_ZCL_CID_BACNET_MULTISTATE_INPUT_EXT 0x060f +#define ZBEE_ZCL_CID_BACNET_MULTISTATE_OUTPUT_REG 0x0610 +#define ZBEE_ZCL_CID_BACNET_MULTISTATE_OUTPUT_EXT 0x0611 +#define ZBEE_ZCL_CID_BACNET_MULTISTATE_VALUE_REG 0x0612 +#define ZBEE_ZCL_CID_BACNET_MULTISTATE_VALUE_EXT 0x0613 + +/* ZCL Cluster IDs - Smart Energy */ +#define ZBEE_ZCL_CID_PRICE 0x0700 +#define ZBEE_ZCL_CID_DEMAND_RESPONSE_LOAD_CONTROL 0x0701 +#define ZBEE_ZCL_CID_SIMPLE_METERING 0x0702 +#define ZBEE_ZCL_CID_MESSAGE 0x0703 +#define ZBEE_ZCL_CID_SMART_ENERGY_TUNNELING 0x0704 +#define ZBEE_ZCL_CID_PRE_PAYMENT 0x0705 + #endif /* PACKET_ZBEE_APS_H*/ diff --git a/epan/dissectors/packet-zbee-nwk.c b/epan/dissectors/packet-zbee-nwk.c index eb3be1bbd0..48c172b6fc 100644 --- a/epan/dissectors/packet-zbee-nwk.c +++ b/epan/dissectors/packet-zbee-nwk.c @@ -1163,7 +1163,7 @@ dissect_zbee_nwk_link_status(tvbuff_t *tvb, proto_tree *tree, guint offset) addr = tvb_get_letohs(tvb, offset); options = tvb_get_guint8(tvb, offset+sizeof(guint16)); if (tree) { - proto_tree_add_text(tree, tvb, offset, sizeof(guint16)+sizeof(guint8), "0x%04x, Incomming Cost: %d Outgoing Cost: %d", addr, options & ZBEE_NWK_CMD_LINK_INCOMMING_COST_MASK, (options & ZBEE_NWK_CMD_LINK_OUTGOING_COST_MASK)>>4); + proto_tree_add_text(tree, tvb, offset, sizeof(guint16)+sizeof(guint8), "0x%04x, Incoming Cost: %d Outgoing Cost: %d", addr, options & ZBEE_NWK_CMD_LINK_INCOMMING_COST_MASK, (options & ZBEE_NWK_CMD_LINK_OUTGOING_COST_MASK)>>4); } offset += (sizeof(guint16)+sizeof(guint8)); } /* for */ diff --git a/epan/dissectors/packet-zbee-zcl.c b/epan/dissectors/packet-zbee-zcl.c new file mode 100644 index 0000000000..5963499352 --- /dev/null +++ b/epan/dissectors/packet-zbee-zcl.c @@ -0,0 +1,2177 @@ +/* packet-zbee-zcl.c + * Dissector routines for the ZigBee Cluster Library (ZCL) + * By Fred Fierling <fff@exegin.com> + * Copyright 2009 Exegin Technologies Limited + * + * $Id:$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * Used Owen Kirby's packet-zbee-aps module as a template. Based + * on ZigBee Cluster Library Specification document 075123r02ZB + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Include Files */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif /* HAVEHCONFIG_H */ + +#include <string.h> +#include <stdlib.h> +#include <glib.h> +#include <gmodule.h> +#include <epan/packet.h> +#include <epan/prefs.h> +#include <epan/expert.h> +#include <epan/reassemble.h> + +#include "packet-zbee.h" +#include "packet-zbee-zcl.h" + +/************************* + * Function Declarations * + ************************* + */ +/* Protocol Registration */ +void proto_init_zbee_zcl (void); + +/* Dissector Routines */ +void dissect_zbee_zcl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); + +/* Command Dissector Helpers */ +void dissect_zcl_read_attr (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset); +void dissect_zcl_read_attr_resp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, + guint *offset); +void dissect_zcl_write_attr (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset); +void dissect_zcl_write_attr_resp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, + guint *offset); +void dissect_zcl_write_attr_undivided (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, + guint *offset); +void dissect_zcl_write_attr_no_resp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, + guint *offset); +void dissect_zcl_config_report (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset); +void dissect_zcl_config_report_resp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, + guint *offset); +void dissect_zcl_read_report_config (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, + guint *offset); +void dissect_zcl_read_report_config_resp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, + guint *offset); +void dissect_zcl_report_attr (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset); +void dissect_zcl_default_resp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset); +void dissect_zcl_discover_attr (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset); +void dissect_zcl_discover_attr_resp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, + guint *offset); +void dissect_zcl_read_attr_struct (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, + guint *offset); +void dissect_zcl_write_attr_struct (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, + guint offset); +void dissect_zcl_write_attr_struct_resp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, + guint offset); + +/* Helper routines */ +guint zbee_apf_transaction_len (tvbuff_t *tvb, guint offset, guint8 type); +void dissect_zcl_attr_data_type_val (tvbuff_t *tvb, proto_tree *tree, guint *offset); +guint dissect_zcl_attr_data_type (tvbuff_t *tvb, proto_tree *tree, guint *offset); +void dissect_zcl_attr_data (tvbuff_t *tvb, proto_tree *tree, guint *offset, guint data_type); +void dissect_zcl_attr_bytes (tvbuff_t *tvb, proto_tree *tree, guint *offset, guint length); +guint dissect_zcl_attr_uint8 (tvbuff_t *tvb, proto_tree *tree, guint *offset, int *length); +guint dissect_zcl_attr_uint16 (tvbuff_t *tvb, proto_tree *tree, guint *offset, int *length); +void dissect_zcl_attr_id (tvbuff_t *tvb, proto_tree *tree, guint *offset); +void dissect_zcl_big_int (tvbuff_t *tvb, proto_tree *tree, guint *offset, guint length, + gboolean signed_flag); +void zcl_dump_data(tvbuff_t *tvb, guint offset, packet_info *pinfo, proto_tree *tree); + +guint64 tvb_get_letohi (tvbuff_t *tvb, guint offset, guint length, gboolean signed_flag); + +/******************** + * Global Variables * + ******************** + */ +/* Header Field Indices. */ +static int proto_zbee_zcl = -1; +static int hf_zbee_zcl_fcf_frame_type = -1; +static int hf_zbee_zcl_fcf_mfr_spec = -1; +static int hf_zbee_zcl_fcf_dir = -1; +static int hf_zbee_zcl_fcf_disable_default_resp = -1; +static int hf_zbee_zcl_mfr_code = -1; +static int hf_zbee_zcl_tran_seqno = -1; + +static int hf_zbee_zcl_cmd_id = -1; +static int hf_zbee_zcl_cs_cmd_id = -1; +static int hf_zbee_zcl_attr_id = -1; +static int hf_zbee_zcl_attr_data_type = -1; +static int hf_zbee_zcl_attr_boolean = -1; +static int hf_zbee_zcl_attr_uint8 = -1; +static int hf_zbee_zcl_attr_uint16 = -1; +static int hf_zbee_zcl_attr_uint24 = -1; +static int hf_zbee_zcl_attr_uint32 = -1; +static int hf_zbee_zcl_attr_uint64 = -1; +static int hf_zbee_zcl_attr_int8 = -1; +static int hf_zbee_zcl_attr_int16 = -1; +static int hf_zbee_zcl_attr_int24 = -1; +static int hf_zbee_zcl_attr_int32 = -1; +static int hf_zbee_zcl_attr_int64 = -1; +static int hf_zbee_zcl_attr_semi = -1; +static int hf_zbee_zcl_attr_float = -1; +static int hf_zbee_zcl_attr_double = -1; +static int hf_zbee_zcl_attr_bytes = -1; +static int hf_zbee_zcl_attr_minint = -1; +static int hf_zbee_zcl_attr_maxint = -1; +static int hf_zbee_zcl_attr_timeout = -1; +static int hf_zbee_zcl_attr_cid = -1; +static int hf_zbee_zcl_attr_hours = -1; +static int hf_zbee_zcl_attr_mins = -1; +static int hf_zbee_zcl_attr_secs = -1; +static int hf_zbee_zcl_attr_csecs = -1; +static int hf_zbee_zcl_attr_yy = -1; +static int hf_zbee_zcl_attr_mm = -1; +static int hf_zbee_zcl_attr_md = -1; +static int hf_zbee_zcl_attr_wd = -1; +static int hf_zbee_zcl_attr_utc = -1; +static int hf_zbee_zcl_attr_status = -1; +static int hf_zbee_zcl_attr_dir = -1; +static int hf_zbee_zcl_attr_dis = -1; +static int hf_zbee_zcl_attr_start = -1; +static int hf_zbee_zcl_attr_maxnum = -1; +static int hf_zbee_zcl_attr_str_len = -1; +static int hf_zbee_zcl_attr_str = -1; +static int hf_zbee_zcl_attr_ostr = -1; + +/* Subtree indices. */ +static gint ett_zbee_zcl = -1; +static gint ett_zbee_zcl_fcf = -1; +static gint ett_zbee_zcl_attr[ZBEE_ZCL_NUM_ATTR_ETT]; + +/* Dissector Handles. */ +static dissector_handle_t data_handle; +static dissector_handle_t zbee_zcl_handle; + +/********************/ +/* Field Names */ +/********************/ +/* Frame Type Names */ +const value_string zbee_zcl_frame_types[] = { + { ZBEE_ZCL_FCF_PROFILE_WIDE, "Profile-wide" }, + { ZBEE_ZCL_FCF_CLUSTER_SPEC, "Cluster-specific" }, + { 0, NULL } +}; + +/* ZCL Command Names */ +const value_string zbee_zcl_cmd_names[] = { + { ZBEE_ZCL_CMD_READ_ATTR, "Read Attributes" }, + { ZBEE_ZCL_CMD_READ_ATTR_RESP, "Read Attributes Response" }, + { ZBEE_ZCL_CMD_WRITE_ATTR, "Write Attributes" }, + { ZBEE_ZCL_CMD_WRITE_ATTR_UNDIVIDED, "Write Attributes Undivided" }, + { ZBEE_ZCL_CMD_WRITE_ATTR_RESP, "Write Attributes Response" }, + { ZBEE_ZCL_CMD_WRITE_ATTR_NO_RESP, "Write Attributes No Response" }, + { ZBEE_ZCL_CMD_CONFIG_REPORT, "Configure Reporting" }, + { ZBEE_ZCL_CMD_CONFIG_REPORT_RESP, "Configure Reporting Response" }, + { ZBEE_ZCL_CMD_READ_REPORT_CONFIG, "Read Reporting Configuration" }, + { ZBEE_ZCL_CMD_READ_REPORT_CONFIG_RESP, "Read Reporting Configuration Response" }, + { ZBEE_ZCL_CMD_REPORT_ATTR, "Report Attributes" }, + { ZBEE_ZCL_CMD_DEFAULT_RESP, "Default Response" }, + { ZBEE_ZCL_CMD_DISCOVER_ATTR, "Discover Attributes" }, + { ZBEE_ZCL_CMD_DISCOVER_ATTR_RESP, "Discover Attributes Response" }, + { ZBEE_ZCL_CMD_READ_ATTR_STRUCT, "Read Attributes Structured" }, + { ZBEE_ZCL_CMD_WRITE_ATTR_STRUCT, "Write Attributes Structured" }, + { ZBEE_ZCL_CMD_WRITE_ATTR_STRUCT_RESP, "Write Attributes Structured Response" }, + + { 0, NULL } +}; + +/* Manufacturer Name Table */ +const value_string zbee_mfr_code_names[] = { + + { ZBEE_MFG_CODE_CIRRONET, ZBEE_MFG_CIRRONET }, + { ZBEE_MFG_CODE_CHIPCON, ZBEE_MFG_CHIPCON }, + { ZBEE_MFG_CODE_EMBER, ZBEE_MFG_EMBER }, + { ZBEE_MFG_CODE_NTS, ZBEE_MFG_NTS }, + { ZBEE_MFG_CODE_FREESCALE, ZBEE_MFG_FREESCALE }, + { ZBEE_MFG_CODE_IPCOM, ZBEE_MFG_IPCOM }, + { ZBEE_MFG_CODE_SAN_JUAN, ZBEE_MFG_SAN_JUAN }, + { ZBEE_MFG_CODE_TUV, ZBEE_MFG_TUV }, + { ZBEE_MFG_CODE_COMPXS, ZBEE_MFG_COMPXS }, + { ZBEE_MFG_CODE_BM, ZBEE_MFG_BM }, + { ZBEE_MFG_CODE_AWAREPOINT, ZBEE_MFG_AWAREPOINT }, + { ZBEE_MFG_CODE_PHILIPS, ZBEE_MFG_PHILIPS }, + { ZBEE_MFG_CODE_LUXOFT, ZBEE_MFG_LUXOFT }, + { ZBEE_MFG_CODE_KORWIN, ZBEE_MFG_KORWIN }, + { ZBEE_MFG_CODE_1_RF, ZBEE_MFG_1_RF }, + { ZBEE_MFG_CODE_STG, ZBEE_MFG_STG }, + { ZBEE_MFG_CODE_TELEGESIS, ZBEE_MFG_TELEGESIS }, + { ZBEE_MFG_CODE_VISIONIC, ZBEE_MFG_VISIONIC }, + { ZBEE_MFG_CODE_INSTA, ZBEE_MFG_INSTA }, + { ZBEE_MFG_CODE_ATALUM, ZBEE_MFG_ATALUM }, + { ZBEE_MFG_CODE_ATMEL, ZBEE_MFG_ATMEL }, + { ZBEE_MFG_CODE_DEVELCO, ZBEE_MFG_DEVELCO }, + { ZBEE_MFG_CODE_HONEYWELL, ZBEE_MFG_HONEYWELL }, + /**/ + { ZBEE_MFG_CODE_RENESAS, ZBEE_MFG_RENESAS }, + { ZBEE_MFG_CODE_XANADU, ZBEE_MFG_XANADU }, + { ZBEE_MFG_CODE_NEC, ZBEE_MFG_NEC }, + { ZBEE_MFG_CODE_YAMATAKE, ZBEE_MFG_YAMATAKE }, + { ZBEE_MFG_CODE_TENDRIL, ZBEE_MFG_TENDRIL }, + { ZBEE_MFG_CODE_ASSA, ZBEE_MFG_ASSA }, + { ZBEE_MFG_CODE_MAXSTREAM, ZBEE_MFG_MAXSTREAM }, + { ZBEE_MFG_CODE_NEUROCOM, ZBEE_MFG_NEUROCOM }, + + { ZBEE_MFG_CODE_III, ZBEE_MFG_III }, + { ZBEE_MFG_CODE_VANTAGE, ZBEE_MFG_VANTAGE }, + { ZBEE_MFG_CODE_ICONTROL, ZBEE_MFG_ICONTROL }, + { ZBEE_MFG_CODE_RAYMARINE, ZBEE_MFG_RAYMARINE }, + { ZBEE_MFG_CODE_LSR, ZBEE_MFG_LSR }, + { ZBEE_MFG_CODE_ONITY, ZBEE_MFG_ONITY }, + { ZBEE_MFG_CODE_MONO, ZBEE_MFG_MONO }, + { ZBEE_MFG_CODE_RFT, ZBEE_MFG_RFT }, + { ZBEE_MFG_CODE_ITRON, ZBEE_MFG_ITRON }, + { ZBEE_MFG_CODE_TRITECH, ZBEE_MFG_TRITECH }, + { ZBEE_MFG_CODE_EMBEDIT, ZBEE_MFG_EMBEDIT }, + { ZBEE_MFG_CODE_S3C, ZBEE_MFG_S3C }, + { ZBEE_MFG_CODE_SIEMENS, ZBEE_MFG_SIEMENS }, + { ZBEE_MFG_CODE_MINDTECH, ZBEE_MFG_MINDTECH }, + { ZBEE_MFG_CODE_LGE, ZBEE_MFG_LGE }, + { ZBEE_MFG_CODE_MITSUBISHI, ZBEE_MFG_MITSUBISHI }, + + { ZBEE_MFG_CODE_JOHNSON, ZBEE_MFG_JOHNSON }, + { ZBEE_MFG_CODE_PRI, ZBEE_MFG_PRI }, + { ZBEE_MFG_CODE_KNICK, ZBEE_MFG_KNICK }, + { ZBEE_MFG_CODE_VICONICS, ZBEE_MFG_VICONICS }, + { ZBEE_MFG_CODE_FLEXIPANEL, ZBEE_MFG_FLEXIPANEL }, + /**/ + { ZBEE_MFG_CODE_TRANE, ZBEE_MFG_TRANE }, + { ZBEE_MFG_CODE_JENNIC, ZBEE_MFG_JENNIC }, + { ZBEE_MFG_CODE_LIG, ZBEE_MFG_LIG }, + { ZBEE_MFG_CODE_ALERTME, ZBEE_MFG_ALERTME }, + { ZBEE_MFG_CODE_DAINTREE, ZBEE_MFG_DAINTREE }, + { ZBEE_MFG_CODE_AIJI, ZBEE_MFG_AIJI }, + { ZBEE_MFG_CODE_TEL_ITALIA, ZBEE_MFG_TEL_ITALIA }, + { ZBEE_MFG_CODE_MIKROKRETS, ZBEE_MFG_MIKROKRETS }, + { ZBEE_MFG_CODE_OKI, ZBEE_MFG_OKI }, + { ZBEE_MFG_CODE_NEWPORT, ZBEE_MFG_NEWPORT }, + + { ZBEE_MFG_CODE_C4, ZBEE_MFG_C4 }, + { ZBEE_MFG_CODE_STM, ZBEE_MFG_STM }, + { ZBEE_MFG_CODE_ASN, ZBEE_MFG_ASN }, + { ZBEE_MFG_CODE_DCSI, ZBEE_MFG_DCSI }, + { ZBEE_MFG_CODE_FRANCE_TEL, ZBEE_MFG_FRANCE_TEL }, + { ZBEE_MFG_CODE_MUNET, ZBEE_MFG_MUNET }, + { ZBEE_MFG_CODE_AUTANI, ZBEE_MFG_AUTANI }, + { ZBEE_MFG_CODE_COL_VNET, ZBEE_MFG_COL_VNET }, + { ZBEE_MFG_CODE_AEROCOMM, ZBEE_MFG_AEROCOMM }, + { ZBEE_MFG_CODE_SI_LABS, ZBEE_MFG_SI_LABS }, + { ZBEE_MFG_CODE_INNCOM, ZBEE_MFG_INNCOM }, + { ZBEE_MFG_CODE_CANNON, ZBEE_MFG_CANNON }, + { ZBEE_MFG_CODE_SYNAPSE, ZBEE_MFG_SYNAPSE }, + { ZBEE_MFG_CODE_FPS, ZBEE_MFG_FPS }, + { ZBEE_MFG_CODE_CLS, ZBEE_MFG_CLS }, + { ZBEE_MFG_CODE_CRANE, ZBEE_MFG_CRANE }, + + { ZBEE_MFG_CODE_MOBILARM, ZBEE_MFG_MOBILARM }, + { ZBEE_MFG_CODE_IMONITOR, ZBEE_MFG_IMONITOR }, + { ZBEE_MFG_CODE_BARTECH, ZBEE_MFG_BARTECH }, + { ZBEE_MFG_CODE_MESHNETICS, ZBEE_MFG_MESHNETICS }, + { ZBEE_MFG_CODE_LS_IND, ZBEE_MFG_LS_IND }, + { ZBEE_MFG_CODE_CASON, ZBEE_MFG_CASON }, + { ZBEE_MFG_CODE_WLESS_GLUE, ZBEE_MFG_WLESS_GLUE }, + { ZBEE_MFG_CODE_ELSTER, ZBEE_MFG_ELSTER }, + { ZBEE_MFG_CODE_SMS_TEC, ZBEE_MFG_SMS_TEC }, + { ZBEE_MFG_CODE_ONSET, ZBEE_MFG_ONSET }, + { ZBEE_MFG_CODE_RIGA, ZBEE_MFG_RIGA }, + { ZBEE_MFG_CODE_ENERGATE, ZBEE_MFG_ENERGATE }, + { ZBEE_MFG_CODE_CONMED, ZBEE_MFG_CONMED }, + { ZBEE_MFG_CODE_POWERMAND, ZBEE_MFG_POWERMAND }, + { ZBEE_MFG_CODE_SCHNEIDER, ZBEE_MFG_SCHNEIDER }, + { ZBEE_MFG_CODE_EATON, ZBEE_MFG_EATON }, + + { ZBEE_MFG_CODE_TELULAR, ZBEE_MFG_TELULAR }, + { ZBEE_MFG_CODE_DELPHI, ZBEE_MFG_DELPHI }, + { ZBEE_MFG_CODE_EPISENSOR, ZBEE_MFG_EPISENSOR }, + { ZBEE_MFG_CODE_LANDIS_GYR, ZBEE_MFG_LANDIS_GYR }, + { ZBEE_MFG_CODE_KABA, ZBEE_MFG_KABA }, + { ZBEE_MFG_CODE_SHURE, ZBEE_MFG_SHURE }, + { ZBEE_MFG_CODE_COMVERGE, ZBEE_MFG_COMVERGE }, + /**/ + { ZBEE_MFG_CODE_HIDALGO, ZBEE_MFG_HIDALGO }, + { ZBEE_MFG_CODE_AIR2APP, ZBEE_MFG_AIR2APP }, + { ZBEE_MFG_CODE_AMX, ZBEE_MFG_AMX }, + { ZBEE_MFG_CODE_EDMI, ZBEE_MFG_EDMI }, + { ZBEE_MFG_CODE_CYAN, ZBEE_MFG_CYAN }, + { ZBEE_MFG_CODE_SYS_SPA, ZBEE_MFG_SYS_SPA }, + { ZBEE_MFG_CODE_TELIT, ZBEE_MFG_TELIT }, + + { ZBEE_MFG_CODE_KAGA, ZBEE_MFG_KAGA }, + { ZBEE_MFG_CODE_4_NOKS, ZBEE_MFG_4_NOKS }, + { 0, NULL } +}; + +/* ZCL Attribute Status Names */ +const value_string zbee_zcl_status_names[] = { + { ZBEE_ZCL_STAT_SUCCESS, "Success"}, + { ZBEE_ZCL_STAT_FAILURE, "Failure"}, + + { ZBEE_ZCL_STAT_NOT_AUTHORIZED, "Not Authorized"}, + { ZBEE_ZCL_STAT_RESERVED_FIELD_NOT_ZERO, "Reserved Field Not Zero"}, + { ZBEE_ZCL_STAT_MALFORMED_CMD, "Malformed Command"}, + { ZBEE_ZCL_STAT_UNSUP_CLUSTER_CMD, "Unsupported Cluster Command"}, + { ZBEE_ZCL_STAT_UNSUP_GENERAL_CMD, "Unsupported General Command"}, + { ZBEE_ZCL_STAT_UNSUP_MFR_CLUSTER_CMD, "Unsupported Manufacturer Cluster Command"}, + { ZBEE_ZCL_STAT_UNSUP_MFR_GENERAL_CMD, "Unsupported Manufacturer General Command"}, + { ZBEE_ZCL_STAT_INVALID_FIELD, "Invalid Field"}, + { ZBEE_ZCL_STAT_UNSUPPORTED_ATTR, "Unsupported Attribute"}, + { ZBEE_ZCL_STAT_INSUFFICIENT_SPACE, "Insufficient Space"}, + { ZBEE_ZCL_STAT_DUPLICATE_EXISTS, "Duplicate Exists"}, + { ZBEE_ZCL_STAT_NOT_FOUND, "Not Found"}, + { ZBEE_ZCL_STAT_UNREPORTABLE_ATTR, "Unreportable Attribute"}, + { ZBEE_ZCL_STAT_INVALID_DATA_TYPE, "Invalid Data Type"}, + { ZBEE_ZCL_STAT_INVALID_SELECTOR, "Invalid Selector"}, + { ZBEE_ZCL_STAT_WRITE_ONLY, "Write Only"}, + { ZBEE_ZCL_STAT_INCONSISTENT_STARTUP_STATE, "Inconsistent Startup State"}, + { ZBEE_ZCL_STAT_DEFINED_OUT_OF_BAND, "Defined Out of Band"}, + { ZBEE_ZCL_STAT_HARDWARE_FAILURE, "Hardware Failure"}, + { ZBEE_ZCL_STAT_SOFTWARE_FAILURE, "Software Failure"}, + + { ZBEE_ZCL_STAT_CALIBRATION_ERROR, "Calibration Error"}, + { ZBEE_ZCL_STAT_INVALID_VALUE, "Invalid Value"}, + { ZBEE_ZCL_STAT_READ_ONLY, "Read Only"}, + + { 0, NULL } +}; + +/* ZCL Attribute Data Names */ +const value_string zbee_zcl_data_type_names[] = { + { ZBEE_ZCL_NO_DATA, "No Data" }, + { ZBEE_ZCL_8_BIT_DATA, "8-Bit Data" }, + { ZBEE_ZCL_16_BIT_DATA, "16-Bit Data" }, + { ZBEE_ZCL_24_BIT_DATA, "24-Bit Data" }, + { ZBEE_ZCL_32_BIT_DATA, "32-Bit Data" }, + { ZBEE_ZCL_40_BIT_DATA, "40-Bit Data" }, + { ZBEE_ZCL_48_BIT_DATA, "48-Bit Data" }, + { ZBEE_ZCL_56_BIT_DATA, "56-Bit Data" }, + { ZBEE_ZCL_64_BIT_DATA, "64-Bit Data" }, + + { ZBEE_ZCL_BOOLEAN, "Boolean" }, + + { ZBEE_ZCL_8_BIT_BITMAP, "8-Bit Bitmap" }, + { ZBEE_ZCL_16_BIT_BITMAP, "16-Bit Bitmap" }, + { ZBEE_ZCL_24_BIT_BITMAP, "24-Bit Bitmap" }, + { ZBEE_ZCL_32_BIT_BITMAP, "32-Bit Bitmap" }, + { ZBEE_ZCL_40_BIT_BITMAP, "40-Bit Bitmap" }, + { ZBEE_ZCL_48_BIT_BITMAP, "48-Bit Bitmap" }, + { ZBEE_ZCL_56_BIT_BITMAP, "56-Bit Bitmap" }, + { ZBEE_ZCL_64_BIT_BITMAP, "64-Bit Bitmap" }, + + { ZBEE_ZCL_8_BIT_UINT, "8-Bit Unsigned Integer" }, + { ZBEE_ZCL_16_BIT_UINT, "16-Bit Unsigned Integer" }, + { ZBEE_ZCL_24_BIT_UINT, "24-Bit Unsigned Integer" }, + { ZBEE_ZCL_32_BIT_UINT, "32-Bit Unsigned Integer" }, + { ZBEE_ZCL_40_BIT_UINT, "40-Bit Unsigned Integer" }, + { ZBEE_ZCL_48_BIT_UINT, "48-Bit Unsigned Integer" }, + { ZBEE_ZCL_56_BIT_UINT, "56-Bit Unsigned Integer" }, + { ZBEE_ZCL_64_BIT_UINT, "64-Bit Unsigned Integer" }, + + { ZBEE_ZCL_8_BIT_INT, "8-Bit Signed Integer" }, + { ZBEE_ZCL_16_BIT_INT, "16-Bit Signed Integer" }, + { ZBEE_ZCL_24_BIT_INT, "24-Bit Signed Integer" }, + { ZBEE_ZCL_32_BIT_INT, "32-Bit Signed Integer" }, + { ZBEE_ZCL_40_BIT_INT, "40-Bit Signed Integer" }, + { ZBEE_ZCL_48_BIT_INT, "48-Bit Signed Integer" }, + { ZBEE_ZCL_56_BIT_INT, "56-Bit Signed Integer" }, + { ZBEE_ZCL_64_BIT_INT, "64-Bit Signed Integer" }, + + { ZBEE_ZCL_8_BIT_ENUM, "8-Bit Enumeration" }, + { ZBEE_ZCL_16_BIT_ENUM, "16-Bit Enumeration" }, + + { ZBEE_ZCL_SEMI_FLOAT, "Semi-precision Floating Point" }, + { ZBEE_ZCL_SINGLE_FLOAT, "Single Precision Floating Point" }, + { ZBEE_ZCL_DOUBLE_FLOAT, "Double Precision Floating Point" }, + + { ZBEE_ZCL_OCTET_STRING, "Octet String" }, + { ZBEE_ZCL_CHAR_STRING, "Character String" }, + { ZBEE_ZCL_LONG_OCTET_STRING, "Long Octet String" }, + { ZBEE_ZCL_LONG_CHAR_STRING, "Long Character String" }, + + { ZBEE_ZCL_ARRAY, "Array" }, + { ZBEE_ZCL_STRUCT, "Structure" }, + + { ZBEE_ZCL_SET, "Set Collection" }, + { ZBEE_ZCL_BAG, "Bag Collection" }, + + { ZBEE_ZCL_TIME, "Time of Day" }, + { ZBEE_ZCL_DATE, "Date" }, + { ZBEE_ZCL_UTC, "UTC Time" }, + + { ZBEE_ZCL_CLUSTER_ID, "Cluster ID" }, + { ZBEE_ZCL_ATTR_ID, "Attribute ID" }, + { ZBEE_ZCL_BACNET_OID, "BACnet OID" }, + + { ZBEE_ZCL_IEEE_ADDR, "IEEE Address" }, + { ZBEE_ZCL_SECURITY_KEY, "128-Bit Security Key" }, + + { ZBEE_ZCL_UNKNOWN, "Unknown" }, + + { 0, NULL } +}; + +/* ZCL Attribute Short Data Names */ +const value_string zbee_zcl_short_data_type_names[] = { + { ZBEE_ZCL_NO_DATA, "No Data" }, + { ZBEE_ZCL_8_BIT_DATA, "Data8" }, + { ZBEE_ZCL_16_BIT_DATA, "Data16" }, + { ZBEE_ZCL_24_BIT_DATA, "Data24" }, + { ZBEE_ZCL_32_BIT_DATA, "Data32" }, + { ZBEE_ZCL_40_BIT_DATA, "Data40" }, + { ZBEE_ZCL_48_BIT_DATA, "Data48" }, + { ZBEE_ZCL_56_BIT_DATA, "Data56" }, + { ZBEE_ZCL_64_BIT_DATA, "Data64" }, + + { ZBEE_ZCL_BOOLEAN, "Boolean" }, + + { ZBEE_ZCL_8_BIT_BITMAP, "Bit8" }, + { ZBEE_ZCL_16_BIT_BITMAP, "Bit16" }, + { ZBEE_ZCL_24_BIT_BITMAP, "Bit24" }, + { ZBEE_ZCL_32_BIT_BITMAP, "Bit32" }, + { ZBEE_ZCL_40_BIT_BITMAP, "Bit40" }, + { ZBEE_ZCL_48_BIT_BITMAP, "Bit48" }, + { ZBEE_ZCL_56_BIT_BITMAP, "Bit56" }, + { ZBEE_ZCL_64_BIT_BITMAP, "Bit64" }, + + { ZBEE_ZCL_8_BIT_UINT, "Uint8" }, + { ZBEE_ZCL_16_BIT_UINT, "Uint16" }, + { ZBEE_ZCL_24_BIT_UINT, "Uint24" }, + { ZBEE_ZCL_32_BIT_UINT, "Uint32" }, + { ZBEE_ZCL_40_BIT_UINT, "Uint40" }, + { ZBEE_ZCL_48_BIT_UINT, "Uint48" }, + { ZBEE_ZCL_56_BIT_UINT, "Uint56" }, + { ZBEE_ZCL_64_BIT_UINT, "Uint64" }, + + { ZBEE_ZCL_8_BIT_INT, "Int8" }, + { ZBEE_ZCL_16_BIT_INT, "Int16" }, + { ZBEE_ZCL_24_BIT_INT, "Int24" }, + { ZBEE_ZCL_32_BIT_INT, "Int32" }, + { ZBEE_ZCL_40_BIT_INT, "Int40" }, + { ZBEE_ZCL_48_BIT_INT, "Int48" }, + { ZBEE_ZCL_56_BIT_INT, "Int56" }, + { ZBEE_ZCL_64_BIT_INT, "Int64" }, + + { ZBEE_ZCL_8_BIT_ENUM, "Enum8" }, + { ZBEE_ZCL_16_BIT_ENUM, "Enum16" }, + + { ZBEE_ZCL_SEMI_FLOAT, "Semi Float" }, + { ZBEE_ZCL_SINGLE_FLOAT, "Float" }, + { ZBEE_ZCL_DOUBLE_FLOAT, "Double Float" }, + + { ZBEE_ZCL_OCTET_STRING, "Oct String" }, + { ZBEE_ZCL_CHAR_STRING, "Char String" }, + { ZBEE_ZCL_LONG_OCTET_STRING, "Long Oct String" }, + { ZBEE_ZCL_LONG_CHAR_STRING, "Long Char String" }, + + { ZBEE_ZCL_ARRAY, "Array" }, + { ZBEE_ZCL_STRUCT, "Structure" }, + + { ZBEE_ZCL_SET, "Set" }, + { ZBEE_ZCL_BAG, "Bag" }, + + { ZBEE_ZCL_TIME, "Time" }, + { ZBEE_ZCL_DATE, "Date" }, + { ZBEE_ZCL_UTC, "UTC" }, + + { ZBEE_ZCL_CLUSTER_ID, "Cluster" }, + { ZBEE_ZCL_ATTR_ID, "Attribute" }, + { ZBEE_ZCL_BACNET_OID, "BACnet" }, + + { ZBEE_ZCL_IEEE_ADDR, "EUI" }, + { ZBEE_ZCL_SECURITY_KEY, "Key" }, + + { ZBEE_ZCL_UNKNOWN, "Unknown" }, + + { 0, NULL } +}; + +/* ZCL Attribute English Weekday Names */ +const value_string zbee_zcl_wd_names[] = { + { 1, "Monday" }, + { 2, "Tuesday" }, + { 3, "Wednesday" }, + { 4, "Thursday" }, + { 5, "Friday" }, + { 6, "Saturday" }, + { 7, "Sunday" }, + + { 0, NULL } +}; + +/* Attribute Direction Names */ +const value_string zbee_zcl_dir_names[] = { + { 0, "Reported" }, + { 1, "Received" }, + + { 0, NULL } +}; + +/* Attribute Discovery Names */ +const value_string zbee_zcl_dis_names[] = { + { 0, "Incomplete" }, + { 1, "Complete" }, + + { 0, NULL } +}; + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zbee_zcl + * DESCRIPTION + * ZigBee Cluster Library dissector for wireshark. + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * packet_into *pinfo - pointer to packet information fields + * proto_tree *tree - pointer to data tree ethereal uses to display packet. + * RETURNS + * void + *--------------------------------------------------------------- + */ +void +dissect_zbee_zcl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + proto_tree *zcl_tree = NULL; + proto_tree *sub_tree = NULL; + + proto_item *proto_root = NULL; + proto_item *ti; + + zbee_zcl_packet packet; + + guint8 fcf; + guint offset = 0; + + /* Init. */ + memset(&packet, 0, sizeof(zbee_zcl_packet)); + + /* Create the protocol tree */ + if ( tree ) { + proto_root = proto_tree_add_protocol_format(tree, proto_zbee_zcl, tvb, offset, + tvb_length(tvb), "ZigBee Cluster Library Frame"); + + zcl_tree = proto_item_add_subtree(proto_root, ett_zbee_zcl); + } + + /* Clear info column */ + if (check_col(pinfo->cinfo, COL_INFO)) { + col_clear(pinfo->cinfo, COL_INFO); + } + + /* Get the FCF */ + fcf = tvb_get_guint8(tvb, offset); + packet.frame_type = zbee_get_bit_field(fcf, ZBEE_ZCL_FCF_FRAME_TYPE); + packet.mfr_spec = zbee_get_bit_field(fcf, ZBEE_ZCL_FCF_MFR_SPEC); + packet.direction = zbee_get_bit_field(fcf, ZBEE_ZCL_FCF_DIRECTION); + packet.disable_default_resp = zbee_get_bit_field(fcf, ZBEE_ZCL_FCF_DISABLE_DEFAULT_RESP); + + /* Display the FCF */ + if ( tree ) { + /* Create the subtree */ + ti = proto_tree_add_text(zcl_tree, tvb, offset, sizeof(guint8), + "Frame Control Field: %s (0x%02x)", + val_to_str(packet.frame_type, zbee_zcl_frame_types, "Unknown"), fcf); + sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_fcf); + + /* Add the frame type */ + proto_tree_add_uint(sub_tree, hf_zbee_zcl_fcf_frame_type, tvb, offset, sizeof(guint8), + fcf & ZBEE_ZCL_FCF_FRAME_TYPE); + + /* Add the manufacturer specific, direction, and disable default response flags */ + proto_tree_add_boolean(sub_tree, hf_zbee_zcl_fcf_mfr_spec, tvb, offset, + sizeof(guint8), fcf & ZBEE_ZCL_FCF_MFR_SPEC); + + proto_tree_add_boolean(sub_tree, hf_zbee_zcl_fcf_dir, tvb, offset, sizeof(guint8), + fcf & ZBEE_ZCL_FCF_DIRECTION); + + proto_tree_add_boolean(sub_tree, hf_zbee_zcl_fcf_disable_default_resp, tvb, offset, + sizeof(guint8), fcf & ZBEE_ZCL_FCF_DISABLE_DEFAULT_RESP); + } + offset += sizeof(guint8); + + /* If the manufacturer code is present, get and display it. */ + if (packet.mfr_spec) { + packet.mfr_code = tvb_get_letohs(tvb, offset); + + if ( tree ) { + proto_tree_add_uint(zcl_tree, hf_zbee_zcl_mfr_code, tvb, offset, sizeof(guint16), + packet.mfr_code); + + proto_item_append_text(proto_root, ", Mfr: %s (0x%04x)", + val_to_str(packet.mfr_code, zbee_mfr_code_names, "Unknown"), + packet.mfr_code); + } + offset += sizeof(guint16); + } + + /* Add the transaction sequence number to the tree */ + packet.tran_seqno = tvb_get_guint8(tvb, offset); + + if ( zcl_tree ) { + proto_tree_add_uint(zcl_tree, hf_zbee_zcl_tran_seqno, tvb, offset, sizeof(guint8), + packet.tran_seqno); + } + offset += sizeof(guint8); + + /* Display the command and sequence number on the proto root and info column. */ + packet.cmd_id = tvb_get_guint8(tvb, offset); + + /* Add command ID to the tree. */ + if ( packet.frame_type == ZBEE_ZCL_FCF_PROFILE_WIDE ) { + if ( tree ) { + proto_item_append_text(proto_root, ", Command: %s, Seq: %u", + val_to_str(packet.cmd_id, zbee_zcl_cmd_names, "Unknown Command"), + packet.tran_seqno); + } + + if ( check_col(pinfo->cinfo, COL_INFO) ) { + col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u", + val_to_str(packet.cmd_id, zbee_zcl_cmd_names, "Unknown Command"), + packet.tran_seqno); + } + + if ( zcl_tree ) { + proto_tree_add_uint(zcl_tree, hf_zbee_zcl_cmd_id, tvb, offset, sizeof(guint8), + packet.cmd_id); + } + offset += sizeof(guint8); + } else { + if ( tree ) { + proto_item_append_text(proto_root, ", Cluster-specific Command: 0x%02x, Seq: %u", + packet.cmd_id, packet.tran_seqno); + } + + if ( check_col(pinfo->cinfo, COL_INFO) ) { + col_append_fstr(pinfo->cinfo, COL_INFO, "Command: 0x%02x, Seq: %u", + packet.cmd_id, packet.tran_seqno); + } + + if ( zcl_tree ) { + proto_tree_add_uint(zcl_tree, hf_zbee_zcl_cs_cmd_id, tvb, offset, sizeof(guint8), + packet.cmd_id); + } + offset += sizeof(guint8); + + /* Don't decode cluster-specific commands */ + zcl_dump_data(tvb, offset, pinfo, zcl_tree); + return; + } + + /* Handle the contents of the command frame. */ + switch ( packet.cmd_id ) { + case ZBEE_ZCL_CMD_READ_ATTR: + dissect_zcl_read_attr(tvb, pinfo, zcl_tree, &offset); + break; + + case ZBEE_ZCL_CMD_READ_ATTR_RESP: + dissect_zcl_read_attr_resp(tvb, pinfo, zcl_tree, &offset); + break; + + case ZBEE_ZCL_CMD_WRITE_ATTR: + case ZBEE_ZCL_CMD_WRITE_ATTR_UNDIVIDED: + case ZBEE_ZCL_CMD_WRITE_ATTR_NO_RESP: + case ZBEE_ZCL_CMD_REPORT_ATTR: + dissect_zcl_write_attr(tvb, pinfo, zcl_tree, &offset); + break; + + case ZBEE_ZCL_CMD_WRITE_ATTR_RESP: + dissect_zcl_write_attr_resp(tvb, pinfo, zcl_tree, &offset); + break; + + case ZBEE_ZCL_CMD_CONFIG_REPORT: + dissect_zcl_config_report(tvb, pinfo, zcl_tree, &offset); + break; + + case ZBEE_ZCL_CMD_CONFIG_REPORT_RESP: + dissect_zcl_config_report_resp(tvb, pinfo, zcl_tree, &offset); + break; + + case ZBEE_ZCL_CMD_READ_REPORT_CONFIG: + dissect_zcl_read_report_config(tvb, pinfo, zcl_tree, &offset); + break; + + case ZBEE_ZCL_CMD_READ_REPORT_CONFIG_RESP: + dissect_zcl_read_report_config_resp(tvb, pinfo, zcl_tree, &offset); + break; + + case ZBEE_ZCL_CMD_DEFAULT_RESP: + dissect_zcl_default_resp(tvb, pinfo, zcl_tree, &offset); + break; + + case ZBEE_ZCL_CMD_DISCOVER_ATTR: + dissect_zcl_discover_attr(tvb, pinfo, zcl_tree, &offset); + break; + + case ZBEE_ZCL_CMD_DISCOVER_ATTR_RESP: + dissect_zcl_discover_attr_resp(tvb, pinfo, zcl_tree, &offset); + break; + + /* BUGBUG: don't dissect these for now */ + case ZBEE_ZCL_CMD_READ_ATTR_STRUCT: + case ZBEE_ZCL_CMD_WRITE_ATTR_STRUCT: + case ZBEE_ZCL_CMD_WRITE_ATTR_STRUCT_RESP: + default: + zcl_dump_data(tvb, offset, pinfo, zcl_tree); + break; + } /* switch */ + + return; +} /* dissect_zbee_zcl */ + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_read_attr + * DESCRIPTION + * Helper dissector for ZCL Read Attributes and + * Write Attributes No Response commands. + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * packet_info *pinfo - pointer to packet information fields + * proto_tree *tree - pointer to data tree ethereal uses to display packet. + * offset - pointer to offset from caller + * RETURNS + * guint - offset after command dissection. + *--------------------------------------------------------------- + */ +void dissect_zcl_read_attr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint *offset) +{ + guint tvb_len; + + tvb_len = tvb_length(tvb); + while ( *offset < tvb_len ) { + /* Dissect the attribute identifier */ + dissect_zcl_attr_id(tvb, tree, offset); + } + + return; +} /* dissect_zcl_report_attr */ + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_read_attr_resp + * DESCRIPTION + * Helper dissector for ZCL Read Attributes Response command. + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * packet_info *pinfo - pointer to packet information fields + * proto_tree *tree - pointer to data tree ethereal uses to display packet. + * offset - pointer to offset from caller + * RETURNS + * guint - offset after command dissection. + *--------------------------------------------------------------- + */ +void dissect_zcl_read_attr_resp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint *offset) +{ + proto_item *ti = NULL; + proto_tree *sub_tree = NULL; + + guint tvb_len; + guint i = 0; + + tvb_len = tvb_length(tvb); + while ( *offset < tvb_len && i < ZBEE_ZCL_NUM_ATTR_ETT ) { + + if ( tree ) { + /* Create subtree for attribute status field */ + ti = proto_tree_add_text(tree, tvb, *offset, 0, "Status Record"); + sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_attr[i]); + i++; + } + + /* Dissect the attribute identifier */ + dissect_zcl_attr_id(tvb, sub_tree, offset); + + /* Dissect the status and optionally the data type and value */ + if ( dissect_zcl_attr_uint8(tvb, sub_tree, offset, &hf_zbee_zcl_attr_status) + == ZBEE_ZCL_STAT_SUCCESS ) { + + /* Dissect the attribute data type and data */ + dissect_zcl_attr_data_type_val(tvb, sub_tree, offset); + } + } + + return; +} /* dissect_zcl_read_attr_resp */ + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_write_attr + * DESCRIPTION + * Helper dissector for ZCL Report Attribute commands. + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * packet_info *pinfo - pointer to packet information fields + * proto_tree *tree - pointer to data tree ethereal uses to display packet. + * offset - pointer to offset from caller + * RETURNS + * guint - offset after command dissection. + *--------------------------------------------------------------- + */ +void dissect_zcl_write_attr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint *offset) +{ + proto_item *ti = NULL; + proto_tree *sub_tree = NULL; + + guint tvb_len; + guint i = 0; + + tvb_len = tvb_length(tvb); + while ( *offset < tvb_len && i < ZBEE_ZCL_NUM_ATTR_ETT ) { + + if ( tree ) { + /* Create subtree for attribute status field */ + ti = proto_tree_add_text(tree, tvb, *offset, 0, "Attribute Field"); + sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_attr[i]); + i++; + } + /* Dissect the attribute identifier */ + dissect_zcl_attr_id(tvb, sub_tree, offset); + + /* Dissect the attribute data type and data */ + dissect_zcl_attr_data_type_val(tvb, sub_tree, offset); + } + + return; +} /* dissect_zcl_write_attr */ + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_write_attr_resp + * DESCRIPTION + * Helper dissector for ZCL Write Attribute Response command. + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * packet_info *pinfo - pointer to packet information fields + * proto_tree *tree - pointer to data tree ethereal uses to display packet. + * offset - pointer to offset from caller + * RETURNS + * guint - offset after command dissection. + *--------------------------------------------------------------- + */ +void dissect_zcl_write_attr_resp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint *offset) +{ + proto_item *ti = NULL; + proto_tree *sub_tree = NULL; + + guint tvb_len; + guint i = 0; + + tvb_len = tvb_length(tvb); + while ( *offset < tvb_len && i < ZBEE_ZCL_NUM_ATTR_ETT ) { + + if ( tree ) { + /* Create subtree for attribute status field */ + ti = proto_tree_add_text(tree, tvb, *offset, 0, "Status Record"); + sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_attr[i]); + i++; + } + + /* Dissect the status */ + dissect_zcl_attr_uint8(tvb, sub_tree, offset, &hf_zbee_zcl_attr_status); + + /* Dissect the attribute identifier */ + dissect_zcl_attr_id(tvb, sub_tree, offset); + } + + return; +} /* dissect_zcl_write_attr_resp */ + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_read_report_config_resp + * DESCRIPTION + * Helper dissector for ZCL Report Attribute commands. + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * packet_info *pinfo - pointer to packet information fields + * proto_tree *tree - pointer to data tree ethereal uses to display packet. + * offset - pointer to offset from caller + *--------------------------------------------------------------- + */ +void dissect_zcl_read_report_config_resp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, + guint *offset) +{ + proto_item *ti = NULL; + proto_tree *sub_tree = NULL; + + guint tvb_len; + guint i = 0; + guint data_type; + guint attr_status; + + tvb_len = tvb_length(tvb); + while ( *offset < tvb_len && i < ZBEE_ZCL_NUM_ATTR_ETT ) { + + if ( tree ) { + /* Create subtree for attribute status field */ + ti = proto_tree_add_text(tree, tvb, *offset, 3, "Reporting Configuration Record"); + sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_attr[i]); + i++; + } + /* Dissect the status */ + attr_status = dissect_zcl_attr_uint8(tvb, sub_tree, offset, &hf_zbee_zcl_attr_status); + + /* Dissect the direction and any reported configuration */ + dissect_zcl_attr_uint8(tvb, sub_tree, offset, &hf_zbee_zcl_attr_dir); + + /* Dissect the attribute id */ + dissect_zcl_attr_id(tvb, sub_tree, offset); + + if ( attr_status == ZBEE_ZCL_STAT_SUCCESS ) { + + /* Dissect the attribute data type */ + data_type = dissect_zcl_attr_uint8(tvb, sub_tree, offset, &hf_zbee_zcl_attr_data_type); + + /* Dissect minimum reporting interval */ + dissect_zcl_attr_uint16(tvb, sub_tree, offset, &hf_zbee_zcl_attr_minint); + + /* Dissect maximum reporting interval */ + dissect_zcl_attr_uint16(tvb, sub_tree, offset, &hf_zbee_zcl_attr_maxint); + + if ( IS_ANALOG_SUBTYPE(data_type) ) { + /* Dissect reportable change */ + dissect_zcl_attr_data(tvb, sub_tree, offset, data_type); + } + + /* Dissect timeout period */ + dissect_zcl_attr_uint16(tvb, sub_tree, offset, &hf_zbee_zcl_attr_timeout); + } + } + + return; +} /* dissect_zcl_read_report_config_resp */ + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_config_report + * DESCRIPTION + * Helper dissector for ZCL Report Attribute commands. + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * packet_info *pinfo - pointer to packet information fields + * proto_tree *tree - pointer to data tree ethereal uses to display packet. + * offset - pointer to offset from caller + *--------------------------------------------------------------- + */ +void dissect_zcl_config_report(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint *offset) +{ + proto_item *ti = NULL; + proto_tree *sub_tree = NULL; + + guint tvb_len; + guint i = 0; + guint data_type; + + tvb_len = tvb_length(tvb); + while ( *offset < tvb_len && i < ZBEE_ZCL_NUM_ATTR_ETT ) { + + if ( tree ) { + /* Create subtree for attribute status field */ + ti = proto_tree_add_text(tree, tvb, *offset, 3, "Reporting Configuration Record"); + sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_attr[i]); + i++; + } + + /* Dissect the direction and any reported configuration */ + if ( dissect_zcl_attr_uint8(tvb, sub_tree, offset, &hf_zbee_zcl_attr_dir) + == ZBEE_ZCL_DIR_REPORTED ) { + + /* Dissect the attribute id */ + dissect_zcl_attr_id(tvb, sub_tree, offset); + + /* Dissect the attribute data type */ + data_type = dissect_zcl_attr_uint8(tvb, sub_tree, offset, &hf_zbee_zcl_attr_data_type); + + /* Dissect minimum reporting interval */ + dissect_zcl_attr_uint16(tvb, sub_tree, offset, &hf_zbee_zcl_attr_minint); + + /* Dissect maximum reporting interval */ + dissect_zcl_attr_uint16(tvb, sub_tree, offset, &hf_zbee_zcl_attr_maxint); + + if ( IS_ANALOG_SUBTYPE(data_type) ) { + /* Dissect reportable change */ + dissect_zcl_attr_data(tvb, sub_tree, offset, data_type); + } + } else { + + /* Dissect the attribute id */ + dissect_zcl_attr_id(tvb, sub_tree, offset); + + /* Dissect timeout period */ + dissect_zcl_attr_uint16(tvb, sub_tree, offset, &hf_zbee_zcl_attr_timeout); + } + } + + return; +} /* dissect_zcl_config_report */ + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_config_report_resp + * DESCRIPTION + * Helper dissector for ZCL Report Attribute commands. + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * packet_info *pinfo - pointer to packet information fields + * proto_tree *tree - pointer to data tree ethereal uses to display packet. + * offset - pointer to offset from caller + * RETURNS + * guint - offset after command dissection. + *--------------------------------------------------------------- + */ +void dissect_zcl_config_report_resp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, + guint *offset) +{ + proto_item *ti = NULL; + proto_tree *sub_tree = NULL; + + guint tvb_len; + guint i = 0; + + tvb_len = tvb_length(tvb); + while ( *offset < tvb_len && i < ZBEE_ZCL_NUM_ATTR_ETT ) { + + if ( tree ) { + /* Create subtree for attribute status field */ + ti = proto_tree_add_text(tree, tvb, *offset, 3, "Attribute Status Record"); + sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_attr[i]); + i++; + } + + /* Dissect the status */ + dissect_zcl_attr_uint8(tvb, sub_tree, offset, &hf_zbee_zcl_attr_status); + + /* Dissect the direction */ + dissect_zcl_attr_uint8(tvb, sub_tree, offset, &hf_zbee_zcl_attr_dir); + + /* Dissect the attribute identifier */ + dissect_zcl_attr_id(tvb, sub_tree, offset); + } + + return; +} /* dissect_zcl_config_report_resp */ + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_read_report_config + * DESCRIPTION + * Helper dissector for ZCL Read Report Configuration command. + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * packet_info *pinfo - pointer to packet information fields + * proto_tree *tree - pointer to data tree ethereal uses to display packet. + * offset - pointer to offset from caller + * RETURNS + * guint - offset after command dissection. + *--------------------------------------------------------------- + */ +void dissect_zcl_read_report_config(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, + guint *offset) +{ + proto_item *ti = NULL; + proto_tree *sub_tree = NULL; + + guint tvb_len; + guint i = 0; + + tvb_len = tvb_length(tvb); + while ( *offset < tvb_len && i < ZBEE_ZCL_NUM_ATTR_ETT ) { + + if ( tree ) { + /* Create subtree for attribute status field */ + ti = proto_tree_add_text(tree, tvb, *offset, 3, "Attribute Status Record"); + sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_attr[i]); + i++; + } + + /* Dissect the direction */ + dissect_zcl_attr_uint8(tvb, sub_tree, offset, &hf_zbee_zcl_attr_dir); + + /* Dissect the attribute identifier */ + dissect_zcl_attr_id(tvb, sub_tree, offset); + } + + return; +} /* dissect_zcl_read_report_config */ + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_default_resp + * DESCRIPTION + * Helper dissector for ZCL Default Response command. + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * packet_info *pinfo - pointer to packet information fields + * proto_tree *tree - pointer to data tree ethereal uses to display packet. + * offset - pointer to offset from caller + * RETURNS + * void + *--------------------------------------------------------------- + */ +void dissect_zcl_default_resp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint *offset) +{ + guint cmd_id; + + /* Dissect the command identifier */ + cmd_id = tvb_get_guint8(tvb, *offset); + + if ( tree ) { + proto_tree_add_uint(tree, hf_zbee_zcl_cmd_id, tvb, *offset, sizeof(guint8), cmd_id); + + } + *offset += sizeof(guint8); + + /* Dissect the status */ + dissect_zcl_attr_uint8(tvb, tree, offset, &hf_zbee_zcl_attr_status); + + return; +} /* dissect_zcl_default_resp */ + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_discover_attr + * DESCRIPTION + * Helper dissector for ZCL Discover Attributes command. + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * packet_info *pinfo - pointer to packet information fields + * proto_tree *tree - pointer to data tree ethereal uses to display packet. + * offset - pointer to offset from caller + * RETURNS + * void + *--------------------------------------------------------------- + */ +void dissect_zcl_discover_attr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint *offset) +{ + /* Dissect the starting attribute identifier */ + dissect_zcl_attr_uint16(tvb, tree, offset, &hf_zbee_zcl_attr_start); + + /* Dissect the number of maximum attribute identifiers */ + dissect_zcl_attr_uint8(tvb, tree, offset, &hf_zbee_zcl_attr_maxnum); + + return; +} /* dissect_zcl_default_resp */ + + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_discover_attr_resp + * DESCRIPTION + * Helper dissector for ZCL Discover Attributes command. + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * packet_info *pinfo - pointer to packet information fields + * proto_tree *tree - pointer to data tree ethereal uses to display packet. + * offset - pointer to offset from caller + * RETURNS + * void + *--------------------------------------------------------------- + */ +void dissect_zcl_discover_attr_resp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, + guint *offset) +{ + proto_item *ti = NULL; + proto_tree *sub_tree = NULL; + + guint tvb_len; + guint i = 0; + + dissect_zcl_attr_uint8(tvb, sub_tree, offset, &hf_zbee_zcl_attr_dis); + + tvb_len = tvb_length(tvb); + while ( *offset < tvb_len && i < ZBEE_ZCL_NUM_ATTR_ETT ) { + + if ( tree ) { + /* Create subtree for attribute status field */ + ti = proto_tree_add_text(tree, tvb, *offset, 3, "Attribute Status Record"); + sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_attr[i]); + i++; + + /* Dissect the attribute identifier */ + dissect_zcl_attr_id(tvb, sub_tree, offset); + + /* Dissect the number of maximum attribute identifiers */ + dissect_zcl_attr_uint8(tvb, sub_tree, offset, &hf_zbee_zcl_attr_data_type); + } + } + + return; +} /* dissect_zcl_default_resp */ + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_attr_data_type + * DESCRIPTION + * Helper dissector for ZCL Attribute commands. + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * proto_tree *tree - pointer to data tree ethereal uses to display packet. + * offset - offset into the tvb to begin dissection. + * RETURNS + * guint - attribute data type + *--------------------------------------------------------------- + */ +guint dissect_zcl_attr_data_type(tvbuff_t *tvb, proto_tree *tree, guint *offset) +{ + guint attr_data_type; + + /* Dissect attribute data type */ + attr_data_type = tvb_get_guint8(tvb, *offset); + + if ( tree ) { + proto_tree_add_uint(tree, hf_zbee_zcl_attr_data_type, tvb, *offset, sizeof(guint8), + attr_data_type); + } + *offset += sizeof(guint8); + + return attr_data_type; +} + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_attr_id + * DESCRIPTION + * Dissects Attribute ID field. This could be done with the + * dissect_zcl_attr_uint16 function, but we leave it separate + * so we can dissect the attr_id with a hash in the future. + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * proto_tree *tree - pointer to data tree ethereal uses to display packet. + * offset - offset into the tvb to begin dissection. + * RETURNS + * void + *--------------------------------------------------------------- + */ +void dissect_zcl_attr_id(tvbuff_t *tvb, proto_tree *tree, guint *offset) +{ + guint16 attr_id; + + attr_id = tvb_get_letohs(tvb, *offset); + + /* add it to tree */ + if ( tree ) { + /* Add the identifier */ + proto_tree_add_uint(tree, hf_zbee_zcl_attr_id, tvb, *offset, sizeof(guint16), + attr_id); + } + *offset += sizeof(guint16); + + return; +} /* dissect_zcl_attr_id */ + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_attr_data_type_val + * DESCRIPTION + * Helper dissector for ZCL Attribute commands. + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * proto_tree *tree - pointer to data tree ethereal uses to display packet. + * offset - offset into the tvb to begin dissection. + * RETURNS + * void + *--------------------------------------------------------------- + */ +void dissect_zcl_attr_data_type_val(tvbuff_t *tvb, proto_tree *tree, guint *offset) +{ + dissect_zcl_attr_data(tvb, tree, offset, + dissect_zcl_attr_uint8(tvb, tree, offset, &hf_zbee_zcl_attr_data_type) ); + + return; +} + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_attr_data + * DESCRIPTION + * Dissects the various types of ZCL attribute data. + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * packet_info *pinfo - pointer to packet information fields + * proto_tree *tree - pointer to data tree ethereal uses to display packet. + * offset - offset into the tvb to begin dissection. + * data_type - the type of ZCL data in the packet buffer + * RETURNS + * void + *--------------------------------------------------------------- + */ +void dissect_zcl_attr_data(tvbuff_t *tvb, proto_tree *tree, guint *offset, guint data_type) +{ + guint attr_uint; + guint64 attr_uint64; + gint attr_int; + gint64 attr_int64; + guint8 *attr_string; + guint8 attr_uint8[4]; + gfloat attr_float; + gdouble attr_double; + nstime_t attr_time; + + attr_uint = 0; + attr_uint64 = 0; + attr_int = 0; + attr_int64 = 0; + + /* Dissect attribute data type and data */ + switch ( data_type ) { + case ZBEE_ZCL_NO_DATA: + break; + + case ZBEE_ZCL_8_BIT_DATA: + case ZBEE_ZCL_8_BIT_BITMAP: + dissect_zcl_attr_bytes(tvb, tree, offset, 1); + break; + + case ZBEE_ZCL_8_BIT_UINT: + case ZBEE_ZCL_8_BIT_ENUM: + + /* Display 8 bit unsigned integer */ + attr_uint = tvb_get_guint8(tvb, *offset); + + if ( tree ) { + proto_item_append_text(tree, ", %s: %u", + val_to_str(data_type, zbee_zcl_short_data_type_names, "Reserved"), attr_uint); + + proto_tree_add_uint(tree, hf_zbee_zcl_attr_uint8, tvb, *offset, sizeof(guint8), + attr_uint); + } + + *offset += sizeof(guint8); + break; + + case ZBEE_ZCL_8_BIT_INT: + /* Display 8 bit integer */ + + attr_int = (gint8)tvb_get_guint8(tvb, *offset); + + if ( tree ) { + proto_item_append_text(tree, ", %s: %-d", + val_to_str(data_type, zbee_zcl_short_data_type_names, "Reserved"), attr_int); + + proto_tree_add_int(tree, hf_zbee_zcl_attr_int8, tvb, *offset, sizeof(gint8), + (gint)attr_int); + } + + *offset += sizeof(gint8); + break; + + case ZBEE_ZCL_BOOLEAN: + + attr_uint = tvb_get_guint8(tvb, *offset); + + if ( tree ) { + proto_item_append_text(tree, ", %s: 0x%02x", + val_to_str(data_type, zbee_zcl_short_data_type_names, "Reserved"), attr_uint); + + proto_tree_add_uint(tree, hf_zbee_zcl_attr_boolean, tvb, *offset, sizeof(guint8), + attr_uint); + } + *offset += sizeof(guint8); + break; + + case ZBEE_ZCL_16_BIT_DATA: + case ZBEE_ZCL_16_BIT_BITMAP: + dissect_zcl_attr_bytes(tvb, tree, offset, 2); + break; + + case ZBEE_ZCL_16_BIT_UINT: + case ZBEE_ZCL_16_BIT_ENUM: + /* Display 16 bit unsigned integer */ + + attr_uint = tvb_get_letohs(tvb, *offset); + + if ( tree ) { + proto_item_append_text(tree, ", %s: %u", + val_to_str(data_type, zbee_zcl_short_data_type_names, "Reserved"), attr_uint); + + proto_tree_add_uint(tree, hf_zbee_zcl_attr_uint16, tvb, *offset, sizeof(guint16), + attr_uint); + } + *offset += sizeof(guint16); + break; + + case ZBEE_ZCL_16_BIT_INT: + /* Display 16 bit integer */ + + attr_int = (gint16)tvb_get_letohs(tvb, *offset); + + if ( tree ) { + proto_item_append_text(tree, ", %s: %-d", + val_to_str(data_type, zbee_zcl_short_data_type_names, "Reserved"), attr_int); + + proto_tree_add_int(tree, hf_zbee_zcl_attr_int16, tvb, *offset, sizeof(gint16), + attr_int); + } + *offset += sizeof(gint16); + break; + + case ZBEE_ZCL_24_BIT_DATA: + case ZBEE_ZCL_24_BIT_BITMAP: + dissect_zcl_attr_bytes(tvb, tree, offset, 3); + break; + + case ZBEE_ZCL_24_BIT_UINT: + /* Display 24 bit unsigned integer */ + + attr_uint = tvb_get_letoh24(tvb, *offset); + + if ( tree ) { + proto_item_append_text(tree, ", %s: %u", + val_to_str(data_type, zbee_zcl_short_data_type_names, "Reserved"), attr_uint); + + proto_tree_add_uint(tree, hf_zbee_zcl_attr_uint24, tvb, *offset, 3, + attr_uint); + } + *offset += 3; + break; + + case ZBEE_ZCL_24_BIT_INT: + /* Display 24 bit signed integer */ + + attr_int = (gint)tvb_get_letoh24(tvb, *offset); + /* sign extend into int32 */ + if (attr_int & INT24_SIGN_BITS) attr_int |= INT24_SIGN_BITS; + + if ( tree ) { + proto_item_append_text(tree, ", %s: %-d", + val_to_str(data_type, zbee_zcl_short_data_type_names, "Reserved"), attr_int); + + proto_tree_add_int(tree, hf_zbee_zcl_attr_int24, tvb, *offset, 3, + attr_int); + } + *offset += 3; + break; + + case ZBEE_ZCL_32_BIT_DATA: + case ZBEE_ZCL_32_BIT_BITMAP: + dissect_zcl_attr_bytes(tvb, tree, offset, 4); + break; + + case ZBEE_ZCL_32_BIT_UINT: + /* Display 32 bit unsigned integer */ + + attr_uint = tvb_get_letohl(tvb, *offset); + + if ( tree ) { + proto_item_append_text(tree, ", %s: %u", + val_to_str(data_type, zbee_zcl_short_data_type_names, "Reserved"), attr_uint); + + proto_tree_add_uint(tree, hf_zbee_zcl_attr_uint32, tvb, *offset, sizeof(guint), + attr_uint); + } + *offset += sizeof(guint); + break; + + case ZBEE_ZCL_32_BIT_INT: + /* Display 32 bit signed integer */ + + attr_int = (gint)tvb_get_letohl(tvb, *offset); + + if ( tree ) { + proto_item_append_text(tree, ", %s: %-d", + val_to_str(data_type, zbee_zcl_short_data_type_names, "Reserved"), attr_int); + + proto_tree_add_int(tree, hf_zbee_zcl_attr_int32, tvb, *offset, sizeof(gint), + attr_int); + } + *offset += sizeof(gint); + break; + + case ZBEE_ZCL_40_BIT_DATA: + case ZBEE_ZCL_40_BIT_BITMAP: + dissect_zcl_attr_bytes(tvb, tree, offset, 5); + break; + + case ZBEE_ZCL_40_BIT_UINT: + dissect_zcl_big_int(tvb, tree, offset, 5, FALSE); + break; + + case ZBEE_ZCL_40_BIT_INT: + dissect_zcl_big_int(tvb, tree, offset, 5, TRUE); + break; + + case ZBEE_ZCL_48_BIT_DATA: + case ZBEE_ZCL_48_BIT_BITMAP: + dissect_zcl_attr_bytes(tvb, tree, offset, 6); + break; + + case ZBEE_ZCL_48_BIT_UINT: + dissect_zcl_big_int(tvb, tree, offset, 6, FALSE); + break; + + case ZBEE_ZCL_48_BIT_INT: + dissect_zcl_big_int(tvb, tree, offset, 6, TRUE); + break; + + case ZBEE_ZCL_56_BIT_DATA: + case ZBEE_ZCL_56_BIT_BITMAP: + dissect_zcl_attr_bytes(tvb, tree, offset, 7); + break; + + case ZBEE_ZCL_56_BIT_UINT: + dissect_zcl_big_int(tvb, tree, offset, 7, FALSE); + break; + + case ZBEE_ZCL_56_BIT_INT: + dissect_zcl_big_int(tvb, tree, offset, 7, TRUE); + break; + + case ZBEE_ZCL_64_BIT_DATA: + case ZBEE_ZCL_64_BIT_BITMAP: + dissect_zcl_attr_bytes(tvb, tree, offset, 8); + break; + + case ZBEE_ZCL_64_BIT_UINT: + dissect_zcl_big_int(tvb, tree, offset, 8, FALSE); + break; + + case ZBEE_ZCL_64_BIT_INT: + dissect_zcl_big_int(tvb, tree, offset, 8, TRUE); + break; + + case ZBEE_ZCL_SEMI_FLOAT: + /* BUGBUG */ + dissect_zcl_attr_bytes(tvb, tree, offset, 2); + break; + + case ZBEE_ZCL_SINGLE_FLOAT: + attr_float = tvb_get_letohieee_float(tvb, *offset); + + if ( tree ) { + proto_item_append_text(tree, ", %s: %g", + val_to_str(data_type, zbee_zcl_short_data_type_names, "Reserved"), attr_float); + + proto_tree_add_item(tree, hf_zbee_zcl_attr_float, tvb, *offset, 4, TRUE); + } + *offset += 4; + break; + + case ZBEE_ZCL_DOUBLE_FLOAT: + attr_double = tvb_get_letohieee_double(tvb, *offset); + + if ( tree ) { + proto_item_append_text(tree, ", Double: %lg", attr_double); + + proto_tree_add_item(tree, hf_zbee_zcl_attr_double, tvb, *offset, 8, TRUE); + } + *offset += 8; + break; + + case ZBEE_ZCL_OCTET_STRING: + + /* Display octet string */ + attr_uint = tvb_get_guint8(tvb, *offset); /* string length */ + if (attr_uint == ZBEE_ZCL_INVALID_STR_LENGTH) attr_uint = 0; + + if ( tree ) { + proto_tree_add_uint(tree, hf_zbee_zcl_attr_str_len, tvb, *offset, sizeof(guint8), + attr_uint); + } + *offset += sizeof(guint8); + + attr_string = tvb_bytes_to_str_punct(tvb, *offset, attr_uint, ':'); + if ( tree ) { + proto_item_append_text(tree, ", Octets: %s", attr_string); + + proto_tree_add_string(tree, hf_zbee_zcl_attr_ostr, tvb, *offset, attr_uint, + attr_string); + } + *offset += attr_uint; + break; + + case ZBEE_ZCL_CHAR_STRING: + + /* Display string */ + attr_uint = tvb_get_guint8(tvb, *offset); /* string length */ + if (attr_uint == ZBEE_ZCL_INVALID_STR_LENGTH) attr_uint = 0; + + if ( tree ) { + proto_tree_add_uint(tree, hf_zbee_zcl_attr_str_len, tvb, *offset, sizeof(guint8), + attr_uint); + } + *offset += sizeof(guint8); + + attr_string = tvb_get_string(tvb, *offset, attr_uint); + if ( tree ) { + proto_item_append_text(tree, ", String: %s", attr_string); + + proto_tree_add_string(tree, hf_zbee_zcl_attr_str, tvb, *offset, attr_uint, + attr_string); + } + *offset += attr_uint; + break; + + case ZBEE_ZCL_LONG_OCTET_STRING: + + /* Display long octet string */ + attr_uint = tvb_get_letohs(tvb, *offset); /* string length */ + if (attr_uint == ZBEE_ZCL_INVALID_LONG_STR_LENGTH) attr_uint = 0; + + if ( tree ) { + proto_tree_add_uint(tree, hf_zbee_zcl_attr_str_len, tvb, *offset, sizeof(guint16), + attr_uint); + } + *offset += sizeof(guint16); + + attr_string = tvb_bytes_to_str_punct(tvb, *offset, attr_uint, ':'); + if ( tree ) { + proto_item_append_text(tree, ", Octets: %s", attr_string); + + proto_tree_add_string(tree, hf_zbee_zcl_attr_ostr, tvb, *offset, attr_uint, + attr_string); + } + *offset += attr_uint; + break; + + case ZBEE_ZCL_LONG_CHAR_STRING: + + /* Display long string */ + attr_uint = tvb_get_letohs(tvb, *offset); /* string length */ + if (attr_uint == ZBEE_ZCL_INVALID_LONG_STR_LENGTH) attr_uint = 0; + + if ( tree ) { + proto_tree_add_uint(tree, hf_zbee_zcl_attr_str_len, tvb, *offset, sizeof(guint16), + attr_uint); + } + *offset += sizeof(guint16); + + attr_string = tvb_get_string(tvb, *offset, attr_uint); + if ( tree ) { + proto_item_append_text(tree, ", String: %s", attr_string); + + proto_tree_add_string(tree, hf_zbee_zcl_attr_str, tvb, *offset, attr_uint, + attr_string); + } + *offset += attr_uint; + break; + + case ZBEE_ZCL_TIME: + /* Dissect Time of Day */ + attr_uint8[0] = dissect_zcl_attr_uint8(tvb, tree, offset, &hf_zbee_zcl_attr_hours); + attr_uint8[1] = dissect_zcl_attr_uint8(tvb, tree, offset, &hf_zbee_zcl_attr_mins); + attr_uint8[2] = dissect_zcl_attr_uint8(tvb, tree, offset, &hf_zbee_zcl_attr_secs); + attr_uint8[3] = dissect_zcl_attr_uint8(tvb, tree, offset, &hf_zbee_zcl_attr_csecs); + + if ( tree ) { + proto_item_append_text(tree, ", Time: %u:%u:%u.%u", + attr_uint8[0], attr_uint8[1], attr_uint8[2], attr_uint8[3]); + } + break; + + case ZBEE_ZCL_DATE: + /* Dissect Date */ + attr_uint8[0] = dissect_zcl_attr_uint8(tvb, tree, offset, &hf_zbee_zcl_attr_yy); + attr_uint8[1] = dissect_zcl_attr_uint8(tvb, tree, offset, &hf_zbee_zcl_attr_mm); + attr_uint8[2] = dissect_zcl_attr_uint8(tvb, tree, offset, &hf_zbee_zcl_attr_md); + attr_uint8[3] = dissect_zcl_attr_uint8(tvb, tree, offset, &hf_zbee_zcl_attr_wd); + + if ( tree ) { + proto_item_append_text(tree, ", Date: %u/%u/%u %s", + attr_uint8[0]+1900, attr_uint8[1], attr_uint8[2], + val_to_str(attr_uint8[3], zbee_zcl_wd_names, "Invalid Weekday") ); + } + break; + + case ZBEE_ZCL_UTC: + /* Display UTC */ + attr_time.secs = (guint32)tvb_get_letohl(tvb, *offset); + attr_time.secs += ZBEE_ZCL_NSTIME_UTC_OFFSET; + attr_time.nsecs = 0; + + if ( tree ) { + proto_item_append_text(tree, ", %s", + val_to_str(data_type, zbee_zcl_short_data_type_names, "Reserved") ); + + proto_tree_add_time(tree, hf_zbee_zcl_attr_utc, tvb, *offset, sizeof(guint), + &attr_time); + } + + *offset += sizeof(guint32); + break; + + case ZBEE_ZCL_CLUSTER_ID: + dissect_zcl_attr_uint16(tvb, tree, offset, &hf_zbee_zcl_attr_cid); + break; + + case ZBEE_ZCL_ATTR_ID: + dissect_zcl_attr_id(tvb, tree, offset); + break; + + case ZBEE_ZCL_BACNET_OID: + dissect_zcl_attr_bytes(tvb, tree, offset, 4); + break; + + case ZBEE_ZCL_IEEE_ADDR: + dissect_zcl_attr_bytes(tvb, tree, offset, 8); + break; + + case ZBEE_ZCL_SECURITY_KEY: + dissect_zcl_attr_bytes(tvb, tree, offset, 16); + break; + + default: + break; + } + + return; +} /* dissect_zcl_attr_data */ + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_attr_big_int + * DESCRIPTION + * Dissects int or uint of up to 64 bits. + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * packet_info *pinfo - pointer to packet information fields + * proto_tree *tree - pointer to data tree ethereal uses to display packet. + * offset - offset into the tvb to begin dissection. + * signed_flag - if TRUE, dissect a signed int + * RETURNS + * void + *--------------------------------------------------------------- + */ +void dissect_zcl_big_int(tvbuff_t *tvb, proto_tree *tree, guint *offset, guint length, + gboolean signed_flag) +{ + guint64 attr_uint64; + + attr_uint64 = tvb_get_letohi(tvb, *offset, length, signed_flag); + + /* add it to tree */ + if ( tree ) { + if ( signed_flag ) { + proto_item_append_text(tree, ", Int: %" G_GINT64_MODIFIER "d", (gint64)attr_uint64); + + proto_tree_add_int64(tree, hf_zbee_zcl_attr_int64, tvb, *offset, length, + (gint64)attr_uint64); + } else { + proto_item_append_text(tree, ", Uint: %" G_GINT64_MODIFIER "u", attr_uint64); + + proto_tree_add_uint64(tree, hf_zbee_zcl_attr_uint64, tvb, *offset, length, + attr_uint64); + } + + } + *offset += length; + + return; +} /* dissect_zcl_attr_big_int */ + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_attr_uint8 + * DESCRIPTION + * Helper dissector for ZCL Attribute commands. + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * proto_tree *tree - pointer to data tree ethereal uses to display packet. + * offset - offset into the tvb to begin dissection. + * hf_zbee_zcl - pointer to header field index + * RETURNS + * guint - dissected data + *--------------------------------------------------------------- + */ +guint dissect_zcl_attr_uint8(tvbuff_t *tvb, proto_tree *tree, guint *offset, int *hf_zbee_zcl) +{ + guint attr_uint; + + attr_uint = tvb_get_guint8(tvb, *offset); + + if ( tree ) { + proto_tree_add_uint(tree, *hf_zbee_zcl, tvb, *offset, sizeof(guint8), attr_uint); + } + (*offset)++; + + return attr_uint; +} + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_attr_uint16 + * DESCRIPTION + * Helper dissector for ZCL Attribute commands. + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * proto_tree *tree - pointer to data tree ethereal uses to display packet. + * offset - offset into the tvb to begin dissection. + * hf_zbee_zcl - pointer to header field index + * RETURNS + * guint - field value + *--------------------------------------------------------------- + */ +guint dissect_zcl_attr_uint16(tvbuff_t *tvb, proto_tree *tree, guint *offset, int *hf_zbee_zcl) +{ + guint attr_uint; + + attr_uint = tvb_get_letohs(tvb, *offset); + + if ( tree ) { + proto_tree_add_uint(tree, *hf_zbee_zcl, tvb, *offset, sizeof(guint16), attr_uint); + } + *offset += sizeof(guint16); + + return attr_uint; +} + +/*FUNCTION:------------------------------------------------------ + * NAME + * dissect_zcl_attr_bytes + * DESCRIPTION + * Helper dissector for ZCL Attribute commands. + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * proto_tree *tree - pointer to data tree ethereal uses to display packet. + * offset - offset into the tvb to begin dissection. + * length - number of bytes to dissect + * RETURNS + * void + *--------------------------------------------------------------- + */ +void dissect_zcl_attr_bytes(tvbuff_t *tvb, proto_tree *tree, guint *offset, guint length) +{ + if ( tree ) { + proto_tree_add_bytes(tree, hf_zbee_zcl_attr_bytes, tvb, *offset, length, + tvb_get_ptr(tvb, *offset, length)); + } + *offset += length; + + return; +} + +/*FUNCTION:------------------------------------------------------ + * NAME + * zdp_dump_excess + * DESCRIPTION + * Helper functions dumps any remaining data into the data dissector. + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * guint offset - offset after parsing last item. + * packet_info *pinfo - packet information structure. + * proto_tree *tree - pointer to data tree Wireshark uses to display packet. + * RETURNS + * void + *--------------------------------------------------------------- + */ +void zcl_dump_data(tvbuff_t *tvb, guint offset, packet_info *pinfo, proto_tree *tree) +{ + proto_tree *root = proto_tree_get_root(tree); + guint length = tvb_length_remaining(tvb, offset); + tvbuff_t *remainder; + + if (length > 0) { + remainder = tvb_new_subset(tvb, offset, length, length); + call_dissector(data_handle, remainder, pinfo, root); + } +} /* zcl_dump_data */ + +/*FUNCTION:------------------------------------------------------ + * NAME + * tvb_get_letohi + * DESCRIPTION + * Gets little endian int or uint of up to 8 bytes from tvb buffer. + * PARAMETERS + * tvbuff_t *tvb - pointer to buffer containing raw packet. + * offset - offset into the tvb to begin dissection. + * length - length of int or uint in bytes + * signed_flag - if TRUE, get a signed int + * RETURNS + * guint64 - value retrieved from tvb buffer + *--------------------------------------------------------------- + */ +guint64 tvb_get_letohi(tvbuff_t *tvb, guint offset, guint length, gboolean signed_flag) +{ + guint64 result; + guint shift; + + result = 0; + shift = 0; + /* build big int of length bytes */ + while ( length-- ) { + result += (guint64)tvb_get_guint8(tvb, offset) << shift; + offset += sizeof(guint8); + shift += 8; + } + + if ( signed_flag && (result >> (shift - 1)) ) { + /* sign extend remaining bytes */ + while ( shift < (sizeof(guint64) * 8) ) { + result += (guint64)0xff << shift; + shift += 8; + } + } + + return result; +} /* tvb_get_letohi */ + +/*FUNCTION:------------------------------------------------------ + * NAME + * proto_register_zbee_zcl + * DESCRIPTION + * ZigBee ZCL protocol registration routine. + * PARAMETERS + * none + * RETURNS + * void + *--------------------------------------------------------------- + */ +void proto_register_zbee_zcl(void) +{ + guint i, j; + + static const true_false_string tfs_client_server = { + "To Client", + "To Server" + }; + + static hf_register_info hf[] = { + { &hf_zbee_zcl_fcf_frame_type, + { "Frame Type", "zbee.zcl.type", FT_UINT8, BASE_HEX, VALS(zbee_zcl_frame_types), + ZBEE_ZCL_FCF_FRAME_TYPE, NULL, HFILL }}, + + { &hf_zbee_zcl_fcf_mfr_spec, + { "Manufacturer Specific", "zbee.zcl.ms", FT_BOOLEAN, 8, NULL, + ZBEE_ZCL_FCF_MFR_SPEC, NULL, HFILL }}, + + { &hf_zbee_zcl_fcf_dir, + { "Direction", "zbee.zcl.dir", FT_BOOLEAN, 8, TFS(&tfs_client_server), + ZBEE_ZCL_FCF_DIRECTION, NULL, HFILL }}, + + { &hf_zbee_zcl_fcf_disable_default_resp, + { "Disable Default Response", "zbee.zcl.ddr", FT_BOOLEAN, 8, NULL, + ZBEE_ZCL_FCF_DISABLE_DEFAULT_RESP, NULL, HFILL }}, + + { &hf_zbee_zcl_mfr_code, + { "Manufacturer Code", "zbee.zcl.cmd.mc", FT_UINT16, BASE_HEX, + VALS(zbee_mfr_code_names), 0x0, "Assigned manufacturer code.", HFILL }}, + + { &hf_zbee_zcl_tran_seqno, + { "Sequence Number", "zbee.zcl.cmd.tsn", FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, + + { &hf_zbee_zcl_cmd_id, + { "Command", "zbee.zcl.cmd.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_cmd_names), + 0x0, NULL, HFILL }}, + + { &hf_zbee_zcl_cs_cmd_id, + { "Command", "zbee.zcl.cs.cmd.id", FT_UINT8, BASE_HEX, "Unknown", + 0x0, NULL, HFILL }}, + + { &hf_zbee_zcl_attr_id, + { "Attribute", "zbee.zcl.attr.id", FT_UINT16, BASE_HEX, NULL, 0x0, + NULL, HFILL }}, + + { &hf_zbee_zcl_attr_data_type, + { "Data Type", "zbee.zcl.attr.data.type", FT_UINT8, BASE_HEX, + VALS(zbee_zcl_data_type_names), 0x0, NULL, HFILL }}, + + { &hf_zbee_zcl_attr_boolean, + { "Boolean", "zbee.zcl.attr.boolean", FT_BOOLEAN, 8, TFS(&tfs_true_false), 0xff, + NULL, HFILL }}, + + { &hf_zbee_zcl_attr_uint8, + { "Uint8", "zbee.zcl.attr.uint8", FT_UINT8, BASE_DEC_HEX, NULL, 0x0, + NULL, HFILL }}, + + { &hf_zbee_zcl_attr_uint16, + { "Uint16", "zbee.zcl.attr.uint16", FT_UINT16, BASE_DEC_HEX, NULL, 0x0, + NULL, HFILL }}, + + { &hf_zbee_zcl_attr_uint24, + { "Uint24", "zbee.zcl.attr.uint24", FT_UINT24, BASE_DEC_HEX, NULL, 0x0, + NULL, HFILL }}, + + { &hf_zbee_zcl_attr_uint32, + { "Uint32", "zbee.zcl.attr.uint32", FT_UINT32, BASE_DEC_HEX, NULL, 0x0, + NULL, HFILL }}, + + { &hf_zbee_zcl_attr_uint64, + { "Uint64", "zbee.zcl.attr.uint64", FT_UINT64, BASE_DEC_HEX, NULL, 0x0, + NULL, HFILL }}, + + { &hf_zbee_zcl_attr_int8, + { "Int8", "zbee.zcl.attr.int8", FT_INT8, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, + + { &hf_zbee_zcl_attr_int16, + { "Int16", "zbee.zcl.attr.int16", FT_INT16, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, + + { &hf_zbee_zcl_attr_int24, + { "Int24", "zbee.zcl.attr.int24", FT_INT24, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, + + { &hf_zbee_zcl_attr_int32, + { "Int32", "zbee.zcl.attr.int32", FT_INT32, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, + + { &hf_zbee_zcl_attr_int64, + { "Int64", "zbee.zcl.attr.int64", FT_INT64, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, + + { &hf_zbee_zcl_attr_semi, + { "Semi Float", "zbee.zcl.attr.float", FT_FLOAT, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, + + { &hf_zbee_zcl_attr_float, + { "Float", "zbee.zcl.attr.float", FT_FLOAT, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, + + { &hf_zbee_zcl_attr_double, + { "Double Float", "zbee.zcl.attr.float", FT_DOUBLE, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, + + { &hf_zbee_zcl_attr_bytes, + { "Bytes", "zbee.zcl.attr.bytes", FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + + { &hf_zbee_zcl_attr_minint, + { "Minimum Interval", "zbee.zcl.attr.minint", FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, + + { &hf_zbee_zcl_attr_maxint, + { "Maximum Interval", "zbee.zcl.attr.maxint", FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, + + { &hf_zbee_zcl_attr_timeout, + { "Timeout", "zbee.zcl.attr.timeout", FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, + + { &hf_zbee_zcl_attr_hours, + { "Hours", "zbee.zcl.attr.hours", FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, + + { &hf_zbee_zcl_attr_mins, + { "Minutes", "zbee.zcl.attr.mins", FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, + + { &hf_zbee_zcl_attr_secs, + { "Seconds", "zbee.zcl.attr.secs", FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, + + { &hf_zbee_zcl_attr_csecs, + { "Centiseconds", "zbee.zcl.attr.csecs", FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, + + { &hf_zbee_zcl_attr_yy, + { "Year", "zbee.zcl.attr.yy", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + + { &hf_zbee_zcl_attr_mm, + { "Month", "zbee.zcl.attr.mm", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + + { &hf_zbee_zcl_attr_md, + { "Day of Month", "zbee.zcl.attr.md", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + + { &hf_zbee_zcl_attr_wd, + { "Day of Week", "zbee.zcl.attr.wd", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + + { &hf_zbee_zcl_attr_utc, + { "UTC", "zbee.zcl.attr.utc", FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + + { &hf_zbee_zcl_attr_status, + { "Status", "zbee.zcl.attr.status", FT_UINT8, BASE_HEX, VALS(zbee_zcl_status_names), + 0x0, NULL, HFILL }}, + + { &hf_zbee_zcl_attr_dir, + { "Direction", "zbee.zcl.attr.dir", FT_UINT8, BASE_HEX, VALS(zbee_zcl_dir_names), + 0x0, NULL, HFILL }}, + + { &hf_zbee_zcl_attr_dis, + { "Discovery", "zbee.zcl.attr.dis", FT_UINT8, BASE_HEX, VALS(zbee_zcl_dis_names), + 0x0, NULL, HFILL }}, + + { &hf_zbee_zcl_attr_cid, + { "Cluster", "zbee.zcl.attr.cid", FT_UINT16, BASE_HEX, NULL, 0x0, + NULL, HFILL }}, + + { &hf_zbee_zcl_attr_start, + { "Start Attribute", "zbee.zcl.attr.start", FT_UINT16, BASE_HEX, NULL, 0x0, + NULL, HFILL }}, + + { &hf_zbee_zcl_attr_maxnum, + { "Maxiumum Number", "zbee.zcl.attr.maxnum", FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, + + { &hf_zbee_zcl_attr_str_len, + { "Length", "zbee.zcl.attr.str.len", FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, + + { &hf_zbee_zcl_attr_str, + { "String", "zbee.zcl.attr.str", FT_STRING, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + + { &hf_zbee_zcl_attr_ostr, + { "Octet String", "zbee.zcl.attr.ostr", FT_STRING, BASE_NONE, NULL, 0x0, + NULL, HFILL }} + }; + + /* ZCL subtrees */ + static gint *ett[ZBEE_ZCL_NUM_INDIVIDUAL_ETT + ZBEE_ZCL_NUM_ATTR_ETT]; + + ett[0] = &ett_zbee_zcl; + ett[1] = &ett_zbee_zcl_fcf; + + j = ZBEE_ZCL_NUM_INDIVIDUAL_ETT; + + /* initialize attribute subtree types */ + for ( i = 0; i < ZBEE_ZCL_NUM_ATTR_ETT; i++, j++) { + ett_zbee_zcl_attr[i] = -1; + ett[j] = &ett_zbee_zcl_attr[i]; + } + + /* Register ZigBee ZCL protocol with Wireshark. */ + proto_zbee_zcl = proto_register_protocol("ZigBee Cluster Library", "ZigBee ZCL", "zbee.zcl"); + proto_register_field_array(proto_zbee_zcl, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + + /* Register the ZCL dissector and subdissector list. */ + register_dissector("zbee.zcl", dissect_zbee_zcl, proto_zbee_zcl); + +} /* proto_register_zbee_zcl */ + +/*FUNCTION:------------------------------------------------------ + * NAME + * proto_reg_handoff_zbee_zcl + * DESCRIPTION + * Finds the dissectors used in this module. + * PARAMETERS + * none + * RETURNS + * void + *--------------------------------------------------------------- + */ +void proto_reg_handoff_zbee_zcl(void) +{ + /* Find the dissectors we need. */ + data_handle = find_dissector("data"); + + /* Register our dissector for the appropriate profiles. */ + zbee_zcl_handle = create_dissector_handle(dissect_zbee_zcl, proto_zbee_zcl); + dissector_add("zbee.profile", ZBEE_PROFILE_IPM, zbee_zcl_handle); + dissector_add("zbee.profile", ZBEE_PROFILE_T1, zbee_zcl_handle); + dissector_add("zbee.profile", ZBEE_PROFILE_HA, zbee_zcl_handle); + dissector_add("zbee.profile", ZBEE_PROFILE_CBA, zbee_zcl_handle); + dissector_add("zbee.profile", ZBEE_PROFILE_WSN, zbee_zcl_handle); + dissector_add("zbee.profile", ZBEE_PROFILE_TA, zbee_zcl_handle); + dissector_add("zbee.profile", ZBEE_PROFILE_HC, zbee_zcl_handle); + dissector_add("zbee.profile", ZBEE_PROFILE_SE, zbee_zcl_handle); + + dissector_add("zbee.profile", ZBEE_PROFILE_C4_CL, zbee_zcl_handle); +} /* proto_reg_handoff_zbee_zcl */ diff --git a/epan/dissectors/packet-zbee-zcl.h b/epan/dissectors/packet-zbee-zcl.h new file mode 100644 index 0000000000..55afdf7958 --- /dev/null +++ b/epan/dissectors/packet-zbee-zcl.h @@ -0,0 +1,178 @@ +/* packet-zbee-zcl.h + * Dissector routines for the ZigBee Cluster Library (ZCL) + * By Fred Fierling <fff@exegin.com> + * Copyright 2009 Exegin Technologies Limited + * + * $Id:$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef PACKET_ZBEE_ZCL_H +#define PACKET_ZBEE_ZCL_H + +/* Structure to contain the ZCL frame information */ +typedef struct{ + gboolean mfr_spec; + gboolean direction; + gboolean disable_default_resp; + + guint8 frame_type; + guint16 mfr_code; + guint8 tran_seqno; + guint8 cmd_id; +} zbee_zcl_packet; + +/* ZCL Commands */ +#define ZBEE_ZCL_CMD_READ_ATTR 0x00 +#define ZBEE_ZCL_CMD_READ_ATTR_RESP 0x01 +#define ZBEE_ZCL_CMD_WRITE_ATTR 0x02 +#define ZBEE_ZCL_CMD_WRITE_ATTR_UNDIVIDED 0x03 +#define ZBEE_ZCL_CMD_WRITE_ATTR_RESP 0x04 +#define ZBEE_ZCL_CMD_WRITE_ATTR_NO_RESP 0x05 +#define ZBEE_ZCL_CMD_CONFIG_REPORT 0x06 +#define ZBEE_ZCL_CMD_CONFIG_REPORT_RESP 0x07 +#define ZBEE_ZCL_CMD_READ_REPORT_CONFIG 0x08 +#define ZBEE_ZCL_CMD_READ_REPORT_CONFIG_RESP 0x09 +#define ZBEE_ZCL_CMD_REPORT_ATTR 0x0a +#define ZBEE_ZCL_CMD_DEFAULT_RESP 0x0b +#define ZBEE_ZCL_CMD_DISCOVER_ATTR 0x0c +#define ZBEE_ZCL_CMD_DISCOVER_ATTR_RESP 0x0d +#define ZBEE_ZCL_CMD_READ_ATTR_STRUCT 0x0e +#define ZBEE_ZCL_CMD_WRITE_ATTR_STRUCT 0x0f +#define ZBEE_ZCL_CMD_WRITE_ATTR_STRUCT_RESP 0x10 + +/* ZCL Data Types */ +#define ZBEE_ZCL_NO_DATA 0x00 + +#define ZBEE_ZCL_8_BIT_DATA 0x08 +#define ZBEE_ZCL_16_BIT_DATA 0x09 +#define ZBEE_ZCL_24_BIT_DATA 0x0a +#define ZBEE_ZCL_32_BIT_DATA 0x0b +#define ZBEE_ZCL_40_BIT_DATA 0x0c +#define ZBEE_ZCL_48_BIT_DATA 0x0d +#define ZBEE_ZCL_56_BIT_DATA 0x0e +#define ZBEE_ZCL_64_BIT_DATA 0x0f + +#define ZBEE_ZCL_BOOLEAN 0x10 + +#define ZBEE_ZCL_8_BIT_BITMAP 0x18 +#define ZBEE_ZCL_16_BIT_BITMAP 0x19 +#define ZBEE_ZCL_24_BIT_BITMAP 0x1a +#define ZBEE_ZCL_32_BIT_BITMAP 0x1b +#define ZBEE_ZCL_40_BIT_BITMAP 0x1c +#define ZBEE_ZCL_48_BIT_BITMAP 0x1d +#define ZBEE_ZCL_56_BIT_BITMAP 0x1e +#define ZBEE_ZCL_64_BIT_BITMAP 0x1f + +#define ZBEE_ZCL_8_BIT_UINT 0x20 +#define ZBEE_ZCL_16_BIT_UINT 0x21 +#define ZBEE_ZCL_24_BIT_UINT 0x22 +#define ZBEE_ZCL_32_BIT_UINT 0x23 +#define ZBEE_ZCL_40_BIT_UINT 0x24 +#define ZBEE_ZCL_48_BIT_UINT 0x25 +#define ZBEE_ZCL_56_BIT_UINT 0x26 +#define ZBEE_ZCL_64_BIT_UINT 0x27 + +#define ZBEE_ZCL_8_BIT_INT 0x28 +#define ZBEE_ZCL_16_BIT_INT 0x29 +#define ZBEE_ZCL_24_BIT_INT 0x2a +#define ZBEE_ZCL_32_BIT_INT 0x2b +#define ZBEE_ZCL_40_BIT_INT 0x2c +#define ZBEE_ZCL_48_BIT_INT 0x2d +#define ZBEE_ZCL_56_BIT_INT 0x2e +#define ZBEE_ZCL_64_BIT_INT 0x2f + +#define ZBEE_ZCL_8_BIT_ENUM 0x30 +#define ZBEE_ZCL_16_BIT_ENUM 0x31 + +#define ZBEE_ZCL_SEMI_FLOAT 0x38 +#define ZBEE_ZCL_SINGLE_FLOAT 0x39 +#define ZBEE_ZCL_DOUBLE_FLOAT 0x3a + +#define ZBEE_ZCL_OCTET_STRING 0x41 +#define ZBEE_ZCL_CHAR_STRING 0x42 +#define ZBEE_ZCL_LONG_OCTET_STRING 0x43 +#define ZBEE_ZCL_LONG_CHAR_STRING 0x44 + +#define ZBEE_ZCL_ARRAY 0x48 +#define ZBEE_ZCL_STRUCT 0x4c + +#define ZBEE_ZCL_SET 0x50 +#define ZBEE_ZCL_BAG 0x51 + +#define ZBEE_ZCL_TIME 0xe0 +#define ZBEE_ZCL_DATE 0xe1 +#define ZBEE_ZCL_UTC 0xe2 + +#define ZBEE_ZCL_CLUSTER_ID 0xe8 +#define ZBEE_ZCL_ATTR_ID 0xe9 +#define ZBEE_ZCL_BACNET_OID 0xea + +#define ZBEE_ZCL_IEEE_ADDR 0xf0 +#define ZBEE_ZCL_SECURITY_KEY 0xf1 + +#define ZBEE_ZCL_UNKNOWN 0xff + +/* ZCL Miscellaneous */ +#define ZBEE_ZCL_INVALID_STR_LENGTH 0xff +#define ZBEE_ZCL_INVALID_LONG_STR_LENGTH 0xffff +#define ZBEE_ZCL_NUM_INDIVIDUAL_ETT 2 +#define ZBEE_ZCL_NUM_ATTR_ETT 64 +#define ZBEE_ZCL_DIR_REPORTED 0 +#define ZBEE_ZCL_DIR_RECEIVED 1 +/* seconds elapsed from year 1970 to 2000 */ +#define ZBEE_ZCL_NSTIME_UTC_OFFSET (((3*365 + 366)*7 + 2*365)*24*3600) +#define IS_ANALOG_SUBTYPE(x) ( (x & 0xe0) == 0x20 || (x & 0xe0) == 0xe0 ) + +/* ZCL Status Enumerations */ +#define ZBEE_ZCL_STAT_SUCCESS 0x00 +#define ZBEE_ZCL_STAT_FAILURE 0x01 + +#define ZBEE_ZCL_STAT_NOT_AUTHORIZED 0x7e +#define ZBEE_ZCL_STAT_RESERVED_FIELD_NOT_ZERO 0x7f +#define ZBEE_ZCL_STAT_MALFORMED_CMD 0x80 +#define ZBEE_ZCL_STAT_UNSUP_CLUSTER_CMD 0x81 +#define ZBEE_ZCL_STAT_UNSUP_GENERAL_CMD 0x82 +#define ZBEE_ZCL_STAT_UNSUP_MFR_CLUSTER_CMD 0x83 +#define ZBEE_ZCL_STAT_UNSUP_MFR_GENERAL_CMD 0x84 +#define ZBEE_ZCL_STAT_INVALID_FIELD 0x85 +#define ZBEE_ZCL_STAT_UNSUPPORTED_ATTR 0x86 +#define ZBEE_ZCL_STAT_INSUFFICIENT_SPACE 0x87 +#define ZBEE_ZCL_STAT_DUPLICATE_EXISTS 0x88 +#define ZBEE_ZCL_STAT_NOT_FOUND 0x89 +#define ZBEE_ZCL_STAT_UNREPORTABLE_ATTR 0x8a +#define ZBEE_ZCL_STAT_INVALID_DATA_TYPE 0x8b +#define ZBEE_ZCL_STAT_INVALID_SELECTOR 0x8c +#define ZBEE_ZCL_STAT_WRITE_ONLY 0x8d +#define ZBEE_ZCL_STAT_INCONSISTENT_STARTUP_STATE 0x8e +#define ZBEE_ZCL_STAT_DEFINED_OUT_OF_BAND 0x8f +#define ZBEE_ZCL_STAT_HARDWARE_FAILURE 0x90 +#define ZBEE_ZCL_STAT_SOFTWARE_FAILURE 0x91 + +#define ZBEE_ZCL_STAT_CALIBRATION_ERROR 0xc0 +#define ZBEE_ZCL_STAT_INVALID_VALUE 0xc1 +#define ZBEE_ZCL_STAT_READ_ONLY 0xc2 + +/* Misc. */ +#define INT24_SIGN_BITS 0xffff8000 +#define MONTHS_PER_YEAR 12 +#define YEAR_OFFSET 1900 + +#endif /* PACKET_ZBEE_ZCL_H*/ diff --git a/epan/dissectors/packet-zbee-zdp.c b/epan/dissectors/packet-zbee-zdp.c index e6969cf4fa..3193886437 100644 --- a/epan/dissectors/packet-zbee-zdp.c +++ b/epan/dissectors/packet-zbee-zdp.c @@ -1096,7 +1096,12 @@ dissect_zbee_zdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_root = proto_tree_add_protocol_format(tree, proto_zbee_zdp, tvb, offset, tvb_length(tvb), "ZigBee Device Profile"); zdp_tree = proto_item_add_subtree(proto_root, ett_zbee_zdp); } - +#if 0 + /* Overwrite the protocol column */ + if (check_col(pinfo->cinfo, COL_PROTOCOL)) { + col_set_str(pinfo->cinfo, COL_PROTOCOL, "ZigBee ZDP"); + } +#endif /* Get and display the sequence number. */ seqno = tvb_get_guint8(tvb, offset); if (tree) { diff --git a/epan/dissectors/packet-zbee.h b/epan/dissectors/packet-zbee.h index 89b04473aa..2e0f11af79 100644 --- a/epan/dissectors/packet-zbee.h +++ b/epan/dissectors/packet-zbee.h @@ -36,25 +36,549 @@ #define ZBEE_BCAST_LOW_POWER_ROUTERS 0xfffb /* Capability Information fields. */ -#define ZBEE_CINFO_ALT_COORD IEEE802154_CMD_CINFO_ALT_PAN_COORD -#define ZBEE_CINFO_FFD IEEE802154_CMD_CINFO_DEVICE_TYPE -#define ZBEE_CINFO_POWER IEEE802154_CMD_CINFO_POWER_SRC -#define ZBEE_CINFO_IDLE_RX IEEE802154_CMD_CINFO_IDLE_RX -#define ZBEE_CINFO_SECURITY IEEE802154_CMD_CINFO_SEC_CAPABLE -#define ZBEE_CINFO_ALLOC IEEE802154_CMD_CINFO_ALLOC_ADDR +#define ZBEE_CINFO_ALT_COORD IEEE802154_CMD_CINFO_ALT_PAN_COORD +#define ZBEE_CINFO_FFD IEEE802154_CMD_CINFO_DEVICE_TYPE +#define ZBEE_CINFO_POWER IEEE802154_CMD_CINFO_POWER_SRC +#define ZBEE_CINFO_IDLE_RX IEEE802154_CMD_CINFO_IDLE_RX +#define ZBEE_CINFO_SECURITY IEEE802154_CMD_CINFO_SEC_CAPABLE +#define ZBEE_CINFO_ALLOC IEEE802154_CMD_CINFO_ALLOC_ADDR /* ZigBee version numbers. */ -#define ZBEE_VERSION_PROTOTYPE 0 /* Does this even exist? */ -#define ZBEE_VERSION_2004 1 /* Re: 053474r06ZB_TSC-ZigBeeSpecification.pdf */ -#define ZBEE_VERSION_2007 2 /* Re: 053474r17ZB_TSC-ZigBeeSpecification.pdf */ +#define ZBEE_VERSION_PROTOTYPE 0 /* Does this even exist? */ +#define ZBEE_VERSION_2004 1 /* Re: 053474r06ZB_TSC-ZigBeeSpecification.pdf */ +#define ZBEE_VERSION_2007 2 /* Re: 053474r17ZB_TSC-ZigBeeSpecification.pdf */ /* ZigBee version macro. */ -#define ZBEE_HAS_2003(x) ((x) >= ZBEE_VERSION_2003) -#define ZBEE_HAS_2006(x) ((x) >= ZBEE_VERSION_2007) -#define ZBEE_HAS_2007(x) ((x) >= ZBEE_VERSION_2007) +#define ZBEE_HAS_2003(x) ((x) >= ZBEE_VERSION_2003) +#define ZBEE_HAS_2006(x) ((x) >= ZBEE_VERSION_2007) +#define ZBEE_HAS_2007(x) ((x) >= ZBEE_VERSION_2007) + +/* ZigBee Application Profile IDs */ +#define ZBEE_DEVICE_PROFILE 0x0000 + +#define ZBEE_PROFILE_IPM 0x0101 + +#define ZBEE_PROFILE_T1 0x0103 +#define ZBEE_PROFILE_HA 0x0104 +#define ZBEE_PROFILE_CBA 0x0105 +#define ZBEE_PROFILE_WSN 0x0106 +#define ZBEE_PROFILE_TA 0x0107 +#define ZBEE_PROFILE_HC 0x0108 +#define ZBEE_PROFILE_SE 0x0109 + +#define ZBEE_PROFILE_STD_MIN 0x0000 +#define ZBEE_PROFILE_STD_MAX 0x7eff + +/* ZigBee Reserved */ +#define ZBEE_PROFILE_T2 0x7f01 + +/* Application Profile ID Ranges */ +#define ZBEE_PROFILE_RSVD0_MIN 0x7f00 +#define ZBEE_PROFILE_RSVD0_MAX 0x7fff + +#define ZBEE_PROFILE_RSVD1_MIN 0x8000 +#define ZBEE_PROFILE_RSVD1_MAX 0xbeff + +/* Organization Profile IDs */ +#define ZBEE_PROFILE_IEEE_1451_5 0xbf00 + +#define ZBEE_PROFILE_MFR_SPEC_ORG_MIN 0xbf00 +#define ZBEE_PROFILE_MFR_SPEC_ORG_MAX 0xbfff + +/* Manufacturer Profile ID Allocations */ +#define ZBEE_PROFILE_CIRRONET_0_MIN 0xc000 +#define ZBEE_PROFILE_CIRRONET_0_MAX 0xc002 +#define ZBEE_PROFILE_CHIPCON_MIN 0xc003 +#define ZBEE_PROFILE_CHIPCON_MAX 0xc00c +#define ZBEE_PROFILE_EMBER_MIN 0xc00d +#define ZBEE_PROFILE_EMBER_MAX 0xc016 +#define ZBEE_PROFILE_NTS_MIN 0xc017 +#define ZBEE_PROFILE_NTS_MAX 0xc020 +#define ZBEE_PROFILE_FREESCALE_MIN 0xc021 +#define ZBEE_PROFILE_FREESCALE_MAX 0xc02a +#define ZBEE_PROFILE_IPCOM_MIN 0xc02b +#define ZBEE_PROFILE_IPCOM_MAX 0xc034 +#define ZBEE_PROFILE_SAN_JUAN_MIN 0xc035 +#define ZBEE_PROFILE_SAN_JUAN_MAX 0xc036 +#define ZBEE_PROFILE_TUV_MIN 0xc037 +#define ZBEE_PROFILE_TUV_MAX 0xc040 +#define ZBEE_PROFILE_COMPXS_MIN 0xc041 +#define ZBEE_PROFILE_COMPXS_MAX 0xc04a +#define ZBEE_PROFILE_BM_MIN 0xc04b +#define ZBEE_PROFILE_BM_MAX 0xc04d +#define ZBEE_PROFILE_AWAREPOINT_MIN 0xc04e +#define ZBEE_PROFILE_AWAREPOINT_MAX 0xc057 +#define ZBEE_PROFILE_SAN_JUAN_1_MIN 0xc058 +#define ZBEE_PROFILE_SAN_JUAN_1_MAX 0xc05d +#define ZBEE_PROFILE_PHILIPS_MIN 0xc05e +#define ZBEE_PROFILE_PHILIPS_MAX 0xc067 +#define ZBEE_PROFILE_LUXOFT_MIN 0xc068 +#define ZBEE_PROFILE_LUXOFT_MAX 0xc071 +#define ZBEE_PROFILE_KORWIN_MIN 0xc072 +#define ZBEE_PROFILE_KORWIN_MAX 0xc07b +#define ZBEE_PROFILE_1_RF_MIN 0xc07c +#define ZBEE_PROFILE_1_RF_MAX 0xc085 +#define ZBEE_PROFILE_STG_MIN 0xc086 +#define ZBEE_PROFILE_STG_MAX 0xc08f +#define ZBEE_PROFILE_TELEGESIS_MIN 0xc090 +#define ZBEE_PROFILE_TELEGESIS_MAX 0xc099 +#define ZBEE_PROFILE_CIRRONET_1_MIN 0xc09a +#define ZBEE_PROFILE_CIRRONET_1_MAX 0xc0a0 +#define ZBEE_PROFILE_VISIONIC_MIN 0xc0a1 +#define ZBEE_PROFILE_VISIONIC_MAX 0xc0aa +#define ZBEE_PROFILE_INSTA_MIN 0xc0ab +#define ZBEE_PROFILE_INSTA_MAX 0xc0b4 +#define ZBEE_PROFILE_ATALUM_MIN 0xc0b5 +#define ZBEE_PROFILE_ATALUM_MAX 0xc0be +#define ZBEE_PROFILE_ATMEL_MIN 0xc0bf +#define ZBEE_PROFILE_ATMEL_MAX 0xc0c8 +#define ZBEE_PROFILE_DEVELCO_MIN 0xc0c9 +#define ZBEE_PROFILE_DEVELCO_MAX 0xc0d2 +#define ZBEE_PROFILE_HONEYWELL_MIN 0xc0d3 +#define ZBEE_PROFILE_HONEYWELL_MAX 0xc0dc +#define ZBEE_PROFILE_NEC_MIN 0xc0dd +#define ZBEE_PROFILE_NEC_MAX 0xc0e6 +#define ZBEE_PROFILE_YAMATAKE_MIN 0xc0e7 +#define ZBEE_PROFILE_YAMATAKE_MAX 0xc0f0 +#define ZBEE_PROFILE_TENDRIL_MIN 0xc0f1 +#define ZBEE_PROFILE_TENDRIL_MAX 0xc0fa +#define ZBEE_PROFILE_ASSA_MIN 0xc0fb +#define ZBEE_PROFILE_ASSA_MAX 0xc104 +#define ZBEE_PROFILE_MAXSTREAM_MIN 0xc105 +#define ZBEE_PROFILE_MAXSTREAM_MAX 0xc10e +#define ZBEE_PROFILE_XANADU_MIN 0xc10f +#define ZBEE_PROFILE_XANADU_MAX 0xc118 +#define ZBEE_PROFILE_NEUROCOM_MIN 0xc119 +#define ZBEE_PROFILE_NEUROCOM_MAX 0xc122 +#define ZBEE_PROFILE_III_MIN 0xc123 +#define ZBEE_PROFILE_III_MAX 0xc12c +#define ZBEE_PROFILE_VANTAGE_MIN 0xc12d +#define ZBEE_PROFILE_VANTAGE_MAX 0xc12f +#define ZBEE_PROFILE_ICONTROL_MIN 0xc130 +#define ZBEE_PROFILE_ICONTROL_MAX 0xc139 +#define ZBEE_PROFILE_RAYMARINE_MIN 0xc13a +#define ZBEE_PROFILE_RAYMARINE_MAX 0xc143 +#define ZBEE_PROFILE_RENESAS_MIN 0xc144 +#define ZBEE_PROFILE_RENESAS_MAX 0xc14d +#define ZBEE_PROFILE_LSR_MIN 0xc14e +#define ZBEE_PROFILE_LSR_MAX 0xc157 +#define ZBEE_PROFILE_ONITY_MIN 0xc158 +#define ZBEE_PROFILE_ONITY_MAX 0xc161 +#define ZBEE_PROFILE_MONO_MIN 0xc162 +#define ZBEE_PROFILE_MONO_MAX 0xc16b +#define ZBEE_PROFILE_RFT_MIN 0xc16c +#define ZBEE_PROFILE_RFT_MAX 0xc175 +#define ZBEE_PROFILE_ITRON_MIN 0xc176 +#define ZBEE_PROFILE_ITRON_MAX 0xc17f +#define ZBEE_PROFILE_TRITECH_MIN 0xc180 +#define ZBEE_PROFILE_TRITECH_MAX 0xc189 +#define ZBEE_PROFILE_EMBEDIT_MIN 0xc18a +#define ZBEE_PROFILE_EMBEDIT_MAX 0xc193 +#define ZBEE_PROFILE_S3C_MIN 0xc194 +#define ZBEE_PROFILE_S3C_MAX 0xc19d +#define ZBEE_PROFILE_SIEMENS_MIN 0xc19e +#define ZBEE_PROFILE_SIEMENS_MAX 0xc1a7 +#define ZBEE_PROFILE_MINDTECH_MIN 0xc1a8 +#define ZBEE_PROFILE_MINDTECH_MAX 0xc1b1 +#define ZBEE_PROFILE_LGE_MIN 0xc1b2 +#define ZBEE_PROFILE_LGE_MAX 0xc1bb +#define ZBEE_PROFILE_MITSUBISHI_MIN 0xc1bc +#define ZBEE_PROFILE_MITSUBISHI_MAX 0xc1c5 +#define ZBEE_PROFILE_JOHNSON_MIN 0xc1c6 +#define ZBEE_PROFILE_JOHNSON_MAX 0xc1cf +#define ZBEE_PROFILE_PRI_MIN 0xc1d0 +#define ZBEE_PROFILE_PRI_MAX 0xc1d9 +#define ZBEE_PROFILE_KNICK_MIN 0xc1da +#define ZBEE_PROFILE_KNICK_MAX 0xc1e3 +#define ZBEE_PROFILE_VICONICS_MIN 0xc1e4 +#define ZBEE_PROFILE_VICONICS_MAX 0xc1ed +#define ZBEE_PROFILE_FLEXIPANEL_MIN 0xc1ee +#define ZBEE_PROFILE_FLEXIPANEL_MAX 0xc1f7 +#define ZBEE_PROFILE_TRANE_MIN 0xc1f8 +#define ZBEE_PROFILE_TRANE_MAX 0xc201 +#define ZBEE_PROFILE_JENNIC_MIN 0xc202 +#define ZBEE_PROFILE_JENNIC_MAX 0xc20b +#define ZBEE_PROFILE_LIG_MIN 0xc20c +#define ZBEE_PROFILE_LIG_MAX 0xc215 +#define ZBEE_PROFILE_ALERTME_MIN 0xc216 +#define ZBEE_PROFILE_ALERTME_MAX 0xc21f +#define ZBEE_PROFILE_DAINTREE_MIN 0xc220 +#define ZBEE_PROFILE_DAINTREE_MAX 0xc229 +#define ZBEE_PROFILE_AIJI_MIN 0xc22a +#define ZBEE_PROFILE_AIJI_MAX 0xc233 +#define ZBEE_PROFILE_TEL_ITALIA_MIN 0xc234 +#define ZBEE_PROFILE_TEL_ITALIA_MAX 0xc23d +#define ZBEE_PROFILE_MIKROKRETS_MIN 0xc23e +#define ZBEE_PROFILE_MIKROKRETS_MAX 0xc247 +#define ZBEE_PROFILE_OKI_MIN 0xc248 +#define ZBEE_PROFILE_OKI_MAX 0xc251 +#define ZBEE_PROFILE_NEWPORT_MIN 0xc252 +#define ZBEE_PROFILE_NEWPORT_MAX 0xc25b + +#define ZBEE_PROFILE_C4_CL 0xc25d +#define ZBEE_PROFILE_C4_MIN 0xc25c +#define ZBEE_PROFILE_C4_MAX 0xc265 + +#define ZBEE_PROFILE_STM_MIN 0xc266 +#define ZBEE_PROFILE_STM_MAX 0xc26f +#define ZBEE_PROFILE_ASN_MIN 0xc270 +#define ZBEE_PROFILE_ASN_MAX 0xc270 +#define ZBEE_PROFILE_DCSI_MIN 0xc271 +#define ZBEE_PROFILE_DCSI_MAX 0xc27a +#define ZBEE_PROFILE_FRANCE_TEL_MIN 0xc27b +#define ZBEE_PROFILE_FRANCE_TEL_MAX 0xc284 +#define ZBEE_PROFILE_MUNET_MIN 0xc285 +#define ZBEE_PROFILE_MUNET_MAX 0xc28e +#define ZBEE_PROFILE_AUTANI_MIN 0xc28f +#define ZBEE_PROFILE_AUTANI_MAX 0xc298 +#define ZBEE_PROFILE_COL_VNET_MIN 0xc299 +#define ZBEE_PROFILE_COL_VNET_MAX 0xc2a2 +#define ZBEE_PROFILE_AEROCOMM_MIN 0xc2a3 +#define ZBEE_PROFILE_AEROCOMM_MAX 0xc2ac +#define ZBEE_PROFILE_SI_LABS_MIN 0xc2ad +#define ZBEE_PROFILE_SI_LABS_MAX 0xc2b6 +#define ZBEE_PROFILE_INNCOM_MIN 0xc2b7 +#define ZBEE_PROFILE_INNCOM_MAX 0xc2c0 +#define ZBEE_PROFILE_CANNON_MIN 0xc2c1 +#define ZBEE_PROFILE_CANNON_MAX 0xc2ca +#define ZBEE_PROFILE_SYNAPSE_MIN 0xc2cb +#define ZBEE_PROFILE_SYNAPSE_MAX 0xc2d4 +#define ZBEE_PROFILE_FPS_MIN 0xc2d5 +#define ZBEE_PROFILE_FPS_MAX 0xc2de +#define ZBEE_PROFILE_CLS_MIN 0xc2df +#define ZBEE_PROFILE_CLS_MAX 0xc2e8 +#define ZBEE_PROFILE_CRANE_MIN 0xc2e9 +#define ZBEE_PROFILE_CRANE_MAX 0xc2f2 +#define ZBEE_PROFILE_ASN_1_MIN 0xc2f3 +#define ZBEE_PROFILE_ASN_1_MAX 0xc2fb +#define ZBEE_PROFILE_MOBILARM_MIN 0xc2fc +#define ZBEE_PROFILE_MOBILARM_MAX 0xc305 +#define ZBEE_PROFILE_IMONITOR_MIN 0xc306 +#define ZBEE_PROFILE_IMONITOR_MAX 0xc30f +#define ZBEE_PROFILE_BARTECH_MIN 0xc310 +#define ZBEE_PROFILE_BARTECH_MAX 0xc319 +#define ZBEE_PROFILE_MESHNETICS_MIN 0xc31a +#define ZBEE_PROFILE_MESHNETICS_MAX 0xc323 +#define ZBEE_PROFILE_LS_IND_MIN 0xc324 +#define ZBEE_PROFILE_LS_IND_MAX 0xc32d +#define ZBEE_PROFILE_CASON_MIN 0xc32e +#define ZBEE_PROFILE_CASON_MAX 0xc337 +#define ZBEE_PROFILE_WLESS_GLUE_MIN 0xc338 +#define ZBEE_PROFILE_WLESS_GLUE_MAX 0xc341 +#define ZBEE_PROFILE_ELSTER_MIN 0xc342 +#define ZBEE_PROFILE_ELSTER_MAX 0xc34b +#define ZBEE_PROFILE_ONSET_MIN 0xc34c +#define ZBEE_PROFILE_ONSET_MAX 0xc355 +#define ZBEE_PROFILE_RIGA_MIN 0xc356 +#define ZBEE_PROFILE_RIGA_MAX 0xc35f +#define ZBEE_PROFILE_ENERGATE_MIN 0xc360 +#define ZBEE_PROFILE_ENERGATE_MAX 0xc369 +#define ZBEE_PROFILE_VANTAGE_1_MIN 0xc36a +#define ZBEE_PROFILE_VANTAGE_1_MAX 0xc370 +#define ZBEE_PROFILE_CONMED_MIN 0xc371 +#define ZBEE_PROFILE_CONMED_MAX 0xc37a +#define ZBEE_PROFILE_SMS_TEC_MIN 0xc37b +#define ZBEE_PROFILE_SMS_TEC_MAX 0xc384 +#define ZBEE_PROFILE_POWERMAND_MIN 0xc385 +#define ZBEE_PROFILE_POWERMAND_MAX 0xc38e +#define ZBEE_PROFILE_SCHNEIDER_MIN 0xc38f +#define ZBEE_PROFILE_SCHNEIDER_MAX 0xc398 +#define ZBEE_PROFILE_EATON_MIN 0xc399 +#define ZBEE_PROFILE_EATON_MAX 0xc3a2 +#define ZBEE_PROFILE_TELULAR_MIN 0xc3a3 +#define ZBEE_PROFILE_TELULAR_MAX 0xc3ac +#define ZBEE_PROFILE_DELPHI_MIN 0xc3ad +#define ZBEE_PROFILE_DELPHI_MAX 0xc3b6 +#define ZBEE_PROFILE_EPISENSOR_MIN 0xc3b7 +#define ZBEE_PROFILE_EPISENSOR_MAX 0xc3c0 +#define ZBEE_PROFILE_LANDIS_GYR_MIN 0xc3c1 +#define ZBEE_PROFILE_LANDIS_GYR_MAX 0xc3ca +#define ZBEE_PROFILE_SHURE_MIN 0xc3cb +#define ZBEE_PROFILE_SHURE_MAX 0xc3d4 +#define ZBEE_PROFILE_COMVERGE_MIN 0xc3d5 +#define ZBEE_PROFILE_COMVERGE_MAX 0xc3df +#define ZBEE_PROFILE_KABA_MIN 0xc3e0 +#define ZBEE_PROFILE_KABA_MAX 0xc3e9 +#define ZBEE_PROFILE_HIDALGO_MIN 0xc3ea +#define ZBEE_PROFILE_HIDALGO_MAX 0xc3f3 +#define ZBEE_PROFILE_AIR2APP_MIN 0xc3f4 +#define ZBEE_PROFILE_AIR2APP_MAX 0xc3fd +#define ZBEE_PROFILE_AMX_MIN 0xc3fe +#define ZBEE_PROFILE_AMX_MAX 0xc407 +#define ZBEE_PROFILE_EDMI_MIN 0xc408 +#define ZBEE_PROFILE_EDMI_MAX 0xc411 +#define ZBEE_PROFILE_CYAN_MIN 0xc412 +#define ZBEE_PROFILE_CYAN_MAX 0xc41b +#define ZBEE_PROFILE_SYS_SPA_MIN 0xc41c +#define ZBEE_PROFILE_SYS_SPA_MAX 0xc425 +#define ZBEE_PROFILE_TELIT_MIN 0xc426 +#define ZBEE_PROFILE_TELIT_MAX 0xc42f +#define ZBEE_PROFILE_KAGA_MIN 0xc430 +#define ZBEE_PROFILE_KAGA_MAX 0xc439 +#define ZBEE_PROFILE_4_NOKS_MIN 0xc43a +#define ZBEE_PROFILE_4_NOKS_MAX 0xc443 + +/* Unallocated Manufacturer IDs */ +#define ZBEE_PROFILE_UNALLOCATED_MIN 0xc000 +#define ZBEE_PROFILE_UNALLOCATED_MAX 0xffff + + +/* Frame Control Field */ +#define ZBEE_ZCL_FCF_FRAME_TYPE 0x03 +#define ZBEE_ZCL_FCF_MFR_SPEC 0x04 +#define ZBEE_ZCL_FCF_DIRECTION 0x08 +#define ZBEE_ZCL_FCF_DISABLE_DEFAULT_RESP 0x10 + +#define ZBEE_ZCL_FCF_PROFILE_WIDE 0x00 +#define ZBEE_ZCL_FCF_CLUSTER_SPEC 0x01 + +/* Manufacturer Codes */ +#define ZBEE_MFG_CODE_CIRRONET 0x1000 +#define ZBEE_MFG_CODE_CHIPCON 0x1001 +#define ZBEE_MFG_CODE_EMBER 0x1002 +#define ZBEE_MFG_CODE_NTS 0x1003 +#define ZBEE_MFG_CODE_FREESCALE 0x1004 +#define ZBEE_MFG_CODE_IPCOM 0x1005 +#define ZBEE_MFG_CODE_SAN_JUAN 0x1006 +#define ZBEE_MFG_CODE_TUV 0x1007 +#define ZBEE_MFG_CODE_COMPXS 0x1008 +#define ZBEE_MFG_CODE_BM 0x1009 +#define ZBEE_MFG_CODE_AWAREPOINT 0x100a +#define ZBEE_MFG_CODE_PHILIPS 0x100b +#define ZBEE_MFG_CODE_LUXOFT 0x100c +#define ZBEE_MFG_CODE_KORWIN 0x100d +#define ZBEE_MFG_CODE_1_RF 0x100e +#define ZBEE_MFG_CODE_STG 0x101f + +#define ZBEE_MFG_CODE_TELEGESIS 0x1010 +#define ZBEE_MFG_CODE_VISIONIC 0x1011 +#define ZBEE_MFG_CODE_INSTA 0x1012 +#define ZBEE_MFG_CODE_ATALUM 0x1013 +#define ZBEE_MFG_CODE_ATMEL 0x1014 +#define ZBEE_MFG_CODE_DEVELCO 0x1015 +#define ZBEE_MFG_CODE_HONEYWELL 0x1016 +/**/ +#define ZBEE_MFG_CODE_RENESAS 0x1018 +#define ZBEE_MFG_CODE_XANADU 0x1019 +#define ZBEE_MFG_CODE_NEC 0x101a +#define ZBEE_MFG_CODE_YAMATAKE 0x101b +#define ZBEE_MFG_CODE_TENDRIL 0x101c +#define ZBEE_MFG_CODE_ASSA 0x101d +#define ZBEE_MFG_CODE_MAXSTREAM 0x101e +#define ZBEE_MFG_CODE_NEUROCOM 0x101f + +#define ZBEE_MFG_CODE_III 0x1020 +#define ZBEE_MFG_CODE_VANTAGE 0x1021 +#define ZBEE_MFG_CODE_ICONTROL 0x1022 +#define ZBEE_MFG_CODE_RAYMARINE 0x1023 +#define ZBEE_MFG_CODE_LSR 0x1024 +#define ZBEE_MFG_CODE_ONITY 0x1025 +#define ZBEE_MFG_CODE_MONO 0x1026 +#define ZBEE_MFG_CODE_RFT 0x1027 +#define ZBEE_MFG_CODE_ITRON 0x1028 +#define ZBEE_MFG_CODE_TRITECH 0x1029 +#define ZBEE_MFG_CODE_EMBEDIT 0x102a +#define ZBEE_MFG_CODE_S3C 0x102b +#define ZBEE_MFG_CODE_SIEMENS 0x102c +#define ZBEE_MFG_CODE_MINDTECH 0x102d +#define ZBEE_MFG_CODE_LGE 0x102e +#define ZBEE_MFG_CODE_MITSUBISHI 0x102f + +#define ZBEE_MFG_CODE_JOHNSON 0x1030 +#define ZBEE_MFG_CODE_PRI 0x1031 +#define ZBEE_MFG_CODE_KNICK 0x1032 +#define ZBEE_MFG_CODE_VICONICS 0x1033 +#define ZBEE_MFG_CODE_FLEXIPANEL 0x1034 +/**/ +#define ZBEE_MFG_CODE_TRANE 0x1036 +#define ZBEE_MFG_CODE_JENNIC 0x1037 +#define ZBEE_MFG_CODE_LIG 0x1038 +#define ZBEE_MFG_CODE_ALERTME 0x1039 +#define ZBEE_MFG_CODE_DAINTREE 0x103a +#define ZBEE_MFG_CODE_AIJI 0x103b +#define ZBEE_MFG_CODE_TEL_ITALIA 0x103c +#define ZBEE_MFG_CODE_MIKROKRETS 0x103d +#define ZBEE_MFG_CODE_OKI 0x103e +#define ZBEE_MFG_CODE_NEWPORT 0x103f + +#define ZBEE_MFG_CODE_C4 0x1040 +#define ZBEE_MFG_CODE_STM 0x1041 +#define ZBEE_MFG_CODE_ASN 0x1042 +#define ZBEE_MFG_CODE_DCSI 0x1043 +#define ZBEE_MFG_CODE_FRANCE_TEL 0x1044 +#define ZBEE_MFG_CODE_MUNET 0x1045 +#define ZBEE_MFG_CODE_AUTANI 0x1046 +#define ZBEE_MFG_CODE_COL_VNET 0x1047 +#define ZBEE_MFG_CODE_AEROCOMM 0x1048 +#define ZBEE_MFG_CODE_SI_LABS 0x1049 +#define ZBEE_MFG_CODE_INNCOM 0x104a +#define ZBEE_MFG_CODE_CANNON 0x104b +#define ZBEE_MFG_CODE_SYNAPSE 0x104c +#define ZBEE_MFG_CODE_FPS 0x104d +#define ZBEE_MFG_CODE_CLS 0x104e +#define ZBEE_MFG_CODE_CRANE 0x104F + +#define ZBEE_MFG_CODE_MOBILARM 0x1050 +#define ZBEE_MFG_CODE_IMONITOR 0x1051 +#define ZBEE_MFG_CODE_BARTECH 0x1052 +#define ZBEE_MFG_CODE_MESHNETICS 0x1053 +#define ZBEE_MFG_CODE_LS_IND 0x1054 +#define ZBEE_MFG_CODE_CASON 0x1055 +#define ZBEE_MFG_CODE_WLESS_GLUE 0x1056 +#define ZBEE_MFG_CODE_ELSTER 0x1057 +#define ZBEE_MFG_CODE_SMS_TEC 0x1058 +#define ZBEE_MFG_CODE_ONSET 0x1059 +#define ZBEE_MFG_CODE_RIGA 0x105a +#define ZBEE_MFG_CODE_ENERGATE 0x105b +#define ZBEE_MFG_CODE_CONMED 0x105c +#define ZBEE_MFG_CODE_POWERMAND 0x105d +#define ZBEE_MFG_CODE_SCHNEIDER 0x105e +#define ZBEE_MFG_CODE_EATON 0x105f + +#define ZBEE_MFG_CODE_TELULAR 0x1060 +#define ZBEE_MFG_CODE_DELPHI 0x1061 +#define ZBEE_MFG_CODE_EPISENSOR 0x1062 +#define ZBEE_MFG_CODE_LANDIS_GYR 0x1063 +#define ZBEE_MFG_CODE_KABA 0x1064 +#define ZBEE_MFG_CODE_SHURE 0x1065 +#define ZBEE_MFG_CODE_COMVERGE 0x1066 +/**/ +#define ZBEE_MFG_CODE_HIDALGO 0x1069 +#define ZBEE_MFG_CODE_AIR2APP 0x106a +#define ZBEE_MFG_CODE_AMX 0x106b +#define ZBEE_MFG_CODE_EDMI 0x106c +#define ZBEE_MFG_CODE_CYAN 0x106d +#define ZBEE_MFG_CODE_SYS_SPA 0x106e +#define ZBEE_MFG_CODE_TELIT 0x106f + +#define ZBEE_MFG_CODE_KAGA 0x1070 +#define ZBEE_MFG_CODE_4_NOKS 0x1071 + +/* Manufacturer Names */ +#define ZBEE_MFG_CIRRONET "Cirronet" +#define ZBEE_MFG_CHIPCON "Chipcon" +#define ZBEE_MFG_EMBER "Ember" +#define ZBEE_MFG_NTS "National Tech" +#define ZBEE_MFG_FREESCALE "Freescale" +#define ZBEE_MFG_IPCOM "IPCom" +#define ZBEE_MFG_SAN_JUAN "San Juan Software" +#define ZBEE_MFG_TUV "TUV" +#define ZBEE_MFG_COMPXS "CompXs" +#define ZBEE_MFG_BM "BM SpA" +#define ZBEE_MFG_AWAREPOINT "AwarePoint" +#define ZBEE_MFG_PHILIPS "Philips" +#define ZBEE_MFG_LUXOFT "Luxoft" +#define ZBEE_MFG_KORWIN "Korvin" +#define ZBEE_MFG_1_RF "One RF" +#define ZBEE_MFG_STG "Software Technology Group" + +#define ZBEE_MFG_TELEGESIS "Telegesis" +#define ZBEE_MFG_VISIONIC "Visionic" +#define ZBEE_MFG_INSTA "Insta" +#define ZBEE_MFG_ATALUM "Atalum" +#define ZBEE_MFG_ATMEL "Atmel" +#define ZBEE_MFG_DEVELCO "Develco" +#define ZBEE_MFG_HONEYWELL "Honeywell" +/**/ +#define ZBEE_MFG_RENESAS "NEC Engineering" +#define ZBEE_MFG_XANADU "Yamatake" +#define ZBEE_MFG_NEC "Tendril" +#define ZBEE_MFG_YAMATAKE "Assa Abloy" +#define ZBEE_MFG_TENDRIL "MaxStream" +#define ZBEE_MFG_ASSA "Xanadu Wireless" +#define ZBEE_MFG_MAXSTREAM "Neurocom" +#define ZBEE_MFG_NEUROCOM "Institute for Information Industry" + +#define ZBEE_MFG_III "Vantage Controls" +#define ZBEE_MFG_VANTAGE "iControl" +#define ZBEE_MFG_ICONTROL "Raymarine" +#define ZBEE_MFG_RAYMARINE "Renesas" +#define ZBEE_MFG_LSR "LS Research" +#define ZBEE_MFG_ONITY "Onity" +#define ZBEE_MFG_MONO "Mono Products" +#define ZBEE_MFG_RFT "RF Tech" +#define ZBEE_MFG_ITRON "Itron" +#define ZBEE_MFG_TRITECH "Tritech" +#define ZBEE_MFG_EMBEDIT "Embedit" +#define ZBEE_MFG_S3C "S3C" +#define ZBEE_MFG_SIEMENS "Siemens" +#define ZBEE_MFG_MINDTECH "Mindtech" +#define ZBEE_MFG_LGE "LG Electronics" +#define ZBEE_MFG_MITSUBISHI "Mitsubishi" + +#define ZBEE_MFG_JOHNSON "Johnson Controls" +#define ZBEE_MFG_PRI "PRI" +#define ZBEE_MFG_KNICK "Knick" +#define ZBEE_MFG_VICONICS "Viconics" +#define ZBEE_MFG_FLEXIPANEL "Flexipanel" +/**/ +#define ZBEE_MFG_TRANE "Trane" +#define ZBEE_MFG_JENNIC "Jennic" +#define ZBEE_MFG_LIG "Living Independently" +#define ZBEE_MFG_ALERTME "AlertMe" +#define ZBEE_MFG_DAINTREE "Daintree" +#define ZBEE_MFG_AIJI "Aiji" +#define ZBEE_MFG_TEL_ITALIA "Telecom Italia" +#define ZBEE_MFG_MIKROKRETS "Mikrokrets" +#define ZBEE_MFG_OKI "Oki Semi" +#define ZBEE_MFG_NEWPORT "Newport Electronics" + +#define ZBEE_MFG_C4 "Control4" +#define ZBEE_MFG_STM "STMicro" +#define ZBEE_MFG_ASN "Ad-Sol Nissin" +#define ZBEE_MFG_DCSI "DCSI" +#define ZBEE_MFG_FRANCE_TEL "France Telecom" +#define ZBEE_MFG_MUNET "muNet" +#define ZBEE_MFG_AUTANI "Autani" +#define ZBEE_MFG_COL_VNET "Colorado vNet" +#define ZBEE_MFG_AEROCOMM "Aerocomm" +#define ZBEE_MFG_SI_LABS "Silicon Labs" +#define ZBEE_MFG_INNCOM "Inncom" +#define ZBEE_MFG_CANNON "Cannon" +#define ZBEE_MFG_SYNAPSE "Synapse" +#define ZBEE_MFG_FPS "Fisher Pierce/Sunrise" +#define ZBEE_MFG_CLS "CentraLite" +#define ZBEE_MFG_CRANE "Crane" + +#define ZBEE_MFG_MOBILARM "Mobilarm" +#define ZBEE_MFG_IMONITOR "iMonitor" +#define ZBEE_MFG_BARTECH "Bartech" +#define ZBEE_MFG_MESHNETICS "Meshnetics" +#define ZBEE_MFG_LS_IND "LS Industrial" +#define ZBEE_MFG_CASON "Cason" +#define ZBEE_MFG_WLESS_GLUE "Wireless Glue" +#define ZBEE_MFG_ELSTER "Elster" +#define ZBEE_MFG_SMS_TEC "SMS Tec" +#define ZBEE_MFG_ONSET "Onset Computer" +#define ZBEE_MFG_RIGA "Riga Development" +#define ZBEE_MFG_ENERGATE "Energate" +#define ZBEE_MFG_CONMED "ConMed Linvatec" +#define ZBEE_MFG_POWERMAND "PowerMand" +#define ZBEE_MFG_SCHNEIDER "Schneider Electric" +#define ZBEE_MFG_EATON "Eaton" + +#define ZBEE_MFG_TELULAR "Telular" +#define ZBEE_MFG_DELPHI "Delphi Medical" +#define ZBEE_MFG_EPISENSOR "EpiSensor" +#define ZBEE_MFG_LANDIS_GYR "Landis+Gyr" +#define ZBEE_MFG_KABA "Kaba Group" +#define ZBEE_MFG_SHURE "Shure" +#define ZBEE_MFG_COMVERGE "Comverge" +/**/ +#define ZBEE_MFG_HIDALGO "Hidalgo" +#define ZBEE_MFG_AIR2APP "Air2App" +#define ZBEE_MFG_AMX "AMX" +#define ZBEE_MFG_EDMI "EDMI" +#define ZBEE_MFG_CYAN "Cyan Ltd." +#define ZBEE_MFG_SYS_SPA "System SPA" +#define ZBEE_MFG_TELIT "Telit" + +#define ZBEE_MFG_KAGA "Kaga Electronics" +#define ZBEE_MFG_4_NOKS "4-noks s.r.l." /* Helper Functions */ -extern proto_item *proto_tree_add_eui64(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gint length, gint64 value); +extern proto_item *proto_tree_add_eui64(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, + gint length, gint64 value); extern guint zbee_get_bit_field(guint input, guint mask); #endif /* PACKET_ZBEE_H */ |