3 * Dissector for Great Britain Companion Specification (GBCS) used in the Smart Metering Equipment Technical Specifications (SMETS)
5 * The Smart Metering Equipment Technical Specifications (SMETS) requires that Gas Smart Metering Equipment (GSME), and Electricity
6 * Smart Metering Equipment (ESME) including variants, meet the requirements described in
7 * the Great Britain Companion Specification (GBCS).
9 * GBCS messages are end-to-end and contains ZigBee, DLMS or ASN.1 formatted payloads. The GBCS messages are transported via IP
10 * or via the ZigBee Tunneling cluster.
12 * https://smartenergycodecompany.co.uk/document-download-centre/download-info/gbcs-v2-1/
14 * Sample capture is attached in Bug 15381
16 * Wireshark - Network traffic analyzer
17 * By Gerald Combs <gerald@wireshark.org>
18 * Copyright 1998 Gerald Combs
20 * SPDX-License-Identifier: GPL-2.0-or-later
24 #include <epan/packet.h>
25 #include <epan/expert.h>
26 #include <epan/reassemble.h>
27 #include "packet-ber.h"
28 #include "packet-zbee.h"
29 #include "packet-zbee-nwk.h"
30 #include "packet-zbee-zcl.h"
31 #include "packet-zbee-aps.h"
32 #include <wsutil/epochs.h>
33 #include <wsutil/time_util.h>
35 #define gbcs_message_code_names_VALUE_STRING_LIST(XXX) \
36 XXX(GBCS_MESSAGE_CCS01, 0x0001, "CCS01 Add Device to CHF device log") \
37 XXX(GBCS_MESSAGE_CCS02, 0x0002, "CCS02 Remove device from CHF device log") \
38 XXX(GBCS_MESSAGE_CCS03, 0x0003, "CCS03 Restore CHF Device Log") \
39 XXX(GBCS_MESSAGE_CCS05CCS04, 0x0004, "CCS05/CCS04 Read CHF device log / Check HAN communications (by reading the CHF Communications Store)") \
40 XXX(GBCS_MESSAGE_CS01A, 0x0007, "CS01a Apply Pre-payment Top Up to an ESME") \
41 XXX(GBCS_MESSAGE_CS02A, 0x0008, "CS02a Provide Security Credentials Details") \
42 XXX(GBCS_MESSAGE_CS02C, 0x000A, "CS02c Issue Security Credentials ") \
43 XXX(GBCS_MESSAGE_CS02D, 0x000B, "CS02d Update Device Certificates on Device") \
44 XXX(GBCS_MESSAGE_CS02E, 0x000C, "CS02e Provide Device Certificates from Device ") \
45 XXX(GBCS_MESSAGE_CS03A1, 0x000D, "CS03a1 Method A Join (Meter)") \
46 XXX(GBCS_MESSAGE_CS03B, 0x000E, "CS03b Method B Join") \
47 XXX(GBCS_MESSAGE_CS04AC, 0x000F, "CS04ac Method A or C Unjoin") \
48 XXX(GBCS_MESSAGE_CS04B, 0x0010, "CS04b Method B Unjoin") \
49 XXX(GBCS_MESSAGE_CS06, 0x0012, "CS06 Activate Firmware") \
50 XXX(GBCS_MESSAGE_CS07, 0x0013, "CS07 Read Device Join Details") \
51 XXX(GBCS_MESSAGE_CS10A, 0x0014, "CS10a Read ZigBee Device Event Log") \
52 XXX(GBCS_MESSAGE_CS11, 0x0015, "CS11 Clear ZigBee Device Event Log") \
53 XXX(GBCS_MESSAGE_CS14, 0x0018, "CS14 Device Addition To / Removal From HAN Whitelist Alerts") \
54 XXX(GBCS_MESSAGE_ECS01A, 0x0019, "ECS01a Set Tariff and Price on ESME") \
55 XXX(GBCS_MESSAGE_ECS02, 0x001A, "ECS02 Set ESME Payment Mode to Credit") \
56 XXX(GBCS_MESSAGE_ECS03, 0x001B, "ECS03 Set ESME Payment Mode to Pre-payment") \
57 XXX(GBCS_MESSAGE_ECS04A, 0x001C, "ECS04a Adjust Meter Balance on the ESME") \
58 XXX(GBCS_MESSAGE_ECS05, 0x001D, "ECS05 Reset Tariff Block Counter Matrix") \
59 XXX(GBCS_MESSAGE_ECS07, 0x001E, "ECS07 Manage Debt on the ESME") \
60 XXX(GBCS_MESSAGE_ECS08, 0x001F, "ECS08 Update Pre-payment Configuration on ESME") \
61 XXX(GBCS_MESSAGE_ECS09, 0x0020, "ECS09 Activate Emergency Credit Remotely on ESME") \
62 XXX(GBCS_MESSAGE_ECS10, 0x0021, "ECS10 Send Message to ESME") \
63 XXX(GBCS_MESSAGE_ECS12, 0x0022, "ECS12 Set Change of Tenancy date on ESME") \
64 XXX(GBCS_MESSAGE_ECS14, 0x0023, "ECS14 Disable Privacy PIN Protection on ESME") \
65 XXX(GBCS_MESSAGE_ECS15A, 0x0024, "ECS15a Clear ESME Event Log") \
66 XXX(GBCS_MESSAGE_ECS16, 0x0025, "ECS16 Write Supplier Contact Details on ESME") \
67 XXX(GBCS_MESSAGE_ECS17A, 0x0026, "ECS17a Read ESME Energy Registers (Export Energy)") \
68 XXX(GBCS_MESSAGE_ECS17B, 0x0027, "ECS17b Read ESME Energy Registers (Import Energy)") \
69 XXX(GBCS_MESSAGE_ECS17C, 0x0028, "ECS17c Read ESME Energy Registers (Power)") \
70 XXX(GBCS_MESSAGE_ECS17D, 0x0029, "ECS17d Read ESME Energy Register (TOU)") \
71 XXX(GBCS_MESSAGE_ECS17E, 0x002A, "ECS17e Read ESME Energy Register (TOU with Blocks)") \
72 XXX(GBCS_MESSAGE_ECS18A, 0x002B, "ECS18a Read Maximum Demand Registers (export)") \
73 XXX(GBCS_MESSAGE_ECS18B, 0x002C, "ECS18b Read Maximum Demand Registers (import)") \
74 XXX(GBCS_MESSAGE_ECS19, 0x002D, "ECS19 Read ESME Pre-payment Registers") \
75 XXX(GBCS_MESSAGE_ECS20A, 0x002E, "ECS20a Read ESME Billing Data Log (payment based debt payments)") \
76 XXX(GBCS_MESSAGE_ECS20B, 0x002F, "ECS20b Read ESME Billing Data Log (change of mode / tariff triggered exc export)") \
77 XXX(GBCS_MESSAGE_ECS20C, 0x0030, "ECS20c Read ESME Billing Data Log (billing calendar triggered exc export)") \
78 XXX(GBCS_MESSAGE_ECS21A, 0x0033, "ECS21a Read Electricity Daily Read Log (exc export)") \
79 XXX(GBCS_MESSAGE_ECS21B, 0x0034, "ECS21b Read Electricity (Pre-payment) Daily Read Log") \
80 XXX(GBCS_MESSAGE_ECS21C, 0x0035, "ECS21c Read Electricity Daily Read Log (export only)") \
81 XXX(GBCS_MESSAGE_ECS22A, 0x0036, "ECS22a Read Electricity Half Hour Profile Data (export)") \
82 XXX(GBCS_MESSAGE_ECS22B, 0x0037, "ECS22b Read Electricity Half Hour Profile Data (active import)") \
83 XXX(GBCS_MESSAGE_ECS22C, 0x0038, "ECS22c Read Electricity Half Hour Profile Data (reactive import)") \
84 XXX(GBCS_MESSAGE_ECS23, 0x0039, "ECS23 Read Voltage Operational Data") \
85 XXX(GBCS_MESSAGE_ECS24, 0x003A, "ECS24 Read ESME Tariff Data") \
86 XXX(GBCS_MESSAGE_ECS26A, 0x003B, "ECS26a Read ESME Configuration Data Pre-payment") \
87 XXX(GBCS_MESSAGE_ECS26B, 0x003C, "ECS26b Read ESME Configuration Voltage Data") \
88 XXX(GBCS_MESSAGE_ECS26C, 0x003D, "ECS26c Read ESME Configuration Data Device Information (randomisation)") \
89 XXX(GBCS_MESSAGE_ECS26D, 0x003E, "ECS26d Read ESME Configuration Data Device Information (Billing Calendar)") \
90 XXX(GBCS_MESSAGE_ECS26E, 0x003F, "ECS26e Read ESME Configuration Data Device Information (device identity exc MPAN)") \
91 XXX(GBCS_MESSAGE_ECS26F, 0x0040, "ECS26f Read ESME Configuration Data Device Information (instantaneous power thresholds)") \
92 XXX(GBCS_MESSAGE_ECS27, 0x0042, "ECS27 Read ESME Load Limit Data") \
93 XXX(GBCS_MESSAGE_ECS28A, 0x0043, "ECS28a Set Load Limit Configurations - General Settings") \
94 XXX(GBCS_MESSAGE_ECS28B, 0x0044, "ECS28b Set Load Limit Configuration Counter Reset") \
95 XXX(GBCS_MESSAGE_ECS29A, 0x0045, "ECS29a Set Voltage Configurations on ESME") \
96 XXX(GBCS_MESSAGE_ECS30, 0x0046, "ECS30 Set Billing Calendar on the ESME") \
97 XXX(GBCS_MESSAGE_ECS34, 0x0047, "ECS34 Set Instantaneous Power Threshold Configuration") \
98 XXX(GBCS_MESSAGE_ECS35A, 0x0048, "ECS35a Read ESME Event Log") \
99 XXX(GBCS_MESSAGE_ECS35B, 0x0049, "ECS35b Read ESME Security Log") \
100 XXX(GBCS_MESSAGE_ECS37, 0x004A, "ECS37 Set Maximum Demand Configurable Time Period") \
101 XXX(GBCS_MESSAGE_ECS38, 0x004B, "ECS38 Update Randomised Offset Limit") \
102 XXX(GBCS_MESSAGE_ECS39A, 0x004C, "ECS39a Set MPAN Value on the ESME") \
103 XXX(GBCS_MESSAGE_ECS39B, 0x004D, "ECS39b Set Export MPAN Value on the ESME") \
104 XXX(GBCS_MESSAGE_ECS40, 0x004E, "ECS40 Read MPAN Value on the ESME") \
105 XXX(GBCS_MESSAGE_ECS42, 0x004F, "ECS42 Remotely Close the Load Switch on the ESME") \
106 XXX(GBCS_MESSAGE_ECS43, 0x0050, "ECS43 Remotely Open the Load Switch on the ESME") \
107 XXX(GBCS_MESSAGE_ECS44, 0x0051, "ECS44 Arm Load Switch in ESME") \
108 XXX(GBCS_MESSAGE_ECS45, 0x0052, "ECS45 Read Status of Load Switch in the ESME") \
109 XXX(GBCS_MESSAGE_ECS46A, 0x0053, "ECS46a Set HC ALCS or ALCS Labels in ESME") \
110 XXX(GBCS_MESSAGE_ECS46C, 0x0054, "ECS46c Set HC ALCS and ALCS configuration in ESME (excluding labels)") \
111 XXX(GBCS_MESSAGE_ECS47, 0x0055, "ECS47 Set or Reset HC ALCS or ALCS State") \
112 XXX(GBCS_MESSAGE_ECS50, 0x0058, "ECS50 Send CIN to ESME") \
113 XXX(GBCS_MESSAGE_ECS52, 0x0059, "ECS52 Read ESME/Comms Hub Firmware Version") \
114 XXX(GBCS_MESSAGE_ECS57, 0x005A, "ECS57 Reset ESME Maximum Demand Registers") \
115 XXX(GBCS_MESSAGE_ECS61C, 0x005E, "ECS61c Read Boost Button Data from ESME") \
116 XXX(GBCS_MESSAGE_ECS62, 0x005F, "ECS62 Set ALCS and Boost Button Association") \
117 XXX(GBCS_MESSAGE_ECS66, 0x0060, "ECS66 Read ESME Daily Consumption Log") \
118 XXX(GBCS_MESSAGE_ECS68, 0x0061, "ECS68 ESME Critical Sensitive Alert (Billing Data Log)") \
119 XXX(GBCS_MESSAGE_ECS70, 0x0062, "ECS70 Set Clock on ESME") \
120 XXX(GBCS_MESSAGE_ECS80, 0x0067, "ECS80 Supply Outage Restore Alert from ESME") \
121 XXX(GBCS_MESSAGE_ECS81, 0x0068, "ECS81 Set Supply Tamper State on ESME") \
122 XXX(GBCS_MESSAGE_ECS82, 0x0069, "ECS82 Read Meter Balance for ESME") \
123 XXX(GBCS_MESSAGE_GCS01A, 0x006B, "GCS01a Set Tariff and Price on GSME") \
124 XXX(GBCS_MESSAGE_GCS02, 0x006C, "GCS02 Set GSME Payment Mode to Credit") \
125 XXX(GBCS_MESSAGE_GCS03, 0x006D, "GCS03 Set GSME Payment Mode to Pre-payment") \
126 XXX(GBCS_MESSAGE_GCS04, 0x006E, "GCS04 Manage Debt on the GSME") \
127 XXX(GBCS_MESSAGE_GCS05, 0x006F, "GCS05 Update Pre-payment Configurations on GSME") \
128 XXX(GBCS_MESSAGE_GCS06, 0x0070, "GCS06 Activate Emergency Credit Remotely on GSME") \
129 XXX(GBCS_MESSAGE_GCS07, 0x0071, "GCS07 Send Message to GSME") \
130 XXX(GBCS_MESSAGE_GCS09, 0x0072, "GCS09 Set Change of Tenancy date on GPF") \
131 XXX(GBCS_MESSAGE_GCS11, 0x0073, "GCS11 Disable Privacy PIN Protection on GSME") \
132 XXX(GBCS_MESSAGE_GCS13A, 0x0074, "GCS13a Read GSME Consumption Register") \
133 XXX(GBCS_MESSAGE_GCS14, 0x0075, "GCS14 Read GSME Pre-payment Register(s)") \
134 XXX(GBCS_MESSAGE_GCS15C, 0x0076, "GCS15c Read GSME Billing Data Log (billing calendar triggered)") \
135 XXX(GBCS_MESSAGE_GCS16A, 0x0077, "GCS16a Read GSME Daily Read log(s)") \
136 XXX(GBCS_MESSAGE_GCS17, 0x0078, "GCS17 Read GSME Profile Data Log") \
137 XXX(GBCS_MESSAGE_GCS18, 0x0079, "GCS18 Read Gas Network Data Log") \
138 XXX(GBCS_MESSAGE_GCS21A, 0x007B, "GCS21a Read Gas Configuration Data Device Information") \
139 XXX(GBCS_MESSAGE_GCS23, 0x007C, "GCS23 Set CV and Conversion Factor Value(s) on the GSME") \
140 XXX(GBCS_MESSAGE_GCS24, 0x007D, "GCS24 Set Uncontrolled Gas Flow Rate and Supply Tamper State on the GSME") \
141 XXX(GBCS_MESSAGE_GCS25, 0x007E, "GCS25 Set Billing Calendar on the GSME") \
142 XXX(GBCS_MESSAGE_GCS28, 0x007F, "GCS28 Set Clock on GSME") \
143 XXX(GBCS_MESSAGE_GCS31, 0x0080, "GCS31 Start Network Data Log on GSME") \
144 XXX(GBCS_MESSAGE_GCS32, 0x0081, "GCS32 Remotely close the valve in the GSME") \
145 XXX(GBCS_MESSAGE_GCS33, 0x0082, "GCS33 Read GSME Valve Status") \
146 XXX(GBCS_MESSAGE_GCS36, 0x0083, "GCS36 Send CIN to GSME") \
147 XXX(GBCS_MESSAGE_GCS38, 0x0084, "GCS38 Read GSME Firmware Version") \
148 XXX(GBCS_MESSAGE_GCS39, 0x0085, "GCS39 Arm Valve in GSME") \
149 XXX(GBCS_MESSAGE_GCS40A, 0x0086, "GCS40a Adjust Pre-payment Mode Meter Balance on the GSME") \
150 XXX(GBCS_MESSAGE_GCS41, 0x0087, "GCS41 Set MPRN Value on the GSME") \
151 XXX(GBCS_MESSAGE_GCS44, 0x0088, "GCS44 Write Contact Details on GSME") \
152 XXX(GBCS_MESSAGE_GCS46, 0x0089, "GCS46 Read MPRN on the GSME") \
153 XXX(GBCS_MESSAGE_GCS53, 0x008B, "GCS53 Push Billing Data Log as an Alert") \
154 XXX(GBCS_MESSAGE_GCS59, 0x008C, "GCS59 Restore GPF Device Log") \
155 XXX(GBCS_MESSAGE_GCS60, 0x008D, "GCS60 Read Meter Balance for GSME") \
156 XXX(GBCS_MESSAGE_PCS02, 0x0090, "PCS02 Activate Emergency Credit on GSME from PPMID") \
157 XXX(GBCS_MESSAGE_ECS26I, 0x0092, "ECS26i Read Configuration Data Device Information (CHF identity)") \
158 XXX(GBCS_MESSAGE_ECS35C, 0x0093, "ECS35c Read CHF Event Log") \
159 XXX(GBCS_MESSAGE_ECS35D, 0x0094, "ECS35d Read CHF Security Log") \
160 XXX(GBCS_MESSAGE_GCS16B, 0x0096, "GCS16b Read GSME Daily Read log(s) (pre-payment)") \
161 XXX(GBCS_MESSAGE_CS01B, 0x0097, "CS01b Apply Pre-payment Top Up to a GSME") \
162 XXX(GBCS_MESSAGE_PCS01, 0x009B, "PCS01 Apply Pre-payment Top Up to a GSME using PPMID") \
163 XXX(GBCS_MESSAGE_GCS21D, 0x009D, "GCS21d Read GSME Configuration Data Device Information (BillingCalendar)") \
164 XXX(GBCS_MESSAGE_GCS21E, 0x009E, "GCS21e Read GSME/GPF Configuration Data Device Information (device identity)") \
165 XXX(GBCS_MESSAGE_GCS21F, 0x009F, "GCS21f Read GSME Tariff Data") \
166 XXX(GBCS_MESSAGE_GCS61, 0x00A0, "GCS61 Read gas Daily Consumption Log") \
167 XXX(GBCS_MESSAGE_CS10B, 0x00A1, "CS10b Read ZigBee Device Security Log") \
168 XXX(GBCS_MESSAGE_ECS01B, 0x00A2, "ECS01b Set Price on ESME") \
169 XXX(GBCS_MESSAGE_GCS01B, 0x00A3, "GCS01b Set Price on GSME") \
170 XXX(GBCS_MESSAGE_CS03A2, 0x00AB, "CS03a2 Method A Join (non Meter)") \
171 XXX(GBCS_MESSAGE_ECS25A, 0x00AC, "ECS25a Set Alert Behaviours - ESME - Supplier") \
172 XXX(GBCS_MESSAGE_GCS20, 0x00AD, "GCS20 Set Alert Behaviours - GSME") \
173 XXX(GBCS_MESSAGE_ECS29B, 0x00AE, "ECS29b Set Voltage Configurations on ESME - 3ph") \
174 XXX(GBCS_MESSAGE_CS03C, 0x00AF, "CS03c Method C Join") \
175 XXX(GBCS_MESSAGE_ECS25B, 0x00B0, "ECS25b Set Alert Behaviours - ESME - Network Operator") \
176 XXX(GBCS_MESSAGE_GCS62, 0x00B2, "GCS62 Backup GPF Device Log") \
177 XXX(GBCS_MESSAGE_ECS04B, 0x00B3, "ECS04b Reset Meter Balance on the ESME") \
178 XXX(GBCS_MESSAGE_GCS40B, 0x00B4, "GCS40b Reset Pre-payment Mode Meter Balance on the GSME") \
179 XXX(GBCS_MESSAGE_GCS21B, 0x00B5, "GCS21b Read GSME Configuration Data Pre-payment") \
180 XXX(GBCS_MESSAGE_GCS13C, 0x00B6, "GCS13c Read GSME Register (TOU)") \
181 XXX(GBCS_MESSAGE_ECS01C, 0x00B7, "ECS01c Set Tariff and Price on ESME secondary") \
182 XXX(GBCS_MESSAGE_GCS13B, 0x00B8, "GCS13b Read GSME Block Counters") \
183 XXX(GBCS_MESSAGE_ECS35E, 0x00B9, "ECS35e Read ESME Power Event Log") \
184 XXX(GBCS_MESSAGE_ECS35F, 0x00BA, "ECS35f Read ALCS Event Log") \
185 XXX(GBCS_MESSAGE_ECS61A, 0x00BB, "ECS61a Read HC ALCS and ALCS Data from ESME") \
186 XXX(GBCS_MESSAGE_ECS23B, 0x00BC, "ECS23b Read Voltage Operational Data -3 Phase") \
187 XXX(GBCS_MESSAGE_ECS24B, 0x00BD, "ECS24b Read ESME Tariff Data - second element") \
188 XXX(GBCS_MESSAGE_ECS26J, 0x00BE, "ECS26j Read ESME Configuration Data Device Information (Payment Mode)") \
189 XXX(GBCS_MESSAGE_GCS21J, 0x00BF, "GCS21j Read GSME Configuration Data Device Information (Payment Mode)") \
190 XXX(GBCS_MESSAGE_GCS40C, 0x00C0, "GCS40c Adjust Credit Mode Meter Balance on the GSME") \
191 XXX(GBCS_MESSAGE_ECS15C, 0x00C1, "ECS15c Clear ALCS Event Log") \
192 XXX(GBCS_MESSAGE_GCS40D, 0x00C2, "GCS40d Reset Credit Mode Meter Balance on the GSME") \
193 XXX(GBCS_MESSAGE_GCS15B, 0x00C3, "GCS15b Read GSME Billing Data Log (change of mode / tariff triggered)") \
194 XXX(GBCS_MESSAGE_GCS15D, 0x00C4, "GCS15d Read GSME Billing Data Log (payment-based debt payments) ") \
195 XXX(GBCS_MESSAGE_GCS15E, 0x00C5, "GCS15e Read GSME Billing Data Log (pre-payment credits)") \
196 XXX(GBCS_MESSAGE_ECS26K, 0x00C6, "ECS26k Read ESME Configuration Voltage Data - 3 phase") \
197 XXX(GBCS_MESSAGE_ECS01D, 0x00C7, "ECS01d Set Price on ESME secondary") \
198 XXX(GBCS_MESSAGE_ECS20D, 0x00C9, "ECS20d Read ESME Billing Data Log (pre-payment credits)") \
199 XXX(GBCS_MESSAGE_ALERT_00CA, 0x00CA, "Futured Dated Firmware Activation Alert") \
200 XXX(GBCS_MESSAGE_ALERT_00CB, 0x00CB, "Futured Dated Updated Security Credentials Alert") \
201 XXX(GBCS_MESSAGE_ALERT_00CC, 0x00CC, "Future Dated Execution Of Instruction Alert (DLMS COSEM)") \
202 XXX(GBCS_MESSAGE_ALERT_00CD, 0x00CD, "Future Dated Execution Of Instruction Alert (GBZ)") \
203 XXX(GBCS_MESSAGE_ALERT_00CE, 0x00CE, "Firmware Distribution Receipt Alert (ESME or Comms Hub)") \
204 XXX(GBCS_MESSAGE_ALERT_00CF, 0x00CF, "Firmware Distribution Receipt Alert (GSME)") \
205 XXX(GBCS_MESSAGE_ECS29C, 0x00D1, "ECS29c Set Voltage Configurations on ESME without counter reset") \
206 XXX(GBCS_MESSAGE_ECS29D, 0x00D2, "ECS29d Set Voltage Configurations on polyphase ESME without counter reset") \
207 XXX(GBCS_MESSAGE_ECS29E, 0x00D3, "ECS29e Reset RMS Voltage Counters on ESME") \
208 XXX(GBCS_MESSAGE_ECS29F, 0x00D4, "ECS29f Reset RMS Voltage Counters on polyphase ESME") \
209 XXX(GBCS_MESSAGE_ALERT_00D5, 0x00D5, "Failure to Deliver Remote Party Message to ESME Alert") \
210 XXX(GBCS_MESSAGE_ECS30A, 0x00D7, "ECS30a Set Billing Calendar on the ESME - all periodicities") \
211 XXX(GBCS_MESSAGE_GCS25A, 0x00D8, "GCS25a Set Billing Calendar on the GSME - all periodicities") \
212 XXX(GBCS_MESSAGE_ECS26L, 0x00D9, "ECS26l Read ESME Configuration Data Device Information (Billing Calendar - all periodicities)") \
213 XXX(GBCS_MESSAGE_GCS21K, 0x00DA, "GCS21k Read GSME Configuration Data Device Information (BillingCalendar - all periodicities)") \
214 XXX(GBCS_MESSAGE_ECS48, 0x00DB, "ECS48 Configure daily resetting of Tariff Block Counter Matrix") \
215 XXX(GBCS_MESSAGE_ECS08A, 0x00DE, "ECS08a Update Pre-payment Configuration on ESME") \
216 XXX(GBCS_MESSAGE_ECS25A1, 0x00EA, "ECS25a1 Set Event Behaviours - ESME to HAN Device - Supplier") \
217 XXX(GBCS_MESSAGE_ECS25A2, 0x00EB, "ECS25a2 Set Event Behaviours - ESME audible alarm - Supplier") \
218 XXX(GBCS_MESSAGE_ECS25A3, 0x00EC, "ECS25a3 Set Event Behaviours - ESME logging - Supplier") \
219 XXX(GBCS_MESSAGE_ECS25B3, 0x00ED, "ECS25b3 Set Event Behaviours - ESME logging - Network Operator") \
220 XXX(GBCS_MESSAGE_ECS25R1, 0x00EE, "ECS25r1 Read non-critical event and alert behaviours - ESME- Supplier") \
221 XXX(GBCS_MESSAGE_ECS25R2, 0x00EF, "ECS25r2 Read non-critical event and alert behaviours - ESME- Network Operator") \
222 XXX(GBCS_MESSAGE_ALERT_00F0, 0x00F0, "Meter Integrity Issue Warning Alert - ESME") \
223 XXX(GBCS_MESSAGE_GCS20R, 0x00F1, "GCS20r Read non-critical event and alert behaviours - GSME- Supplier") \
224 XXX(GBCS_MESSAGE_ALERT_00F2, 0x00F2, "Meter Integrity Issue Warning Alert - GSME") \
225 XXX(GBCS_MESSAGE_ECS26M, 0x00F9, "ECS26m Read ESME Configuration Data Device Information (identity, type and supply tamper state)") \
226 XXX(GBCS_MESSAGE_ECS26N, 0x00FA, "ECS26n Read CHF Configuration Data Device Information (CH identity and type)") \
227 XXX(GBCS_MESSAGE_GCS21M, 0x00FB, "GCS21m Read GSME Configuration Data Device Information (identity, type and supply tamper / depletion state)") \
228 XXX(GBCS_USECASE_GCS24A, 0x00FC, "GCS24a Set Uncontrolled Gas Flow Rate at greater resolution and Supply Tamper State on the GSME") \
229 XXX(GBCS_MESSAGE_CS02B0, 0x0100, "CS02b Update Security Credentials - rootBySupplier") \
230 XXX(GBCS_MESSAGE_CS02B1, 0x0101, "CS02b Update Security Credentials - rootByWanProvider") \
231 XXX(GBCS_MESSAGE_CS02B2, 0x0102, "CS02b Update Security Credentials - supplierBySupplier") \
232 XXX(GBCS_MESSAGE_CS02B3, 0x0103, "CS02b Update Security Credentials - networkOperatorByNetworkOperator") \
233 XXX(GBCS_MESSAGE_CS02B4, 0x0104, "CS02b Update Security Credentials - accessControlBrokerByACB") \
234 XXX(GBCS_MESSAGE_CS02B5, 0x0105, "CS02b Update Security Credentials - wanProviderByWanProvider") \
235 XXX(GBCS_MESSAGE_CS02B6, 0x0106, "CS02b Update Security Credentials - transCoSByTransCoS") \
236 XXX(GBCS_MESSAGE_CS02B7, 0x0107, "CS02b Update Security Credentials - supplierByTransCoS") \
237 XXX(GBCS_MESSAGE_CS02B8, 0x0108, "CS02b Update Security Credentials - anyExceptAbnormalRootByRecovery") \
238 XXX(GBCS_MESSAGE_CS02B9, 0x0109, "CS02b Update Security Credentials - anyByContingency") \
239 XXX(GBCS_MESSAGE_DBCH01, 0x010A, "DBCH01 Read CHF Sub GHz Channel") \
240 XXX(GBCS_MESSAGE_DBCH02, 0x010B, "DBCH02 Read CHF Sub GHz Channel Log") \
241 XXX(GBCS_MESSAGE_DBCH03, 0x010C, "DBCH03 Read CHF Sub GHz Configuration") \
242 XXX(GBCS_MESSAGE_DBCH04, 0x010D, "DBCH04 Set CHF Sub GHz Configuration") \
243 XXX(GBCS_MESSAGE_DBCH05, 0x010E, "DBCH05 Request CHF Sub GHz Channel Scan") \
244 XXX(GBCS_MESSAGE_CCS06, 0x010F, "CCS06 Read CHF device log and check HAN communications") \
245 XXX(GBCS_MESSAGE_DBCH06, 0x0110, "DBCH06 Limited Duty Cycle Action Taken Sub GHz Alert") \
246 XXX(GBCS_MESSAGE_DBCH07, 0x0111, "DBCH07 Sub GHz Sub GHz Channel Changed Sub GHz Alert") \
247 XXX(GBCS_MESSAGE_DBCH08, 0x0112, "DBCH08 Sub GHz Channel Scan Request Assessment Outcome Sub GHz Alert") \
248 XXX(GBCS_MESSAGE_DBCH09, 0x0113, "DBCH09 Sub GHz Configuration Changed Sub GHz Alert") \
249 XXX(GBCS_MESSAGE_DBCH10, 0x0114, "DBCH10 Message Discarded Due to Duty Cycle Management Sub GHz Alert") \
250 XXX(GBCS_MESSAGE_DBCH11, 0x0115, "DBCH11 No More Sub GHz Device Capacity Sub GHz Alert") \
251 XXX(GBCS_MESSAGE_PECS01, 0x0116, "PECS01 Apply Pre-payment Top Up to an ESME using PPMID") \
252 XXX(GBCS_MESSAGE_PECS02, 0x0117, "PECS02 Activate Emergency Credit on ESME from PPMID") \
253 XXX(GBCS_MESSAGE_PECS03, 0x0118, "PECS03 Request to Enable ESME Supply from PPMID") \
254 XXX(GBCS_MESSAGE_HECS01, 0x0119, "HECS01 Request Control of a HAN Connected Auxiliary Load Control Switch from HCALCS") \
255 XXX(GBCS_MESSAGE_ALERT_1000, 0x1000, "Generic Critical Alert") \
256 XXX(GBCS_MESSAGE_ALERT_1001, 0x1001, "Generic Non Critical Alert")
258 VALUE_STRING_ARRAY(gbcs_message_code_names
);
259 static value_string_ext gbcs_message_code_names_ext
= VALUE_STRING_EXT_INIT(gbcs_message_code_names
);
261 #define gbcs_message_cra_names_VALUE_STRING_LIST(XXX) \
262 XXX(GBCS_MESSAGE_CRA_COMMAND, 0x01, "Command" ) \
263 XXX(GBCS_MESSAGE_CRA_RESPONSE, 0x02, "Response" ) \
264 XXX(GBCS_MESSAGE_CRA_ALERT, 0x03, "Alert" )
266 VALUE_STRING_ENUM(gbcs_message_cra_names
);
267 VALUE_STRING_ARRAY(gbcs_message_cra_names
);
270 dlms_date_time(tvbuff_t
*tvb
, unsigned offset
, nstime_t
*date_time
)
272 //TODO Handle DLMS date never
279 tm
.tm_year
= tvb_get_uint16(tvb
, offset
, ENC_BIG_ENDIAN
) - 1900;
282 tm
.tm_mon
= tvb_get_uint8(tvb
, offset
) - 1; // tm.tm_mon [0-11]
285 tm
.tm_mday
= tvb_get_uint8(tvb
, offset
);
288 offset
+= 1; //Skip week day
290 tm
.tm_hour
= tvb_get_uint8(tvb
, offset
);
293 tm
.tm_min
= tvb_get_uint8(tvb
, offset
);
296 tm
.tm_sec
= tvb_get_uint8(tvb
, offset
);
298 date_time
->secs
= mktime_utc(&tm
);
299 date_time
->nsecs
= 0;
302 /* ########################################################################## */
303 /* #### GBCS GBZ ############################################################ */
304 /* ########################################################################## */
306 #define GBCS_GBZ_MAX_COMPONENTS 31 // GCS16a
307 #define GBCS_GBZ_MAC_LENGTH 12
309 #define GBCS_GBZ_EXTENDED_HEADER_CONTROL_FROM_DATE_TIME_PRESENT 0x10
310 #define GBCS_GBZ_EXTENDED_HEADER_CONTROL_LAST_COMPONENT 0x01
311 #define GBCS_GBZ_EXTENDED_HEADER_CONTROL_ENCRYPTED_COMPONENT 0x02
313 #define gbcs_gbz_alert_code_names_VALUE_STRING_LIST(XXX) \
314 XXX(GBCS_GBZ_ALERT_AVERAGE_RMS_VOLTAGE_ABOVE_AVERAGE_RMS_OVER_VOL_1,0x8002, "Average RMS Voltage above Average RMS Over Voltage Threshold (current value above threshold; previous value below threshold)") \
315 XXX(GBCS_GBZ_ALERT_AVERAGE_RMS_VOLTAGE_ABOVE_AVERAGE_RMS_OVER_VOL_2,0x8003, "Average RMS Voltage above Average RMS Over Voltage Threshold on Phase 1 (current value above threshold; previous value below threshold)") \
316 XXX(GBCS_GBZ_ALERT_AVERAGE_RMS_VOLTAGE_ABOVE_AVERAGE_RMS_OVER_VOL_3,0x8004, "Average RMS Voltage above Average RMS Over Voltage Threshold on Phase 2 (current value above threshold; previous value below threshold)") \
317 XXX(GBCS_GBZ_ALERT_AVERAGE_RMS_VOLTAGE_ABOVE_AVERAGE_RMS_OVER_VOL_4,0x8005, "Average RMS Voltage above Average RMS Over Voltage Threshold on Phase 3 (current value above threshold; previous value below threshold)") \
318 XXX(GBCS_GBZ_ALERT_AVERAGE_RMS_VOLTAGE_BELOW_AVERAGE_RMS_UNDER_VO_1,0x8006, "Average RMS Voltage below Average RMS Under Voltage Threshold (current value below threshold; previous value above threshold)") \
319 XXX(GBCS_GBZ_ALERT_AVERAGE_RMS_VOLTAGE_BELOW_AVERAGE_RMS_UNDER_VO_2,0x8007, "Average RMS Voltage below Average RMS Under Voltage Threshold on Phase 1 (current value below threshold; previous value above threshold)") \
320 XXX(GBCS_GBZ_ALERT_AVERAGE_RMS_VOLTAGE_BELOW_AVERAGE_RMS_UNDER_VO_3,0x8008, "Average RMS Voltage below Average RMS Under Voltage Threshold on Phase 2 (current value below threshold; previous value above threshold)") \
321 XXX(GBCS_GBZ_ALERT_AVERAGE_RMS_VOLTAGE_BELOW_AVERAGE_RMS_UNDER_VO_4,0x8009, "Average RMS Voltage below Average RMS Under Voltage Threshold on Phase 3 (current value below threshold; previous value above threshold)") \
322 XXX(GBCS_GBZ_ALERT_OVER_CURRENT, 0x8010, "Over Current") \
323 XXX(GBCS_GBZ_ALERT_OVER_CURRENT_L1, 0x8011, "Over Current L1") \
324 XXX(GBCS_GBZ_ALERT_OVER_CURRENT_L3, 0x8013, "Over Current L3") \
325 XXX(GBCS_GBZ_ALERT_POWER_FACTOR_THRESHOLD_BELOW, 0x8014, "Power Factor Threshold Below") \
326 XXX(GBCS_GBZ_ALERT_POWER_FACTOR_THRESHOLD_OK, 0x8015, "Power Factor Threshold Ok") \
327 XXX(GBCS_GBZ_ALERT_OVER_CURRENT_L2, 0x8016, "Over Current L2") \
328 XXX(GBCS_GBZ_ALERT_RMS_VOLTAGE_ABOVE_EXTREME_OVER_VOLTAGE_THRESHO_1,0x8020, "RMS Voltage above Extreme Over Voltage Threshold (voltage rises above for longer than the configurable period)") \
329 XXX(GBCS_GBZ_ALERT_RMS_VOLTAGE_ABOVE_EXTREME_OVER_VOLTAGE_THRESHO_2,0x8021, "RMS Voltage above Extreme Over Voltage Threshold on Phase 1 (voltage rises above for longer than the configurable period)") \
330 XXX(GBCS_GBZ_ALERT_RMS_VOLTAGE_ABOVE_EXTREME_OVER_VOLTAGE_THRESHO_3,0x8022, "RMS Voltage above Extreme Over Voltage Threshold on Phase 2 (voltage rises above for longer than the configurable period)") \
331 XXX(GBCS_GBZ_ALERT_RMS_VOLTAGE_ABOVE_EXTREME_OVER_VOLTAGE_THRESHO_4,0x8023, "RMS Voltage above Extreme Over Voltage Threshold on Phase 3 (voltage rises above for longer than the configurable period)") \
332 XXX(GBCS_GBZ_ALERT_RMS_VOLTAGE_ABOVE_VOLTAGE_SWELL_THRESHOLD_VOLT_1,0x8024, "RMS Voltage above Voltage Swell Threshold (voltage rises above for longer than the configurable period)") \
333 XXX(GBCS_GBZ_ALERT_RMS_VOLTAGE_ABOVE_VOLTAGE_SWELL_THRESHOLD_ON_P_2,0x8025, "RMS Voltage above Voltage Swell Threshold on Phase 1 (voltage rises above for longer than the configurable period)") \
334 XXX(GBCS_GBZ_ALERT_RMS_VOLTAGE_ABOVE_VOLTAGE_SWELL_THRESHOLD_ON_P_3,0x8026, "RMS Voltage above Voltage Swell Threshold on Phase 2 (voltage rises above for longer than the configurable period)") \
335 XXX(GBCS_GBZ_ALERT_RMS_VOLTAGE_ABOVE_VOLTAGE_SWELL_THRESHOLD_ON_P_4,0x8027, "RMS Voltage above Voltage Swell Threshold on Phase 3 (voltage rises above for longer than the configurable period)") \
336 XXX(GBCS_GBZ_ALERT_RMS_VOLTAGE_BELOW_EXTREME_UNDER_VOLTAGE_THRESH_1,0x8028, "RMS Voltage below Extreme Under Voltage Threshold (voltage falls below for longer than the configurable period)") \
337 XXX(GBCS_GBZ_ALERT_RMS_VOLTAGE_BELOW_EXTREME_UNDER_VOLTAGE_THRESH_2,0x8029, "RMS Voltage below Extreme Under Voltage Threshold on Phase 1 (voltage falls below for longer than the configurable period)") \
338 XXX(GBCS_GBZ_ALERT_RMS_VOLTAGE_BELOW_EXTREME_UNDER_VOLTAGE_THRESH_3,0x802A, "RMS Voltage below Extreme Under Voltage Threshold on Phase 2 (voltage falls below for longer than the configurable period)") \
339 XXX(GBCS_GBZ_ALERT_RMS_VOLTAGE_BELOW_EXTREME_UNDER_VOLTAGE_THRESH_4,0x802B, "RMS Voltage below Extreme Under Voltage Threshold on Phase 3 (voltage falls below for longer than the configurable period)") \
340 XXX(GBCS_GBZ_ALERT_RMS_VOLTAGE_BELOW_VOLTAGE_SAG_THRESHOLD_VOLTA_1, 0x802C, "RMS Voltage below Voltage Sag Threshold (voltage falls below for longer than the configurable period)") \
341 XXX(GBCS_GBZ_ALERT_RMS_VOLTAGE_BELOW_VOLTAGE_SAG_THRESHOLD_ON_PHA_1,0x802D, "RMS Voltage below Voltage Sag Threshold on Phase 1 (voltage falls below for longer than the configurable period)") \
342 XXX(GBCS_GBZ_ALERT_RMS_VOLTAGE_BELOW_VOLTAGE_SAG_THRESHOLD_ON_PHA_2,0x802E, "RMS Voltage below Voltage Sag Threshold on Phase 2 (voltage falls below for longer than the configurable period)") \
343 XXX(GBCS_GBZ_ALERT_RMS_VOLTAGE_BELOW_VOLTAGE_SAG_THRESHOLD_ON_PHA_3,0x802F, "RMS Voltage below Voltage Sag Threshold on Phase 3 (voltage falls below for longer than the configurable period)") \
344 XXX(GBCS_GBZ_ALERT_GPF_DEVICE_LOG_CHANGED, 0x8071, "GPF Device Log Changed") \
345 XXX(GBCS_GBZ_ALERT_AVERAGE_RMS_VOLTAGE_BELOW_AVERAGE_RMS_OVER_VOL_1,0x8085, "Average RMS Voltage below Average RMS Over Voltage Threshold (current value below threshold; previous value above threshold)") \
346 XXX(GBCS_GBZ_ALERT_AVERAGE_RMS_VOLTAGE_BELOW_AVERAGE_RMS_OVER_VOL_2,0x8086, "Average RMS Voltage below Average RMS Over Voltage Threshold on Phase 1 (current value below threshold; previous value above threshold)") \
347 XXX(GBCS_GBZ_ALERT_AVERAGE_RMS_VOLTAGE_BELOW_AVERAGE_RMS_OVER_VOL_3,0x8087, "Average RMS Voltage below Average RMS Over Voltage Threshold on Phase 2 (current value below threshold; previous value above threshold)") \
348 XXX(GBCS_GBZ_ALERT_AVERAGE_RMS_VOLTAGE_BELOW_AVERAGE_RMS_OVER_VOL_4,0x8088, "Average RMS Voltage below Average RMS Over Voltage Threshold on Phase 3 (current value below threshold; previous value above threshold)") \
349 XXX(GBCS_GBZ_ALERT_AVERAGE_RMS_VOLTAGE_ABOVE_AVERAGE_RMS_UNDER_VO_1,0x8089, "Average RMS Voltage above Average RMS Under Voltage Threshold (current value above threshold; previous value below threshold)") \
350 XXX(GBCS_GBZ_ALERT_AVERAGE_RMS_VOLTAGE_ABOVE_AVERAGE_RMS_UNDER_VO_2,0x808A, "Average RMS Voltage above Average RMS Under Voltage Threshold on Phase 1 (current value above threshold; previous value below threshold)") \
351 XXX(GBCS_GBZ_ALERT_AVERAGE_RMS_VOLTAGE_ABOVE_AVERAGE_RMS_UNDER_VO_3,0x808B, "Average RMS Voltage above Average RMS Under Voltage Threshold on Phase 2 (current value above threshold; previous value below threshold)") \
352 XXX(GBCS_GBZ_ALERT_AVERAGE_RMS_VOLTAGE_ABOVE_AVERAGE_RMS_UNDER_VO_4,0x808C, "Average RMS Voltage above Average RMS Under Voltage Threshold on Phase 3 (current value above threshold; previous value below threshold)") \
353 XXX(GBCS_GBZ_ALERT_RMS_VOLTAGE_ABOVE_EXTREME_OVER_VOLTAGE_THRESHO_5,0x808D, "RMS Voltage above Extreme Over Voltage Threshold (voltage returns below for longer than the configurable period)") \
354 XXX(GBCS_GBZ_ALERT_RMS_VOLTAGE_ABOVE_EXTREME_OVER_VOLTAGE_THRESHO_6,0x808E, "RMS Voltage above Extreme Over Voltage Threshold on Phase 1 (voltage returns below for longer than the configurable period)") \
355 XXX(GBCS_GBZ_ALERT_RMS_VOLTAGE_ABOVE_EXTREME_OVER_VOLTAGE_THRESHO_7,0x808F, "RMS Voltage above Extreme Over Voltage Threshold on Phase 2 (voltage returns below for longer than the configurable period)") \
356 XXX(GBCS_GBZ_ALERT_RMS_VOLTAGE_ABOVE_EXTREME_OVER_VOLTAGE_THRESHO_8,0x8090, "RMS Voltage above Extreme Over Voltage Threshold on Phase 3 (voltage returns below for longer than the configurable period)") \
357 XXX(GBCS_GBZ_ALERT_RMS_VOLTAGE_ABOVE_VOLTAGE_SWELL_THRESHOLD_VOLT_2,0x8091, "RMS Voltage above Voltage Swell Threshold (voltage returns below for longer than the configurable period)") \
358 XXX(GBCS_GBZ_ALERT_RMS_VOLTAGE_ABOVE_VOLTAGE_SWELL_THRESHOLD_ON_P_1,0x8092, "RMS Voltage above Voltage Swell Threshold on Phase 1 (voltage returns below for longer than the configurable period)") \
359 XXX(GBCS_GBZ_ALERT_RMS_VOLTAGE_ABOVE_VOLTAGE_SWELL_THRESHOLD_ON_P_5,0x8093, "RMS Voltage above Voltage Swell Threshold on Phase 2 (voltage returns below for longer than the configurable period)") \
360 XXX(GBCS_GBZ_ALERT_RMS_VOLTAGE_ABOVE_VOLTAGE_SWELL_THRESHOLD_ON_P_6,0x8094, "RMS Voltage above Voltage Swell Threshold on Phase 3 (voltage returns below for longer than the configurable period)") \
361 XXX(GBCS_GBZ_ALERT_RMS_VOLTAGE_BELOW_EXTREME_UNDER_VOLTAGE_THRESH_5,0x8095, "RMS Voltage below Extreme Under Voltage Threshold (voltage returns above for longer than the configurable period)") \
362 XXX(GBCS_GBZ_ALERT_RMS_VOLTAGE_BELOW_EXTREME_UNDER_VOLTAGE_THRESH_6,0x8096, "RMS Voltage below Extreme Under Voltage Threshold on Phase 1 (voltage returns above for longer than the configurable period)") \
363 XXX(GBCS_GBZ_ALERT_RMS_VOLTAGE_BELOW_EXTREME_UNDER_VOLTAGE_THRESH_7,0x8097, "RMS Voltage below Extreme Under Voltage Threshold on Phase 2 (voltage returns above for longer than the configurable period)") \
364 XXX(GBCS_GBZ_ALERT_RMS_VOLTAGE_BELOW_EXTREME_UNDER_VOLTAGE_THRESH_8,0x8098, "RMS Voltage below Extreme Under Voltage Threshold on Phase 3 (voltage returns above for longer than the configurable period)") \
365 XXX(GBCS_GBZ_ALERT_RMS_VOLTAGE_BELOW_VOLTAGE_SAG_THRESHOLD_VOLTA_2, 0x8099, "RMS Voltage below Voltage Sag Threshold (voltage returns above for longer than the configurable period)") \
366 XXX(GBCS_GBZ_ALERT_RMS_VOLTAGE_BELOW_VOLTAGE_SAG_THRESHOLD_ON_PHA_4,0x809A, "RMS Voltage below Voltage Sag Threshold on Phase 1 (voltage returns above for longer than the configurable period)") \
367 XXX(GBCS_GBZ_ALERT_RMS_VOLTAGE_BELOW_VOLTAGE_SAG_THRESHOLD_ON_PHA_5,0x809B, "RMS Voltage below Voltage Sag Threshold on Phase 2 (voltage returns above for longer than the configurable period)") \
368 XXX(GBCS_GBZ_ALERT_RMS_VOLTAGE_BELOW_VOLTAGE_SAG_THRESHOLD_ON_PHA_6,0x809C, "RMS Voltage below Voltage Sag Threshold on Phase 3 (voltage returns above for longer than the configurable period)") \
369 XXX(GBCS_GBZ_ALERT_COMBINED_CREDIT_BELOW_LOW_CREDIT_THRESHOLD_PREPA,0x810D, "Combined Credit Below Low Credit Threshold (prepayment mode)") \
370 XXX(GBCS_GBZ_ALERT_CREDIT_ADDED_LOCALLY, 0x810E, "Credit Added Locally") \
371 XXX(GBCS_GBZ_ALERT_EMERGENCY_CREDIT_HAS_BECOME_AVAILABLE_PREPAYMENT,0x8119, "Emergency Credit Has Become Available (prepayment mode)") \
372 XXX(GBCS_GBZ_ALERT_FAILURE_IN_CHANGING_OR_MAINTAINING_HCALCS_OR_A_1,0x811A, "Failure in changing or maintaining HCALCS or ALCS state") \
373 XXX(GBCS_GBZ_ALERT_SUCCESS_IN_CHANGING_OR_MAINTAINING_HCALCS_OR_A_2,0x8131, "Success in changing or maintaining HCALCS or ALCS state") \
374 XXX(GBCS_GBZ_ALERT_CLOCK_ADJUSTED_WITHIN_TOLERANCE, 0x8145, "Clock adjusted (within tolerance)") \
375 XXX(GBCS_GBZ_ALERT_IMMEDIATE_HAN_INTERFACE_COMMAND_RECEIVED_AND_SUC,0x8154, "Immediate HAN Interface Command Received and Successfully Actioned") \
376 XXX(GBCS_GBZ_ALERT_IMMEDIATE_HAN_INTERFACE_COMMAND_RECEIVED_BUT_NOT,0x8155, "Immediate HAN Interface Command Received but not Successfully Actioned") \
377 XXX(GBCS_GBZ_ALERT_USER_INTERFACE_COMMAND_INPUT_AND_SUCCESSFULLY_AC,0x8161, "User Interface Command Input and Successfully Actioned") \
378 XXX(GBCS_GBZ_ALERT_USER_INTERFACE_COMMAND_INPUT_BUT_NOT_SUCCESSFULL,0x8162, "User Interface Command Input but not Successfully Actioned") \
379 XXX(GBCS_GBZ_ALERT_SUPPLY_DISABLED_THEN_ARMED_ACTIVATE_EMERGENCY, 0x8168, "Supply Disabled then Armed - Activate Emergency Credit triggered") \
380 XXX(GBCS_GBZ_ALERT_DEVICE_JOINED_SMHAN, 0x8183, "Device joined SMHAN") \
381 XXX(GBCS_GBZ_ALERT_VALVE_TESTED, 0x8184, "Valve tested") \
382 XXX(GBCS_GBZ_ALERT_GSME_COMMAND_NOT_RETRIEVED, 0x819D, "GSME Command Not Retrieved") \
383 XXX(GBCS_GBZ_ALERT_TAP_OFF_MESSAGE_RESPONSE_OR_ALERT_FAILURE, 0x819E, "Tap Off Message Response or Alert Failure") \
384 XXX(GBCS_GBZ_ALERT_SMART_METER_INTEGRITY_ISSUE_WARNING, 0x81A0, "Smart Meter Integrity Issue Warning") \
385 XXX(GBCS_GBZ_ALERT_BATTERY_COVER_CLOSED, 0x81A1, "Battery Cover Closed") \
386 XXX(GBCS_GBZ_ALERT_CH_CONNECTED_TO_ESME, 0x81A2, "CH Connected to ESME") \
387 XXX(GBCS_GBZ_ALERT_CH_DISCONNECTED_FROM_ESME, 0x81A3, "CH Disconnected from ESME") \
388 XXX(GBCS_GBZ_ALERT_CLOSE_TUNNEL_COMMAND_REJECTED, 0x81A4, "Close Tunnel Command Rejected") \
389 XXX(GBCS_GBZ_ALERT_COMMUNICATION_FROM_LOCAL_PORT_EG_OPTICAL, 0x81A5, "Communication From Local Port (e.g. Optical)") \
390 XXX(GBCS_GBZ_ALERT_CUSTOMER_ACKNOWLEDGED_MESSAGE_ON_HAN_DEVICE, 0x81A6, "Customer Acknowledged Message on HAN Device") \
391 XXX(GBCS_GBZ_ALERT_DEBT_COLLECTION_COMPLETED_TIME_DEBT_1, 0x81A7, "Debt Collection Completed - Time Debt 1") \
392 XXX(GBCS_GBZ_ALERT_DEBT_COLLECTION_COMPLETED_TIME_DEBT_2, 0x81A8, "Debt Collection Completed - Time Debt 2") \
393 XXX(GBCS_GBZ_ALERT_DEBT_COLLECTION_COMPLETED_PAYMENT_DEBT, 0x81A9, "Debt Collection Completed - Payment Debt") \
394 XXX(GBCS_GBZ_ALERT_EMERGENCY_CREDIT_EXHAUSTED, 0x81AA, "Emergency Credit Exhausted") \
395 XXX(GBCS_GBZ_ALERT_EMERGENCY_CREDIT_ACTIVATED, 0x81AB, "Emergency Credit Activated") \
396 XXX(GBCS_GBZ_ALERT_ERROR_MEASUREMENT_FAULT, 0x81AC, "Error Measurement Fault") \
397 XXX(GBCS_GBZ_ALERT_ERROR_METROLOGY_FIRMWARE_VERIFICATION_FAILURE, 0x81AD, "Error Metrology Firmware Verification Failure") \
398 XXX(GBCS_GBZ_ALERT_ERROR_NON_VOLATILE_MEMORY, 0x81AE, "Error Non Volatile Memory") \
399 XXX(GBCS_GBZ_ALERT_ERROR_PROGRAM_EXECUTION, 0x81AF, "Error Program Execution") \
400 XXX(GBCS_GBZ_ALERT_ERROR_PROGRAM_STORAGE, 0x81B0, "Error Program Storage") \
401 XXX(GBCS_GBZ_ALERT_ERROR_RAM, 0x81B1, "Error RAM") \
402 XXX(GBCS_GBZ_ALERT_ERROR_UNEXPECTED_HARDWARE_RESET, 0x81B2, "Error Unexpected Hardware Reset") \
403 XXX(GBCS_GBZ_ALERT_ERROR_WATCHDOG, 0x81B3, "Error Watchdog ") \
404 XXX(GBCS_GBZ_ALERT_EXCESS_GAS_FLOW_BEYOND_METER_CAPACITY, 0x81B4, "Excess Gas Flow Beyond Meter Capacity") \
405 XXX(GBCS_GBZ_ALERT_FLOW_SENSOR_DETECTS_AIR_IN_GAS_FLOW, 0x81B5, "Flow Sensor Detects Air in Gas Flow") \
406 XXX(GBCS_GBZ_ALERT_FLOW_SENSOR_DETECTS_REVERSE_FLOW_OF_GAS, 0x81B6, "Flow Sensor Detects Reverse Flow of Gas") \
407 XXX(GBCS_GBZ_ALERT_INCORRECT_PHASE_SEQUENCING, 0x81B7, "Incorrect phase sequencing") \
408 XXX(GBCS_GBZ_ALERT_INCORRECT_POLARITY, 0x81B8, "Incorrect Polarity") \
409 XXX(GBCS_GBZ_ALERT_METER_COVER_CLOSED, 0x81B9, "Meter Cover Closed") \
410 XXX(GBCS_GBZ_ALERT_REQUEST_TUNNEL_COMMAND_REJECTED, 0x81BA, "Request Tunnel Command Rejected") \
411 XXX(GBCS_GBZ_ALERT_REVERSE_CURRENT, 0x81BB, "Reverse Current") \
412 XXX(GBCS_GBZ_ALERT_STRONG_MAGNETIC_FIELD_REMOVED, 0x81BC, "Strong Magnetic Field Removed") \
413 XXX(GBCS_GBZ_ALERT_SUPPLY_CONNECT_FAILURE_VALVE_OR_LOAD_SWITCH, 0x81BD, "Supply Connect Failure (Valve or Load Switch)") \
414 XXX(GBCS_GBZ_ALERT_SUPPLY_DISABLED_THEN_LOCKED_SUPPLY_TAMPER_STATE, 0x81BE, "Supply Disabled Then Locked - Supply Tamper State Cause") \
415 XXX(GBCS_GBZ_ALERT_SUPPLY_DISABLED_THEN_ARMED_UNCONTROLLED_GAS_FLOW,0x81BF, "Supply Disabled Then Armed - Uncontrolled Gas Flow Rate") \
416 XXX(GBCS_GBZ_ALERT_SUPPLY_DISCONNECT_FAILURE_VALVE_OR_LOAD_SWITCH, 0x81C0, "Supply Disconnect Failure (Valve or Load Switch)") \
417 XXX(GBCS_GBZ_ALERT_TERMINAL_COVER_CLOSED, 0x81C1, "Terminal Cover Closed") \
418 XXX(GBCS_GBZ_ALERT_TILT_TAMPER_ENDED, 0x81C2, "Tilt Tamper Ended") \
419 XXX(GBCS_GBZ_ALERT_TILT_TAMPER, 0x81C3, "Tilt Tamper") \
420 XXX(GBCS_GBZ_ALERT_UTRN_MANUAL_ENTRY_SUSPENDED, 0x81C4, "UTRN Manual Entry Suspended") \
421 XXX(GBCS_GBZ_ALERT_UTRN_REJECTED_AS_LOCKED_OUT, 0x81C5, "UTRN rejected as locked out") \
422 XXX(GBCS_GBZ_ALERT_CLOCK_NOT_ADJUSTED_OUTSIDE_TOLERANCE, 0x81C6, "Clock not adjusted (outside tolerance)") \
423 XXX(GBCS_GBZ_ALERT_ACTIVE_POWER_IMPORT_ABOVE_LOAD_LIMIT_THRESHOLD, 0x8F01, "Active Power Import above Load Limit Threshold") \
424 XXX(GBCS_GBZ_ALERT_BILLING_DATA_LOG_UPDATED, 0x8F0A, "Billing Data Log Updated") \
425 XXX(GBCS_GBZ_ALERT_CLOCK_NOT_ADJUSTED_ADJUSTMENT_GREATER_THAN_10_SE,0x8F0C, "Clock not adjusted (adjustment greater than 10 seconds)") \
426 XXX(GBCS_GBZ_ALERT_CREDIT_BELOW_DISABLEMENT_THRESHOLD_PREPAYMENT_MO,0x8F0F, "Credit Below Disablement Threshold (prepayment mode)") \
427 XXX(GBCS_GBZ_ALERT_CHF_DEVICE_LOG_CHANGED, 0x8F12, "CHF Device Log Changed") \
428 XXX(GBCS_GBZ_ALERT_FIRMWARE_VERIFICATION_FAILED_AT_POWER_ON, 0x8F1B, "Firmware Verification Failed At Power On") \
429 XXX(GBCS_GBZ_ALERT_FIRMWARE_VERIFICATION_FAILED, 0x8F1C, "Firmware Verification Failed") \
430 XXX(GBCS_GBZ_ALERT_GSME_POWER_SUPPLY_LOSS, 0x8F1D, "GSME Power Supply Loss") \
431 XXX(GBCS_GBZ_ALERT_INTEGRITY_CHECK_OF_CONTENT_OR_FORMAT_OF_COMMAND, 0x8F1E, "Integrity check of content or format of command failed") \
432 XXX(GBCS_GBZ_ALERT_LOW_BATTERY_CAPACITY, 0x8F1F, "Low Battery Capacity") \
433 XXX(GBCS_GBZ_ALERT_LIMITED_DUTY_CYCLE_ACTION_TAKEN, 0x8F20, "Limited Duty Cycle Action Taken") \
434 XXX(GBCS_GBZ_ALERT_DUTY_CYCLE_FALL_BELOW_NORMAL_LIMITED, 0x8F21, "Duty Cycle fallen below Normal-Limited Duty Cycle Threshold") \
435 XXX(GBCS_GBZ_ALERT_CRITICAL_DUTY_CYCLE_ACTION_TAKEN, 0x8F22, "Critical Duty Cycle Action Taken") \
436 XXX(GBCS_GBZ_ALERT_DUTY_CYCLE_FALL_BELOW_LIMITED_CRITICAL, 0x8F23, "Duty Cycle fallen below Limited-Critical Duty Cycle Threshold") \
437 XXX(GBCS_GBZ_ALERT_REGULATED_DUTY_CYCLE_ACTION_TAKEN, 0x8F24, "Regulated Duty Cycle Action Taken") \
438 XXX(GBCS_GBZ_ALERT_DUTY_CYCLE_FALL_BELOW_CRITICAL_REGULATED, 0x8F25, "Duty Cycle fallen below Critical-Regulated Duty Cycle Threshold") \
439 XXX(GBCS_GBZ_ALERT_SUB_GHZ_CHANNEL_CHANGED, 0x8F26, "Sub GHz Channel Changed") \
440 XXX(GBCS_GBZ_ALERT_SUB_GHZ_CHANNEL_SCAN_INITIATED, 0x8F27, "Sub GHz Channel Scan initiated") \
441 XXX(GBCS_GBZ_ALERT_SUB_GHZ_CHANNEL_SCAN_REQUEST_ASSESSMENT_OUTCOME, 0x8F28, "Sub GHz Channel Scan Request Assessment Outcome") \
442 XXX(GBCS_GBZ_ALERT_THREE_LOST_GSME_SEARCHES_FAILED, 0x8F29, "Three Lost GSME Searches Failed") \
443 XXX(GBCS_GBZ_ALERT_SUB_GHZ_CONFIGURATION_CHANGED, 0x8F2A, "Sub GHz Configuration Changed") \
444 XXX(GBCS_GBZ_ALERT_SUB_GHZ_CHANNEL_NOT_CHANGED_DUE_TO_FREQUENCY_AGI,0x8F2B, "Sub GHz Channel not changed due to Frequency Agility Parameters") \
445 XXX(GBCS_GBZ_ALERT_MESSAGE_DISCARDED_DUE_TO_DUTY_CYCLE_MANAGEMENT, 0x8F2C, "Message Discarded Due to Duty Cycle Management") \
446 XXX(GBCS_GBZ_ALERT_NO_MORE_SUB_GHZ_DEVICE_CAPACITY, 0x8F2D, "No More Sub GHz Device Capacity") \
447 XXX(GBCS_GBZ_ALERT_SOURCE_DOES_NOT_HAVE_AUTHORITY_FOR_COMMAND, 0x8F30, "Source Does not have Authority for Command") \
448 XXX(GBCS_GBZ_ALERT_SUPPLY_ARMED, 0x8F32, "Supply Armed") \
449 XXX(GBCS_GBZ_ALERT_SUPPLY_DISABLED_THEN_ARMED_LOAD_LIMIT_TRIGGERED, 0x8F33, "Supply Disabled then Armed - Load Limit triggered") \
450 XXX(GBCS_GBZ_ALERT_SUPPLY_ENABLED_AFTER_LOAD_LIMIT_RESTORATION_PERI,0x8F34, "Supply Enabled after Load Limit Restoration Period (Load Limit triggered)") \
451 XXX(GBCS_GBZ_ALERT_SUPPLY_OUTAGE_RESTORED, 0x8F35, "Supply Outage Restored") \
452 XXX(GBCS_GBZ_ALERT_SUPPLY_OUTAGE_RESTORED_OUTAGE_3_MINUTES, 0x8F36, "Supply Outage Restored - Outage >= 3 minutes") \
453 XXX(GBCS_GBZ_ALERT_SUPPLY_OUTAGE_RESTORED_ON_PHASE_1, 0x8F37, "Supply Outage Restored on Phase 1") \
454 XXX(GBCS_GBZ_ALERT_SUPPLY_OUTAGE_RESTORED_ON_PHASE_1_RESTORED_OUTAG,0x8F38, "Supply Outage Restored on Phase 1 Restored - Outage >= 3 minutes") \
455 XXX(GBCS_GBZ_ALERT_SUPPLY_OUTAGE_RESTORED_ON_PHASE_2_RESTORED, 0x8F39, "Supply Outage Restored on Phase 2 Restored") \
456 XXX(GBCS_GBZ_ALERT_SUPPLY_OUTAGE_RESTORED_ON_PHASE_2_RESTORED_OUTAG,0x8F3A, "Supply Outage Restored on Phase 2 Restored - Outage >= 3 minutes") \
457 XXX(GBCS_GBZ_ALERT_SUPPLY_OUTAGE_RESTORED_ON_PHASE_3_RESTORED, 0x8F3B, "Supply Outage Restored on Phase 3 Restored") \
458 XXX(GBCS_GBZ_ALERT_SUPPLY_OUTAGE_RESTORED_ON_PHASE_3_RESTORED_OUTAG,0x8F3C, "Supply Outage Restored on Phase 3 Restored - Outage >= 3 minutes") \
459 XXX(GBCS_GBZ_ALERT_TRUSTED_SOURCE_AUTHENTICATION_FAILURE, 0x8F3D, "Trusted Source Authentication Failure") \
460 XXX(GBCS_GBZ_ALERT_UNAUTHORISED_COMMUNICATION_ACCESS_ATTEMPTED, 0x8F3E, "Unauthorised Communication Access attempted") \
461 XXX(GBCS_GBZ_ALERT_UNAUTHORISED_PHYSICAL_ACCESS_TAMPER_DETECT, 0x8F3F, "Unauthorised Physical Access - Tamper Detect") \
462 XXX(GBCS_GBZ_ALERT_CHANGE_IN_THE_EXECUTING_FIRMWARE_VERSION, 0x8F43, "Change in the executing Firmware version") \
463 XXX(GBCS_GBZ_ALERT_CREDIT_WOULD_CAUSE_METER_BALANCE_TO_EXCEED_MAXIM,0x8F47, "Credit would cause Meter Balance to exceed Maximum Meter Balance Threshold") \
464 XXX(GBCS_GBZ_ALERT_DEVICE_JOINING_FAILED, 0x8F48, "Device joining failed") \
465 XXX(GBCS_GBZ_ALERT_DEVICE_JOINING_SUCCEEDED, 0x8F49, "Device joining succeeded ") \
466 XXX(GBCS_GBZ_ALERT_DEVICE_UNJOINING_FAILED, 0x8F4A, "Device Unjoining failed ") \
467 XXX(GBCS_GBZ_ALERT_DEVICE_UNJOINING_SUCCEEDED, 0x8F4B, "Device Unjoining succeeded ") \
468 XXX(GBCS_GBZ_ALERT_DEVICE_OWN_DIGITAL_SIGNING_CERT_REPLACEME_FAILED,0x8F4C, "Device's own Digital Signing Certificate replacement failed") \
469 XXX(GBCS_GBZ_ALERT_DEVICE_OWN_DIGITAL_SIGNING_CERT_REPLACEME_SUCCES,0x8F4D, "Device's own Digital Signing Certificate replacement succeeded") \
470 XXX(GBCS_GBZ_ALERT_DEVICE_OWN_KEY_AGREEMENT_CERTIFICATE_REP_FAILED, 0x8F4E, "Device's own Key Agreement Certificate replacement failed") \
471 XXX(GBCS_GBZ_ALERT_DEVICE_OWN_KEY_AGREEMENT_CERTIFICATE_REP_SUCCEED,0x8F4F, "Device's own Key Agreement Certificate replacement succeeded") \
472 XXX(GBCS_GBZ_ALERT_DUPLICATE_UTRN_ENTERED, 0x8F51, "Duplicate UTRN entered") \
473 XXX(GBCS_GBZ_ALERT_EVENT_LOG_CLEARED, 0x8F52, "Event Log Cleared") \
474 XXX(GBCS_GBZ_ALERT_FAILED_AUTHENTICATION_OR_AUTHORISATION_NOT_COVER,0x8F53, "Failed Authentication or Authorisation not covered by other codes") \
475 XXX(GBCS_GBZ_ALERT_SUPPLY_INTERRUPTED, 0x8F57, "Supply interrupted") \
476 XXX(GBCS_GBZ_ALERT_SUPPLY_INTERRUPTED_ON_PHASE_1, 0x8F58, "Supply interrupted on Phase 1") \
477 XXX(GBCS_GBZ_ALERT_SUPPLY_INTERRUPTED_ON_PHASE_2, 0x8F59, "Supply interrupted on Phase 2") \
478 XXX(GBCS_GBZ_ALERT_SUPPLY_INTERRUPTED_ON_PHASE_3, 0x8F5A, "Supply interrupted on Phase 3") \
479 XXX(GBCS_GBZ_ALERT_UTRN_EXCEEDS_MAXIMUM_CREDIT_THRESHOLD, 0x8F5B, "UTRN exceeds Maximum Credit Threshold") \
480 XXX(GBCS_GBZ_ALERT_UNUSUAL_NUMBERS_OF_MALFORMED_OUT_OF_ORDER_OR_UNE,0x8F60, "Unusual numbers of malformed, out-of-order or unexpected Commands received") \
481 XXX(GBCS_GBZ_ALERT_UTRN_NOT_AUTHENTIC, 0x8F63, "UTRN not Authentic") \
482 XXX(GBCS_GBZ_ALERT_UTRN_NOT_FOR_THIS_DEVICE, 0x8F64, "UTRN not for this Device") \
483 XXX(GBCS_GBZ_ALERT_FUTURE_DATE_HAN_INTERFACE_CMD_SUCCESS_ACTIONED, 0x8F66, "Future date HAN Interface Command Successfully Actioned") \
484 XXX(GBCS_GBZ_ALERT_FUTURE_DATE_HAN_INTERFACE_CMD_NOT_SUCCESS_ACTION,0x8F67, "Future date HAN Interface Command not Successfully Actioned") \
485 XXX(GBCS_GBZ_ALERT_DEVICE_COMMISSIONED, 0x8F69, "Device commissioned") \
486 XXX(GBCS_GBZ_ALERT_UPDATE_SECURITY_CREDENTIALS, 0x8F70, "Update Security Credentials") \
487 XXX(GBCS_GBZ_ALERT_FIRMWARE_VERIFICATION_SUCCESSFUL, 0x8F72, "Firmware Verification Successful") \
488 XXX(GBCS_GBZ_ALERT_UNAUTHORISED_PHYSICAL_ACCESS_BATTERY_COVER_REMOV,0x8F73, "Unauthorised Physical Access - Battery Cover Removed") \
489 XXX(GBCS_GBZ_ALERT_UNAUTHORISED_PHYSICAL_ACCESS_METER_COVER_REMOVED,0x8F74, "Unauthorised Physical Access - Meter Cover Removed") \
490 XXX(GBCS_GBZ_ALERT_UNAUTHORISED_PHYSICAL_ACCESS_STRONG_MAGNETIC_FIE,0x8F75, "Unauthorised Physical Access - Strong Magnetic field") \
491 XXX(GBCS_GBZ_ALERT_UNAUTHORISED_PHYSICAL_ACCESS_TERMINAL_COVER_REMO,0x8F76, "Unauthorised Physical Access - Terminal Cover Removed") \
492 XXX(GBCS_GBZ_ALERT_UNAUTHORISED_PHYSICAL_ACCESS_SECOND_TERMINAL_COV,0x8F77, "Unauthorised Physical Access - Second Terminal Cover Removed") \
493 XXX(GBCS_GBZ_ALERT_UNAUTHORISED_PHYSICAL_ACCESS_OTHER, 0x8F78, "Unauthorised Physical Access - Other") \
494 XXX(GBCS_GBZ_ALERT_REMAINING_BATTERY_CAPACITY_RESET, 0x8F82, "Remaining Battery Capacity reset") \
495 XXX(GBCS_GBZ_ALERT_DISABLEMENT_OF_SUPPLY_INS_CREDIT_SUSPENDED, 0x8F83, "Disablement of Supply due to insufficient credit has been suspended") \
496 XXX(GBCS_GBZ_ALERT_FAILURE_TO_DELIVER_REMOTE_PARTY_MESSAGE_TO_ESME, 0x8F84, "Failure to Deliver Remote Party Message to ESME")
498 VALUE_STRING_ENUM(gbcs_gbz_alert_code_names
);
499 VALUE_STRING_ARRAY(gbcs_gbz_alert_code_names
);
500 static value_string_ext gbcs_gbz_alert_code_names_ext
= VALUE_STRING_EXT_INIT(gbcs_gbz_alert_code_names
);
502 #define gbcs_gbz_integrity_issue_warning_names_VALUE_STRING_LIST(XXX) \
503 XXX(GBCS_GBZ_INTEGRITY_ISSUE_WARNING_OTHER, 0x0000, "Other" ) \
504 XXX(GBCS_GBZ_INTEGRITY_ISSUE_WARNING_ERROR_NON_VOLATILE_MEMORY, 0x0001, "Error Non Volatile Memory" ) \
505 XXX(GBCS_GBZ_INTEGRITY_ISSUE_WARNING_ERROR_PROGRAM_EXECUTION, 0x0002, "Error Program Execution" ) \
506 XXX(GBCS_GBZ_INTEGRITY_ISSUE_WARNING_ERROR_PROGRAM_STORAGE, 0x0003, "Error Program Storage" ) \
507 XXX(GBCS_GBZ_INTEGRITY_ISSUE_WARNING_ERROR_RAM, 0x0004, "Error RAM" ) \
508 XXX(GBCS_GBZ_INTEGRITY_ISSUE_WARNING_ERROR_UNEXPECTED_HW_RESET, 0x0005, "Error Unexpected Hardware Reset" ) \
509 XXX(GBCS_GBZ_INTEGRITY_ISSUE_WARNING_ERROR_WATCHDOG, 0x0006, "Error Watchdog" ) \
510 XXX(GBCS_GBZ_INTEGRITY_ISSUE_WARNING_ERROR_MET_FW_VERIFICATION_FAIL,0x0007, "Error Metrology Firmware Verification Failure" ) \
511 XXX(GBCS_GBZ_INTEGRITY_ISSUE_WARNING_ERROR_MEASUREMENT_FAULT, 0x0008, "Error Measurement Fault" ) \
512 XXX(GBCS_GBZ_INTEGRITY_ISSUE_WARNING_UNSPEC_SMART_METER_OP_INT_ERR, 0x0009, "Unspecified Smart Meter Operational Integrity Error" )
514 VALUE_STRING_ENUM(gbcs_gbz_integrity_issue_warning_names
);
515 VALUE_STRING_ARRAY(gbcs_gbz_integrity_issue_warning_names
);
517 static dissector_handle_t zcl_handle
;
519 static int proto_gbcs_gbz
;
521 static int hf_gbcs_gbz_profile_id
;
522 static int hf_gbcs_gbz_components
;
523 static int hf_gbcs_gbz_extended_header_control
;
524 static int hf_gbcs_gbz_extended_header_cluster
;
525 static int hf_gbcs_gbz_extended_header_length
;
526 static int hf_gbcs_gbz_alert_code
;
527 static int hf_gbcs_gbz_timestamp
;
528 static int hf_gbcs_gbz_firmware_alert_start
;
529 static int hf_gbcs_gbz_firmware_hash
;
530 static int hf_gbcs_gbz_future_alert_start
;
531 static int hf_gbcs_gbz_message_code
;
532 static int hf_gbcs_gbz_originator_counter
;
533 static int hf_gbcs_gbz_frame_control
;
534 static int hf_gbcs_gbz_command_id
;
535 static int hf_gbcs_gbz_integrity_issue_warning
;
536 static int hf_gbcs_gbz_from_date_time
;
537 static int hf_gbcs_gbz_additional_header_control
;
538 static int hf_gbcs_gbz_additional_frame_counter
;
539 static int hf_gbcs_gbz_transaction
;
540 static int hf_gbcs_gbz_length_of_ciphered_information
;
541 static int hf_gbcs_gbz_security_control
;
542 static int hf_gbcs_gbz_invocation_counter
;
543 static int hf_gbcs_gbz_encrypted_payload
;
544 static int hf_gbcs_gbz_mac
;
546 static int ett_gbcs_gbz
;
547 static int ett_gbcs_gbz_components
[GBCS_GBZ_MAX_COMPONENTS
];
549 static expert_field ei_gbcs_gbz_invalid_length
;
551 void proto_register_gbcs_gbz(void);
552 void proto_reg_handoff_gbcs_gbz(void);
554 static void dissect_gbcs_gbz_component(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, unsigned *offset
, unsigned component_index
)
557 proto_tree
*component_tree
;
558 uint32_t component_len
;
560 bool fromdatetime_present
;
561 bool encryption_present
;
562 uint32_t extended_header_control
;
564 if (component_index
> GBCS_GBZ_MAX_COMPONENTS
- 1) {
565 component_index
= GBCS_GBZ_MAX_COMPONENTS
- 1;
568 component_tree
= proto_tree_add_subtree(tree
, tvb
, *offset
, 1, ett_gbcs_gbz_components
[component_index
], &ti
, "Use Case Component");
570 proto_tree_add_item_ret_uint(component_tree
, hf_gbcs_gbz_extended_header_control
, tvb
, *offset
, 1, ENC_NA
, &extended_header_control
);
571 fromdatetime_present
= extended_header_control
& GBCS_GBZ_EXTENDED_HEADER_CONTROL_FROM_DATE_TIME_PRESENT
;
572 encryption_present
= extended_header_control
& GBCS_GBZ_EXTENDED_HEADER_CONTROL_ENCRYPTED_COMPONENT
;
575 proto_tree_add_item_ret_uint(component_tree
, hf_gbcs_gbz_extended_header_cluster
, tvb
, *offset
, 2, ENC_BIG_ENDIAN
, &cluster
);
578 proto_tree_add_item_ret_uint(component_tree
, hf_gbcs_gbz_extended_header_length
, tvb
, *offset
, 2, ENC_BIG_ENDIAN
, &component_len
);
581 if ((int)component_len
> tvb_reported_length_remaining(tvb
, *offset
)) {
582 expert_add_info(pinfo
, tree
, &ei_gbcs_gbz_invalid_length
);
585 if (fromdatetime_present
) {
586 proto_tree_add_item(component_tree
, hf_gbcs_gbz_from_date_time
, tvb
, *offset
, 4, ENC_TIME_ZBEE_ZCL
|ENC_BIG_ENDIAN
);
590 if (encryption_present
) {
591 proto_tree_add_item(component_tree
, hf_gbcs_gbz_additional_header_control
, tvb
, *offset
, 1, ENC_NA
);
595 proto_tree_add_item(component_tree
, hf_gbcs_gbz_additional_frame_counter
, tvb
, *offset
, 1, ENC_NA
);
599 proto_tree_add_item(component_tree
, hf_gbcs_gbz_frame_control
, tvb
, *offset
, 1, ENC_NA
);
603 proto_tree_add_item(component_tree
, hf_gbcs_gbz_transaction
, tvb
, *offset
, 1, ENC_NA
);
607 proto_tree_add_item(component_tree
, hf_gbcs_gbz_command_id
, tvb
, *offset
, 1, ENC_NA
);
611 if (encryption_present
) {
612 proto_tree_add_item(component_tree
, hf_gbcs_gbz_length_of_ciphered_information
, tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
616 proto_tree_add_item(component_tree
, hf_gbcs_gbz_security_control
, tvb
, *offset
, 1, ENC_NA
);
620 proto_tree_add_item(component_tree
, hf_gbcs_gbz_invocation_counter
, tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
624 if (component_len
< GBCS_GBZ_MAC_LENGTH
) {
625 expert_add_info(pinfo
, tree
, &ei_gbcs_gbz_invalid_length
);
628 proto_tree_add_item(component_tree
, hf_gbcs_gbz_encrypted_payload
, tvb
, *offset
, component_len
- GBCS_GBZ_MAC_LENGTH
, ENC_NA
);
629 *offset
+= component_len
- GBCS_GBZ_MAC_LENGTH
;
631 proto_tree_add_item(component_tree
, hf_gbcs_gbz_mac
, tvb
, *offset
, GBCS_GBZ_MAC_LENGTH
, ENC_NA
);
632 *offset
+= GBCS_GBZ_MAC_LENGTH
;
634 else if (zcl_handle
) {
636 tvbuff_t
*payload_tvb
;
638 wmem_strbuf_t
*strbuf
;
640 text
= col_get_text(pinfo
->cinfo
, COL_INFO
);
642 strbuf
= wmem_strbuf_new(pinfo
->pool
, text
);
644 nwk
.cluster_id
= cluster
;
645 payload_tvb
= tvb_new_subset_length(tvb
, *offset
- 3, component_len
+ 3);
646 call_dissector_with_data(zcl_handle
, payload_tvb
, pinfo
, component_tree
, &nwk
);
648 col_add_str(pinfo
->cinfo
, COL_INFO
, wmem_strbuf_get_str(strbuf
));
650 *offset
+= component_len
;
652 proto_item_set_end(ti
, tvb
, *offset
);
655 static int dissect_gbcs_gbz(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data
)
658 proto_tree
*gbz_tree
;
660 uint8_t cra
= *(uint8_t*)data
;
662 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "GBCS GBZ");
664 ti
= proto_tree_add_item(tree
, proto_gbcs_gbz
, tvb
, 0, -1, ENC_NA
);
665 gbz_tree
= proto_item_add_subtree(ti
, ett_gbcs_gbz
);
667 proto_tree_add_item(gbz_tree
, hf_gbcs_gbz_profile_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
670 proto_tree_add_item(gbz_tree
, hf_gbcs_gbz_components
, tvb
, offset
, 1, ENC_NA
);
673 if (cra
== GBCS_MESSAGE_CRA_ALERT
) {
677 proto_tree_add_item_ret_uint(gbz_tree
, hf_gbcs_gbz_alert_code
, tvb
, offset
, 2, ENC_BIG_ENDIAN
, &alert_code
);
678 col_append_sep_str(pinfo
->cinfo
, COL_INFO
, NULL
, val_to_str_ext_const(alert_code
, &gbcs_gbz_alert_code_names_ext
, "Unknown alert"));
681 timestamp
.secs
= (time_t)tvb_get_ntohl(tvb
, offset
) + EPOCH_DELTA_2000_01_01_00_00_00_UTC
;
683 proto_tree_add_time(gbz_tree
, hf_gbcs_gbz_timestamp
, tvb
, offset
, 4, ×tamp
);
686 switch (alert_code
) {
687 case GBCS_GBZ_ALERT_FIRMWARE_VERIFICATION_FAILED
:
688 case GBCS_GBZ_ALERT_FIRMWARE_VERIFICATION_SUCCESSFUL
:
689 proto_tree_add_item(gbz_tree
, hf_gbcs_gbz_firmware_alert_start
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
692 proto_tree_add_item(gbz_tree
, hf_gbcs_gbz_firmware_hash
, tvb
, offset
, 32, ENC_NA
);
695 case GBCS_GBZ_ALERT_FUTURE_DATE_HAN_INTERFACE_CMD_SUCCESS_ACTIONED
:
696 case GBCS_GBZ_ALERT_FUTURE_DATE_HAN_INTERFACE_CMD_NOT_SUCCESS_ACTION
:
697 if (tvb_get_uint8(tvb
, offset
) == 0x0E) {
698 proto_tree_add_item(gbz_tree
, hf_gbcs_gbz_future_alert_start
, tvb
, offset
, 1, ENC_NA
);
701 proto_tree_add_item(gbz_tree
, hf_gbcs_gbz_message_code
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
704 proto_tree_add_item(gbz_tree
, hf_gbcs_gbz_originator_counter
, tvb
, offset
, 8, ENC_BIG_ENDIAN
);
707 proto_tree_add_item(gbz_tree
, hf_gbcs_gbz_extended_header_cluster
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
710 proto_tree_add_item(gbz_tree
, hf_gbcs_gbz_frame_control
, tvb
, offset
, 1, ENC_NA
);
713 proto_tree_add_item(gbz_tree
, hf_gbcs_gbz_command_id
, tvb
, offset
, 1, ENC_NA
);
717 case GBCS_GBZ_ALERT_BILLING_DATA_LOG_UPDATED
:
718 dissect_gbcs_gbz_component(tvb
, pinfo
, gbz_tree
, &offset
, 0);
720 case GBCS_GBZ_ALERT_SMART_METER_INTEGRITY_ISSUE_WARNING
:
721 proto_tree_add_item(gbz_tree
, hf_gbcs_gbz_integrity_issue_warning
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
729 unsigned component_index
= 0;
731 while (tvb_reported_length_remaining(tvb
, offset
) > 0) {
732 dissect_gbcs_gbz_component(tvb
, pinfo
, gbz_tree
, &offset
, component_index
++);
736 return tvb_captured_length(tvb
);
739 void proto_register_gbcs_gbz(void)
741 static hf_register_info hf
[] = {
742 {&hf_gbcs_gbz_profile_id
,
743 {"Profile ID", "gbcs_gbz.profile_id",
744 FT_UINT16
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}
746 {&hf_gbcs_gbz_components
,
747 {"Total number of GBZ Use Case Specific Component(s)", "gbcs_gbz.components",
748 FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}
750 {&hf_gbcs_gbz_extended_header_control
,
751 {"Extended Header Control Field", "gbcs_gbz.extended_header_control",
752 FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}
754 {&hf_gbcs_gbz_extended_header_cluster
,
755 {"Extended Header Cluster ID", "gbcs_gbz.extended_header_cluster",
756 FT_UINT16
, BASE_HEX
| BASE_RANGE_STRING
, RVALS(zbee_aps_cid_names
), 0x0, NULL
, HFILL
}
758 {&hf_gbcs_gbz_extended_header_length
,
759 {"Extended Header Length", "gbcs_gbz.extended_header_length",
760 FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}
762 {&hf_gbcs_gbz_alert_code
,
763 {"Alert Code", "gbcs_gbz.alert_code",
764 FT_UINT16
, BASE_HEX
| BASE_EXT_STRING
, &gbcs_gbz_alert_code_names_ext
, 0x0, NULL
, HFILL
}
766 {&hf_gbcs_gbz_timestamp
,
767 {"Timestamp", "gbcs_gbz.timestamp",
768 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_UTC
, NULL
, 0x0, NULL
, HFILL
}
770 {&hf_gbcs_gbz_firmware_alert_start
,
771 {"Firmware Alert Start", "gbcs_gbz.firmware_alert_start",
772 FT_UINT16
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}
774 {&hf_gbcs_gbz_firmware_hash
,
775 {"Calculated Manufacture Image Hash", "gbcs_gbz.firmware_hash",
776 FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}
778 {&hf_gbcs_gbz_future_alert_start
,
779 {"Future Dated Command Alert Start", "gbcs_gbz.future_alert_start",
780 FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}
782 {&hf_gbcs_gbz_message_code
,
783 {"Message Code", "gbcs_gbz.message_code",
784 FT_UINT16
, BASE_HEX
| BASE_EXT_STRING
, &gbcs_message_code_names_ext
, 0x0, NULL
, HFILL
}
786 {&hf_gbcs_gbz_originator_counter
,
787 {"Originator Counter", "gbcs_gbz.originator_counter",
788 FT_UINT64
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}
790 {&hf_gbcs_gbz_frame_control
,
791 {"Frame Control", "gbcs_gbz.frame_control",
792 FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}
794 {&hf_gbcs_gbz_command_id
,
795 {"Command Identifier", "gbcs_gbz.command_id",
796 FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}
798 {&hf_gbcs_gbz_integrity_issue_warning
,
799 {"Integrity Issue Warning", "gbcs_gbz.integrity_issue_warning",
800 FT_UINT16
, BASE_HEX
, VALS(gbcs_gbz_integrity_issue_warning_names
), 0x0, NULL
, HFILL
}
802 {&hf_gbcs_gbz_from_date_time
,
803 {"From Date Time", "gbcs_gbz.from_date_time",
804 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_UTC
, NULL
, 0x0, NULL
, HFILL
}
806 {&hf_gbcs_gbz_additional_header_control
,
807 {"Additional Header Control", "gbcs_gbz.additional_header_control",
808 FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}
810 {&hf_gbcs_gbz_additional_frame_counter
,
811 {"Additional Header Frame Counter", "gbcs_gbz.additional_frame_counter",
812 FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}
814 {&hf_gbcs_gbz_transaction
,
815 {"Transaction Sequence Number", "gbcs_gbz.transaction",
816 FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}
818 {&hf_gbcs_gbz_length_of_ciphered_information
,
819 {"Length of Ciphered Information", "gbcs_gbz.length_of_ciphered_information",
820 FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}
822 {&hf_gbcs_gbz_security_control
,
823 {"Security Control", "gbcs_gbz.security_control",
824 FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}
826 {&hf_gbcs_gbz_invocation_counter
,
827 {"Invocation Counter", "gbcs_gbz.invocation_counter",
828 FT_UINT32
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}
830 {&hf_gbcs_gbz_encrypted_payload
,
831 {"Encrypted ZCL Payload", "gbcs_gbz.encrypted_payload",
832 FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}
835 {"Encrypted ZCL MAC", "gbcs_gbz.mac",
836 FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}
840 static int *ett
[1 + GBCS_GBZ_MAX_COMPONENTS
];
843 ett
[j
++] = &ett_gbcs_gbz
;
844 for (int i
= 0; i
< GBCS_GBZ_MAX_COMPONENTS
; i
++, j
++) {
845 ett
[j
] = &ett_gbcs_gbz_components
[i
];
848 expert_module_t
* expert_gbcs_gbz
;
849 static ei_register_info ei
[] = {
850 { &ei_gbcs_gbz_invalid_length
,
851 { "gbcs_gbz.invalid_length", PI_PROTOCOL
, PI_WARN
, "Invalid length", EXPFILL
}}
854 proto_gbcs_gbz
= proto_register_protocol("GBCS GBZ", "GBCS GBZ", "gbcs_gbz");
855 register_dissector("gbcs_gbz", dissect_gbcs_gbz
, proto_gbcs_gbz
);
856 proto_register_field_array(proto_gbcs_gbz
, hf
, array_length(hf
));
857 proto_register_subtree_array(ett
, array_length(ett
));
859 expert_gbcs_gbz
= expert_register_protocol(proto_gbcs_gbz
);
860 expert_register_field_array(expert_gbcs_gbz
, ei
, array_length(ei
));
863 void proto_reg_handoff_gbcs_gbz(void)
865 zcl_handle
= find_dissector(ZBEE_PROTOABBREV_ZCL
);
868 /* ########################################################################## */
869 /* #### GBCS Tunnel ######################################################### */
870 /* ########################################################################## */
872 #define gbcs_tunnel_command_names_VALUE_STRING_LIST(XXX) \
873 XXX(GBCS_TUNNEL_COMMAND_GET, 0x01, "GET" ) \
874 XXX(GBCS_TUNNEL_COMMAND_GET_RESPONSE, 0x02, "GET-RESPONSE" ) \
875 XXX(GBCS_TUNNEL_COMMAND_PUT, 0x03, "PUT" )
877 VALUE_STRING_ENUM(gbcs_tunnel_command_names
);
878 VALUE_STRING_ARRAY(gbcs_tunnel_command_names
);
880 static dissector_handle_t gbcs_message_handle
;
882 static int proto_gbcs_tunnel
;
884 static int hf_gbcs_tunnel_command
;
885 static int hf_gbcs_tunnel_remaining
;
887 static int ett_gbcs_tunnel
;
889 void proto_register_gbcs_tunnel(void);
890 void proto_reg_handoff_gbcs_tunnel(void);
892 static int dissect_gbcs_tunnel(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
)
897 command
= tvb_get_uint8(tvb
, offset
);
899 case GBCS_TUNNEL_COMMAND_GET
:
900 case GBCS_TUNNEL_COMMAND_GET_RESPONSE
:
901 case GBCS_TUNNEL_COMMAND_PUT
: {
903 proto_tree
*tunnel_tree
;
905 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "GBCS Tunnel");
907 ti
= proto_tree_add_item(tree
, proto_gbcs_tunnel
, tvb
, offset
, -1, ENC_NA
);
908 tunnel_tree
= proto_item_add_subtree(ti
, ett_gbcs_tunnel
);
910 col_set_str(pinfo
->cinfo
, COL_INFO
, val_to_str_const(command
, gbcs_tunnel_command_names
, "Unknown Command"));
911 proto_tree_add_item(tunnel_tree
, hf_gbcs_tunnel_command
, tvb
, offset
, 1, ENC_NA
);
914 if (command
== GBCS_TUNNEL_COMMAND_GET_RESPONSE
) {
915 proto_tree_add_item(tunnel_tree
, hf_gbcs_tunnel_remaining
, tvb
, offset
, 1, ENC_NA
);
922 /* No tunnel header */
923 col_clear(pinfo
->cinfo
, COL_INFO
);
927 if (command
!= GBCS_TUNNEL_COMMAND_GET
&& tvb_reported_length_remaining(tvb
, offset
) > 0) {
928 tvbuff_t
*payload_tvb
= tvb_new_subset_remaining(tvb
, offset
);
930 if (gbcs_message_handle
!= NULL
) {
931 call_dissector_with_data(gbcs_message_handle
, payload_tvb
, pinfo
, tree
, NULL
);
934 call_data_dissector(payload_tvb
, pinfo
, tree
);
938 return tvb_captured_length(tvb
);
942 dissect_gbcs_tunnel_heur(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data
)
944 switch (tvb_get_uint8(tvb
, 0)) {
945 case GBCS_TUNNEL_COMMAND_GET
:
946 case GBCS_TUNNEL_COMMAND_PUT
:
947 case GBCS_TUNNEL_COMMAND_GET_RESPONSE
:
950 dissect_gbcs_tunnel(tvb
, pinfo
, tree
, data
);
958 void proto_register_gbcs_tunnel(void)
960 static hf_register_info hf
[] = {
961 {&hf_gbcs_tunnel_command
,
962 {"Transfer data command", "gbcs_tunnel.command",
963 FT_UINT8
, BASE_HEX
, VALS(gbcs_tunnel_command_names
), 0x0, NULL
, HFILL
}
965 {&hf_gbcs_tunnel_remaining
,
966 {"Remaining messages", "gbcs_tunnel.remaining",
967 FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}
971 static int *ett
[] = {
975 proto_gbcs_tunnel
= proto_register_protocol("GBCS Tunnel", "GBCS Tunnel", "gbcs_tunnel");
976 register_dissector("gbcs_tunnel", dissect_gbcs_tunnel
, proto_gbcs_tunnel
);
977 proto_register_field_array(proto_gbcs_tunnel
, hf
, array_length(hf
));
978 proto_register_subtree_array(ett
, array_length(ett
));
981 void proto_reg_handoff_gbcs_tunnel(void)
983 gbcs_message_handle
= find_dissector("gbcs_message");
984 heur_dissector_add("zbee_zcl_se.tun", dissect_gbcs_tunnel_heur
, "GBCS over ZigBee SE Tunneling", "gbcs_zbee_zcl_se.tun", proto_gbcs_tunnel
, HEURISTIC_ENABLE
);
987 /* ########################################################################## */
988 /* #### GBCS Message ######################################################### */
989 /* ########################################################################## */
991 #define GBCS_MESSAGE_GENERAL_CIPHERING 0xDD
992 #define GBCS_MESSAGE_GENERAL_SIGNING 0xDF
993 #define GBCS_MESSAGE_ACCESS_REQUEST 0xD9
994 #define GBCS_MESSAGE_ACCESS_RESPONSE 0xDA
995 #define GBCS_MESSAGE_DATA_NOTIFICATION 0x0F
996 #define GBCS_MESSAGE_GENERAL_BLOCK_TRANSFER 0xE0
998 #define GBCS_MESSAGE_TRANSACTION_ID_LENGTH 9
999 #define GBCS_MESSAGE_DLMS_DATE_TIME_LENGTH 12
1000 #define GBCS_MESSAGE_KRP_LENGTH 64
1001 #define GBCS_MESSAGE_MAC_LENGTH 12
1003 #define GBCS_MESSAGE_GBT_BLOCK_CONTROL_LAST_BLOCK 0x80
1004 #define GBCS_MESSAGE_GBT_BLOCK_CONTROL_STREAMING 0x40
1005 #define GBCS_MESSAGE_GBT_BLOCK_CONTROL_WINDOW 0x3F
1007 static dissector_handle_t gbcs_gbcs_handle
;
1008 static dissector_handle_t gbcs_gbz_handle
;
1009 static dissector_handle_t gbcs_ber_handle
;
1011 static int proto_gbcs_message
;
1013 static int hf_gbcs_message_element_length
;
1014 static int hf_gbcs_message_mac_header_general_ciphering
;
1015 static int hf_gbcs_message_mac_header_cra_flag
;
1016 static int hf_gbcs_message_mac_header_originator_counter
;
1017 static int hf_gbcs_message_mac_header_business_originator_id
;
1018 static int hf_gbcs_message_mac_header_business_target_id
;
1019 static int hf_gbcs_message_mac_header_date_time
;
1020 static int hf_gbcs_message_mac_header_other_info
;
1021 static int hf_gbcs_message_mac_header_key_info
;
1022 static int hf_gbcs_message_mac_header_security_control_byte
;
1023 static int hf_gbcs_message_mac_header_invocation_counter
;
1024 static int hf_gbcs_message_grouping_header_general_signing
;
1025 static int hf_gbcs_message_grouping_header_cra_flag
;
1026 static int hf_gbcs_message_grouping_header_originator_counter
;
1027 static int hf_gbcs_message_grouping_header_business_originator_id
;
1028 static int hf_gbcs_message_grouping_header_business_target_id
;
1029 static int hf_gbcs_message_grouping_header_date_time
;
1030 static int hf_gbcs_message_grouping_header_message_code
;
1031 static int hf_gbcs_message_grouping_header_supplementary_remote_party_id
;
1032 static int hf_gbcs_message_grouping_header_supplementary_remote_party_counter
;
1033 static int hf_gbcs_message_grouping_header_supplementary_originator_counter
;
1034 static int hf_gbcs_message_grouping_header_supplementary_remote_party_ka_certificate
;
1035 static int hf_gbcs_message_krp
;
1036 static int hf_gbcs_message_mac
;
1037 static int hf_gbcs_message_routing_header_general_ciphering
;
1038 static int hf_gbcs_message_routing_header_cra_flag
;
1039 static int hf_gbcs_message_routing_header_originator_counter
;
1040 static int hf_gbcs_message_routing_header_business_originator_id
;
1041 static int hf_gbcs_message_routing_header_business_target_id
;
1042 static int hf_gbcs_message_routing_header_date_time
;
1043 static int hf_gbcs_message_routing_header_message_code
;
1044 static int hf_gbcs_message_routing_header_key_info
;
1045 static int hf_gbcs_message_routing_header_security_control_byte
;
1046 static int hf_gbcs_message_routing_header_invocation_counter
;
1047 static int hf_gbcs_message_gbt_header_general_block_transfer
;
1048 static int hf_gbcs_message_gbt_header_block_control
;
1049 static int hf_gbcs_message_gbt_header_block_control_last_block
;
1050 static int hf_gbcs_message_gbt_header_block_control_streaming
;
1051 static int hf_gbcs_message_gbt_header_block_control_window
;
1052 static int hf_gbcs_message_gbt_header_block_number
;
1053 static int hf_gbcs_message_gbt_header_block_number_ack
;
1054 static int hf_gbcs_message_gbt_blocks
;
1055 static int hf_gbcs_message_gbt_block
;
1056 static int hf_gbcs_message_gbt_block_overlap
;
1057 static int hf_gbcs_message_gbt_block_overlap_conflicts
;
1058 static int hf_gbcs_message_gbt_block_multiple_tails
;
1059 static int hf_gbcs_message_gbt_block_too_long_fragment
;
1060 static int hf_gbcs_message_gbt_block_error
;
1061 static int hf_gbcs_message_gbt_block_count
;
1062 static int hf_gbcs_message_gbt_reassembled_in
;
1063 static int hf_gbcs_message_gbt_reassembled_length
;
1065 static int ett_gbcs_message
;
1066 static int ett_gbcs_message_element
;
1067 static int ett_gbcs_message_mac_header
;
1068 static int ett_gbcs_message_grouping_header
;
1069 static int ett_gbcs_message_grouping_header_other_info
;
1070 static int ett_gbcs_message_routing_header
;
1071 static int ett_gbcs_message_routing_header_other_info
;
1072 static int ett_gbcs_message_gbt_header
;
1073 static int ett_gbcs_message_gbt_header_block_control
;
1074 static int ett_gbcs_message_gbt_fragment
;
1075 static int ett_gbcs_message_gbt_fragments
;
1076 static int ett_gbcs_message_asn1
;
1077 static int ett_gbcs_message_dlms
;
1079 static reassembly_table gbcs_message_gbt_reassembly_table
;
1081 static const fragment_items gbcs_message_gbt_frag_items
= {
1082 /* Fragment subtrees */
1083 &ett_gbcs_message_gbt_fragment
,
1084 &ett_gbcs_message_gbt_fragments
,
1085 /* Fragment fields */
1086 &hf_gbcs_message_gbt_blocks
,
1087 &hf_gbcs_message_gbt_block
,
1088 &hf_gbcs_message_gbt_block_overlap
,
1089 &hf_gbcs_message_gbt_block_overlap_conflicts
,
1090 &hf_gbcs_message_gbt_block_multiple_tails
,
1091 &hf_gbcs_message_gbt_block_too_long_fragment
,
1092 &hf_gbcs_message_gbt_block_error
,
1093 &hf_gbcs_message_gbt_block_count
,
1094 /* Reassembled in field */
1095 &hf_gbcs_message_gbt_reassembled_in
,
1096 /* Reassembled length field */
1097 &hf_gbcs_message_gbt_reassembled_length
,
1098 /* Reassembled data field */
1104 void proto_register_gbcs_message(void);
1105 void proto_reg_handoff_gbcs_message(void);
1108 dissect_gbcs_message_element(proto_tree
*tree
, int hfindex
, tvbuff_t
*tvb
, unsigned *offset
)
1110 proto_tree
*element_tree
;
1111 proto_item
*tree_ti
, *value_ti
;
1114 element_tree
= proto_tree_add_subtree(tree
, tvb
, *offset
, 1, ett_gbcs_message_element
, &tree_ti
, "");
1116 proto_tree_add_item_ret_uint(element_tree
, hf_gbcs_message_element_length
, tvb
, *offset
, 1, ENC_NA
, &len
);
1120 value_ti
= proto_tree_add_item(element_tree
, hfindex
, tvb
, *offset
, len
, ENC_BIG_ENDIAN
);
1124 label
= (char*)wmem_alloc(wmem_packet_scope(), ITEM_LABEL_LENGTH
+1);
1125 proto_item_fill_label(PITEM_FINFO(value_ti
), label
, NULL
);
1126 proto_item_append_text(tree_ti
, "%s", label
);
1129 proto_item_set_end(tree_ti
, tvb
, *offset
);
1132 proto_item_append_text(tree_ti
, "%s: <none>", proto_registrar_get_name(hfindex
));
1137 dissect_gbcs_message_element_transaction_id(proto_tree
*tree
, int hfindex_cra_flag
, int hfindex_originator_counter
, tvbuff_t
*tvb
, unsigned *offset
)
1139 proto_tree
*element_tree
;
1140 proto_item
*tree_ti
, *value_ti
;
1143 element_tree
= proto_tree_add_subtree(tree
, tvb
, *offset
, 1, ett_gbcs_message_element
, &tree_ti
, "");
1145 proto_tree_add_item_ret_uint(element_tree
, hf_gbcs_message_element_length
, tvb
, *offset
, 1, ENC_NA
, &len
);
1149 value_ti
= proto_tree_add_item(element_tree
, hfindex_cra_flag
, tvb
, *offset
, 1, ENC_NA
);
1153 label
= (char*)wmem_alloc(wmem_packet_scope(), ITEM_LABEL_LENGTH
+1);
1154 proto_item_fill_label(PITEM_FINFO(value_ti
), label
, NULL
);
1155 label
= strstr(label
, ": ") + 2;
1156 proto_item_append_text(tree_ti
, "Transaction ID: %s", label
);
1160 value_ti
= proto_tree_add_item(element_tree
, hfindex_originator_counter
, tvb
, *offset
, 8, ENC_BIG_ENDIAN
);
1164 label
= (char*)wmem_alloc(wmem_packet_scope(), ITEM_LABEL_LENGTH
+1);
1165 proto_item_fill_label(PITEM_FINFO(value_ti
), label
, NULL
);
1166 label
= strstr(label
, ": ") + 2;
1167 proto_item_append_text(tree_ti
, ", %s", label
);
1170 proto_item_set_end(tree_ti
, tvb
, *offset
);
1173 proto_item_append_text(tree_ti
, "Transaction ID: <none>");
1178 dissect_gbcs_message_element_date_time(proto_tree
*tree
, int hfindex
, tvbuff_t
*tvb
, unsigned *offset
)
1180 proto_tree
*element_tree
;
1181 proto_item
*tree_ti
, *value_ti
;
1184 element_tree
= proto_tree_add_subtree(tree
, tvb
, *offset
, 1, ett_gbcs_message_element
, &tree_ti
, "");
1186 proto_tree_add_item_ret_uint(element_tree
, hf_gbcs_message_element_length
, tvb
, *offset
, 1, ENC_NA
, &len
);
1192 dlms_date_time(tvb
, *offset
, &date_time
);
1193 value_ti
= proto_tree_add_time(element_tree
, hfindex
, tvb
, *offset
, GBCS_MESSAGE_DLMS_DATE_TIME_LENGTH
, &date_time
);
1197 label
= (char*)wmem_alloc(wmem_packet_scope(), ITEM_LABEL_LENGTH
+1);
1198 proto_item_fill_label(PITEM_FINFO(value_ti
), label
, NULL
);
1199 proto_item_append_text(tree_ti
, "%s", label
);
1201 *offset
+= GBCS_MESSAGE_DLMS_DATE_TIME_LENGTH
;
1203 proto_item_set_end(tree_ti
, tvb
, *offset
);
1206 proto_item_append_text(tree_ti
, "%s: <none>", proto_registrar_get_name(hfindex
));
1211 dissect_gbcs_message_mac_header(tvbuff_t
*tvb
, proto_tree
*tree
, unsigned *offset
)
1214 proto_tree
*mac_header_tree
;
1215 unsigned len
, offset_start
;
1217 mac_header_tree
= proto_tree_add_subtree(tree
, tvb
, *offset
, 1, ett_gbcs_message_mac_header
, &ti
, "MAC Header");
1219 proto_tree_add_item(mac_header_tree
, hf_gbcs_message_mac_header_general_ciphering
, tvb
, *offset
, 1, ENC_NA
);
1222 dissect_gbcs_message_element_transaction_id(mac_header_tree
, hf_gbcs_message_mac_header_cra_flag
,
1223 hf_gbcs_message_mac_header_originator_counter
, tvb
, offset
); // transaction-id - always none
1224 dissect_gbcs_message_element(mac_header_tree
, hf_gbcs_message_mac_header_business_originator_id
, tvb
, offset
); // originator-system-title - always none
1225 dissect_gbcs_message_element(mac_header_tree
, hf_gbcs_message_mac_header_business_target_id
, tvb
, offset
); // recipient-system-title - always none
1226 dissect_gbcs_message_element_date_time(mac_header_tree
, hf_gbcs_message_mac_header_date_time
, tvb
, offset
); // date-time - always none
1227 dissect_gbcs_message_element(mac_header_tree
, hf_gbcs_message_mac_header_other_info
, tvb
, offset
); // other-information - always none
1228 dissect_gbcs_message_element(mac_header_tree
, hf_gbcs_message_mac_header_key_info
, tvb
, offset
); // key-info - always none
1230 offset_start
= *offset
;
1231 *offset
= get_ber_length(tvb
, *offset
, &len
, NULL
);
1232 proto_tree_add_uint(mac_header_tree
, hf_gbcs_message_element_length
, tvb
, offset_start
, *offset
- offset_start
, len
);
1234 proto_tree_add_item(mac_header_tree
, hf_gbcs_message_mac_header_security_control_byte
, tvb
, *offset
, 1, ENC_NA
);
1237 proto_tree_add_item(mac_header_tree
, hf_gbcs_message_mac_header_invocation_counter
, tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
1240 proto_item_set_end(ti
, tvb
, *offset
);
1244 dissect_gbcs_message_grouping_header(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, unsigned *offset
, unsigned *len
, uint8_t *cra
)
1246 proto_item
*grouping_header_ti
, *other_info_ti
;
1247 proto_tree
*grouping_header_tree
, *other_info_tree
;
1248 unsigned other_info_len
;
1249 unsigned offset_start
;
1250 uint32_t message_code
;
1252 grouping_header_tree
= proto_tree_add_subtree(tree
, tvb
, *offset
, 1, ett_gbcs_message_grouping_header
, &grouping_header_ti
, "Grouping Header");
1254 proto_tree_add_item(grouping_header_tree
, hf_gbcs_message_grouping_header_general_signing
, tvb
, *offset
, 1, ENC_NA
);
1257 *cra
= tvb_get_uint8(tvb
, *offset
+ 1);
1258 col_append_sep_str(pinfo
->cinfo
, COL_INFO
, NULL
, val_to_str_const(*cra
, gbcs_message_cra_names
, "Unknown CRA"));
1259 dissect_gbcs_message_element_transaction_id(grouping_header_tree
,
1260 hf_gbcs_message_grouping_header_cra_flag
, hf_gbcs_message_grouping_header_originator_counter
, tvb
, offset
);
1262 dissect_gbcs_message_element(grouping_header_tree
, hf_gbcs_message_grouping_header_business_originator_id
, tvb
, offset
);
1264 dissect_gbcs_message_element(grouping_header_tree
, hf_gbcs_message_grouping_header_business_target_id
, tvb
, offset
);
1266 dissect_gbcs_message_element_date_time(grouping_header_tree
, hf_gbcs_message_grouping_header_date_time
, tvb
, offset
);
1268 other_info_tree
= proto_tree_add_subtree(grouping_header_tree
, tvb
,
1269 *offset
, 1, ett_gbcs_message_grouping_header_other_info
, &other_info_ti
, "Other Information");
1271 offset_start
= *offset
;
1272 *offset
= get_ber_length(tvb
, *offset
, &other_info_len
, NULL
);
1273 proto_tree_add_uint(other_info_tree
, hf_gbcs_message_element_length
, tvb
, offset_start
, *offset
- offset_start
, other_info_len
);
1275 proto_tree_add_item_ret_uint(other_info_tree
, hf_gbcs_message_grouping_header_message_code
,
1276 tvb
, *offset
, 2, ENC_BIG_ENDIAN
, &message_code
);
1277 col_append_sep_str(pinfo
->cinfo
, COL_INFO
, NULL
, val_to_str_ext_const(message_code
, &gbcs_message_code_names_ext
, "Unknown Use Case"));
1279 other_info_len
-= 2;
1281 if (other_info_len
> 0) {
1282 proto_tree_add_item(other_info_tree
, hf_gbcs_message_grouping_header_supplementary_remote_party_id
,
1283 tvb
, *offset
, 8, ENC_BIG_ENDIAN
);
1285 other_info_len
-= 8;
1288 if (other_info_len
> 0) {
1289 proto_tree_add_item(other_info_tree
, hf_gbcs_message_grouping_header_supplementary_remote_party_counter
,
1290 tvb
, *offset
, 8, ENC_BIG_ENDIAN
);
1292 other_info_len
-= 8;
1295 if (other_info_len
> 0) {
1296 proto_tree_add_item(other_info_tree
, hf_gbcs_message_grouping_header_supplementary_originator_counter
,
1297 tvb
, *offset
, 8, ENC_BIG_ENDIAN
);
1299 other_info_len
-= 8;
1302 if (other_info_len
> 0) {
1303 proto_tree_add_item(other_info_tree
, hf_gbcs_message_grouping_header_supplementary_remote_party_ka_certificate
,
1304 tvb
, *offset
, other_info_len
, ENC_NA
);
1305 *offset
+= other_info_len
;
1306 other_info_len
-= other_info_len
;
1309 proto_item_set_end(other_info_ti
, tvb
, *offset
);
1311 offset_start
= *offset
;
1312 *offset
= get_ber_length(tvb
, *offset
, len
, NULL
);
1313 proto_tree_add_uint(grouping_header_tree
, hf_gbcs_message_element_length
, tvb
, offset_start
, *offset
- offset_start
, *len
);
1315 proto_item_set_end(grouping_header_ti
, tvb
, *offset
);
1319 dissect_gbcs_message_routing_header(tvbuff_t
*tvb
, proto_tree
*tree
, unsigned *offset
,
1320 uint64_t *business_originator
, uint64_t *originator_counter
)
1322 proto_item
*routing_header_ti
, *other_info_ti
;
1323 proto_tree
*routing_header_tree
, *other_info_tree
;
1324 unsigned other_info_len
;
1325 unsigned len
, offset_start
;
1327 routing_header_tree
= proto_tree_add_subtree(tree
, tvb
, *offset
, 1, ett_gbcs_message_routing_header
, &routing_header_ti
, "Routing Header");
1329 proto_tree_add_item(routing_header_tree
, hf_gbcs_message_routing_header_general_ciphering
, tvb
, *offset
, 1, ENC_NA
);
1332 *originator_counter
= tvb_get_uint64(tvb
, *offset
+ 2, ENC_BIG_ENDIAN
);
1333 dissect_gbcs_message_element_transaction_id(routing_header_tree
,
1334 hf_gbcs_message_routing_header_cra_flag
, hf_gbcs_message_routing_header_originator_counter
, tvb
, offset
);
1336 *business_originator
= tvb_get_uint64(tvb
, *offset
+ 1, ENC_BIG_ENDIAN
);
1337 dissect_gbcs_message_element(routing_header_tree
, hf_gbcs_message_routing_header_business_originator_id
, tvb
, offset
);
1339 dissect_gbcs_message_element(routing_header_tree
, hf_gbcs_message_routing_header_business_target_id
, tvb
, offset
);
1341 dissect_gbcs_message_element_date_time(routing_header_tree
, hf_gbcs_message_routing_header_date_time
, tvb
, offset
); // date-time - always none
1343 other_info_tree
= proto_tree_add_subtree(routing_header_tree
, tvb
,
1344 *offset
, 1, ett_gbcs_message_routing_header_other_info
, &other_info_ti
, "Other Information");
1346 offset_start
= *offset
;
1347 *offset
= get_ber_length(tvb
, *offset
, &other_info_len
, NULL
);
1348 proto_tree_add_uint(other_info_tree
, hf_gbcs_message_element_length
, tvb
, offset_start
, *offset
- offset_start
, other_info_len
);
1350 proto_tree_add_item(other_info_tree
, hf_gbcs_message_routing_header_message_code
, tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
1353 dissect_gbcs_message_element(routing_header_tree
, hf_gbcs_message_routing_header_key_info
, tvb
, offset
); // key-info - always none
1355 offset_start
= *offset
;
1356 *offset
= get_ber_length(tvb
, *offset
, &len
, NULL
);
1357 proto_tree_add_uint(routing_header_tree
, hf_gbcs_message_element_length
, tvb
, offset_start
, *offset
- offset_start
, len
);
1359 proto_tree_add_item(routing_header_tree
, hf_gbcs_message_routing_header_security_control_byte
, tvb
, *offset
, 1, ENC_NA
);
1362 proto_tree_add_item(routing_header_tree
, hf_gbcs_message_routing_header_invocation_counter
, tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
1365 proto_item_set_end(routing_header_ti
, tvb
, *offset
);
1369 dissect_gbcs_message_gbt_header(tvbuff_t
*tvb
, proto_tree
*tree
, unsigned *offset
,
1370 unsigned *len
, uint16_t *block_number
, bool *last
)
1373 proto_tree
*gbt_header_tree
;
1374 unsigned offset_start
;
1376 gbt_header_tree
= proto_tree_add_subtree(tree
, tvb
, *offset
, 1, ett_gbcs_message_gbt_header
, &ti
, "GBT Header");
1378 proto_tree_add_item(gbt_header_tree
, hf_gbcs_message_gbt_header_general_block_transfer
, tvb
, *offset
, 1, ENC_NA
);
1381 static int* const block_control
[] = {
1382 &hf_gbcs_message_gbt_header_block_control_last_block
,
1383 &hf_gbcs_message_gbt_header_block_control_streaming
,
1384 &hf_gbcs_message_gbt_header_block_control_window
,
1388 *last
= tvb_get_uint8(tvb
, *offset
) & GBCS_MESSAGE_GBT_BLOCK_CONTROL_LAST_BLOCK
;
1389 proto_tree_add_bitmask(gbt_header_tree
, tvb
, *offset
, hf_gbcs_message_gbt_header_block_control
,
1390 ett_gbcs_message_gbt_header_block_control
, block_control
, ENC_BIG_ENDIAN
);
1393 *block_number
= tvb_get_uint16(tvb
, *offset
, ENC_BIG_ENDIAN
);
1394 proto_tree_add_item(gbt_header_tree
, hf_gbcs_message_gbt_header_block_number
, tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
1397 proto_tree_add_item(gbt_header_tree
, hf_gbcs_message_gbt_header_block_number_ack
, tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
1400 offset_start
= *offset
;
1401 *offset
= get_ber_length(tvb
, *offset
, len
, NULL
);
1402 proto_tree_add_uint(gbt_header_tree
, hf_gbcs_message_element_length
, tvb
, offset_start
, *offset
- offset_start
, *len
);
1404 proto_item_set_end(ti
, tvb
, *offset
);
1408 dissect_gbcs_gbt_payload(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, unsigned *offset
, unsigned len
, uint64_t business_originator
,
1409 uint64_t originator_counter
, uint16_t block_number
, bool last
)
1412 fragment_head
*frag_msg
= NULL
;
1415 pinfo
->fragmented
= true;
1417 msg_id
= ((uint32_t)business_originator
<< 8) | ((uint32_t)originator_counter
& 0xFF);
1419 frag_msg
= fragment_add_seq_check(&gbcs_message_gbt_reassembly_table
,
1420 tvb
, *offset
, pinfo
, msg_id
, NULL
, block_number
- 1, len
, !last
);
1422 new_tvb
= process_reassembled_data(tvb
, *offset
, pinfo
,
1423 "Reassembled GBT", frag_msg
, &gbcs_message_gbt_frag_items
, NULL
, tree
);
1426 /* The reassembly handler defragmented the message, and created a new tvbuff */
1427 call_dissector_with_data(gbcs_gbcs_handle
, new_tvb
, pinfo
, proto_tree_get_parent_tree(tree
), NULL
);
1430 /* The reassembly handler could not defragment the message yet */
1431 col_append_sep_fstr(pinfo
->cinfo
, COL_INFO
, NULL
, "GBT block %d", block_number
);
1432 call_data_dissector(tvb_new_subset_length(tvb
, *offset
, len
), pinfo
, proto_tree_get_parent_tree(tree
));
1439 dissect_gbcs_message_payload(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, unsigned *offset
, unsigned len
, uint8_t cra
)
1441 tvbuff_t
*payload_tvb
= tvb_new_subset_length(tvb
, *offset
, len
);
1443 if (gbcs_gbz_handle
!= NULL
&& tvb_get_ntohs(payload_tvb
, 0) == ZBEE_PROFILE_SE
) {
1444 // Dissect GBZ payload
1445 call_dissector_with_data(gbcs_gbz_handle
, payload_tvb
, pinfo
, tree
, &cra
);
1447 else if (tvb_get_uint8(payload_tvb
, 0) == GBCS_MESSAGE_ACCESS_REQUEST
1448 || tvb_get_uint8(payload_tvb
, 0) == GBCS_MESSAGE_ACCESS_RESPONSE
1449 || tvb_get_uint8(payload_tvb
, 0) == GBCS_MESSAGE_DATA_NOTIFICATION
) {
1450 //TODO Dissect DLMS payload
1451 proto_tree
*dlms_tree
;
1453 dlms_tree
= proto_tree_add_subtree(tree
, payload_tvb
, 0, len
, ett_gbcs_message_dlms
, NULL
, "GBCS DLMS");
1454 call_data_dissector(payload_tvb
, pinfo
, dlms_tree
);
1457 // If it isn't GBZ or DLMS, then it is ASN.1
1459 wmem_strbuf_t
*strbuf
;
1460 proto_tree
*asn1_tree
;
1462 text
= col_get_text(pinfo
->cinfo
, COL_INFO
);
1464 strbuf
= wmem_strbuf_new(pinfo
->pool
, text
);
1466 asn1_tree
= proto_tree_add_subtree(tree
, payload_tvb
, 0, len
, ett_gbcs_message_asn1
, NULL
, "GBCS ASN.1");
1467 call_dissector(gbcs_ber_handle
, payload_tvb
, pinfo
, asn1_tree
);
1469 col_add_str(pinfo
->cinfo
, COL_INFO
, wmem_strbuf_get_str(strbuf
));
1477 dissect_gbcs_message_krp(tvbuff_t
*tvb
, proto_tree
*tree
, unsigned *offset
)
1479 dissect_gbcs_message_element(tree
, hf_gbcs_message_krp
, tvb
, offset
);
1483 dissect_gbcs_message_mac(tvbuff_t
*tvb
, proto_tree
*tree
, unsigned *offset
)
1485 proto_tree_add_item(tree
, hf_gbcs_message_mac
, tvb
, *offset
, GBCS_MESSAGE_MAC_LENGTH
, ENC_NA
);
1486 *offset
+= GBCS_MESSAGE_MAC_LENGTH
;
1490 dissect_gbcs_message(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
)
1493 proto_tree
*gbcs_message_tree
;
1494 unsigned offset
= 0;
1496 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "GBCS Message");
1498 ti
= proto_tree_add_item(tree
, proto_gbcs_message
, tvb
, offset
, -1, ENC_NA
);
1499 gbcs_message_tree
= proto_item_add_subtree(ti
, ett_gbcs_message
);
1501 if ((tvb_get_uint8(tvb
, offset
) == GBCS_MESSAGE_GENERAL_CIPHERING
&& tvb_get_uint8(tvb
, offset
+ 1) == 0)
1502 || tvb_get_uint8(tvb
, offset
) == GBCS_MESSAGE_GENERAL_SIGNING
) {
1503 // Normal GBCS message
1504 bool mac
= tvb_get_uint8(tvb
, offset
) == GBCS_MESSAGE_GENERAL_CIPHERING
;
1505 unsigned grouping_len
;
1506 uint8_t grouping_cra
;
1509 dissect_gbcs_message_mac_header(tvb
, gbcs_message_tree
, &offset
);
1512 dissect_gbcs_message_grouping_header(tvb
, pinfo
, gbcs_message_tree
, &offset
, &grouping_len
, &grouping_cra
);
1514 dissect_gbcs_message_payload(tvb
, pinfo
, tree
, &offset
, grouping_len
, grouping_cra
);
1516 dissect_gbcs_message_krp(tvb
, gbcs_message_tree
, &offset
);
1519 dissect_gbcs_message_mac(tvb
, gbcs_message_tree
, &offset
);
1522 else if (tvb_get_uint8(tvb
, offset
) == GBCS_MESSAGE_GENERAL_CIPHERING
&& tvb_get_uint8(tvb
, offset
+ 1) == 0x09) {
1523 // GBCS General Block Transfer
1525 uint64_t business_originator
;
1526 uint64_t originator_counter
;
1527 uint16_t block_number
;
1530 dissect_gbcs_message_routing_header(tvb
, gbcs_message_tree
, &offset
, &business_originator
, &originator_counter
);
1532 dissect_gbcs_message_gbt_header(tvb
, gbcs_message_tree
, &offset
, &gbt_len
, &block_number
, &last
);
1534 if (gbt_len
> 0) { // GBT Ack contains no data
1535 dissect_gbcs_gbt_payload(tvb
, pinfo
, gbcs_message_tree
, &offset
, gbt_len
, business_originator
, originator_counter
, block_number
, last
);
1539 proto_item_set_end(ti
, tvb
, offset
);
1541 return tvb_captured_length(tvb
);
1544 void proto_register_gbcs_message(void)
1546 static hf_register_info hf
[] = {
1547 {&hf_gbcs_message_element_length
,
1548 {"Length", "gbcs_message.element_length",
1549 FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}
1551 {&hf_gbcs_message_mac_header_general_ciphering
,
1552 {"General Ciphering", "gbcs_message.mac_header.general_ciphering",
1553 FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}
1555 {&hf_gbcs_message_mac_header_cra_flag
,
1556 {"CRA Flag", "gbcs_message.mac_header.cra_flag",
1557 FT_UINT8
, BASE_HEX
, VALS(gbcs_message_cra_names
), 0x0, NULL
, HFILL
}
1559 {&hf_gbcs_message_mac_header_originator_counter
,
1560 {"Originator Counter", "gbcs_message.mac_header.originator_counter",
1561 FT_UINT64
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}
1563 {&hf_gbcs_message_mac_header_business_originator_id
,
1564 {"Business Originator ID", "gbcs_message.mac_header.business_originator_id",
1565 FT_EUI64
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}
1567 {&hf_gbcs_message_mac_header_business_target_id
,
1568 {"Business Target ID", "gbcs_message.mac_header.business_target_id",
1569 FT_EUI64
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}
1571 {&hf_gbcs_message_mac_header_date_time
,
1572 {"Date Time", "gbcs_message.mac_header.date_time",
1573 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_UTC
, NULL
, 0x0, NULL
, HFILL
}
1575 {&hf_gbcs_message_mac_header_other_info
,
1576 {"Other-Information", "gbcs_message.mac_header.other_info",
1577 FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}
1579 {&hf_gbcs_message_mac_header_key_info
,
1580 {"Key-Info", "gbcs_message.mac_header.key_info",
1581 FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}
1583 {&hf_gbcs_message_mac_header_security_control_byte
,
1584 {"Security Control Byte", "gbcs_message.mac_header.security_control_byte",
1585 FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}
1587 {&hf_gbcs_message_mac_header_invocation_counter
,
1588 {"Invocation Counter", "gbcs_message.mac_header.invocation_counter",
1589 FT_UINT32
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}
1591 {&hf_gbcs_message_grouping_header_general_signing
,
1592 {"General Signing", "gbcs_message.grouping_header.general_signing",
1593 FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}
1595 {&hf_gbcs_message_grouping_header_cra_flag
,
1596 {"CRA Flag", "gbcs_message.grouping_header.cra_flag",
1597 FT_UINT8
, BASE_HEX
, VALS(gbcs_message_cra_names
), 0x0, NULL
, HFILL
}
1599 {&hf_gbcs_message_grouping_header_originator_counter
,
1600 {"Originator Counter", "gbcs_message.grouping_header.originator_counter",
1601 FT_UINT64
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}
1603 {&hf_gbcs_message_grouping_header_business_originator_id
,
1604 {"Business Originator ID", "gbcs_message.grouping_header.business_originator_id",
1605 FT_EUI64
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}
1607 {&hf_gbcs_message_grouping_header_business_target_id
,
1608 {"Business Target ID", "gbcs_message.grouping_header.business_target_id",
1609 FT_EUI64
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}
1611 {&hf_gbcs_message_grouping_header_date_time
,
1612 {"Date Time", "gbcs_message.grouping_header.date_time",
1613 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_UTC
, NULL
, 0x0, NULL
, HFILL
}
1615 {&hf_gbcs_message_grouping_header_message_code
,
1616 {"Message Code", "gbcs_message.grouping_header.message_code",
1617 FT_UINT16
, BASE_HEX
| BASE_EXT_STRING
, &gbcs_message_code_names_ext
, 0x0, NULL
, HFILL
}
1619 {&hf_gbcs_message_grouping_header_supplementary_remote_party_id
,
1620 {"Supplementary Remote Party ID", "gbcs_message.grouping_header.supplementary_remote_party_id",
1621 FT_EUI64
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}
1623 {&hf_gbcs_message_grouping_header_supplementary_remote_party_counter
,
1624 {"Supplementary Remote Party Counter", "gbcs_message.grouping_header.supplementary_remote_party_counter",
1625 FT_UINT64
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}
1627 {&hf_gbcs_message_grouping_header_supplementary_originator_counter
,
1628 {"Supplementary Originator Counter", "gbcs_message.grouping_header.supplementary_remote_party_originator_counter",
1629 FT_UINT64
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}
1631 {&hf_gbcs_message_grouping_header_supplementary_remote_party_ka_certificate
,
1632 {"Certificate", "gbcs_message.grouping_header.supplementary_remote_party_ka_certificate",
1633 FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}
1635 {&hf_gbcs_message_krp
,
1636 {"KRP", "gbcs_message.krp",
1637 FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}
1639 {&hf_gbcs_message_mac
,
1640 {"MAC", "gbcs_message.mac",
1641 FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}
1643 {&hf_gbcs_message_routing_header_general_ciphering
,
1644 {"General Ciphering", "gbcs_message.routing_header.general_ciphering",
1645 FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}
1647 {&hf_gbcs_message_routing_header_cra_flag
,
1648 {"CRA Flag", "gbcs_message.routing_header.cra_flag",
1649 FT_UINT8
, BASE_HEX
, VALS(gbcs_message_cra_names
), 0x0, NULL
, HFILL
}
1651 {&hf_gbcs_message_routing_header_originator_counter
,
1652 {"Originator Counter", "gbcs_message.routing_header.originator_counter",
1653 FT_UINT64
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}
1655 {&hf_gbcs_message_routing_header_business_originator_id
,
1656 {"Business Originator ID", "gbcs_message.routing_header.business_originator_id",
1657 FT_EUI64
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}
1659 {&hf_gbcs_message_routing_header_business_target_id
,
1660 {"Business Target ID", "gbcs_message.routing_header.business_target_id",
1661 FT_EUI64
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}
1663 {&hf_gbcs_message_routing_header_date_time
,
1664 {"Date Time", "gbcs_message.routing_header.date_time",
1665 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_UTC
, NULL
, 0x0, NULL
, HFILL
}
1667 {&hf_gbcs_message_routing_header_key_info
,
1668 {"Key-Info", "gbcs_message.routing_header.key_info",
1669 FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}
1671 {&hf_gbcs_message_routing_header_message_code
,
1672 {"Message Code", "gbcs_message.routing_header.message_code",
1673 FT_UINT16
, BASE_HEX
| BASE_EXT_STRING
, &gbcs_message_code_names_ext
, 0x0, NULL
, HFILL
}
1675 {&hf_gbcs_message_routing_header_security_control_byte
,
1676 {"Security Control Byte", "gbcs_message.routing_header.security_control_byte",
1677 FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}
1679 {&hf_gbcs_message_routing_header_invocation_counter
,
1680 {"Invocation Counter", "gbcs_message.routing_header.invocation_counter",
1681 FT_UINT32
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}
1683 {&hf_gbcs_message_gbt_header_general_block_transfer
,
1684 {"General Block Transfer", "gbcs_message.gbt_header.general_block_transfer",
1685 FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}
1687 {&hf_gbcs_message_gbt_header_block_control
,
1688 {"Block Control", "gbcs_message.gbt_header.block_control",
1689 FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}
1691 {&hf_gbcs_message_gbt_header_block_control_last_block
,
1692 {"Last Block", "gbcs_message.gbt_header.block_control.last_block",
1693 FT_BOOLEAN
, 8, NULL
, GBCS_MESSAGE_GBT_BLOCK_CONTROL_LAST_BLOCK
, NULL
, HFILL
}
1695 {&hf_gbcs_message_gbt_header_block_control_streaming
,
1696 {"Streaming", "gbcs_message.gbt_header.block_control.streaming",
1697 FT_BOOLEAN
, 8, NULL
, GBCS_MESSAGE_GBT_BLOCK_CONTROL_STREAMING
, NULL
, HFILL
}
1699 {&hf_gbcs_message_gbt_header_block_control_window
,
1700 {"Window", "gbcs_message.gbt_header.block_control.window",
1701 FT_UINT8
, BASE_DEC
, NULL
, GBCS_MESSAGE_GBT_BLOCK_CONTROL_WINDOW
, NULL
, HFILL
}
1703 {&hf_gbcs_message_gbt_header_block_number
,
1704 {"Block Number", "gbcs_message.gbt_header.block_number",
1705 FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}
1707 {&hf_gbcs_message_gbt_header_block_number_ack
,
1708 {"Block Number Ack", "gbcs_message.gbt_header.block_number_ack",
1709 FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}
1711 { &hf_gbcs_message_gbt_blocks
,
1712 { "Message blocks", "gbcs_message.gbt.blocks",
1713 FT_NONE
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}
1715 { &hf_gbcs_message_gbt_block
,
1716 { "Message block", "gbcs_message.gbt.block",
1717 FT_FRAMENUM
, BASE_NONE
, NULL
, 0x0,NULL
, HFILL
}
1719 { &hf_gbcs_message_gbt_block_overlap
,
1720 { "Message block overlap", "gbcs_message.gbt.block.overlap",
1721 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}
1723 { &hf_gbcs_message_gbt_block_overlap_conflicts
,
1724 { "Message block overlapping with conflicting data", "gbcs_message.gbt.block.overlap.conflicts",
1725 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}
1727 { &hf_gbcs_message_gbt_block_multiple_tails
,
1728 { "Message has multiple tail blocks", "gbcs_message.gbt.block.multiple_tails",
1729 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}
1731 { &hf_gbcs_message_gbt_block_too_long_fragment
,
1732 { "Message block too long", "gbcs_message.gbt.block.too_long_fragment",
1733 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}
1735 { &hf_gbcs_message_gbt_block_error
,
1736 { "Message defragmentation error", "gbcs_message.gbt.block.error",
1737 FT_FRAMENUM
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}
1739 { &hf_gbcs_message_gbt_block_count
,
1740 { "Message block count", "gbcs_message.gbt.block.count",
1741 FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}
1743 { &hf_gbcs_message_gbt_reassembled_in
,
1744 { "Reassembled in", "gbcs_message.gbt.reassembled.in",
1745 FT_FRAMENUM
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}
1747 { &hf_gbcs_message_gbt_reassembled_length
,
1748 { "Reassembled GBT length", "gbcs_message.gbt.reassembled.length",
1749 FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}
1753 static int *ett
[] = {
1755 &ett_gbcs_message_element
,
1756 &ett_gbcs_message_mac_header
,
1757 &ett_gbcs_message_grouping_header
,
1758 &ett_gbcs_message_grouping_header_other_info
,
1759 &ett_gbcs_message_routing_header
,
1760 &ett_gbcs_message_routing_header_other_info
,
1761 &ett_gbcs_message_gbt_header
,
1762 &ett_gbcs_message_gbt_header_block_control
,
1763 &ett_gbcs_message_gbt_fragment
,
1764 &ett_gbcs_message_gbt_fragments
,
1765 &ett_gbcs_message_asn1
,
1766 &ett_gbcs_message_dlms
1769 proto_gbcs_message
= proto_register_protocol("GBCS Message", "GBCS Message", "gbcs_message");
1770 gbcs_gbcs_handle
= register_dissector("gbcs_message", dissect_gbcs_message
, proto_gbcs_message
);
1771 proto_register_field_array(proto_gbcs_message
, hf
, array_length(hf
));
1772 proto_register_subtree_array(ett
, array_length(ett
));
1774 reassembly_table_register(&gbcs_message_gbt_reassembly_table
, &addresses_reassembly_table_functions
);
1777 void proto_reg_handoff_gbcs_message(void)
1779 gbcs_gbz_handle
= find_dissector("gbcs_gbz");
1780 gbcs_ber_handle
= find_dissector("ber");
1784 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1789 * indent-tabs-mode: nil
1792 * vi: set shiftwidth=4 tabstop=8 expandtab:
1793 * :indentSize=4:tabSize=8:noTabs=true: