Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-simulcrypt.c
blob67a43c2ba66b17571293f28795b42f077886d315
1 /* packet-simulcrypt.c
2 * Simulcrypt protocol interface as defined in ETSI TS 103.197 v 1.5.1
4 * ECMG <-> SCS support
5 * David Castleford, Orange Labs / France Telecom R&D
6 * Oct 2008
8 * EMMG <-> MUX support and generic interface support
9 * Copyright 2009, Stig Bjorlykke <stig@bjorlykke.org>
11 * EIS <-> SCS support, (P)SIG <-> MUX support, MUX <-> CiM support and (P) <-> CiP support
12 * Copyright 2010, Giuliano Fabris <giuliano.fabris@appeartv.com> / AppearTV
14 * Wireshark - Network traffic analyzer
15 * By Gerald Combs <gerald@wireshark.org>
16 * Copyright 1998 Gerald Combs
18 * SPDX-License-Identifier: GPL-2.0-or-later
21 #include "config.h"
23 #include <epan/packet.h>
24 #include <epan/prefs.h>
25 #include <epan/tfs.h>
26 #include <epan/unit_strings.h>
28 #include <wsutil/array.h>
29 #include "packet-tcp.h"
31 #define PROTO_TAG_SIMULCRYPT "SIMULCRYPT"
32 #define CA_SYSTEM_ID_MIKEY 0x9999 /* CA_system_ID corresponding to MIKEY ECM */
33 #define CA_SYSTEM_ID_MIKEY_PROTO "mikey" /* Protocol name to be used to "decode as" ECMs with CA_SYSTEM_ID_MIKEY */
35 void proto_register_simulcrypt(void);
37 /* Tecm_interpretation links ca_system_id to ecmg port and protocol name for dissection of
38 * ecm_datagram in ECM_Response message.
39 * Currently size is 1 as only have MIKEY protocol but could add extra protocols
40 * could add option in preferences for new ca_system_id for new protocol for example
42 typedef struct Tecm_interpretation
44 int ca_system_id;
45 const char *protocol_name;
46 dissector_handle_t protocol_handle;
47 unsigned ecmg_port;
48 } ecm_interpretation;
50 #define ECM_MIKEY_INDEX 0 /* must agree with tab_ecm_inter initialization */
52 static ecm_interpretation tab_ecm_inter[] = {
53 {CA_SYSTEM_ID_MIKEY, CA_SYSTEM_ID_MIKEY_PROTO, NULL, -1}
56 #define ECM_INTERPRETATION_SIZE array_length(tab_ecm_inter)
58 static int dissect_simulcrypt_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_);
59 static unsigned get_simulcrypt_message_len(packet_info *pinfo, tvbuff_t *tvb, int offset, void *data);
60 static void dissect_simulcrypt_data(proto_tree *simulcrypt_tree, proto_item *simulcrypt_item, packet_info *pinfo _U_,
61 tvbuff_t *tvb, proto_tree *tree, int offset,
62 int container_data_length, uint16_t iftype, bool is_subtree);
64 /* Wireshark ID of the SIMULCRYPT protocol */
65 static int proto_simulcrypt;
67 /* Dissector handle for SIMULCRYPT protocol */
68 static dissector_handle_t simulcrypt_handle;
70 /* Preferences (with default values) */
71 static int ca_system_id_mikey = CA_SYSTEM_ID_MIKEY; /* MIKEY ECM CA_system_ID */
73 /* MIKEY payload start bytes */
74 /*unsigned char mikey_start[3]={0x01,0x00,0x15};
75 * mikey_start[0]=0x01; first byte mikey payload (version)
76 * mikey_start[1]=0x00; second byte mikey payload (data type)
77 * mikey_start[2]=0x15; third byte (next payload)
80 /* Dissector-internal values to determine interface, can be re-organized */
81 #define SIMULCRYPT_RESERVED 0
82 #define SIMULCRYPT_ECMG_SCS 1
83 #define SIMULCRYPT_EMMG_MUX 2
84 #define SIMULCRYPT_CPSIG_PSIG 3
85 #define SIMULCRYPT_EIS_SCS 4
86 #define SIMULCRYPT_PSIG_MUX 5
87 #define SIMULCRYPT_MUX_CIM 6
88 #define SIMULCRYPT_PSIG_CIP 7
89 #define SIMULCRYPT_USER_DEFINED 8
91 static const value_string interfacenames[] = {
92 { SIMULCRYPT_RESERVED, "DVB reserved" },
93 { SIMULCRYPT_ECMG_SCS, "ECMG <-> SCS" },
94 { SIMULCRYPT_EMMG_MUX, "EMMG <-> MUX" },
95 { SIMULCRYPT_CPSIG_PSIG, "C(P)SIG <-> (P)SIG" },
96 { SIMULCRYPT_EIS_SCS, "EIS <-> SCS" },
97 { SIMULCRYPT_PSIG_MUX, "(P)SIG <-> MUX" },
98 { SIMULCRYPT_MUX_CIM, "Carousel in the MUX - CiM" },
99 { SIMULCRYPT_PSIG_CIP, "Carousel in the (P) - CiP" },
100 { SIMULCRYPT_USER_DEFINED, "User defined" },
101 { 0, NULL }
104 /* Reserved 0x0000 */
105 #define SIMULCRYPT_ECMG_CHANNEL_SETUP 0x0001
106 #define SIMULCRYPT_ECMG_CHANNEL_TEST 0x0002
107 #define SIMULCRYPT_ECMG_CHANNEL_STATUS 0x0003
108 #define SIMULCRYPT_ECMG_CHANNEL_CLOSE 0x0004
109 #define SIMULCRYPT_ECMG_CHANNEL_ERROR 0x0005
110 /* Reserved 0x0006 - 0x0010 */
111 #define SIMULCRYPT_EMMG_CHANNEL_SETUP 0x0011
112 #define SIMULCRYPT_EMMG_CHANNEL_TEST 0x0012
113 #define SIMULCRYPT_EMMG_CHANNEL_STATUS 0x0013
114 #define SIMULCRYPT_EMMG_CHANNEL_CLOSE 0x0014
115 #define SIMULCRYPT_EMMG_CHANNEL_ERROR 0x0015
116 /* Reserved 0x0016 - 0x0100 */
117 #define SIMULCRYPT_ECMG_STREAM_SETUP 0x0101
118 #define SIMULCRYPT_ECMG_STREAM_TEST 0x0102
119 #define SIMULCRYPT_ECMG_STREAM_STATUS 0x0103
120 #define SIMULCRYPT_ECMG_STREAM_CLOSE_REQUEST 0x0104
121 #define SIMULCRYPT_ECMG_STREAM_CLOSE_RESPONSE 0x0105
122 #define SIMULCRYPT_ECMG_STREAM_ERROR 0x0106
123 /* Reserved 0x0107 - 0x0110 */
124 #define SIMULCRYPT_EMMG_STREAM_SETUP 0x0111
125 #define SIMULCRYPT_EMMG_STREAM_TEST 0x0112
126 #define SIMULCRYPT_EMMG_STREAM_STATUS 0x0113
127 #define SIMULCRYPT_EMMG_STREAM_CLOSE_REQUEST 0x0114
128 #define SIMULCRYPT_EMMG_STREAM_CLOSE_RESPONSE 0x0115
129 #define SIMULCRYPT_EMMG_STREAM_ERROR 0x0116
130 #define SIMULCRYPT_EMMG_STREAM_BW_REQUEST 0x0117
131 #define SIMULCRYPT_EMMG_STREAM_BW_ALLOCATION 0x0118
132 /* Reserved 0x0119 - 0x0200 */
133 #define SIMULCRYPT_ECMG_CW_PROVISION 0x0201
134 #define SIMULCRYPT_ECMG_ECM_RESPONSE 0x0202
135 /* Reserved 0x0203 - 0x0210 */
136 #define SIMULCRYPT_EMMG_DATA_PROVISION 0x0211
137 /* Reserved 0x0212 - 0x0300 */
139 /* Reserved 0x0322 - 0x0400 */
140 #define SIMULCRYPT_EIS_CHANNEL_SET_UP 0x0401
141 #define SIMULCRYPT_EIS_CHANNEL_TEST 0x0402
142 #define SIMULCRYPT_EIS_CHANNEL_STATUS 0x0403
143 #define SIMULCRYPT_EIS_CHANNEL_CLOSE 0x0404
144 #define SIMULCRYPT_EIS_CHANNEL_ERROR 0x0405
145 #define SIMULCRYPT_EIS_CHANNEL_RESET 0x0406
147 #define SIMULCRYPT_EIS_SCG_PROVISION 0x0408
148 #define SIMULCRYPT_EIS_SCG_TEST 0x0409
149 #define SIMULCRYPT_EIS_SCG_STATUS 0x040A
150 #define SIMULCRYPT_EIS_SCG_ERROR 0x040B
151 #define SIMULCRYPT_EIS_SCG_LIST_REQUEST 0x040C
152 #define SIMULCRYPT_EIS_SCG_LIST_RESPONSE 0x040D
154 #define SIMULCRYPT_PSIG_CHANNEL_SETUP 0x0411
155 #define SIMULCRYPT_PSIG_CHANNEL_TEST 0x0412
156 #define SIMULCRYPT_PSIG_CHANNEL_STATUS 0x0413
157 #define SIMULCRYPT_PSIG_CHANNEL_CLOSE 0x0414
158 #define SIMULCRYPT_PSIG_CHANNEL_ERROR 0x0415
160 #define SIMULCRYPT_PSIG_STREAM_SETUP 0x0421
161 #define SIMULCRYPT_PSIG_STREAM_TEST 0x0422
162 #define SIMULCRYPT_PSIG_STREAM_STATUS 0x0423
163 #define SIMULCRYPT_PSIG_STREAM_CLOSE_REQUEST 0x0424
164 #define SIMULCRYPT_PSIG_STREAM_CLOSE_RESPONSE 0x0425
165 #define SIMULCRYPT_PSIG_STREAM_ERROR 0x0426
167 #define SIMULCRYPT_PSIG_CIM_STREAM_SECTION_PROVISION 0x0431
168 #define SIMULCRYPT_PSIG_CIM_CHANNEL_RESET 0x0432
170 #define SIMULCRYPT_PSIG_CIM_STREAM_BW_REQUEST 0x0441
171 #define SIMULCRYPT_PSIG_CIM_STREAM_BW_ALLOCATION 0x0442
172 #define SIMULCRYPT_PSIG_CIM_STREAM_DATA_PROVISION 0x0443
174 /* User defined 0x8000 - 0xFFFF */
176 static const value_string messagetypenames[] = {
177 { SIMULCRYPT_ECMG_CHANNEL_SETUP, "CHANNEL_SETUP" },
178 { SIMULCRYPT_ECMG_CHANNEL_TEST, "CHANNEL_TEST" },
179 { SIMULCRYPT_ECMG_CHANNEL_STATUS, "CHANNEL_STATUS" },
180 { SIMULCRYPT_ECMG_CHANNEL_CLOSE, "CHANNEL_CLOSE" },
181 { SIMULCRYPT_ECMG_CHANNEL_ERROR, "CHANNEL_ERROR" },
183 { SIMULCRYPT_EMMG_CHANNEL_SETUP, "CHANNEL_SETUP" },
184 { SIMULCRYPT_EMMG_CHANNEL_TEST, "CHANNEL_TEST" },
185 { SIMULCRYPT_EMMG_CHANNEL_STATUS, "CHANNEL_STATUS" },
186 { SIMULCRYPT_EMMG_CHANNEL_CLOSE, "CHANNEL_CLOSE" },
187 { SIMULCRYPT_EMMG_CHANNEL_ERROR, "CHANNEL_ERROR" },
189 { SIMULCRYPT_ECMG_STREAM_SETUP, "STREAM_SETUP" },
190 { SIMULCRYPT_ECMG_STREAM_TEST, "STREAM_TEST" },
191 { SIMULCRYPT_ECMG_STREAM_STATUS, "STREAM_STATUS" },
192 { SIMULCRYPT_ECMG_STREAM_CLOSE_REQUEST, "STREAM_CLOSE_REQUEST" },
193 { SIMULCRYPT_ECMG_STREAM_CLOSE_RESPONSE, "STREAM_CLOSE_RESPONSE" },
194 { SIMULCRYPT_ECMG_STREAM_ERROR, "STREAM_ERROR" },
196 { SIMULCRYPT_EMMG_STREAM_SETUP, "STREAM_SETUP" },
197 { SIMULCRYPT_EMMG_STREAM_TEST, "STREAM_TEST" },
198 { SIMULCRYPT_EMMG_STREAM_STATUS, "STREAM_STATUS" },
199 { SIMULCRYPT_EMMG_STREAM_CLOSE_REQUEST, "STREAM_CLOSE_REQUEST" },
200 { SIMULCRYPT_EMMG_STREAM_CLOSE_RESPONSE, "STREAM_CLOSE_RESPONSE" },
201 { SIMULCRYPT_EMMG_STREAM_ERROR, "STREAM_ERROR" },
202 { SIMULCRYPT_EMMG_STREAM_BW_REQUEST, "STREAM_BW_REQUEST" },
203 { SIMULCRYPT_EMMG_STREAM_BW_ALLOCATION, "STREAM_BW_ALLOCATION" },
205 { SIMULCRYPT_ECMG_CW_PROVISION, "CW_PROVISION" },
206 { SIMULCRYPT_ECMG_ECM_RESPONSE, "ECM_RESPONSE" },
208 { SIMULCRYPT_EMMG_DATA_PROVISION, "DATA_PROVISION" },
210 { SIMULCRYPT_EIS_CHANNEL_SET_UP, "CHANNEL_SET_UP" },
211 { SIMULCRYPT_EIS_CHANNEL_TEST, "CHANNEL_TEST" },
212 { SIMULCRYPT_EIS_CHANNEL_STATUS, "CHANNEL_STATUS" },
213 { SIMULCRYPT_EIS_CHANNEL_CLOSE, "CHANNEL_CLOSE" },
214 { SIMULCRYPT_EIS_CHANNEL_ERROR, "CHANNEL_ERROR" },
215 { SIMULCRYPT_EIS_CHANNEL_RESET, "CHANNEL_RESET" },
217 { SIMULCRYPT_EIS_SCG_PROVISION, "SCG_PROVISION" },
218 { SIMULCRYPT_EIS_SCG_TEST, "SCG_TEST" },
219 { SIMULCRYPT_EIS_SCG_STATUS, "SCG_STATUS" },
220 { SIMULCRYPT_EIS_SCG_ERROR, "SCG_ERROR" },
221 { SIMULCRYPT_EIS_SCG_LIST_REQUEST, "SCG_LIST_REQUEST" },
222 { SIMULCRYPT_EIS_SCG_LIST_RESPONSE, "SCG_LIST_RESPONSE" },
225 { SIMULCRYPT_PSIG_CHANNEL_SETUP, "CHANNEL_SETUP" },
226 { SIMULCRYPT_PSIG_CHANNEL_TEST, "CHANNEL_TEST" },
227 { SIMULCRYPT_PSIG_CHANNEL_STATUS, "CHANNEL_STATUS" },
228 { SIMULCRYPT_PSIG_CHANNEL_CLOSE, "CHANNEL_CLOSE" },
229 { SIMULCRYPT_PSIG_CHANNEL_ERROR, "CHANNEL_ERROR" },
231 { SIMULCRYPT_PSIG_STREAM_SETUP, "STREAM_SETUP" },
232 { SIMULCRYPT_PSIG_STREAM_TEST, "STREAM_TEST" },
233 { SIMULCRYPT_PSIG_STREAM_STATUS, "STREAM_STATUS" },
234 { SIMULCRYPT_PSIG_STREAM_CLOSE_REQUEST, "STREAM_CLOSE_REQUEST" },
235 { SIMULCRYPT_PSIG_STREAM_CLOSE_RESPONSE, "STREAM_CLOSE_RESPONSE" },
236 { SIMULCRYPT_PSIG_STREAM_ERROR, "STREAM_ERROR" },
238 { SIMULCRYPT_PSIG_CIM_STREAM_SECTION_PROVISION, "CIM_STREAM_SECTION_PROVISION"},
239 { SIMULCRYPT_PSIG_CIM_CHANNEL_RESET, "CIM_CHANNEL_RESET"},
241 /* XXX: Following added (since they seem to have been missing) */
242 { SIMULCRYPT_PSIG_CIM_STREAM_BW_REQUEST, "CIM_STREAM_BW_REQUEST"},
243 { SIMULCRYPT_PSIG_CIM_STREAM_BW_ALLOCATION, "CIM_STREAM_BW_ALLOCATION"},
244 { SIMULCRYPT_PSIG_CIM_STREAM_DATA_PROVISION, "CIM_STREAM_DATA_PROVISION"},
246 { 0, NULL }
248 static value_string_ext messagetypenames_ext = VALUE_STRING_EXT_INIT(messagetypenames);
250 /* Simulcrypt ECMG Parameter Types */
251 #define SIMULCRYPT_ECMG_DVB_RESERVED 0x0000
252 #define SIMULCRYPT_ECMG_SUPER_CAS_ID 0x0001
253 #define SIMULCRYPT_ECMG_SECTION_TSPKT_FLAG 0x0002
254 #define SIMULCRYPT_ECMG_DELAY_START 0x0003
255 #define SIMULCRYPT_ECMG_DELAY_STOP 0x0004
256 #define SIMULCRYPT_ECMG_TRANSITION_DELAY_START 0x0005
257 #define SIMULCRYPT_ECMG_TRANSITION_DELAY_STOP 0x0006
258 #define SIMULCRYPT_ECMG_ECM_REP_PERIOD 0x0007
259 #define SIMULCRYPT_ECMG_MAX_STREAMS 0x0008
260 #define SIMULCRYPT_ECMG_MIN_CP_DURATION 0x0009
261 #define SIMULCRYPT_ECMG_LEAD_CW 0x000A
262 #define SIMULCRYPT_ECMG_CW_PER_MESSAGE 0x000B
263 #define SIMULCRYPT_ECMG_MAX_COMP_TIME 0x000C
264 #define SIMULCRYPT_ECMG_ACCESS_CRITERIA 0x000D
265 #define SIMULCRYPT_ECMG_ECM_CHANNEL_ID 0x000E
266 #define SIMULCRYPT_ECMG_ECM_STREAM_ID 0x000F
267 #define SIMULCRYPT_ECMG_NOMINAL_CP_DURATION 0x0010
268 #define SIMULCRYPT_ECMG_ACCESS_CRITERIA_TRANSFER_MODE 0x0011
269 #define SIMULCRYPT_ECMG_CP_NUMBER 0x0012
270 #define SIMULCRYPT_ECMG_CP_DURATION 0x0013
271 #define SIMULCRYPT_ECMG_CP_CW_COMBINATION 0x0014
272 #define SIMULCRYPT_ECMG_ECM_DATAGRAM 0x0015
273 #define SIMULCRYPT_ECMG_AC_DELAY_START 0x0016
274 #define SIMULCRYPT_ECMG_AC_DELAY_STOP 0x0017
275 #define SIMULCRYPT_ECMG_CW_ENCRYPTION 0x0018
276 #define SIMULCRYPT_ECMG_ECM_ID 0x0019
277 #define SIMULCRYPT_ECMG_ERROR_STATUS 0x7000
278 #define SIMULCRYPT_ECMG_ERROR_INFORMATION 0x7001
280 static const value_string ecmg_parametertypenames[] = {
281 { SIMULCRYPT_ECMG_DVB_RESERVED, "DVB_RESERVED" },
282 { SIMULCRYPT_ECMG_SUPER_CAS_ID, "SUPER_CAS_ID" },
283 { SIMULCRYPT_ECMG_SECTION_TSPKT_FLAG, "SECTION_TSPKT_FLAG" },
284 { SIMULCRYPT_ECMG_DELAY_START, "DELAY_START" },
285 { SIMULCRYPT_ECMG_DELAY_STOP, "DELAY_STOP" },
286 { SIMULCRYPT_ECMG_TRANSITION_DELAY_START, "TRANSITION_DELAY_START" },
287 { SIMULCRYPT_ECMG_TRANSITION_DELAY_STOP, "TRANSITION_DELAY_STOP" },
288 { SIMULCRYPT_ECMG_ECM_REP_PERIOD, "ECM_REP_PERIOD" },
289 { SIMULCRYPT_ECMG_MAX_STREAMS, "MAX_STREAMS" },
290 { SIMULCRYPT_ECMG_MIN_CP_DURATION, "MIN_CP_DURATION" },
291 { SIMULCRYPT_ECMG_LEAD_CW, "LEAD_CW" },
292 { SIMULCRYPT_ECMG_CW_PER_MESSAGE, "CW_PER_MESSAGE" },
293 { SIMULCRYPT_ECMG_MAX_COMP_TIME, "MAX_COMP_TIME" },
294 { SIMULCRYPT_ECMG_ACCESS_CRITERIA, "ACCESS_CRITERIA" },
295 { SIMULCRYPT_ECMG_ECM_CHANNEL_ID, "ECM_CHANNEL_ID" },
296 { SIMULCRYPT_ECMG_ECM_STREAM_ID, "ECM_STREAM_ID" },
297 { SIMULCRYPT_ECMG_NOMINAL_CP_DURATION, "NOMINAL_CP_DURATION" },
298 { SIMULCRYPT_ECMG_ACCESS_CRITERIA_TRANSFER_MODE, "ACCESS_CRITERIA_TRANSFER_MODE" },
299 { SIMULCRYPT_ECMG_CP_NUMBER, "CP_NUMBER" },
300 { SIMULCRYPT_ECMG_CP_DURATION, "CP_DURATION" },
301 { SIMULCRYPT_ECMG_CP_CW_COMBINATION, "CP_CW_COMBINATION" },
302 { SIMULCRYPT_ECMG_ECM_DATAGRAM, "ECM_DATAGRAM" },
303 { SIMULCRYPT_ECMG_AC_DELAY_START, "AC_DELAY_START" },
304 { SIMULCRYPT_ECMG_AC_DELAY_STOP, "AC_DELAY_STOP" },
305 { SIMULCRYPT_ECMG_CW_ENCRYPTION, "CW_ENCRYPTION" },
306 { SIMULCRYPT_ECMG_ECM_ID, "ECM_ID" },
307 { SIMULCRYPT_ECMG_ERROR_STATUS, "ERROR_STATUS" },
308 { SIMULCRYPT_ECMG_ERROR_INFORMATION, "ERROR_INFORMATION" },
309 { 0, NULL }
311 static value_string_ext ecmg_parametertypenames_ext = VALUE_STRING_EXT_INIT(ecmg_parametertypenames);
313 /* Simulcrypt ECMG protocol error values */
314 static const value_string ecmg_error_values[] = {
315 { 0x0000, "DVB Reserved" },
316 { 0x0001, "Invalid message" },
317 { 0x0002, "Unsupported protocol version" },
318 { 0x0003, "Unknown message type value" },
319 { 0x0004, "Message too long" },
320 { 0x0005, "Unknown super CAS ID value" },
321 { 0x0006, "Unknown ECM channel ID value" },
322 { 0x0007, "Unknown ECM stream ID value" },
323 { 0x0008, "Too many channels on this ECMG" },
324 { 0x0009, "Too many ECM streams on this channel" },
325 { 0x000A, "Too many ECM streams on this ECMG" },
326 { 0x000B, "Not enough control words to compute ECM" },
327 { 0x000C, "ECMG out of storage capacity" },
328 { 0x000D, "ECMG out of computational resources" },
329 { 0x000E, "Unknown parameter type value" },
330 { 0x000F, "Inconsistent length for DVB parameter" },
331 { 0x0010, "Missing mandatory DVB parameter" },
332 { 0x0011, "Invalid value for DVB parameter" },
333 { 0x0012, "Unknown ECM ID value" },
334 { 0x0013, "ECM channel ID value already in use" },
335 { 0x0014, "ECM stream ID value already in use" },
336 { 0x0015, "ECM ID value already in use" },
337 { 0x7000, "Unknown error" },
338 { 0x7001, "Unrecoverable error" },
339 { 0, NULL }
341 static value_string_ext ecmg_error_values_ext = VALUE_STRING_EXT_INIT(ecmg_error_values);
343 /* Simulcrypt EMMG Parameter Types */
344 #define SIMULCRYPT_EMMG_DVB_RESERVED 0x0000
345 #define SIMULCRYPT_EMMG_CLIENT_ID 0x0001
346 #define SIMULCRYPT_EMMG_SECTION_TSPKT_FLAG 0x0002
347 #define SIMULCRYPT_EMMG_DATA_CHANNEL_ID 0x0003
348 #define SIMULCRYPT_EMMG_DATA_STREAM_ID 0x0004
349 #define SIMULCRYPT_EMMG_DATAGRAM 0x0005
350 #define SIMULCRYPT_EMMG_BANDWIDTH 0x0006
351 #define SIMULCRYPT_EMMG_DATA_TYPE 0x0007
352 #define SIMULCRYPT_EMMG_DATA_ID 0x0008
353 #define SIMULCRYPT_EMMG_ERROR_STATUS 0x7000
354 #define SIMULCRYPT_EMMG_ERROR_INFORMATION 0x7001
356 static const value_string emmg_parametertypenames[] = {
357 { SIMULCRYPT_EMMG_DVB_RESERVED, "DVB_RESERVED" },
358 { SIMULCRYPT_EMMG_CLIENT_ID, "CLIENT_ID" },
359 { SIMULCRYPT_EMMG_SECTION_TSPKT_FLAG, "SECTION_TSPKT_FLAG" },
360 { SIMULCRYPT_EMMG_DATA_CHANNEL_ID, "DATA_CHANNEL_ID" },
361 { SIMULCRYPT_EMMG_DATA_STREAM_ID, "DATA_STREAM_ID" },
362 { SIMULCRYPT_EMMG_DATAGRAM, "DATAGRAM" },
363 { SIMULCRYPT_EMMG_BANDWIDTH, "BANDWIDTH" },
364 { SIMULCRYPT_EMMG_DATA_TYPE, "DATA_TYPE" },
365 { SIMULCRYPT_EMMG_DATA_ID, "DATA_ID" },
366 { SIMULCRYPT_EMMG_ERROR_STATUS, "ERROR_STATUS" },
367 { SIMULCRYPT_EMMG_ERROR_INFORMATION, "ERROR_INFORMATION" },
368 { 0, NULL }
370 static value_string_ext emmg_parametertypenames_ext = VALUE_STRING_EXT_INIT(emmg_parametertypenames);
372 /* Simulcrypt EMMG protocol error values */
373 static const value_string emmg_error_values[] = {
374 { 0x0000, "DVB Reserved" },
375 { 0x0001, "Invalid message" },
376 { 0x0002, "Unsupported protocol version" },
377 { 0x0003, "Unknown message type value" },
378 { 0x0004, "Message too long" },
379 { 0x0005, "Unknown data stream ID value" },
380 { 0x0006, "Unknown data channel ID value" },
381 { 0x0007, "Too many channels on this MUX" },
382 { 0x0008, "Too many data streams on this channel" },
383 { 0x0009, "Too many data streams on this MUX" },
384 { 0x000A, "Unknown parameter type" },
385 { 0x000B, "Inconsistent length for DVB parameter" },
386 { 0x000C, "Missing mandatory DVB parameter" },
387 { 0x000D, "Invalid value for DVB parameter" },
388 { 0x000E, "Unknown client ID value" },
389 { 0x000F, "Exceeded bandwidth" },
390 { 0x0010, "Unknown data ID value" },
391 { 0x0011, "Data channel ID value already in use" },
392 { 0x0012, "Data stream ID value already in use" },
393 { 0x0013, "Data ID value already in use" },
394 { 0x0014, "Client ID value already in use" },
395 { 0x7000, "Unknown error" },
396 { 0x7001, "Unrecoverable error" },
397 { 0, NULL }
399 static value_string_ext emmg_error_values_ext = VALUE_STRING_EXT_INIT(emmg_error_values);
401 /* Simulcrypt EIS Parameter Types */
402 #define SIMULCRYPT_EIS_DVB_RESERVED 0x0000
403 #define SIMULCRYPT_EIS_CHANNEL_ID 0x0001
404 #define SIMULCRYPT_EIS_SERVICE_FLAG 0x0002
405 #define SIMULCRYPT_EIS_COMPONENT_FLAG 0x0003
406 #define SIMULCRYPT_EIS_MAX_SCG 0x0004
407 #define SIMULCRYPT_EIS_ECM_GROUP 0x0005
408 #define SIMULCRYPT_EIS_SCG_ID 0x0006
409 #define SIMULCRYPT_EIS_SCG_REFERENCE_ID 0x0007
410 #define SIMULCRYPT_EIS_SUPER_CAS_ID 0x0008
411 #define SIMULCRYPT_EIS_ECM_ID 0x0009
412 #define SIMULCRYPT_EIS_ACCESS_CRITERIA 0x000A
413 #define SIMULCRYPT_EIS_ACTIVATION_TIME 0x000B
414 #define SIMULCRYPT_EIS_ACTIVATION_PENDING_FLAG 0x000C
415 #define SIMULCRYPT_EIS_COMPONENT_ID 0x000D
416 #define SIMULCRYPT_EIS_SERVICE_ID 0x000E
417 #define SIMULCRYPT_EIS_TRANSPORT_STREAM_ID 0x000F
418 #define SIMULCRYPT_EIS_AC_CHANGED_FLAG 0x0010
419 #define SIMULCRYPT_EIS_SCG_CURRENT_REFERENCE_ID 0x0011
420 #define SIMULCRYPT_EIS_SCG_PENDING_REFERENCE_ID 0x0012
421 #define SIMULCRYPT_EIS_CP_DURATION_FLAG 0x0013
422 #define SIMULCRYPT_EIS_RECOMMENDED_CP_DURATION 0x0014
423 #define SIMULCRYPT_EIS_SCG_NOMINAL_CP_DURATION 0x0015
424 #define SIMULCRYPT_EIS_ORIGINAL_NETWORK_ID 0x0016
426 #define SIMULCRYPT_EIS_ERROR_STATUS 0x7000
427 #define SIMULCRYPT_EIS_ERROR_INFORMATION 0x7001
428 #define SIMULCRYPT_EIS_ERROR_DESCRIPTION 0x7002
430 static const value_string eis_parametertypenames[] = {
431 { SIMULCRYPT_EIS_DVB_RESERVED, "DVB_RESERVED" },
432 { SIMULCRYPT_EIS_CHANNEL_ID, "EIS_CHANNEL_ID" },
433 { SIMULCRYPT_EIS_SERVICE_FLAG, "SERVICE_FLAG" },
434 { SIMULCRYPT_EIS_COMPONENT_FLAG, "COMPONENT_FLAG" },
435 { SIMULCRYPT_EIS_MAX_SCG, "MAX_SCG" },
436 { SIMULCRYPT_EIS_ECM_GROUP, "ECM_GROUP" },
437 { SIMULCRYPT_EIS_SCG_ID, "SCG_ID" },
438 { SIMULCRYPT_EIS_SCG_REFERENCE_ID, "SCG_REFERENCE_ID" },
439 { SIMULCRYPT_EIS_SUPER_CAS_ID, "SUPER_CAS_ID" },
440 { SIMULCRYPT_EIS_ECM_ID, "ECM_ID" },
441 { SIMULCRYPT_EIS_ACCESS_CRITERIA, "ACCESS_CRITERIA" },
442 { SIMULCRYPT_EIS_ACTIVATION_TIME, "ACTIVATION_TIME" },
443 { SIMULCRYPT_EIS_ACTIVATION_PENDING_FLAG, "ACTIVATION_PENDING_FLAG" },
444 { SIMULCRYPT_EIS_COMPONENT_ID, "COMPONENT_ID" },
445 { SIMULCRYPT_EIS_SERVICE_ID, "SERVICE_ID" },
446 { SIMULCRYPT_EIS_TRANSPORT_STREAM_ID, "TRANSPORT_STREAM_ID" },
447 { SIMULCRYPT_EIS_AC_CHANGED_FLAG, "AC_CHANGED_FLAG" },
448 { SIMULCRYPT_EIS_SCG_CURRENT_REFERENCE_ID, "SCG_CURRENT_REFERENCE_ID" },
449 { SIMULCRYPT_EIS_SCG_PENDING_REFERENCE_ID, "SCG_PENDING_REFERENCE_ID" },
450 { SIMULCRYPT_EIS_CP_DURATION_FLAG, "CP_DURATION_FLAG" },
451 { SIMULCRYPT_EIS_RECOMMENDED_CP_DURATION, "RECOMMENDED_CP_DURATION" },
452 { SIMULCRYPT_EIS_SCG_NOMINAL_CP_DURATION, "SCG_NOMINAL_CP_DURATION" },
453 { SIMULCRYPT_EIS_ORIGINAL_NETWORK_ID, "ORIGINAL_NETWORK_ID" },
455 { SIMULCRYPT_EIS_ERROR_STATUS, "ERROR_STATUS" },
456 { SIMULCRYPT_EIS_ERROR_INFORMATION, "ERROR_INFORMATION" },
457 { SIMULCRYPT_EIS_ERROR_DESCRIPTION, "ERROR_DESCRIPTION" },
459 { 0, NULL }
461 static value_string_ext eis_parametertypenames_ext = VALUE_STRING_EXT_INIT(eis_parametertypenames);
463 /* Simulcrypt EIS protocol error values */
464 static const value_string eis_error_values[] = {
465 { 0x0000, "DVB Reserved" },
466 { 0x0001, "Invalid message" },
467 { 0x0002, "Unsupported protocol version" },
468 { 0x0003, "Unknown message_type value" },
469 { 0x0004, "Message too long" },
470 { 0x0005, "Inconsistent length for parameter" },
471 { 0x0006, "Missing mandatory parameter" },
472 { 0x0007, "Invalid value for parameter" },
473 { 0x0008, "Unknown EIS_channel_ID value" },
474 { 0x0009, "Unknown SCG_ID value" },
475 { 0x000A, "Max SCGs already defined" },
476 { 0x000B, "Service level SCG definitions not supportend" },
477 { 0x000C, "Elementary Stream level SCG definitions not supported" },
478 { 0x000D, "Activation_time possibly too soon for SCS to be accurate" },
479 { 0x000E, "SCG definition cannot span transport boundaries" },
480 { 0x000F, "A resource does not exist on this SCG" },
481 { 0x0010, "A resource is already defined in an existing SCG" },
482 { 0x0011, "SCG may not contain one or more content entries and no ECM_Group entries" },
483 { 0x0012, "SCG may not contain one or more ECM_Group entries and no content entries" },
484 { 0x0013, "EIS_channel_ID value already in use" },
485 { 0x0014, "Unknown Super_CAS_Id" },
487 { 0x7000, "Unknown error" },
488 { 0x7001, "Unrecoverable error" },
490 { 0, NULL }
492 static value_string_ext eis_error_values_ext = VALUE_STRING_EXT_INIT(eis_error_values);
494 /* Simulcrypt PSIG Parameter Types */
495 #define SIMULCRYPT_PSIG_DVB_RESERVED 0x0000
496 #define SIMULCRYPT_PSIG_PSIG_TYPE 0x0001
497 #define SIMULCRYPT_PSIG_CHANNEL_ID 0x0002
498 #define SIMULCRYPT_PSIG_STREAM_ID 0x0003
499 #define SIMULCRYPT_PSIG_TRANSPORT_STREAM_ID 0x0004
500 #define SIMULCRYPT_PSIG_ORIGINAL_NETWORK_ID 0x0005
501 #define SIMULCRYPT_PSIG_PACKET_ID 0x0006
502 #define SIMULCRYPT_PSIG_INTERFACE_MODE_CONFIGURATION 0x0007
503 #define SIMULCRYPT_PSIG_MAX_STREAM 0x0008
504 #define SIMULCRYPT_PSIG_TABLE_PERIOD_PAIR 0x0009
505 #define SIMULCRYPT_PSIG_MPEG_SECTION 0x000A
506 #define SIMULCRYPT_PSIG_REPETITION_RATE 0x000B
507 #define SIMULCRYPT_PSIG_ACTIVATION_TIME 0x000C
508 #define SIMULCRYPT_PSIG_DATAGRAM 0x000D
509 #define SIMULCRYPT_PSIG_BANDWIDTH 0x000E
510 #define SIMULCRYPT_PSIG_INITIAL_BANDWIDTH 0x000F
511 #define SIMULCRYPT_PSIG_MAX_COMP_TIME 0x0010
512 #define SIMULCRYPT_PSIG_ASI_INPUT_PACKET_ID 0x0011
514 #define SIMULCRYPT_PSIG_ERROR_STATUS 0x7000
515 #define SIMULCRYPT_PSIG_ERROR_INFORMATION 0x7001
517 static const value_string psig_parametertypenames[] = {
518 { SIMULCRYPT_PSIG_DVB_RESERVED, "DVB_RESERVED" },
519 { SIMULCRYPT_PSIG_PSIG_TYPE, "PSIG_TYPE" },
520 { SIMULCRYPT_PSIG_CHANNEL_ID, "PSIG_CHANNEL_ID" },
521 { SIMULCRYPT_PSIG_STREAM_ID, "STREAM_ID" },
522 { SIMULCRYPT_PSIG_TRANSPORT_STREAM_ID, "TRANSPORT_STREAM_ID" },
523 { SIMULCRYPT_PSIG_ORIGINAL_NETWORK_ID, "ORIGINAL_NETWORK_ID" },
524 { SIMULCRYPT_PSIG_PACKET_ID, "PACKET_ID" },
525 { SIMULCRYPT_PSIG_INTERFACE_MODE_CONFIGURATION, "INTERFACE_MODE_CONFIGURATION" },
526 { SIMULCRYPT_PSIG_MAX_STREAM, "MAX_STREAM" },
527 { SIMULCRYPT_PSIG_TABLE_PERIOD_PAIR, "TABLE_PERIOD_PAIR" },
528 { SIMULCRYPT_PSIG_MPEG_SECTION, "MPEG_SECTION" },
529 { SIMULCRYPT_PSIG_REPETITION_RATE, "REPETITION_RATE" },
530 { SIMULCRYPT_PSIG_ACTIVATION_TIME, "ACTIVATION_TIME" },
531 { SIMULCRYPT_PSIG_DATAGRAM, "DATAGRAM" },
532 { SIMULCRYPT_PSIG_BANDWIDTH, "BANDWIDTH" },
533 { SIMULCRYPT_PSIG_INITIAL_BANDWIDTH, "INITIAL_BANDWIDTH" },
534 { SIMULCRYPT_PSIG_MAX_COMP_TIME, "MAX_COMP_TIME" },
535 { SIMULCRYPT_PSIG_ASI_INPUT_PACKET_ID, "ASI_INPUT_PACKET_ID" },
537 { SIMULCRYPT_PSIG_ERROR_STATUS, "ERROR_STATUS" },
538 { SIMULCRYPT_PSIG_ERROR_INFORMATION, "ERROR_INFORMATION" },
540 { 0, NULL }
542 static value_string_ext psig_parametertypenames_ext = VALUE_STRING_EXT_INIT(psig_parametertypenames);
544 #if 0
545 /* Simulcrypt PSIG protocol error values */
546 static const value_string psig_error_values[] = {
547 { 0x0000, "DVB Reserved" },
548 { 0x0001, "Invalid message" },
549 { 0x0002, "Unsupported protocol version" },
550 { 0x0003, "Unknown message_type value" },
551 { 0x0004, "Message too long" },
552 { 0x0005, "Unknown stream_ID value" },
553 { 0x0006, "Unknown channel_ID value" },
554 { 0x0007, "Too many channels on this MUX" },
555 { 0x0008, "Too many data streams on this channel" },
556 { 0x0009, "Too many data streams on this MUX" },
557 { 0x000A, "Unknown parameter_type" },
558 { 0x000B, "Inconsistent length for parameter" },
559 { 0x000C, "Missing mandatory parameter" },
560 { 0x000D, "Invalid value for parameter" },
561 { 0x000E, "Inconsistent value of transport_stream_ID" },
562 { 0x000F, "Inconsistent value of packet_ID" },
563 { 0x0010, "channel_ID value already in use" },
564 { 0x0011, "stream_ID value already in use" },
565 { 0x0012, "Stream already open for this pair (transport_stream_ID, packet_ID)" },
566 { 0x0013, "Overflow error when receiving the list of MPEG (CiM error type)" },
567 { 0x0014, "Inconsistent format of TOT template (CiM error type)" },
568 { 0x0015, "Warning: Difficulties in respecting the requested repetition_rates for the last 5 minutes (CiM error type)" },
569 { 0x0016, "Warning: Difficulties in respecting the requested Bandwidth for the last 5 minutes (CiM error type)" },
571 { 0x7000, "Unknown error" },
572 { 0x7001, "Unrecoverable error" },
574 { 0, NULL }
576 static value_string_ext psig_error_values_ext = VALUE_STRING_EXT_INIT(psig_error_values);
577 #endif
579 /* The following hf_* variables are used to hold the Wireshark IDs of
580 * our header fields; they are filled out when we call
581 * proto_register_field_array() in proto_register_simulcrypt()
583 static int hf_simulcrypt_header;
584 static int hf_simulcrypt_version;
585 static int hf_simulcrypt_message_type;
586 static int hf_simulcrypt_interface;
587 static int hf_simulcrypt_message_length;
588 static int hf_simulcrypt_message;
589 static int hf_simulcrypt_parameter;
590 static int hf_simulcrypt_parameter_type;
591 static int hf_simulcrypt_ecmg_parameter_type;
592 static int hf_simulcrypt_emmg_parameter_type;
593 static int hf_simulcrypt_parameter_length;
594 static int hf_simulcrypt_ca_system_id;
595 static int hf_simulcrypt_ca_subsystem_id;
596 static int hf_simulcrypt_super_cas_id;
597 static int hf_simulcrypt_section_tspkt_flag;
598 static int hf_simulcrypt_ecm_channel_id;
599 static int hf_simulcrypt_delay_start;
600 static int hf_simulcrypt_delay_stop;
601 static int hf_simulcrypt_ac_delay_start;
602 static int hf_simulcrypt_ac_delay_stop;
603 static int hf_simulcrypt_transition_delay_start;
604 static int hf_simulcrypt_transition_delay_stop;
605 static int hf_simulcrypt_ecm_rep_period;
606 static int hf_simulcrypt_max_streams;
607 static int hf_simulcrypt_min_cp_duration;
608 static int hf_simulcrypt_lead_cw;
609 static int hf_simulcrypt_cw_per_msg;
610 static int hf_simulcrypt_max_comp_time;
611 static int hf_simulcrypt_access_criteria;
612 static int hf_simulcrypt_ecm_stream_id;
613 static int hf_simulcrypt_nominal_cp_duration;
614 static int hf_simulcrypt_access_criteria_transfer_mode;
615 static int hf_simulcrypt_cp_number;
616 static int hf_simulcrypt_cp_duration;
617 static int hf_simulcrypt_cp_cw_combination;
618 static int hf_simulcrypt_ecm_datagram;
619 static int hf_simulcrypt_cw_encryption;
620 static int hf_simulcrypt_ecm_id;
621 static int hf_simulcrypt_client_id;
622 static int hf_simulcrypt_data_channel_id;
623 static int hf_simulcrypt_data_stream_id;
624 static int hf_simulcrypt_datagram;
625 static int hf_simulcrypt_bandwidth;
626 static int hf_simulcrypt_data_type;
627 static int hf_simulcrypt_data_id;
628 static int hf_simulcrypt_ecmg_error_status;
629 static int hf_simulcrypt_emmg_error_status;
630 static int hf_simulcrypt_error_information;
632 static int hf_simulcrypt_eis_parameter_type;
633 static int hf_simulcrypt_eis_channel_id;
634 static int hf_simulcrypt_service_flag;
635 static int hf_simulcrypt_component_flag;
636 static int hf_simulcrypt_max_scg;
637 static int hf_simulcrypt_ecm_group;
638 static int hf_simulcrypt_scg_id;
639 static int hf_simulcrypt_scg_reference_id;
640 static int hf_simulcrypt_activation_time;
641 static int hf_simulcrypt_year;
642 static int hf_simulcrypt_month;
643 static int hf_simulcrypt_day;
644 static int hf_simulcrypt_hour;
645 static int hf_simulcrypt_minute;
646 static int hf_simulcrypt_second;
647 static int hf_simulcrypt_hundredth_second;
648 static int hf_simulcrypt_activation_pending_flag;
649 static int hf_simulcrypt_component_id;
650 static int hf_simulcrypt_service_id;
651 static int hf_simulcrypt_transport_stream_id;
652 static int hf_simulcrypt_ac_changed_flag;
653 static int hf_simulcrypt_scg_current_reference_id;
654 static int hf_simulcrypt_scg_pending_reference_id;
655 static int hf_simulcrypt_cp_duration_flag;
656 static int hf_simulcrypt_recommended_cp_duration;
657 static int hf_simulcrypt_scg_nominal_cp_duration;
658 static int hf_simulcrypt_original_network_id;
659 static int hf_simulcrypt_eis_error_status;
660 static int hf_simulcrypt_error_description;
662 static int hf_simulcrypt_psig_parameter_type;
663 static int hf_simulcrypt_psig_type;
664 static int hf_simulcrypt_channel_id;
665 static int hf_simulcrypt_stream_id;
666 static int hf_simulcrypt_packet_id;
667 static int hf_simulcrypt_interface_mode_configuration;
668 static int hf_simulcrypt_max_stream;
669 static int hf_simulcrypt_table_period_pair;
670 static int hf_simulcrypt_mpeg_section;
671 static int hf_simulcrypt_repetition_rate;
672 static int hf_simulcrypt_initial_bandwidth;
673 static int hf_simulcrypt_asi_input_packet_id;
674 static int hf_simulcrypt_psig_error_status;
675 static int hf_simulcrypt_parameter_value;
677 /* These are the ids of the subtrees that we may be creating */
678 static int ett_simulcrypt;
679 static int ett_simulcrypt_header;
680 static int ett_simulcrypt_message;
681 static int ett_simulcrypt_parameter;
682 static int ett_simulcrypt_super_cas_id;
683 static int ett_simulcrypt_ecm_datagram;
684 static int ett_simulcrypt_ecm_group;
685 static int ett_simulcrypt_activation_time;
686 static int ett_simulcrypt_table_period_pair;
689 #define FRAME_HEADER_LEN 8
691 /* The main dissecting routine */
692 static int
693 dissect_simulcrypt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
695 tcp_dissect_pdus(tvb, pinfo, tree, true, FRAME_HEADER_LEN,
696 get_simulcrypt_message_len, dissect_simulcrypt_message, data);
697 return tvb_captured_length(tvb);
700 /* Informative tree structure is shown here:
701 * TREE -
702 * - HEADER
703 * version
704 * message type
705 * message length
706 * - MESSAGE
707 * - TYPE of parameter
708 * length of parameter
709 value of parameter
710 - PARAMETER (optional branch for certain parameters only)
711 * parameter value sub items here
712 * End informative tree structure
715 static uint16_t
716 get_interface (uint16_t type)
718 int interface;
720 if (type >= 0x8000) {
721 return SIMULCRYPT_USER_DEFINED;
724 /* Hex values fetched from Table 3: Message-type values for command/response-based protocols */
725 switch (type & 0xFFF0) {
726 case 0x0000:
727 case 0x0100:
728 case 0x0200:
729 interface = SIMULCRYPT_ECMG_SCS;
730 break;
731 case 0x0010:
732 case 0x0110:
733 case 0x0210:
734 interface = SIMULCRYPT_EMMG_MUX;
735 break;
736 case 0x0310:
737 case 0x0320:
738 interface = SIMULCRYPT_CPSIG_PSIG;
739 break;
740 case 0x0400:
741 interface = SIMULCRYPT_EIS_SCS;
742 break;
743 case 0x0410:
744 case 0x0420:
745 interface = SIMULCRYPT_PSIG_MUX;
746 break;
747 case 0x0430:
748 interface = SIMULCRYPT_MUX_CIM;
749 break;
750 case 0x0440:
751 interface = SIMULCRYPT_PSIG_CIP;
752 break;
753 default:
754 interface = SIMULCRYPT_RESERVED;
755 break;
758 return interface;
761 static void
762 dissect_ecmg_parameter_value (proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, uint32_t offset,
763 uint16_t plen, uint16_t ptype, char *pvalue_char)
765 proto_item *simulcrypt_item;
766 proto_tree *simulcrypt_super_cas_id_tree;
767 proto_tree *simulcrypt_ecm_datagram_tree;
768 tvbuff_t *next_tvb;
769 uint32_t pvaluedec; /* parameter decimal value */
770 int ca_system_id;
771 unsigned i;
773 switch (ptype) {
774 case SIMULCRYPT_ECMG_SUPER_CAS_ID:
775 /* add super_cas_id item */
776 simulcrypt_item = proto_tree_add_item(tree, hf_simulcrypt_super_cas_id, tvb, offset, plen, ENC_BIG_ENDIAN); /* value item */
777 simulcrypt_super_cas_id_tree = proto_item_add_subtree(simulcrypt_item, ett_simulcrypt_super_cas_id);
779 /* Simulcrypt_super_cas_id_tree */
780 simulcrypt_item = proto_tree_add_item(simulcrypt_super_cas_id_tree, hf_simulcrypt_ca_system_id, tvb, offset, 2, ENC_BIG_ENDIAN );
782 /* Test for known CA_System_ID */
783 ca_system_id = tvb_get_ntohs(tvb,offset);
784 for(i=0;i<ECM_INTERPRETATION_SIZE;i++)
786 if(tab_ecm_inter[i].ca_system_id==ca_system_id)
788 tab_ecm_inter[i].ecmg_port=pinfo->destport;
789 proto_item_append_text(simulcrypt_item, ", Port %d, Protocol %s",tab_ecm_inter[i].ecmg_port, tab_ecm_inter[i].protocol_name);
790 break;
793 proto_tree_add_item(simulcrypt_super_cas_id_tree, hf_simulcrypt_ca_subsystem_id, tvb, offset+2, 2, ENC_BIG_ENDIAN );
794 break;
795 case SIMULCRYPT_ECMG_SECTION_TSPKT_FLAG:
796 proto_tree_add_item(tree, hf_simulcrypt_section_tspkt_flag, tvb, offset, plen, ENC_BIG_ENDIAN); /* value item */
797 break;
798 case SIMULCRYPT_ECMG_ECM_CHANNEL_ID:
799 proto_tree_add_item(tree, hf_simulcrypt_ecm_channel_id, tvb, offset, plen, ENC_BIG_ENDIAN);
800 break;
801 case SIMULCRYPT_ECMG_DELAY_START:
802 proto_tree_add_item(tree, hf_simulcrypt_delay_start, tvb, offset, plen, ENC_BIG_ENDIAN);
803 break;
804 case SIMULCRYPT_ECMG_DELAY_STOP:
805 proto_tree_add_item(tree, hf_simulcrypt_delay_stop, tvb, offset, plen, ENC_BIG_ENDIAN);
806 break;
807 case SIMULCRYPT_ECMG_TRANSITION_DELAY_START:
808 proto_tree_add_item(tree, hf_simulcrypt_transition_delay_start, tvb, offset, plen, ENC_BIG_ENDIAN);
809 break;
810 case SIMULCRYPT_ECMG_TRANSITION_DELAY_STOP:
811 proto_tree_add_item(tree, hf_simulcrypt_transition_delay_stop, tvb, offset, plen, ENC_BIG_ENDIAN);
812 break;
813 case SIMULCRYPT_ECMG_AC_DELAY_START:
814 proto_tree_add_item(tree, hf_simulcrypt_ac_delay_start, tvb, offset, plen, ENC_BIG_ENDIAN);
815 break;
816 case SIMULCRYPT_ECMG_AC_DELAY_STOP:
817 proto_tree_add_item(tree, hf_simulcrypt_ac_delay_stop, tvb, offset, plen, ENC_BIG_ENDIAN);
818 break;
819 case SIMULCRYPT_ECMG_ECM_REP_PERIOD:
820 proto_tree_add_item(tree, hf_simulcrypt_ecm_rep_period, tvb, offset, plen, ENC_BIG_ENDIAN);
821 break;
822 case SIMULCRYPT_ECMG_MAX_STREAMS:
823 proto_tree_add_item(tree, hf_simulcrypt_max_streams, tvb, offset, plen, ENC_BIG_ENDIAN);
824 break;
825 case SIMULCRYPT_ECMG_MIN_CP_DURATION:
826 /* convert value to ms (in units 100 ms) */
827 pvaluedec = tvb_get_ntohs(tvb, offset); /* read 2 byte min CP duration value */
828 pvaluedec = pvaluedec*100; /* in ms now */
829 simulcrypt_item = proto_tree_add_item(tree, hf_simulcrypt_min_cp_duration, tvb, offset, plen, ENC_BIG_ENDIAN);
830 proto_item_append_text(simulcrypt_item, " (%d ms)",pvaluedec);
831 break;
832 case SIMULCRYPT_ECMG_LEAD_CW:
833 proto_tree_add_item(tree, hf_simulcrypt_lead_cw, tvb, offset, plen, ENC_BIG_ENDIAN);
834 break;
835 case SIMULCRYPT_ECMG_CW_PER_MESSAGE:
836 proto_tree_add_item(tree, hf_simulcrypt_cw_per_msg, tvb, offset, plen, ENC_BIG_ENDIAN);
837 break;
838 case SIMULCRYPT_ECMG_MAX_COMP_TIME:
839 proto_tree_add_item(tree, hf_simulcrypt_max_comp_time, tvb, offset, plen, ENC_BIG_ENDIAN);
840 break;
841 case SIMULCRYPT_ECMG_ACCESS_CRITERIA:
842 proto_tree_add_item(tree, hf_simulcrypt_access_criteria, tvb, offset, plen, ENC_NA);
843 break;
844 case SIMULCRYPT_ECMG_ECM_STREAM_ID:
845 proto_tree_add_item(tree, hf_simulcrypt_ecm_stream_id, tvb, offset, plen, ENC_BIG_ENDIAN);
846 break;
847 case SIMULCRYPT_ECMG_NOMINAL_CP_DURATION:
848 /* convert value to ms (in units 100 ms) */
849 pvaluedec = tvb_get_ntohs(tvb, offset); /* read 2 byte nominal CP duration value */
850 pvaluedec = pvaluedec*100; /* in ms now */
851 simulcrypt_item = proto_tree_add_item(tree, hf_simulcrypt_nominal_cp_duration, tvb, offset, plen, ENC_BIG_ENDIAN);
852 proto_item_append_text(simulcrypt_item, " (%d ms)", pvaluedec);
853 break;
854 case SIMULCRYPT_ECMG_ACCESS_CRITERIA_TRANSFER_MODE:
855 proto_tree_add_item(tree, hf_simulcrypt_access_criteria_transfer_mode, tvb, offset, plen, ENC_BIG_ENDIAN);
856 break;
857 case SIMULCRYPT_ECMG_CP_NUMBER:
858 proto_tree_add_item(tree, hf_simulcrypt_cp_number, tvb, offset, plen, ENC_BIG_ENDIAN);
859 break;
860 case SIMULCRYPT_ECMG_CP_DURATION:
861 /* convert value to ms (in units 100 ms) */
862 pvaluedec = tvb_get_ntohs(tvb, offset); /* read 2 byte CP duration value */
863 pvaluedec = pvaluedec*100; /* in ms now */
864 simulcrypt_item = proto_tree_add_item(tree, hf_simulcrypt_cp_duration, tvb, offset, plen, ENC_BIG_ENDIAN);
865 proto_item_append_text(simulcrypt_item, " (%d ms)", pvaluedec);
866 break;
867 case SIMULCRYPT_ECMG_CP_CW_COMBINATION:
868 proto_tree_add_item(tree, hf_simulcrypt_cp_cw_combination, tvb, offset, plen, ENC_NA);
869 break;
870 case SIMULCRYPT_ECMG_ECM_DATAGRAM:
871 simulcrypt_item = proto_tree_add_item(tree, hf_simulcrypt_ecm_datagram, tvb, offset, plen, ENC_NA);
872 /* Test srcport against table of ECMG ports & CA_System_ID for known protocol types */
873 for(i=0;i<ECM_INTERPRETATION_SIZE;i++)
875 if(tab_ecm_inter[i].ecmg_port==pinfo->srcport) /* ECMG source port */
876 { /* recognise port & ca_system_id and hence protocol name for ECM datagram */
877 next_tvb = tvb_new_subset_remaining(tvb, offset);
878 simulcrypt_ecm_datagram_tree = proto_item_add_subtree(simulcrypt_item, ett_simulcrypt_ecm_datagram);
879 if(tab_ecm_inter[i].protocol_handle != NULL)
881 call_dissector(tab_ecm_inter[i].protocol_handle, next_tvb,pinfo, simulcrypt_ecm_datagram_tree);
883 break;
886 break;
887 case SIMULCRYPT_ECMG_CW_ENCRYPTION:
888 proto_tree_add_item(tree, hf_simulcrypt_cw_encryption, tvb, offset, plen, ENC_NA);
889 break;
890 case SIMULCRYPT_ECMG_ECM_ID:
891 proto_tree_add_item(tree, hf_simulcrypt_ecm_id, tvb, offset, plen, ENC_BIG_ENDIAN);
892 break;
893 case SIMULCRYPT_ECMG_ERROR_STATUS:
894 proto_tree_add_item(tree, hf_simulcrypt_ecmg_error_status, tvb, offset, plen, ENC_BIG_ENDIAN);
895 break;
896 case SIMULCRYPT_ECMG_ERROR_INFORMATION:
897 proto_tree_add_item(tree, hf_simulcrypt_error_information, tvb, offset, plen, ENC_NA);
898 break;
899 default: /* Unknown parameter type */
900 proto_tree_add_string(tree, hf_simulcrypt_parameter_value, tvb, offset, plen, pvalue_char);
901 break;
902 } /* end parameter type switch */
905 static void
906 dissect_emmg_parameter_value (proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, uint32_t offset,
907 uint16_t plen, uint16_t ptype, char *pvalue_char)
909 switch (ptype) {
910 case SIMULCRYPT_EMMG_CLIENT_ID:
911 proto_tree_add_item(tree, hf_simulcrypt_client_id, tvb, offset, plen, ENC_BIG_ENDIAN);
912 break;
913 case SIMULCRYPT_EMMG_SECTION_TSPKT_FLAG:
914 proto_tree_add_item(tree, hf_simulcrypt_section_tspkt_flag, tvb, offset, plen, ENC_BIG_ENDIAN);
915 break;
916 case SIMULCRYPT_EMMG_DATA_CHANNEL_ID:
917 proto_tree_add_item(tree, hf_simulcrypt_data_channel_id, tvb, offset, plen, ENC_BIG_ENDIAN);
918 break;
919 case SIMULCRYPT_EMMG_DATA_STREAM_ID:
920 proto_tree_add_item(tree, hf_simulcrypt_data_stream_id, tvb, offset, plen, ENC_BIG_ENDIAN);
921 break;
922 case SIMULCRYPT_EMMG_DATAGRAM:
923 proto_tree_add_item(tree, hf_simulcrypt_datagram, tvb, offset, plen, ENC_NA);
924 break;
925 case SIMULCRYPT_EMMG_BANDWIDTH:
926 proto_tree_add_item(tree, hf_simulcrypt_bandwidth, tvb, offset, plen, ENC_BIG_ENDIAN);
927 break;
928 case SIMULCRYPT_EMMG_DATA_TYPE:
929 proto_tree_add_item(tree, hf_simulcrypt_data_type, tvb, offset, plen, ENC_BIG_ENDIAN);
930 break;
931 case SIMULCRYPT_EMMG_DATA_ID:
932 proto_tree_add_item(tree, hf_simulcrypt_data_id, tvb, offset, plen, ENC_BIG_ENDIAN);
933 break;
934 case SIMULCRYPT_EMMG_ERROR_STATUS:
935 proto_tree_add_item(tree, hf_simulcrypt_emmg_error_status, tvb, offset, plen, ENC_BIG_ENDIAN);
936 break;
937 case SIMULCRYPT_EMMG_ERROR_INFORMATION:
938 proto_tree_add_item(tree, hf_simulcrypt_error_information, tvb, offset, plen, ENC_NA);
939 break;
940 default: /* Unknown parameter type */
941 proto_tree_add_string(tree, hf_simulcrypt_parameter_value, tvb, offset, plen, pvalue_char);
942 break;
943 } /* end parameter type switch */
947 static void
948 // NOLINTNEXTLINE(misc-no-recursion)
949 dissect_eis_parameter_value (proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, uint32_t offset,
950 uint16_t plen, uint16_t ptype, char *pvalue_char)
952 proto_item *simulcrypt_item;
953 proto_tree *simulcrypt_super_cas_id_tree;
954 proto_tree *simulcrypt_ecm_group_tree;
955 proto_tree *simulcrypt_activation_time_tree;
956 uint32_t pvaluedec; /* parameter decimal value */
957 int ca_system_id;
958 unsigned i;
960 switch (ptype) {
961 case SIMULCRYPT_EIS_CHANNEL_ID:
962 proto_tree_add_item(tree, hf_simulcrypt_eis_channel_id, tvb, offset, plen, ENC_BIG_ENDIAN);
963 break;
964 case SIMULCRYPT_EIS_SERVICE_FLAG:
965 proto_tree_add_item(tree, hf_simulcrypt_service_flag, tvb, offset, plen, ENC_BIG_ENDIAN);
966 break;
967 case SIMULCRYPT_EIS_COMPONENT_FLAG:
968 proto_tree_add_item(tree, hf_simulcrypt_component_flag, tvb, offset, plen, ENC_BIG_ENDIAN);
969 break;
970 case SIMULCRYPT_EIS_MAX_SCG:
971 proto_tree_add_item(tree, hf_simulcrypt_max_scg, tvb, offset, plen, ENC_BIG_ENDIAN);
972 break;
973 case SIMULCRYPT_EIS_ECM_GROUP:
974 /* add ECM_Group item */
975 simulcrypt_item = proto_tree_add_item(tree, hf_simulcrypt_ecm_group, tvb, offset, plen, ENC_NA); /* value item */
977 /* create subtree */
978 simulcrypt_ecm_group_tree = proto_item_add_subtree(simulcrypt_item, ett_simulcrypt_ecm_group);
980 /* dissect subtree */
981 dissect_simulcrypt_data(simulcrypt_ecm_group_tree, simulcrypt_item, pinfo, tvb, tree, offset, plen, SIMULCRYPT_EIS_SCS, true);
982 break;
983 case SIMULCRYPT_EIS_SCG_ID:
984 proto_tree_add_item(tree, hf_simulcrypt_scg_id, tvb, offset, plen, ENC_BIG_ENDIAN);
985 break;
986 case SIMULCRYPT_EIS_SCG_REFERENCE_ID:
987 proto_tree_add_item(tree, hf_simulcrypt_scg_reference_id, tvb, offset, plen, ENC_BIG_ENDIAN);
988 break;
989 case SIMULCRYPT_EIS_SUPER_CAS_ID:
990 /* add super_cas_id item */
991 simulcrypt_item = proto_tree_add_item(tree, hf_simulcrypt_super_cas_id, tvb, offset, plen, ENC_BIG_ENDIAN); /* value item */
992 simulcrypt_super_cas_id_tree = proto_item_add_subtree(simulcrypt_item, ett_simulcrypt_super_cas_id);
994 /* Simulcrypt_super_cas_id_tree */
995 simulcrypt_item = proto_tree_add_item(simulcrypt_super_cas_id_tree, hf_simulcrypt_ca_system_id, tvb, offset, 2, ENC_BIG_ENDIAN );
997 /* Test for known CA_System_ID */
998 ca_system_id = tvb_get_ntohs(tvb,offset);
999 for(i=0;i<ECM_INTERPRETATION_SIZE;i++)
1001 if(tab_ecm_inter[i].ca_system_id==ca_system_id)
1003 tab_ecm_inter[i].ecmg_port=pinfo->destport;
1004 proto_item_append_text(simulcrypt_item, ", Port %d, Protocol %s",tab_ecm_inter[i].ecmg_port, tab_ecm_inter[i].protocol_name);
1005 break;
1008 proto_tree_add_item(simulcrypt_super_cas_id_tree, hf_simulcrypt_ca_subsystem_id, tvb, offset+2, 2, ENC_BIG_ENDIAN );
1009 break;
1010 case SIMULCRYPT_EIS_ECM_ID:
1011 proto_tree_add_item(tree, hf_simulcrypt_ecm_id, tvb, offset, plen, ENC_BIG_ENDIAN);
1012 break;
1013 case SIMULCRYPT_EIS_ACCESS_CRITERIA:
1014 proto_tree_add_item(tree, hf_simulcrypt_access_criteria, tvb, offset, plen, ENC_NA);
1015 break;
1016 case SIMULCRYPT_EIS_ACTIVATION_TIME:
1017 simulcrypt_item = proto_tree_add_item(tree, hf_simulcrypt_activation_time, tvb, offset, plen, ENC_NA); /* value item */
1019 /* create subtree */
1020 simulcrypt_activation_time_tree = proto_item_add_subtree(simulcrypt_item, ett_simulcrypt_activation_time);
1022 /* dissect subtree */
1023 proto_tree_add_item(simulcrypt_activation_time_tree, hf_simulcrypt_year, tvb, offset, 2, ENC_BIG_ENDIAN); /* first 2 bytes */
1024 proto_tree_add_item(simulcrypt_activation_time_tree, hf_simulcrypt_month, tvb, offset+2, 1, ENC_BIG_ENDIAN); /* third byte */
1025 proto_tree_add_item(simulcrypt_activation_time_tree, hf_simulcrypt_day, tvb, offset+3, 1, ENC_BIG_ENDIAN); /*fourth byte */
1026 proto_tree_add_item(simulcrypt_activation_time_tree, hf_simulcrypt_hour, tvb, offset+4, 1, ENC_BIG_ENDIAN); /*fifth byte */
1027 proto_tree_add_item(simulcrypt_activation_time_tree, hf_simulcrypt_minute, tvb, offset+5, 1, ENC_BIG_ENDIAN); /* sixth byte */
1028 proto_tree_add_item(simulcrypt_activation_time_tree, hf_simulcrypt_second, tvb, offset+6, 1, ENC_BIG_ENDIAN); /* seventh byte */
1029 proto_tree_add_item(simulcrypt_activation_time_tree, hf_simulcrypt_hundredth_second, tvb, offset+7, 1, ENC_BIG_ENDIAN); /* eighth byte */
1030 break;
1031 case SIMULCRYPT_EIS_ACTIVATION_PENDING_FLAG:
1032 proto_tree_add_item(tree, hf_simulcrypt_activation_pending_flag, tvb, offset, plen, ENC_BIG_ENDIAN);
1033 break;
1034 case SIMULCRYPT_EIS_COMPONENT_ID:
1035 proto_tree_add_item(tree, hf_simulcrypt_component_id, tvb, offset, plen, ENC_BIG_ENDIAN);
1036 break;
1037 case SIMULCRYPT_EIS_SERVICE_ID:
1038 proto_tree_add_item(tree, hf_simulcrypt_service_id, tvb, offset, plen, ENC_BIG_ENDIAN);
1039 break;
1040 case SIMULCRYPT_EIS_TRANSPORT_STREAM_ID:
1041 proto_tree_add_item(tree, hf_simulcrypt_transport_stream_id, tvb, offset, plen, ENC_BIG_ENDIAN);
1042 break;
1043 case SIMULCRYPT_EIS_AC_CHANGED_FLAG:
1044 proto_tree_add_item(tree, hf_simulcrypt_ac_changed_flag, tvb, offset, plen, ENC_BIG_ENDIAN);
1045 break;
1046 case SIMULCRYPT_EIS_SCG_CURRENT_REFERENCE_ID:
1047 proto_tree_add_item(tree, hf_simulcrypt_scg_current_reference_id, tvb, offset, plen, ENC_BIG_ENDIAN);
1048 break;
1049 case SIMULCRYPT_EIS_SCG_PENDING_REFERENCE_ID:
1050 proto_tree_add_item(tree, hf_simulcrypt_scg_pending_reference_id, tvb, offset, plen, ENC_BIG_ENDIAN);
1051 break;
1052 case SIMULCRYPT_EIS_CP_DURATION_FLAG:
1053 proto_tree_add_item(tree, hf_simulcrypt_cp_duration_flag, tvb, offset, plen, ENC_BIG_ENDIAN);
1054 break;
1055 case SIMULCRYPT_EIS_RECOMMENDED_CP_DURATION:
1056 /* convert value to ms (in units 100 ms) */
1057 pvaluedec = tvb_get_ntohs(tvb, offset); /* read 2 byte CP duration value */
1058 pvaluedec = pvaluedec*100; /* in ms now */
1059 simulcrypt_item = proto_tree_add_item(tree, hf_simulcrypt_recommended_cp_duration, tvb, offset, plen, ENC_BIG_ENDIAN);
1060 proto_item_append_text(simulcrypt_item, " (%d ms)", pvaluedec);
1061 break;
1062 case SIMULCRYPT_EIS_SCG_NOMINAL_CP_DURATION:
1063 /* convert value to ms (in units 100 ms) */
1064 pvaluedec = tvb_get_ntohs(tvb, offset); /* read 2 byte CP duration value */
1065 pvaluedec = pvaluedec*100; /* in ms now */
1066 simulcrypt_item = proto_tree_add_item(tree, hf_simulcrypt_scg_nominal_cp_duration, tvb, offset, plen, ENC_BIG_ENDIAN);
1067 proto_item_append_text(simulcrypt_item, " (%d ms)", pvaluedec);
1068 break;
1069 case SIMULCRYPT_EIS_ORIGINAL_NETWORK_ID:
1070 proto_tree_add_item(tree, hf_simulcrypt_original_network_id, tvb, offset, plen, ENC_BIG_ENDIAN);
1071 break;
1073 case SIMULCRYPT_EIS_ERROR_STATUS:
1074 proto_tree_add_item(tree, hf_simulcrypt_eis_error_status, tvb, offset, plen, ENC_BIG_ENDIAN);
1075 break;
1076 case SIMULCRYPT_EIS_ERROR_INFORMATION:
1077 proto_tree_add_item(tree, hf_simulcrypt_error_information, tvb, offset, plen, ENC_NA);
1078 break;
1079 case SIMULCRYPT_EIS_ERROR_DESCRIPTION:
1080 proto_tree_add_item(tree, hf_simulcrypt_error_description, tvb, offset, plen, ENC_ASCII);
1081 break;
1083 default: /* Unknown parameter type */
1084 proto_tree_add_string(tree, hf_simulcrypt_parameter_value, tvb, offset, plen, pvalue_char);
1085 break;
1086 } /* end parameter type switch */
1089 static void
1090 // NOLINTNEXTLINE(misc-no-recursion)
1091 dissect_psig_parameter_value (proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, uint32_t offset,
1092 uint16_t plen, uint16_t ptype, char *pvalue_char)
1094 proto_tree *simulcrypt_psig_table_period_pair_tree;
1095 proto_tree *simulcrypt_activation_time_tree;
1096 proto_item *simulcrypt_item;
1097 uint32_t pvaluedec; /* parameter decimal value */
1099 increment_dissection_depth(pinfo);
1100 switch (ptype) {
1101 case SIMULCRYPT_PSIG_PSIG_TYPE:
1102 pvaluedec = tvb_get_uint8(tvb, offset);
1103 simulcrypt_item = proto_tree_add_item(tree, hf_simulcrypt_psig_type, tvb, offset, plen, ENC_BIG_ENDIAN);
1104 switch(pvaluedec){
1105 case 1:
1106 proto_item_append_text(simulcrypt_item, " (PSIG)");
1107 break;
1108 case 2:
1109 proto_item_append_text(simulcrypt_item, " (SIG)");
1110 break;
1111 case 3:
1112 proto_item_append_text(simulcrypt_item, " (PSISIG)");
1113 break;
1114 default:
1115 break;
1117 break;
1118 case SIMULCRYPT_PSIG_CHANNEL_ID:
1119 proto_tree_add_item(tree, hf_simulcrypt_channel_id, tvb, offset, plen, ENC_BIG_ENDIAN);
1120 break;
1121 case SIMULCRYPT_PSIG_STREAM_ID:
1122 proto_tree_add_item(tree, hf_simulcrypt_stream_id, tvb, offset, plen, ENC_BIG_ENDIAN);
1123 break;
1124 case SIMULCRYPT_PSIG_TRANSPORT_STREAM_ID:
1125 proto_tree_add_item(tree, hf_simulcrypt_transport_stream_id, tvb, offset, plen, ENC_BIG_ENDIAN);
1126 break;
1127 case SIMULCRYPT_PSIG_ORIGINAL_NETWORK_ID:
1128 proto_tree_add_item(tree, hf_simulcrypt_original_network_id, tvb, offset, plen, ENC_BIG_ENDIAN);
1129 break;
1130 case SIMULCRYPT_PSIG_PACKET_ID:
1131 proto_tree_add_item(tree, hf_simulcrypt_packet_id, tvb, offset, plen, ENC_BIG_ENDIAN);
1132 break;
1133 case SIMULCRYPT_PSIG_INTERFACE_MODE_CONFIGURATION:
1134 proto_tree_add_item(tree, hf_simulcrypt_interface_mode_configuration, tvb, offset, plen, ENC_BIG_ENDIAN);
1135 break;
1136 case SIMULCRYPT_PSIG_MAX_STREAM:
1137 proto_tree_add_item(tree, hf_simulcrypt_max_stream, tvb, offset, plen, ENC_BIG_ENDIAN);
1138 break;
1139 case SIMULCRYPT_PSIG_TABLE_PERIOD_PAIR:
1140 simulcrypt_item = proto_tree_add_item(tree, hf_simulcrypt_table_period_pair, tvb, offset, plen, ENC_NA); /* value item */
1142 /* create subtree */
1143 simulcrypt_psig_table_period_pair_tree = proto_item_add_subtree(simulcrypt_item, ett_simulcrypt_table_period_pair);
1145 /* dissect subtree */
1146 dissect_simulcrypt_data(simulcrypt_psig_table_period_pair_tree, simulcrypt_item, pinfo, tvb, tree, offset, plen, SIMULCRYPT_MUX_CIM, true);
1147 break;
1148 case SIMULCRYPT_PSIG_MPEG_SECTION:
1149 proto_tree_add_item(tree, hf_simulcrypt_mpeg_section, tvb, offset, plen, ENC_NA);
1150 break;
1151 case SIMULCRYPT_PSIG_REPETITION_RATE:
1152 proto_tree_add_item(tree, hf_simulcrypt_repetition_rate, tvb, offset, plen, ENC_BIG_ENDIAN);
1153 break;
1154 case SIMULCRYPT_PSIG_ACTIVATION_TIME:
1155 simulcrypt_item = proto_tree_add_item(tree, hf_simulcrypt_activation_time, tvb, offset, plen, ENC_NA); /* value item */
1157 /* create subtree */
1158 simulcrypt_activation_time_tree = proto_item_add_subtree(simulcrypt_item, ett_simulcrypt_activation_time);
1160 /* dissect subtree */
1161 proto_tree_add_item(simulcrypt_activation_time_tree, hf_simulcrypt_year, tvb, offset, 2, ENC_BIG_ENDIAN); /* first 2 bytes */
1162 proto_tree_add_item(simulcrypt_activation_time_tree, hf_simulcrypt_month, tvb, offset+2, 1, ENC_BIG_ENDIAN); /* third byte */
1163 proto_tree_add_item(simulcrypt_activation_time_tree, hf_simulcrypt_day, tvb, offset+3, 1, ENC_BIG_ENDIAN); /*fourth byte */
1164 proto_tree_add_item(simulcrypt_activation_time_tree, hf_simulcrypt_hour, tvb, offset+4, 1, ENC_BIG_ENDIAN); /*fifth byte */
1165 proto_tree_add_item(simulcrypt_activation_time_tree, hf_simulcrypt_minute, tvb, offset+5, 1, ENC_BIG_ENDIAN); /* sixth byte */
1166 proto_tree_add_item(simulcrypt_activation_time_tree, hf_simulcrypt_second, tvb, offset+6, 1, ENC_BIG_ENDIAN); /* seventh byte */
1167 proto_tree_add_item(simulcrypt_activation_time_tree, hf_simulcrypt_hundredth_second, tvb, offset+7, 1, ENC_BIG_ENDIAN); /* eighth byte */
1168 break;
1169 case SIMULCRYPT_PSIG_DATAGRAM:
1170 proto_tree_add_item(tree, hf_simulcrypt_datagram, tvb, offset, plen, ENC_NA);
1171 break;
1172 case SIMULCRYPT_PSIG_BANDWIDTH:
1173 proto_tree_add_item(tree, hf_simulcrypt_bandwidth, tvb, offset, plen, ENC_BIG_ENDIAN);
1174 break;
1175 case SIMULCRYPT_PSIG_INITIAL_BANDWIDTH:
1176 proto_tree_add_item(tree, hf_simulcrypt_initial_bandwidth, tvb, offset, plen, ENC_BIG_ENDIAN);
1177 break;
1178 case SIMULCRYPT_PSIG_MAX_COMP_TIME:
1179 proto_tree_add_item(tree, hf_simulcrypt_max_comp_time, tvb, offset, plen, ENC_BIG_ENDIAN);
1180 break;
1181 case SIMULCRYPT_PSIG_ASI_INPUT_PACKET_ID:
1182 proto_tree_add_item(tree, hf_simulcrypt_asi_input_packet_id, tvb, offset, plen, ENC_BIG_ENDIAN);
1183 break;
1184 case SIMULCRYPT_PSIG_ERROR_STATUS:
1185 proto_tree_add_item(tree, hf_simulcrypt_psig_error_status, tvb, offset, plen, ENC_BIG_ENDIAN);
1186 break;
1187 case SIMULCRYPT_PSIG_ERROR_INFORMATION:
1188 proto_tree_add_item(tree, hf_simulcrypt_error_information, tvb, offset, plen, ENC_NA);
1189 break;
1190 default: /* Unknown parameter type */
1191 proto_tree_add_string(tree, hf_simulcrypt_parameter_value, tvb, offset, plen, pvalue_char);
1192 break;
1193 } /* end parameter type switch */
1194 decrement_dissection_depth(pinfo);
1197 /* This method dissects fully reassembled messages */
1198 static int
1199 dissect_simulcrypt_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
1201 proto_item *simulcrypt_item;
1202 proto_tree *simulcrypt_tree;
1203 proto_tree *simulcrypt_header_tree;
1204 proto_tree *simulcrypt_message_tree;
1205 uint16_t type, iftype;
1207 col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_TAG_SIMULCRYPT);
1208 col_clear(pinfo->cinfo,COL_INFO);
1210 /* get 2 byte type value */
1211 type = tvb_get_ntohs(tvb, 1); /* 2 bytes starting at offset 1 are the message type */
1212 iftype = get_interface (type);
1214 col_add_fstr(pinfo->cinfo, COL_INFO, "%d > %d Info Type:[%s]",
1215 pinfo->srcport, pinfo->destport,
1216 val_to_str_ext(type, &messagetypenames_ext, "Unknown Type:0x%02x"));
1218 if (tree)
1220 /* we are being asked for details */
1221 uint32_t offset = 0;
1222 uint32_t msg_length;
1224 simulcrypt_item = proto_tree_add_item(tree, proto_simulcrypt, tvb, 0, -1, ENC_NA);
1225 simulcrypt_tree = proto_item_add_subtree(simulcrypt_item, ett_simulcrypt);
1227 proto_item_append_text(simulcrypt_item, ", Interface: %s", val_to_str(iftype, interfacenames, "Unknown (0x%02x)"));
1229 /* Simulcrypt_tree analysis */
1230 /* we are being asked for details */
1231 /* ADD HEADER BRANCH */
1232 simulcrypt_item = proto_tree_add_item(simulcrypt_tree, hf_simulcrypt_header, tvb, offset, 5, ENC_NA );
1233 simulcrypt_header_tree = proto_item_add_subtree(simulcrypt_item, ett_simulcrypt_header);
1234 proto_item_append_text(simulcrypt_header_tree, ", Length: %s", "5 bytes"); /* add text to Header tree indicating Length 5 bytes */
1236 /* Simulcrypt_header_tree analysis */
1237 /* Message Version 1 Byte */
1238 proto_tree_add_item(simulcrypt_header_tree, hf_simulcrypt_version, tvb, offset, 1, ENC_BIG_ENDIAN);
1239 offset+=1;
1241 /* Message Type 2 Bytes */
1242 proto_tree_add_item(simulcrypt_header_tree, hf_simulcrypt_message_type, tvb, offset, 2, ENC_BIG_ENDIAN);
1243 simulcrypt_item = proto_tree_add_uint_format_value(simulcrypt_header_tree, hf_simulcrypt_interface, tvb, offset, 2, iftype,
1244 "%s", val_to_str_const(iftype, interfacenames, "Unknown"));
1245 proto_item_set_generated (simulcrypt_item);
1246 offset+=2;
1248 /* Message Length 2 Bytes */
1249 proto_tree_add_item(simulcrypt_header_tree, hf_simulcrypt_message_length, tvb, offset, 2, ENC_BIG_ENDIAN);
1250 msg_length = tvb_get_ntohs(tvb, offset); /* read 2 byte message length value */
1251 offset+=2;
1253 /* ADD MESSAGE BRANCH */
1254 simulcrypt_item = proto_tree_add_item(simulcrypt_tree, hf_simulcrypt_message, tvb, offset, -1, ENC_NA );
1255 simulcrypt_message_tree = proto_item_add_subtree(simulcrypt_item, ett_simulcrypt_message);
1256 proto_item_append_text(simulcrypt_message_tree, " containing TLV parameters"); /* add text to Message tree */
1257 proto_item_append_text(simulcrypt_message_tree, ", Length: %d (bytes)", msg_length); /* add length info to message_tree */
1259 /* end header details */
1261 /* Simulcrypt_message_tree analysis */
1262 /* we are being asked for details */
1263 /* Navigate through message after header to find one or more parameters */
1265 dissect_simulcrypt_data(simulcrypt_message_tree, simulcrypt_item, pinfo, tvb, tree, offset, (msg_length+5), iftype, false); /* offset is from beginning of the 5 byte header */
1267 } /* end tree */
1269 return tvb_captured_length(tvb);
1272 /* this method is used to dissect TLV parameters */
1273 /* can be used both from the main tree (simulcrypt_message_tree) and the subtrees (created from TLV items) */
1274 static void
1275 // NOLINTNEXTLINE(misc-no-recursion)
1276 dissect_simulcrypt_data(proto_tree *simulcrypt_tree, proto_item *simulcrypt_item, packet_info *pinfo _U_,
1277 tvbuff_t *tvb, proto_tree *tree, int offset,
1278 int container_data_length, uint16_t iftype, bool is_subtree)
1280 int subtree_offset = 0;
1281 proto_tree *simulcrypt_parameter_tree;
1282 int applied_offset;
1284 if(is_subtree)
1286 applied_offset = subtree_offset;
1288 else
1290 applied_offset = offset;
1293 while (applied_offset < container_data_length)
1295 uint16_t plen; /* parameter length */
1296 uint16_t ptype; /* parameter type */
1297 char *pvalue_char; /* parameter value string */
1299 /* Parameter Type 2 Bytes */
1300 ptype = tvb_get_ntohs(tvb, offset); /* read 2 byte type value */
1301 /* Parameter Length 2 Bytes */
1302 plen = tvb_get_ntohs(tvb, offset+2); /* read 2 byte length value */
1303 /* Parameter Value plen Bytes */
1304 pvalue_char = tvb_bytes_to_str(pinfo->pool, tvb, offset+4, plen);
1306 simulcrypt_item = proto_tree_add_item(simulcrypt_tree, hf_simulcrypt_parameter, tvb, offset, plen+2+2, ENC_NA );
1308 /* add length and value info to type */
1309 switch (iftype) {
1310 case SIMULCRYPT_ECMG_SCS:
1311 proto_item_append_text(simulcrypt_item, ": Type=%s", val_to_str_ext(ptype, &ecmg_parametertypenames_ext, "Unknown Type:0x%02x"));
1312 break;
1313 case SIMULCRYPT_EMMG_MUX:
1314 proto_item_append_text(simulcrypt_item, ": Type=%s", val_to_str_ext(ptype, &emmg_parametertypenames_ext, "Unknown Type:0x%02x"));
1315 break;
1316 case SIMULCRYPT_EIS_SCS:
1317 proto_item_append_text(simulcrypt_item, ": Type=%s", val_to_str_ext(ptype, &eis_parametertypenames_ext, "Unknown Type:0x%02x"));
1318 break;
1319 case SIMULCRYPT_PSIG_MUX:
1320 case SIMULCRYPT_MUX_CIM:
1321 case SIMULCRYPT_PSIG_CIP:
1322 proto_item_append_text(simulcrypt_item, ": Type=%s", val_to_str_ext(ptype, &psig_parametertypenames_ext, "Unknown Type:0x%02x"));
1323 break;
1324 default:
1325 proto_item_append_text(simulcrypt_item, ": Type=0x%02x", ptype);
1326 break;
1328 proto_item_append_text(simulcrypt_item, ", Value Length=%d (bytes)", plen); /* add length info to parameter */
1329 proto_item_append_text(simulcrypt_item, ", Value=0x%s", pvalue_char); /* add value info to parameter */
1330 /* add subtree for parameter type, length and value items */
1331 simulcrypt_parameter_tree = proto_item_add_subtree(simulcrypt_item, ett_simulcrypt_parameter); /* add subtree for Length and Value */
1332 switch (iftype) { /* parameter type */
1333 case SIMULCRYPT_ECMG_SCS:
1334 proto_tree_add_item(simulcrypt_parameter_tree, hf_simulcrypt_ecmg_parameter_type, tvb, offset, 2, ENC_BIG_ENDIAN);
1335 break;
1336 case SIMULCRYPT_EMMG_MUX:
1337 proto_tree_add_item(simulcrypt_parameter_tree, hf_simulcrypt_emmg_parameter_type, tvb, offset, 2, ENC_BIG_ENDIAN);
1338 break;
1339 case SIMULCRYPT_EIS_SCS:
1340 proto_tree_add_item(simulcrypt_parameter_tree, hf_simulcrypt_eis_parameter_type, tvb, offset, 2, ENC_BIG_ENDIAN);
1341 break;
1342 case SIMULCRYPT_PSIG_MUX:
1343 case SIMULCRYPT_MUX_CIM:
1344 case SIMULCRYPT_PSIG_CIP:
1345 proto_tree_add_item(simulcrypt_parameter_tree, hf_simulcrypt_psig_parameter_type, tvb, offset, 2, ENC_BIG_ENDIAN);
1346 break;
1347 default:
1348 proto_tree_add_item(simulcrypt_parameter_tree, hf_simulcrypt_parameter_type, tvb, offset, 2, ENC_BIG_ENDIAN);
1349 break;
1351 proto_tree_add_item(simulcrypt_parameter_tree, hf_simulcrypt_parameter_length, tvb, offset+2, 2, ENC_BIG_ENDIAN); /* length item */
1352 offset += 2+2; /* offset --> parameter value */
1354 switch (iftype) {
1355 case SIMULCRYPT_ECMG_SCS:
1356 dissect_ecmg_parameter_value (simulcrypt_parameter_tree, tvb, pinfo, offset, plen, ptype, pvalue_char);
1357 break;
1358 case SIMULCRYPT_EMMG_MUX:
1359 dissect_emmg_parameter_value (simulcrypt_parameter_tree, tvb, pinfo, offset, plen, ptype, pvalue_char);
1360 break;
1361 case SIMULCRYPT_EIS_SCS:
1362 dissect_eis_parameter_value (simulcrypt_parameter_tree, tvb, pinfo, offset, plen, ptype, pvalue_char);
1363 break;
1364 case SIMULCRYPT_PSIG_MUX:
1365 case SIMULCRYPT_MUX_CIM:
1366 case SIMULCRYPT_PSIG_CIP:
1367 dissect_psig_parameter_value (simulcrypt_parameter_tree, tvb, pinfo, offset, plen, ptype, pvalue_char);
1368 break;
1369 default:
1370 proto_tree_add_string(tree, hf_simulcrypt_parameter_value, tvb, offset, plen, pvalue_char);
1371 break;
1373 offset += plen;
1374 subtree_offset += 2+2+plen;
1376 if(is_subtree)
1378 applied_offset = subtree_offset;
1380 else
1382 applied_offset = offset;
1384 } /* end parameter tree details */
1388 /* determine PDU length of protocol foo */
1389 static unsigned
1390 get_simulcrypt_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
1391 int offset, void *data _U_)
1393 unsigned iLg;
1395 iLg = tvb_get_ntohs(tvb,offset+3); /*length is at offset 3 */
1396 iLg += 5; /* add 1 byte version + 2 byte type + 2 byte length (simulcrypt "header" */
1397 return iLg;
1400 /* Clean out the ecm_interpretation port association whenever */
1401 /* making a pass through a capture file to dissect all its packets */
1402 /* (e.g., reading in a new capture file, changing a simulcrypt pref, */
1403 /* or running a "filter packets" or "colorize packets" pass over the */
1404 /* current capture file. */
1406 static void
1407 simulcrypt_init(void)
1409 unsigned i;
1411 for(i=0;i<ECM_INTERPRETATION_SIZE;i++)
1413 tab_ecm_inter[i].ecmg_port = -1;
1417 void proto_reg_handoff_simulcrypt(void);
1419 void
1420 proto_register_simulcrypt (void)
1422 /* A header field is something you can search/filter on.
1424 * We create a structure to register our fields. It consists of an
1425 * array of hf_register_info structures, each of which are of the format
1426 * {&(field id), {name, abbrev, type, display, strings, bitmask, blurb, HFILL}}.
1428 static hf_register_info hf[] =
1430 { &hf_simulcrypt_header,
1431 { "Header", "simulcrypt.header", FT_NONE, BASE_NONE, NULL, 0x0,
1432 NULL, HFILL }},
1434 { &hf_simulcrypt_version,
1435 { "Version", "simulcrypt.version", FT_UINT8, BASE_HEX, NULL, 0x0, /* version 1 byte */
1436 NULL, HFILL }},
1438 { &hf_simulcrypt_message_type,
1439 { "Message Type", "simulcrypt.message.type", FT_UINT16, BASE_HEX|BASE_EXT_STRING, &messagetypenames_ext, 0x0, /* type 2 bytes */
1440 NULL, HFILL }},
1442 { &hf_simulcrypt_interface,
1443 { "Interface", "simulcrypt.message.interface", FT_UINT16, BASE_DEC, VALS(interfacenames), 0x0,
1444 NULL, HFILL }},
1446 { &hf_simulcrypt_message_length,
1447 { "Message Length", "simulcrypt.message.len", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_byte_bytes), 0x0, /* length 2 bytes, print as decimal value */
1448 NULL, HFILL }},
1450 { &hf_simulcrypt_message,
1451 { "Message", "simulcrypt.message", FT_NONE, BASE_NONE, NULL, 0x0,
1452 NULL, HFILL }},
1454 { &hf_simulcrypt_parameter,
1455 { "Parameter", "simulcrypt.parameter", FT_NONE, BASE_NONE, NULL, 0x0,
1456 NULL, HFILL }},
1458 { &hf_simulcrypt_parameter_type,
1459 { "Parameter Type", "simulcrypt.parameter.type", FT_UINT16, BASE_HEX, NULL, 0x0, /* type 2 bytes */
1460 NULL, HFILL }},
1462 { &hf_simulcrypt_ecmg_parameter_type,
1463 { "Parameter Type", "simulcrypt.parameter.type", FT_UINT16, BASE_HEX | BASE_EXT_STRING, &ecmg_parametertypenames_ext, 0x0, /* type 2 bytes */
1464 NULL, HFILL }},
1466 { &hf_simulcrypt_emmg_parameter_type,
1467 { "Parameter Type", "simulcrypt.parameter.type", FT_UINT16, BASE_HEX | BASE_EXT_STRING, &emmg_parametertypenames_ext, 0x0, /* type 2 bytes */
1468 NULL, HFILL }},
1470 { &hf_simulcrypt_parameter_length,
1471 { "Parameter Length", "simulcrypt.parameter.len", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_byte_bytes), 0x0, /* length 2 bytes, print as decimal value */
1472 NULL, HFILL }},
1474 { &hf_simulcrypt_ca_system_id,
1475 { "CA System ID", "simulcrypt.parameter.ca_system_id", FT_UINT16, BASE_DEC, NULL, 0x0,
1476 NULL, HFILL }},
1478 { &hf_simulcrypt_ca_subsystem_id,
1479 { "CA Subsystem ID", "simulcrypt.parameter.ca_subsystem_id", FT_UINT16, BASE_DEC, NULL, 0x0,
1480 NULL, HFILL }},
1482 { &hf_simulcrypt_super_cas_id,
1483 { "SuperCAS ID", "simulcrypt.super_cas_id", FT_UINT32, BASE_HEX, NULL, 0x0,
1484 NULL, HFILL }},
1486 { &hf_simulcrypt_section_tspkt_flag,
1487 { "Section TS pkt flag", "simulcrypt.section_tspkt_flag", FT_UINT8, BASE_HEX, NULL, 0x0,
1488 NULL, HFILL }},
1490 { &hf_simulcrypt_ecm_channel_id,
1491 { "ECM channel ID", "simulcrypt.ecm_channel_id", FT_UINT16, BASE_DEC, NULL, 0x0,
1492 NULL, HFILL }},
1494 { &hf_simulcrypt_delay_start,
1495 { "Delay start", "simulcrypt.delay_start", FT_INT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_milliseconds), 0x0,
1496 NULL, HFILL }},
1498 { &hf_simulcrypt_delay_stop,
1499 { "Delay stop", "simulcrypt.delay_stop", FT_INT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_milliseconds), 0x0,
1500 NULL, HFILL }},
1502 { &hf_simulcrypt_ac_delay_start,
1503 { "AC delay start", "simulcrypt.ac_delay_start", FT_INT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_milliseconds), 0x0,
1504 NULL, HFILL }},
1506 { &hf_simulcrypt_ac_delay_stop,
1507 { "AC delay stop", "simulcrypt.ac_delay_stop", FT_INT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_milliseconds), 0x0,
1508 NULL, HFILL }},
1510 { &hf_simulcrypt_transition_delay_start,
1511 { "Transition delay start", "simulcrypt.transition_delay_start", FT_INT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_milliseconds), 0x0,
1512 NULL, HFILL }},
1514 { &hf_simulcrypt_transition_delay_stop,
1515 { "Transition delay stop", "simulcrypt.transition_delay_stop", FT_INT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_milliseconds), 0x0,
1516 NULL, HFILL }},
1518 { &hf_simulcrypt_ecm_rep_period,
1519 { "ECM repetition period", "simulcrypt.ecm_rep_period", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_milliseconds), 0x0,
1520 NULL, HFILL }},
1522 { &hf_simulcrypt_max_streams,
1523 { "Max streams", "simulcrypt.max_streams", FT_UINT16, BASE_DEC, NULL, 0x0,
1524 NULL, HFILL }},
1526 { &hf_simulcrypt_min_cp_duration,
1527 { "Min CP duration", "simulcrypt.min_cp_duration", FT_UINT16, BASE_DEC, NULL, 0x0,
1528 NULL, HFILL }},
1530 { &hf_simulcrypt_lead_cw,
1531 { "Lead CW", "simulcrypt.lead_cw", FT_UINT8, BASE_DEC, NULL, 0x0,
1532 NULL, HFILL }},
1534 { &hf_simulcrypt_cw_per_msg,
1535 { "CW per msg", "simulcrypt.cw_per_msg", FT_UINT8, BASE_DEC, NULL, 0x0,
1536 NULL, HFILL }},
1538 { &hf_simulcrypt_max_comp_time,
1539 { "Max comp time", "simulcrypt.max_comp_time", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_milliseconds), 0x0,
1540 NULL, HFILL }},
1542 { &hf_simulcrypt_access_criteria,
1543 { "Access criteria", "simulcrypt.access_criteria", FT_BYTES, BASE_NONE, NULL, 0x0,
1544 NULL, HFILL }},
1546 { &hf_simulcrypt_ecm_stream_id,
1547 { "ECM stream ID", "simulcrypt.ecm_stream_id", FT_UINT16, BASE_DEC, NULL, 0x0,
1548 NULL, HFILL }},
1550 { &hf_simulcrypt_nominal_cp_duration,
1551 { "Nominal CP duration", "simulcrypt.nominal_cp_duration", FT_UINT16, BASE_DEC, NULL, 0x0,
1552 NULL, HFILL }},
1554 { &hf_simulcrypt_access_criteria_transfer_mode,
1555 { "AC transfer mode", "simulcrypt.access_criteria_transfer_mode", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
1556 NULL, HFILL }},
1558 { &hf_simulcrypt_cp_number,
1559 { "CP number", "simulcrypt.cp_number", FT_UINT16, BASE_DEC, NULL, 0x0,
1560 NULL, HFILL }},
1562 { &hf_simulcrypt_cp_duration,
1563 { "CP duration", "simulcrypt.cp_duration", FT_UINT16, BASE_DEC, NULL, 0x0,
1564 NULL, HFILL }},
1566 { &hf_simulcrypt_cp_cw_combination,
1567 { "CP CW combination", "simulcrypt.cp_cw_combination", FT_BYTES, BASE_NONE, NULL, 0x0,
1568 NULL, HFILL }},
1570 { &hf_simulcrypt_ecm_datagram,
1571 { "ECM datagram", "simulcrypt.ecm_datagram", FT_BYTES, BASE_NONE, NULL, 0x0,
1572 NULL, HFILL }},
1574 { &hf_simulcrypt_cw_encryption,
1575 { "CW encryption", "simulcrypt.cw_encryption", FT_NONE, BASE_NONE, NULL, 0x0,
1576 NULL, HFILL }},
1578 { &hf_simulcrypt_ecm_id,
1579 { "ECM ID", "simulcrypt.ecm_id", FT_UINT16, BASE_DEC, NULL, 0x0,
1580 NULL, HFILL }},
1582 { &hf_simulcrypt_client_id,
1583 { "Client ID", "simulcrypt.client_id", FT_UINT32, BASE_DEC, NULL, 0x0,
1584 NULL, HFILL }},
1586 { &hf_simulcrypt_data_channel_id,
1587 { "Data Channel ID", "simulcrypt.data_channel_id", FT_UINT16, BASE_DEC, NULL, 0x0,
1588 NULL, HFILL }},
1590 { &hf_simulcrypt_data_stream_id,
1591 { "Data Stream ID", "simulcrypt.data_stream_id", FT_UINT16, BASE_DEC, NULL, 0x0,
1592 NULL, HFILL }},
1594 { &hf_simulcrypt_datagram,
1595 { "Datagram", "simulcrypt.datagram", FT_BYTES, BASE_NONE, NULL, 0x0,
1596 NULL, HFILL }},
1598 { &hf_simulcrypt_bandwidth,
1599 { "Bandwidth", "simulcrypt.bandwidth", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_kbps), 0x0,
1600 NULL, HFILL }},
1602 { &hf_simulcrypt_data_type,
1603 { "Data Type", "simulcrypt.data_type", FT_UINT8, BASE_DEC, NULL, 0x0,
1604 NULL, HFILL }},
1606 { &hf_simulcrypt_data_id,
1607 { "Data ID", "simulcrypt.data_id", FT_UINT16, BASE_DEC, NULL, 0x0,
1608 NULL, HFILL }},
1610 { &hf_simulcrypt_ecmg_error_status,
1611 { "Error status", "simulcrypt.error_status", FT_UINT16, BASE_DEC | BASE_EXT_STRING, &ecmg_error_values_ext, 0x0,
1612 NULL, HFILL }},
1614 { &hf_simulcrypt_emmg_error_status,
1615 { "Error status", "simulcrypt.error_status", FT_UINT16, BASE_DEC | BASE_EXT_STRING, &emmg_error_values_ext, 0x0,
1616 NULL, HFILL }},
1618 { &hf_simulcrypt_error_information,
1619 { "Error information", "simulcrypt.error_information", FT_BYTES, BASE_NONE, NULL, 0x0,
1620 NULL, HFILL }},
1622 { &hf_simulcrypt_eis_parameter_type,
1623 { "Parameter Type", "simulcrypt.parameter.type", FT_UINT16, BASE_HEX | BASE_EXT_STRING, &eis_parametertypenames_ext, 0x0, /* type 2 bytes */
1624 NULL, HFILL }},
1626 { &hf_simulcrypt_eis_channel_id,
1627 { "EIS channel ID", "simulcrypt.parameter.eis_channel_id", FT_UINT16, BASE_DEC, NULL, 0x0,
1628 NULL, HFILL }},
1630 { &hf_simulcrypt_service_flag,
1631 { "Service flag", "simulcrypt.parameter.service_flag", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
1632 NULL, HFILL }},
1634 { &hf_simulcrypt_component_flag,
1635 { "Component flag", "simulcrypt.parameter.component_flag", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
1636 NULL, HFILL }},
1638 { &hf_simulcrypt_max_scg,
1639 { "Max SCG", "simulcrypt.parameter.max_scg", FT_UINT16, BASE_DEC, NULL, 0x0,
1640 NULL, HFILL }},
1642 { &hf_simulcrypt_ecm_group,
1643 { "ECM group", "simulcrypt.parameter.ecm_group", FT_BYTES, BASE_NONE, NULL, 0x0,
1644 NULL, HFILL }},
1646 { &hf_simulcrypt_scg_id,
1647 { "SCG ID", "simulcrypt.parameter.scg_id", FT_UINT16, BASE_DEC, NULL, 0x0,
1648 NULL, HFILL }},
1650 { &hf_simulcrypt_scg_reference_id,
1651 { "SCG reference ID", "simulcrypt.parameter.scg_reference_id", FT_UINT32, BASE_DEC, NULL, 0x0,
1652 NULL, HFILL }},
1654 { &hf_simulcrypt_activation_time,
1655 { "Activation time", "simulcrypt.parameter.activation_time", FT_BYTES, BASE_NONE, NULL, 0x0,
1656 NULL, HFILL }},
1658 { &hf_simulcrypt_year,
1659 { "Year", "simulcrypt.parameter.year", FT_UINT16, BASE_DEC, NULL, 0x0,
1660 NULL, HFILL }},
1662 { &hf_simulcrypt_month,
1663 { "Month", "simulcrypt.parameter.month", FT_UINT8, BASE_DEC, NULL, 0x0,
1664 NULL, HFILL }},
1666 { &hf_simulcrypt_day,
1667 { "Day", "simulcrypt.parameter.day", FT_UINT8, BASE_DEC, NULL, 0x0,
1668 NULL, HFILL }},
1670 { &hf_simulcrypt_hour,
1671 { "Hour", "simulcrypt.parameter.hour", FT_UINT8, BASE_DEC, NULL, 0x0,
1672 NULL, HFILL }},
1674 { &hf_simulcrypt_minute,
1675 { "Minute", "simulcrypt.parameter.minute", FT_UINT8, BASE_DEC, NULL, 0x0,
1676 NULL, HFILL }},
1678 { &hf_simulcrypt_second,
1679 { "Second", "simulcrypt.parameter.second", FT_UINT8, BASE_DEC, NULL, 0x0,
1680 NULL, HFILL }},
1682 { &hf_simulcrypt_hundredth_second,
1683 { "Hundredth_second", "simulcrypt.parameter.hundredth_second", FT_UINT8, BASE_DEC, NULL, 0x0,
1684 NULL, HFILL }},
1686 { &hf_simulcrypt_activation_pending_flag,
1687 { "Activation pending flag", "simulcrypt.parameter.activation_pending_flag", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
1688 NULL, HFILL }},
1690 { &hf_simulcrypt_component_id,
1691 { "Component ID", "simulcrypt.parameter.component_id", FT_UINT16, BASE_DEC, NULL, 0x0,
1692 NULL, HFILL }},
1694 { &hf_simulcrypt_service_id,
1695 { "Service ID", "simulcrypt.parameter.service_id", FT_UINT16, BASE_DEC, NULL, 0x0,
1696 NULL, HFILL }},
1698 { &hf_simulcrypt_transport_stream_id,
1699 { "Transport stream ID", "simulcrypt.parameter.transport_stream_id", FT_UINT16, BASE_DEC, NULL, 0x0,
1700 NULL, HFILL }},
1702 { &hf_simulcrypt_ac_changed_flag,
1703 { "AC changed flag", "simulcrypt.parameter.ac_changed_flag", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
1704 NULL, HFILL }},
1706 { &hf_simulcrypt_scg_current_reference_id,
1707 { "SCG current reference ID", "simulcrypt.parameter.scg_current_reference_id", FT_UINT32, BASE_DEC, NULL, 0x0,
1708 NULL, HFILL }},
1710 { &hf_simulcrypt_scg_pending_reference_id,
1711 { "SCG pending reference ID", "simulcrypt.parameter.scg_pending_reference_id", FT_UINT32, BASE_DEC, NULL, 0x0,
1712 NULL, HFILL }},
1714 { &hf_simulcrypt_cp_duration_flag,
1715 { "CP duration flag", "simulcrypt.parameter.cp_duration_flag", FT_UINT8, BASE_DEC, NULL, 0x0,
1716 NULL, HFILL }},
1718 { &hf_simulcrypt_recommended_cp_duration,
1719 { "Recommended CP duration", "simulcrypt.parameter.recommended_cp_duration", FT_UINT16, BASE_DEC, NULL, 0x0,
1720 NULL, HFILL }},
1722 { &hf_simulcrypt_scg_nominal_cp_duration,
1723 { "SCG nominal CP duration", "simulcrypt.parameter.scg_nominal_cp_duration", FT_UINT16, BASE_DEC, NULL, 0x0,
1724 NULL, HFILL }},
1726 { &hf_simulcrypt_original_network_id,
1727 { "Original network ID", "simulcrypt.parameter.original_network_id", FT_UINT16, BASE_DEC, NULL, 0x0,
1728 NULL, HFILL }},
1730 { &hf_simulcrypt_eis_error_status,
1731 { "Error status", "simulcrypt.error_status", FT_UINT16, BASE_DEC | BASE_EXT_STRING, &eis_error_values_ext, 0x0,
1732 NULL, HFILL }},
1734 { &hf_simulcrypt_error_description,
1735 { "Error description", "simulcrypt.error_description", FT_STRING, BASE_NONE, NULL, 0x0, /* error_description --> ASCII byte string */
1736 NULL, HFILL }},
1738 { &hf_simulcrypt_psig_parameter_type,
1739 { "Parameter Type", "simulcrypt.parameter.type", FT_UINT16, BASE_HEX | BASE_EXT_STRING, &psig_parametertypenames_ext, 0x0, /* type 2 bytes */
1740 NULL, HFILL }},
1742 { &hf_simulcrypt_psig_type,
1743 { "PSIG type", "simulcrypt.parameter.psig_type", FT_UINT8, BASE_HEX, NULL, 0x0,
1744 NULL, HFILL }},
1746 { &hf_simulcrypt_channel_id,
1747 { "Channel ID", "simulcrypt.parameter.channel_id", FT_UINT16, BASE_DEC, NULL, 0x0,
1748 NULL, HFILL }},
1750 { &hf_simulcrypt_stream_id,
1751 { "Stream ID", "simulcrypt.parameter.stream_id", FT_UINT16, BASE_DEC, NULL, 0x0,
1752 NULL, HFILL }},
1754 { &hf_simulcrypt_packet_id,
1755 { "Packet ID", "simulcrypt.parameter.packet_id", FT_UINT16, BASE_DEC, NULL, 0x0,
1756 NULL, HFILL }},
1758 { &hf_simulcrypt_interface_mode_configuration,
1759 { "Interface mode configuration", "simulcrypt.parameter.interface_mode_configuration", FT_UINT8, BASE_HEX, NULL, 0x0,
1760 NULL, HFILL }},
1762 { &hf_simulcrypt_max_stream,
1763 { "Max stream", "simulcrypt.parameter.max_stream", FT_UINT16, BASE_DEC, NULL, 0x0,
1764 NULL, HFILL }},
1766 { &hf_simulcrypt_table_period_pair,
1767 { "Table period pair", "simulcrypt.parameter.table_period_pair", FT_BYTES, BASE_NONE, NULL, 0x0,
1768 NULL, HFILL }},
1770 { &hf_simulcrypt_mpeg_section,
1771 { "MPEG section", "simulcrypt.parameter.mpeg_section", FT_BYTES, BASE_NONE, NULL, 0x0,
1772 NULL, HFILL }},
1774 { &hf_simulcrypt_repetition_rate,
1775 { "Repetition rate", "simulcrypt.parameter.repetition_rate", FT_UINT32, BASE_DEC, NULL, 0x0,
1776 NULL, HFILL }},
1778 { &hf_simulcrypt_initial_bandwidth,
1779 { "Initial bandwidth", "simulcrypt.parameter.initial_bandwidth", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_kbps), 0x0,
1780 NULL, HFILL }},
1782 { &hf_simulcrypt_asi_input_packet_id,
1783 { "ASI input packet ID", "simulcrypt.parameter.asi_input_packet_id", FT_UINT16, BASE_DEC, NULL, 0x0,
1784 NULL, HFILL }},
1786 { &hf_simulcrypt_psig_error_status,
1787 { "Error status", "simulcrypt.parameter.error_status", FT_UINT16, BASE_DEC, NULL, 0x0,
1788 NULL, HFILL }},
1790 { &hf_simulcrypt_parameter_value,
1791 { "Parameter Value", "simulcrypt.parameter.value", FT_STRING, BASE_NONE, NULL, 0x0,
1792 NULL, HFILL }}
1795 static int *ett[] =
1797 &ett_simulcrypt,
1798 &ett_simulcrypt_header,
1799 &ett_simulcrypt_message,
1800 &ett_simulcrypt_parameter,
1801 &ett_simulcrypt_super_cas_id,
1802 &ett_simulcrypt_ecm_datagram,
1803 &ett_simulcrypt_ecm_group,
1804 &ett_simulcrypt_activation_time,
1805 &ett_simulcrypt_table_period_pair
1808 module_t *simulcrypt_module;
1810 /* execute protocol initialization only once */
1811 proto_simulcrypt = proto_register_protocol ("SIMULCRYPT Protocol", "SIMULCRYPT", "simulcrypt");
1813 proto_register_field_array (proto_simulcrypt, hf, array_length (hf));
1814 proto_register_subtree_array (ett, array_length (ett));
1816 register_init_routine(simulcrypt_init);
1818 simulcrypt_handle = register_dissector("simulcrypt", dissect_simulcrypt, proto_simulcrypt);
1820 /* Register our configuration options for Simulcrypt, particularly our port. */
1821 /* This registers our preferences; function proto_reg_handoff_simulcrypt is */
1822 /* called when preferences are applied. */
1823 simulcrypt_module = prefs_register_protocol(proto_simulcrypt, proto_reg_handoff_simulcrypt);
1825 prefs_register_uint_preference(simulcrypt_module, "ca_system_id_mikey","MIKEY ECM CA_system_ID (in hex)",
1826 "Set the CA_system_ID used to decode ECM datagram as MIKEY", 16, &ca_system_id_mikey);
1829 /* this is run every time preferences are changed and also during Wireshark initialization */
1830 void
1831 proto_reg_handoff_simulcrypt(void)
1833 static bool initialized=false;
1834 unsigned i;
1836 if (!initialized) {
1837 for(i=0;i<ECM_INTERPRETATION_SIZE;i++)
1839 tab_ecm_inter[i].protocol_handle = find_dissector(tab_ecm_inter[i].protocol_name);
1841 dissector_add_for_decode_as_with_preference("udp.port", simulcrypt_handle);
1842 dissector_add_for_decode_as_with_preference("tcp.port", simulcrypt_handle);
1843 initialized = true;
1846 /* update tab_ecm_inter table (always do this) */
1847 tab_ecm_inter[ECM_MIKEY_INDEX].ca_system_id=ca_system_id_mikey;
1851 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1853 * Local variables:
1854 * c-basic-offset: 8
1855 * tab-width: 8
1856 * indent-tabs-mode: t
1857 * End:
1859 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
1860 * :indentSize=8:tabSize=8:noTabs=false: