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
16 * Wireshark - Network traffic analyzer
17 * By Gerald Combs <gerald@wireshark.org>
18 * Copyright 1998 Gerald Combs
20 * This program is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU General Public License
22 * as published by the Free Software Foundation; either version 2
23 * of the License, or (at your option) any later version.
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
30 * You should have received a copy of the GNU General Public License
31 * along with this program; if not, write to the Free Software
32 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
38 #include <epan/packet.h>
39 #include <epan/dissectors/packet-tcp.h>
40 #include <epan/prefs.h>
42 #define PROTO_TAG_SIMULCRYPT "SIMULCRYPT"
43 #define CA_SYSTEM_ID_MIKEY 0x9999 /* CA_system_ID corresponding to MIKEY ECM */
44 #define CA_SYSTEM_ID_MIKEY_PROTO "mikey" /* Protocol name to be used to "decode as" ECMs with CA_SYSTEM_ID_MIKEY */
46 /* Tecm_interpretation links ca_system_id to ecmg port and protocol name for dissection of
47 * ecm_datagram in ECM_Response message.
48 * Currently size is 1 as only have MIKEY protocol but could add extra protocols
49 * could add option in preferences for new ca_system_id for new protocol for example
51 typedef struct Tecm_interpretation
54 const char *protocol_name
;
55 dissector_handle_t protocol_handle
;
59 #define ECM_MIKEY_INDEX 0 /* must agree with tab_ecm_inter initialization */
61 static ecm_interpretation tab_ecm_inter
[] = {
62 {CA_SYSTEM_ID_MIKEY
, CA_SYSTEM_ID_MIKEY_PROTO
, NULL
, -1}
65 #define ECM_INTERPRETATION_SIZE (sizeof(tab_ecm_inter)/sizeof(ecm_interpretation))
67 static int dissect_simulcrypt_message(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
);
68 static guint
get_simulcrypt_message_len(packet_info
*pinfo
, tvbuff_t
*tvb
, int offset
);
69 static void dissect_simulcrypt_data(proto_tree
*simulcrypt_tree
, proto_item
*simulcrypt_item
, packet_info
*pinfo _U_
,
70 tvbuff_t
*tvb
, proto_tree
*tree
, int offset
,
71 int container_data_length
, guint16 iftype
, gboolean is_subtree
);
73 /* Wireshark ID of the SIMULCRYPT protocol */
74 static guint proto_simulcrypt
= -1;
76 /* Preferences (with default values) */
77 static guint global_simulcrypt_tcp_port
= 0; /* Simulcrypt registered only if pref set to non-zero value */
78 static guint global_simulcrypt_udp_port
= 0; /* Simulcrypt registered only if pref set to non-zero value */
79 static int ca_system_id_mikey
= CA_SYSTEM_ID_MIKEY
; /* MIKEY ECM CA_system_ID */
81 /* MIKEY payload start bytes */
82 /*unsigned char mikey_start[3]={0x01,0x00,0x15};
83 * mikey_start[0]=0x01; first byte mikey payload (version)
84 * mikey_start[1]=0x00; second byte mikey payload (data type)
85 * mikey_start[2]=0x15; third byte (next payload)
88 /* Dissector-internal values to determine interface, can be re-organized */
89 #define SIMULCRYPT_RESERVED 0
90 #define SIMULCRYPT_ECMG_SCS 1
91 #define SIMULCRYPT_EMMG_MUX 2
92 #define SIMULCRYPT_CPSIG_PSIG 3
93 #define SIMULCRYPT_EIS_SCS 4
94 #define SIMULCRYPT_PSIG_MUX 5
95 #define SIMULCRYPT_MUX_CIM 6
96 #define SIMULCRYPT_PSIG_CIP 7
97 #define SIMULCRYPT_USER_DEFINED 8
99 static const value_string interfacenames
[] = {
100 { SIMULCRYPT_RESERVED
, "DVB reserved" },
101 { SIMULCRYPT_ECMG_SCS
, "ECMG <-> SCS" },
102 { SIMULCRYPT_EMMG_MUX
, "EMMG <-> MUX" },
103 { SIMULCRYPT_CPSIG_PSIG
, "C(P)SIG <-> (P)SIG" },
104 { SIMULCRYPT_EIS_SCS
, "EIS <-> SCS" },
105 { SIMULCRYPT_PSIG_MUX
, "(P)SIG <-> MUX" },
106 { SIMULCRYPT_MUX_CIM
, "Carousel in the MUX - CiM" },
107 { SIMULCRYPT_PSIG_CIP
, "Carousel in the (P) - CiP" },
108 { SIMULCRYPT_USER_DEFINED
, "User defined" },
112 /* Reserved 0x0000 */
113 #define SIMULCRYPT_ECMG_CHANNEL_SETUP 0x0001
114 #define SIMULCRYPT_ECMG_CHANNEL_TEST 0x0002
115 #define SIMULCRYPT_ECMG_CHANNEL_STATUS 0x0003
116 #define SIMULCRYPT_ECMG_CHANNEL_CLOSE 0x0004
117 #define SIMULCRYPT_ECMG_CHANNEL_ERROR 0x0005
118 /* Reserved 0x0006 - 0x0010 */
119 #define SIMULCRYPT_EMMG_CHANNEL_SETUP 0x0011
120 #define SIMULCRYPT_EMMG_CHANNEL_TEST 0x0012
121 #define SIMULCRYPT_EMMG_CHANNEL_STATUS 0x0013
122 #define SIMULCRYPT_EMMG_CHANNEL_CLOSE 0x0014
123 #define SIMULCRYPT_EMMG_CHANNEL_ERROR 0x0015
124 /* Reserved 0x0016 - 0x0100 */
125 #define SIMULCRYPT_ECMG_STREAM_SETUP 0x0101
126 #define SIMULCRYPT_ECMG_STREAM_TEST 0x0102
127 #define SIMULCRYPT_ECMG_STREAM_STATUS 0x0103
128 #define SIMULCRYPT_ECMG_STREAM_CLOSE_REQUEST 0x0104
129 #define SIMULCRYPT_ECMG_STREAM_CLOSE_RESPONSE 0x0105
130 #define SIMULCRYPT_ECMG_STREAM_ERROR 0x0106
131 /* Reserved 0x0107 - 0x0110 */
132 #define SIMULCRYPT_EMMG_STREAM_SETUP 0x0111
133 #define SIMULCRYPT_EMMG_STREAM_TEST 0x0112
134 #define SIMULCRYPT_EMMG_STREAM_STATUS 0x0113
135 #define SIMULCRYPT_EMMG_STREAM_CLOSE_REQUEST 0x0114
136 #define SIMULCRYPT_EMMG_STREAM_CLOSE_RESPONSE 0x0115
137 #define SIMULCRYPT_EMMG_STREAM_ERROR 0x0116
138 #define SIMULCRYPT_EMMG_STREAM_BW_REQUEST 0x0117
139 #define SIMULCRYPT_EMMG_STREAM_BW_ALLOCATION 0x0118
140 /* Reserved 0x0119 - 0x0200 */
141 #define SIMULCRYPT_ECMG_CW_PROVISION 0x0201
142 #define SIMULCRYPT_ECMG_ECM_RESPONSE 0x0202
143 /* Reserved 0x0203 - 0x0210 */
144 #define SIMULCRYPT_EMMG_DATA_PROVISION 0x0211
145 /* Reserved 0x0212 - 0x0300 */
147 /* Reserved 0x0322 - 0x0400 */
148 #define SIMULCRYPT_EIS_CHANNEL_SET_UP 0x0401
149 #define SIMULCRYPT_EIS_CHANNEL_TEST 0x0402
150 #define SIMULCRYPT_EIS_CHANNEL_STATUS 0x0403
151 #define SIMULCRYPT_EIS_CHANNEL_CLOSE 0x0404
152 #define SIMULCRYPT_EIS_CHANNEL_ERROR 0x0405
153 #define SIMULCRYPT_EIS_CHANNEL_RESET 0x0406
155 #define SIMULCRYPT_EIS_SCG_PROVISION 0x0408
156 #define SIMULCRYPT_EIS_SCG_TEST 0x0409
157 #define SIMULCRYPT_EIS_SCG_STATUS 0x040A
158 #define SIMULCRYPT_EIS_SCG_ERROR 0x040B
159 #define SIMULCRYPT_EIS_SCG_LIST_REQUEST 0x040C
160 #define SIMULCRYPT_EIS_SCG_LIST_RESPONSE 0x040D
162 #define SIMULCRYPT_PSIG_CHANNEL_SETUP 0x0411
163 #define SIMULCRYPT_PSIG_CHANNEL_TEST 0x0412
164 #define SIMULCRYPT_PSIG_CHANNEL_STATUS 0x0413
165 #define SIMULCRYPT_PSIG_CHANNEL_CLOSE 0x0414
166 #define SIMULCRYPT_PSIG_CHANNEL_ERROR 0x0415
168 #define SIMULCRYPT_PSIG_STREAM_SETUP 0x0421
169 #define SIMULCRYPT_PSIG_STREAM_TEST 0x0422
170 #define SIMULCRYPT_PSIG_STREAM_STATUS 0x0423
171 #define SIMULCRYPT_PSIG_STREAM_CLOSE_REQUEST 0x0424
172 #define SIMULCRYPT_PSIG_STREAM_CLOSE_RESPONSE 0x0425
173 #define SIMULCRYPT_PSIG_STREAM_ERROR 0x0426
175 #define SIMULCRYPT_PSIG_CIM_STREAM_SECTION_PROVISION 0x0431
176 #define SIMULCRYPT_PSIG_CIM_CHANNEL_RESET 0x0432
178 #define SIMULCRYPT_PSIG_CIM_STREAM_BW_REQUEST 0x0441
179 #define SIMULCRYPT_PSIG_CIM_STREAM_BW_ALLOCATION 0x0442
180 #define SIMULCRYPT_PSIG_CIM_STREAM_DATA_PROVISION 0x0443
182 /* User defined 0x8000 - 0xFFFF */
184 static const value_string messagetypenames
[] = {
185 { SIMULCRYPT_ECMG_CHANNEL_SETUP
, "CHANNEL_SETUP" },
186 { SIMULCRYPT_ECMG_CHANNEL_TEST
, "CHANNEL_TEST" },
187 { SIMULCRYPT_ECMG_CHANNEL_STATUS
, "CHANNEL_STATUS" },
188 { SIMULCRYPT_ECMG_CHANNEL_CLOSE
, "CHANNEL_CLOSE" },
189 { SIMULCRYPT_ECMG_CHANNEL_ERROR
, "CHANNEL_ERROR" },
191 { SIMULCRYPT_EMMG_CHANNEL_SETUP
, "CHANNEL_SETUP" },
192 { SIMULCRYPT_EMMG_CHANNEL_TEST
, "CHANNEL_TEST" },
193 { SIMULCRYPT_EMMG_CHANNEL_STATUS
, "CHANNEL_STATUS" },
194 { SIMULCRYPT_EMMG_CHANNEL_CLOSE
, "CHANNEL_CLOSE" },
195 { SIMULCRYPT_EMMG_CHANNEL_ERROR
, "CHANNEL_ERROR" },
197 { SIMULCRYPT_ECMG_STREAM_SETUP
, "STREAM_SETUP" },
198 { SIMULCRYPT_ECMG_STREAM_TEST
, "STREAM_TEST" },
199 { SIMULCRYPT_ECMG_STREAM_STATUS
, "STREAM_STATUS" },
200 { SIMULCRYPT_ECMG_STREAM_CLOSE_REQUEST
, "STREAM_CLOSE_REQUEST" },
201 { SIMULCRYPT_ECMG_STREAM_CLOSE_RESPONSE
, "STREAM_CLOSE_RESPONSE" },
202 { SIMULCRYPT_ECMG_STREAM_ERROR
, "STREAM_ERROR" },
204 { SIMULCRYPT_EMMG_STREAM_SETUP
, "STREAM_SETUP" },
205 { SIMULCRYPT_EMMG_STREAM_TEST
, "STREAM_TEST" },
206 { SIMULCRYPT_EMMG_STREAM_STATUS
, "STREAM_STATUS" },
207 { SIMULCRYPT_EMMG_STREAM_CLOSE_REQUEST
, "STREAM_CLOSE_REQUEST" },
208 { SIMULCRYPT_EMMG_STREAM_CLOSE_RESPONSE
, "STREAM_CLOSE_RESPONSE" },
209 { SIMULCRYPT_EMMG_STREAM_ERROR
, "STREAM_ERROR" },
210 { SIMULCRYPT_EMMG_STREAM_BW_REQUEST
, "STREAM_BW_REQUEST" },
211 { SIMULCRYPT_EMMG_STREAM_BW_ALLOCATION
, "STREAM_BW_ALLOCATION" },
213 { SIMULCRYPT_ECMG_CW_PROVISION
, "CW_PROVISION" },
214 { SIMULCRYPT_ECMG_ECM_RESPONSE
, "ECM_RESPONSE" },
216 { SIMULCRYPT_EMMG_DATA_PROVISION
, "DATA_PROVISION" },
218 { SIMULCRYPT_EIS_CHANNEL_SET_UP
, "CHANNEL_SET_UP" },
219 { SIMULCRYPT_EIS_CHANNEL_TEST
, "CHANNEL_TEST" },
220 { SIMULCRYPT_EIS_CHANNEL_STATUS
, "CHANNEL_STATUS" },
221 { SIMULCRYPT_EIS_CHANNEL_CLOSE
, "CHANNEL_CLOSE" },
222 { SIMULCRYPT_EIS_CHANNEL_ERROR
, "CHANNEL_ERROR" },
223 { SIMULCRYPT_EIS_CHANNEL_RESET
, "CHANNEL_RESET" },
225 { SIMULCRYPT_EIS_SCG_PROVISION
, "SCG_PROVISION" },
226 { SIMULCRYPT_EIS_SCG_TEST
, "SCG_TEST" },
227 { SIMULCRYPT_EIS_SCG_STATUS
, "SCG_STATUS" },
228 { SIMULCRYPT_EIS_SCG_ERROR
, "SCG_ERROR" },
229 { SIMULCRYPT_EIS_SCG_LIST_REQUEST
, "SCG_LIST_REQUEST" },
230 { SIMULCRYPT_EIS_SCG_LIST_RESPONSE
, "SCG_LIST_RESPONSE" },
233 { SIMULCRYPT_PSIG_CHANNEL_SETUP
, "CHANNEL_SETUP" },
234 { SIMULCRYPT_PSIG_CHANNEL_TEST
, "CHANNEL_TEST" },
235 { SIMULCRYPT_PSIG_CHANNEL_STATUS
, "CHANNEL_STATUS" },
236 { SIMULCRYPT_PSIG_CHANNEL_CLOSE
, "CHANNEL_CLOSE" },
237 { SIMULCRYPT_PSIG_CHANNEL_ERROR
, "CHANNEL_ERROR" },
239 { SIMULCRYPT_PSIG_STREAM_SETUP
, "STREAM_SETUP" },
240 { SIMULCRYPT_PSIG_STREAM_TEST
, "STREAM_TEST" },
241 { SIMULCRYPT_PSIG_STREAM_STATUS
, "STREAM_STATUS" },
242 { SIMULCRYPT_PSIG_STREAM_CLOSE_REQUEST
, "STREAM_CLOSE_REQUEST" },
243 { SIMULCRYPT_PSIG_STREAM_CLOSE_RESPONSE
, "STREAM_CLOSE_RESPONSE" },
244 { SIMULCRYPT_PSIG_STREAM_ERROR
, "STREAM_ERROR" },
246 { SIMULCRYPT_PSIG_CIM_STREAM_SECTION_PROVISION
, "CIM_STREAM_SECTION_PROVISION"},
247 { SIMULCRYPT_PSIG_CIM_CHANNEL_RESET
, "CIM_CHANNEL_RESET"},
252 /* Simulcrypt ECMG Parameter Types */
253 #define SIMULCRYPT_ECMG_DVB_RESERVED 0x0000
254 #define SIMULCRYPT_ECMG_SUPER_CAS_ID 0x0001
255 #define SIMULCRYPT_ECMG_SECTION_TSPKT_FLAG 0x0002
256 #define SIMULCRYPT_ECMG_DELAY_START 0x0003
257 #define SIMULCRYPT_ECMG_DELAY_STOP 0x0004
258 #define SIMULCRYPT_ECMG_TRANSITION_DELAY_START 0x0005
259 #define SIMULCRYPT_ECMG_TRANSITION_DELAY_STOP 0x0006
260 #define SIMULCRYPT_ECMG_ECM_REP_PERIOD 0x0007
261 #define SIMULCRYPT_ECMG_MAX_STREAMS 0x0008
262 #define SIMULCRYPT_ECMG_MIN_CP_DURATION 0x0009
263 #define SIMULCRYPT_ECMG_LEAD_CW 0x000A
264 #define SIMULCRYPT_ECMG_CW_PER_MESSAGE 0x000B
265 #define SIMULCRYPT_ECMG_MAX_COMP_TIME 0x000C
266 #define SIMULCRYPT_ECMG_ACCESS_CRITERIA 0x000D
267 #define SIMULCRYPT_ECMG_ECM_CHANNEL_ID 0x000E
268 #define SIMULCRYPT_ECMG_ECM_STREAM_ID 0x000F
269 #define SIMULCRYPT_ECMG_NOMINAL_CP_DURATION 0x0010
270 #define SIMULCRYPT_ECMG_ACCESS_CRITERIA_TRANSFER_MODE 0x0011
271 #define SIMULCRYPT_ECMG_CP_NUMBER 0x0012
272 #define SIMULCRYPT_ECMG_CP_DURATION 0x0013
273 #define SIMULCRYPT_ECMG_CP_CW_COMBINATION 0x0014
274 #define SIMULCRYPT_ECMG_ECM_DATAGRAM 0x0015
275 #define SIMULCRYPT_ECMG_AC_DELAY_START 0x0016
276 #define SIMULCRYPT_ECMG_AC_DELAY_STOP 0x0017
277 #define SIMULCRYPT_ECMG_CW_ENCRYPTION 0x0018
278 #define SIMULCRYPT_ECMG_ECM_ID 0x0019
279 #define SIMULCRYPT_ECMG_ERROR_STATUS 0x7000
280 #define SIMULCRYPT_ECMG_ERROR_INFORMATION 0x7001
282 static const value_string ecmg_parametertypenames
[] = {
283 { SIMULCRYPT_ECMG_DVB_RESERVED
, "DVB_RESERVED" },
284 { SIMULCRYPT_ECMG_SUPER_CAS_ID
, "SUPER_CAS_ID" },
285 { SIMULCRYPT_ECMG_SECTION_TSPKT_FLAG
, "SECTION_TSPKT_FLAG" },
286 { SIMULCRYPT_ECMG_DELAY_START
, "DELAY_START" },
287 { SIMULCRYPT_ECMG_DELAY_STOP
, "DELAY_STOP" },
288 { SIMULCRYPT_ECMG_TRANSITION_DELAY_START
, "TRANSITION_DELAY_START" },
289 { SIMULCRYPT_ECMG_TRANSITION_DELAY_STOP
, "TRANSITION_DELAY_STOP" },
290 { SIMULCRYPT_ECMG_ECM_REP_PERIOD
, "ECM_REP_PERIOD" },
291 { SIMULCRYPT_ECMG_MAX_STREAMS
, "MAX_STREAMS" },
292 { SIMULCRYPT_ECMG_MIN_CP_DURATION
, "MIN_CP_DURATION" },
293 { SIMULCRYPT_ECMG_LEAD_CW
, "LEAD_CW" },
294 { SIMULCRYPT_ECMG_CW_PER_MESSAGE
, "CW_PER_MESSAGE" },
295 { SIMULCRYPT_ECMG_MAX_COMP_TIME
, "MAX_COMP_TIME" },
296 { SIMULCRYPT_ECMG_ACCESS_CRITERIA
, "ACCESS_CRITERIA" },
297 { SIMULCRYPT_ECMG_ECM_CHANNEL_ID
, "ECM_CHANNEL_ID" },
298 { SIMULCRYPT_ECMG_ECM_STREAM_ID
, "ECM_STREAM_ID" },
299 { SIMULCRYPT_ECMG_NOMINAL_CP_DURATION
, "NOMINAL_CP_DURATION" },
300 { SIMULCRYPT_ECMG_ACCESS_CRITERIA_TRANSFER_MODE
, "ACCESS_CRITERIA_TRANSFER_MODE" },
301 { SIMULCRYPT_ECMG_CP_NUMBER
, "CP_NUMBER" },
302 { SIMULCRYPT_ECMG_CP_DURATION
, "CP_DURATION" },
303 { SIMULCRYPT_ECMG_CP_CW_COMBINATION
, "CP_CW_COMBINATION" },
304 { SIMULCRYPT_ECMG_ECM_DATAGRAM
, "ECM_DATAGRAM" },
305 { SIMULCRYPT_ECMG_AC_DELAY_START
, "AC_DELAY_START" },
306 { SIMULCRYPT_ECMG_AC_DELAY_STOP
, "AC_DELAY_STOP" },
307 { SIMULCRYPT_ECMG_CW_ENCRYPTION
, "CW_ENCRYPTION" },
308 { SIMULCRYPT_ECMG_ECM_ID
, "ECM_ID" },
309 { SIMULCRYPT_ECMG_ERROR_STATUS
, "ERROR_STATUS" },
310 { SIMULCRYPT_ECMG_ERROR_INFORMATION
, "ERROR_INFORMATION" },
314 /* Simulcrypt ECMG protocol error values */
315 static const value_string ecmg_error_values
[] = {
316 { 0x0000, "DVB Reserved" },
317 { 0x0001, "Invalid message" },
318 { 0x0002, "Unsupported protocol version" },
319 { 0x0003, "Unknown message type value" },
320 { 0x0004, "Message too long" },
321 { 0x0005, "Unknown super CAS ID value" },
322 { 0x0006, "Unknown ECM channel ID value" },
323 { 0x0007, "Unknown ECM stream ID value" },
324 { 0x0008, "Too many channels on this ECMG" },
325 { 0x0009, "Too many ECM streams on this channel" },
326 { 0x000A, "Too many ECM streams on this ECMG" },
327 { 0x000B, "Not enough control words to compute ECM" },
328 { 0x000C, "ECMG out of storage capacity" },
329 { 0x000D, "ECMG out of computational resources" },
330 { 0x000E, "Unknown parameter type value" },
331 { 0x000F, "Inconsistent length for DVB parameter" },
332 { 0x0010, "Missing mandatory DVB parameter" },
333 { 0x0011, "Invalid value for DVB parameter" },
334 { 0x0012, "Unknown ECM ID value" },
335 { 0x0013, "ECM channel ID value already in use" },
336 { 0x0014, "ECM stream ID value already in use" },
337 { 0x0015, "ECM ID value already in use" },
338 { 0x7000, "Unknown error" },
339 { 0x7001, "Unrecoverable error" },
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" },
371 /* Simulcrypt EMMG protocol error values */
372 static const value_string emmg_error_values
[] = {
373 { 0x0000, "DVB Reserved" },
374 { 0x0001, "Invalid message" },
375 { 0x0002, "Unsupported protocol version" },
376 { 0x0003, "Unknown message type value" },
377 { 0x0004, "Message too long" },
378 { 0x0005, "Unknown data stream ID value" },
379 { 0x0006, "Unknown data channel ID value" },
380 { 0x0007, "Too many channels on this MUX" },
381 { 0x0008, "Too many data streams on this channel" },
382 { 0x0009, "Too many data streams on this MUX" },
383 { 0x000A, "Unknown parameter type" },
384 { 0x000B, "Inconsistent length for DVB parameter" },
385 { 0x000C, "Missing mandatory DVB parameter" },
386 { 0x000D, "Invalid value for DVB parameter" },
387 { 0x000E, "Unknown client ID value" },
388 { 0x000F, "Exceeded bandwidth" },
389 { 0x0010, "Unknown data ID value" },
390 { 0x0011, "Data channel ID value already in use" },
391 { 0x0012, "Data stream ID value already in use" },
392 { 0x0013, "Data ID value already in use" },
393 { 0x0014, "Client ID value already in use" },
394 { 0x7000, "Unknown error" },
395 { 0x7001, "Unrecoverable error" },
399 /* Simulcrypt EIS Parameter Types */
400 #define SIMULCRYPT_EIS_DVB_RESERVED 0x0000
401 #define SIMULCRYPT_EIS_CHANNEL_ID 0x0001
402 #define SIMULCRYPT_EIS_SERVICE_FLAG 0x0002
403 #define SIMULCRYPT_EIS_COMPONENT_FLAG 0x0003
404 #define SIMULCRYPT_EIS_MAX_SCG 0x0004
405 #define SIMULCRYPT_EIS_ECM_GROUP 0x0005
406 #define SIMULCRYPT_EIS_SCG_ID 0x0006
407 #define SIMULCRYPT_EIS_SCG_REFERENCE_ID 0x0007
408 #define SIMULCRYPT_EIS_SUPER_CAS_ID 0x0008
409 #define SIMULCRYPT_EIS_ECM_ID 0x0009
410 #define SIMULCRYPT_EIS_ACCESS_CRITERIA 0x000A
411 #define SIMULCRYPT_EIS_ACTIVATION_TIME 0x000B
412 #define SIMULCRYPT_EIS_ACTIVATION_PENDING_FLAG 0x000C
413 #define SIMULCRYPT_EIS_COMPONENT_ID 0x000D
414 #define SIMULCRYPT_EIS_SERVICE_ID 0x000E
415 #define SIMULCRYPT_EIS_TRANSPORT_STREAM_ID 0x000F
416 #define SIMULCRYPT_EIS_AC_CHANGED_FLAG 0x0010
417 #define SIMULCRYPT_EIS_SCG_CURRENT_REFERENCE_ID 0x0011
418 #define SIMULCRYPT_EIS_SCG_PENDING_REFERENCE_ID 0x0012
419 #define SIMULCRYPT_EIS_CP_DURATION_FLAG 0x0013
420 #define SIMULCRYPT_EIS_RECOMMENDED_CP_DURATION 0x0014
421 #define SIMULCRYPT_EIS_SCG_NOMINAL_CP_DURATION 0x0015
422 #define SIMULCRYPT_EIS_ORIGINAL_NETWORK_ID 0x0016
424 #define SIMULCRYPT_EIS_ERROR_STATUS 0x7000
425 #define SIMULCRYPT_EIS_ERROR_INFORMATION 0x7001
426 #define SIMULCRYPT_EIS_ERROR_DESCRIPTION 0x7002
428 static const value_string eis_parametertypenames
[] = {
429 { SIMULCRYPT_EIS_DVB_RESERVED
, "DVB_RESERVED" },
430 { SIMULCRYPT_EIS_CHANNEL_ID
, "EIS_CHANNEL_ID" },
431 { SIMULCRYPT_EIS_SERVICE_FLAG
, "SERVICE_FLAG" },
432 { SIMULCRYPT_EIS_COMPONENT_FLAG
, "COMPONENT_FLAG" },
433 { SIMULCRYPT_EIS_MAX_SCG
, "MAX_SCG" },
434 { SIMULCRYPT_EIS_ECM_GROUP
, "ECM_GROUP" },
435 { SIMULCRYPT_EIS_SCG_ID
, "SCG_ID" },
436 { SIMULCRYPT_EIS_SCG_REFERENCE_ID
, "SCG_REFERENCE_ID" },
437 { SIMULCRYPT_EIS_SUPER_CAS_ID
, "SUPER_CAS_ID" },
438 { SIMULCRYPT_EIS_ECM_ID
, "ECM_ID" },
439 { SIMULCRYPT_EIS_ACCESS_CRITERIA
, "ACCESS_CRITERIA" },
440 { SIMULCRYPT_EIS_ACTIVATION_TIME
, "ACTIVATION_TIME" },
441 { SIMULCRYPT_EIS_ACTIVATION_PENDING_FLAG
, "ACTIVATION_PENDING_FLAG" },
442 { SIMULCRYPT_EIS_COMPONENT_ID
, "COMPONENT_ID" },
443 { SIMULCRYPT_EIS_SERVICE_ID
, "SERVICE_ID" },
444 { SIMULCRYPT_EIS_TRANSPORT_STREAM_ID
, "TRANSPORT_STREAM_ID" },
445 { SIMULCRYPT_EIS_AC_CHANGED_FLAG
, "AC_CHANGED_FLAG" },
446 { SIMULCRYPT_EIS_SCG_CURRENT_REFERENCE_ID
, "SCG_CURRENT_REFERENCE_ID" },
447 { SIMULCRYPT_EIS_SCG_PENDING_REFERENCE_ID
, "SCG_PENDING_REFERENCE_ID" },
448 { SIMULCRYPT_EIS_CP_DURATION_FLAG
, "CP_DURATION_FLAG" },
449 { SIMULCRYPT_EIS_RECOMMENDED_CP_DURATION
, "RECOMMENDED_CP_DURATION" },
450 { SIMULCRYPT_EIS_SCG_NOMINAL_CP_DURATION
, "SCG_NOMINAL_CP_DURATION" },
451 { SIMULCRYPT_EIS_ORIGINAL_NETWORK_ID
, "ORIGINAL_NETWORK_ID" },
453 { SIMULCRYPT_EIS_ERROR_STATUS
, "ERROR_STATUS" },
454 { SIMULCRYPT_EIS_ERROR_INFORMATION
, "ERROR_INFORMATION" },
455 { SIMULCRYPT_EIS_ERROR_DESCRIPTION
, "ERROR_DESCRIPTION" },
460 /* Simulcrypt EIS protocol error values */
461 static const value_string eis_error_values
[] = {
462 { 0x0000, "DVB Reserved" },
463 { 0x0001, "Invalid message" },
464 { 0x0002, "Unsupported protocol version" },
465 { 0x0003, "Unknown message_type value" },
466 { 0x0004, "Message too long" },
467 { 0x0005, "Inconsistent length for parameter" },
468 { 0x0006, "Missing mandatory parameter" },
469 { 0x0007, "Invalid value for parameter" },
470 { 0x0008, "Unknown EIS_channel_ID value" },
471 { 0x0009, "Unknown SCG_ID value" },
472 { 0x000A, "Max SCGs already defined" },
473 { 0x000B, "Service level SCG definitions not supportend" },
474 { 0x000C, "Elementary Stream level SCG definitions not supported" },
475 { 0x000D, "Activation_time possibly too soon for SCS to be accurate" },
476 { 0x000E, "SCG definition cannot span transport boundaries" },
477 { 0x000F, "A resource does not exist on this SCG" },
478 { 0x0010, "A resource is already defined in an existing SCG" },
479 { 0x0011, "SCG may not contain one or more content entries and no ECM_Group entries" },
480 { 0x0012, "SCG may not contain one or more ECM_Group entries and no content entries" },
481 { 0x0013, "EIS_channel_ID value already in use" },
482 { 0x0014, "Unknown Super_CAS_Id" },
484 { 0x7000, "Unknown error" },
485 { 0x7001, "Unrecoverable error" },
490 /* Simulcrypt PSIG Parameter Types */
491 #define SIMULCRYPT_PSIG_DVB_RESERVED 0x0000
492 #define SIMULCRYPT_PSIG_PSIG_TYPE 0x0001
493 #define SIMULCRYPT_PSIG_CHANNEL_ID 0x0002
494 #define SIMULCRYPT_PSIG_STREAM_ID 0x0003
495 #define SIMULCRYPT_PSIG_TRANSPORT_STREAM_ID 0x0004
496 #define SIMULCRYPT_PSIG_ORIGINAL_NETWORK_ID 0x0005
497 #define SIMULCRYPT_PSIG_PACKET_ID 0x0006
498 #define SIMULCRYPT_PSIG_INTERFACE_MODE_CONFIGURATION 0x0007
499 #define SIMULCRYPT_PSIG_MAX_STREAM 0x0008
500 #define SIMULCRYPT_PSIG_TABLE_PERIOD_PAIR 0x0009
501 #define SIMULCRYPT_PSIG_MPEG_SECTION 0x000A
502 #define SIMULCRYPT_PSIG_REPETITION_RATE 0x000B
503 #define SIMULCRYPT_PSIG_ACTIVATION_TIME 0x000C
504 #define SIMULCRYPT_PSIG_DATAGRAM 0x000D
505 #define SIMULCRYPT_PSIG_BANDWIDTH 0x000E
506 #define SIMULCRYPT_PSIG_INITIAL_BANDWIDTH 0x000F
507 #define SIMULCRYPT_PSIG_MAX_COMP_TIME 0x0010
508 #define SIMULCRYPT_PSIG_ASI_INPUT_PACKET_ID 0x0011
510 #define SIMULCRYPT_PSIG_ERROR_STATUS 0x7000
511 #define SIMULCRYPT_PSIG_ERROR_INFORMATION 0x7001
513 static const value_string psig_parametertypenames
[] = {
514 { SIMULCRYPT_PSIG_DVB_RESERVED
, "DVB_RESERVED" },
515 { SIMULCRYPT_PSIG_PSIG_TYPE
, "PSIG_TYPE" },
516 { SIMULCRYPT_PSIG_CHANNEL_ID
, "PSIG_CHANNEL_ID" },
517 { SIMULCRYPT_PSIG_STREAM_ID
, "STREAM_ID" },
518 { SIMULCRYPT_PSIG_TRANSPORT_STREAM_ID
, "TRANSPORT_STREAM_ID" },
519 { SIMULCRYPT_PSIG_ORIGINAL_NETWORK_ID
, "ORIGINAL_NETWORK_ID" },
520 { SIMULCRYPT_PSIG_PACKET_ID
, "PACKET_ID" },
521 { SIMULCRYPT_PSIG_INTERFACE_MODE_CONFIGURATION
, "INTERFACE_MODE_CONFIGURATION" },
522 { SIMULCRYPT_PSIG_MAX_STREAM
, "MAX_STREAM" },
523 { SIMULCRYPT_PSIG_TABLE_PERIOD_PAIR
, "TABLE_PERIOD_PAIR" },
524 { SIMULCRYPT_PSIG_MPEG_SECTION
, "MPEG_SECTION" },
525 { SIMULCRYPT_PSIG_REPETITION_RATE
, "REPETITION_RATE" },
526 { SIMULCRYPT_PSIG_ACTIVATION_TIME
, "ACTIVATION_TIME" },
527 { SIMULCRYPT_PSIG_DATAGRAM
, "DATAGRAM" },
528 { SIMULCRYPT_PSIG_BANDWIDTH
, "BANDWIDTH" },
529 { SIMULCRYPT_PSIG_INITIAL_BANDWIDTH
, "INITIAL_BANDWIDTH" },
530 { SIMULCRYPT_PSIG_MAX_COMP_TIME
, "MAX_COMP_TIME" },
531 { SIMULCRYPT_PSIG_ASI_INPUT_PACKET_ID
, "ASI_INPUT_PACKET_ID" },
533 { SIMULCRYPT_PSIG_ERROR_STATUS
, "ERROR_STATUS" },
534 { SIMULCRYPT_PSIG_ERROR_INFORMATION
, "ERROR_INFORMATION" },
540 /* Simulcrypt PSIG protocol error values */
541 static const value_string psig_error_values
[] = {
542 { 0x0000, "DVB Reserved" },
543 { 0x0001, "Invalid message" },
544 { 0x0002, "Unsupported protocol version" },
545 { 0x0003, "Unknown message_type value" },
546 { 0x0004, "Message too long" },
547 { 0x0005, "Unknown stream_ID value" },
548 { 0x0006, "Unknown channel_ID value" },
549 { 0x0007, "Too many channels on this MUX" },
550 { 0x0008, "Too many data streams on this channel" },
551 { 0x0009, "Too many data streams on this MUX" },
552 { 0x000A, "Unknown parameter_type" },
553 { 0x000B, "Inconsistent length for parameter" },
554 { 0x000C, "Missing mandatory parameter" },
555 { 0x000D, "Invalid value for parameter" },
556 { 0x000E, "Inconsistent value of transport_stream_ID" },
557 { 0x000F, "Inconsistent value of packet_ID" },
558 { 0x0010, "channel_ID value already in use" },
559 { 0x0011, "stream_ID value already in use" },
560 { 0x0012, "Stream already open for this pair (transport_stream_ID, packet_ID)" },
561 { 0x0013, "Overflow error when receiving the list of MPEG (CiM error type)" },
562 { 0x0014, "Inconsistent format of TOT template (CiM error type)" },
563 { 0x0015, "Warning: Difficulties in respecting the requested repetition_rates for the last 5 minutes (CiM error type)" },
564 { 0x0016, "Warning: Difficulties in respecting the requested Bandwidth for the last 5 minutes (CiM error type)" },
566 { 0x7000, "Unknown error" },
567 { 0x7001, "Unrecoverable error" },
573 /* The following hf_* variables are used to hold the Wireshark IDs of
574 * our header fields; they are filled out when we call
575 * proto_register_field_array() in proto_register_simulcrypt()
577 static gint hf_simulcrypt_header
= -1;
578 static gint hf_simulcrypt_version
= -1;
579 static gint hf_simulcrypt_message_type
= -1;
580 static gint hf_simulcrypt_interface
= -1;
581 static gint hf_simulcrypt_message_length
= -1;
582 static gint hf_simulcrypt_message
= -1;
583 static gint hf_simulcrypt_parameter
= -1;
584 static gint hf_simulcrypt_parameter_type
= -1;
585 static gint hf_simulcrypt_ecmg_parameter_type
= -1;
586 static gint hf_simulcrypt_emmg_parameter_type
= -1;
587 static gint hf_simulcrypt_parameter_length
= -1;
588 static gint hf_simulcrypt_ca_system_id
= -1;
589 static gint hf_simulcrypt_ca_subsystem_id
= -1;
590 static gint hf_simulcrypt_super_cas_id
= -1;
591 static gint hf_simulcrypt_section_tspkt_flag
= -1;
592 static gint hf_simulcrypt_ecm_channel_id
= -1;
593 static gint hf_simulcrypt_delay_start
= -1;
594 static gint hf_simulcrypt_delay_stop
= -1;
595 static gint hf_simulcrypt_ac_delay_start
= -1;
596 static gint hf_simulcrypt_ac_delay_stop
= -1;
597 static gint hf_simulcrypt_transition_delay_start
= -1;
598 static gint hf_simulcrypt_transition_delay_stop
= -1;
599 static gint hf_simulcrypt_ecm_rep_period
= -1;
600 static gint hf_simulcrypt_max_streams
= -1;
601 static gint hf_simulcrypt_min_cp_duration
= -1;
602 static gint hf_simulcrypt_lead_cw
= -1;
603 static gint hf_simulcrypt_cw_per_msg
= -1;
604 static gint hf_simulcrypt_max_comp_time
= -1;
605 static gint hf_simulcrypt_access_criteria
= -1;
606 static gint hf_simulcrypt_ecm_stream_id
= -1;
607 static gint hf_simulcrypt_nominal_cp_duration
= -1;
608 static gint hf_simulcrypt_access_criteria_transfer_mode
= -1;
609 static gint hf_simulcrypt_cp_number
= -1;
610 static gint hf_simulcrypt_cp_duration
= -1;
611 static gint hf_simulcrypt_cp_cw_combination
= -1;
612 static gint hf_simulcrypt_ecm_datagram
= -1;
613 static gint hf_simulcrypt_cw_encryption
= -1;
614 static gint hf_simulcrypt_ecm_id
= -1;
615 static gint hf_simulcrypt_client_id
= -1;
616 static gint hf_simulcrypt_data_channel_id
= -1;
617 static gint hf_simulcrypt_data_stream_id
= -1;
618 static gint hf_simulcrypt_datagram
= -1;
619 static gint hf_simulcrypt_bandwidth
= -1;
620 static gint hf_simulcrypt_data_type
= -1;
621 static gint hf_simulcrypt_data_id
= -1;
622 static gint hf_simulcrypt_ecmg_error_status
= -1;
623 static gint hf_simulcrypt_emmg_error_status
= -1;
624 static gint hf_simulcrypt_error_information
= -1;
626 static gint hf_simulcrypt_eis_parameter_type
= -1;
627 static gint hf_simulcrypt_eis_channel_id
= -1;
628 static gint hf_simulcrypt_service_flag
= -1;
629 static gint hf_simulcrypt_component_flag
= -1;
630 static gint hf_simulcrypt_max_scg
= -1;
631 static gint hf_simulcrypt_ecm_group
= -1;
632 static gint hf_simulcrypt_scg_id
= -1;
633 static gint hf_simulcrypt_scg_reference_id
= -1;
634 static gint hf_simulcrypt_activation_time
= -1;
635 static gint hf_simulcrypt_year
= -1;
636 static gint hf_simulcrypt_month
= -1;
637 static gint hf_simulcrypt_day
= -1;
638 static gint hf_simulcrypt_hour
= -1;
639 static gint hf_simulcrypt_minute
= -1;
640 static gint hf_simulcrypt_second
= -1;
641 static gint hf_simulcrypt_hundredth_second
= -1;
642 static gint hf_simulcrypt_activation_pending_flag
= -1;
643 static gint hf_simulcrypt_component_id
= -1;
644 static gint hf_simulcrypt_service_id
= -1;
645 static gint hf_simulcrypt_transport_stream_id
= -1;
646 static gint hf_simulcrypt_ac_changed_flag
= -1;
647 static gint hf_simulcrypt_scg_current_reference_id
= -1;
648 static gint hf_simulcrypt_scg_pending_reference_id
= -1;
649 static gint hf_simulcrypt_cp_duration_flag
= -1;
650 static gint hf_simulcrypt_recommended_cp_duration
= -1;
651 static gint hf_simulcrypt_scg_nominal_cp_duration
= -1;
652 static gint hf_simulcrypt_original_network_id
= -1;
653 static gint hf_simulcrypt_eis_error_status
= -1;
654 static gint hf_simulcrypt_error_description
= -1;
656 static gint hf_simulcrypt_psig_parameter_type
= -1;
657 static gint hf_simulcrypt_psig_type
= -1;
658 static gint hf_simulcrypt_channel_id
= -1;
659 static gint hf_simulcrypt_stream_id
= -1;
660 static gint hf_simulcrypt_packet_id
= -1;
661 static gint hf_simulcrypt_interface_mode_configuration
= -1;
662 static gint hf_simulcrypt_max_stream
= -1;
663 static gint hf_simulcrypt_table_period_pair
= -1;
664 static gint hf_simulcrypt_mpeg_section
= -1;
665 static gint hf_simulcrypt_repetition_rate
= -1;
666 static gint hf_simulcrypt_initial_bandwidth
= -1;
667 static gint hf_simulcrypt_asi_input_packet_id
= -1;
668 static gint hf_simulcrypt_psig_error_status
= -1;
670 /* These are the ids of the subtrees that we may be creating */
671 static gint ett_simulcrypt
= -1;
672 static gint ett_simulcrypt_header
= -1;
673 static gint ett_simulcrypt_message
= -1;
674 static gint ett_simulcrypt_parameter
= -1;
675 static gint ett_simulcrypt_super_cas_id
= -1;
676 static gint ett_simulcrypt_ecm_datagram
= -1;
677 static gint ett_simulcrypt_ecm_group
= -1;
678 static gint ett_simulcrypt_activation_time
= -1;
679 static gint ett_simulcrypt_table_period_pair
= -1;
682 #define FRAME_HEADER_LEN 8
684 /* The main dissecting routine */
686 dissect_simulcrypt(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data
)
688 tcp_dissect_pdus(tvb
, pinfo
, tree
, TRUE
, FRAME_HEADER_LEN
,
689 get_simulcrypt_message_len
, dissect_simulcrypt_message
, data
);
690 return tvb_length(tvb
);
693 /* Informative tree structure is shown here:
700 * - TYPE of parameter
701 * length of parameter
703 - PARAMETER (optional branch for certain parameters only)
704 * parameter value sub items here
705 * End informative tree structure
709 get_interface (guint16 type
)
713 if (type
>= 0x8000) {
714 return SIMULCRYPT_USER_DEFINED
;
717 /* Hex values fetched from Table 3: Message-type values for command/response-based protocols */
718 switch (type
& 0xFFF0) {
722 interface
= SIMULCRYPT_ECMG_SCS
;
727 interface
= SIMULCRYPT_EMMG_MUX
;
731 interface
= SIMULCRYPT_CPSIG_PSIG
;
734 interface
= SIMULCRYPT_EIS_SCS
;
738 interface
= SIMULCRYPT_PSIG_MUX
;
741 interface
= SIMULCRYPT_MUX_CIM
;
744 interface
= SIMULCRYPT_PSIG_CIP
;
747 interface
= SIMULCRYPT_RESERVED
;
755 dissect_ecmg_parameter_value (proto_tree
*tree
, tvbuff_t
*tvb
, packet_info
*pinfo
, guint32 offset
,
756 guint16 plen
, guint16 ptype
, gchar
*pvalue_char
)
758 proto_item
*simulcrypt_item
;
759 proto_tree
*simulcrypt_super_cas_id_tree
;
760 proto_tree
*simulcrypt_ecm_datagram_tree
;
762 guint32 pvaluedec
; /* parameter decimal value */
767 case SIMULCRYPT_ECMG_SUPER_CAS_ID
:
768 /* add super_cas_id item */
769 simulcrypt_item
= proto_tree_add_item(tree
, hf_simulcrypt_super_cas_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
); /* value item */
770 simulcrypt_super_cas_id_tree
= proto_item_add_subtree(simulcrypt_item
, ett_simulcrypt_super_cas_id
);
772 /* Simulcrypt_super_cas_id_tree */
773 simulcrypt_item
= proto_tree_add_item(simulcrypt_super_cas_id_tree
, hf_simulcrypt_ca_system_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
775 /* Test for known CA_System_ID */
776 ca_system_id
= tvb_get_ntohs(tvb
,offset
);
777 for(i
=0;i
<ECM_INTERPRETATION_SIZE
;i
++)
779 if(tab_ecm_inter
[i
].ca_system_id
==ca_system_id
)
781 tab_ecm_inter
[i
].ecmg_port
=pinfo
->destport
;
782 proto_item_append_text(simulcrypt_item
, ", Port %d, Protocol %s",tab_ecm_inter
[i
].ecmg_port
, tab_ecm_inter
[i
].protocol_name
);
786 proto_tree_add_item(simulcrypt_super_cas_id_tree
, hf_simulcrypt_ca_subsystem_id
, tvb
, offset
+2, 2, ENC_BIG_ENDIAN
);
788 case SIMULCRYPT_ECMG_SECTION_TSPKT_FLAG
:
789 proto_tree_add_item(tree
, hf_simulcrypt_section_tspkt_flag
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
); /* value item */
791 case SIMULCRYPT_ECMG_ECM_CHANNEL_ID
:
792 proto_tree_add_item(tree
, hf_simulcrypt_ecm_channel_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
794 case SIMULCRYPT_ECMG_DELAY_START
:
795 simulcrypt_item
= proto_tree_add_item(tree
, hf_simulcrypt_delay_start
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
796 proto_item_append_text(simulcrypt_item
, " ms");
798 case SIMULCRYPT_ECMG_DELAY_STOP
:
799 simulcrypt_item
= proto_tree_add_item(tree
, hf_simulcrypt_delay_stop
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
800 proto_item_append_text(simulcrypt_item
, " ms");
802 case SIMULCRYPT_ECMG_TRANSITION_DELAY_START
:
803 simulcrypt_item
= proto_tree_add_item(tree
, hf_simulcrypt_transition_delay_start
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
804 proto_item_append_text(simulcrypt_item
, " ms");
806 case SIMULCRYPT_ECMG_TRANSITION_DELAY_STOP
:
807 simulcrypt_item
= proto_tree_add_item(tree
, hf_simulcrypt_transition_delay_stop
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
808 proto_item_append_text(simulcrypt_item
, " ms");
810 case SIMULCRYPT_ECMG_AC_DELAY_START
:
811 simulcrypt_item
= proto_tree_add_item(tree
, hf_simulcrypt_ac_delay_start
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
812 proto_item_append_text(simulcrypt_item
, " ms");
814 case SIMULCRYPT_ECMG_AC_DELAY_STOP
:
815 simulcrypt_item
= proto_tree_add_item(tree
, hf_simulcrypt_ac_delay_stop
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
816 proto_item_append_text(simulcrypt_item
, " ms");
818 case SIMULCRYPT_ECMG_ECM_REP_PERIOD
:
819 simulcrypt_item
= proto_tree_add_item(tree
, hf_simulcrypt_ecm_rep_period
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
820 proto_item_append_text(simulcrypt_item
, " ms");
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 simulcrypt_item
= proto_tree_add_item(tree
, hf_simulcrypt_max_comp_time
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
840 proto_item_append_text(simulcrypt_item
, " ms");
842 case SIMULCRYPT_ECMG_ACCESS_CRITERIA
:
843 proto_tree_add_item(tree
, hf_simulcrypt_access_criteria
, tvb
, offset
, plen
, ENC_NA
);
845 case SIMULCRYPT_ECMG_ECM_STREAM_ID
:
846 proto_tree_add_item(tree
, hf_simulcrypt_ecm_stream_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
848 case SIMULCRYPT_ECMG_NOMINAL_CP_DURATION
:
849 /* convert value to ms (in units 100 ms) */
850 pvaluedec
= tvb_get_ntohs(tvb
, offset
); /* read 2 byte nominal CP duration value */
851 pvaluedec
= pvaluedec
*100; /* in ms now */
852 simulcrypt_item
= proto_tree_add_item(tree
, hf_simulcrypt_nominal_cp_duration
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
853 proto_item_append_text(simulcrypt_item
, " (%d ms)", pvaluedec
);
855 case SIMULCRYPT_ECMG_ACCESS_CRITERIA_TRANSFER_MODE
:
856 proto_tree_add_item(tree
, hf_simulcrypt_access_criteria_transfer_mode
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
858 case SIMULCRYPT_ECMG_CP_NUMBER
:
859 proto_tree_add_item(tree
, hf_simulcrypt_cp_number
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
861 case SIMULCRYPT_ECMG_CP_DURATION
:
862 /* convert value to ms (in units 100 ms) */
863 pvaluedec
= tvb_get_ntohs(tvb
, offset
); /* read 2 byte CP duration value */
864 pvaluedec
= pvaluedec
*100; /* in ms now */
865 simulcrypt_item
= proto_tree_add_item(tree
, hf_simulcrypt_cp_duration
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
866 proto_item_append_text(simulcrypt_item
, " (%d ms)", pvaluedec
);
868 case SIMULCRYPT_ECMG_CP_CW_COMBINATION
:
869 proto_tree_add_item(tree
, hf_simulcrypt_cp_cw_combination
, tvb
, offset
, plen
, ENC_NA
);
871 case SIMULCRYPT_ECMG_ECM_DATAGRAM
:
872 simulcrypt_item
= proto_tree_add_item(tree
, hf_simulcrypt_ecm_datagram
, tvb
, offset
, plen
, ENC_NA
);
873 /* Test srcport against table of ECMG ports & CA_System_ID for known protocol types */
874 for(i
=0;i
<ECM_INTERPRETATION_SIZE
;i
++)
876 if(tab_ecm_inter
[i
].ecmg_port
==pinfo
->srcport
) /* ECMG source port */
877 { /* recognise port & ca_system_id and hence protocol name for ECM datagram */
878 next_tvb
= tvb_new_subset_remaining(tvb
, offset
);
879 simulcrypt_ecm_datagram_tree
= proto_item_add_subtree(simulcrypt_item
, ett_simulcrypt_ecm_datagram
);
880 if(tab_ecm_inter
[i
].protocol_handle
!= NULL
)
882 call_dissector(tab_ecm_inter
[i
].protocol_handle
, next_tvb
,pinfo
, simulcrypt_ecm_datagram_tree
);
888 case SIMULCRYPT_ECMG_CW_ENCRYPTION
:
889 proto_tree_add_item(tree
, hf_simulcrypt_cw_encryption
, tvb
, offset
, plen
, ENC_NA
);
891 case SIMULCRYPT_ECMG_ECM_ID
:
892 proto_tree_add_item(tree
, hf_simulcrypt_ecm_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
894 case SIMULCRYPT_ECMG_ERROR_STATUS
:
895 proto_tree_add_item(tree
, hf_simulcrypt_ecmg_error_status
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
897 case SIMULCRYPT_ECMG_ERROR_INFORMATION
:
898 proto_tree_add_item(tree
, hf_simulcrypt_error_information
, tvb
, offset
, plen
, ENC_NA
);
900 default: /* Unknown parameter type */
901 proto_tree_add_text(tree
, tvb
, offset
, plen
, "Parameter Value: %s", pvalue_char
);
903 } /* end parameter type switch */
907 dissect_emmg_parameter_value (proto_tree
*tree
, tvbuff_t
*tvb
, packet_info
*pinfo _U_
, guint32 offset
,
908 guint16 plen
, guint16 ptype
, gchar
*pvalue_char
)
910 proto_item
*simulcrypt_item
;
913 case SIMULCRYPT_EMMG_CLIENT_ID
:
914 proto_tree_add_item(tree
, hf_simulcrypt_client_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
916 case SIMULCRYPT_EMMG_SECTION_TSPKT_FLAG
:
917 proto_tree_add_item(tree
, hf_simulcrypt_section_tspkt_flag
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
919 case SIMULCRYPT_EMMG_DATA_CHANNEL_ID
:
920 proto_tree_add_item(tree
, hf_simulcrypt_data_channel_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
922 case SIMULCRYPT_EMMG_DATA_STREAM_ID
:
923 proto_tree_add_item(tree
, hf_simulcrypt_data_stream_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
925 case SIMULCRYPT_EMMG_DATAGRAM
:
926 proto_tree_add_item(tree
, hf_simulcrypt_datagram
, tvb
, offset
, plen
, ENC_NA
);
928 case SIMULCRYPT_EMMG_BANDWIDTH
:
929 simulcrypt_item
= proto_tree_add_item(tree
, hf_simulcrypt_bandwidth
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
930 proto_item_append_text(simulcrypt_item
, " kbit/s");
932 case SIMULCRYPT_EMMG_DATA_TYPE
:
933 proto_tree_add_item(tree
, hf_simulcrypt_data_type
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
935 case SIMULCRYPT_EMMG_DATA_ID
:
936 proto_tree_add_item(tree
, hf_simulcrypt_data_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
938 case SIMULCRYPT_EMMG_ERROR_STATUS
:
939 proto_tree_add_item(tree
, hf_simulcrypt_emmg_error_status
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
941 case SIMULCRYPT_EMMG_ERROR_INFORMATION
:
942 proto_tree_add_item(tree
, hf_simulcrypt_error_information
, tvb
, offset
, plen
, ENC_NA
);
944 default: /* Unknown parameter type */
945 proto_tree_add_text(tree
, tvb
, offset
, plen
, "Parameter Value: %s", pvalue_char
);
947 } /* end parameter type switch */
952 dissect_eis_parameter_value (proto_tree
*tree
, tvbuff_t
*tvb
, packet_info
*pinfo _U_
, guint32 offset
,
953 guint16 plen
, guint16 ptype
, gchar
*pvalue_char
)
955 proto_item
*simulcrypt_item
;
956 proto_tree
*simulcrypt_super_cas_id_tree
;
957 proto_tree
*simulcrypt_ecm_group_tree
;
958 proto_tree
*simulcrypt_activation_time_tree
;
959 guint32 pvaluedec
; /* parameter decimal value */
964 case SIMULCRYPT_EIS_CHANNEL_ID
:
965 proto_tree_add_item(tree
, hf_simulcrypt_eis_channel_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
967 case SIMULCRYPT_EIS_SERVICE_FLAG
:
968 proto_tree_add_item(tree
, hf_simulcrypt_service_flag
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
970 case SIMULCRYPT_EIS_COMPONENT_FLAG
:
971 proto_tree_add_item(tree
, hf_simulcrypt_component_flag
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
973 case SIMULCRYPT_EIS_MAX_SCG
:
974 proto_tree_add_item(tree
, hf_simulcrypt_max_scg
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
976 case SIMULCRYPT_EIS_ECM_GROUP
:
977 /* add ECM_Group item */
978 simulcrypt_item
= proto_tree_add_item(tree
, hf_simulcrypt_ecm_group
, tvb
, offset
, plen
, ENC_NA
); /* value item */
981 simulcrypt_ecm_group_tree
= proto_item_add_subtree(simulcrypt_item
, ett_simulcrypt_ecm_group
);
983 /* dissect subtree */
984 dissect_simulcrypt_data(simulcrypt_ecm_group_tree
, simulcrypt_item
, pinfo
, tvb
, tree
, offset
, plen
, SIMULCRYPT_EIS_SCS
, TRUE
);
986 case SIMULCRYPT_EIS_SCG_ID
:
987 proto_tree_add_item(tree
, hf_simulcrypt_scg_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
989 case SIMULCRYPT_EIS_SCG_REFERENCE_ID
:
990 proto_tree_add_item(tree
, hf_simulcrypt_scg_reference_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
992 case SIMULCRYPT_EIS_SUPER_CAS_ID
:
993 /* add super_cas_id item */
994 simulcrypt_item
= proto_tree_add_item(tree
, hf_simulcrypt_super_cas_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
); /* value item */
995 simulcrypt_super_cas_id_tree
= proto_item_add_subtree(simulcrypt_item
, ett_simulcrypt_super_cas_id
);
997 /* Simulcrypt_super_cas_id_tree */
998 simulcrypt_item
= proto_tree_add_item(simulcrypt_super_cas_id_tree
, hf_simulcrypt_ca_system_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1000 /* Test for known CA_System_ID */
1001 ca_system_id
= tvb_get_ntohs(tvb
,offset
);
1002 for(i
=0;i
<ECM_INTERPRETATION_SIZE
;i
++)
1004 if(tab_ecm_inter
[i
].ca_system_id
==ca_system_id
)
1006 tab_ecm_inter
[i
].ecmg_port
=pinfo
->destport
;
1007 proto_item_append_text(simulcrypt_item
, ", Port %d, Protocol %s",tab_ecm_inter
[i
].ecmg_port
, tab_ecm_inter
[i
].protocol_name
);
1011 proto_tree_add_item(simulcrypt_super_cas_id_tree
, hf_simulcrypt_ca_subsystem_id
, tvb
, offset
+2, 2, ENC_BIG_ENDIAN
);
1013 case SIMULCRYPT_EIS_ECM_ID
:
1014 proto_tree_add_item(tree
, hf_simulcrypt_ecm_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1016 case SIMULCRYPT_EIS_ACCESS_CRITERIA
:
1017 proto_tree_add_item(tree
, hf_simulcrypt_access_criteria
, tvb
, offset
, plen
, ENC_NA
);
1019 case SIMULCRYPT_EIS_ACTIVATION_TIME
:
1020 simulcrypt_item
= proto_tree_add_item(tree
, hf_simulcrypt_activation_time
, tvb
, offset
, plen
, ENC_NA
); /* value item */
1022 /* create subtree */
1023 simulcrypt_activation_time_tree
= proto_item_add_subtree(simulcrypt_item
, ett_simulcrypt_activation_time
);
1025 /* dissect subtree */
1026 proto_tree_add_item(simulcrypt_activation_time_tree
, hf_simulcrypt_year
, tvb
, offset
, 2, ENC_BIG_ENDIAN
); /* first 2 bytes */
1027 proto_tree_add_item(simulcrypt_activation_time_tree
, hf_simulcrypt_month
, tvb
, offset
+2, 1, ENC_BIG_ENDIAN
); /* third byte */
1028 proto_tree_add_item(simulcrypt_activation_time_tree
, hf_simulcrypt_day
, tvb
, offset
+3, 1, ENC_BIG_ENDIAN
); /*fourth byte */
1029 proto_tree_add_item(simulcrypt_activation_time_tree
, hf_simulcrypt_hour
, tvb
, offset
+4, 1, ENC_BIG_ENDIAN
); /*fifth byte */
1030 proto_tree_add_item(simulcrypt_activation_time_tree
, hf_simulcrypt_minute
, tvb
, offset
+5, 1, ENC_BIG_ENDIAN
); /* sixth byte */
1031 proto_tree_add_item(simulcrypt_activation_time_tree
, hf_simulcrypt_second
, tvb
, offset
+6, 1, ENC_BIG_ENDIAN
); /* seventh byte */
1032 proto_tree_add_item(simulcrypt_activation_time_tree
, hf_simulcrypt_hundredth_second
, tvb
, offset
+7, 1, ENC_BIG_ENDIAN
); /* eighth byte */
1034 case SIMULCRYPT_EIS_ACTIVATION_PENDING_FLAG
:
1035 proto_tree_add_item(tree
, hf_simulcrypt_activation_pending_flag
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1037 case SIMULCRYPT_EIS_COMPONENT_ID
:
1038 proto_tree_add_item(tree
, hf_simulcrypt_component_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1040 case SIMULCRYPT_EIS_SERVICE_ID
:
1041 proto_tree_add_item(tree
, hf_simulcrypt_service_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1043 case SIMULCRYPT_EIS_TRANSPORT_STREAM_ID
:
1044 proto_tree_add_item(tree
, hf_simulcrypt_transport_stream_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1046 case SIMULCRYPT_EIS_AC_CHANGED_FLAG
:
1047 proto_tree_add_item(tree
, hf_simulcrypt_ac_changed_flag
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1049 case SIMULCRYPT_EIS_SCG_CURRENT_REFERENCE_ID
:
1050 proto_tree_add_item(tree
, hf_simulcrypt_scg_current_reference_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1052 case SIMULCRYPT_EIS_SCG_PENDING_REFERENCE_ID
:
1053 proto_tree_add_item(tree
, hf_simulcrypt_scg_pending_reference_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1055 case SIMULCRYPT_EIS_CP_DURATION_FLAG
:
1056 proto_tree_add_item(tree
, hf_simulcrypt_cp_duration_flag
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1058 case SIMULCRYPT_EIS_RECOMMENDED_CP_DURATION
:
1059 /* convert value to ms (in units 100 ms) */
1060 pvaluedec
= tvb_get_ntohs(tvb
, offset
); /* read 2 byte CP duration value */
1061 pvaluedec
= pvaluedec
*100; /* in ms now */
1062 simulcrypt_item
= proto_tree_add_item(tree
, hf_simulcrypt_recommended_cp_duration
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1063 proto_item_append_text(simulcrypt_item
, " (%d ms)", pvaluedec
);
1065 case SIMULCRYPT_EIS_SCG_NOMINAL_CP_DURATION
:
1066 /* convert value to ms (in units 100 ms) */
1067 pvaluedec
= tvb_get_ntohs(tvb
, offset
); /* read 2 byte CP duration value */
1068 pvaluedec
= pvaluedec
*100; /* in ms now */
1069 simulcrypt_item
= proto_tree_add_item(tree
, hf_simulcrypt_scg_nominal_cp_duration
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1070 proto_item_append_text(simulcrypt_item
, " (%d ms)", pvaluedec
);
1072 case SIMULCRYPT_EIS_ORIGINAL_NETWORK_ID
:
1073 proto_tree_add_item(tree
, hf_simulcrypt_original_network_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1076 case SIMULCRYPT_EIS_ERROR_STATUS
:
1077 proto_tree_add_item(tree
, hf_simulcrypt_eis_error_status
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1079 case SIMULCRYPT_EIS_ERROR_INFORMATION
:
1080 proto_tree_add_item(tree
, hf_simulcrypt_error_information
, tvb
, offset
, plen
, ENC_NA
);
1082 case SIMULCRYPT_EIS_ERROR_DESCRIPTION
:
1083 proto_tree_add_item(tree
, hf_simulcrypt_error_description
, tvb
, offset
, plen
, ENC_ASCII
|ENC_NA
);
1086 default: /* Unknown parameter type */
1087 proto_tree_add_text(tree
, tvb
, offset
, plen
, "Parameter Value: %s", pvalue_char
);
1089 } /* end parameter type switch */
1093 dissect_psig_parameter_value (proto_tree
*tree
, tvbuff_t
*tvb
, packet_info
*pinfo _U_
, guint32 offset
,
1094 guint16 plen
, guint16 ptype
, gchar
*pvalue_char
)
1096 proto_tree
*simulcrypt_psig_table_period_pair_tree
;
1097 proto_tree
*simulcrypt_activation_time_tree
;
1098 proto_item
*simulcrypt_item
;
1099 guint32 pvaluedec
; /* parameter decimal value */
1102 case SIMULCRYPT_PSIG_PSIG_TYPE
:
1103 pvaluedec
= tvb_get_guint8(tvb
, offset
);
1104 simulcrypt_item
= proto_tree_add_item(tree
, hf_simulcrypt_psig_type
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1107 proto_item_append_text(simulcrypt_item
, " (PSIG)");
1110 proto_item_append_text(simulcrypt_item
, " (SIG)");
1113 proto_item_append_text(simulcrypt_item
, " (PSISIG)");
1119 case SIMULCRYPT_PSIG_CHANNEL_ID
:
1120 proto_tree_add_item(tree
, hf_simulcrypt_channel_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1122 case SIMULCRYPT_PSIG_STREAM_ID
:
1123 proto_tree_add_item(tree
, hf_simulcrypt_stream_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1125 case SIMULCRYPT_PSIG_TRANSPORT_STREAM_ID
:
1126 proto_tree_add_item(tree
, hf_simulcrypt_transport_stream_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1128 case SIMULCRYPT_PSIG_ORIGINAL_NETWORK_ID
:
1129 proto_tree_add_item(tree
, hf_simulcrypt_original_network_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1131 case SIMULCRYPT_PSIG_PACKET_ID
:
1132 proto_tree_add_item(tree
, hf_simulcrypt_packet_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1134 case SIMULCRYPT_PSIG_INTERFACE_MODE_CONFIGURATION
:
1135 proto_tree_add_item(tree
, hf_simulcrypt_interface_mode_configuration
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1137 case SIMULCRYPT_PSIG_MAX_STREAM
:
1138 proto_tree_add_item(tree
, hf_simulcrypt_max_stream
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1140 case SIMULCRYPT_PSIG_TABLE_PERIOD_PAIR
:
1141 simulcrypt_item
= proto_tree_add_item(tree
, hf_simulcrypt_table_period_pair
, tvb
, offset
, plen
, ENC_NA
); /* value item */
1143 /* create subtree */
1144 simulcrypt_psig_table_period_pair_tree
= proto_item_add_subtree(simulcrypt_item
, ett_simulcrypt_table_period_pair
);
1146 /* dissect subtree */
1147 dissect_simulcrypt_data(simulcrypt_psig_table_period_pair_tree
, simulcrypt_item
, pinfo
, tvb
, tree
, offset
, plen
, SIMULCRYPT_MUX_CIM
, TRUE
);
1149 case SIMULCRYPT_PSIG_MPEG_SECTION
:
1150 proto_tree_add_item(tree
, hf_simulcrypt_mpeg_section
, tvb
, offset
, plen
, ENC_NA
);
1152 case SIMULCRYPT_PSIG_REPETITION_RATE
:
1153 proto_tree_add_item(tree
, hf_simulcrypt_repetition_rate
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1155 case SIMULCRYPT_PSIG_ACTIVATION_TIME
:
1156 simulcrypt_item
= proto_tree_add_item(tree
, hf_simulcrypt_activation_time
, tvb
, offset
, plen
, ENC_NA
); /* value item */
1158 /* create subtree */
1159 simulcrypt_activation_time_tree
= proto_item_add_subtree(simulcrypt_item
, ett_simulcrypt_activation_time
);
1161 /* dissect subtree */
1162 proto_tree_add_item(simulcrypt_activation_time_tree
, hf_simulcrypt_year
, tvb
, offset
, 2, ENC_BIG_ENDIAN
); /* first 2 bytes */
1163 proto_tree_add_item(simulcrypt_activation_time_tree
, hf_simulcrypt_month
, tvb
, offset
+2, 1, ENC_BIG_ENDIAN
); /* third byte */
1164 proto_tree_add_item(simulcrypt_activation_time_tree
, hf_simulcrypt_day
, tvb
, offset
+3, 1, ENC_BIG_ENDIAN
); /*fourth byte */
1165 proto_tree_add_item(simulcrypt_activation_time_tree
, hf_simulcrypt_hour
, tvb
, offset
+4, 1, ENC_BIG_ENDIAN
); /*fifth byte */
1166 proto_tree_add_item(simulcrypt_activation_time_tree
, hf_simulcrypt_minute
, tvb
, offset
+5, 1, ENC_BIG_ENDIAN
); /* sixth byte */
1167 proto_tree_add_item(simulcrypt_activation_time_tree
, hf_simulcrypt_second
, tvb
, offset
+6, 1, ENC_BIG_ENDIAN
); /* seventh byte */
1168 proto_tree_add_item(simulcrypt_activation_time_tree
, hf_simulcrypt_hundredth_second
, tvb
, offset
+7, 1, ENC_BIG_ENDIAN
); /* eighth byte */
1170 case SIMULCRYPT_PSIG_DATAGRAM
:
1171 proto_tree_add_item(tree
, hf_simulcrypt_datagram
, tvb
, offset
, plen
, ENC_NA
);
1173 case SIMULCRYPT_PSIG_BANDWIDTH
:
1174 simulcrypt_item
= proto_tree_add_item(tree
, hf_simulcrypt_bandwidth
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1175 proto_item_append_text(simulcrypt_item
, " kbit/s");
1177 case SIMULCRYPT_PSIG_INITIAL_BANDWIDTH
:
1178 simulcrypt_item
= proto_tree_add_item(tree
, hf_simulcrypt_initial_bandwidth
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1179 proto_item_append_text(simulcrypt_item
, " kbit/s");
1181 case SIMULCRYPT_PSIG_MAX_COMP_TIME
:
1182 simulcrypt_item
= proto_tree_add_item(tree
, hf_simulcrypt_max_comp_time
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1183 proto_item_append_text(simulcrypt_item
, " ms");
1185 case SIMULCRYPT_PSIG_ASI_INPUT_PACKET_ID
:
1186 proto_tree_add_item(tree
, hf_simulcrypt_asi_input_packet_id
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1188 case SIMULCRYPT_PSIG_ERROR_STATUS
:
1189 proto_tree_add_item(tree
, hf_simulcrypt_psig_error_status
, tvb
, offset
, plen
, ENC_BIG_ENDIAN
);
1191 case SIMULCRYPT_PSIG_ERROR_INFORMATION
:
1192 proto_tree_add_item(tree
, hf_simulcrypt_error_information
, tvb
, offset
, plen
, ENC_NA
);
1194 default: /* Unknown parameter type */
1195 proto_tree_add_text(tree
, tvb
, offset
, plen
, "Parameter Value: %s", pvalue_char
);
1197 } /* end parameter type switch */
1200 /* This method dissects fully reassembled messages */
1202 dissect_simulcrypt_message(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
1204 proto_item
*simulcrypt_item
;
1205 proto_tree
*simulcrypt_tree
;
1206 proto_tree
*simulcrypt_header_tree
;
1207 proto_tree
*simulcrypt_message_tree
;
1208 guint16 type
, iftype
;
1210 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, PROTO_TAG_SIMULCRYPT
);
1211 col_clear(pinfo
->cinfo
,COL_INFO
);
1213 /* get 2 byte type value */
1214 type
= tvb_get_ntohs(tvb
, 1); /* 2 bytes starting at offset 1 are the message type */
1215 iftype
= get_interface (type
);
1217 col_add_fstr(pinfo
->cinfo
, COL_INFO
, "%d > %d Info Type:[%s]",
1218 pinfo
->srcport
, pinfo
->destport
,
1219 val_to_str(type
, messagetypenames
, "Unknown Type:0x%02x"));
1223 /* we are being asked for details */
1227 simulcrypt_item
= proto_tree_add_item(tree
, proto_simulcrypt
, tvb
, 0, -1, ENC_NA
);
1228 simulcrypt_tree
= proto_item_add_subtree(simulcrypt_item
, ett_simulcrypt
);
1230 proto_item_append_text(simulcrypt_item
, ", Interface: %s", val_to_str(iftype
, interfacenames
, "Unknown (0x%02x)"));
1232 /* Simulcrypt_tree analysis */
1233 /* we are being asked for details */
1234 /* ADD HEADER BRANCH */
1235 simulcrypt_item
= proto_tree_add_item(simulcrypt_tree
, hf_simulcrypt_header
, tvb
, offset
, 5, ENC_NA
);
1236 simulcrypt_header_tree
= proto_item_add_subtree(simulcrypt_item
, ett_simulcrypt_header
);
1237 proto_item_append_text(simulcrypt_header_tree
, ", Length: %s", "5 bytes"); /* add text to Header tree indicating Length 5 bytes */
1239 /* Simulcrypt_header_tree analysis */
1240 /* Message Version 1 Byte */
1241 proto_tree_add_item(simulcrypt_header_tree
, hf_simulcrypt_version
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1244 /* Message Type 2 Bytes */
1245 proto_tree_add_item(simulcrypt_header_tree
, hf_simulcrypt_message_type
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1246 simulcrypt_item
= proto_tree_add_uint_format_value(simulcrypt_header_tree
, hf_simulcrypt_interface
, tvb
, offset
, 2, iftype
,
1247 "%s", val_to_str_const(iftype
, interfacenames
, "Unknown"));
1248 PROTO_ITEM_SET_GENERATED (simulcrypt_item
);
1251 /* Message Length 2 Bytes */
1252 simulcrypt_item
= proto_tree_add_item(simulcrypt_header_tree
, hf_simulcrypt_message_length
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1253 proto_item_append_text(simulcrypt_item
, " (bytes)");
1254 msg_length
= tvb_get_ntohs(tvb
, offset
); /* read 2 byte message length value */
1257 /* ADD MESSAGE BRANCH */
1258 simulcrypt_item
= proto_tree_add_item(simulcrypt_tree
, hf_simulcrypt_message
, tvb
, offset
, -1, ENC_NA
);
1259 simulcrypt_message_tree
= proto_item_add_subtree(simulcrypt_item
, ett_simulcrypt_message
);
1260 proto_item_append_text(simulcrypt_message_tree
, " containing TLV parameters"); /* add text to Message tree */
1261 proto_item_append_text(simulcrypt_message_tree
, ", Length: %d (bytes)", msg_length
); /* add length info to message_tree */
1263 /* end header details */
1265 /* Simulcrypt_message_tree analysis */
1266 /* we are being asked for details */
1267 /* Navigate through message after header to find one or more parameters */
1269 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 */
1273 return tvb_length(tvb
);
1276 /* this method is used to dissect TLV parameters */
1277 /* can be used both from the main tree (simulcrypt_message_tree) and the subtrees (created from TLV items) */
1279 dissect_simulcrypt_data(proto_tree
*simulcrypt_tree
, proto_item
*simulcrypt_item
, packet_info
*pinfo _U_
,
1280 tvbuff_t
*tvb
, proto_tree
*tree
, int offset
,
1281 int container_data_length
, guint16 iftype
, gboolean is_subtree
)
1283 int subtree_offset
= 0;
1284 proto_tree
*simulcrypt_parameter_tree
;
1289 applied_offset
= subtree_offset
;
1293 applied_offset
= offset
;
1296 while (applied_offset
< container_data_length
)
1298 guint16 plen
; /* parameter length */
1299 guint16 ptype
; /* parameter type */
1300 gchar
*pvalue_char
; /* parameter value string */
1302 /* Parameter Type 2 Bytes */
1303 ptype
= tvb_get_ntohs(tvb
, offset
); /* read 2 byte type value */
1304 /* Parameter Length 2 Bytes */
1305 plen
= tvb_get_ntohs(tvb
, offset
+2); /* read 2 byte length value */
1306 /* Parameter Value plen Bytes */
1307 pvalue_char
= tvb_bytes_to_str(tvb
, offset
+4, plen
);
1309 simulcrypt_item
= proto_tree_add_item(simulcrypt_tree
, hf_simulcrypt_parameter
, tvb
, offset
, plen
+2+2, ENC_NA
);
1311 /* add length and value info to type */
1313 case SIMULCRYPT_ECMG_SCS
:
1314 proto_item_append_text(simulcrypt_item
, ": Type=%s", val_to_str(ptype
, ecmg_parametertypenames
, "Unknown Type:0x%02x"));
1316 case SIMULCRYPT_EMMG_MUX
:
1317 proto_item_append_text(simulcrypt_item
, ": Type=%s", val_to_str(ptype
, emmg_parametertypenames
, "Unknown Type:0x%02x"));
1319 case SIMULCRYPT_EIS_SCS
:
1320 proto_item_append_text(simulcrypt_item
, ": Type=%s", val_to_str(ptype
, eis_parametertypenames
, "Unknown Type:0x%02x"));
1322 case SIMULCRYPT_PSIG_MUX
:
1323 case SIMULCRYPT_MUX_CIM
:
1324 case SIMULCRYPT_PSIG_CIP
:
1325 proto_item_append_text(simulcrypt_item
, ": Type=%s", val_to_str(ptype
, psig_parametertypenames
, "Unknown Type:0x%02x"));
1328 proto_item_append_text(simulcrypt_item
, ": Type=0x%02x", ptype
);
1331 proto_item_append_text(simulcrypt_item
, ", Value Length=%d (bytes)", plen
); /* add length info to parameter */
1332 proto_item_append_text(simulcrypt_item
, ", Value=0x%s", pvalue_char
); /* add value info to parameter */
1333 /* add subtree for parameter type, length and value items */
1334 simulcrypt_parameter_tree
= proto_item_add_subtree(simulcrypt_item
, ett_simulcrypt_parameter
); /* add subtree for Length and Value */
1335 switch (iftype
) { /* parameter type */
1336 case SIMULCRYPT_ECMG_SCS
:
1337 proto_tree_add_item(simulcrypt_parameter_tree
, hf_simulcrypt_ecmg_parameter_type
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1339 case SIMULCRYPT_EMMG_MUX
:
1340 proto_tree_add_item(simulcrypt_parameter_tree
, hf_simulcrypt_emmg_parameter_type
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1342 case SIMULCRYPT_EIS_SCS
:
1343 proto_tree_add_item(simulcrypt_parameter_tree
, hf_simulcrypt_eis_parameter_type
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1345 case SIMULCRYPT_PSIG_MUX
:
1346 case SIMULCRYPT_MUX_CIM
:
1347 case SIMULCRYPT_PSIG_CIP
:
1348 proto_tree_add_item(simulcrypt_parameter_tree
, hf_simulcrypt_psig_parameter_type
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1351 proto_tree_add_item(simulcrypt_parameter_tree
, hf_simulcrypt_parameter_type
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1354 simulcrypt_item
= proto_tree_add_item(simulcrypt_parameter_tree
, hf_simulcrypt_parameter_length
, tvb
, offset
+2, 2, ENC_BIG_ENDIAN
); /* length item */
1355 proto_item_append_text(simulcrypt_item
, " (bytes)");
1356 offset
+= 2+2; /* offset --> parameter value */
1359 case SIMULCRYPT_ECMG_SCS
:
1360 dissect_ecmg_parameter_value (simulcrypt_parameter_tree
, tvb
, pinfo
, offset
, plen
, ptype
, pvalue_char
);
1362 case SIMULCRYPT_EMMG_MUX
:
1363 dissect_emmg_parameter_value (simulcrypt_parameter_tree
, tvb
, pinfo
, offset
, plen
, ptype
, pvalue_char
);
1365 case SIMULCRYPT_EIS_SCS
:
1366 dissect_eis_parameter_value (simulcrypt_parameter_tree
, tvb
, pinfo
, offset
, plen
, ptype
, pvalue_char
);
1368 case SIMULCRYPT_PSIG_MUX
:
1369 case SIMULCRYPT_MUX_CIM
:
1370 case SIMULCRYPT_PSIG_CIP
:
1371 dissect_psig_parameter_value (simulcrypt_parameter_tree
, tvb
, pinfo
, offset
, plen
, ptype
, pvalue_char
);
1374 proto_tree_add_text(tree
, tvb
, offset
, plen
, "Parameter Value: %s", pvalue_char
);
1378 subtree_offset
+= 2+2+plen
;
1382 applied_offset
= subtree_offset
;
1386 applied_offset
= offset
;
1388 } /* end parameter tree details */
1392 /* determine PDU length of protocol foo */
1394 get_simulcrypt_message_len(packet_info
*pinfo _U_
, tvbuff_t
*tvb
, int offset
)
1398 iLg
= tvb_get_ntohs(tvb
,offset
+3); /*length is at offset 3 */
1399 iLg
+= 5; /* add 1 byte version + 2 byte type + 2 byte length (simulcrypt "header" */
1403 /* Clean out the ecm_interpretation port association whenever */
1404 /* making a pass through a capture file to dissect all its packets */
1405 /* (e.g., reading in a new capture file, changing a simulcrypt pref, */
1406 /* or running a "filter packets" or "colorize packets" pass over the */
1407 /* current capture file. */
1410 simulcrypt_init(void)
1414 for(i
=0;i
<ECM_INTERPRETATION_SIZE
;i
++)
1416 tab_ecm_inter
[i
].ecmg_port
= -1;
1420 void proto_reg_handoff_simulcrypt(void);
1423 proto_register_simulcrypt (void)
1425 /* A header field is something you can search/filter on.
1427 * We create a structure to register our fields. It consists of an
1428 * array of hf_register_info structures, each of which are of the format
1429 * {&(field id), {name, abbrev, type, display, strings, bitmask, blurb, HFILL}}.
1431 static hf_register_info hf
[] =
1433 { &hf_simulcrypt_header
,
1434 { "Header", "simulcrypt.header", FT_NONE
, BASE_NONE
, NULL
, 0x0,
1437 { &hf_simulcrypt_version
,
1438 { "Version", "simulcrypt.version", FT_UINT8
, BASE_HEX
, NULL
, 0x0, /* version 1 byte */
1441 { &hf_simulcrypt_message_type
,
1442 { "Message Type", "simulcrypt.message.type", FT_UINT16
, BASE_HEX
, VALS(messagetypenames
), 0x0, /* type 2 bytes */
1445 { &hf_simulcrypt_interface
,
1446 { "Interface", "simulcrypt.message.interface", FT_UINT16
, BASE_DEC
, VALS(interfacenames
), 0x0,
1449 { &hf_simulcrypt_message_length
,
1450 { "Message Length", "simulcrypt.message.len", FT_UINT16
, BASE_DEC
, NULL
, 0x0, /* length 2 bytes, print as decimal value */
1453 { &hf_simulcrypt_message
,
1454 { "Message", "simulcrypt.message", FT_NONE
, BASE_NONE
, NULL
, 0x0,
1457 { &hf_simulcrypt_parameter
,
1458 { "Parameter", "simulcrypt.parameter", FT_NONE
, BASE_NONE
, NULL
, 0x0,
1461 { &hf_simulcrypt_parameter_type
,
1462 { "Parameter Type", "simulcrypt.parameter.type", FT_UINT16
, BASE_HEX
, NULL
, 0x0, /* type 2 bytes */
1465 { &hf_simulcrypt_ecmg_parameter_type
,
1466 { "Parameter Type", "simulcrypt.parameter.type", FT_UINT16
, BASE_HEX
, VALS(ecmg_parametertypenames
), 0x0, /* type 2 bytes */
1469 { &hf_simulcrypt_emmg_parameter_type
,
1470 { "Parameter Type", "simulcrypt.parameter.type", FT_UINT16
, BASE_HEX
, VALS(emmg_parametertypenames
), 0x0, /* type 2 bytes */
1473 { &hf_simulcrypt_parameter_length
,
1474 { "Parameter Length", "simulcrypt.parameter.len", FT_UINT16
, BASE_DEC
, NULL
, 0x0, /* length 2 bytes, print as decimal value */
1477 { &hf_simulcrypt_ca_system_id
,
1478 { "CA System ID", "simulcrypt.parameter.ca_system_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1481 { &hf_simulcrypt_ca_subsystem_id
,
1482 { "CA Subsystem ID", "simulcrypt.parameter.ca_subsystem_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1485 { &hf_simulcrypt_super_cas_id
,
1486 { "SuperCAS ID", "simulcrypt.super_cas_id", FT_UINT32
, BASE_HEX
, NULL
, 0x0,
1489 { &hf_simulcrypt_section_tspkt_flag
,
1490 { "Section TS pkt flag", "simulcrypt.section_tspkt_flag", FT_UINT8
, BASE_HEX
, NULL
, 0x0,
1493 { &hf_simulcrypt_ecm_channel_id
,
1494 { "ECM channel ID", "simulcrypt.ecm_channel_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1497 { &hf_simulcrypt_delay_start
,
1498 { "Delay start", "simulcrypt.delay_start", FT_INT16
, BASE_DEC
, NULL
, 0x0,
1501 { &hf_simulcrypt_delay_stop
,
1502 { "Delay stop", "simulcrypt.delay_stop", FT_INT16
, BASE_DEC
, NULL
, 0x0,
1505 { &hf_simulcrypt_ac_delay_start
,
1506 { "AC delay start", "simulcrypt.ac_delay_start", FT_INT16
, BASE_DEC
, NULL
, 0x0,
1509 { &hf_simulcrypt_ac_delay_stop
,
1510 { "AC delay stop", "simulcrypt.ac_delay_stop", FT_INT16
, BASE_DEC
, NULL
, 0x0,
1513 { &hf_simulcrypt_transition_delay_start
,
1514 { "Transition delay start", "simulcrypt.transition_delay_start", FT_INT16
, BASE_DEC
, NULL
, 0x0,
1517 { &hf_simulcrypt_transition_delay_stop
,
1518 { "Transition delay stop", "simulcrypt.transition_delay_stop", FT_INT16
, BASE_DEC
, NULL
, 0x0,
1521 { &hf_simulcrypt_ecm_rep_period
,
1522 { "ECM repetition period", "simulcrypt.ecm_rep_period", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1525 { &hf_simulcrypt_max_streams
,
1526 { "Max streams", "simulcrypt.max_streams", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1529 { &hf_simulcrypt_min_cp_duration
,
1530 { "Min CP duration", "simulcrypt.min_cp_duration", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1533 { &hf_simulcrypt_lead_cw
,
1534 { "Lead CW", "simulcrypt.lead_cw", FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1537 { &hf_simulcrypt_cw_per_msg
,
1538 { "CW per msg", "simulcrypt.cw_per_msg", FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1541 { &hf_simulcrypt_max_comp_time
,
1542 { "Max comp time", "simulcrypt.max_comp_time", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1545 { &hf_simulcrypt_access_criteria
,
1546 { "Access criteria", "simulcrypt.access_criteria", FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1549 { &hf_simulcrypt_ecm_stream_id
,
1550 { "ECM stream ID", "simulcrypt.ecm_stream_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1553 { &hf_simulcrypt_nominal_cp_duration
,
1554 { "Nominal CP duration", "simulcrypt.nominal_cp_duration", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1557 { &hf_simulcrypt_access_criteria_transfer_mode
,
1558 { "AC transfer mode", "simulcrypt.access_criteria_transfer_mode", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
1561 { &hf_simulcrypt_cp_number
,
1562 { "CP number", "simulcrypt.cp_number", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1565 { &hf_simulcrypt_cp_duration
,
1566 { "CP duration", "simulcrypt.cp_duration", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1569 { &hf_simulcrypt_cp_cw_combination
,
1570 { "CP CW combination", "simulcrypt.cp_cw_combination", FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1573 { &hf_simulcrypt_ecm_datagram
,
1574 { "ECM datagram", "simulcrypt.ecm_datagram", FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1577 { &hf_simulcrypt_cw_encryption
,
1578 { "CW encryption", "simulcrypt.cw_encryption", FT_NONE
, BASE_NONE
, NULL
, 0x0,
1581 { &hf_simulcrypt_ecm_id
,
1582 { "ECM ID", "simulcrypt.ecm_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1585 { &hf_simulcrypt_client_id
,
1586 { "Client ID", "simulcrypt.client_id", FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1589 { &hf_simulcrypt_data_channel_id
,
1590 { "Data Channel ID", "simulcrypt.data_channel_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1593 { &hf_simulcrypt_data_stream_id
,
1594 { "Data Stream ID", "simulcrypt.data_stream_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1597 { &hf_simulcrypt_datagram
,
1598 { "Datagram", "simulcrypt.datagram", FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1601 { &hf_simulcrypt_bandwidth
,
1602 { "Bandwidth", "simulcrypt.bandwidth", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1605 { &hf_simulcrypt_data_type
,
1606 { "Data Type", "simulcrypt.data_type", FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1609 { &hf_simulcrypt_data_id
,
1610 { "Data ID", "simulcrypt.data_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1613 { &hf_simulcrypt_ecmg_error_status
,
1614 { "Error status", "simulcrypt.error_status", FT_UINT16
, BASE_DEC
, VALS(ecmg_error_values
), 0x0,
1617 { &hf_simulcrypt_emmg_error_status
,
1618 { "Error status", "simulcrypt.error_status", FT_UINT16
, BASE_DEC
, VALS(emmg_error_values
), 0x0,
1621 { &hf_simulcrypt_error_information
,
1622 { "Error information", "simulcrypt.error_information", FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1625 { &hf_simulcrypt_eis_parameter_type
,
1626 { "Parameter Type", "simulcrypt.parameter.type", FT_UINT16
, BASE_HEX
, VALS(eis_parametertypenames
), 0x0, /* type 2 bytes */
1629 { &hf_simulcrypt_eis_channel_id
,
1630 { "EIS channel ID", "simulcrypt.parameter.eis_channel_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1633 { &hf_simulcrypt_service_flag
,
1634 { "Service flag", "simulcrypt.parameter.service_flag", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
1637 { &hf_simulcrypt_component_flag
,
1638 { "Component flag", "simulcrypt.parameter.component_flag", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
1641 { &hf_simulcrypt_max_scg
,
1642 { "Max SCG", "simulcrypt.parameter.max_scg", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1645 { &hf_simulcrypt_ecm_group
,
1646 { "ECM group", "simulcrypt.parameter.ecm_group", FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1649 { &hf_simulcrypt_scg_id
,
1650 { "SCG ID", "simulcrypt.parameter.scg_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1653 { &hf_simulcrypt_scg_reference_id
,
1654 { "SCG reference ID", "simulcrypt.parameter.scg_reference_id", FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1657 { &hf_simulcrypt_activation_time
,
1658 { "Activation time", "simulcrypt.parameter.activation_time", FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1661 { &hf_simulcrypt_year
,
1662 { "Year", "simulcrypt.parameter.year", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1665 { &hf_simulcrypt_month
,
1666 { "Month", "simulcrypt.parameter.month", FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1669 { &hf_simulcrypt_day
,
1670 { "Day", "simulcrypt.parameter.day", FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1673 { &hf_simulcrypt_hour
,
1674 { "Hour", "simulcrypt.parameter.hour", FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1677 { &hf_simulcrypt_minute
,
1678 { "Minute", "simulcrypt.parameter.minute", FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1681 { &hf_simulcrypt_second
,
1682 { "Second", "simulcrypt.parameter.second", FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1685 { &hf_simulcrypt_hundredth_second
,
1686 { "Hundredth_second", "simulcrypt.parameter.hundredth_second", FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1689 { &hf_simulcrypt_activation_pending_flag
,
1690 { "Activation pending flag", "simulcrypt.parameter.activation_pending_flag", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
1693 { &hf_simulcrypt_component_id
,
1694 { "Component ID", "simulcrypt.parameter.component_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1697 { &hf_simulcrypt_service_id
,
1698 { "Service ID", "simulcrypt.parameter.service_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1701 { &hf_simulcrypt_transport_stream_id
,
1702 { "Transport stream ID", "simulcrypt.parameter.transport_stream_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1705 { &hf_simulcrypt_ac_changed_flag
,
1706 { "AC changed flag", "simulcrypt.parameter.ac_changed_flag", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
1709 { &hf_simulcrypt_scg_current_reference_id
,
1710 { "SCG current reference ID", "simulcrypt.parameter.scg_current_reference_id", FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1713 { &hf_simulcrypt_scg_pending_reference_id
,
1714 { "SCG pending reference ID", "simulcrypt.parameter.scg_pending_reference_id", FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1717 { &hf_simulcrypt_cp_duration_flag
,
1718 { "CP duration flag", "simulcrypt.parameter.cp_duration_flag", FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1721 { &hf_simulcrypt_recommended_cp_duration
,
1722 { "Recommended CP duration", "simulcrypt.parameter.recommended_cp_duration", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1725 { &hf_simulcrypt_scg_nominal_cp_duration
,
1726 { "SCG nominal CP duration", "simulcrypt.parameter.scg_nominal_cp_duration", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1729 { &hf_simulcrypt_original_network_id
,
1730 { "Original network ID", "simulcrypt.parameter.original_network_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1733 { &hf_simulcrypt_eis_error_status
,
1734 { "Error status", "simulcrypt.error_status", FT_UINT16
, BASE_DEC
, VALS(eis_error_values
), 0x0,
1737 { &hf_simulcrypt_error_description
,
1738 { "Error status", "simulcrypt.error_description", FT_STRING
, BASE_NONE
, NULL
, 0x0, /* error_description --> ASCII byte string */
1741 { &hf_simulcrypt_psig_parameter_type
,
1742 { "Parameter Type", "simulcrypt.parameter.type", FT_UINT16
, BASE_HEX
, VALS(psig_parametertypenames
), 0x0, /* type 2 bytes */
1745 { &hf_simulcrypt_psig_type
,
1746 { "PSIG type", "simulcrypt.parameter.psig_type", FT_UINT8
, BASE_HEX
, NULL
, 0x0,
1749 { &hf_simulcrypt_channel_id
,
1750 { "Channel ID", "simulcrypt.parameter.channel_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1753 { &hf_simulcrypt_stream_id
,
1754 { "Stream ID", "simulcrypt.parameter.stream_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1757 { &hf_simulcrypt_packet_id
,
1758 { "Packet ID", "simulcrypt.parameter.packet_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1761 { &hf_simulcrypt_interface_mode_configuration
,
1762 { "Interface mode configuration", "simulcrypt.parameter.interface_mode_configuration", FT_UINT8
, BASE_HEX
, NULL
, 0x0,
1765 { &hf_simulcrypt_max_stream
,
1766 { "Max stream", "simulcrypt.parameter.max_stream", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1769 { &hf_simulcrypt_table_period_pair
,
1770 { "Table period pair", "simulcrypt.parameter.table_period_pair", FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1773 { &hf_simulcrypt_mpeg_section
,
1774 { "MPEG section", "simulcrypt.parameter.mpeg_section", FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1777 { &hf_simulcrypt_repetition_rate
,
1778 { "Repetition rate", "simulcrypt.parameter.repetition_rate", FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1781 { &hf_simulcrypt_initial_bandwidth
,
1782 { "Initial bandwidth", "simulcrypt.parameter.initial_bandwidth", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1785 { &hf_simulcrypt_asi_input_packet_id
,
1786 { "ASI input packet ID", "simulcrypt.parameter.asi_input_packet_id", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1789 { &hf_simulcrypt_psig_error_status
,
1790 { "Error status", "simulcrypt.parameter.error_status", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1794 static gint
*ett
[] =
1797 &ett_simulcrypt_header
,
1798 &ett_simulcrypt_message
,
1799 &ett_simulcrypt_parameter
,
1800 &ett_simulcrypt_super_cas_id
,
1801 &ett_simulcrypt_ecm_datagram
,
1802 &ett_simulcrypt_ecm_group
,
1803 &ett_simulcrypt_activation_time
,
1804 &ett_simulcrypt_table_period_pair
1807 module_t
*simulcrypt_module
;
1809 /* execute protocol initialization only once */
1810 proto_simulcrypt
= proto_register_protocol ("SIMULCRYPT Protocol", "SIMULCRYPT", "simulcrypt");
1812 proto_register_field_array (proto_simulcrypt
, hf
, array_length (hf
));
1813 proto_register_subtree_array (ett
, array_length (ett
));
1815 register_init_routine(simulcrypt_init
);
1817 /* Register our configuration options for Simulcrypt, particularly our port. */
1818 /* This registers our preferences; function proto_reg_handoff_simulcrypt is */
1819 /* called when preferences are applied. */
1820 simulcrypt_module
= prefs_register_protocol(proto_simulcrypt
, proto_reg_handoff_simulcrypt
);
1822 prefs_register_uint_preference(simulcrypt_module
, "tcp.port", "Simulcrypt TCP Port",
1823 "Set the TCP port for Simulcrypt messages ('0' means no port is assigned)",
1824 10, &global_simulcrypt_tcp_port
);
1826 prefs_register_uint_preference(simulcrypt_module
, "udp.port", "Simulcrypt UDP Port",
1827 "Set the UDP port for Simulcrypt messages ('0' means no port is assigned)",
1828 10, &global_simulcrypt_udp_port
);
1830 prefs_register_uint_preference(simulcrypt_module
, "ca_system_id_mikey","MIKEY ECM CA_system_ID (in hex)",
1831 "Set the CA_system_ID used to decode ECM datagram as MIKEY", 16, &ca_system_id_mikey
);
1834 /* this is run every time preferences are changed and also during Wireshark initialization */
1836 proto_reg_handoff_simulcrypt(void)
1838 static gboolean initialized
=FALSE
;
1839 static dissector_handle_t simulcrypt_handle
;
1840 static guint tcp_port
, udp_port
;
1844 simulcrypt_handle
= new_create_dissector_handle(dissect_simulcrypt
, proto_simulcrypt
);
1845 for(i
=0;i
<ECM_INTERPRETATION_SIZE
;i
++)
1847 tab_ecm_inter
[i
].protocol_handle
= find_dissector(tab_ecm_inter
[i
].protocol_name
);
1849 dissector_add_handle("tcp.port", simulcrypt_handle
); /* for "decode_as" */
1850 dissector_add_handle("udp.port", simulcrypt_handle
); /* for "decode_as" */
1854 dissector_delete_uint("tcp.port", tcp_port
, simulcrypt_handle
);
1855 dissector_delete_uint("udp.port", udp_port
, simulcrypt_handle
);
1857 if (global_simulcrypt_tcp_port
!= 0) {
1858 dissector_add_uint("tcp.port", global_simulcrypt_tcp_port
, simulcrypt_handle
);
1860 if (global_simulcrypt_udp_port
!= 0) {
1861 dissector_add_uint("udp.port", global_simulcrypt_udp_port
, simulcrypt_handle
);
1863 tcp_port
= global_simulcrypt_tcp_port
;
1864 udp_port
= global_simulcrypt_udp_port
;
1866 /* update tab_ecm_inter table (always do this) */
1867 tab_ecm_inter
[ECM_MIKEY_INDEX
].ca_system_id
=ca_system_id_mikey
;