2 * Simulcrypt protocol interface as defined in ETSI TS 103.197 v 1.5.1
5 * David Castleford, Orange Labs / France Telecom R&D
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
23 #include <epan/packet.h>
24 #include <epan/prefs.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
45 const char *protocol_name
;
46 dissector_handle_t protocol_handle
;
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" },
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"},
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" },
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" },
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" },
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" },
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" },
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" },
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" },
542 static value_string_ext psig_parametertypenames_ext
= VALUE_STRING_EXT_INIT(psig_parametertypenames
);
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" },
576 static value_string_ext psig_error_values_ext
= VALUE_STRING_EXT_INIT(psig_error_values
);
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 */
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:
707 * - TYPE of parameter
708 * length of parameter
710 - PARAMETER (optional branch for certain parameters only)
711 * parameter value sub items here
712 * End informative tree structure
716 get_interface (uint16_t type
)
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) {
729 interface
= SIMULCRYPT_ECMG_SCS
;
734 interface
= SIMULCRYPT_EMMG_MUX
;
738 interface
= SIMULCRYPT_CPSIG_PSIG
;
741 interface
= SIMULCRYPT_EIS_SCS
;
745 interface
= SIMULCRYPT_PSIG_MUX
;
748 interface
= SIMULCRYPT_MUX_CIM
;
751 interface
= SIMULCRYPT_PSIG_CIP
;
754 interface
= SIMULCRYPT_RESERVED
;
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
;
769 uint32_t pvaluedec
; /* parameter decimal value */
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
);
793 proto_tree_add_item(simulcrypt_super_cas_id_tree
, hf_simulcrypt_ca_subsystem_id
, tvb
, offset
+2, 2, ENC_BIG_ENDIAN
);
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 */
798 case SIMULCRYPT_ECMG_ECM_CHANNEL_ID
:
799 proto_tree_add_item(tree
, hf_simulcrypt_ecm_channel_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
801 case SIMULCRYPT_ECMG_DELAY_START
:
802 proto_tree_add_item(tree
, hf_simulcrypt_delay_start
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
804 case SIMULCRYPT_ECMG_DELAY_STOP
:
805 proto_tree_add_item(tree
, hf_simulcrypt_delay_stop
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
807 case SIMULCRYPT_ECMG_TRANSITION_DELAY_START
:
808 proto_tree_add_item(tree
, hf_simulcrypt_transition_delay_start
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
810 case SIMULCRYPT_ECMG_TRANSITION_DELAY_STOP
:
811 proto_tree_add_item(tree
, hf_simulcrypt_transition_delay_stop
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
813 case SIMULCRYPT_ECMG_AC_DELAY_START
:
814 proto_tree_add_item(tree
, hf_simulcrypt_ac_delay_start
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
816 case SIMULCRYPT_ECMG_AC_DELAY_STOP
:
817 proto_tree_add_item(tree
, hf_simulcrypt_ac_delay_stop
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
819 case SIMULCRYPT_ECMG_ECM_REP_PERIOD
:
820 proto_tree_add_item(tree
, hf_simulcrypt_ecm_rep_period
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
822 case SIMULCRYPT_ECMG_MAX_STREAMS
:
823 proto_tree_add_item(tree
, hf_simulcrypt_max_streams
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
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
);
832 case SIMULCRYPT_ECMG_LEAD_CW
:
833 proto_tree_add_item(tree
, hf_simulcrypt_lead_cw
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
835 case SIMULCRYPT_ECMG_CW_PER_MESSAGE
:
836 proto_tree_add_item(tree
, hf_simulcrypt_cw_per_msg
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
838 case SIMULCRYPT_ECMG_MAX_COMP_TIME
:
839 proto_tree_add_item(tree
, hf_simulcrypt_max_comp_time
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
841 case SIMULCRYPT_ECMG_ACCESS_CRITERIA
:
842 proto_tree_add_item(tree
, hf_simulcrypt_access_criteria
, tvb
, offset
, plen
, ENC_NA
);
844 case SIMULCRYPT_ECMG_ECM_STREAM_ID
:
845 proto_tree_add_item(tree
, hf_simulcrypt_ecm_stream_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
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
);
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
);
857 case SIMULCRYPT_ECMG_CP_NUMBER
:
858 proto_tree_add_item(tree
, hf_simulcrypt_cp_number
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
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
);
867 case SIMULCRYPT_ECMG_CP_CW_COMBINATION
:
868 proto_tree_add_item(tree
, hf_simulcrypt_cp_cw_combination
, tvb
, offset
, plen
, ENC_NA
);
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
);
887 case SIMULCRYPT_ECMG_CW_ENCRYPTION
:
888 proto_tree_add_item(tree
, hf_simulcrypt_cw_encryption
, tvb
, offset
, plen
, ENC_NA
);
890 case SIMULCRYPT_ECMG_ECM_ID
:
891 proto_tree_add_item(tree
, hf_simulcrypt_ecm_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
893 case SIMULCRYPT_ECMG_ERROR_STATUS
:
894 proto_tree_add_item(tree
, hf_simulcrypt_ecmg_error_status
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
896 case SIMULCRYPT_ECMG_ERROR_INFORMATION
:
897 proto_tree_add_item(tree
, hf_simulcrypt_error_information
, tvb
, offset
, plen
, ENC_NA
);
899 default: /* Unknown parameter type */
900 proto_tree_add_string(tree
, hf_simulcrypt_parameter_value
, tvb
, offset
, plen
, pvalue_char
);
902 } /* end parameter type switch */
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
)
910 case SIMULCRYPT_EMMG_CLIENT_ID
:
911 proto_tree_add_item(tree
, hf_simulcrypt_client_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
913 case SIMULCRYPT_EMMG_SECTION_TSPKT_FLAG
:
914 proto_tree_add_item(tree
, hf_simulcrypt_section_tspkt_flag
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
916 case SIMULCRYPT_EMMG_DATA_CHANNEL_ID
:
917 proto_tree_add_item(tree
, hf_simulcrypt_data_channel_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
919 case SIMULCRYPT_EMMG_DATA_STREAM_ID
:
920 proto_tree_add_item(tree
, hf_simulcrypt_data_stream_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
922 case SIMULCRYPT_EMMG_DATAGRAM
:
923 proto_tree_add_item(tree
, hf_simulcrypt_datagram
, tvb
, offset
, plen
, ENC_NA
);
925 case SIMULCRYPT_EMMG_BANDWIDTH
:
926 proto_tree_add_item(tree
, hf_simulcrypt_bandwidth
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
928 case SIMULCRYPT_EMMG_DATA_TYPE
:
929 proto_tree_add_item(tree
, hf_simulcrypt_data_type
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
931 case SIMULCRYPT_EMMG_DATA_ID
:
932 proto_tree_add_item(tree
, hf_simulcrypt_data_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
934 case SIMULCRYPT_EMMG_ERROR_STATUS
:
935 proto_tree_add_item(tree
, hf_simulcrypt_emmg_error_status
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
937 case SIMULCRYPT_EMMG_ERROR_INFORMATION
:
938 proto_tree_add_item(tree
, hf_simulcrypt_error_information
, tvb
, offset
, plen
, ENC_NA
);
940 default: /* Unknown parameter type */
941 proto_tree_add_string(tree
, hf_simulcrypt_parameter_value
, tvb
, offset
, plen
, pvalue_char
);
943 } /* end parameter type switch */
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 */
961 case SIMULCRYPT_EIS_CHANNEL_ID
:
962 proto_tree_add_item(tree
, hf_simulcrypt_eis_channel_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
964 case SIMULCRYPT_EIS_SERVICE_FLAG
:
965 proto_tree_add_item(tree
, hf_simulcrypt_service_flag
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
967 case SIMULCRYPT_EIS_COMPONENT_FLAG
:
968 proto_tree_add_item(tree
, hf_simulcrypt_component_flag
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
970 case SIMULCRYPT_EIS_MAX_SCG
:
971 proto_tree_add_item(tree
, hf_simulcrypt_max_scg
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
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 */
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);
983 case SIMULCRYPT_EIS_SCG_ID
:
984 proto_tree_add_item(tree
, hf_simulcrypt_scg_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
986 case SIMULCRYPT_EIS_SCG_REFERENCE_ID
:
987 proto_tree_add_item(tree
, hf_simulcrypt_scg_reference_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
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
);
1008 proto_tree_add_item(simulcrypt_super_cas_id_tree
, hf_simulcrypt_ca_subsystem_id
, tvb
, offset
+2, 2, ENC_BIG_ENDIAN
);
1010 case SIMULCRYPT_EIS_ECM_ID
:
1011 proto_tree_add_item(tree
, hf_simulcrypt_ecm_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1013 case SIMULCRYPT_EIS_ACCESS_CRITERIA
:
1014 proto_tree_add_item(tree
, hf_simulcrypt_access_criteria
, tvb
, offset
, plen
, ENC_NA
);
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 */
1031 case SIMULCRYPT_EIS_ACTIVATION_PENDING_FLAG
:
1032 proto_tree_add_item(tree
, hf_simulcrypt_activation_pending_flag
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1034 case SIMULCRYPT_EIS_COMPONENT_ID
:
1035 proto_tree_add_item(tree
, hf_simulcrypt_component_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1037 case SIMULCRYPT_EIS_SERVICE_ID
:
1038 proto_tree_add_item(tree
, hf_simulcrypt_service_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1040 case SIMULCRYPT_EIS_TRANSPORT_STREAM_ID
:
1041 proto_tree_add_item(tree
, hf_simulcrypt_transport_stream_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1043 case SIMULCRYPT_EIS_AC_CHANGED_FLAG
:
1044 proto_tree_add_item(tree
, hf_simulcrypt_ac_changed_flag
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
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
);
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
);
1052 case SIMULCRYPT_EIS_CP_DURATION_FLAG
:
1053 proto_tree_add_item(tree
, hf_simulcrypt_cp_duration_flag
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
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
);
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
);
1069 case SIMULCRYPT_EIS_ORIGINAL_NETWORK_ID
:
1070 proto_tree_add_item(tree
, hf_simulcrypt_original_network_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1073 case SIMULCRYPT_EIS_ERROR_STATUS
:
1074 proto_tree_add_item(tree
, hf_simulcrypt_eis_error_status
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1076 case SIMULCRYPT_EIS_ERROR_INFORMATION
:
1077 proto_tree_add_item(tree
, hf_simulcrypt_error_information
, tvb
, offset
, plen
, ENC_NA
);
1079 case SIMULCRYPT_EIS_ERROR_DESCRIPTION
:
1080 proto_tree_add_item(tree
, hf_simulcrypt_error_description
, tvb
, offset
, plen
, ENC_ASCII
);
1083 default: /* Unknown parameter type */
1084 proto_tree_add_string(tree
, hf_simulcrypt_parameter_value
, tvb
, offset
, plen
, pvalue_char
);
1086 } /* end parameter type switch */
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
);
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
);
1106 proto_item_append_text(simulcrypt_item
, " (PSIG)");
1109 proto_item_append_text(simulcrypt_item
, " (SIG)");
1112 proto_item_append_text(simulcrypt_item
, " (PSISIG)");
1118 case SIMULCRYPT_PSIG_CHANNEL_ID
:
1119 proto_tree_add_item(tree
, hf_simulcrypt_channel_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1121 case SIMULCRYPT_PSIG_STREAM_ID
:
1122 proto_tree_add_item(tree
, hf_simulcrypt_stream_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1124 case SIMULCRYPT_PSIG_TRANSPORT_STREAM_ID
:
1125 proto_tree_add_item(tree
, hf_simulcrypt_transport_stream_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1127 case SIMULCRYPT_PSIG_ORIGINAL_NETWORK_ID
:
1128 proto_tree_add_item(tree
, hf_simulcrypt_original_network_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1130 case SIMULCRYPT_PSIG_PACKET_ID
:
1131 proto_tree_add_item(tree
, hf_simulcrypt_packet_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1133 case SIMULCRYPT_PSIG_INTERFACE_MODE_CONFIGURATION
:
1134 proto_tree_add_item(tree
, hf_simulcrypt_interface_mode_configuration
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1136 case SIMULCRYPT_PSIG_MAX_STREAM
:
1137 proto_tree_add_item(tree
, hf_simulcrypt_max_stream
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
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);
1148 case SIMULCRYPT_PSIG_MPEG_SECTION
:
1149 proto_tree_add_item(tree
, hf_simulcrypt_mpeg_section
, tvb
, offset
, plen
, ENC_NA
);
1151 case SIMULCRYPT_PSIG_REPETITION_RATE
:
1152 proto_tree_add_item(tree
, hf_simulcrypt_repetition_rate
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
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 */
1169 case SIMULCRYPT_PSIG_DATAGRAM
:
1170 proto_tree_add_item(tree
, hf_simulcrypt_datagram
, tvb
, offset
, plen
, ENC_NA
);
1172 case SIMULCRYPT_PSIG_BANDWIDTH
:
1173 proto_tree_add_item(tree
, hf_simulcrypt_bandwidth
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1175 case SIMULCRYPT_PSIG_INITIAL_BANDWIDTH
:
1176 proto_tree_add_item(tree
, hf_simulcrypt_initial_bandwidth
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1178 case SIMULCRYPT_PSIG_MAX_COMP_TIME
:
1179 proto_tree_add_item(tree
, hf_simulcrypt_max_comp_time
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
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
);
1184 case SIMULCRYPT_PSIG_ERROR_STATUS
:
1185 proto_tree_add_item(tree
, hf_simulcrypt_psig_error_status
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1187 case SIMULCRYPT_PSIG_ERROR_INFORMATION
:
1188 proto_tree_add_item(tree
, hf_simulcrypt_error_information
, tvb
, offset
, plen
, ENC_NA
);
1190 default: /* Unknown parameter type */
1191 proto_tree_add_string(tree
, hf_simulcrypt_parameter_value
, tvb
, offset
, plen
, pvalue_char
);
1193 } /* end parameter type switch */
1194 decrement_dissection_depth(pinfo
);
1197 /* This method dissects fully reassembled messages */
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"));
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
);
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
);
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 */
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 */
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) */
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
;
1286 applied_offset
= subtree_offset
;
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 */
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"));
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"));
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"));
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"));
1325 proto_item_append_text(simulcrypt_item
, ": Type=0x%02x", ptype
);
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
);
1336 case SIMULCRYPT_EMMG_MUX
:
1337 proto_tree_add_item(simulcrypt_parameter_tree
, hf_simulcrypt_emmg_parameter_type
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1339 case SIMULCRYPT_EIS_SCS
:
1340 proto_tree_add_item(simulcrypt_parameter_tree
, hf_simulcrypt_eis_parameter_type
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
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
);
1348 proto_tree_add_item(simulcrypt_parameter_tree
, hf_simulcrypt_parameter_type
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
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 */
1355 case SIMULCRYPT_ECMG_SCS
:
1356 dissect_ecmg_parameter_value (simulcrypt_parameter_tree
, tvb
, pinfo
, offset
, plen
, ptype
, pvalue_char
);
1358 case SIMULCRYPT_EMMG_MUX
:
1359 dissect_emmg_parameter_value (simulcrypt_parameter_tree
, tvb
, pinfo
, offset
, plen
, ptype
, pvalue_char
);
1361 case SIMULCRYPT_EIS_SCS
:
1362 dissect_eis_parameter_value (simulcrypt_parameter_tree
, tvb
, pinfo
, offset
, plen
, ptype
, pvalue_char
);
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
);
1370 proto_tree_add_string(tree
, hf_simulcrypt_parameter_value
, tvb
, offset
, plen
, pvalue_char
);
1374 subtree_offset
+= 2+2+plen
;
1378 applied_offset
= subtree_offset
;
1382 applied_offset
= offset
;
1384 } /* end parameter tree details */
1388 /* determine PDU length of protocol foo */
1390 get_simulcrypt_message_len(packet_info
*pinfo _U_
, tvbuff_t
*tvb
,
1391 int offset
, void *data _U_
)
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" */
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. */
1407 simulcrypt_init(void)
1411 for(i
=0;i
<ECM_INTERPRETATION_SIZE
;i
++)
1413 tab_ecm_inter
[i
].ecmg_port
= -1;
1417 void proto_reg_handoff_simulcrypt(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,
1434 { &hf_simulcrypt_version
,
1435 { "Version", "simulcrypt.version", FT_UINT8
, BASE_HEX
, NULL
, 0x0, /* version 1 byte */
1438 { &hf_simulcrypt_message_type
,
1439 { "Message Type", "simulcrypt.message.type", FT_UINT16
, BASE_HEX
|BASE_EXT_STRING
, &messagetypenames_ext
, 0x0, /* type 2 bytes */
1442 { &hf_simulcrypt_interface
,
1443 { "Interface", "simulcrypt.message.interface", FT_UINT16
, BASE_DEC
, VALS(interfacenames
), 0x0,
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 */
1450 { &hf_simulcrypt_message
,
1451 { "Message", "simulcrypt.message", FT_NONE
, BASE_NONE
, NULL
, 0x0,
1454 { &hf_simulcrypt_parameter
,
1455 { "Parameter", "simulcrypt.parameter", FT_NONE
, BASE_NONE
, NULL
, 0x0,
1458 { &hf_simulcrypt_parameter_type
,
1459 { "Parameter Type", "simulcrypt.parameter.type", FT_UINT16
, BASE_HEX
, NULL
, 0x0, /* type 2 bytes */
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 */
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 */
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 */
1474 { &hf_simulcrypt_ca_system_id
,
1475 { "CA System ID", "simulcrypt.parameter.ca_system_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1478 { &hf_simulcrypt_ca_subsystem_id
,
1479 { "CA Subsystem ID", "simulcrypt.parameter.ca_subsystem_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1482 { &hf_simulcrypt_super_cas_id
,
1483 { "SuperCAS ID", "simulcrypt.super_cas_id", FT_UINT32
, BASE_HEX
, NULL
, 0x0,
1486 { &hf_simulcrypt_section_tspkt_flag
,
1487 { "Section TS pkt flag", "simulcrypt.section_tspkt_flag", FT_UINT8
, BASE_HEX
, NULL
, 0x0,
1490 { &hf_simulcrypt_ecm_channel_id
,
1491 { "ECM channel ID", "simulcrypt.ecm_channel_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1494 { &hf_simulcrypt_delay_start
,
1495 { "Delay start", "simulcrypt.delay_start", FT_INT16
, BASE_DEC
|BASE_UNIT_STRING
, UNS(&units_milliseconds
), 0x0,
1498 { &hf_simulcrypt_delay_stop
,
1499 { "Delay stop", "simulcrypt.delay_stop", FT_INT16
, BASE_DEC
|BASE_UNIT_STRING
, UNS(&units_milliseconds
), 0x0,
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,
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,
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,
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,
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,
1522 { &hf_simulcrypt_max_streams
,
1523 { "Max streams", "simulcrypt.max_streams", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1526 { &hf_simulcrypt_min_cp_duration
,
1527 { "Min CP duration", "simulcrypt.min_cp_duration", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1530 { &hf_simulcrypt_lead_cw
,
1531 { "Lead CW", "simulcrypt.lead_cw", FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1534 { &hf_simulcrypt_cw_per_msg
,
1535 { "CW per msg", "simulcrypt.cw_per_msg", FT_UINT8
, BASE_DEC
, NULL
, 0x0,
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,
1542 { &hf_simulcrypt_access_criteria
,
1543 { "Access criteria", "simulcrypt.access_criteria", FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1546 { &hf_simulcrypt_ecm_stream_id
,
1547 { "ECM stream ID", "simulcrypt.ecm_stream_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1550 { &hf_simulcrypt_nominal_cp_duration
,
1551 { "Nominal CP duration", "simulcrypt.nominal_cp_duration", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1554 { &hf_simulcrypt_access_criteria_transfer_mode
,
1555 { "AC transfer mode", "simulcrypt.access_criteria_transfer_mode", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
1558 { &hf_simulcrypt_cp_number
,
1559 { "CP number", "simulcrypt.cp_number", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1562 { &hf_simulcrypt_cp_duration
,
1563 { "CP duration", "simulcrypt.cp_duration", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1566 { &hf_simulcrypt_cp_cw_combination
,
1567 { "CP CW combination", "simulcrypt.cp_cw_combination", FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1570 { &hf_simulcrypt_ecm_datagram
,
1571 { "ECM datagram", "simulcrypt.ecm_datagram", FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1574 { &hf_simulcrypt_cw_encryption
,
1575 { "CW encryption", "simulcrypt.cw_encryption", FT_NONE
, BASE_NONE
, NULL
, 0x0,
1578 { &hf_simulcrypt_ecm_id
,
1579 { "ECM ID", "simulcrypt.ecm_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1582 { &hf_simulcrypt_client_id
,
1583 { "Client ID", "simulcrypt.client_id", FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1586 { &hf_simulcrypt_data_channel_id
,
1587 { "Data Channel ID", "simulcrypt.data_channel_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1590 { &hf_simulcrypt_data_stream_id
,
1591 { "Data Stream ID", "simulcrypt.data_stream_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1594 { &hf_simulcrypt_datagram
,
1595 { "Datagram", "simulcrypt.datagram", FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1598 { &hf_simulcrypt_bandwidth
,
1599 { "Bandwidth", "simulcrypt.bandwidth", FT_UINT16
, BASE_DEC
|BASE_UNIT_STRING
, UNS(&units_kbps
), 0x0,
1602 { &hf_simulcrypt_data_type
,
1603 { "Data Type", "simulcrypt.data_type", FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1606 { &hf_simulcrypt_data_id
,
1607 { "Data ID", "simulcrypt.data_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1610 { &hf_simulcrypt_ecmg_error_status
,
1611 { "Error status", "simulcrypt.error_status", FT_UINT16
, BASE_DEC
| BASE_EXT_STRING
, &ecmg_error_values_ext
, 0x0,
1614 { &hf_simulcrypt_emmg_error_status
,
1615 { "Error status", "simulcrypt.error_status", FT_UINT16
, BASE_DEC
| BASE_EXT_STRING
, &emmg_error_values_ext
, 0x0,
1618 { &hf_simulcrypt_error_information
,
1619 { "Error information", "simulcrypt.error_information", FT_BYTES
, BASE_NONE
, NULL
, 0x0,
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 */
1626 { &hf_simulcrypt_eis_channel_id
,
1627 { "EIS channel ID", "simulcrypt.parameter.eis_channel_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1630 { &hf_simulcrypt_service_flag
,
1631 { "Service flag", "simulcrypt.parameter.service_flag", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
1634 { &hf_simulcrypt_component_flag
,
1635 { "Component flag", "simulcrypt.parameter.component_flag", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
1638 { &hf_simulcrypt_max_scg
,
1639 { "Max SCG", "simulcrypt.parameter.max_scg", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1642 { &hf_simulcrypt_ecm_group
,
1643 { "ECM group", "simulcrypt.parameter.ecm_group", FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1646 { &hf_simulcrypt_scg_id
,
1647 { "SCG ID", "simulcrypt.parameter.scg_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1650 { &hf_simulcrypt_scg_reference_id
,
1651 { "SCG reference ID", "simulcrypt.parameter.scg_reference_id", FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1654 { &hf_simulcrypt_activation_time
,
1655 { "Activation time", "simulcrypt.parameter.activation_time", FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1658 { &hf_simulcrypt_year
,
1659 { "Year", "simulcrypt.parameter.year", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1662 { &hf_simulcrypt_month
,
1663 { "Month", "simulcrypt.parameter.month", FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1666 { &hf_simulcrypt_day
,
1667 { "Day", "simulcrypt.parameter.day", FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1670 { &hf_simulcrypt_hour
,
1671 { "Hour", "simulcrypt.parameter.hour", FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1674 { &hf_simulcrypt_minute
,
1675 { "Minute", "simulcrypt.parameter.minute", FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1678 { &hf_simulcrypt_second
,
1679 { "Second", "simulcrypt.parameter.second", FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1682 { &hf_simulcrypt_hundredth_second
,
1683 { "Hundredth_second", "simulcrypt.parameter.hundredth_second", FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1686 { &hf_simulcrypt_activation_pending_flag
,
1687 { "Activation pending flag", "simulcrypt.parameter.activation_pending_flag", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
1690 { &hf_simulcrypt_component_id
,
1691 { "Component ID", "simulcrypt.parameter.component_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1694 { &hf_simulcrypt_service_id
,
1695 { "Service ID", "simulcrypt.parameter.service_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1698 { &hf_simulcrypt_transport_stream_id
,
1699 { "Transport stream ID", "simulcrypt.parameter.transport_stream_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1702 { &hf_simulcrypt_ac_changed_flag
,
1703 { "AC changed flag", "simulcrypt.parameter.ac_changed_flag", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
1706 { &hf_simulcrypt_scg_current_reference_id
,
1707 { "SCG current reference ID", "simulcrypt.parameter.scg_current_reference_id", FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1710 { &hf_simulcrypt_scg_pending_reference_id
,
1711 { "SCG pending reference ID", "simulcrypt.parameter.scg_pending_reference_id", FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1714 { &hf_simulcrypt_cp_duration_flag
,
1715 { "CP duration flag", "simulcrypt.parameter.cp_duration_flag", FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1718 { &hf_simulcrypt_recommended_cp_duration
,
1719 { "Recommended CP duration", "simulcrypt.parameter.recommended_cp_duration", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1722 { &hf_simulcrypt_scg_nominal_cp_duration
,
1723 { "SCG nominal CP duration", "simulcrypt.parameter.scg_nominal_cp_duration", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1726 { &hf_simulcrypt_original_network_id
,
1727 { "Original network ID", "simulcrypt.parameter.original_network_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1730 { &hf_simulcrypt_eis_error_status
,
1731 { "Error status", "simulcrypt.error_status", FT_UINT16
, BASE_DEC
| BASE_EXT_STRING
, &eis_error_values_ext
, 0x0,
1734 { &hf_simulcrypt_error_description
,
1735 { "Error description", "simulcrypt.error_description", FT_STRING
, BASE_NONE
, NULL
, 0x0, /* error_description --> ASCII byte string */
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 */
1742 { &hf_simulcrypt_psig_type
,
1743 { "PSIG type", "simulcrypt.parameter.psig_type", FT_UINT8
, BASE_HEX
, NULL
, 0x0,
1746 { &hf_simulcrypt_channel_id
,
1747 { "Channel ID", "simulcrypt.parameter.channel_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1750 { &hf_simulcrypt_stream_id
,
1751 { "Stream ID", "simulcrypt.parameter.stream_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1754 { &hf_simulcrypt_packet_id
,
1755 { "Packet ID", "simulcrypt.parameter.packet_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1758 { &hf_simulcrypt_interface_mode_configuration
,
1759 { "Interface mode configuration", "simulcrypt.parameter.interface_mode_configuration", FT_UINT8
, BASE_HEX
, NULL
, 0x0,
1762 { &hf_simulcrypt_max_stream
,
1763 { "Max stream", "simulcrypt.parameter.max_stream", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1766 { &hf_simulcrypt_table_period_pair
,
1767 { "Table period pair", "simulcrypt.parameter.table_period_pair", FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1770 { &hf_simulcrypt_mpeg_section
,
1771 { "MPEG section", "simulcrypt.parameter.mpeg_section", FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1774 { &hf_simulcrypt_repetition_rate
,
1775 { "Repetition rate", "simulcrypt.parameter.repetition_rate", FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1778 { &hf_simulcrypt_initial_bandwidth
,
1779 { "Initial bandwidth", "simulcrypt.parameter.initial_bandwidth", FT_UINT16
, BASE_DEC
|BASE_UNIT_STRING
, UNS(&units_kbps
), 0x0,
1782 { &hf_simulcrypt_asi_input_packet_id
,
1783 { "ASI input packet ID", "simulcrypt.parameter.asi_input_packet_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1786 { &hf_simulcrypt_psig_error_status
,
1787 { "Error status", "simulcrypt.parameter.error_status", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1790 { &hf_simulcrypt_parameter_value
,
1791 { "Parameter Value", "simulcrypt.parameter.value", FT_STRING
, BASE_NONE
, NULL
, 0x0,
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 */
1831 proto_reg_handoff_simulcrypt(void)
1833 static bool initialized
=false;
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
);
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
1856 * indent-tabs-mode: t
1859 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
1860 * :indentSize=8:tabSize=8:noTabs=false: