1 /* packet-zbee-zcl-se.c
2 * Dissector routines for the ZigBee ZCL SE clusters like
4 * By Fabio Tarabelloni <fabio.tarabelloni@reloc.it>
5 * Copyright 2013 RELOC s.r.l.
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30 #include <epan/packet.h>
31 #include <epan/prefs.h>
32 #include <epan/expert.h>
33 #include <epan/to_str.h>
35 #include "packet-zbee.h"
36 #include "packet-zbee-aps.h"
37 #include "packet-zbee-zcl.h"
38 #include "packet-zbee-security.h"
40 /* ########################################################################## */
41 /* #### common to all SE clusters ########################################### */
42 /* ########################################################################## */
44 #define ZBEE_ZCL_SE_ATTR_REPORT_PENDING 0x00
45 #define ZBEE_ZCL_SE_ATTR_REPORT_COMPLETE 0x01
47 static const value_string zbee_zcl_se_reporting_status_names[] = {
48 { ZBEE_ZCL_SE_ATTR_REPORT_PENDING, "Pending" },
49 { ZBEE_ZCL_SE_ATTR_REPORT_COMPLETE, "Complete" },
53 /*************************/
54 /* Global Variables */
55 /*************************/
57 /* ########################################################################## */
58 /* #### (0x0702) METERING CLUSTER ########################################## */
59 /* ########################################################################## */
62 #define zbee_zcl_met_attr_names_VALUE_STRING_LIST(XXX) \
63 /* Client: Notification AttributeSet / Server: Reading Information Set */ \
64 XXX(ZBEE_ZCL_ATTR_ID_MET_FUNC_NOTI_FLAGS_CUR_SUM_DEL, 0x0000, "Client: Functional Notification Flags / Server: Current Summation Delivered" ) \
65 XXX(ZBEE_ZCL_ATTR_ID_MET_NOT_FLAGS2_CUR_SUM_RECV, 0x0001, "Client: Notification Flag 2 / Server: Current Summation Received" ) \
66 XXX(ZBEE_ZCL_ATTR_ID_MET_NOT_FLAGS3_CUR_MAX_DE_DEL, 0x0002, "Client: Notification Flag 3 / Server: Current Max Demand Delivered" ) \
67 XXX(ZBEE_ZCL_ATTR_ID_MET_NOT_FLAGS4_CUR_MAX_DE_RECV, 0x0003, "Client: Notification Flag 4 / Server: Current Max Demand Received" ) \
68 XXX(ZBEE_ZCL_ATTR_ID_MET_NOT_FLAGS5_DFT_SUM, 0x0004, "Client: Notification Flag 5 / Server: DFTSummation" ) \
69 XXX(ZBEE_ZCL_ATTR_ID_MET_NOT_FLAGS6_DAI_FREE_TIME, 0x0005, "Client: Notification Flag 6 / Server: Daily Freeze Time" ) \
70 XXX(ZBEE_ZCL_ATTR_ID_MET_NOT_FLAGS7_POW_FAC, 0x0006, "Client: Notification Flag 7 / Server: Power Factor" ) \
71 XXX(ZBEE_ZCL_ATTR_ID_MET_NOT_FLAGS8_READ_SNAP_TIME, 0x0007, "Client: Notification Flag 8 / Server: Reading Snapshot Time" ) \
72 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_MAX_DEMAND_DEL_TIME, 0x0008, "Current Max Demand Delivered Time" ) \
73 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_MAX_DEMAND_RECV_TIME, 0x0009, "Current Max Demand Received Time" ) \
74 XXX(ZBEE_ZCL_ATTR_ID_MET_DEFAULT_UPDATE_PERIOD, 0x000A, "Default Update Period" ) \
75 XXX(ZBEE_ZCL_ATTR_ID_MET_FAST_POLL_UPDATE_PERIOD, 0x000B, "Fast Poll Update Period" ) \
76 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_BLOCK_PER_CON_DEL, 0x000C, "Current Block Period Consumption Delivered" ) \
77 XXX(ZBEE_ZCL_ATTR_ID_MET_DAILY_CON_TARGET, 0x000D, "Daily Consumption Target" ) \
78 XXX(ZBEE_ZCL_ATTR_ID_MET_CURRENT_BLOCK, 0x000E, "Current Block" ) \
79 XXX(ZBEE_ZCL_ATTR_ID_MET_PROFILE_INTERVAL_PERIOD, 0x000F, "Profile Interval Period" ) \
80 /* XXX(ZBEE_ZCL_ATTR_ID_MET_DEPRECATED, 0x0010, "Deprecated" }, */ \
81 XXX(ZBEE_ZCL_ATTR_ID_MET_PRESET_READING_TIME, 0x0011, "Preset Reading Time" ) \
82 XXX(ZBEE_ZCL_ATTR_ID_MET_VOLUME_PER_REPORT, 0x0012, "Volume Per Report" ) \
83 XXX(ZBEE_ZCL_ATTR_ID_MET_FLOW_RESTRICTION, 0x0013, "Flow Restriction" ) \
84 XXX(ZBEE_ZCL_ATTR_ID_MET_SUPPLY_STATUS, 0x0014, "Supply Status" ) \
85 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_INLET_ENER_CAR_SUM, 0x0015, "Current Inlet Energy Carrier Summation" ) \
86 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_OUTLET_ENER_CAR_SUM, 0x0016, "Current Outlet Energy Carrier Summation" ) \
87 XXX(ZBEE_ZCL_ATTR_ID_MET_INLET_TEMPERATURE, 0x0017, "Inlet Temperature" ) \
88 XXX(ZBEE_ZCL_ATTR_ID_MET_OUTLET_TEMPERATURE, 0x0018, "Outlet Temperature" ) \
89 XXX(ZBEE_ZCL_ATTR_ID_MET_CONTROL_TEMPERATURE, 0x0019, "Control Temperature" ) \
90 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_INLET_ENER_CAR_DEM, 0x001A, "Current Inlet Energy Carrier Demand" ) \
91 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_OUTLET_ENER_CAR_DEM, 0x001B, "Current Outlet Energy Carrier Demand" ) \
92 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_BLOCK_CON_DEL, 0x001C, "Previous Block Period Consumption Delivered" ) \
93 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_BLOCL_CON_RECV, 0x001D, "Current Block Period Consumption Received" ) \
94 XXX(ZBEE_ZCL_ATTR_ID_MET_CURRENT_BLOCK_RECEIVED, 0x001E, "Current Block Received" ) \
95 XXX(ZBEE_ZCL_ATTR_ID_MET_DFT_SUMMATION_RECEIVED, 0x001F, "DFT Summation Received" ) \
96 XXX(ZBEE_ZCL_ATTR_ID_MET_ACTIVE_REG_TIER_DEL, 0x0020, "Active Register Tier Delivered" ) \
97 XXX(ZBEE_ZCL_ATTR_ID_MET_ACTIVE_REG_TIER_RECV, 0x0021, "Active Register Tier Received" ) \
98 XXX(ZBEE_ZCL_ATTR_ID_MET_LAST_BLOCK_SWITCH_TIME, 0x0022, "Last Block Switch Time" ) \
99 /* Summation TOU Information Set */ \
100 XXX(ZBEE_ZCL_ATTR_ID_MET_CURRENT_TIER_1_SUM_DEL, 0x0100, "Current Tier 1 Summation Delivered" ) \
101 XXX(ZBEE_ZCL_ATTR_ID_MET_CURRENT_TIER_2_SUM_DEL, 0x0102, "Current Tier 2 Summation Delivered" ) \
102 XXX(ZBEE_ZCL_ATTR_ID_MET_CURRENT_TIER_3_SUM_DEL, 0x0104, "Current Tier 3 Summation Delivered" ) \
103 XXX(ZBEE_ZCL_ATTR_ID_MET_CURRENT_TIER_4_SUM_DEL, 0x0106, "Current Tier 4 Summation Delivered" ) \
104 /* Meter Status Attribute Set */ \
105 XXX(ZBEE_ZCL_ATTR_ID_MET_STATUS, 0x0200, "Status" ) \
106 XXX(ZBEE_ZCL_ATTR_ID_MET_REMAIN_BAT_LIFE_DAYS, 0x0205, "Remaining Battery Life in Days" ) \
107 XXX(ZBEE_ZCL_ATTR_ID_MET_CURRENT_METER_ID, 0x0206, "Current Meter ID" ) \
108 XXX(ZBEE_ZCL_ATTR_ID_MET_AMBIENT_CON_IND, 0x0207, "Ambient Consumption Indicator" ) \
110 XXX(ZBEE_ZCL_ATTR_ID_MET_UNIT_OF_MEASURE, 0x0300, "Unit of Measure" ) \
111 XXX(ZBEE_ZCL_ATTR_ID_MET_MULTIPLIER, 0x0301, "Multiplier" ) \
112 XXX(ZBEE_ZCL_ATTR_ID_MET_DIVISOR, 0x0302, "Divisor" ) \
113 XXX(ZBEE_ZCL_ATTR_ID_MET_SUMMATION_FORMATTING, 0x0303, "Summation Formatting" ) \
114 XXX(ZBEE_ZCL_ATTR_ID_MET_METERING_DEVICE_TYPE, 0x0306, "Metering Device Type" ) \
115 XXX(ZBEE_ZCL_ATTR_ID_MET_SITE_ID, 0x0307, "Site ID" ) \
116 XXX(ZBEE_ZCL_ATTR_ID_MET_CUSTOMER_ID_NUMBER, 0x0311, "Customer ID Number" ) \
117 XXX(ZBEE_ZCL_ATTR_ID_MET_ALT_UNIT_OF_MEASURE, 0x0312, "Alternative Unit of Measure" ) \
118 XXX(ZBEE_ZCL_ATTR_ID_MET_ALT_CON_FORMATTING, 0x0314, "Alternative Consumption Formatting" ) \
119 /* Historical Consumption Attribute */ \
120 XXX(ZBEE_ZCL_ATTR_ID_MET_INSTANT_DEMAND, 0x0400, "Instantaneous Demand" ) \
121 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_DAY_CON_DEL, 0x0401, "Current Day Consumption Delivered" ) \
122 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_DAY_CON_DEL, 0x0403, "Previous Day Consumption Delivered" ) \
123 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_2_DAY_CON_DEL, 0x0420, "Previous Day 2 Consumption Delivered" ) \
124 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_3_DAY_CON_DEL, 0x0422, "Previous Day 3 Consumption Delivered" ) \
125 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_4_DAY_CON_DEL, 0x0424, "Previous Day 4 Consumption Delivered" ) \
126 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_5_DAY_CON_DEL, 0x0426, "Previous Day 5 Consumption Delivered" ) \
127 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_6_DAY_CON_DEL, 0x0428, "Previous Day 6 Consumption Delivered" ) \
128 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_7_DAY_CON_DEL, 0x042A, "Previous Day 7 Consumption Delivered" ) \
129 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_8_DAY_CON_DEL, 0x042C, "Previous Day 8 Consumption Delivered" ) \
130 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_WEEK_CON_DEL, 0x0430, "Current Week Consumption Delivered" ) \
131 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_WEEK_CON_DEL, 0x0432, "Previous Week Consumption Delivered" ) \
132 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_WEEK_2_CON_DEL, 0x0434, "Previous Week 2 Consumption Delivered" ) \
133 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_WEEK_3_CON_DEL, 0x0436, "Previous Week 3 Consumption Delivered" ) \
134 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_WEEK_4_CON_DEL, 0x0438, "Previous Week 4 Consumption Delivered" ) \
135 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_WEEK_5_CON_DEL, 0x043A, "Previous Week 5 Consumption Delivered" ) \
136 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_MONTH_CON_DEL, 0x0440, "Current Month Consumption Delivered" ) \
137 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_MONTH_CON_DEL, 0x0442, "Previous Month Consumption Delivered" ) \
138 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_MONTH_2_CON_DEL, 0x0444, "Previous Month 2 Consumption Delivered" ) \
139 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_MONTH_3_CON_DEL, 0x0446, "Previous Month 3 Consumption Delivered" ) \
140 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_MONTH_4_CON_DEL, 0x0448, "Previous Month 4 Consumption Delivered" ) \
141 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_MONTH_5_CON_DEL, 0x044A, "Previous Month 5 Consumption Delivered" ) \
142 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_MONTH_6_CON_DEL, 0x044C, "Previous Month 6 Consumption Delivered" ) \
143 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_MONTH_7_CON_DEL, 0x044E, "Previous Month 7 Consumption Delivered" ) \
144 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_MONTH_8_CON_DEL, 0x0450, "Previous Month 8 Consumption Delivered" ) \
145 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_MONTH_9_CON_DEL, 0x0452, "Previous Month 9 Consumption Delivered" ) \
146 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_MONTH_10_CON_DEL, 0x0454, "Previous Month 10 Consumption Delivered" ) \
147 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_MONTH_11_CON_DEL, 0x0456, "Previous Month 11 Consumption Delivered" ) \
148 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_MONTH_12_CON_DEL, 0x0458, "Previous Month 12 Consumption Delivered" ) \
149 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_MONTH_13_CON_DEL, 0x045A, "Previous Month 13 Consumption Delivered" ) \
150 /* Supply Limit Attributes */ \
151 XXX(ZBEE_ZCL_ATTR_ID_MET_SUPPLY_TAMPER_STATE, 0x0607, "Supply Tamper State" ) \
152 XXX(ZBEE_ZCL_ATTR_ID_MET_SUPPLY_DEPLETION_STATE, 0x0608, "Supply Depletion State" ) \
153 /* Block Information Attribute Set (Delivered) */ \
154 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_NO_TIER_BLOCK_1_SUM_DEL, 0x0700, "Current No Tier Block 1 Summation Delivered" ) \
155 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_NO_TIER_BLOCK_2_SUM_DEL, 0x0701, "Current No Tier Block 2 Summation Delivered" ) \
156 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_NO_TIER_BLOCK_3_SUM_DEL, 0x0702, "Current No Tier Block 3 Summation Delivered" ) \
157 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_NO_TIER_BLOCK_4_SUM_DEL, 0x0703, "Current No Tier Block 4 Summation Delivered" ) \
158 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_TIER_1_BLOCK_1_SUM_DEL, 0x0710, "Current Tier 1 Block 1 Summation Delivered" ) \
159 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_TIER_1_BLOCK_2_SUM_DEL, 0x0711, "Current Tier 1 Block 2 Summation Delivered" ) \
160 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_TIER_1_BLOCK_3_SUM_DEL, 0x0712, "Current Tier 1 Block 3 Summation Delivered" ) \
161 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_TIER_1_BLOCK_4_SUM_DEL, 0x0713, "Current Tier 1 Block 4 Summation Delivered" ) \
162 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_TIER_2_BLOCK_1_SUM_DEL, 0x0720, "Current Tier 2 Block 1 Summation Delivered" ) \
163 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_TIER_2_BLOCK_2_SUM_DEL, 0x0721, "Current Tier 2 Block 2 Summation Delivered" ) \
164 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_TIER_2_BLOCK_3_SUM_DEL, 0x0722, "Current Tier 2 Block 3 Summation Delivered" ) \
165 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_TIER_2_BLOCK_4_SUM_DEL, 0x0723, "Current Tier 2 Block 4 Summation Delivered" ) \
166 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_TIER_3_BLOCK_1_SUM_DEL, 0x0730, "Current Tier 3 Block 1 Summation Delivered" ) \
167 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_TIER_3_BLOCK_2_SUM_DEL, 0x0731, "Current Tier 3 Block 2 Summation Delivered" ) \
168 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_TIER_3_BLOCK_3_SUM_DEL, 0x0732, "Current Tier 3 Block 3 Summation Delivered" ) \
169 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_TIER_3_BLOCK_4_SUM_DEL, 0x0733, "Current Tier 3 Block 4 Summation Delivered" ) \
170 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_TIER_4_BLOCK_1_SUM_DEL, 0x0740, "Current Tier 4 Block 1 Summation Delivered" ) \
171 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_TIER_4_BLOCK_2_SUM_DEL, 0x0741, "Current Tier 4 Block 2 Summation Delivered" ) \
172 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_TIER_4_BLOCK_3_SUM_DEL, 0x0742, "Current Tier 4 Block 3 Summation Delivered" ) \
173 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_TIER_4_BLOCK_4_SUM_DEL, 0x0743, "Current Tier 4 Block 4 Summation Delivered" ) \
174 /* Meter Billing Attribute Set */ \
175 XXX(ZBEE_ZCL_ATTR_ID_MET_BILL_TO_DATE_DELIVERED, 0x0A00, "Bill To Date Delivered" ) \
176 XXX(ZBEE_ZCL_ATTR_ID_MET_BILL_TO_DATE_TIMESTAMP_DEL, 0x0A01, "BillToDateTimeStampDelivered" ) \
177 XXX(ZBEE_ZCL_ATTR_ID_MET_BILL_DELIVERED_TRAILING_DIGIT, 0x0A04, "Bill Delivered Trailing Digit" ) \
178 /* Alternative Historical Consumption Attribute Set */ \
179 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_DAY_ALT_CON_DEL, 0x0C01, "Current Day Alternative Consumption Delivered" ) \
180 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_DAY_ALT_CON_DEL, 0x0C03, "Previous Day Alternative Consumption Delivered" ) \
181 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_DAY_2_ALT_CON_DEL, 0x0C20, "Previous Day 2 Alternative Consumption Delivered" ) \
182 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_DAY_3_ALT_CON_DEL, 0x0C22, "Previous Day 3 Alternative Consumption Delivered" ) \
183 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_DAY_4_ALT_CON_DEL, 0x0C24, "Previous Day 4 Alternative Consumption Delivered" ) \
184 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_DAY_5_ALT_CON_DEL, 0x0C26, "Previous Day 5 Alternative Consumption Delivered" ) \
185 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_DAY_6_ALT_CON_DEL, 0x0C28, "Previous Day 6 Alternative Consumption Delivered" ) \
186 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_DAY_7_ALT_CON_DEL, 0x0C2A, "Previous Day 7 Alternative Consumption Delivered" ) \
187 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_DAY_8_ALT_CON_DEL, 0x0C2C, "Previous Day 8 Alternative Consumption Delivered" ) \
188 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_WEEK_ALT_CON_DEL, 0x0C30, "Current Week Alternative Consumption Delivered" ) \
189 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_WEEK_ALT_CON_DEL, 0x0C32, "Previous Week Alternative Consumption Delivered" ) \
190 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_WEEK_2_ALT_CON_DEL, 0x0C34, "Previous Week 2 Alternative Consumption Delivered" ) \
191 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_WEEK_3_ALT_CON_DEL, 0x0C36, "Previous Week 3 Alternative Consumption Delivered" ) \
192 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_WEEK_4_ALT_CON_DEL, 0x0C38, "Previous Week 4 Alternative Consumption Delivered" ) \
193 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_WEEK_5_ALT_CON_DEL, 0x0C3A, "Previous Week 5 Alternative Consumption Delivered" ) \
194 XXX(ZBEE_ZCL_ATTR_ID_MET_CUR_MONTH_ALT_CON_DEL, 0x0C40, "Current Month Alternative Consumption Delivered" ) \
195 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_MONTH_ALT_CON_DEL, 0x0C42, "Previous Month Alternative Consumption Delivered" ) \
196 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_MONTH_2_ALT_CON_DEL, 0x0C44, "Previous Month 2 Alternative Consumption Delivered" ) \
197 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_MONTH_3_ALT_CON_DEL, 0x0C46, "Previous Month 3 Alternative Consumption Delivered" ) \
198 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_MONTH_4_ALT_CON_DEL, 0x0C48, "Previous Month 4 Alternative Consumption Delivered" ) \
199 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_MONTH_5_ALT_CON_DEL, 0x0C4A, "Previous Month 5 Alternative Consumption Delivered" ) \
200 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_MONTH_6_ALT_CON_DEL, 0x0C4C, "Previous Month 6 Alternative Consumption Delivered" ) \
201 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_MONTH_7_ALT_CON_DEL, 0x0C4E, "Previous Month 7 Alternative Consumption Delivered" ) \
202 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_MONTH_8_ALT_CON_DEL, 0x0C50, "Previous Month 8 Alternative Consumption Delivered" ) \
203 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_MONTH_9_ALT_CON_DEL, 0x0C52, "Previous Month 9 Alternative Consumption Delivered" ) \
204 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_MONTH_10_ALT_CON_DEL, 0x0C54, "Previous Month 10 Alternative Consumption Delivered" ) \
205 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_MONTH_11_ALT_CON_DEL, 0x0C56, "Previous Month 11 Alternative Consumption Delivered" ) \
206 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_MONTH_12_ALT_CON_DEL, 0x0C58, "Previous Month 12 Alternative Consumption Delivered" ) \
207 XXX(ZBEE_ZCL_ATTR_ID_MET_PREV_MONTH_13_ALT_CON_DEL, 0x0C5A, "Previous Month 13 Alternative Consumption Delivered" ) \
209 XXX(ZBEE_ZCL_ATTR_ID_SE_ATTR_REPORT_STATUS_MET, 0xFFFE, "Attribute Reporting Status" )
211 VALUE_STRING_ENUM(zbee_zcl_met_attr_names);
212 VALUE_STRING_ARRAY(zbee_zcl_met_attr_names);
213 static value_string_ext zbee_zcl_met_attr_names_ext = VALUE_STRING_EXT_INIT(zbee_zcl_met_attr_names);
215 /* Server Commands Received */
216 #define zbee_zcl_met_srv_rx_cmd_names_VALUE_STRING_LIST(XXX) \
217 XXX(ZBEE_ZCL_CMD_ID_MET_REQUEST_MIRROR_RSP, 0x01, "Request Mirror Response" ) \
218 XXX(ZBEE_ZCL_CMD_ID_MET_GET_SNAPSHOT, 0x06, "Get Snapshot" ) \
219 XXX(ZBEE_ZCL_CMD_ID_MET_GET_SAMPLED_DATA, 0x08, "Get Sampled Data" ) \
220 XXX(ZBEE_ZCL_CMD_ID_MET_LOCAL_CHANGE_SUPPLY, 0x0C, "Local Change Supply" )
222 VALUE_STRING_ENUM(zbee_zcl_met_srv_rx_cmd_names);
223 VALUE_STRING_ARRAY(zbee_zcl_met_srv_rx_cmd_names);
225 /* Server Commands Generated */
226 #define zbee_zcl_met_srv_tx_cmd_names_VALUE_STRING_LIST(XXX) \
227 XXX(ZBEE_ZCL_CMD_ID_MET_REQUEST_MIRROR, 0x01, "Request Mirror" ) \
228 XXX(ZBEE_ZCL_CMD_ID_MET_PUBLISH_SNAPSHOT, 0x06, "Publish Snapshot" ) \
229 XXX(ZBEE_ZCL_CMD_ID_MET_GET_SAMPLED_DATA_RSP, 0x07, "Get Sampled Data Response" ) \
230 XXX(ZBEE_ZCL_CMD_ID_MET_CONFIGURE_MIRROR, 0x08, "Configure Mirror" ) \
231 XXX(ZBEE_ZCL_CMD_ID_MET_GET_NOTIFIED_MESSAGE, 0x0B, "Get Notified Message" )
233 VALUE_STRING_ENUM(zbee_zcl_met_srv_tx_cmd_names);
234 VALUE_STRING_ARRAY(zbee_zcl_met_srv_tx_cmd_names);
236 /*************************/
237 /* Function Declarations */
238 /*************************/
239 void proto_register_zbee_zcl_met(void);
240 void proto_reg_handoff_zbee_zcl_met(void);
242 /* Attribute Dissector Helpers */
243 static void dissect_zcl_met_attr_data (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type);
245 /* Command Dissector Helpers */
246 static void dissect_zcl_met_request_mirror_rsp (tvbuff_t *tvb, proto_tree *tree, guint *offset);
247 static void dissect_zcl_met_get_snapshot (tvbuff_t *tvb, proto_tree *tree, guint *offset);
248 static void dissect_zcl_met_get_sampled_data (tvbuff_t *tvb, proto_tree *tree, guint *offset);
249 static void dissect_zcl_met_local_change_supply (tvbuff_t *tvb, proto_tree *tree, guint *offset);
250 static void dissect_zcl_met_publish_snapshot (tvbuff_t *tvb, proto_tree *tree, guint *offset);
251 static void dissect_zcl_met_get_sampled_data_rsp (tvbuff_t *tvb, proto_tree *tree, guint *offset);
252 static void dissect_zcl_met_configure_mirror (tvbuff_t *tvb, proto_tree *tree, guint *offset);
253 static void dissect_zcl_met_get_notified_msg (tvbuff_t *tvb, proto_tree *tree, guint *offset);
255 /*************************/
256 /* Global Variables */
257 /*************************/
259 static dissector_handle_t met_handle;
261 /* Initialize the protocol and registered fields */
262 static int proto_zbee_zcl_met = -1;
264 static int hf_zbee_zcl_met_srv_tx_cmd_id = -1;
265 static int hf_zbee_zcl_met_srv_rx_cmd_id = -1;
266 static int hf_zbee_zcl_met_attr_id = -1;
267 static int hf_zbee_zcl_met_attr_reporting_status = -1;
268 static int hf_zbee_zcl_met_request_mirror_rsp_endpoint_id = -1;
269 static int hf_zbee_zcl_met_get_snapshot_start_time = -1;
270 static int hf_zbee_zcl_met_get_snapshot_end_time = -1;
271 static int hf_zbee_zcl_met_get_snapshot_snapshot_offset = -1;
272 static int hf_zbee_zcl_met_get_snapshot_snapshot_cause = -1;
273 static int hf_zbee_zcl_met_get_sampled_data_sample_id = -1;
274 static int hf_zbee_zcl_met_get_sampled_data_sample_start_time = -1;
275 static int hf_zbee_zcl_met_get_sampled_data_sample_type = -1;
276 static int hf_zbee_zcl_met_get_sampled_data_number_of_samples = -1;
277 static int hf_zbee_zcl_met_local_change_supply_supply_status = -1;
278 static int hf_zbee_zcl_met_publish_snapshot_snapshot_id = -1;
279 static int hf_zbee_zcl_met_publish_snapshot_snapshot_time = -1;
280 static int hf_zbee_zcl_met_publish_snapshot_snapshots_found = -1;
281 static int hf_zbee_zcl_met_publish_snapshot_cmd_index = -1;
282 static int hf_zbee_zcl_met_publish_snapshot_total_commands = -1;
283 static int hf_zbee_zcl_met_publish_snapshot_snapshot_cause = -1;
284 static int hf_zbee_zcl_met_publish_snapshot_snapshot_payload_type = -1;
285 static int hf_zbee_zcl_met_publish_snapshot_snapshot_sub_payload = -1;
286 static int hf_zbee_zcl_met_get_sampled_data_rsp_sample_id = -1;
287 static int hf_zbee_zcl_met_get_sampled_data_rsp_sample_start_time = -1;
288 static int hf_zbee_zcl_met_get_sampled_data_rsp_sample_type = -1;
289 static int hf_zbee_zcl_met_get_sampled_data_rsp_sample_request_interval = -1;
290 static int hf_zbee_zcl_met_get_sampled_data_rsp_sample_number_of_samples = -1;
291 static int hf_zbee_zcl_met_get_sampled_data_rsp_sample_samples = -1;
292 static int hf_zbee_zcl_met_configure_mirror_issuer_event_id = -1;
293 static int hf_zbee_zcl_met_configure_mirror_reporting_interval = -1;
294 static int hf_zbee_zcl_met_configure_mirror_mirror_notification_reporting = -1;
295 static int hf_zbee_zcl_met_configure_mirror_notification_scheme = -1;
296 static int hf_zbee_zcl_met_get_notified_msg_notification_scheme = -1;
297 static int hf_zbee_zcl_met_get_notified_msg_notification_flag_attribute_id = -1;
298 static int hf_zbee_zcl_met_get_notified_msg_notification_flags = -1;
300 /* Initialize the subtree pointers */
301 static gint ett_zbee_zcl_met = -1;
303 /*************************/
304 /* Function Bodies */
305 /*************************/
308 *This function is called by ZCL foundation dissector in order to decode
310 *@param tree pointer to data tree Wireshark uses to display packet.
311 *@param tvb pointer to buffer containing raw packet.
312 *@param offset pointer to buffer offset
313 *@param attr_id attribute identifier
314 *@param data_type attribute data type
317 dissect_zcl_met_attr_data(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type)
320 /* applies to all SE clusters */
321 case ZBEE_ZCL_ATTR_ID_SE_ATTR_REPORT_STATUS_MET:
322 proto_tree_add_item(tree, hf_zbee_zcl_met_attr_reporting_status, tvb, *offset, 1, ENC_NA);
326 default: /* Catch all */
327 dissect_zcl_attr_data(tvb, tree, offset, data_type);
330 } /*dissect_zcl_met_attr_data*/
333 *ZigBee ZCL Metering cluster dissector for wireshark.
335 *@param tvb pointer to buffer containing raw packet.
336 *@param pinfo pointer to packet information fields
337 *@param tree pointer to data tree Wireshark uses to display packet.
340 dissect_zbee_zcl_met(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
342 proto_tree *payload_tree;
343 zbee_zcl_packet *zcl;
348 /* Reject the packet if data is NULL */
351 zcl = (zbee_zcl_packet *)data;
352 cmd_id = zcl->cmd_id;
354 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
355 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
356 /* Append the command name to the info column. */
357 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
358 val_to_str_const(cmd_id, zbee_zcl_met_srv_rx_cmd_names, "Unknown Command"),
361 /* Add the command ID. */
362 proto_tree_add_uint(tree, hf_zbee_zcl_met_srv_rx_cmd_id, tvb, offset, 1, cmd_id);
364 /* Check is this command has a payload, than add the payload tree */
365 rem_len = tvb_reported_length_remaining(tvb, ++offset);
367 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_met, NULL, "Payload");
369 /* Call the appropriate command dissector */
372 case ZBEE_ZCL_CMD_ID_MET_REQUEST_MIRROR_RSP:
373 dissect_zcl_met_request_mirror_rsp(tvb, payload_tree, &offset);
376 case ZBEE_ZCL_CMD_ID_MET_GET_SNAPSHOT:
377 dissect_zcl_met_get_snapshot(tvb, payload_tree, &offset);
380 case ZBEE_ZCL_CMD_ID_MET_GET_SAMPLED_DATA:
381 dissect_zcl_met_get_sampled_data(tvb, payload_tree, &offset);
384 case ZBEE_ZCL_CMD_ID_MET_LOCAL_CHANGE_SUPPLY:
385 dissect_zcl_met_local_change_supply(tvb, payload_tree, &offset);
393 else { /* ZBEE_ZCL_FCF_TO_CLIENT */
394 /* Append the command name to the info column. */
395 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
396 val_to_str_const(cmd_id, zbee_zcl_met_srv_tx_cmd_names, "Unknown Command"),
399 /* Add the command ID. */
400 proto_tree_add_uint(tree, hf_zbee_zcl_met_srv_tx_cmd_id, tvb, offset, 1, cmd_id);
402 /* Check is this command has a payload, than add the payload tree */
403 rem_len = tvb_reported_length_remaining(tvb, ++offset);
405 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_met, NULL, "Payload");
407 /* Call the appropriate command dissector */
410 case ZBEE_ZCL_CMD_ID_MET_REQUEST_MIRROR:
414 case ZBEE_ZCL_CMD_ID_MET_PUBLISH_SNAPSHOT:
415 dissect_zcl_met_publish_snapshot(tvb, payload_tree, &offset);
418 case ZBEE_ZCL_CMD_ID_MET_GET_SAMPLED_DATA_RSP:
419 dissect_zcl_met_get_sampled_data_rsp(tvb, payload_tree, &offset);
422 case ZBEE_ZCL_CMD_ID_MET_CONFIGURE_MIRROR:
423 dissect_zcl_met_configure_mirror(tvb, payload_tree, &offset);
426 case ZBEE_ZCL_CMD_ID_MET_GET_NOTIFIED_MESSAGE:
427 dissect_zcl_met_get_notified_msg(tvb, payload_tree, &offset);
436 return tvb_captured_length(tvb);
437 } /*dissect_zbee_zcl_met*/
440 *This function manages the Request Mirror Response payload
442 *@param tvb pointer to buffer containing raw packet.
443 *@param tree pointer to data tree Wireshark uses to display packet.
444 *@param offset pointer to offset from caller
447 dissect_zcl_met_request_mirror_rsp(tvbuff_t *tvb, proto_tree *tree, guint *offset)
450 proto_tree_add_item(tree, hf_zbee_zcl_met_request_mirror_rsp_endpoint_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
452 } /*dissect_zcl_met_get_snapshot*/
455 *This function manages the Get Snapshot payload
457 *@param tvb pointer to buffer containing raw packet.
458 *@param tree pointer to data tree Wireshark uses to display packet.
459 *@param offset pointer to offset from caller
462 dissect_zcl_met_get_snapshot(tvbuff_t *tvb, proto_tree *tree, guint *offset)
466 gint rem_len = tvb_reported_length_remaining(tvb, *offset);
469 start_time.secs = (time_t)tvb_get_letohl(tvb, *offset) + ZBEE_ZCL_NSTIME_UTC_OFFSET;
470 start_time.nsecs = 0;
471 proto_tree_add_time(tree, hf_zbee_zcl_met_get_snapshot_start_time, tvb, *offset, 4, &start_time);
475 /* End Time - not part of SE 1.1b specification */
476 end_time.secs = (time_t)tvb_get_letohl(tvb, *offset) + ZBEE_ZCL_NSTIME_UTC_OFFSET;
478 proto_tree_add_time(tree, hf_zbee_zcl_met_get_snapshot_end_time, tvb, *offset, 4, &end_time);
482 /* Snapshot Offset */
483 proto_tree_add_item(tree, hf_zbee_zcl_met_get_snapshot_snapshot_offset, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
487 proto_tree_add_item(tree, hf_zbee_zcl_met_get_snapshot_snapshot_cause, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
489 } /*dissect_zcl_met_get_snapshot*/
492 *This function manages the Get Sampled Data payload
494 *@param tvb pointer to buffer containing raw packet.
495 *@param tree pointer to data tree Wireshark uses to display packet.
496 *@param offset pointer to offset from caller
499 dissect_zcl_met_get_sampled_data(tvbuff_t *tvb, proto_tree *tree, guint *offset)
501 nstime_t sample_time;
504 proto_tree_add_item(tree, hf_zbee_zcl_met_get_sampled_data_sample_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
507 /* Sample Start Time */
508 sample_time.secs = (time_t)tvb_get_letohl(tvb, *offset) + ZBEE_ZCL_NSTIME_UTC_OFFSET;
509 sample_time.nsecs = 0;
510 proto_tree_add_time(tree, hf_zbee_zcl_met_get_sampled_data_sample_start_time, tvb, *offset, 4, &sample_time);
514 proto_tree_add_item(tree, hf_zbee_zcl_met_get_sampled_data_sample_type, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
517 /* Number of Samples */
518 proto_tree_add_item(tree, hf_zbee_zcl_met_get_sampled_data_number_of_samples, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
520 } /*dissect_zcl_met_get_sampled_data*/
523 *This function manages the Local Change Supply payload
525 *@param tvb pointer to buffer containing raw packet.
526 *@param tree pointer to data tree Wireshark uses to display packet.
527 *@param offset pointer to offset from caller
530 dissect_zcl_met_local_change_supply(tvbuff_t *tvb, proto_tree *tree, guint *offset)
532 /* Proposed Supply Status */
533 proto_tree_add_item(tree, hf_zbee_zcl_met_local_change_supply_supply_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
535 } /*dissect_zcl_met_local_change_supply*/
538 *This function manages the Publish Snapshot payload
540 *@param tvb pointer to buffer containing raw packet.
541 *@param tree pointer to data tree Wireshark uses to display packet.
542 *@param offset pointer to offset from caller
545 dissect_zcl_met_publish_snapshot(tvbuff_t *tvb, proto_tree *tree, guint *offset)
547 nstime_t snapshot_time;
551 proto_tree_add_item(tree, hf_zbee_zcl_met_publish_snapshot_snapshot_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
555 snapshot_time.secs = (time_t)tvb_get_letohl(tvb, *offset) + ZBEE_ZCL_NSTIME_UTC_OFFSET;
556 snapshot_time.nsecs = 0;
557 proto_tree_add_time(tree, hf_zbee_zcl_met_publish_snapshot_snapshot_time, tvb, *offset, 4, &snapshot_time);
560 /* Total Snapshots Found */
561 proto_tree_add_item(tree, hf_zbee_zcl_met_publish_snapshot_snapshots_found, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
565 proto_tree_add_item(tree, hf_zbee_zcl_met_publish_snapshot_cmd_index, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
568 /* Total Number of Commands */
569 proto_tree_add_item(tree, hf_zbee_zcl_met_publish_snapshot_total_commands, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
573 proto_tree_add_item(tree, hf_zbee_zcl_met_publish_snapshot_snapshot_cause, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
576 /* Snapshot Payload Type */
577 proto_tree_add_item(tree, hf_zbee_zcl_met_publish_snapshot_snapshot_payload_type, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
580 /* Snapshot Sub-Payload */
581 rem_len = tvb_reported_length_remaining(tvb, *offset);
582 proto_tree_add_item(tree, hf_zbee_zcl_met_publish_snapshot_snapshot_sub_payload, tvb, *offset, rem_len, ENC_NA);
584 } /*dissect_zcl_met_publish_snapshot*/
587 *This function manages the Get Sampled Data Response payload
589 *@param tvb pointer to buffer containing raw packet.
590 *@param tree pointer to data tree Wireshark uses to display packet.
591 *@param offset pointer to offset from caller
594 dissect_zcl_met_get_sampled_data_rsp(tvbuff_t *tvb, proto_tree *tree, guint *offset)
596 nstime_t sample_start_time;
600 proto_tree_add_item(tree, hf_zbee_zcl_met_get_sampled_data_rsp_sample_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
603 /* Sample Start Time */
604 sample_start_time.secs = (time_t)tvb_get_letohl(tvb, *offset) + ZBEE_ZCL_NSTIME_UTC_OFFSET;
605 sample_start_time.nsecs = 0;
606 proto_tree_add_time(tree, hf_zbee_zcl_met_get_sampled_data_rsp_sample_start_time, tvb, *offset, 4, &sample_start_time);
610 proto_tree_add_item(tree, hf_zbee_zcl_met_get_sampled_data_rsp_sample_type, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
613 /* Sample Request Interval */
614 proto_tree_add_item(tree, hf_zbee_zcl_met_get_sampled_data_rsp_sample_request_interval, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
617 /* Number of Samples */
618 proto_tree_add_item(tree, hf_zbee_zcl_met_get_sampled_data_rsp_sample_number_of_samples, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
622 rem_len = tvb_reported_length_remaining(tvb, *offset);
623 while (rem_len >= 3) {
624 guint32 val = tvb_get_guint24(tvb, *offset, ENC_LITTLE_ENDIAN);
625 proto_tree_add_uint(tree, hf_zbee_zcl_met_get_sampled_data_rsp_sample_samples, tvb, *offset, 3, val);
629 } /*dissect_zcl_met_get_sampled_data_rsp*/
632 *This function manages the Configure Mirror payload
634 *@param tvb pointer to buffer containing raw packet.
635 *@param tree pointer to data tree Wireshark uses to display packet.
636 *@param offset pointer to offset from caller
639 dissect_zcl_met_configure_mirror(tvbuff_t *tvb, proto_tree *tree, guint *offset)
641 /* Issuer Event ID */
642 proto_tree_add_item(tree, hf_zbee_zcl_met_configure_mirror_issuer_event_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
645 /* Reporting Interval */
646 proto_tree_add_item(tree, hf_zbee_zcl_met_configure_mirror_reporting_interval, tvb, *offset, 3, ENC_LITTLE_ENDIAN);
649 /* Mirror Notification Reporting */
650 proto_tree_add_item(tree, hf_zbee_zcl_met_configure_mirror_mirror_notification_reporting, tvb, *offset, 1, ENC_NA);
653 /* Notification Scheme */
654 proto_tree_add_item(tree, hf_zbee_zcl_met_configure_mirror_notification_scheme, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
656 } /*dissect_zcl_met_configure_mirror*/
659 *This function manages the Get Notified Message payload
661 *@param tvb pointer to buffer containing raw packet.
662 *@param tree pointer to data tree Wireshark uses to display packet.
663 *@param offset pointer to offset from caller
666 dissect_zcl_met_get_notified_msg(tvbuff_t *tvb, proto_tree *tree, guint *offset)
668 /* Notification Scheme */
669 proto_tree_add_item(tree, hf_zbee_zcl_met_get_notified_msg_notification_scheme, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
672 /* Notification Flag attribute ID */
673 proto_tree_add_item(tree, hf_zbee_zcl_met_get_notified_msg_notification_flag_attribute_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
676 /* Notification Flags #N */
677 proto_tree_add_item(tree, hf_zbee_zcl_met_get_notified_msg_notification_flags, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
679 } /*dissect_zcl_met_get_notified_msg*/
682 *This function registers the ZCL Metering dissector
686 proto_register_zbee_zcl_met(void)
688 static hf_register_info hf[] = {
690 { &hf_zbee_zcl_met_attr_id,
691 { "Attribute", "zbee_zcl_se.met.attr_id", FT_UINT16, BASE_HEX | BASE_EXT_STRING, &zbee_zcl_met_attr_names_ext,
692 0x0, NULL, HFILL } },
694 { &hf_zbee_zcl_met_attr_reporting_status, /* common to all SE clusters */
695 { "Attribute Reporting Status", "zbee_zcl_se.met.attr.attr_reporting_status",
696 FT_UINT8, BASE_HEX, VALS(zbee_zcl_se_reporting_status_names), 0x00, NULL, HFILL } },
698 { &hf_zbee_zcl_met_srv_tx_cmd_id,
699 { "Command", "zbee_zcl_se.met.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_met_srv_tx_cmd_names),
700 0x00, NULL, HFILL } },
702 { &hf_zbee_zcl_met_srv_rx_cmd_id,
703 { "Command", "zbee_zcl_se.met.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_met_srv_rx_cmd_names),
704 0x00, NULL, HFILL } },
706 { &hf_zbee_zcl_met_request_mirror_rsp_endpoint_id,
707 { "EndPoint ID", "zbee_zcl_se.met.request_mirror_rsp.endpoint_id", FT_UINT16, BASE_DEC, NULL,
708 0x00, NULL, HFILL } },
710 { &hf_zbee_zcl_met_get_snapshot_start_time,
711 { "Start Time", "zbee_zcl_se.met.get_snapshot.start_time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL,
712 0x00, NULL, HFILL } },
714 { &hf_zbee_zcl_met_get_snapshot_end_time,
715 { "End Time", "zbee_zcl_se.met.get_snapshot.end_time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL,
716 0x00, NULL, HFILL } },
718 { &hf_zbee_zcl_met_get_snapshot_snapshot_offset,
719 { "Snapshot Offset", "zbee_zcl_se.met.get_snapshot.snapshot_offset", FT_UINT8, BASE_DEC, NULL,
720 0x00, NULL, HFILL } },
722 { &hf_zbee_zcl_met_get_snapshot_snapshot_cause,
723 { "Snapshot Cause", "zbee_zcl_se.met.get_snapshot.snapshot_cause", FT_UINT32, BASE_HEX, NULL,
724 0x00, NULL, HFILL } },
726 { &hf_zbee_zcl_met_get_sampled_data_sample_id,
727 { "Sample ID", "zbee_zcl_se.met.get_sampled_data.sample_id", FT_UINT16, BASE_DEC, NULL,
728 0x00, NULL, HFILL } },
730 { &hf_zbee_zcl_met_get_sampled_data_sample_start_time,
731 { "Sample Start Time", "zbee_zcl_se.met.get_sampled_data.sample_start_time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL,
732 0x00, NULL, HFILL } },
734 { &hf_zbee_zcl_met_get_sampled_data_sample_type,
735 { "Sample Type", "zbee_zcl_se.met.get_sampled_data.sample_type", FT_UINT8, BASE_DEC, NULL,
736 0x00, NULL, HFILL } },
738 { &hf_zbee_zcl_met_get_sampled_data_number_of_samples,
739 { "Number of Samples", "zbee_zcl_se.met.get_sampled_data.number_of_samples", FT_UINT16, BASE_DEC, NULL,
740 0x00, NULL, HFILL } },
742 { &hf_zbee_zcl_met_local_change_supply_supply_status,
743 { "Proposed Supply Status", "zbee_zcl_se.met.local_change_supply.supply_status", FT_UINT8, BASE_DEC, NULL,
744 0x00, NULL, HFILL } },
746 { &hf_zbee_zcl_met_publish_snapshot_snapshot_id,
747 { "Snapshot ID", "zbee_zcl_se.met.publish_snapshot.snapshot_id", FT_UINT32, BASE_DEC, NULL,
748 0x00, NULL, HFILL } },
750 { &hf_zbee_zcl_met_publish_snapshot_snapshot_time,
751 { "Snapshot Time", "zbee_zcl_se.met.publish_snapshot.snapshot_time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL,
752 0x00, NULL, HFILL } },
754 { &hf_zbee_zcl_met_publish_snapshot_snapshots_found,
755 { "Total Snapshots Found", "zbee_zcl_se.met.publish_snapshot.snapshots_found", FT_UINT8, BASE_DEC, NULL,
756 0x00, NULL, HFILL } },
758 { &hf_zbee_zcl_met_publish_snapshot_cmd_index,
759 { "Command Index", "zbee_zcl_se.met.publish_snapshot.command_index", FT_UINT8, BASE_DEC, NULL,
760 0x00, NULL, HFILL } },
762 { &hf_zbee_zcl_met_publish_snapshot_total_commands,
763 { "Total Number of Commands", "zbee_zcl_se.met.publish_snapshot.total_commands", FT_UINT8, BASE_DEC, NULL,
764 0x00, NULL, HFILL } },
766 { &hf_zbee_zcl_met_publish_snapshot_snapshot_cause,
767 { "Snapshot Cause", "zbee_zcl_se.met.publish_snapshot.snapshot_cause", FT_UINT32, BASE_HEX, NULL,
768 0x00, NULL, HFILL } },
770 { &hf_zbee_zcl_met_publish_snapshot_snapshot_payload_type,
771 { "Snapshot Payload Type", "zbee_zcl_se.met.publish_snapshot.payload_type", FT_UINT8, BASE_DEC, NULL,
772 0x00, NULL, HFILL } },
774 { &hf_zbee_zcl_met_publish_snapshot_snapshot_sub_payload,
775 { "Snapshot Sub-Payload", "zbee_zcl_se.met.publish_snapshot.payload_type", FT_BYTES, BASE_NONE, NULL,
776 0x00, NULL, HFILL } },
778 { &hf_zbee_zcl_met_get_sampled_data_rsp_sample_id,
779 { "Sample ID", "zbee_zcl_se.met.get_sampled_data_rsp.sample_id", FT_UINT16, BASE_DEC, NULL,
780 0x00, NULL, HFILL } },
782 { &hf_zbee_zcl_met_get_sampled_data_rsp_sample_start_time,
783 { "Sample Start Time", "zbee_zcl_se.met.get_sampled_data_rsp.sample_start_time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL,
784 0x00, NULL, HFILL } },
786 { &hf_zbee_zcl_met_get_sampled_data_rsp_sample_type,
787 { "Sample Type", "zbee_zcl_se.met.get_sampled_data_rsp.sample_type", FT_UINT8, BASE_DEC, NULL,
788 0x00, NULL, HFILL } },
790 { &hf_zbee_zcl_met_get_sampled_data_rsp_sample_request_interval,
791 { "Sample Request Interval", "zbee_zcl_se.met.get_sampled_data_rsp.sample_request_interval", FT_UINT16, BASE_DEC, NULL,
792 0x00, NULL, HFILL } },
794 { &hf_zbee_zcl_met_get_sampled_data_rsp_sample_number_of_samples,
795 { "Number of Samples", "zbee_zcl_se.met.get_sampled_data_rsp.number_of_samples", FT_UINT16, BASE_DEC, NULL,
796 0x00, NULL, HFILL } },
798 { &hf_zbee_zcl_met_get_sampled_data_rsp_sample_samples,
799 { "Samples", "zbee_zcl_se.met.get_sampled_data_rsp.samples", FT_UINT24, BASE_DEC, NULL,
800 0x00, NULL, HFILL } },
802 { &hf_zbee_zcl_met_configure_mirror_issuer_event_id,
803 { "Issuer Event ID", "zbee_zcl_se.met.configure_mirror.issuer_event_id", FT_UINT32, BASE_DEC, NULL,
804 0x00, NULL, HFILL } },
806 { &hf_zbee_zcl_met_configure_mirror_reporting_interval,
807 { "Reporting Interval", "zbee_zcl_se.met.configure_mirror.reporting_interval", FT_UINT24, BASE_DEC, NULL,
808 0x00, NULL, HFILL } },
810 { &hf_zbee_zcl_met_configure_mirror_mirror_notification_reporting,
811 { "Mirror Notification Reporting", "zbee_zcl_se.met.configure_mirror.mirror_notification_reporting", FT_BOOLEAN, BASE_NONE, NULL,
812 0x00, NULL, HFILL } },
814 { &hf_zbee_zcl_met_configure_mirror_notification_scheme,
815 { "Notification Scheme", "zbee_zcl_se.met.configure_mirror.notification_scheme", FT_UINT8, BASE_DEC, NULL,
816 0x00, NULL, HFILL } },
818 { &hf_zbee_zcl_met_get_notified_msg_notification_scheme,
819 { "Notification Scheme", "zbee_zcl_se.met.get_notified_msg.notification_scheme", FT_UINT8, BASE_DEC, NULL,
820 0x00, NULL, HFILL } },
822 { &hf_zbee_zcl_met_get_notified_msg_notification_flag_attribute_id,
823 { "Notification Flag attribute ID", "zbee_zcl_se.met.get_notified_msg.notification_flag_attribute_id", FT_UINT16, BASE_DEC, NULL,
824 0x00, NULL, HFILL } },
826 { &hf_zbee_zcl_met_get_notified_msg_notification_flags,
827 { "Notification Flags", "zbee_zcl_se.met.get_notified_msg.notification_flags", FT_UINT32, BASE_HEX, NULL,
828 0x00, NULL, HFILL } }
831 /* ZCL Metering subtrees */
836 /* Register the ZigBee ZCL Metering cluster protocol name and description */
837 proto_zbee_zcl_met = proto_register_protocol("ZigBee ZCL Metering", "ZCL Metering", ZBEE_PROTOABBREV_ZCL_MET);
838 proto_register_field_array(proto_zbee_zcl_met, hf, array_length(hf));
839 proto_register_subtree_array(ett, array_length(ett));
841 /* Register the ZigBee ZCL Metering dissector. */
842 met_handle = register_dissector(ZBEE_PROTOABBREV_ZCL_MET, dissect_zbee_zcl_met, proto_zbee_zcl_met);
843 } /*proto_register_zbee_zcl_met*/
846 *Hands off the Zcl Metering dissector.
850 proto_reg_handoff_zbee_zcl_met(void)
852 /* Register our dissector with the ZigBee application dissectors. */
853 dissector_add_uint("zbee.zcl.cluster", ZBEE_ZCL_CID_SIMPLE_METERING, met_handle);
855 zbee_zcl_init_cluster( proto_zbee_zcl_met,
857 ZBEE_ZCL_CID_SIMPLE_METERING,
858 hf_zbee_zcl_met_attr_id,
859 hf_zbee_zcl_met_srv_rx_cmd_id,
860 hf_zbee_zcl_met_srv_tx_cmd_id,
861 (zbee_zcl_fn_attr_data)dissect_zcl_met_attr_data
863 } /*proto_reg_handoff_zbee_zcl_met*/
865 /* ########################################################################## */
866 /* #### (0x0703) MESSAGING CLUSTER ########################################## */
867 /* ########################################################################## */
869 /* Attributes - None (other than Attribute Reporting Status) */
870 #define zbee_zcl_msg_attr_names_VALUE_STRING_LIST(XXX) \
872 XXX(ZBEE_ZCL_ATTR_ID_SE_ATTR_REPORT_STATUS_MSG, 0xFFFE, "Attribute Reporting Status" )
874 VALUE_STRING_ENUM(zbee_zcl_msg_attr_names);
875 VALUE_STRING_ARRAY(zbee_zcl_msg_attr_names);
877 /* Server Commands Received */
878 #define zbee_zcl_msg_srv_rx_cmd_names_VALUE_STRING_LIST(XXX) \
879 XXX(ZBEE_ZCL_CMD_ID_MSG_GET_LAST_MSG, 0x00, "Get Last Message" ) \
880 XXX(ZBEE_ZCL_CMD_ID_MSG_MSG_CONFIRM, 0x01, "Message Confirmation" ) \
881 XXX(ZBEE_ZCL_CMD_ID_MSG_GET_MESSAGE_CANCEL, 0x02, "Get Message Cancellation" )
883 VALUE_STRING_ENUM(zbee_zcl_msg_srv_rx_cmd_names);
884 VALUE_STRING_ARRAY(zbee_zcl_msg_srv_rx_cmd_names);
886 /* Server Commands Generated */
887 #define zbee_zcl_msg_srv_tx_cmd_names_VALUE_STRING_LIST(XXX) \
888 XXX(ZBEE_ZCL_CMD_ID_MSG_DISPLAY_MSG, 0x00, "Display Message" ) \
889 XXX(ZBEE_ZCL_CMD_ID_MSG_CANCEL_MSG, 0x01, "Cancel Message" ) \
890 XXX(ZBEE_ZCL_CMD_ID_MSG_DISPLAY_PROTECTED_MSG, 0x02, "Display Protected Message" ) \
891 XXX(ZBEE_ZCL_CMD_ID_MSG_CANCEL_ALL_MSG, 0x03, "Cancel All Messages" )
893 VALUE_STRING_ENUM(zbee_zcl_msg_srv_tx_cmd_names);
894 VALUE_STRING_ARRAY(zbee_zcl_msg_srv_tx_cmd_names);
896 /* Message Control Field Bit Map */
897 #define ZBEE_ZCL_MSG_CTRL_TX_MASK 0x03
898 #define ZBEE_ZCL_MSG_CTRL_IMPORTANCE_MASK 0x0C
899 #define ZBEE_ZCL_MSG_CTRL_RESERVED_MASK 0x50
900 #define ZBEE_ZCL_MSG_CTRL_ENHANCED_CONFIRM_MASK 0x20
901 #define ZBEE_ZCL_MSG_CTRL_CONFIRM_MASK 0x80
903 #define ZBEE_ZCL_MSG_CTRL_TX_NORMAL_ONLY 0x00 /* Normal Transmission Only */
904 #define ZBEE_ZCL_MSG_CTRL_TX_NORMAL_ANON_INTERPAN 0x01 /* Normal and Anonymous Inter-PAN Transmission Only */
905 #define ZBEE_ZCL_MSG_CTRL_TX_ANON_INTERPAN_ONLY 0x02 /* Anonymous Inter-PAN Transmission Only */
907 #define ZBEE_ZCL_MSG_CTRL_IMPORTANCE_LOW 0x00 /* Low */
908 #define ZBEE_ZCL_MSG_CTRL_IMPORTANCE_MEDIUM 0x01 /* Medium */
909 #define ZBEE_ZCL_MSG_CTRL_IMPORTANCE_HIGH 0x02 /* High */
910 #define ZBEE_ZCL_MSG_CTRL_IMPORTANCE_CRITICAL 0x03 /* Critical */
912 #define ZBEE_ZCL_MSG_EXT_CTRL_STATUS_MASK 0x01
914 #define ZBEE_ZCL_MSG_CONFIRM_CTRL_MASK 0x01
916 #define ZBEE_ZCL_MSG_START_TIME_NOW 0x00000000 /* Now */
918 /*************************/
919 /* Function Declarations */
920 /*************************/
921 void proto_register_zbee_zcl_msg(void);
922 void proto_reg_handoff_zbee_zcl_msg(void);
924 /* Attribute Dissector Helpers */
925 static void dissect_zcl_msg_attr_data (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type);
927 /* Command Dissector Helpers */
928 static void dissect_zcl_msg_display (tvbuff_t *tvb, proto_tree *tree, guint *offset);
929 static void dissect_zcl_msg_cancel (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset);
930 static void dissect_zcl_msg_confirm (tvbuff_t *tvb, proto_tree *tree, guint *offset);
931 static void dissect_zcl_msg_cancel_all (tvbuff_t *tvb, proto_tree *tree, guint *offset);
932 static void dissect_zcl_msg_get_cancel (tvbuff_t *tvb, proto_tree *tree, guint *offset);
934 /* Private functions prototype */
935 static void decode_zcl_msg_duration (gchar *s, guint16 value);
937 /*************************/
938 /* Global Variables */
939 /*************************/
941 static dissector_handle_t msg_handle;
943 /* Initialize the protocol and registered fields */
944 static int proto_zbee_zcl_msg = -1;
946 static int hf_zbee_zcl_msg_srv_tx_cmd_id = -1;
947 static int hf_zbee_zcl_msg_srv_rx_cmd_id = -1;
948 static int hf_zbee_zcl_msg_attr_id = -1;
949 static int hf_zbee_zcl_msg_attr_reporting_status = -1;
950 static int hf_zbee_zcl_msg_message_id = -1;
951 static int hf_zbee_zcl_msg_ctrl = -1;
952 static int hf_zbee_zcl_msg_ctrl_tx = -1;
953 static int hf_zbee_zcl_msg_ctrl_importance = -1;
954 static int hf_zbee_zcl_msg_ctrl_enh_confirm = -1;
955 static int hf_zbee_zcl_msg_ctrl_reserved = -1;
956 static int hf_zbee_zcl_msg_ctrl_confirm = -1;
957 static int hf_zbee_zcl_msg_ext_ctrl = -1;
958 static int hf_zbee_zcl_msg_ext_ctrl_status = -1;
959 static int hf_zbee_zcl_msg_start_time = -1;
960 static int hf_zbee_zcl_msg_duration = -1;
961 static int hf_zbee_zcl_msg_message_length = - 1;
962 static int hf_zbee_zcl_msg_message = -1;
963 static int hf_zbee_zcl_msg_confirm_time = -1;
964 static int hf_zbee_zcl_msg_confirm_ctrl = -1;
965 static int hf_zbee_zcl_msg_confirm_response = -1;
966 static int hf_zbee_zcl_msg_confirm_response_length = - 1;
967 static int hf_zbee_zcl_msg_implementation_time = -1;
968 static int hf_zbee_zcl_msg_earliest_time = -1;
970 /* Initialize the subtree pointers */
971 static gint ett_zbee_zcl_msg = -1;
972 static gint ett_zbee_zcl_msg_message_control = -1;
973 static gint ett_zbee_zcl_msg_ext_message_control = -1;
975 static expert_field ei_zbee_zcl_msg_msg_ctrl_depreciated = EI_INIT;
977 /* Message Control Transmission */
978 static const value_string zbee_zcl_msg_ctrl_tx_names[] = {
979 { ZBEE_ZCL_MSG_CTRL_TX_NORMAL_ONLY, "Normal Transmission Only" },
980 { ZBEE_ZCL_MSG_CTRL_TX_NORMAL_ANON_INTERPAN, "Normal and Anonymous Inter-PAN Transmission Only" },
981 { ZBEE_ZCL_MSG_CTRL_TX_ANON_INTERPAN_ONLY, "Anonymous Inter-PAN Transmission Only" },
985 /* Message Control Importance */
986 static const value_string zbee_zcl_msg_ctrl_importance_names[] = {
987 { ZBEE_ZCL_MSG_CTRL_IMPORTANCE_LOW, "Low" },
988 { ZBEE_ZCL_MSG_CTRL_IMPORTANCE_MEDIUM, "Medium" },
989 { ZBEE_ZCL_MSG_CTRL_IMPORTANCE_HIGH, "High" },
990 { ZBEE_ZCL_MSG_CTRL_IMPORTANCE_CRITICAL, "Critical" },
994 /*************************/
995 /* Function Bodies */
996 /*************************/
999 *This function is called by ZCL foundation dissector in order to decode
1001 *@param tree pointer to data tree Wireshark uses to display packet.
1002 *@param tvb pointer to buffer containing raw packet.
1003 *@param offset pointer to buffer offset
1004 *@param attr_id attribute identifier
1005 *@param data_type attribute data type
1008 dissect_zcl_msg_attr_data(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type)
1011 /* no cluster specific attributes */
1013 /* applies to all SE clusters */
1014 case ZBEE_ZCL_ATTR_ID_SE_ATTR_REPORT_STATUS_MSG:
1015 proto_tree_add_item(tree, hf_zbee_zcl_msg_attr_reporting_status, tvb, *offset, 1, ENC_NA);
1019 default: /* Catch all */
1020 dissect_zcl_attr_data(tvb, tree, offset, data_type);
1023 } /*dissect_zcl_ias_zone_attr_data*/
1026 *ZigBee ZCL Messaging cluster dissector for wireshark.
1028 *@param tvb pointer to buffer containing raw packet.
1029 *@param pinfo pointer to packet information fields
1030 *@param tree pointer to data tree Wireshark uses to display packet.
1033 dissect_zbee_zcl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
1035 proto_tree *payload_tree;
1036 zbee_zcl_packet *zcl;
1041 /* Reject the packet if data is NULL */
1044 zcl = (zbee_zcl_packet *)data;
1045 cmd_id = zcl->cmd_id;
1047 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
1048 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
1049 /* Append the command name to the info column. */
1050 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
1051 val_to_str_const(cmd_id, zbee_zcl_msg_srv_rx_cmd_names, "Unknown Command"),
1054 /* Add the command ID. */
1055 proto_tree_add_uint(tree, hf_zbee_zcl_msg_srv_rx_cmd_id, tvb, offset, 1, cmd_id);
1057 /* Check is this command has a payload, than add the payload tree */
1058 rem_len = tvb_reported_length_remaining(tvb, ++offset);
1060 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_msg, NULL, "Payload");
1062 /* Call the appropriate command dissector */
1065 case ZBEE_ZCL_CMD_ID_MSG_GET_LAST_MSG:
1069 case ZBEE_ZCL_CMD_ID_MSG_MSG_CONFIRM:
1070 dissect_zcl_msg_confirm(tvb, payload_tree, &offset);
1073 case ZBEE_ZCL_CMD_ID_MSG_GET_MESSAGE_CANCEL:
1074 dissect_zcl_msg_get_cancel(tvb, payload_tree, &offset);
1082 else { /* ZBEE_ZCL_FCF_TO_CLIENT */
1083 /* Append the command name to the info column. */
1084 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
1085 val_to_str_const(cmd_id, zbee_zcl_msg_srv_tx_cmd_names, "Unknown Command"),
1088 /* Add the command ID. */
1089 proto_tree_add_uint(tree, hf_zbee_zcl_msg_srv_tx_cmd_id, tvb, offset, 1, cmd_id);
1091 /* Check is this command has a payload, than add the payload tree */
1092 rem_len = tvb_reported_length_remaining(tvb, ++offset);
1094 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_msg, NULL, "Payload");
1096 /* Call the appropriate command dissector */
1099 case ZBEE_ZCL_CMD_ID_MSG_DISPLAY_MSG:
1100 dissect_zcl_msg_display(tvb, payload_tree, &offset);
1103 case ZBEE_ZCL_CMD_ID_MSG_CANCEL_MSG:
1104 dissect_zcl_msg_cancel(tvb, pinfo, payload_tree, &offset);
1107 case ZBEE_ZCL_CMD_ID_MSG_DISPLAY_PROTECTED_MSG:
1108 dissect_zcl_msg_display(tvb, payload_tree, &offset);
1111 case ZBEE_ZCL_CMD_ID_MSG_CANCEL_ALL_MSG:
1112 dissect_zcl_msg_cancel_all(tvb, payload_tree, &offset);
1121 return tvb_captured_length(tvb);
1122 } /*dissect_zbee_zcl_msg*/
1125 *This function manages the Display Message payload
1127 *@param tvb pointer to buffer containing raw packet.
1128 *@param tree pointer to data tree Wireshark uses to display packet.
1129 *@param offset pointer to offset from caller
1132 dissect_zcl_msg_display(tvbuff_t *tvb, proto_tree *tree, guint *offset)
1137 static const int * message_ctrl_flags[] = {
1138 &hf_zbee_zcl_msg_ctrl_tx,
1139 &hf_zbee_zcl_msg_ctrl_importance,
1140 &hf_zbee_zcl_msg_ctrl_enh_confirm,
1141 &hf_zbee_zcl_msg_ctrl_reserved,
1142 &hf_zbee_zcl_msg_ctrl_confirm,
1146 static const int * message_ext_ctrl_flags[] = {
1147 &hf_zbee_zcl_msg_ext_ctrl_status,
1152 proto_tree_add_item(tree, hf_zbee_zcl_msg_message_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
1155 /* Message Control */
1156 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_msg_ctrl, ett_zbee_zcl_msg_message_control, message_ctrl_flags, ENC_NA);
1160 proto_tree_add_item(tree, hf_zbee_zcl_msg_start_time, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
1163 /* Duration In Minutes*/
1164 proto_tree_add_item(tree, hf_zbee_zcl_msg_duration, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1167 /* Message Length */
1168 msg_len = tvb_get_guint8(tvb, *offset); /* string length */
1169 proto_tree_add_item(tree, hf_zbee_zcl_msg_message_length, tvb, *offset, 1, ENC_NA);
1173 msg_data = tvb_get_string_enc(wmem_packet_scope(), tvb, *offset, msg_len, ENC_LITTLE_ENDIAN);
1174 proto_tree_add_string(tree, hf_zbee_zcl_msg_message, tvb, *offset, msg_len, msg_data);
1177 /* (Optional) Extended Message Control */
1178 if (tvb_reported_length_remaining(tvb, *offset) > 0) {
1179 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_msg_ext_ctrl, ett_zbee_zcl_msg_ext_message_control, message_ext_ctrl_flags, ENC_NA);
1183 } /*dissect_zcl_msg_display*/
1186 *This function manages the Cancel Message payload
1188 *@param tvb pointer to buffer containing raw packet.
1189 *@param tree pointer to data tree Wireshark uses to display packet.
1190 *@param offset pointer to offset from caller
1193 dissect_zcl_msg_cancel(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset)
1198 proto_tree_add_item(tree, hf_zbee_zcl_msg_message_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
1201 /* Message Control */
1202 msg_ctrl = tvb_get_guint8(tvb, *offset);
1203 proto_tree_add_item(tree, hf_zbee_zcl_msg_ctrl, tvb, *offset, 1, ENC_NA);
1206 if (msg_ctrl != 0x00) {
1207 expert_add_info(pinfo, tree, &ei_zbee_zcl_msg_msg_ctrl_depreciated);
1210 } /* dissect_zcl_msg_cancel */
1214 *Send Cancel All command
1216 *@param tvb pointer to buffer containing raw packet.
1217 *@param tree pointer to data tree Wireshark uses to display packet.
1218 *@param offset pointer to offset from caller
1221 dissect_zcl_msg_cancel_all(tvbuff_t *tvb, proto_tree *tree, guint *offset)
1225 /* Retrieve "Confirmation Time" field */
1226 impl_time.secs = (time_t)tvb_get_letohl(tvb, *offset) + ZBEE_ZCL_NSTIME_UTC_OFFSET;
1227 impl_time.nsecs = 0;
1228 proto_tree_add_time(tree, hf_zbee_zcl_msg_implementation_time, tvb, *offset, 4, &impl_time);
1231 } /* dissect_zcl_msg_cancel_all */
1234 *Send Cancel All command
1236 *@param tvb pointer to buffer containing raw packet.
1237 *@param tree pointer to data tree Wireshark uses to display packet.
1238 *@param offset pointer to offset from caller
1241 dissect_zcl_msg_get_cancel(tvbuff_t *tvb, proto_tree *tree, guint *offset)
1245 /* Earliest Implementation Time */
1246 impl_time.secs = (time_t)tvb_get_letohl(tvb, *offset) + ZBEE_ZCL_NSTIME_UTC_OFFSET;
1247 impl_time.nsecs = 0;
1248 proto_tree_add_time(tree, hf_zbee_zcl_msg_earliest_time, tvb, *offset, 4, &impl_time);
1251 } /* dissect_zcl_msg_get_cancel */
1255 *This function manages the Message Confirmation payload
1257 *@param tvb pointer to buffer containing raw packet.
1258 *@param tree pointer to data tree Wireshark uses to display packet.
1259 *@param offset pointer to offset from caller
1262 dissect_zcl_msg_confirm(tvbuff_t *tvb, proto_tree *tree, guint *offset)
1266 nstime_t confirm_time;
1268 /* Retrieve "Message ID" field */
1269 proto_tree_add_item(tree, hf_zbee_zcl_msg_message_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
1272 /* Retrieve "Confirmation Time" field */
1273 confirm_time.secs = (time_t)tvb_get_letohl(tvb, *offset) + ZBEE_ZCL_NSTIME_UTC_OFFSET;
1274 confirm_time.nsecs = 0;
1275 proto_tree_add_time(tree, hf_zbee_zcl_msg_confirm_time, tvb, *offset, 4, &confirm_time);
1278 /* (Optional) Confirm Control */
1279 if ( tvb_reported_length_remaining(tvb, *offset) <= 0 ) return;
1280 proto_tree_add_item(tree, hf_zbee_zcl_msg_confirm_ctrl, tvb, *offset, 1, ENC_NA);
1283 /* (Optional) Response Text Length */
1284 if ( tvb_reported_length_remaining(tvb, *offset) <= 0 ) return;
1285 msg_len = tvb_get_guint8(tvb, *offset); /* string length */
1286 proto_tree_add_item(tree, hf_zbee_zcl_msg_confirm_response_length, tvb, *offset, 1, ENC_NA);
1289 /* (Optional) Response Text, but is we have a length we expect to find the subsequent string */
1291 msg_data = tvb_get_string_enc(wmem_packet_scope(), tvb, *offset, msg_len, ENC_LITTLE_ENDIAN);
1292 proto_tree_add_string(tree, hf_zbee_zcl_msg_confirm_response, tvb, *offset, msg_len, msg_data);
1296 } /* dissect_zcl_msg_confirm */
1299 *This function decodes duration in minute type variable
1303 decode_zcl_msg_duration(gchar *s, guint16 value)
1305 if (value == 0xffff)
1306 g_snprintf(s, ITEM_LABEL_LENGTH, "Until changed");
1308 g_snprintf(s, ITEM_LABEL_LENGTH, "%d minutes", value);
1310 } /*decode_zcl_msg_duration*/
1313 * This function decodes start time, with a special case for
1314 * ZBEE_ZCL_MSG_START_TIME_NOW.
1316 * @param s string to display
1317 * @param value value to decode
1320 decode_zcl_msg_start_time(gchar *s, guint32 value)
1322 if (value == ZBEE_ZCL_MSG_START_TIME_NOW)
1323 g_snprintf(s, ITEM_LABEL_LENGTH, "Now");
1326 time_t epoch_time = (time_t)value + ZBEE_ZCL_NSTIME_UTC_OFFSET;
1327 start_time = abs_time_secs_to_str (NULL, epoch_time, ABSOLUTE_TIME_LOCAL, TRUE);
1328 g_snprintf(s, ITEM_LABEL_LENGTH, "%s", start_time);
1329 wmem_free(NULL, start_time);
1331 } /* decode_zcl_msg_start_time */
1334 *This function registers the ZCL Messaging dissector
1338 proto_register_zbee_zcl_msg(void)
1340 static hf_register_info hf[] = {
1342 { &hf_zbee_zcl_msg_attr_id,
1343 { "Attribute", "zbee_zcl_se.msg.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_msg_attr_names),
1344 0x0, NULL, HFILL } },
1346 { &hf_zbee_zcl_msg_attr_reporting_status, /* common to all SE clusters */
1347 { "Attribute Reporting Status", "zbee_zcl_se.msg.attr.attr_reporting_status",
1348 FT_UINT8, BASE_HEX, VALS(zbee_zcl_se_reporting_status_names), 0x00, NULL, HFILL } },
1350 { &hf_zbee_zcl_msg_srv_tx_cmd_id,
1351 { "Command", "zbee_zcl_se.msg.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_msg_srv_tx_cmd_names),
1352 0x00, NULL, HFILL } },
1354 { &hf_zbee_zcl_msg_srv_rx_cmd_id,
1355 { "Command", "zbee_zcl_se.msg.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_msg_srv_rx_cmd_names),
1356 0x00, NULL, HFILL } },
1358 { &hf_zbee_zcl_msg_message_id,
1359 { "Message ID", "zbee_zcl_se.msg.message.id", FT_UINT32, BASE_HEX, NULL,
1360 0x00, NULL, HFILL } },
1362 /* Start of 'Message Control' fields */
1363 { &hf_zbee_zcl_msg_ctrl,
1364 { "Message Control", "zbee_zcl_se.msg.message.ctrl", FT_UINT8, BASE_HEX, NULL,
1365 0x0, NULL, HFILL } },
1367 { &hf_zbee_zcl_msg_ctrl_tx,
1368 { "Transmission", "zbee_zcl_se.msg.message.ctrl.tx", FT_UINT8, BASE_HEX, VALS(zbee_zcl_msg_ctrl_tx_names),
1369 ZBEE_ZCL_MSG_CTRL_TX_MASK, NULL, HFILL } },
1371 { &hf_zbee_zcl_msg_ctrl_importance,
1372 { "Importance", "zbee_zcl_se.msg.message.ctrl.importance", FT_UINT8, BASE_HEX, VALS(zbee_zcl_msg_ctrl_importance_names),
1373 ZBEE_ZCL_MSG_CTRL_IMPORTANCE_MASK, NULL, HFILL } },
1375 { &hf_zbee_zcl_msg_ctrl_enh_confirm,
1376 { "Confirmation", "zbee_zcl_se.msg.message.ctrl.enhconfirm", FT_BOOLEAN, 8, TFS(&tfs_required_not_required),
1377 ZBEE_ZCL_MSG_CTRL_ENHANCED_CONFIRM_MASK, NULL, HFILL } },
1379 { &hf_zbee_zcl_msg_ctrl_reserved,
1380 { "Reserved", "zbee_zcl_se.msg.message.ctrl.reserved", FT_UINT8, BASE_HEX, NULL,
1381 ZBEE_ZCL_MSG_CTRL_RESERVED_MASK, NULL, HFILL } },
1383 { &hf_zbee_zcl_msg_ctrl_confirm,
1384 { "Confirmation", "zbee_zcl_se.msg.message.ctrl.confirm", FT_BOOLEAN, 8, TFS(&tfs_required_not_required),
1385 ZBEE_ZCL_MSG_CTRL_CONFIRM_MASK, NULL, HFILL } },
1386 /* End of 'Message Control' fields */
1388 /* Start of 'Extended Message Control' fields */
1389 { &hf_zbee_zcl_msg_ext_ctrl,
1390 { "Extended Message Control", "zbee_zcl_se.msg.message.ext.ctrl", FT_UINT8, BASE_HEX, NULL,
1391 0x0, NULL, HFILL } },
1393 { &hf_zbee_zcl_msg_ext_ctrl_status,
1394 { "Message Confirmation Status", "zbee_zcl_se.msg.message.ext.ctrl.status", FT_BOOLEAN, 8, TFS(&tfs_confirmed_unconfirmed),
1395 ZBEE_ZCL_MSG_EXT_CTRL_STATUS_MASK, NULL, HFILL } },
1396 /* End of 'Extended Message Control' fields */
1398 { &hf_zbee_zcl_msg_start_time,
1399 { "Start Time", "zbee_zcl_se.msg.message.start_time", FT_UINT32, BASE_CUSTOM, CF_FUNC(decode_zcl_msg_start_time),
1400 0x00, NULL, HFILL } },
1402 { &hf_zbee_zcl_msg_duration,
1403 { "Duration", "zbee_zcl_se.msg.message.duration", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_msg_duration),
1404 0x00, NULL, HFILL } },
1406 { &hf_zbee_zcl_msg_message_length,
1407 { "Message Length", "zbee_zcl_se.msg.message.length", FT_UINT8, BASE_DEC, NULL,
1408 0x00, NULL, HFILL } },
1410 { &hf_zbee_zcl_msg_message,
1411 { "Message", "zbee_zcl_se.msg.message", FT_STRING, BASE_NONE, NULL,
1412 0x00, NULL, HFILL } },
1414 { &hf_zbee_zcl_msg_confirm_time,
1415 { "Confirmation Time", "zbee_zcl_se.msg.message.confirm_time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL,
1416 0x0, NULL, HFILL } },
1418 { &hf_zbee_zcl_msg_confirm_ctrl,
1419 { "Confirmation Control", "zbee_zcl_se.msg.message.confirm.ctrl", FT_BOOLEAN, 8, TFS(&tfs_no_yes),
1420 ZBEE_ZCL_MSG_CONFIRM_CTRL_MASK, NULL, HFILL } },
1422 { &hf_zbee_zcl_msg_confirm_response_length,
1423 { "Response Length", "zbee_zcl_se.msg.message.length", FT_UINT8, BASE_DEC, NULL,
1424 0x00, NULL, HFILL } },
1426 { &hf_zbee_zcl_msg_confirm_response,
1427 { "Response", "zbee_zcl_se.msg.message", FT_STRING, BASE_NONE, NULL,
1428 0x00, NULL, HFILL } },
1430 { &hf_zbee_zcl_msg_implementation_time,
1431 { "Implementation Time", "zbee_zcl_se.msg.impl_time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL,
1434 { &hf_zbee_zcl_msg_earliest_time,
1435 { "Earliest Implementation Time", "zbee_zcl_se.msg.earliest_impl_time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL,
1440 /* ZCL Messaging subtrees */
1443 &ett_zbee_zcl_msg_message_control,
1444 &ett_zbee_zcl_msg_ext_message_control,
1448 expert_module_t* expert_zbee_zcl_msg;
1449 static ei_register_info ei[] = {
1450 { &ei_zbee_zcl_msg_msg_ctrl_depreciated, { "zbee_zcl_se.msg.msg_ctrl.depreciated", PI_PROTOCOL, PI_WARN, "Message Control depreciated in this message, should be 0x00", EXPFILL }},
1453 /* Register the ZigBee ZCL Messaging cluster protocol name and description */
1454 proto_zbee_zcl_msg = proto_register_protocol("ZigBee ZCL Messaging", "ZCL Messaging", ZBEE_PROTOABBREV_ZCL_MSG);
1455 proto_register_field_array(proto_zbee_zcl_msg, hf, array_length(hf));
1456 proto_register_subtree_array(ett, array_length(ett));
1458 expert_zbee_zcl_msg = expert_register_protocol(proto_zbee_zcl_msg);
1459 expert_register_field_array(expert_zbee_zcl_msg, ei, array_length(ei));
1461 /* Register the ZigBee ZCL Messaging dissector. */
1462 msg_handle = register_dissector(ZBEE_PROTOABBREV_ZCL_MSG, dissect_zbee_zcl_msg, proto_zbee_zcl_msg);
1463 } /*proto_register_zbee_zcl_msg*/
1466 *Hands off the Zcl Messaging dissector.
1470 proto_reg_handoff_zbee_zcl_msg(void)
1472 /* Register our dissector with the ZigBee application dissectors. */
1473 dissector_add_uint("zbee.zcl.cluster", ZBEE_ZCL_CID_MESSAGE, msg_handle);
1475 zbee_zcl_init_cluster( proto_zbee_zcl_msg,
1477 ZBEE_ZCL_CID_MESSAGE,
1478 hf_zbee_zcl_msg_attr_id,
1479 hf_zbee_zcl_msg_srv_rx_cmd_id,
1480 hf_zbee_zcl_msg_srv_tx_cmd_id,
1481 (zbee_zcl_fn_attr_data)dissect_zcl_msg_attr_data
1483 } /*proto_reg_handoff_zbee_zcl_msg*/
1485 /* ########################################################################## */
1486 /* #### (0x0704) TUNNELING CLUSTER ########################################### */
1487 /* ########################################################################## */
1490 #define zbee_zcl_tun_attr_names_VALUE_STRING_LIST(XXX) \
1491 XXX(ZBEE_ZCL_ATTR_ID_TUN_CLOSE_TIMEOUT, 0x0000, "Close Tunnel Timeout" ) \
1492 /* Smart Energy */ \
1493 XXX(ZBEE_ZCL_ATTR_ID_SE_ATTR_REPORT_STATUS_TUN, 0xFFFE, "Attribute Reporting Status" )
1495 VALUE_STRING_ENUM(zbee_zcl_tun_attr_names);
1496 VALUE_STRING_ARRAY(zbee_zcl_tun_attr_names);
1498 /* Server Commands Received */
1499 #define zbee_zcl_tun_srv_rx_cmd_names_VALUE_STRING_LIST(XXX) \
1500 XXX(ZBEE_ZCL_CMD_ID_TUN_REQUEST_TUNNEL, 0x00, "Request Tunnel" ) \
1501 XXX(ZBEE_ZCL_CMD_ID_TUN_CLOSE_TUNNEL, 0x01, "Close Tunnel" ) \
1502 XXX(ZBEE_ZCL_CMD_ID_TUN_TRANSFER_DATA, 0x02, "Transfer Data" ) \
1503 XXX(ZBEE_ZCL_CMD_ID_TUN_TRANSFER_DATA_ERROR, 0x03, "Transfer Data Error" ) \
1504 XXX(ZBEE_ZCL_CMD_ID_TUN_ACK_TRANSFER_DATA, 0x04, "Ack Transfer Data" ) \
1505 XXX(ZBEE_ZCL_CMD_ID_TUN_READY_DATA, 0x05, "Ready Data" ) \
1506 XXX(ZBEE_ZCL_CMD_ID_TUN_GET_SUPPORTED_PROTOCOLS, 0x06, "Get Supported Protocols" )
1508 VALUE_STRING_ENUM(zbee_zcl_tun_srv_rx_cmd_names);
1509 VALUE_STRING_ARRAY(zbee_zcl_tun_srv_rx_cmd_names);
1511 /* Server Commands Generated */
1512 #define zbee_zcl_tun_srv_tx_cmd_names_VALUE_STRING_LIST(XXX) \
1513 XXX(ZBEE_ZCL_CMD_ID_TUN_REQUEST_TUNNEL_RSP, 0x00, "Request Tunnel Response" ) \
1514 XXX(ZBEE_ZCL_CMD_ID_TUN_TRANSFER_DATA_TX, 0x01, "Transfer Data" ) \
1515 XXX(ZBEE_ZCL_CMD_ID_TUN_TRANSFER_DATA_ERROR_TX, 0x02, "Transfer Data Error" ) \
1516 XXX(ZBEE_ZCL_CMD_ID_TUN_ACK_TRANSFER_DATA_TX, 0x03, "Ack Transfer Data" ) \
1517 XXX(ZBEE_ZCL_CMD_ID_TUN_READY_DATA_TX, 0x04, "Ready Data" ) \
1518 XXX(ZBEE_ZCL_CMD_ID_TUN_GET_SUPPORTED_PROTOCOLS_RSP, 0x05, "Get Supported Tunnel Protocols" ) \
1519 XXX(ZBEE_ZCL_CMD_ID_TUN_CLOSURE_NOTIFY, 0x06, "Tunnel Closure Notification" )
1521 VALUE_STRING_ENUM(zbee_zcl_tun_srv_tx_cmd_names);
1522 VALUE_STRING_ARRAY(zbee_zcl_tun_srv_tx_cmd_names);
1524 /*************************/
1525 /* Function Declarations */
1526 /*************************/
1527 void proto_register_zbee_zcl_tun(void);
1528 void proto_reg_handoff_zbee_zcl_tun(void);
1530 /* Attribute Dissector Helpers */
1531 static void dissect_zcl_tun_attr_data (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type);
1533 /* Private functions prototype */
1535 /*************************/
1536 /* Global Variables */
1537 /*************************/
1539 static dissector_handle_t tun_handle;
1541 /* Initialize the protocol and registered fields */
1542 static int proto_zbee_zcl_tun = -1;
1544 static int hf_zbee_zcl_tun_srv_tx_cmd_id = -1;
1545 static int hf_zbee_zcl_tun_srv_rx_cmd_id = -1;
1546 static int hf_zbee_zcl_tun_attr_id = -1;
1547 static int hf_zbee_zcl_tun_attr_reporting_status = -1;
1548 static int hf_zbee_zcl_tun_attr_close_timeout = -1;
1549 static int hf_zbee_zcl_tun_protocol_id = -1;
1550 static int hf_zbee_zcl_tun_manufacturer_code = -1;
1551 static int hf_zbee_zcl_tun_flow_control_support = -1;
1552 static int hf_zbee_zcl_tun_max_in_size = -1;
1553 static int hf_zbee_zcl_tun_tunnel_id = -1;
1554 static int hf_zbee_zcl_tun_num_octets_left = -1;
1555 static int hf_zbee_zcl_tun_protocol_offset = -1;
1556 static int hf_zbee_zcl_tun_protocol_list_complete = -1;
1557 static int hf_zbee_zcl_tun_protocol_count = -1;
1558 static int hf_zbee_zcl_tun_transfer_status = -1;
1559 static int hf_zbee_zcl_tun_transfer_data = -1;
1560 static int hf_zbee_zcl_tun_transfer_data_status = -1;
1562 /* Initialize the subtree pointers */
1563 static gint ett_zbee_zcl_tun = -1;
1565 /* Subdissector handles. */
1566 static dissector_handle_t ipv4_handle;
1567 static dissector_handle_t ipv6_handle;
1569 #define zbee_zcl_tun_protocol_names_VALUE_STRING_LIST(XXX) \
1570 XXX(ZBEE_ZCL_TUN_PROTO_DLMS, 0x00, "DLMS/COSEM (IEC 62056)" ) \
1571 XXX(ZBEE_ZCL_TUN_PROTO_IEC_61107, 0x01, "IEC 61107" ) \
1572 XXX(ZBEE_ZCL_TUN_PROTO_ANSI_C12, 0x02, "ANSI C12" ) \
1573 XXX(ZBEE_ZCL_TUN_PROTO_M_BUS, 0x03, "M-BUS" ) \
1574 XXX(ZBEE_ZCL_TUN_PROTO_SML, 0x04, "SML" ) \
1575 XXX(ZBEE_ZCL_TUN_PROTO_CLIMATE_TALK, 0x05, "ClimateTalk" ) \
1576 XXX(ZBEE_ZCL_TUN_PROTO_GB_HRGP, 0x06, "GB-HRGP" ) \
1577 XXX(ZBEE_ZCL_TUN_PROTO_IPV6, 0x07, "IPv6" ) \
1578 XXX(ZBEE_ZCL_TUN_PROTO_IPV4, 0x08, "IPv4" ) \
1579 XXX(ZBEE_ZCL_TUN_PROTO_NULL, 0x09, "null" ) \
1580 XXX(ZBEE_ZCL_TUN_PROTO_TEST, 199, "test" ) \
1581 XXX(ZBEE_ZCL_TUN_PROTO_MANUFACTURER, 200, "Manufacturer Specific" ) \
1582 XXX(ZBEE_ZCL_TUN_PROTO_RESERVED, 0xFF, "Reserved" )
1584 VALUE_STRING_ENUM(zbee_zcl_tun_protocol_names);
1585 VALUE_STRING_ARRAY(zbee_zcl_tun_protocol_names);
1587 #define zbee_zcl_tun_trans_data_status_names_VALUE_STRING_LIST(XXX) \
1588 XXX(ZBEE_ZCL_TUN_TRANS_STATUS_NO_TUNNEL, 0x00, "Tunnel ID Does Not Exist" ) \
1589 XXX(ZBEE_ZCL_TUN_TRANS_STATUS_WRONG_DEV, 0x01, "Wrong Device" ) \
1590 XXX(ZBEE_ZCL_TUN_TRANS_STATUS_OVERFLOW, 0x02, "Data Overflow" )
1592 VALUE_STRING_ENUM(zbee_zcl_tun_trans_data_status_names);
1593 VALUE_STRING_ARRAY(zbee_zcl_tun_trans_data_status_names);
1595 #define zbee_zcl_tun_status_names_VALUE_STRING_LIST(XXX) \
1596 XXX(ZBEE_ZCL_TUN_STATUS_SUCCESS, 0x00, "Success" ) \
1597 XXX(ZBEE_ZCL_TUN_STATUS_BUSY, 0x01, "Busy" ) \
1598 XXX(ZBEE_ZCL_TUN_STATUS_NO_MORE_IDS, 0x02, "No More Tunnel IDs" ) \
1599 XXX(ZBEE_ZCL_TUN_STATUS_PROTO_NOT_SUPP, 0x03, "Protocol Not Supported" ) \
1600 XXX(ZBEE_ZCL_TUN_STATUS_FLOW_CONTROL_NOT_SUPP, 0x04, "Flow Control Not Supported" )
1602 VALUE_STRING_ENUM(zbee_zcl_tun_status_names);
1603 VALUE_STRING_ARRAY(zbee_zcl_tun_status_names);
1605 /*************************/
1606 /* Function Bodies */
1607 /*************************/
1610 *This function is called by ZCL foundation dissector in order to decode
1612 *@param tree pointer to data tree Wireshark uses to display packet.
1613 *@param tvb pointer to buffer containing raw packet.
1614 *@param offset pointer to buffer offset
1615 *@param attr_id attribute identifier
1616 *@param data_type attribute data type
1619 dissect_zcl_tun_attr_data(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type)
1622 /* cluster specific attributes */
1623 case ZBEE_ZCL_ATTR_ID_TUN_CLOSE_TIMEOUT:
1624 proto_tree_add_item(tree, hf_zbee_zcl_tun_attr_close_timeout, tvb, *offset, 2, ENC_NA);
1628 /* applies to all SE clusters */
1629 case ZBEE_ZCL_ATTR_ID_SE_ATTR_REPORT_STATUS_TUN:
1630 proto_tree_add_item(tree, hf_zbee_zcl_tun_attr_reporting_status, tvb, *offset, 1, ENC_NA);
1634 default: /* Catch all */
1635 dissect_zcl_attr_data(tvb, tree, offset, data_type);
1638 } /*dissect_zcl_ias_zone_attr_data*/
1641 *This function manages the Display Message payload
1643 *@param tvb pointer to buffer containing raw packet.
1644 *@param tree pointer to data tree Wireshark uses to display packet.
1645 *@param offset pointer to offset from caller
1648 dissect_zcl_tun_request_tunnel(tvbuff_t *tvb, proto_tree *tree, guint *offset)
1650 proto_tree_add_item(tree, hf_zbee_zcl_tun_protocol_id, tvb, *offset, 1, ENC_NA);
1653 proto_tree_add_item(tree, hf_zbee_zcl_tun_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1656 proto_tree_add_item(tree, hf_zbee_zcl_tun_flow_control_support, tvb, *offset, 1, ENC_NA);
1659 proto_tree_add_item(tree, hf_zbee_zcl_tun_max_in_size, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1664 *This function manages the Display Message payload
1666 *@param tvb pointer to buffer containing raw packet.
1667 *@param tree pointer to data tree Wireshark uses to display packet.
1668 *@param offset pointer to offset from caller
1671 dissect_zcl_tun_close_tunnel(tvbuff_t *tvb, proto_tree *tree, guint *offset)
1673 proto_tree_add_item(tree, hf_zbee_zcl_tun_tunnel_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1678 *This function manages the Display Message payload
1680 *@param tvb pointer to buffer containing raw packet.
1681 *@param tree pointer to data tree Wireshark uses to display packet.
1682 *@param offset pointer to offset from caller
1685 dissect_zcl_tun_transfer_data(tvbuff_t *tvb, proto_tree *tree, guint *offset)
1689 proto_tree_add_item(tree, hf_zbee_zcl_tun_tunnel_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1692 length = tvb_reported_length_remaining(tvb, *offset);
1693 proto_tree_add_item(tree, hf_zbee_zcl_tun_transfer_data, tvb, *offset, length, ENC_NA);
1698 *This function manages the Display Message payload
1700 *@param tvb pointer to buffer containing raw packet.
1701 *@param tree pointer to data tree Wireshark uses to display packet.
1702 *@param offset pointer to offset from caller
1705 dissect_zcl_tun_transfer_data_error(tvbuff_t *tvb, proto_tree *tree, guint *offset)
1707 proto_tree_add_item(tree, hf_zbee_zcl_tun_tunnel_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1710 proto_tree_add_item(tree, hf_zbee_zcl_tun_transfer_data_status, tvb, *offset, 1, ENC_NA);
1715 *This function manages the Display Message payload
1717 *@param tvb pointer to buffer containing raw packet.
1718 *@param tree pointer to data tree Wireshark uses to display packet.
1719 *@param offset pointer to offset from caller
1722 dissect_zcl_tun_ack_transfer_data(tvbuff_t *tvb, proto_tree *tree, guint *offset)
1724 proto_tree_add_item(tree, hf_zbee_zcl_tun_tunnel_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1727 proto_tree_add_item(tree, hf_zbee_zcl_tun_num_octets_left, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1732 *This function manages the Display Message payload
1734 *@param tvb pointer to buffer containing raw packet.
1735 *@param tree pointer to data tree Wireshark uses to display packet.
1736 *@param offset pointer to offset from caller
1739 dissect_zcl_tun_ready_data(tvbuff_t *tvb, proto_tree *tree, guint *offset)
1741 proto_tree_add_item(tree, hf_zbee_zcl_tun_tunnel_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1744 proto_tree_add_item(tree, hf_zbee_zcl_tun_num_octets_left, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1749 *This function manages the Display Message payload
1751 *@param tvb pointer to buffer containing raw packet.
1752 *@param tree pointer to data tree Wireshark uses to display packet.
1753 *@param offset pointer to offset from caller
1756 dissect_zcl_tun_get_supported(tvbuff_t *tvb, proto_tree *tree, guint *offset)
1758 proto_tree_add_item(tree, hf_zbee_zcl_tun_protocol_offset, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1763 *This function manages the Display Message payload
1765 *@param tvb pointer to buffer containing raw packet.
1766 *@param tree pointer to data tree Wireshark uses to display packet.
1767 *@param offset pointer to offset from caller
1770 dissect_zcl_tun_request_tunnel_rsp(tvbuff_t *tvb, proto_tree *tree, guint *offset)
1772 proto_tree_add_item(tree, hf_zbee_zcl_tun_tunnel_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1775 proto_tree_add_item(tree, hf_zbee_zcl_tun_transfer_status, tvb, *offset, 1, ENC_NA);
1778 proto_tree_add_item(tree, hf_zbee_zcl_tun_max_in_size, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1783 *This function manages the Display Message payload
1785 *@param tvb pointer to buffer containing raw packet.
1786 *@param tree pointer to data tree Wireshark uses to display packet.
1787 *@param offset pointer to offset from caller
1790 dissect_zcl_tun_get_supported_rsp(tvbuff_t *tvb, proto_tree *tree, guint *offset)
1794 proto_tree_add_item(tree, hf_zbee_zcl_tun_protocol_list_complete, tvb, *offset, 1, ENC_NA);
1797 proto_tree_add_item(tree, hf_zbee_zcl_tun_protocol_count, tvb, *offset, 1, ENC_NA);
1800 while (tvb_reported_length_remaining(tvb, *offset) > 0) {
1801 mfg_code = tvb_get_letohs(tvb, *offset);
1802 if (mfg_code == 0xFFFF) {
1803 proto_tree_add_string(tree, hf_zbee_zcl_tun_manufacturer_code, tvb, *offset, 2, "Standard Protocol (Mfg Code 0xFFFF)");
1806 proto_tree_add_item(tree, hf_zbee_zcl_tun_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1810 proto_tree_add_item(tree, hf_zbee_zcl_tun_protocol_id, tvb, *offset, 1, ENC_NA);
1816 *This function manages the Display Message payload
1818 *@param tvb pointer to buffer containing raw packet.
1819 *@param tree pointer to data tree Wireshark uses to display packet.
1820 *@param offset pointer to offset from caller
1823 dissect_zcl_tun_closure_notify(tvbuff_t *tvb, proto_tree *tree, guint *offset)
1825 proto_tree_add_item(tree, hf_zbee_zcl_tun_tunnel_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1830 *ZigBee ZCL Messaging cluster dissector for wireshark.
1832 *@param tvb pointer to buffer containing raw packet.
1833 *@param pinfo pointer to packet information fields
1834 *@param tree pointer to data tree Wireshark uses to display packet.
1837 dissect_zbee_zcl_tun(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
1839 proto_tree *payload_tree;
1840 zbee_zcl_packet *zcl;
1845 /* Reject the packet if data is NULL */
1848 zcl = (zbee_zcl_packet *)data;
1849 cmd_id = zcl->cmd_id;
1851 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
1852 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
1853 /* Append the command name to the info column. */
1854 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
1855 val_to_str_const(cmd_id, zbee_zcl_tun_srv_rx_cmd_names, "Unknown Command"),
1858 /* Add the command ID. */
1859 proto_tree_add_uint(tree, hf_zbee_zcl_tun_srv_rx_cmd_id, tvb, offset, 1, cmd_id);
1861 /* Check is this command has a payload, than add the payload tree */
1862 rem_len = tvb_reported_length_remaining(tvb, ++offset);
1864 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_tun, NULL, "Payload");
1866 /* Call the appropriate command dissector */
1869 case ZBEE_ZCL_CMD_ID_TUN_REQUEST_TUNNEL:
1870 dissect_zcl_tun_request_tunnel(tvb, payload_tree, &offset);
1873 case ZBEE_ZCL_CMD_ID_TUN_CLOSE_TUNNEL:
1874 dissect_zcl_tun_close_tunnel(tvb, payload_tree, &offset);
1877 case ZBEE_ZCL_CMD_ID_TUN_TRANSFER_DATA:
1878 dissect_zcl_tun_transfer_data(tvb, payload_tree, &offset);
1881 case ZBEE_ZCL_CMD_ID_TUN_TRANSFER_DATA_ERROR:
1882 dissect_zcl_tun_transfer_data_error(tvb, payload_tree, &offset);
1885 case ZBEE_ZCL_CMD_ID_TUN_ACK_TRANSFER_DATA:
1886 dissect_zcl_tun_ack_transfer_data(tvb, payload_tree, &offset);
1889 case ZBEE_ZCL_CMD_ID_TUN_READY_DATA:
1890 dissect_zcl_tun_ready_data(tvb, payload_tree, &offset);
1893 case ZBEE_ZCL_CMD_ID_TUN_GET_SUPPORTED_PROTOCOLS:
1894 dissect_zcl_tun_get_supported(tvb, payload_tree, &offset);
1902 else { /* ZBEE_ZCL_FCF_TO_CLIENT */
1903 /* Append the command name to the info column. */
1904 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
1905 val_to_str_const(cmd_id, zbee_zcl_tun_srv_tx_cmd_names, "Unknown Command"),
1908 /* Add the command ID. */
1909 proto_tree_add_uint(tree, hf_zbee_zcl_tun_srv_tx_cmd_id, tvb, offset, 1, cmd_id);
1911 /* Check is this command has a payload, than add the payload tree */
1912 rem_len = tvb_reported_length_remaining(tvb, ++offset);
1914 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_tun, NULL, "Payload");
1916 /* Call the appropriate command dissector */
1919 case ZBEE_ZCL_CMD_ID_TUN_REQUEST_TUNNEL_RSP:
1920 dissect_zcl_tun_request_tunnel_rsp(tvb, payload_tree, &offset);
1923 case ZBEE_ZCL_CMD_ID_TUN_TRANSFER_DATA_TX:
1924 dissect_zcl_tun_transfer_data(tvb, payload_tree, &offset);
1927 case ZBEE_ZCL_CMD_ID_TUN_TRANSFER_DATA_ERROR_TX:
1928 dissect_zcl_tun_transfer_data_error(tvb, payload_tree, &offset);
1931 case ZBEE_ZCL_CMD_ID_TUN_ACK_TRANSFER_DATA_TX:
1932 dissect_zcl_tun_ack_transfer_data(tvb, payload_tree, &offset);
1935 case ZBEE_ZCL_CMD_ID_TUN_READY_DATA_TX:
1936 dissect_zcl_tun_ready_data(tvb, payload_tree, &offset);
1939 case ZBEE_ZCL_CMD_ID_TUN_GET_SUPPORTED_PROTOCOLS_RSP:
1940 dissect_zcl_tun_get_supported_rsp(tvb, payload_tree, &offset);
1943 case ZBEE_ZCL_CMD_ID_TUN_CLOSURE_NOTIFY:
1944 dissect_zcl_tun_closure_notify(tvb, payload_tree, &offset);
1953 return tvb_captured_length(tvb);
1954 } /*dissect_zbee_zcl_tun*/
1957 *This function registers the ZCL Messaging dissector
1961 proto_register_zbee_zcl_tun(void)
1963 static hf_register_info hf[] = {
1965 { &hf_zbee_zcl_tun_attr_id,
1966 { "Attribute", "zbee_zcl_se.tun.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_tun_attr_names),
1967 0x0, NULL, HFILL } },
1969 { &hf_zbee_zcl_tun_attr_reporting_status, /* common to all SE clusters */
1970 { "Attribute Reporting Status", "zbee_zcl_se.tun.attr.attr_reporting_status",
1971 FT_UINT8, BASE_HEX, VALS(zbee_zcl_se_reporting_status_names), 0x00, NULL, HFILL } },
1973 { &hf_zbee_zcl_tun_attr_close_timeout,
1974 { "Close Tunnel Timeout", "zbee_zcl_se.tun.attr.close_tunnel", FT_UINT16, BASE_DEC, NULL,
1975 0x0, NULL, HFILL } },
1977 { &hf_zbee_zcl_tun_srv_tx_cmd_id,
1978 { "Command", "zbee_zcl_se.tun.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_tun_srv_tx_cmd_names),
1979 0x00, NULL, HFILL } },
1981 { &hf_zbee_zcl_tun_srv_rx_cmd_id,
1982 { "Command", "zbee_zcl_se.tun.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_tun_srv_rx_cmd_names),
1983 0x00, NULL, HFILL } },
1985 { &hf_zbee_zcl_tun_protocol_id,
1986 { "Protocol ID", "zbee_zcl_se.tun.protocol_id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_tun_protocol_names),
1987 0x00, NULL, HFILL } },
1989 { &hf_zbee_zcl_tun_manufacturer_code,
1990 { "Manufacturer Code", "zbee_zcl_se.tun.manufacturer_code", FT_UINT16, BASE_HEX, VALS(zbee_mfr_code_names),
1991 0x00, NULL, HFILL } },
1993 { &hf_zbee_zcl_tun_flow_control_support,
1994 { "Flow Control Supported", "zbee_zcl_se.tun.flow_control_supported", FT_BOOLEAN, 8, TFS(&tfs_true_false),
1995 0x00, NULL, HFILL } },
1997 { &hf_zbee_zcl_tun_max_in_size,
1998 { "Max Incoming Transfer Size", "zbee_zcl_se.tun.max_in_transfer_size", FT_UINT16, BASE_HEX, NULL,
1999 0x00, NULL, HFILL } },
2001 { &hf_zbee_zcl_tun_tunnel_id,
2002 { "Tunnel Id", "zbee_zcl_se.tun.tunnel_id", FT_UINT16, BASE_HEX, NULL,
2003 0x00, NULL, HFILL } },
2005 { &hf_zbee_zcl_tun_num_octets_left,
2006 { "Num Octets Left", "zbee_zcl_se.tun.octets_left", FT_UINT16, BASE_HEX, NULL,
2007 0x00, NULL, HFILL } },
2009 { &hf_zbee_zcl_tun_protocol_offset,
2010 { "Protocol Offset", "zbee_zcl_se.tun.protocol_offset", FT_UINT8, BASE_HEX, NULL,
2011 0x00, NULL, HFILL } },
2013 { &hf_zbee_zcl_tun_transfer_status,
2014 { "Transfer Status", "zbee_zcl_se.tun.transfer_status", FT_UINT8, BASE_HEX, VALS(zbee_zcl_tun_status_names),
2015 0x00, NULL, HFILL } },
2017 { &hf_zbee_zcl_tun_transfer_data,
2018 { "Transfer Data", "zbee_zcl_se.tun.transfer_data", FT_BYTES, BASE_NONE, NULL,
2021 { &hf_zbee_zcl_tun_transfer_data_status,
2022 { "Transfer Data Status", "zbee_zcl_se.tun.transfer_data_status", FT_UINT8, BASE_HEX, VALS(zbee_zcl_tun_trans_data_status_names),
2023 0x00, NULL, HFILL } },
2025 { &hf_zbee_zcl_tun_protocol_count,
2026 { "Protocol Count", "zbee_zcl_se.tun.protocol_count", FT_UINT8, BASE_HEX, NULL,
2027 0x00, NULL, HFILL } },
2029 { &hf_zbee_zcl_tun_protocol_list_complete,
2030 { "List Complete", "zbee_zcl_se.tun.protocol_list_complete", FT_BOOLEAN, 8, TFS(&tfs_true_false),
2031 0x00, NULL, HFILL } },
2035 /* ZCL Messaging subtrees */
2040 /* Register the ZigBee ZCL Messaging cluster protocol name and description */
2041 proto_zbee_zcl_tun = proto_register_protocol("ZigBee ZCL Tunneling", "ZCL Tunneling", ZBEE_PROTOABBREV_ZCL_TUN);
2042 proto_register_field_array(proto_zbee_zcl_tun, hf, array_length(hf));
2043 proto_register_subtree_array(ett, array_length(ett));
2045 /* Register the ZigBee ZCL Messaging dissector. */
2046 tun_handle = register_dissector(ZBEE_PROTOABBREV_ZCL_TUN, dissect_zbee_zcl_tun, proto_zbee_zcl_tun);
2048 } /* proto_register_zbee_zcl_tun */
2051 *Hands off the Zcl Messaging dissector.
2055 proto_reg_handoff_zbee_zcl_tun(void)
2057 ipv4_handle = find_dissector("ipv4");
2058 ipv6_handle = find_dissector("ipv6");
2060 /* Register our dissector with the ZigBee application dissectors. */
2061 dissector_add_uint("zbee.zcl.cluster", ZBEE_ZCL_CID_TUNNELING, tun_handle);
2063 zbee_zcl_init_cluster( proto_zbee_zcl_tun,
2065 ZBEE_ZCL_CID_TUNNELING,
2066 hf_zbee_zcl_tun_attr_id,
2067 hf_zbee_zcl_tun_srv_rx_cmd_id,
2068 hf_zbee_zcl_tun_srv_tx_cmd_id,
2069 (zbee_zcl_fn_attr_data)dissect_zcl_tun_attr_data
2071 } /* proto_reg_handoff_zbee_zcl_tun */
2074 /* ########################################################################## */
2075 /* #### (0x0705) PREPAYMENT CLUSTER ########################################## */
2076 /* ########################################################################## */
2079 #define zbee_zcl_pp_attr_names_VALUE_STRING_LIST(XXX) \
2080 /* Prepayment Information Set */ \
2081 XXX(ZBEE_ZCL_ATTR_ID_PP_PAYMENT_CONTROL_CONFIGURATION, 0x0000, "Payment Control Configuration" ) \
2082 XXX(ZBEE_ZCL_ATTR_ID_PP_CREDIT_REMAINING, 0x0001, "Credit Remaining" ) \
2083 XXX(ZBEE_ZCL_ATTR_ID_PP_EMERGENCY_CREDIT_REMAINING, 0x0002, "Emergency Credit Remaining" ) \
2084 XXX(ZBEE_ZCL_ATTR_ID_PP_ACCUMULATED_DEBT, 0x0005, "Accumulated Debt" ) \
2085 XXX(ZBEE_ZCL_ATTR_ID_PP_OVERALL_DEBT_CAP, 0x0006, "Overall Debt Cap" ) \
2086 XXX(ZBEE_ZCL_ATTR_ID_PP_EMERGENCY_CREDIT_LIMIT, 0x0010, "Emergency Credit Limit / Allowance" ) \
2087 XXX(ZBEE_ZCL_ATTR_ID_PP_EMERGENCY_CREDIT_THRESHOLD, 0x0011, "Emergency Credit Threshold" ) \
2088 XXX(ZBEE_ZCL_ATTR_ID_PP_MAX_CREDIT_LIMIT, 0x0021, "Max Credit Limit" ) \
2089 XXX(ZBEE_ZCL_ATTR_ID_PP_MAX_CREDIT_PER_TOPUP, 0x0022, "Max Credit Per Top Up" ) \
2090 XXX(ZBEE_ZCL_ATTR_ID_PP_LOW_CREDIT_WARNING, 0x0031, "Low Credit Warning" ) \
2091 XXX(ZBEE_ZCL_ATTR_ID_PP_CUT_OFF_VALUE, 0x0040, "Cut Off Value" ) \
2093 XXX(ZBEE_ZCL_ATTR_ID_PP_DEBT_AMOUNT_1, 0x0211, "Debt Amount 1" ) \
2094 XXX(ZBEE_ZCL_ATTR_ID_PP_DEBT_RECOVERY_FREQ_1, 0x0216, "Debt Recovery Frequency 1" ) \
2095 XXX(ZBEE_ZCL_ATTR_ID_PP_DEBT_RECOVERY_AMOUNT_1, 0x0217, "Debt Recovery Amount 1" ) \
2096 XXX(ZBEE_ZCL_ATTR_ID_PP_DEBT_RECOVERY_TOP_UP_PERCENTAGE_1, 0x0219, "Debt Recovery Top Up Percentage 1" ) \
2097 XXX(ZBEE_ZCL_ATTR_ID_PP_DEBT_AMOUNT_2, 0x0221, "Debt Amount 2" ) \
2098 XXX(ZBEE_ZCL_ATTR_ID_PP_DEBT_RECOVERY_FREQ_2, 0x0226, "Debt Recovery Frequency 2" ) \
2099 XXX(ZBEE_ZCL_ATTR_ID_PP_DEBT_RECOVERY_AMOUNT_2, 0x0227, "Debt Recovery Amount 2" ) \
2100 XXX(ZBEE_ZCL_ATTR_ID_PP_DEBT_RECOVERY_TOP_UP_PERCENTAGE_2, 0x0229, "Debt Recovery Top Up Percentage 2" ) \
2101 XXX(ZBEE_ZCL_ATTR_ID_PP_DEBT_AMOUNT_3, 0x0231, "Debt Amount 3" ) \
2102 XXX(ZBEE_ZCL_ATTR_ID_PP_DEBT_RECOVERY_FREQ_3, 0x0236, "Debt Recovery Frequency 3" ) \
2103 XXX(ZBEE_ZCL_ATTR_ID_PP_DEBT_RECOVERY_AMOUNT_3, 0x0237, "Debt Recovery Amount 3" ) \
2104 XXX(ZBEE_ZCL_ATTR_ID_PP_DEBT_RECOVERY_TOP_UP_PERCENTAGE_3, 0x0239, "Debt Recovery Top Up Percentage 3" ) \
2106 XXX(ZBEE_ZCL_ATTR_ID_PP_PREPAYMENT_ALARM_STATUS, 0x0400, "Prepayment Alarm Status" ) \
2107 /* Historical Cost Consumption Information Set */ \
2108 XXX(ZBEE_ZCL_ATTR_ID_PP_HISTORICAL_COST_CON_FORMAT, 0x0500, "Historical Cost Consumption Formatting" ) \
2109 XXX(ZBEE_ZCL_ATTR_ID_PP_CONSUMPTION_UNIT_OF_MEASUREMENT, 0x0501, "Consumption Unit of Measurement" ) \
2110 XXX(ZBEE_ZCL_ATTR_ID_PP_CURRENCY_SCALING_FACTOR, 0x0502, "Currency Scaling Factor" ) \
2111 XXX(ZBEE_ZCL_ATTR_ID_PP_CURRENCY, 0x0503, "Currency" ) \
2112 XXX(ZBEE_ZCL_ATTR_ID_PP_CURRENT_DAY_COST_CON_DELIVERED, 0x051C, "Current Day Cost Consumption Delivered" ) \
2113 XXX(ZBEE_ZCL_ATTR_ID_PP_PREVIOUS_DAY_COST_CON_DELIVERED, 0x051E, "Previous Day Cost Consumption Delivered" ) \
2114 XXX(ZBEE_ZCL_ATTR_ID_PP_PREVIOUS_DAY_2_COST_CON_DELIVERED, 0x0520, "Previous Day 2 Cost Consumption Delivered" ) \
2115 XXX(ZBEE_ZCL_ATTR_ID_PP_PREVIOUS_DAY_3_COST_CON_DELIVERED, 0x0522, "Previous Day 3 Cost Consumption Delivered" ) \
2116 XXX(ZBEE_ZCL_ATTR_ID_PP_PREVIOUS_DAY_4_COST_CON_DELIVERED, 0x0524, "Previous Day 4 Cost Consumption Delivered" ) \
2117 XXX(ZBEE_ZCL_ATTR_ID_PP_PREVIOUS_DAY_5_COST_CON_DELIVERED, 0x0526, "Previous Day 5 Cost Consumption Delivered" ) \
2118 XXX(ZBEE_ZCL_ATTR_ID_PP_PREVIOUS_DAY_6_COST_CON_DELIVERED, 0x0528, "Previous Day 6 Cost Consumption Delivered" ) \
2119 XXX(ZBEE_ZCL_ATTR_ID_PP_PREVIOUS_DAY_7_COST_CON_DELIVERED, 0x052A, "Previous Day 7 Cost Consumption Delivered" ) \
2120 XXX(ZBEE_ZCL_ATTR_ID_PP_PREVIOUS_DAY_8_COST_CON_DELIVERED, 0x052C, "Previous Day 8 Cost Consumption Delivered" ) \
2121 XXX(ZBEE_ZCL_ATTR_ID_PP_CURRENT_WEEK_COST_CON_DELIVERED, 0x0530, "Current Week Cost Consumption Delivered" ) \
2122 XXX(ZBEE_ZCL_ATTR_ID_PP_PREVIOUS_WEEK_COST_CON_DELIVERED, 0x0532, "Previous Week Cost Consumption Delivered" ) \
2123 XXX(ZBEE_ZCL_ATTR_ID_PP_PREVIOUS_WEEK_2_COST_CON_DELIVERED, 0x0534, "Previous Week 2 Cost Consumption Delivered" ) \
2124 XXX(ZBEE_ZCL_ATTR_ID_PP_PREVIOUS_WEEK_3_COST_CON_DELIVERED, 0x0536, "Previous Week 3 Cost Consumption Delivered" ) \
2125 XXX(ZBEE_ZCL_ATTR_ID_PP_PREVIOUS_WEEK_4_COST_CON_DELIVERED, 0x0538, "Previous Week 4 Cost Consumption Delivered" ) \
2126 XXX(ZBEE_ZCL_ATTR_ID_PP_PREVIOUS_WEEK_5_COST_CON_DELIVERED, 0x053A, "Previous Week 5 Cost Consumption Delivered" ) \
2127 XXX(ZBEE_ZCL_ATTR_ID_PP_CURRENT_MON_COST_CON_DELIVERED, 0x0540, "Current Month Cost Consumption Delivered" ) \
2128 XXX(ZBEE_ZCL_ATTR_ID_PP_PREVIOUS_MON_COST_CON_DELIVERED, 0x0542, "Previous Month Cost Consumption Delivered" ) \
2129 XXX(ZBEE_ZCL_ATTR_ID_PP_PREVIOUS_MON_2_COST_CON_DELIVERED, 0x0544, "Previous Month 2 Cost Consumption Delivered" ) \
2130 XXX(ZBEE_ZCL_ATTR_ID_PP_PREVIOUS_MON_3_COST_CON_DELIVERED, 0x0546, "Previous Month 3 Cost Consumption Delivered" ) \
2131 XXX(ZBEE_ZCL_ATTR_ID_PP_PREVIOUS_MON_4_COST_CON_DELIVERED, 0x0548, "Previous Month 4 Cost Consumption Delivered" ) \
2132 XXX(ZBEE_ZCL_ATTR_ID_PP_PREVIOUS_MON_5_COST_CON_DELIVERED, 0x054A, "Previous Month 5 Cost Consumption Delivered" ) \
2133 XXX(ZBEE_ZCL_ATTR_ID_PP_PREVIOUS_MON_6_COST_CON_DELIVERED, 0x054C, "Previous Month 6 Cost Consumption Delivered" ) \
2134 XXX(ZBEE_ZCL_ATTR_ID_PP_PREVIOUS_MON_7_COST_CON_DELIVERED, 0x054E, "Previous Month 7 Cost Consumption Delivered" ) \
2135 XXX(ZBEE_ZCL_ATTR_ID_PP_PREVIOUS_MON_8_COST_CON_DELIVERED, 0x0550, "Previous Month 8 Cost Consumption Delivered" ) \
2136 XXX(ZBEE_ZCL_ATTR_ID_PP_PREVIOUS_MON_9_COST_CON_DELIVERED, 0x0552, "Previous Month 9 Cost Consumption Delivered" ) \
2137 XXX(ZBEE_ZCL_ATTR_ID_PP_PREVIOUS_MON_10_COST_CON_DELIVERED, 0x0554, "Previous Month 10 Cost Consumption Delivered" ) \
2138 XXX(ZBEE_ZCL_ATTR_ID_PP_PREVIOUS_MON_11_COST_CON_DELIVERED, 0x0556, "Previous Month 11 Cost Consumption Delivered" ) \
2139 XXX(ZBEE_ZCL_ATTR_ID_PP_PREVIOUS_MON_12_COST_CON_DELIVERED, 0x0558, "Previous Month 12 Cost Consumption Delivered" ) \
2140 XXX(ZBEE_ZCL_ATTR_ID_PP_PREVIOUS_MON_13_COST_CON_DELIVERED, 0x055A, "Previous Month 13 Cost Consumption Delivered" ) \
2141 XXX(ZBEE_ZCL_ATTR_ID_PP_HISTORICAL_FREEZE_TIME, 0x055C, "Historical Freeze Time" ) \
2142 /* Smart Energy */ \
2143 XXX(ZBEE_ZCL_ATTR_ID_SE_ATTR_REPORT_STATUS_PP, 0xFFFE, "Attribute Reporting Status" )
2145 VALUE_STRING_ENUM(zbee_zcl_pp_attr_names);
2146 VALUE_STRING_ARRAY(zbee_zcl_pp_attr_names);
2147 static value_string_ext zbee_zcl_pp_attr_names_ext = VALUE_STRING_EXT_INIT(zbee_zcl_pp_attr_names);
2149 /* Server Commands Received */
2150 #define zbee_zcl_pp_srv_rx_cmd_names_VALUE_STRING_LIST(XXX) \
2151 XXX(ZBEE_ZCL_CMD_ID_PP_SELECT_AVAILABLE_EMERGENCY_CREDIT, 0x00, "Select Available Emergency Credit" ) \
2152 XXX(ZBEE_ZCL_CMD_ID_PP_CONSUMER_TOP_UP, 0x04, "Consumer Top Up" ) \
2153 XXX(ZBEE_ZCL_CMD_ID_PP_GET_PREPAY_SNAPTSHOT, 0x07, "Get Prepay Snapshot" ) \
2154 XXX(ZBEE_ZCL_CMD_ID_PP_GET_TOP_UP_LOG, 0x08, "Get Top Up Log" ) \
2155 XXX(ZBEE_ZCL_CMD_ID_PP_GET_DEBT_REPAYMENT_LOG, 0x0A, "Get Debt Repayment Log" )
2157 VALUE_STRING_ENUM(zbee_zcl_pp_srv_rx_cmd_names);
2158 VALUE_STRING_ARRAY(zbee_zcl_pp_srv_rx_cmd_names);
2160 /* Server Commands Generated */
2161 #define zbee_zcl_pp_srv_tx_cmd_names_VALUE_STRING_LIST(XXX) \
2162 XXX(ZBEE_ZCL_CMD_ID_PP_PUBLISH_PREPAY_SNAPSHOT, 0x01, "Publish Prepay Snapshot" ) \
2163 XXX(ZBEE_ZCL_CMD_ID_PP_CONSUMER_TOP_UP_RESPONSE, 0x03, "Consumer Top Up Response" ) \
2164 XXX(ZBEE_ZCL_CMD_ID_PP_PUBLISH_TOP_UP_LOG, 0x05, "Publish Top Up Log" ) \
2165 XXX(ZBEE_ZCL_CMD_ID_PP_PUBLISH_DEBT_LOG, 0x06, "Publish Debt Log" )
2167 VALUE_STRING_ENUM(zbee_zcl_pp_srv_tx_cmd_names);
2168 VALUE_STRING_ARRAY(zbee_zcl_pp_srv_tx_cmd_names);
2170 /*************************/
2171 /* Function Declarations */
2172 /*************************/
2173 void proto_register_zbee_zcl_pp(void);
2174 void proto_reg_handoff_zbee_zcl_pp(void);
2176 /* Attribute Dissector Helpers */
2177 static void dissect_zcl_pp_attr_data (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type);
2179 /*************************/
2180 /* Global Variables */
2181 /*************************/
2183 static dissector_handle_t pp_handle;
2185 /* Initialize the protocol and registered fields */
2186 static int proto_zbee_zcl_pp = -1;
2188 static int hf_zbee_zcl_pp_srv_tx_cmd_id = -1;
2189 static int hf_zbee_zcl_pp_srv_rx_cmd_id = -1;
2190 static int hf_zbee_zcl_pp_attr_id = -1;
2191 static int hf_zbee_zcl_pp_attr_reporting_status = -1;
2193 /* Initialize the subtree pointers */
2194 static gint ett_zbee_zcl_pp = -1;
2196 /*************************/
2197 /* Function Bodies */
2198 /*************************/
2201 *This function is called by ZCL foundation dissector in order to decode
2203 *@param tree pointer to data tree Wireshark uses to display packet.
2204 *@param tvb pointer to buffer containing raw packet.
2205 *@param offset pointer to buffer offset
2206 *@param attr_id attribute identifier
2207 *@param data_type attribute data type
2210 dissect_zcl_pp_attr_data(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type)
2213 /* applies to all SE clusters */
2214 case ZBEE_ZCL_ATTR_ID_SE_ATTR_REPORT_STATUS_PP:
2215 proto_tree_add_item(tree, hf_zbee_zcl_pp_attr_reporting_status, tvb, *offset, 1, ENC_NA);
2219 default: /* Catch all */
2220 dissect_zcl_attr_data(tvb, tree, offset, data_type);
2223 } /*dissect_zcl_pp_attr_data*/
2226 *ZigBee ZCL Prepayment cluster dissector for wireshark.
2228 *@param tvb pointer to buffer containing raw packet.
2229 *@param pinfo pointer to packet information fields
2230 *@param tree pointer to data tree Wireshark uses to display packet.
2233 dissect_zbee_zcl_pp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
2235 zbee_zcl_packet *zcl;
2240 /* Reject the packet if data is NULL */
2243 zcl = (zbee_zcl_packet *)data;
2244 cmd_id = zcl->cmd_id;
2246 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
2247 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
2248 /* Append the command name to the info column. */
2249 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
2250 val_to_str_const(cmd_id, zbee_zcl_pp_srv_rx_cmd_names, "Unknown Command"),
2253 /* Add the command ID. */
2254 proto_tree_add_uint(tree, hf_zbee_zcl_pp_srv_rx_cmd_id, tvb, offset, 1, cmd_id);
2256 /* Check is this command has a payload, than add the payload tree */
2257 rem_len = tvb_reported_length_remaining(tvb, ++offset);
2259 proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_pp, NULL, "Payload");
2261 /* Call the appropriate command dissector */
2264 case ZBEE_ZCL_CMD_ID_PP_SELECT_AVAILABLE_EMERGENCY_CREDIT:
2265 /* Add function to dissect payload */
2268 case ZBEE_ZCL_CMD_ID_PP_CONSUMER_TOP_UP:
2269 /* Add function to dissect payload */
2272 case ZBEE_ZCL_CMD_ID_PP_GET_PREPAY_SNAPTSHOT:
2273 /* Add function to dissect payload */
2276 case ZBEE_ZCL_CMD_ID_PP_GET_TOP_UP_LOG:
2277 /* Add function to dissect payload */
2280 case ZBEE_ZCL_CMD_ID_PP_GET_DEBT_REPAYMENT_LOG:
2281 /* Add function to dissect payload */
2289 else { /* ZBEE_ZCL_FCF_TO_CLIENT */
2290 /* Append the command name to the info column. */
2291 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
2292 val_to_str_const(cmd_id, zbee_zcl_pp_srv_tx_cmd_names, "Unknown Command"),
2295 /* Add the command ID. */
2296 proto_tree_add_uint(tree, hf_zbee_zcl_pp_srv_tx_cmd_id, tvb, offset, 1, cmd_id);
2298 /* Check is this command has a payload, than add the payload tree */
2299 rem_len = tvb_reported_length_remaining(tvb, ++offset);
2301 proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_pp, NULL, "Payload");
2303 /* Call the appropriate command dissector */
2306 case ZBEE_ZCL_CMD_ID_PP_PUBLISH_PREPAY_SNAPSHOT:
2307 /* Add function to dissect payload */
2310 case ZBEE_ZCL_CMD_ID_PP_CONSUMER_TOP_UP_RESPONSE:
2311 /* Add function to dissect payload */
2314 case ZBEE_ZCL_CMD_ID_PP_PUBLISH_TOP_UP_LOG:
2315 /* Add function to dissect payload */
2318 case ZBEE_ZCL_CMD_ID_PP_PUBLISH_DEBT_LOG:
2319 /* Add function to dissect payload */
2328 return tvb_captured_length(tvb);
2329 } /*dissect_zbee_zcl_pp*/
2332 *This function registers the ZCL Prepayment dissector
2336 proto_register_zbee_zcl_pp(void)
2338 static hf_register_info hf[] = {
2340 { &hf_zbee_zcl_pp_attr_id,
2341 { "Attribute", "zbee_zcl_se.pp.attr_id", FT_UINT16, BASE_HEX | BASE_EXT_STRING, &zbee_zcl_pp_attr_names_ext,
2342 0x0, NULL, HFILL } },
2344 { &hf_zbee_zcl_pp_attr_reporting_status, /* common to all SE clusters */
2345 { "Attribute Reporting Status", "zbee_zcl_se.pp.attr.attr_reporting_status",
2346 FT_UINT8, BASE_HEX, VALS(zbee_zcl_se_reporting_status_names), 0x00, NULL, HFILL } },
2348 { &hf_zbee_zcl_pp_srv_tx_cmd_id,
2349 { "Command", "zbee_zcl_se.pp.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_pp_srv_tx_cmd_names),
2350 0x00, NULL, HFILL } },
2352 { &hf_zbee_zcl_pp_srv_rx_cmd_id,
2353 { "Command", "zbee_zcl_se.pp.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_pp_srv_rx_cmd_names),
2354 0x00, NULL, HFILL } },
2358 /* ZCL Prepayment subtrees */
2363 /* Register the ZigBee ZCL Prepayment cluster protocol name and description */
2364 proto_zbee_zcl_pp = proto_register_protocol("ZigBee ZCL Prepayment", "ZCL Prepayment", ZBEE_PROTOABBREV_ZCL_PRE_PAYMENT);
2365 proto_register_field_array(proto_zbee_zcl_pp, hf, array_length(hf));
2366 proto_register_subtree_array(ett, array_length(ett));
2368 /* Register the ZigBee ZCL Prepayment dissector. */
2369 pp_handle = register_dissector(ZBEE_PROTOABBREV_ZCL_PRE_PAYMENT, dissect_zbee_zcl_pp, proto_zbee_zcl_pp);
2370 } /*proto_register_zbee_zcl_pp*/
2373 *Hands off the Zcl Prepayment dissector.
2377 proto_reg_handoff_zbee_zcl_pp(void)
2379 /* Register our dissector with the ZigBee application dissectors. */
2380 dissector_add_uint("zbee.zcl.cluster", ZBEE_ZCL_CID_PRE_PAYMENT, pp_handle);
2382 zbee_zcl_init_cluster( proto_zbee_zcl_pp,
2384 ZBEE_ZCL_CID_PRE_PAYMENT,
2385 hf_zbee_zcl_pp_attr_id,
2386 hf_zbee_zcl_pp_srv_rx_cmd_id,
2387 hf_zbee_zcl_pp_srv_tx_cmd_id,
2388 (zbee_zcl_fn_attr_data)dissect_zcl_pp_attr_data
2390 } /*proto_reg_handoff_zbee_zcl_pp*/
2392 /* ########################################################################## */
2393 /* #### (0x0709) EVENTS CLUSTER ############################################# */
2394 /* ########################################################################## */
2397 #define zbee_zcl_events_attr_names_VALUE_STRING_LIST(XXX) \
2398 /* Smart Energy */ \
2399 XXX(ZBEE_ZCL_ATTR_ID_SE_ATTR_REPORT_STATUS_EVENTS, 0xFFFE, "Attribute Reporting Status" )
2401 VALUE_STRING_ENUM(zbee_zcl_events_attr_names);
2402 VALUE_STRING_ARRAY(zbee_zcl_events_attr_names);
2404 /* Server Commands Received */
2405 #define zbee_zcl_events_srv_rx_cmd_names_VALUE_STRING_LIST(XXX) \
2406 XXX(ZBEE_ZCL_CMD_ID_EVENTS_GET_EVENT_LOG, 0x00, "Get Event Log" ) \
2407 XXX(ZBEE_ZCL_CMD_ID_EVENTS_CLEAR_EVENT_LOG_REQUEST, 0x01, "Clear Event Log Request" )
2409 VALUE_STRING_ENUM(zbee_zcl_events_srv_rx_cmd_names);
2410 VALUE_STRING_ARRAY(zbee_zcl_events_srv_rx_cmd_names);
2412 /* Server Commands Generated */
2413 #define zbee_zcl_events_srv_tx_cmd_names_VALUE_STRING_LIST(XXX) \
2414 XXX(ZBEE_ZCL_CMD_ID_EVENTS_PUBLISH_EVENT, 0x00, "Publish Event" ) \
2415 XXX(ZBEE_ZCL_CMD_ID_EVENTS_PUBLISH_EVENT_LOG, 0x01, "Publish Event Log" ) \
2416 XXX(ZBEE_ZCL_CMD_ID_EVENTS_CLEAR_EVENT_LOG_RESPONSE, 0x02, "Clear Event Log Response" )
2418 VALUE_STRING_ENUM(zbee_zcl_events_srv_tx_cmd_names);
2419 VALUE_STRING_ARRAY(zbee_zcl_events_srv_tx_cmd_names);
2421 /*************************/
2422 /* Function Declarations */
2423 /*************************/
2424 void proto_register_zbee_zcl_events(void);
2425 void proto_reg_handoff_zbee_zcl_events(void);
2427 /* Attribute Dissector Helpers */
2428 static void dissect_zcl_events_attr_data (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type);
2430 /*************************/
2431 /* Global Variables */
2432 /*************************/
2434 static dissector_handle_t events_handle;
2436 /* Initialize the protocol and registered fields */
2437 static int proto_zbee_zcl_events = -1;
2439 static int hf_zbee_zcl_events_srv_tx_cmd_id = -1;
2440 static int hf_zbee_zcl_events_srv_rx_cmd_id = -1;
2441 static int hf_zbee_zcl_events_attr_id = -1;
2442 static int hf_zbee_zcl_events_attr_reporting_status = -1;
2444 /* Initialize the subtree pointers */
2445 static gint ett_zbee_zcl_events = -1;
2447 /*************************/
2448 /* Function Bodies */
2449 /*************************/
2452 *This function is called by ZCL foundation dissector in order to decode
2454 *@param tree pointer to data tree Wireshark uses to display packet.
2455 *@param tvb pointer to buffer containing raw packet.
2456 *@param offset pointer to buffer offset
2457 *@param attr_id attribute identifier
2458 *@param data_type attribute data type
2461 dissect_zcl_events_attr_data(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type)
2464 /* applies to all SE clusters */
2465 case ZBEE_ZCL_ATTR_ID_SE_ATTR_REPORT_STATUS_EVENTS:
2466 proto_tree_add_item(tree, hf_zbee_zcl_events_attr_reporting_status, tvb, *offset, 1, ENC_NA);
2470 default: /* Catch all */
2471 dissect_zcl_attr_data(tvb, tree, offset, data_type);
2474 } /*dissect_zcl_events_attr_data*/
2477 *ZigBee ZCL Events cluster dissector for wireshark.
2479 *@param tvb pointer to buffer containing raw packet.
2480 *@param pinfo pointer to packet information fields
2481 *@param tree pointer to data tree Wireshark uses to display packet.
2484 dissect_zbee_zcl_events(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
2486 zbee_zcl_packet *zcl;
2491 /* Reject the packet if data is NULL */
2494 zcl = (zbee_zcl_packet *)data;
2495 cmd_id = zcl->cmd_id;
2497 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
2498 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
2499 /* Append the command name to the info column. */
2500 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
2501 val_to_str_const(cmd_id, zbee_zcl_events_srv_rx_cmd_names, "Unknown Command"),
2504 /* Add the command ID. */
2505 proto_tree_add_uint(tree, hf_zbee_zcl_events_srv_rx_cmd_id, tvb, offset, 1, cmd_id);
2507 /* Check is this command has a payload, than add the payload tree */
2508 rem_len = tvb_reported_length_remaining(tvb, ++offset);
2510 proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_events, NULL, "Payload");
2512 /* Call the appropriate command dissector */
2515 case ZBEE_ZCL_CMD_ID_EVENTS_GET_EVENT_LOG:
2516 /* Add function to dissect payload */
2519 case ZBEE_ZCL_CMD_ID_EVENTS_CLEAR_EVENT_LOG_REQUEST:
2520 /* Add function to dissect payload */
2528 else { /* ZBEE_ZCL_FCF_TO_CLIENT */
2529 /* Append the command name to the info column. */
2530 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
2531 val_to_str_const(cmd_id, zbee_zcl_events_srv_tx_cmd_names, "Unknown Command"),
2534 /* Add the command ID. */
2535 proto_tree_add_uint(tree, hf_zbee_zcl_events_srv_tx_cmd_id, tvb, offset, 1, cmd_id);
2537 /* Check is this command has a payload, than add the payload tree */
2538 rem_len = tvb_reported_length_remaining(tvb, ++offset);
2540 proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_events, NULL, "Payload");
2542 /* Call the appropriate command dissector */
2545 case ZBEE_ZCL_CMD_ID_EVENTS_PUBLISH_EVENT:
2546 /* Add function to dissect payload */
2549 case ZBEE_ZCL_CMD_ID_EVENTS_PUBLISH_EVENT_LOG:
2550 /* Add function to dissect payload */
2553 case ZBEE_ZCL_CMD_ID_EVENTS_CLEAR_EVENT_LOG_RESPONSE:
2554 /* Add function to dissect payload */
2563 return tvb_captured_length(tvb);
2564 } /*dissect_zbee_zcl_events*/
2567 *This function registers the ZCL Events dissector
2571 proto_register_zbee_zcl_events(void)
2573 static hf_register_info hf[] = {
2575 { &hf_zbee_zcl_events_attr_id,
2576 { "Attribute", "zbee_zcl_se.events.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_events_attr_names),
2577 0x0, NULL, HFILL } },
2579 { &hf_zbee_zcl_events_attr_reporting_status, /* common to all SE clusters */
2580 { "Attribute Reporting Status", "zbee_zcl_se.events.attr.attr_reporting_status",
2581 FT_UINT8, BASE_HEX, VALS(zbee_zcl_se_reporting_status_names), 0x00, NULL, HFILL } },
2583 { &hf_zbee_zcl_events_srv_tx_cmd_id,
2584 { "Command", "zbee_zcl_se.events.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_events_srv_tx_cmd_names),
2585 0x00, NULL, HFILL } },
2587 { &hf_zbee_zcl_events_srv_rx_cmd_id,
2588 { "Command", "zbee_zcl_se.events.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_events_srv_rx_cmd_names),
2589 0x00, NULL, HFILL } },
2593 /* ZCL Events subtrees */
2595 &ett_zbee_zcl_events,
2598 /* Register the ZigBee ZCL Events cluster protocol name and description */
2599 proto_zbee_zcl_events = proto_register_protocol("ZigBee ZCL Events", "ZCL Events", ZBEE_PROTOABBREV_ZCL_EVENTS);
2600 proto_register_field_array(proto_zbee_zcl_events, hf, array_length(hf));
2601 proto_register_subtree_array(ett, array_length(ett));
2603 /* Register the ZigBee ZCL Events dissector. */
2604 events_handle = register_dissector(ZBEE_PROTOABBREV_ZCL_EVENTS, dissect_zbee_zcl_events, proto_zbee_zcl_events);
2605 } /*proto_register_zbee_zcl_events*/
2608 *Hands off the Zcl Events dissector.
2612 proto_reg_handoff_zbee_zcl_events(void)
2614 /* Register our dissector with the ZigBee application dissectors. */
2615 dissector_add_uint("zbee.zcl.cluster", ZBEE_ZCL_CID_EVENTS, events_handle);
2617 zbee_zcl_init_cluster( proto_zbee_zcl_events,
2618 ett_zbee_zcl_events,
2619 ZBEE_ZCL_CID_EVENTS,
2620 hf_zbee_zcl_events_attr_id,
2621 hf_zbee_zcl_events_srv_rx_cmd_id,
2622 hf_zbee_zcl_events_srv_tx_cmd_id,
2623 (zbee_zcl_fn_attr_data)dissect_zcl_events_attr_data
2625 } /*proto_reg_handoff_zbee_zcl_events*/
2627 /* ########################################################################## */
2628 /* #### (0x0800) KEY ESTABLISHMENT ########################################## */
2629 /* ########################################################################## */
2631 /*************************/
2633 /*************************/
2635 #define ZBEE_ZCL_KE_USAGE_KEY_AGREEMENT 0x08
2636 #define ZBEE_ZCL_KE_USAGE_DIGITAL_SIGNATURE 0x80
2639 #define zbee_zcl_ke_attr_names_VALUE_STRING_LIST(XXX) \
2640 XXX(ZBEE_ZCL_ATTR_ID_KE_SUITE, 0x0000, "Supported Key Establishment Suites" )
2642 VALUE_STRING_ARRAY(zbee_zcl_ke_attr_names);
2644 /* Server Commands Received and Generated */
2645 #define zbee_zcl_ke_srv_cmd_names_VALUE_STRING_LIST(XXX) \
2646 XXX(ZBEE_ZCL_CMD_ID_KE_INITIATE, 0x00, "Initiate Key Establishment" ) \
2647 XXX(ZBEE_ZCL_CMD_ID_KE_EPHEMERAL, 0x01, "Ephemeral Data" ) \
2648 XXX(ZBEE_ZCL_CMD_ID_KE_CONFIRM, 0x02, "Confirm Key Data" ) \
2649 XXX(ZBEE_ZCL_CMD_ID_KE_TERMINATE, 0x03, "Terminate Key Establishment" )
2651 VALUE_STRING_ENUM(zbee_zcl_ke_srv_cmd_names);
2652 VALUE_STRING_ARRAY(zbee_zcl_ke_srv_cmd_names);
2655 #define zbee_zcl_ke_suite_names_VALUE_STRING_LIST(XXX) \
2656 XXX(ZBEE_ZCL_KE_SUITE_1, 0x0001, "Crypto Suite 1 (CBKE K163)" ) \
2657 XXX(ZBEE_ZCL_KE_SUITE_2, 0x0002, "Crypto Suite 2 (CBKE K283)" )
2659 VALUE_STRING_ENUM(zbee_zcl_ke_suite_names);
2660 VALUE_STRING_ARRAY(zbee_zcl_ke_suite_names);
2662 /* Crypto Suite 2 Type Names */
2663 #define zbee_zcl_ke_type_names_VALUE_STRING_LIST(XXX) \
2664 XXX(ZBEE_ZCL_KE_TYPE_NO_EXT, 0x00, "No Extensions" )
2666 VALUE_STRING_ARRAY(zbee_zcl_ke_type_names);
2668 /* Crypto Suite 2 Curve Names */
2669 #define zbee_zcl_ke_curve_names_VALUE_STRING_LIST(XXX) \
2670 XXX(ZBEE_ZCL_KE_CURVE_SECT283K1, 0x0D, "sect283k1" )
2672 VALUE_STRING_ARRAY(zbee_zcl_ke_curve_names);
2674 /* Crypto Suite 2 Hash Names */
2675 #define zbee_zcl_ke_hash_names_VALUE_STRING_LIST(XXX) \
2676 XXX(ZBEE_ZCL_KE_HASH_AES_MMO, 0x08, "AES MMO" )
2678 VALUE_STRING_ARRAY(zbee_zcl_ke_hash_names);
2680 #define zbee_zcl_ke_status_names_VALUE_STRING_LIST(XXX) \
2681 XXX(ZBEE_ZCL_KE_STATUS_RESERVED, 0x00, "Reserved" ) \
2682 XXX(ZBEE_ZCL_KE_STATUS_UNKNOWN_ISSUER, 0x01, "Unknown Issuer" ) \
2683 XXX(ZBEE_ZCL_KE_STATUS_BAD_KEY_CONFIRM, 0x02, "Bad Key Confirm" ) \
2684 XXX(ZBEE_ZCL_KE_STATUS_BAD_MESSAGE, 0x03, "Bad Message" ) \
2685 XXX(ZBEE_ZCL_KE_STATUS_NO_RESOURCES, 0x04, "No Resources" ) \
2686 XXX(ZBEE_ZCL_KE_STATUS_UNSUPPORTED_SUITE, 0x05, "Unsupported Suite" ) \
2687 XXX(ZBEE_ZCL_KE_STATUS_INVALID_CERTIFICATE, 0x06, "Invalid Certificate" )
2689 VALUE_STRING_ARRAY(zbee_zcl_ke_status_names);
2691 /*************************/
2692 /* Function Declarations */
2693 /*************************/
2695 void proto_register_zbee_zcl_ke(void);
2696 void proto_reg_handoff_zbee_zcl_ke(void);
2698 /* Private functions prototype */
2700 /*************************/
2701 /* Global Variables */
2702 /*************************/
2704 static dissector_handle_t ke_handle;
2706 /* Initialize the protocol and registered fields */
2707 static int proto_zbee_zcl_ke = -1;
2708 static int hf_zbee_zcl_ke_srv_tx_cmd_id = -1;
2709 static int hf_zbee_zcl_ke_srv_rx_cmd_id = -1;
2710 static int hf_zbee_zcl_ke_attr_id = -1;
2711 static int hf_zbee_zcl_ke_suite = -1;
2712 static int hf_zbee_zcl_ke_ephemeral_time = -1;
2713 static int hf_zbee_zcl_ke_confirm_time = -1;
2714 static int hf_zbee_zcl_ke_status = -1;
2715 static int hf_zbee_zcl_ke_wait_time = -1;
2716 static int hf_zbee_zcl_ke_cert_reconstr = -1;
2717 static int hf_zbee_zcl_ke_cert_subject = -1;
2718 static int hf_zbee_zcl_ke_cert_issuer = -1;
2719 static int hf_zbee_zcl_ke_cert_profile_attr = -1;
2720 static int hf_zbee_zcl_ke_cert_type = -1;
2721 static int hf_zbee_zcl_ke_cert_serialno = -1;
2722 static int hf_zbee_zcl_ke_cert_curve = -1;
2723 static int hf_zbee_zcl_ke_cert_hash = -1;
2724 static int hf_zbee_zcl_ke_cert_valid_from = -1;
2725 static int hf_zbee_zcl_ke_cert_valid_to = -1;
2726 static int hf_zbee_zcl_ke_cert_key_usage_agreement = -1;
2727 static int hf_zbee_zcl_ke_cert_key_usage_signature = -1;
2728 static int hf_zbee_zcl_ke_ephemeral_qeu = -1;
2729 static int hf_zbee_zcl_ke_ephemeral_qev = -1;
2730 static int hf_zbee_zcl_ke_macu = -1;
2731 static int hf_zbee_zcl_ke_macv = -1;
2733 /* Initialize the subtree pointers */
2734 static gint ett_zbee_zcl_ke = -1;
2735 static gint ett_zbee_zcl_ke_cert = -1;
2736 static gint ett_zbee_zcl_ke_key_usage = -1;
2738 /*************************/
2739 /* Function Bodies */
2740 /*************************/
2743 *This function dissects the Suite 1 Certificate
2745 *@param tvb pointer to buffer containing raw packet.
2746 *@param tree pointer to data tree Wireshark uses to display packet.
2747 *@param offset pointer to offset from caller
2750 dissect_zcl_ke_suite1_certificate(tvbuff_t *tvb, proto_tree *tree, guint *offset)
2752 proto_tree_add_item(tree, hf_zbee_zcl_ke_cert_reconstr, tvb, *offset, 22, ENC_NA);
2755 proto_tree_add_item(tree, hf_zbee_zcl_ke_cert_subject, tvb, *offset, 8, ENC_NA);
2758 proto_tree_add_item(tree, hf_zbee_zcl_ke_cert_issuer, tvb, *offset, 8, ENC_NA);
2761 proto_tree_add_item(tree, hf_zbee_zcl_ke_cert_profile_attr, tvb, *offset, 10, ENC_NA);
2764 } /*dissect_zcl_ke_suite1_certificate*/
2767 *This function dissects the Suite 2 Certificate
2769 *@param tvb pointer to buffer containing raw packet.
2770 *@param tree pointer to data tree Wireshark uses to display packet.
2771 *@param offset pointer to offset from caller
2774 dissect_zcl_ke_suite2_certificate(tvbuff_t *tvb, proto_tree *tree, guint *offset)
2776 nstime_t valid_from_time;
2777 nstime_t valid_to_time;
2780 proto_tree *usage_tree;
2782 proto_tree_add_item(tree, hf_zbee_zcl_ke_cert_type, tvb, *offset, 1, ENC_NA);
2785 proto_tree_add_item(tree, hf_zbee_zcl_ke_cert_serialno, tvb, *offset, 8, ENC_NA);
2788 proto_tree_add_item(tree, hf_zbee_zcl_ke_cert_curve, tvb, *offset, 1, ENC_NA);
2791 proto_tree_add_item(tree, hf_zbee_zcl_ke_cert_hash, tvb, *offset, 1, ENC_NA);
2794 proto_tree_add_item(tree, hf_zbee_zcl_ke_cert_issuer, tvb, *offset, 8, ENC_NA);
2797 valid_from_time.secs = (time_t)tvb_get_ntoh40(tvb, *offset);
2798 valid_from_time.nsecs = 0;
2799 proto_tree_add_time(tree, hf_zbee_zcl_ke_cert_valid_from, tvb, *offset, 5, &valid_from_time);
2802 valid_to = tvb_get_ntohl(tvb, *offset);
2803 if (valid_to == 0xFFFFFFFF) {
2804 proto_tree_add_time_format(tree, hf_zbee_zcl_ke_cert_valid_to, tvb, *offset, 4, &valid_to_time, "Valid To: does not expire (0xFFFFFFFF)");
2807 valid_to_time.secs = valid_from_time.secs + valid_to;
2808 valid_to_time.nsecs = 0;
2809 proto_tree_add_time(tree, hf_zbee_zcl_ke_cert_valid_to, tvb, *offset, 4, &valid_to_time);
2813 proto_tree_add_item(tree, hf_zbee_zcl_ke_cert_subject, tvb, *offset, 8, ENC_NA);
2816 key_usage = tvb_get_guint8(tvb, *offset);
2817 usage_tree = proto_tree_add_subtree_format(tree, tvb, *offset, 1, ett_zbee_zcl_ke_key_usage, NULL, "Key Usage (0x%02x)", key_usage);
2819 proto_tree_add_item(usage_tree, hf_zbee_zcl_ke_cert_key_usage_agreement, tvb, *offset, 1, ENC_NA);
2820 proto_tree_add_item(usage_tree, hf_zbee_zcl_ke_cert_key_usage_signature, tvb, *offset, 1, ENC_NA);
2823 proto_tree_add_item(tree, hf_zbee_zcl_ke_cert_reconstr, tvb, *offset, 37, ENC_NA);
2826 } /*dissect_zcl_ke_suite2_certificate*/
2829 *This function manages the Initiate Key Establishment message
2831 *@param tvb pointer to buffer containing raw packet.
2832 *@param tree pointer to data tree Wireshark uses to display packet.
2833 *@param offset pointer to offset from caller
2836 dissect_zcl_ke_initiate(tvbuff_t *tvb, proto_tree *tree, guint *offset)
2839 proto_tree *subtree;
2842 suite = tvb_get_letohs(tvb, *offset);
2844 proto_tree_add_item(tree, hf_zbee_zcl_ke_suite, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
2847 proto_tree_add_item(tree, hf_zbee_zcl_ke_ephemeral_time, tvb, *offset, 1, ENC_NA);
2850 proto_tree_add_item(tree, hf_zbee_zcl_ke_confirm_time, tvb, *offset, 1, ENC_NA);
2853 rem_len = tvb_reported_length_remaining(tvb, *offset);
2854 subtree = proto_tree_add_subtree(tree, tvb, *offset, rem_len, ett_zbee_zcl_ke_cert, NULL, "Implicit Certificate");
2857 case ZBEE_ZCL_KE_SUITE_1:
2858 dissect_zcl_ke_suite1_certificate(tvb, subtree, offset);
2861 case ZBEE_ZCL_KE_SUITE_2:
2862 dissect_zcl_ke_suite2_certificate(tvb, subtree, offset);
2868 } /* dissect_zcl_ke_initiate */
2871 *This function dissects the Ephemeral Data QEU
2873 *@param tvb pointer to buffer containing raw packet.
2874 *@param tree pointer to data tree Wireshark uses to display packet.
2875 *@param offset pointer to offset from caller
2878 dissect_zcl_ke_ephemeral_qeu(tvbuff_t *tvb, proto_tree *tree, guint *offset)
2882 /* size depends on suite but without a session we don't know that here */
2883 /* so just report what we have */
2884 length = tvb_reported_length_remaining(tvb, *offset);
2885 proto_tree_add_item(tree, hf_zbee_zcl_ke_ephemeral_qeu, tvb, *offset, length, ENC_NA);
2887 return tvb_captured_length(tvb);
2891 *This function dissects the Ephemeral Data QEV
2893 *@param tvb pointer to buffer containing raw packet.
2894 *@param tree pointer to data tree Wireshark uses to display packet.
2895 *@param offset pointer to offset from caller
2898 dissect_zcl_ke_ephemeral_qev(tvbuff_t *tvb, proto_tree *tree, guint *offset)
2902 /* size depends on suite but without a session we don't know that here */
2903 /* so just report what we have */
2904 length = tvb_reported_length_remaining(tvb, *offset);
2905 proto_tree_add_item(tree, hf_zbee_zcl_ke_ephemeral_qev, tvb, *offset, length, ENC_NA);
2907 return tvb_captured_length(tvb);
2911 *This function dissects the Confirm MACU
2913 *@param tvb pointer to buffer containing raw packet.
2914 *@param tree pointer to data tree Wireshark uses to display packet.
2915 *@param offset pointer to offset from caller
2918 dissect_zcl_ke_confirm_macu(tvbuff_t *tvb, proto_tree *tree, guint *offset)
2920 proto_tree_add_item(tree, hf_zbee_zcl_ke_macu, tvb, *offset, ZBEE_SEC_CONST_BLOCKSIZE, ENC_NA);
2921 *offset += ZBEE_SEC_CONST_BLOCKSIZE;
2922 return tvb_captured_length(tvb);
2926 *This function dissects the Confirm MACV
2928 *@param tvb pointer to buffer containing raw packet.
2929 *@param tree pointer to data tree Wireshark uses to display packet.
2930 *@param offset pointer to offset from caller
2933 dissect_zcl_ke_confirm_macv(tvbuff_t *tvb, proto_tree *tree, guint *offset)
2935 proto_tree_add_item(tree, hf_zbee_zcl_ke_macv, tvb, *offset, ZBEE_SEC_CONST_BLOCKSIZE, ENC_NA);
2936 *offset += ZBEE_SEC_CONST_BLOCKSIZE;
2937 return tvb_captured_length(tvb);
2941 *This function dissects the Terminate Key Establishment message
2943 *@param tvb pointer to buffer containing raw packet.
2944 *@param tree pointer to data tree Wireshark uses to display packet.
2945 *@param offset pointer to offset from caller
2948 dissect_zcl_ke_terminate(tvbuff_t *tvb, proto_tree *tree, guint *offset)
2950 proto_tree_add_item(tree, hf_zbee_zcl_ke_status, tvb, *offset, 1, ENC_NA);
2953 proto_tree_add_item(tree, hf_zbee_zcl_ke_wait_time, tvb, *offset, 1, ENC_NA);
2956 proto_tree_add_item(tree, hf_zbee_zcl_ke_suite, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
2961 *ZigBee ZCL Key Establishment cluster dissector for wireshark.
2963 *@param tvb pointer to buffer containing raw packet.
2964 *@param pinfo pointer to packet information fields
2965 *@param tree pointer to data tree Wireshark uses to display packet.
2968 dissect_zbee_zcl_ke(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
2970 zbee_zcl_packet *zcl;
2975 /* Reject the packet if data is NULL */
2978 zcl = (zbee_zcl_packet *)data;
2979 cmd_id = zcl->cmd_id;
2981 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
2982 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
2983 /* Append the command name to the info column. */
2984 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
2985 val_to_str_const(cmd_id, zbee_zcl_ke_srv_cmd_names, "Unknown Command"),
2988 /* Add the command ID. */
2989 proto_tree_add_uint(tree, hf_zbee_zcl_ke_srv_rx_cmd_id, tvb, offset, 1, cmd_id);
2991 /* Check is this command has a payload, than add the payload tree */
2992 rem_len = tvb_reported_length_remaining(tvb, offset);
2993 offset += 1; /* delay from last add_item */
2996 /* Call the appropriate command dissector */
2998 case ZBEE_ZCL_CMD_ID_KE_INITIATE:
2999 dissect_zcl_ke_initiate(tvb, tree, &offset);
3002 case ZBEE_ZCL_CMD_ID_KE_EPHEMERAL:
3003 return dissect_zcl_ke_ephemeral_qeu(tvb, tree, &offset);
3005 case ZBEE_ZCL_CMD_ID_KE_CONFIRM:
3006 return dissect_zcl_ke_confirm_macu(tvb, tree, &offset);
3008 case ZBEE_ZCL_CMD_ID_KE_TERMINATE:
3009 dissect_zcl_ke_terminate(tvb, tree, &offset);
3017 else { /* ZBEE_ZCL_FCF_TO_CLIENT */
3018 /* Append the command name to the info column. */
3019 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
3020 val_to_str_const(cmd_id, zbee_zcl_ke_srv_cmd_names, "Unknown Command"),
3023 /* Add the command ID. */
3024 proto_tree_add_uint(tree, hf_zbee_zcl_ke_srv_tx_cmd_id, tvb, offset, 1, cmd_id);
3026 /* Check is this command has a payload, than add the payload tree */
3027 rem_len = tvb_reported_length_remaining(tvb, ++offset);
3029 /* Call the appropriate command dissector */
3031 case ZBEE_ZCL_CMD_ID_KE_INITIATE:
3032 dissect_zcl_ke_initiate(tvb, tree, &offset);
3035 case ZBEE_ZCL_CMD_ID_KE_EPHEMERAL:
3036 return dissect_zcl_ke_ephemeral_qev(tvb, tree, &offset);
3038 case ZBEE_ZCL_CMD_ID_KE_CONFIRM:
3039 return dissect_zcl_ke_confirm_macv(tvb, tree, &offset);
3041 case ZBEE_ZCL_CMD_ID_KE_TERMINATE:
3042 dissect_zcl_ke_terminate(tvb, tree, &offset);
3051 return tvb_captured_length(tvb);
3052 } /*dissect_zbee_zcl_ke*/
3056 *This function registers the ZCL Messaging dissector
3060 proto_register_zbee_zcl_ke(void)
3062 static hf_register_info hf[] = {
3064 { &hf_zbee_zcl_ke_attr_id,
3065 { "Attribute", "zbee_zcl_se.ke.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_ke_attr_names),
3066 0x00, NULL, HFILL } },
3068 { &hf_zbee_zcl_ke_srv_tx_cmd_id,
3069 { "Command", "zbee_zcl_se.ke.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_ke_srv_cmd_names),
3070 0x00, NULL, HFILL } },
3072 { &hf_zbee_zcl_ke_srv_rx_cmd_id,
3073 { "Command", "zbee_zcl_se.ke.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_ke_srv_cmd_names),
3074 0x00, NULL, HFILL } },
3076 { &hf_zbee_zcl_ke_suite,
3077 { "Key Establishment Suite", "zbee_zcl_se.ke.attr.suite", FT_UINT16, BASE_HEX, VALS(zbee_zcl_ke_suite_names),
3078 0x00, NULL, HFILL } },
3080 { &hf_zbee_zcl_ke_ephemeral_time,
3081 { "Ephemeral Data Generate Time", "zbee_zcl_se.ke.init.ephemeral.time", FT_UINT8, BASE_DEC, NULL,
3084 { &hf_zbee_zcl_ke_confirm_time,
3085 { "Confirm Key Generate Time", "zbee_zcl_se.ke.init.confirm.time", FT_UINT8, BASE_DEC, NULL,
3088 { &hf_zbee_zcl_ke_status,
3089 { "Status", "zbee_zcl_se.ke.terminate.status", FT_UINT8, BASE_HEX, VALS(zbee_zcl_ke_status_names),
3090 0x00, NULL, HFILL } },
3092 { &hf_zbee_zcl_ke_wait_time,
3093 { "Wait Time", "zbee_zcl_se.ke.terminate.wait.time", FT_UINT8, BASE_DEC, NULL,
3096 { &hf_zbee_zcl_ke_cert_reconstr,
3097 { "Public Key", "zbee_zcl_se.ke.cert.reconst", FT_BYTES, BASE_NONE, NULL,
3100 { &hf_zbee_zcl_ke_cert_subject,
3101 { "Subject", "zbee_zcl_se.ke.cert.subject", FT_BYTES, BASE_NONE, NULL,
3104 { &hf_zbee_zcl_ke_cert_issuer,
3105 { "Issuer", "zbee_zcl_se.ke.cert.issuer", FT_BYTES, BASE_NONE, NULL,
3108 { &hf_zbee_zcl_ke_cert_profile_attr,
3109 { "Profile Attribute Data", "zbee_zcl_se.ke.cert.profile", FT_BYTES, BASE_NONE, NULL,
3112 { &hf_zbee_zcl_ke_cert_type,
3113 { "Type", "zbee_zcl_se.ke.cert.type", FT_UINT8, BASE_HEX, VALS(zbee_zcl_ke_type_names),
3116 { &hf_zbee_zcl_ke_cert_serialno,
3117 { "Serial No", "zbee_zcl_se.ke.cert.serialno", FT_UINT64, BASE_HEX, NULL,
3120 { &hf_zbee_zcl_ke_cert_curve,
3121 { "Curve", "zbee_zcl_se.ke.cert.curve", FT_UINT8, BASE_HEX, VALS(zbee_zcl_ke_curve_names),
3124 { &hf_zbee_zcl_ke_cert_hash,
3125 { "Hash", "zbee_zcl_se.ke.cert.hash", FT_UINT8, BASE_HEX, VALS(zbee_zcl_ke_hash_names),
3128 { &hf_zbee_zcl_ke_cert_valid_from,
3129 { "Valid From", "zbee_zcl_se.ke.cert.valid.from", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL,
3132 { &hf_zbee_zcl_ke_cert_valid_to,
3133 { "Valid To", "zbee_zcl_se.ke.cert.valid.to", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL,
3136 { &hf_zbee_zcl_ke_cert_key_usage_agreement,
3137 { "Key Agreement", "zbee_zcl_se.ke.cert.key.usage.agreement", FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled),
3138 ZBEE_ZCL_KE_USAGE_KEY_AGREEMENT, NULL, HFILL }},
3140 { &hf_zbee_zcl_ke_cert_key_usage_signature,
3141 { "Digital Signature", "zbee_zcl_se.ke.cert.key.usage.signature", FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled),
3142 ZBEE_ZCL_KE_USAGE_DIGITAL_SIGNATURE, NULL, HFILL }},
3144 { &hf_zbee_zcl_ke_ephemeral_qeu,
3145 { "Ephemeral Data (QEU)", "zbee_zcl_se.ke.qeu", FT_BYTES, BASE_NONE, NULL,
3148 { &hf_zbee_zcl_ke_ephemeral_qev,
3149 { "Ephemeral Data (QEV)", "zbee_zcl_se.ke.qev", FT_BYTES, BASE_NONE, NULL,
3152 { &hf_zbee_zcl_ke_macu,
3153 { "Message Authentication Code (MACU)", "zbee_zcl_se.ke.macu", FT_BYTES, BASE_NONE, NULL,
3156 { &hf_zbee_zcl_ke_macv,
3157 { "Message Authentication Code (MACV)", "zbee_zcl_se.ke.macv", FT_BYTES, BASE_NONE, NULL,
3164 &ett_zbee_zcl_ke_cert,
3165 &ett_zbee_zcl_ke_key_usage,
3168 /* Register the ZigBee ZCL Messaging cluster protocol name and description */
3169 proto_zbee_zcl_ke = proto_register_protocol("ZigBee ZCL Key Establishment", "ZCL Key Establishment", ZBEE_PROTOABBREV_ZCL_KE);
3170 proto_register_field_array(proto_zbee_zcl_ke, hf, array_length(hf));
3171 proto_register_subtree_array(ett, array_length(ett));
3173 /* Register the ZigBee ZCL Messaging dissector. */
3174 ke_handle = register_dissector(ZBEE_PROTOABBREV_ZCL_KE, dissect_zbee_zcl_ke, proto_zbee_zcl_ke);
3175 } /*proto_register_zbee_zcl_ke*/
3178 *Hands off the Zcl Key Establishment dissector.
3182 proto_reg_handoff_zbee_zcl_ke(void)
3184 /* Register our dissector with the ZigBee application dissectors. */
3185 dissector_add_uint("zbee.zcl.cluster", ZBEE_ZCL_CID_KE, ke_handle);
3187 zbee_zcl_init_cluster( proto_zbee_zcl_ke,
3190 hf_zbee_zcl_ke_attr_id,
3191 hf_zbee_zcl_ke_srv_rx_cmd_id,
3192 hf_zbee_zcl_ke_srv_tx_cmd_id,
3195 } /*proto_reg_handoff_zbee_zcl_ke*/
3198 * Editor modelines - http://www.wireshark.org/tools/modelines.html
3203 * indent-tabs-mode: nil
3206 * vi: set shiftwidth=4 tabstop=8 expandtab:
3207 * :indentSize=4:tabSize=8:noTabs=true: