Coverage Report

Created: 2026-08-14 06:45

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-dvbci.c
Line
Count
Source
1
/* packet-dvbci.c
2
 * Routines for DVB-CI (Common Interface) dissection
3
 * Copyright 2011-2015, Martin Kaiser <martin@kaiser.cx>
4
 *
5
 * Wireshark - Network traffic analyzer
6
 * By Gerald Combs <gerald@wireshark.org>
7
 * Copyright 1998 Gerald Combs
8
 *
9
 * SPDX-License-Identifier: GPL-2.0-or-later
10
 */
11
12
/* This dissector supports DVB-CI as defined in EN50221 and
13
 * CI+ (www.ci-plus.com).
14
 * For more details, see https://gitlab.com/wireshark/wireshark/-/wikis/DVB-CI.
15
 *
16
 * The pcap input format for this dissector is documented at
17
 * http://www.kaiser.cx/pcap-dvbci.html.
18
 */
19
20
#include "config.h"
21
22
#include <epan/packet.h>
23
#include <epan/addr_resolv.h>
24
#include <epan/conversation.h>
25
#include <epan/dvb_chartbl.h>
26
#include <epan/exported_pdu.h>
27
#include <epan/reassemble.h>
28
#include <epan/prefs.h>
29
#include <epan/tap.h>
30
#include <epan/expert.h>
31
#include <epan/asn1.h>
32
#include <epan/tfs.h>
33
#include "packet-dvbci.h"
34
#include "packet-mpeg-descriptor.h"
35
#include "packet-mpeg-sect.h"
36
#include "packet-x509af.h"
37
#include "packet-x509ce.h"
38
#include "packet-ber.h"
39
#include "packet-mpeg-pmt.h"
40
#include <wsutil/wsgcrypt.h>
41
#include <wsutil/pint.h>
42
43
void proto_register_dvbci(void);
44
void proto_reg_handoff_dvbci(void);
45
46
0
#define AES_BLOCK_LEN 16
47
32
#define AES_KEY_LEN 16
48
49
16
#define EXPORTED_SAC_MSG_PROTO "ciplus_sac_msg"
50
16
#define EXPORTED_SAC_MSG_DESCRIPTION "CI+ SAC message"
51
52
0
#define IS_DATA_TRANSFER(e) (e==DVBCI_EVT_DATA_CAM_TO_HOST || e==DVBCI_EVT_DATA_HOST_TO_CAM)
53
54
/* direction of data transfer in [as]pdu_info_t and elsewhere */
55
0
#define DATA_CAM_TO_HOST  DVBCI_EVT_DATA_CAM_TO_HOST
56
0
#define DATA_HOST_TO_CAM  DVBCI_EVT_DATA_HOST_TO_CAM
57
0
#define DIRECTION_ANY     0x0
58
59
/* source/destination address field */
60
0
#define ADDR_HOST "Host"
61
0
#define ADDR_CAM  "CAM"
62
63
/* hardware event */
64
#define CAM_IN    0x01
65
#define CAM_OUT   0x02
66
#define POWER_ON  0x03
67
#define POWER_OFF 0x04
68
#define TS_ROUTE  0x05
69
#define TS_BYPASS 0x06
70
#define RESET_H   0x07
71
#define RESET_L   0x08
72
#define READY_H   0x09
73
#define READY_L   0x0A
74
75
/* Card Information Structure (CIS) */
76
77
/* tuples */
78
#define CISTPL_NO_LINK       0x14
79
0
#define CISTPL_VERS_1        0x15
80
0
#define CISTPL_CONFIG        0x1A
81
0
#define CISTPL_CFTABLE_ENTRY 0x1B
82
0
#define CISTPL_DEVICE_OC     0x1C
83
0
#define CISTPL_DEVICE_OA     0x1D
84
0
#define CISTPL_MANFID        0x20
85
0
#define CISTPL_END           0xFF
86
/* subtuple */
87
0
#define CCSTPL_CIF           0xC0
88
/* interface types */
89
#define TPCE_IF_TYPE_MEM     0
90
#define TPCE_IF_TYPE_IO_MEM  1
91
#define TPCE_IF_TYPE_CUST0   4
92
#define TPCE_IF_TYPE_CUST1   5
93
#define TPCE_IF_TYPE_CUST2   6
94
#define TPCE_IF_TYPE_CUST3   7
95
/* "voltage used" field in the device tuples */
96
#define CIS_DEV_VCC50 0
97
#define CIS_DEV_VCC33 1
98
99
/* link layer */
100
0
#define ML_MORE 0x80
101
#define ML_LAST 0x00
102
103
/* base values of sequence ids for reassembly of fragmented tpdus
104
   if there's two open transport connections, their tpdu fragments may be
105
    interleaved, we must add the tcid to the base value in order to
106
    distinguish between different transport connections
107
   TPDU_SEQ_ID_BASE and SPDU_SEQ_ID_BASE can be arbitrary 32bit values, they
108
    must be more than 256 apart since we add the 8bit tcid */
109
0
#define TPDU_SEQ_ID_BASE       123
110
/* same as above, the spdu fragments are also demultiplexed based on the
111
    t_c_id field */
112
0
#define SPDU_SEQ_ID_BASE      2417
113
114
/* transport layer */
115
0
#define NO_TAG        0x00
116
0
#define T_SB          0x80
117
0
#define T_RCV         0x81
118
#define T_CREATE_T_C  0x82
119
#define T_C_T_C_REPLY 0x83
120
#define T_DELETE_T_C  0x84
121
#define T_D_T_C_REPLY 0x85
122
#define T_REQUEST_T_C 0x86
123
#define T_NEW_T_C     0x87
124
#define T_T_C_ERROR   0x88
125
0
#define T_DATA_LAST   0xA0
126
0
#define T_DATA_MORE   0xA1
127
128
#define SB_VAL_MSG_AVAILABLE    0x80
129
#define SB_VAL_NO_MSG_AVAILABLE 0x00
130
131
/* session layer */
132
0
#define T_SESSION_NUMBER          0x90
133
0
#define T_OPEN_SESSION_REQUEST    0x91
134
0
#define T_OPEN_SESSION_RESPONSE   0x92
135
0
#define T_CREATE_SESSION          0x93
136
0
#define T_CREATE_SESSION_RESPONSE 0x94
137
0
#define T_CLOSE_SESSION_REQUEST   0x95
138
0
#define T_CLOSE_SESSION_RESPONSE  0x96
139
140
/* status for open/create session */
141
0
#define SESS_OPENED                   0x00
142
#define SESS_NOT_OPENED_RES_NON_EXIST 0xF0
143
#define SESS_NOT_OPENED_RES_UNAVAIL   0xF1
144
#define SESS_NOT_OPENED_RES_VER_LOWER 0xF2
145
#define SESS_NOT_OPENED_RES_BUSY      0xF3
146
147
/* status for close session */
148
0
#define SESS_CLOSED       0x00
149
#define SESS_NB_NOT_ALLOC 0xF0
150
151
/* circuit id from session number (16bit) and transport connection id * (8bit) */
152
0
#define CT_ID(s,t) ((uint32_t)(s<<8|t))
153
154
/* resource id */
155
16
#define RES_ID_TYPE_MASK 0xC0000000
156
16
#define RES_CLASS_MASK   0x3FFF0000
157
16
#define RES_TYPE_MASK    0x0000FFC0
158
16
#define RES_VER_MASK     0x0000003F
159
160
/* resource class */
161
#define RES_CLASS_RM  0x01
162
#define RES_CLASS_AP  0x02
163
#define RES_CLASS_CA  0x03
164
#define RES_CLASS_AUT 0x10
165
#define RES_CLASS_HC  0x20
166
#define RES_CLASS_DT  0x24
167
#define RES_CLASS_MMI 0x40
168
#define RES_CLASS_AMI 0x41
169
#define RES_CLASS_LSC 0x60
170
#define RES_CLASS_CC  0x8C
171
#define RES_CLASS_HLC 0x8D
172
#define RES_CLASS_CUP 0x8E
173
#define RES_CLASS_OPP 0x8F
174
#define RES_CLASS_AFS 0x91
175
#define RES_CLASS_SAS 0x96
176
177
0
#define RES_ID_LEN 4 /* bytes */
178
0
#define RES_CLASS(_res_id) (_res_id & RES_CLASS_MASK) >> 16
179
0
#define RES_VER(_res_id)   (_res_id & RES_VER_MASK)
180
181
/* appinfo resource */
182
#define APP_TYPE_CA  0x1
183
#define APP_TYPE_EPG 0x2
184
185
#define DATA_RATE_72 0x0
186
#define DATA_RATE_96 0x1
187
188
/* ca resource */
189
#define LIST_MGMT_MORE   0x0
190
#define LIST_MGMT_FIRST  0x1
191
#define LIST_MGMT_LAST   0x2
192
#define LIST_MGMT_ONLY   0x3
193
#define LIST_MGMT_ADD    0x4
194
#define LIST_MGMT_UPDATE 0x5
195
196
#define CMD_ID_OK_DESCR     0x1
197
#define CMD_ID_OK_MMI       0x2
198
#define CMD_ID_QUERY        0x3
199
#define CMD_ID_NOT_SELECTED 0x4
200
201
0
#define CA_DESC_TAG 0x9
202
203
0
#define CA_ENAB_DESC_OK             0x01
204
0
#define CA_ENAB_DESC_OK_PURCHASE    0x02
205
0
#define CA_ENAB_DESC_OK_TECH        0x03
206
#define CA_ENAB_DESC_NG_ENTITLEMENT 0x71
207
#define CA_ENAB_DESC_NG_TECH        0x73
208
209
/* host control resource */
210
0
#define HC_STAT_OK            0x0
211
#define HC_STAT_ERR_DLVRY     0x1
212
#define HC_STAT_ERR_LOCK      0x2
213
#define HC_STAT_ERR_BUSY      0x3
214
#define HC_STAT_ERR_PARAM     0x4
215
#define HC_STAT_ERR_NOT_FOUND 0x5
216
#define HC_STAT_ERR_UNKNOWN   0x6
217
218
#define HC_RELEASE_OK      0x0
219
#define HC_RELEASE_REFUSED 0x1
220
221
/* mmi resource */
222
#define CLOSE_MMI_CMD_ID_IMMEDIATE 0x0
223
0
#define CLOSE_MMI_CMD_ID_DELAY     0x1
224
225
/* only commands and parameters for high-level mmi are supported */
226
0
#define DISP_CMD_SET_MMI_MODE 1
227
#define DISP_CMD_GET_DISP_TBL 2
228
#define DISP_CMD_GET_INP_TBL  3
229
230
#define MMI_MODE_HIGH 1
231
232
0
#define DISP_REP_ID_MMI_MODE_ACK     0x01
233
0
#define DISP_REP_ID_DISP_CHAR_TBL    0x02
234
0
#define DISP_REP_ID_INP_CHAR_TBL     0x03
235
#define DISP_REP_ID_UNKNOWN_CMD      0xF0
236
#define DISP_REP_ID_UNKNOWN_MMI_MODE 0xF1
237
#define DISP_REP_ID_UNKNOWN_CHAR_TBL 0xF2
238
239
#define VISIBLE_ANS 0
240
#define BLIND_ANS   1
241
242
#define ANSW_ID_CANCEL 0x00
243
0
#define ANSW_ID_ANSWER 0x01
244
245
/* used for answer_text_length, choice_nb and item_nb */
246
0
#define NB_UNKNOWN 0xFF
247
248
/* cam upgrade resource */
249
#define CUP_DELAYED   0x0
250
#define CUP_IMMEDIATE 0x1
251
252
#define CUP_ANS_NO  0x0
253
#define CUP_ANS_YES 0x1
254
#define CUP_ANS_ASK 0x2
255
256
#define CUP_RESET_PCMCIA 0x0
257
#define CUP_RESET_CMDIF  0x1
258
#define CUP_RESET_NONE   0x2
259
260
/* content control resource */
261
0
#define CC_ID_HOST_ID            0x05
262
#define CC_ID_CICAM_ID           0x06
263
0
#define CC_ID_HOST_BRAND_CERT    0x07
264
0
#define CC_ID_CICAM_BRAND_CERT   0x08
265
0
#define CC_ID_KP                 0x0C
266
0
#define CC_ID_DHPH               0x0D
267
#define CC_ID_DHPM               0x0E
268
0
#define CC_ID_HOST_DEV_CERT      0x0F
269
0
#define CC_ID_CICAM_DEV_CERT     0x10
270
0
#define CC_ID_SIG_A              0x11
271
#define CC_ID_SIG_B              0x12
272
#define CC_ID_AUTH_NONCE         0x13
273
0
#define CC_ID_NS_HOST            0x14
274
#define CC_ID_NS_MODULE          0x15
275
0
#define CC_ID_AKH                0x16
276
0
#define CC_ID_URI                0x19
277
0
#define CC_ID_PROG_NUM           0x1A
278
0
#define CC_ID_URI_CNF            0x1B
279
0
#define CC_ID_KEY_REGISTER       0x1C
280
0
#define CC_ID_URI_VERSIONS       0x1D
281
0
#define CC_ID_STATUS_FIELD       0x1E
282
#define CC_ID_SRM_DATA           0x1F
283
0
#define CC_ID_SRM_CONFIRM        0x20
284
0
#define CC_ID_CICAM_LICENSE      0x21
285
0
#define CC_ID_LICENSE_STATUS     0x22
286
0
#define CC_ID_LICENSE_RCV_STATUS 0x23
287
#define CC_ID_HOST_LICENSE       0x24
288
0
#define CC_ID_PLAY_COUNT         0x25
289
0
#define CC_ID_OPERATING_MODE     0x26
290
#define CC_ID_PINCODE_DATA       0x27
291
0
#define CC_ID_REC_START_STATUS   0x28
292
0
#define CC_ID_MODE_CHG_STATUS    0x29
293
0
#define CC_ID_REC_STOP_STATUS    0x2A
294
295
0
#define CC_EMI_FREE    0x00
296
#define CC_EMI_NO_MORE 0x01
297
#define CC_EMI_ONCE    0x02
298
0
#define CC_EMI_NEVER   0x03
299
300
#define CC_KEY_EVEN 0x0
301
#define CC_KEY_ODD  0x1
302
303
#define CC_STATUS_OK                    0x0
304
#define CC_STATUS_NO_CC_SUPPORT         0x1
305
#define CC_STATUS_HOST_BUSY             0x2
306
#define CC_STATUS_AUTH_FAILED_OR_NO_SRM 0x3
307
#define CC_STATUS_CICAM_BUSY            0x4
308
#define CC_STATUS_REC_MODE_ERR          0x5
309
310
0
#define SAC_MSG_HDR_LEN 8
311
312
#define CC_SAC_AUTH_AES128_XCBC_MAC 0x0
313
0
#define CC_SAC_ENC_AES128_CBC       0x0
314
315
#define CC_CAP_NONE               0x0
316
#define CC_CAP_CAS_PIN            0x1
317
#define CC_CAP_CAS_FTA_PIN        0x2
318
#define CC_CAP_CAS_PIN_CACHED     0x3
319
#define CC_CAP_CAS_FTA_PIN_CACHED 0x4
320
321
/* length of DVB-SI utc time field in bytes */
322
0
#define UTC_TIME_LEN 5
323
324
#define CC_PIN_BAD         0x0
325
#define CC_PIN_CAM_BUSY    0x1
326
#define CC_PIN_OK          0x2
327
#define CC_PIN_UNCONFIRMED 0x3
328
#define CC_PIN_VB_NOT_REQ  0x4
329
#define CC_PIN_CSA         0x5
330
331
#define CC_OP_MODE_WATCH_BUFFER 0x0
332
#define CC_OP_MODE_TIMESHIFT    0x1
333
#define CC_OP_MODE_UNATTENDED   0x2
334
335
/* application mmi resource */
336
#define ACK_CODE_OK        0x1
337
#define ACK_CODE_WRONG_API 0x2
338
#define ACK_CODE_API_BUSY  0x3
339
340
0
#define REQ_TYPE_FILE      0x0
341
0
#define REQ_TYPE_DATA      0x1
342
0
#define REQ_TYPE_FILE_HASH 0x2
343
0
#define REQ_TYPE_REQ       0x3
344
345
/* lsc resource */
346
0
#define COMMS_CMD_ID_CONNECT_ON_CHANNEL    1
347
0
#define COMMS_CMD_ID_DISCONNECT_ON_CHANNEL 2
348
0
#define COMMS_CMD_ID_SET_PARAMS            3
349
0
#define COMMS_CMD_ID_ENQUIRE_STATUS        4
350
0
#define COMMS_CMD_ID_GET_NEXT_BUFFER       5
351
352
#define CONN_DESC_TEL      1
353
#define CONN_DESC_CABLE    2
354
0
#define CONN_DESC_IP       3
355
0
#define CONN_DESC_HOSTNAME 4
356
357
#define LSC_DESC_IP       0xCF
358
#define LSC_DESC_HOSTNAME 0xCD
359
360
0
#define LSC_IPV4 1
361
0
#define LSC_IPV6 2
362
363
0
#define LSC_TCP 1
364
0
#define LSC_UDP 2
365
366
#define COMMS_REP_ID_CONNECT_ACK         1
367
#define COMMS_REP_ID_DISCONNECT_ACK      2
368
0
#define COMMS_REP_ID_SET_PARAMS_ACK      3
369
0
#define COMMS_REP_ID_STATUS_REPLY        4
370
#define COMMS_REP_ID_GET_NEXT_BUFFER_ACK 5
371
0
#define COMMS_REP_ID_SEND_ACK            6
372
373
#define LSC_RET_OK 0
374
#define LSC_DISCONNECTED 0
375
0
#define LSC_CONNECTED    1
376
#define LSC_RET_TOO_BIG 0xFE
377
378
/* auxiliary file system resource */
379
#define AFS_ACK_RSV     0
380
#define AFS_ACK_OK      1
381
#define AFS_ACK_UNKNOWN 2
382
383
/* operator profile resource */
384
0
#define TABLE_ID_CICAM_NIT 0x40  /* CICAM NIT must be a NIT actual */
385
386
#define OPP_REF_REG_FLG_NONE  0
387
#define OPP_REF_REG_FLG_ADV   1
388
#define OPP_REF_REG_FLG_URG   2
389
#define OPP_REF_REG_FLG_SCHED 3
390
391
#define OPP_ERR_FLG_OK          0
392
#define OPP_ERR_FLG_PROF        1
393
#define OPP_ERR_FLG_UNSUPPORTED 2
394
#define OPP_ERR_FLG_CANCELLED   3
395
396
/* EIT p/f, EIT schedule usage */
397
#define OPP_EIT_ABSENT 0
398
#define OPP_EIT_NOT_X  1
399
#define OPP_EIT_FULL_X 2
400
#define OPP_EIT_BARKER 3
401
#define OPP_EPG_APP    4
402
403
#define OPP_EXT_EVT_DIFF 0
404
#define OPP_EXT_EVT_ADD  1
405
406
/* these values match the delivery system descriptor tags */
407
#define OPP_DLV_CAP_S  0x43
408
#define OPP_DLV_CAP_C  0x44
409
#define OPP_DLV_CAP_T  0x5A
410
#define OPP_DLV_CAP_S2 0x79
411
412
#define OPP_TUNE_OK          0
413
#define OPP_TUNE_UNSUPPORTED 1
414
#define OPP_TUNE_INVALID     2
415
#define OPP_TUNE_ERR         3
416
417
0
#define OPP_NO_MORE_DESC 0xFF
418
419
/* sas resource */
420
0
#define SAS_SESS_STATE_CONNECTED 0
421
#define SAS_SESS_STATE_NOT_FOUND 1
422
#define SAS_SESS_STATE_DENIED    2
423
424
425
/* application layer */
426
427
0
#define APDU_TAG_SIZE 3
428
429
/* "don't care" value for min_len_field and len_field (this can't be 0) */
430
0
#define LEN_FIELD_ANY UINT32_MAX
431
432
static GHashTable *apdu_table;
433
434
typedef struct _apdu_info_t {
435
    uint32_t tag;
436
    /* the minimum length required for this apdu */
437
    uint32_t min_len_field;
438
    /* if the apdu has a well-known length, we enforce it here
439
     * (otherwise, we set this to LEN_FIELD_ANY) */
440
    uint32_t len_field;
441
    uint8_t direction;
442
    uint16_t res_class;
443
    uint8_t res_min_ver;
444
    void (*dissect_payload)(uint32_t, int,
445
            tvbuff_t *, unsigned offset, conversation_t *, packet_info *, proto_tree *);
446
} apdu_info_t;
447
448
449
static void
450
dissect_dvbci_payload_rm(uint32_t tag, int len_field,
451
        tvbuff_t *tvb, unsigned offset, conversation_t *conv _U_,
452
        packet_info *pinfo, proto_tree *tree);
453
static void
454
dissect_dvbci_payload_ap(uint32_t tag, int len_field _U_,
455
        tvbuff_t *tvb, unsigned offset, conversation_t *conv _U_,
456
        packet_info *pinfo, proto_tree *tree);
457
static void
458
dissect_dvbci_payload_ca(uint32_t tag, int len_field,
459
        tvbuff_t *tvb, unsigned offset, conversation_t *conv _U_,
460
        packet_info *pinfo, proto_tree *tree);
461
static void
462
dissect_dvbci_payload_aut(uint32_t tag, int len_field _U_,
463
        tvbuff_t *tvb, unsigned offset, conversation_t *conv _U_,
464
        packet_info *pinfo _U_, proto_tree *tree);
465
static void
466
dissect_dvbci_payload_hc(uint32_t tag, int len_field _U_,
467
        tvbuff_t *tvb, unsigned offset, conversation_t *conv _U_,
468
        packet_info *pinfo, proto_tree *tree);
469
static void
470
dissect_dvbci_payload_dt(uint32_t tag, int len_field,
471
        tvbuff_t *tvb, unsigned offset, conversation_t *conv _U_,
472
        packet_info *pinfo, proto_tree *tree);
473
static void
474
dissect_dvbci_payload_mmi(uint32_t tag, int len_field,
475
        tvbuff_t *tvb, unsigned offset, conversation_t *conv _U_,
476
        packet_info *pinfo, proto_tree *tree);
477
static void
478
dissect_dvbci_payload_hlc(uint32_t tag, int len_field _U_,
479
        tvbuff_t *tvb, unsigned offset, conversation_t *conv _U_,
480
        packet_info *pinfo, proto_tree *tree);
481
static void
482
dissect_dvbci_payload_cup(uint32_t tag, int len_field _U_,
483
        tvbuff_t *tvb, unsigned offset, conversation_t *conv _U_,
484
        packet_info *pinfo, proto_tree *tree);
485
static void
486
dissect_dvbci_payload_cc(uint32_t tag, int len_field _U_,
487
        tvbuff_t *tvb, unsigned offset, conversation_t *conv _U_,
488
        packet_info *pinfo, proto_tree *tree);
489
static void
490
dissect_dvbci_payload_ami(uint32_t tag, int len_field _U_,
491
        tvbuff_t *tvb, unsigned offset, conversation_t *conv _U_,
492
        packet_info *pinfo, proto_tree *tree);
493
static void
494
dissect_dvbci_payload_lsc(uint32_t tag, int len_field,
495
        tvbuff_t *tvb, unsigned offset, conversation_t *conv,
496
        packet_info *pinfo, proto_tree *tree);
497
static void
498
dissect_dvbci_payload_opp(uint32_t tag, int len_field _U_,
499
        tvbuff_t *tvb, unsigned offset, conversation_t *conv _U_,
500
        packet_info *pinfo, proto_tree *tree);
501
static void
502
dissect_dvbci_payload_afs(uint32_t tag, int len_field _U_,
503
        tvbuff_t *tvb, unsigned offset, conversation_t *conv _U_,
504
        packet_info *pinfo, proto_tree *tree);
505
static void
506
dissect_dvbci_payload_sas(uint32_t tag, int len_field _U_,
507
        tvbuff_t *tvb, unsigned offset, conversation_t *conv,
508
        packet_info *pinfo, proto_tree *tree);
509
510
511
/* apdu defines */
512
#define T_PROFILE_ENQ                   0x9F8010
513
0
#define T_PROFILE                       0x9F8011
514
#define T_PROFILE_CHANGE                0x9F8012
515
#define T_APP_INFO_ENQ                  0x9F8020
516
0
#define T_APP_INFO                      0x9F8021
517
#define T_ENTER_MENU                    0x9F8022
518
#define T_REQUEST_CICAM_RESET           0x9F8023
519
0
#define T_DATARATE_INFO                 0x9F8024
520
#define T_CA_INFO_ENQ                   0x9F8030
521
0
#define T_CA_INFO                       0x9F8031
522
0
#define T_CA_PMT                        0x9F8032
523
0
#define T_CA_PMT_REPLY                  0x9F8033
524
0
#define T_AUTH_REQ                      0x9F8200
525
0
#define T_AUTH_RESP                     0x9F8201
526
0
#define T_TUNE                          0x9F8400
527
0
#define T_REPLACE                       0x9F8401
528
0
#define T_CLEAR_REPLACE                 0x9F8402
529
#define T_ASK_RELEASE                   0x9F8403
530
0
#define T_TUNE_BROADCAST_REQ            0x9F8404
531
0
#define T_TUNE_REPLY                    0x9F8405
532
0
#define T_ASK_RELEASE_REPLY             0x9F8406
533
#define T_TUNE_LCN_REQ                  0x9F8407
534
#define T_TUNE_IP_REQ                   0x9F8408
535
#define T_TUNE_TRIPLET_REQ              0x9F8409
536
#define T_TUNE_STATUS_REQ               0x9F840A
537
#define T_TUNE_STATUS_REPLY             0x9F840B
538
0
#define T_DATE_TIME_ENQ                 0x9F8440
539
0
#define T_DATE_TIME                     0x9F8441
540
0
#define T_CLOSE_MMI                     0x9F8800
541
0
#define T_DISPLAY_CONTROL               0x9F8801
542
0
#define T_DISPLAY_REPLY                 0x9F8802
543
0
#define T_ENQ                           0x9F8807
544
0
#define T_ANSW                          0x9F8808
545
0
#define T_MENU_LAST                     0x9F8809
546
0
#define T_MENU_MORE                     0x9F880A
547
0
#define T_MENU_ANSW                     0x9F880B
548
0
#define T_LIST_LAST                     0x9F880C
549
0
#define T_LIST_MORE                     0x9F880D
550
#define T_HOST_COUNTRY_ENQ              0x9F8100
551
0
#define T_HOST_COUNTRY                  0x9F8101
552
#define T_HOST_LANGUAGE_ENQ             0x9F8110
553
0
#define T_HOST_LANGUAGE                 0x9F8111
554
0
#define T_CAM_FIRMWARE_UPGRADE          0x9F9D01
555
0
#define T_CAM_FIRMWARE_UPGRADE_REPLY    0x9F9D02
556
0
#define T_CAM_FIRMWARE_UPGRADE_PROGRESS 0x9F9D03
557
0
#define T_CAM_FIRMWARE_UPGRADE_COMPLETE 0x9F9D04
558
#define T_CC_OPEN_REQ                   0x9F9001
559
0
#define T_CC_OPEN_CNF                   0x9F9002
560
0
#define T_CC_DATA_REQ                   0x9F9003
561
0
#define T_CC_DATA_CNF                   0x9F9004
562
#define T_CC_SYNC_REQ                   0x9F9005
563
0
#define T_CC_SYNC_CNF                   0x9F9006
564
0
#define T_CC_SAC_DATA_REQ               0x9F9007
565
0
#define T_CC_SAC_DATA_CNF               0x9F9008
566
0
#define T_CC_SAC_SYNC_REQ               0x9F9009
567
0
#define T_CC_SAC_SYNC_CNF               0x9F9010
568
#define T_CC_PIN_CAPABILITIES_REQ       0x9F9011
569
0
#define T_CC_PIN_CAPABILITIES_REPLY     0x9F9012
570
0
#define T_CC_PIN_CMD                    0x9F9013
571
0
#define T_CC_PIN_REPLY                  0x9F9014
572
0
#define T_CC_PIN_EVENT                  0x9F9015
573
0
#define T_CC_PIN_PLAYBACK               0x9F9016
574
0
#define T_CC_PIN_MMI_REQ                0x9F9017
575
0
#define T_REQUEST_START                 0x9F8000
576
0
#define T_REQUEST_START_ACK             0x9F8001
577
0
#define T_FILE_REQUEST                  0x9F8002
578
0
#define T_FILE_ACKNOWLEDGE              0x9F8003
579
0
#define T_APP_ABORT_REQUEST             0x9F8004
580
0
#define T_APP_ABORT_ACK                 0x9F8005
581
0
#define T_COMMS_CMD                     0x9F8C00
582
0
#define T_COMMS_REPLY                   0x9F8C02
583
0
#define T_COMMS_SEND_LAST               0x9F8C03
584
0
#define T_COMMS_SEND_MORE               0x9F8C04
585
0
#define T_COMMS_RCV_LAST                0x9F8C05
586
0
#define T_COMMS_RCV_MORE                0x9F8C06
587
#define T_COMMS_IP_CONFIG_REQ           0x9F8C09
588
0
#define T_COMMS_IP_CONFIG_REPLY         0x9F8C0A
589
0
#define T_AFS_FILE_SYSTEM_OFFER         0x9F9400
590
0
#define T_AFS_FILE_SYSTEM_ACK           0x9F9401
591
0
#define T_AFS_FILE_REQUEST              0x9F9402
592
0
#define T_AFS_FILE_ACKNOWLEDGE          0x9F9403
593
#define T_OPERATOR_STATUS_REQ           0x9F9C00
594
0
#define T_OPERATOR_STATUS               0x9F9C01
595
#define T_OPERATOR_NIT_REQ              0x9F9C02
596
0
#define T_OPERATOR_NIT                  0x9F9C03
597
#define T_OPERATOR_INFO_REQ             0x9F9C04
598
0
#define T_OPERATOR_INFO                 0x9F9C05
599
0
#define T_OPERATOR_SEARCH_START         0x9F9C06
600
0
#define T_OPERATOR_SEARCH_STATUS        0x9F9C07
601
#define T_OPERATOR_EXIT                 0x9F9C08
602
0
#define T_OPERATOR_TUNE                 0x9F9C09
603
0
#define T_OPERATOR_TUNE_STATUS          0x9F9C0A
604
#define T_OPERATOR_ENTITLEMENT_ACK      0x9F9C0B
605
#define T_OPERATOR_SEARCH_CANCEL        0x9F9C0C
606
0
#define T_SAS_CONNECT_RQST              0x9F9A00
607
0
#define T_SAS_CONNECT_CNF               0x9F9A01
608
0
#define T_SAS_ASYNC_MSG                 0x9F9A07
609
610
/* these are no real apdus, they just use the same format */
611
0
#define T_TEXT_LAST             0x9F8803
612
0
#define T_TEXT_MORE             0x9F8804
613
0
#define T_CONNECTION_DESCRIPTOR 0x9F8C01
614
615
0
#define IS_MENU_APDU(t) (t==T_MENU_MORE || t==T_MENU_LAST)
616
617
618
static const apdu_info_t apdu_info[] = {
619
    {T_PROFILE_ENQ,         0, 0,             DIRECTION_ANY,    RES_CLASS_RM, 1, NULL},
620
    {T_PROFILE,             0, LEN_FIELD_ANY, DIRECTION_ANY,    RES_CLASS_RM, 1, dissect_dvbci_payload_rm},
621
    {T_PROFILE_CHANGE,      0, 0,             DIRECTION_ANY,    RES_CLASS_RM, 1, NULL},
622
623
    {T_APP_INFO_ENQ,        0, 0,             DATA_HOST_TO_CAM, RES_CLASS_AP, 1, NULL},
624
    {T_APP_INFO,            6, LEN_FIELD_ANY, DATA_CAM_TO_HOST, RES_CLASS_AP, 1, dissect_dvbci_payload_ap},
625
    {T_ENTER_MENU,          0, 0,             DATA_HOST_TO_CAM, RES_CLASS_AP, 1, NULL},
626
    {T_REQUEST_CICAM_RESET, 0, 0,             DATA_CAM_TO_HOST, RES_CLASS_AP, 3, NULL},
627
    {T_DATARATE_INFO,       0, 1,             DATA_HOST_TO_CAM, RES_CLASS_AP, 3, dissect_dvbci_payload_ap},
628
629
    {T_CA_INFO_ENQ,         0, 0,             DATA_HOST_TO_CAM, RES_CLASS_CA, 1, NULL},
630
    {T_CA_INFO,             0, LEN_FIELD_ANY, DATA_CAM_TO_HOST, RES_CLASS_CA, 1, dissect_dvbci_payload_ca},
631
    {T_CA_PMT,              6, LEN_FIELD_ANY, DATA_HOST_TO_CAM, RES_CLASS_CA, 1, dissect_dvbci_payload_ca},
632
    {T_CA_PMT_REPLY,        8, LEN_FIELD_ANY, DATA_CAM_TO_HOST, RES_CLASS_CA, 1, dissect_dvbci_payload_ca},
633
634
    {T_AUTH_REQ,            2, LEN_FIELD_ANY, DATA_CAM_TO_HOST, RES_CLASS_AUT, 1, dissect_dvbci_payload_aut},
635
    {T_AUTH_RESP,           2, LEN_FIELD_ANY, DATA_HOST_TO_CAM, RES_CLASS_AUT, 1, dissect_dvbci_payload_aut},
636
637
    {T_TUNE,                0, 8,             DATA_CAM_TO_HOST, RES_CLASS_HC, 1, dissect_dvbci_payload_hc},
638
    {T_REPLACE,             0, 5,             DATA_CAM_TO_HOST, RES_CLASS_HC, 1, dissect_dvbci_payload_hc},
639
    {T_CLEAR_REPLACE,       0, 1,             DATA_CAM_TO_HOST, RES_CLASS_HC, 1, dissect_dvbci_payload_hc},
640
    {T_ASK_RELEASE,         0, 0,             DATA_HOST_TO_CAM, RES_CLASS_HC, 1, NULL},
641
    {T_TUNE_BROADCAST_REQ,  5, LEN_FIELD_ANY, DATA_CAM_TO_HOST, RES_CLASS_HC, 2, dissect_dvbci_payload_hc},
642
    {T_TUNE_REPLY,          1, 1,             DATA_HOST_TO_CAM, RES_CLASS_HC, 2, dissect_dvbci_payload_hc},
643
    {T_ASK_RELEASE_REPLY,   1, 1,             DATA_CAM_TO_HOST, RES_CLASS_HC, 2, dissect_dvbci_payload_hc},
644
645
    {T_DATE_TIME_ENQ,       0, 1,             DATA_CAM_TO_HOST, RES_CLASS_DT, 1, dissect_dvbci_payload_dt},
646
    {T_DATE_TIME,           5, LEN_FIELD_ANY, DATA_HOST_TO_CAM, RES_CLASS_DT, 1, dissect_dvbci_payload_dt},
647
648
    {T_CLOSE_MMI,           1, LEN_FIELD_ANY, DIRECTION_ANY,    RES_CLASS_MMI, 1, dissect_dvbci_payload_mmi},
649
    {T_DISPLAY_CONTROL,     1, LEN_FIELD_ANY, DATA_CAM_TO_HOST, RES_CLASS_MMI, 1, dissect_dvbci_payload_mmi},
650
    {T_DISPLAY_REPLY,       1, LEN_FIELD_ANY, DATA_HOST_TO_CAM, RES_CLASS_MMI, 1, dissect_dvbci_payload_mmi},
651
    {T_ENQ,                 2, LEN_FIELD_ANY, DATA_CAM_TO_HOST, RES_CLASS_MMI, 1, dissect_dvbci_payload_mmi},
652
    {T_ANSW,                1, LEN_FIELD_ANY, DATA_HOST_TO_CAM, RES_CLASS_MMI, 1, dissect_dvbci_payload_mmi},
653
    {T_MENU_LAST,          13, LEN_FIELD_ANY, DATA_CAM_TO_HOST, RES_CLASS_MMI, 1, dissect_dvbci_payload_mmi},
654
    {T_MENU_MORE,          13, LEN_FIELD_ANY, DATA_CAM_TO_HOST, RES_CLASS_MMI, 1, dissect_dvbci_payload_mmi},
655
    {T_MENU_ANSW,           0, 1,             DATA_HOST_TO_CAM, RES_CLASS_MMI, 1, dissect_dvbci_payload_mmi},
656
    {T_LIST_LAST,          13, LEN_FIELD_ANY, DATA_CAM_TO_HOST, RES_CLASS_MMI, 1, dissect_dvbci_payload_mmi},
657
    {T_LIST_MORE,          13, LEN_FIELD_ANY, DATA_CAM_TO_HOST, RES_CLASS_MMI, 1, dissect_dvbci_payload_mmi},
658
659
    {T_HOST_COUNTRY_ENQ,    0, 0,             DATA_CAM_TO_HOST, RES_CLASS_HLC, 1, NULL},
660
    {T_HOST_COUNTRY,        0, 3,             DATA_HOST_TO_CAM, RES_CLASS_HLC, 1, dissect_dvbci_payload_hlc},
661
    {T_HOST_LANGUAGE_ENQ,   0, 0,             DATA_CAM_TO_HOST, RES_CLASS_HLC, 1, NULL},
662
    {T_HOST_LANGUAGE,       0, 3,             DATA_HOST_TO_CAM, RES_CLASS_HLC, 1, dissect_dvbci_payload_hlc},
663
664
    {T_CAM_FIRMWARE_UPGRADE,          0, 3, DATA_CAM_TO_HOST, RES_CLASS_CUP, 1, dissect_dvbci_payload_cup},
665
    {T_CAM_FIRMWARE_UPGRADE_REPLY,    0, 1, DATA_HOST_TO_CAM, RES_CLASS_CUP, 1, dissect_dvbci_payload_cup},
666
    {T_CAM_FIRMWARE_UPGRADE_PROGRESS, 0, 1, DATA_CAM_TO_HOST, RES_CLASS_CUP, 1, dissect_dvbci_payload_cup},
667
    {T_CAM_FIRMWARE_UPGRADE_COMPLETE, 0, 1, DATA_CAM_TO_HOST, RES_CLASS_CUP, 1, dissect_dvbci_payload_cup},
668
669
    {T_CC_OPEN_REQ,                0,  0,             DATA_CAM_TO_HOST, RES_CLASS_CC, 1, NULL},
670
    {T_CC_OPEN_CNF,                0,  1,             DATA_HOST_TO_CAM, RES_CLASS_CC, 1, dissect_dvbci_payload_cc},
671
    {T_CC_DATA_REQ,                3,  LEN_FIELD_ANY, DATA_CAM_TO_HOST, RES_CLASS_CC, 1, dissect_dvbci_payload_cc},
672
    {T_CC_DATA_CNF,                2,  LEN_FIELD_ANY, DATA_HOST_TO_CAM, RES_CLASS_CC, 1, dissect_dvbci_payload_cc},
673
    {T_CC_SYNC_REQ,                0,  0,             DATA_CAM_TO_HOST, RES_CLASS_CC, 1, NULL},
674
    {T_CC_SYNC_CNF,                0,  1,             DATA_HOST_TO_CAM, RES_CLASS_CC, 1, dissect_dvbci_payload_cc},
675
    {T_CC_SAC_DATA_REQ,            8,  LEN_FIELD_ANY, DIRECTION_ANY,    RES_CLASS_CC, 1, dissect_dvbci_payload_cc},
676
    {T_CC_SAC_DATA_CNF,            8,  LEN_FIELD_ANY, DIRECTION_ANY,    RES_CLASS_CC, 1, dissect_dvbci_payload_cc},
677
    {T_CC_SAC_SYNC_REQ,            8,  LEN_FIELD_ANY, DATA_CAM_TO_HOST, RES_CLASS_CC, 1, dissect_dvbci_payload_cc},
678
    {T_CC_SAC_SYNC_CNF,            8,  LEN_FIELD_ANY, DATA_HOST_TO_CAM, RES_CLASS_CC, 1, dissect_dvbci_payload_cc},
679
    {T_CC_PIN_CAPABILITIES_REQ,    0,  0,             DATA_HOST_TO_CAM, RES_CLASS_CC, 2, NULL},
680
    {T_CC_PIN_CAPABILITIES_REPLY,  7,  7,             DATA_CAM_TO_HOST, RES_CLASS_CC, 2, dissect_dvbci_payload_cc},
681
    {T_CC_PIN_CMD,                 1,  LEN_FIELD_ANY, DATA_HOST_TO_CAM, RES_CLASS_CC, 2, dissect_dvbci_payload_cc},
682
    {T_CC_PIN_REPLY,               1,  1,             DATA_CAM_TO_HOST, RES_CLASS_CC, 2, dissect_dvbci_payload_cc},
683
    {T_CC_PIN_EVENT,              25, 25,             DATA_CAM_TO_HOST, RES_CLASS_CC, 2, dissect_dvbci_payload_cc},
684
    {T_CC_PIN_PLAYBACK,           16, 16,             DATA_HOST_TO_CAM, RES_CLASS_CC, 2, dissect_dvbci_payload_cc},
685
    {T_CC_PIN_MMI_REQ,             1,  LEN_FIELD_ANY, DATA_HOST_TO_CAM, RES_CLASS_CC, 2, dissect_dvbci_payload_cc},
686
687
    {T_REQUEST_START,       2, LEN_FIELD_ANY, DATA_CAM_TO_HOST, RES_CLASS_AMI, 1, dissect_dvbci_payload_ami},
688
    {T_REQUEST_START_ACK,   0, 1,             DATA_HOST_TO_CAM, RES_CLASS_AMI, 1, dissect_dvbci_payload_ami},
689
    {T_FILE_REQUEST,        1, LEN_FIELD_ANY, DATA_HOST_TO_CAM, RES_CLASS_AMI, 1, dissect_dvbci_payload_ami},
690
    {T_FILE_ACKNOWLEDGE,    2, LEN_FIELD_ANY, DATA_CAM_TO_HOST, RES_CLASS_AMI, 1, dissect_dvbci_payload_ami},
691
    {T_APP_ABORT_REQUEST,   0, LEN_FIELD_ANY, DIRECTION_ANY,    RES_CLASS_AMI, 1, dissect_dvbci_payload_ami},
692
    {T_APP_ABORT_ACK,       0, LEN_FIELD_ANY, DIRECTION_ANY,    RES_CLASS_AMI, 1, dissect_dvbci_payload_ami},
693
694
    {T_COMMS_CMD,             1, LEN_FIELD_ANY, DATA_CAM_TO_HOST, RES_CLASS_LSC, 1, dissect_dvbci_payload_lsc},
695
    {T_COMMS_REPLY,           0, 2,             DATA_HOST_TO_CAM, RES_CLASS_LSC, 1, dissect_dvbci_payload_lsc},
696
    {T_COMMS_SEND_LAST,       2, LEN_FIELD_ANY, DATA_CAM_TO_HOST, RES_CLASS_LSC, 1, dissect_dvbci_payload_lsc},
697
    {T_COMMS_SEND_MORE,       2, LEN_FIELD_ANY, DATA_CAM_TO_HOST, RES_CLASS_LSC, 1, dissect_dvbci_payload_lsc},
698
    {T_COMMS_RCV_LAST,        2, LEN_FIELD_ANY, DATA_HOST_TO_CAM, RES_CLASS_LSC, 1, dissect_dvbci_payload_lsc},
699
    {T_COMMS_RCV_MORE,        2, LEN_FIELD_ANY, DATA_HOST_TO_CAM, RES_CLASS_LSC, 1, dissect_dvbci_payload_lsc},
700
    {T_COMMS_IP_CONFIG_REQ,   0, 0,             DATA_CAM_TO_HOST, RES_CLASS_LSC, 4, NULL},
701
    {T_COMMS_IP_CONFIG_REPLY, 2, LEN_FIELD_ANY, DATA_HOST_TO_CAM, RES_CLASS_LSC, 4, dissect_dvbci_payload_lsc},
702
703
    {T_AFS_FILE_SYSTEM_OFFER, 1, LEN_FIELD_ANY, DATA_CAM_TO_HOST, RES_CLASS_AFS, 1, dissect_dvbci_payload_afs},
704
    {T_AFS_FILE_SYSTEM_ACK,   1, 1,             DATA_HOST_TO_CAM, RES_CLASS_AFS, 1, dissect_dvbci_payload_afs},
705
    {T_AFS_FILE_REQUEST,      1, LEN_FIELD_ANY, DATA_HOST_TO_CAM, RES_CLASS_AFS, 1, dissect_dvbci_payload_afs},
706
    {T_AFS_FILE_ACKNOWLEDGE,  2, LEN_FIELD_ANY, DATA_CAM_TO_HOST, RES_CLASS_AFS, 1, dissect_dvbci_payload_afs},
707
708
    {T_OPERATOR_STATUS_REQ,       0, 0,             DATA_HOST_TO_CAM, RES_CLASS_OPP, 1, NULL},
709
    {T_OPERATOR_STATUS,           0, 6,             DATA_CAM_TO_HOST, RES_CLASS_OPP, 1, dissect_dvbci_payload_opp},
710
    {T_OPERATOR_NIT_REQ,          0, 0,             DATA_HOST_TO_CAM, RES_CLASS_OPP, 1, NULL},
711
    {T_OPERATOR_NIT,              2, LEN_FIELD_ANY, DATA_CAM_TO_HOST, RES_CLASS_OPP, 1, dissect_dvbci_payload_opp},
712
    {T_OPERATOR_INFO_REQ,         0, 0,             DATA_HOST_TO_CAM, RES_CLASS_OPP, 1, NULL},
713
    {T_OPERATOR_INFO,             1, LEN_FIELD_ANY, DATA_CAM_TO_HOST, RES_CLASS_OPP, 1, dissect_dvbci_payload_opp},
714
    {T_OPERATOR_SEARCH_START,     3, LEN_FIELD_ANY, DATA_HOST_TO_CAM, RES_CLASS_OPP, 1, dissect_dvbci_payload_opp},
715
    {T_OPERATOR_SEARCH_STATUS,    0, 6,             DATA_CAM_TO_HOST, RES_CLASS_OPP, 1, dissect_dvbci_payload_opp},
716
    {T_OPERATOR_EXIT,             0, 0,             DATA_HOST_TO_CAM, RES_CLASS_OPP, 1, NULL},
717
    {T_OPERATOR_TUNE,             2, LEN_FIELD_ANY, DATA_CAM_TO_HOST, RES_CLASS_OPP, 1, dissect_dvbci_payload_opp},
718
    {T_OPERATOR_TUNE_STATUS,      5, LEN_FIELD_ANY, DATA_HOST_TO_CAM, RES_CLASS_OPP, 1, dissect_dvbci_payload_opp},
719
    {T_OPERATOR_ENTITLEMENT_ACK,  0, 0,             DATA_HOST_TO_CAM, RES_CLASS_OPP, 1, NULL},
720
    {T_OPERATOR_SEARCH_CANCEL,    0, 0,             DATA_HOST_TO_CAM, RES_CLASS_OPP, 1, NULL},
721
722
    {T_SAS_CONNECT_RQST,    0, 8,             DATA_HOST_TO_CAM, RES_CLASS_SAS, 1, dissect_dvbci_payload_sas},
723
    {T_SAS_CONNECT_CNF,     0, 9,             DATA_CAM_TO_HOST, RES_CLASS_SAS, 1, dissect_dvbci_payload_sas},
724
    {T_SAS_ASYNC_MSG,       3, LEN_FIELD_ANY, DIRECTION_ANY,    RES_CLASS_SAS, 1, dissect_dvbci_payload_sas}
725
};
726
727
static const value_string dvbci_apdu_tag[] = {
728
    { T_PROFILE_ENQ,                   "Profile enquiry" },
729
    { T_PROFILE,                       "Profile information" },
730
    { T_PROFILE_CHANGE,                "Profile change notification" },
731
    { T_APP_INFO_ENQ,                  "Application info enquiry" },
732
    { T_APP_INFO,                      "Application info" },
733
    { T_ENTER_MENU,                    "Enter menu" },
734
    { T_REQUEST_CICAM_RESET,           "Request CICAM reset" },
735
    { T_DATARATE_INFO,                 "Datarate info" },
736
    { T_CA_INFO_ENQ,                   "CA info enquiry" },
737
    { T_CA_INFO,                       "CA info" },
738
    { T_CA_PMT,                        "CA PMT" },
739
    { T_CA_PMT_REPLY,                  "CA PMT reply" },
740
    { T_AUTH_REQ,                      "Authentication request" },
741
    { T_AUTH_RESP,                     "Authentication response" },
742
    { T_TUNE,                          "Tune" },
743
    { T_REPLACE,                       "Replace" },
744
    { T_CLEAR_REPLACE,                 "Clear replace" },
745
    { T_ASK_RELEASE,                   "Ask release" },
746
    { T_TUNE_BROADCAST_REQ,            "Tune broadcast request" },
747
    { T_TUNE_REPLY,                    "Tune reply" },
748
    { T_ASK_RELEASE_REPLY,             "Ask release reply" },
749
    { T_TUNE_LCN_REQ,                  "Tune LCN request" },
750
    { T_TUNE_IP_REQ,                   "Tune IP request" },
751
    { T_TUNE_TRIPLET_REQ,              "Tune triplet request" },
752
    { T_TUNE_STATUS_REQ,               "Tune status request" },
753
    { T_TUNE_STATUS_REPLY,             "Tune status reply" },
754
    { T_DATE_TIME_ENQ,                 "Date-Time enquiry" },
755
    { T_DATE_TIME,                     "Date-Time" },
756
    { T_CLOSE_MMI,                     "Close MMI" },
757
    { T_DISPLAY_CONTROL,               "Display control" },
758
    { T_DISPLAY_REPLY,                 "Display reply" },
759
    { T_TEXT_LAST,                     "Text last" },
760
    { T_TEXT_MORE,                     "Text more" },
761
    { T_ENQ,                           "Enquiry" },
762
    { T_ANSW,                          "Answer" },
763
    { T_MENU_LAST,                     "Menu last" },
764
    { T_MENU_MORE,                     "Menu more" },
765
    { T_MENU_ANSW,                     "Menu answer" },
766
    { T_LIST_LAST,                     "List last" },
767
    { T_LIST_MORE,                     "List more" },
768
    { T_HOST_COUNTRY_ENQ,              "Host country enquiry" },
769
    { T_HOST_COUNTRY,                  "Host country" },
770
    { T_HOST_LANGUAGE_ENQ,             "Host language enquiry" },
771
    { T_HOST_LANGUAGE,                 "Host language" },
772
    { T_CAM_FIRMWARE_UPGRADE,          "CAM firmware upgrade" },
773
    { T_CAM_FIRMWARE_UPGRADE_REPLY,    "CAM firmware upgrade reply" },
774
    { T_CAM_FIRMWARE_UPGRADE_PROGRESS, "CAM firmware upgrade progress" },
775
    { T_CAM_FIRMWARE_UPGRADE_COMPLETE, "CAM firmware upgrade complete" },
776
    { T_CC_OPEN_REQ,                   "CC open request" },
777
    { T_CC_OPEN_CNF,                   "CC open confirm" },
778
    { T_CC_DATA_REQ,                   "CC data request" },
779
    { T_CC_DATA_CNF,                   "CC data confirm" },
780
    { T_CC_SYNC_REQ,                   "CC sync request" },
781
    { T_CC_SYNC_CNF,                   "CC sync confirm" },
782
    { T_CC_SAC_DATA_REQ,               "CC SAC data request" },
783
    { T_CC_SAC_DATA_CNF,               "CC SAC data confirm" },
784
    { T_CC_SAC_SYNC_REQ,               "CC SAC sync request" },
785
    { T_CC_SAC_SYNC_CNF,               "CC SAC sync confirm" },
786
    { T_CC_PIN_CAPABILITIES_REQ,       "CC PIN capabilities request" },
787
    { T_CC_PIN_CAPABILITIES_REPLY,     "CC PIN capabilities reply" },
788
    { T_CC_PIN_CMD,                    "CC PIN command" },
789
    { T_CC_PIN_REPLY,                  "CC PIN reply" },
790
    { T_CC_PIN_EVENT,                  "CC PIN event" },
791
    { T_CC_PIN_PLAYBACK,               "CC PIN playback" },
792
    { T_CC_PIN_MMI_REQ,                "CC PIN MMI request" },
793
    { T_REQUEST_START,                 "Request start" },
794
    { T_REQUEST_START_ACK,             "Request start ack" },
795
    { T_FILE_REQUEST,                  "File request" },
796
    { T_FILE_ACKNOWLEDGE,              "File acknowledge" },
797
    { T_APP_ABORT_REQUEST,             "App abort request" },
798
    { T_APP_ABORT_ACK,                 "App abort ack" },
799
    { T_COMMS_CMD,                     "Comms command" },
800
    { T_COMMS_REPLY,                   "Comms reply" },
801
    { T_CONNECTION_DESCRIPTOR,         "Connection descriptor" },
802
    { T_COMMS_SEND_LAST,               "Comms send last" },
803
    { T_COMMS_SEND_MORE,               "Comms send more" },
804
    { T_COMMS_RCV_LAST,                "Comms receive last" },
805
    { T_COMMS_RCV_MORE,                "Comms receive more" },
806
    { T_COMMS_IP_CONFIG_REQ,           "Comms IP config request" },
807
    { T_COMMS_IP_CONFIG_REPLY,         "Comms IP config reply" },
808
    { T_AFS_FILE_SYSTEM_OFFER,         "File system offer" },
809
    { T_AFS_FILE_SYSTEM_ACK,           "File system ack" },
810
    { T_AFS_FILE_REQUEST,              "File request" },
811
    { T_AFS_FILE_ACKNOWLEDGE,          "File acknowledge" },
812
    { T_OPERATOR_STATUS_REQ,           "Operator status request" },
813
    { T_OPERATOR_STATUS,               "Operator status" },
814
    { T_OPERATOR_NIT_REQ,              "Operator NIT request" },
815
    { T_OPERATOR_NIT,                  "Operator NIT" },
816
    { T_OPERATOR_INFO_REQ,             "Operator info request" },
817
    { T_OPERATOR_INFO,                 "Operator info" },
818
    { T_OPERATOR_SEARCH_START,         "Operator search start" },
819
    { T_OPERATOR_SEARCH_STATUS,        "Operator search status" },
820
    { T_OPERATOR_EXIT,                 "Operator exit" },
821
    { T_OPERATOR_TUNE,                 "Operator tune" },
822
    { T_OPERATOR_TUNE_STATUS,          "Operator tune status" },
823
    { T_OPERATOR_ENTITLEMENT_ACK,      "Operator entitlement acknowledge" },
824
    { T_OPERATOR_SEARCH_CANCEL,        "Operator search cancel" },
825
    { T_SAS_CONNECT_RQST,              "SAS connect request" },
826
    { T_SAS_CONNECT_CNF,               "SAS connect confirm" },
827
    { T_SAS_ASYNC_MSG,                 "SAS async message" },
828
    { 0, NULL }
829
};
830
831
WS_DLL_PUBLIC_DEF const value_string dvbci_event[] = {
832
    { DVBCI_EVT_DATA_HOST_TO_CAM, "data transfer Host -> CAM" },
833
    { DVBCI_EVT_DATA_CAM_TO_HOST, "data transfer CAM -> Host" },
834
    { DVBCI_EVT_CIS_READ,         "read the Card Information Structure (CIS)" },
835
    { DVBCI_EVT_COR_WRITE,        "write into the Configuration Option Register (COR)" },
836
    { DVBCI_EVT_HW_EVT,           "hardware event" },
837
    { 0, NULL }
838
};
839
840
static int proto_dvbci;
841
842
static dissector_handle_t dvbci_handle;
843
844
static const char *dvbci_sek;
845
static const char *dvbci_siv;
846
static bool dvbci_dissect_lsc_msg;
847
848
/* the output of pref_key_string_to_bin() applied to dvbci_sek and _siv */
849
static unsigned char *dvbci_sek_bin;
850
static unsigned char *dvbci_siv_bin;
851
852
static dissector_handle_t data_handle;
853
static dissector_handle_t mpeg_pmt_handle;
854
static dissector_handle_t dvb_nit_handle;
855
static dissector_handle_t mime_handle;
856
static dissector_table_t tcp_dissector_table;
857
static dissector_table_t udp_dissector_table;
858
859
static int exported_pdu_tap = -1;
860
861
static int ett_dvbci;
862
static int ett_dvbci_hdr;
863
static int ett_dvbci_cis;
864
static int ett_dvbci_cis_tpl;
865
static int ett_dvbci_cis_subtpl;
866
static int ett_dvbci_link;
867
static int ett_dvbci_link_frag;
868
static int ett_dvbci_link_frags;
869
static int ett_dvbci_transport;
870
static int ett_dvbci_transport_frag;
871
static int ett_dvbci_transport_frags;
872
static int ett_dvbci_session;
873
static int ett_dvbci_res;
874
static int ett_dvbci_application;
875
static int ett_dvbci_es;
876
static int ett_dvbci_ca_desc;
877
static int ett_dvbci_text;
878
static int ett_dvbci_cc_item;
879
static int ett_dvbci_sac_msg_body;
880
static int ett_dvbci_ami_req_types;
881
static int ett_dvbci_lsc_conn_desc;
882
static int ett_dvbci_opp_cap_loop;
883
static int ett_dvbci_dlv_sys_hint;
884
885
886
static int hf_dvbci_hdr_ver;
887
static int hf_dvbci_event;
888
static int hf_dvbci_len;
889
static int hf_dvbci_hw_event;
890
static int hf_dvbci_cor_addr;
891
static int hf_dvbci_cor_val;
892
static int hf_dvbci_cis_tpl_code;
893
static int hf_dvbci_cis_tpl_len;
894
static int hf_dvbci_cis_tpl_data;
895
static int hf_dvbci_cis_tpll_v1_major;
896
static int hf_dvbci_cis_tpll_v1_minor;
897
static int hf_dvbci_cis_tpll_v1_info_manuf;
898
static int hf_dvbci_cis_tpll_v1_info_name;
899
static int hf_dvbci_cis_tpll_v1_info_additional;
900
static int hf_dvbci_cis_tpll_v1_end;
901
static int hf_dvbci_cis_tpcc_rfsz;
902
static int hf_dvbci_cis_tpcc_rmsz;
903
static int hf_dvbci_cis_tpcc_rasz;
904
static int hf_dvbci_cis_tpcc_last;
905
static int hf_dvbci_cis_tpcc_radr;
906
static int hf_dvbci_cis_tpcc_rmsk;
907
static int hf_dvbci_cis_st_code;
908
static int hf_dvbci_cis_st_len;
909
static int hf_dvbci_cis_stci_ifn_size;
910
static int hf_dvbci_cis_stci_ifn;
911
static int hf_dvbci_cis_stci_str;
912
static int hf_dvbci_cis_tpce_indx_intface;
913
static int hf_dvbci_cis_tpce_indx_default;
914
static int hf_dvbci_cis_tpce_indx_cnf_entry;
915
static int hf_dvbci_cis_tpce_if_type;
916
static int hf_dvbci_cis_tpce_fs_mem_space;
917
static int hf_dvbci_cis_tpce_fs_irq;
918
static int hf_dvbci_cis_tpce_fs_io;
919
static int hf_dvbci_cis_dev_vcc_used;
920
static int hf_dvbci_cis_dev_mwait;
921
static int hf_dvbci_cis_dev_oth_cond_info;
922
static int hf_dvbci_cis_tplmid_manf;
923
static int hf_dvbci_cis_tplmid_card;
924
static int hf_dvbci_buf_size;
925
static int hf_dvbci_tcid;
926
static int hf_dvbci_ml;
927
static int hf_dvbci_l_frags;
928
static int hf_dvbci_l_frag;
929
static int hf_dvbci_l_frag_overlap;
930
static int hf_dvbci_l_frag_overlap_conflicts;
931
static int hf_dvbci_l_frag_multiple_tails;
932
static int hf_dvbci_l_frag_too_long_frag;
933
static int hf_dvbci_l_frag_err;
934
static int hf_dvbci_l_frag_cnt;
935
static int hf_dvbci_l_reass_in;
936
static int hf_dvbci_l_reass_len;
937
static int hf_dvbci_c_tpdu_tag;
938
static int hf_dvbci_r_tpdu_tag;
939
static int hf_dvbci_t_c_id;
940
static int hf_dvbci_sb_tag;
941
static int hf_dvbci_sb_value;
942
static int hf_dvbci_t_frags;
943
static int hf_dvbci_t_frag;
944
static int hf_dvbci_t_frag_overlap;
945
static int hf_dvbci_t_frag_overlap_conflicts;
946
static int hf_dvbci_t_frag_multiple_tails;
947
static int hf_dvbci_t_frag_too_long_frag;
948
static int hf_dvbci_t_frag_err;
949
static int hf_dvbci_t_frag_cnt;
950
static int hf_dvbci_t_reass_in;
951
static int hf_dvbci_t_reass_len;
952
static int hf_dvbci_spdu_tag;
953
static int hf_dvbci_sess_status;
954
static int hf_dvbci_sess_nb;
955
static int hf_dvbci_close_sess_status;
956
static int hf_dvbci_res_id;
957
static int hf_dvbci_res_id_type;
958
static int hf_dvbci_res_class;
959
static int hf_dvbci_res_type;
960
static int hf_dvbci_res_ver;
961
static int hf_dvbci_apdu_tag;
962
static int hf_dvbci_app_type;
963
static int hf_dvbci_app_manf;
964
static int hf_dvbci_manf_code;
965
static int hf_dvbci_menu_str_len;
966
static int hf_dvbci_ap_char_tbl;
967
static int hf_dvbci_menu_str;
968
static int hf_dvbci_data_rate;
969
static int hf_dvbci_ca_sys_id;
970
static int hf_dvbci_ca_pmt_list_mgmt;
971
static int hf_dvbci_prog_num;
972
static int hf_dvbci_ca_ver;
973
static int hf_dvbci_curr_next;
974
static int hf_dvbci_prog_info_len;
975
static int hf_dvbci_stream_type;
976
static int hf_dvbci_es_pid;
977
static int hf_dvbci_es_info_len;
978
static int hf_dvbci_ca_pmt_cmd_id;
979
static int hf_dvbci_descr_len;
980
static int hf_dvbci_ca_pid;
981
static int hf_dvbci_ca_priv_data;
982
static int hf_dvbci_ca_enable_flag;
983
static int hf_dvbci_ca_enable;
984
static int hf_dvbci_auth_proto_id;
985
static int hf_dvbci_auth_req_bytes;
986
static int hf_dvbci_auth_resp_bytes;
987
static int hf_dvbci_network_id;
988
static int hf_dvbci_original_network_id;
989
static int hf_dvbci_transport_stream_id;
990
static int hf_dvbci_service_id;
991
static int hf_dvbci_replacement_ref;
992
static int hf_dvbci_replaced_pid;
993
static int hf_dvbci_replacement_pid;
994
static int hf_dvbci_pmt_flag;
995
static int hf_dvbci_hc_desc_loop_len;
996
static int hf_dvbci_hc_status;
997
static int hf_dvbci_hc_release_reply;
998
static int hf_dvbci_resp_intv;
999
static int hf_dvbci_utc_time;
1000
static int hf_dvbci_local_offset;
1001
static int hf_dvbci_close_mmi_cmd_id;
1002
static int hf_dvbci_close_mmi_delay;
1003
static int hf_dvbci_disp_ctl_cmd;
1004
static int hf_dvbci_mmi_mode;
1005
static int hf_dvbci_disp_rep_id;
1006
static int hf_dvbci_mmi_char_tbl;
1007
static int hf_dvbci_blind_ans;
1008
static int hf_dvbci_ans_txt_len;
1009
static int hf_dvbci_enq;
1010
static int hf_dvbci_ans_id;
1011
static int hf_dvbci_ans;
1012
static int hf_dvbci_choice_nb;
1013
static int hf_dvbci_choice_ref;
1014
static int hf_dvbci_item_nb;
1015
static int hf_dvbci_title;
1016
static int hf_dvbci_subtitle;
1017
static int hf_dvbci_bottom;
1018
static int hf_dvbci_item;
1019
static int hf_dvbci_host_country;
1020
static int hf_dvbci_host_language;
1021
static int hf_dvbci_cup_type;
1022
static int hf_dvbci_cup_download_time;
1023
static int hf_dvbci_cup_answer;
1024
static int hf_dvbci_cup_progress;
1025
static int hf_dvbci_cup_reset;
1026
static int hf_dvbci_cc_sys_id_bitmask;
1027
static int hf_dvbci_cc_snd_dat_nbr;
1028
static int hf_dvbci_cc_req_dat_nbr;
1029
static int hf_dvbci_cc_dat_id;
1030
static int hf_dvbci_cc_dat_len;
1031
static int hf_dvbci_brand_cert;
1032
static int hf_dvbci_dev_cert;
1033
static int hf_dvbci_uri_ver;
1034
static int hf_dvbci_uri_aps;
1035
static int hf_dvbci_uri_emi;
1036
static int hf_dvbci_uri_ict;
1037
static int hf_dvbci_uri_rct;
1038
static int hf_dvbci_uri_dot;
1039
static int hf_dvbci_uri_rl;
1040
static int hf_dvbci_cc_key_register;
1041
static int hf_dvbci_cc_status_field;
1042
static int hf_dvbci_cc_op_mode;
1043
static int hf_dvbci_cc_data;
1044
static int hf_dvbci_sac_msg_ctr;
1045
static int hf_dvbci_sac_proto_ver;
1046
static int hf_dvbci_sac_auth_cip;
1047
static int hf_dvbci_sac_payload_enc;
1048
static int hf_dvbci_sac_enc_cip;
1049
static int hf_dvbci_sac_payload_len;
1050
static int hf_dvbci_sac_enc_body;
1051
static int hf_dvbci_sac_padding;
1052
static int hf_dvbci_sac_signature;
1053
static int hf_dvbci_rating;
1054
static int hf_dvbci_capability_field;
1055
static int hf_dvbci_pin_chg_time;
1056
static int hf_dvbci_pincode_status;
1057
static int hf_dvbci_cc_prog_num;
1058
static int hf_dvbci_pin_evt_time;
1059
static int hf_dvbci_pin_evt_cent;
1060
static int hf_dvbci_cc_priv_data;
1061
static int hf_dvbci_pincode;
1062
static int hf_dvbci_app_dom_id_len;
1063
static int hf_dvbci_init_obj_len;
1064
static int hf_dvbci_app_dom_id;
1065
static int hf_dvbci_init_obj;
1066
static int hf_dvbci_ack_code;
1067
static int hf_dvbci_req_type;
1068
static int hf_dvbci_file_hash;
1069
static int hf_dvbci_file_name_len;
1070
static int hf_dvbci_file_name;
1071
static int hf_dvbci_file_data_len;
1072
static int hf_dvbci_ami_priv_data;
1073
static int hf_dvbci_req_ok;
1074
static int hf_dvbci_file_ok;
1075
static int hf_dvbci_abort_req_code;
1076
static int hf_dvbci_abort_ack_code;
1077
static int hf_dvbci_phase_id;
1078
static int hf_dvbci_comms_rep_id;
1079
static int hf_dvbci_lsc_buf_size;
1080
static int hf_dvbci_lsc_ret_val;
1081
static int hf_dvbci_comms_cmd_id;
1082
static int hf_dvbci_conn_desc_type;
1083
static int hf_dvbci_lsc_media_tag;
1084
static int hf_dvbci_lsc_media_len;
1085
static int hf_dvbci_lsc_media_data;
1086
static int hf_dvbci_lsc_ip_ver;
1087
static int hf_dvbci_lsc_ipv4_addr;
1088
static int hf_dvbci_lsc_ipv6_addr;
1089
static int hf_dvbci_lsc_dst_port;
1090
static int hf_dvbci_lsc_proto;
1091
static int hf_dvbci_lsc_hostname;
1092
static int hf_dvbci_lsc_retry_count;
1093
static int hf_dvbci_lsc_timeout;
1094
static int hf_dvbci_lsc_conn_state;
1095
static int hf_dvbci_lsc_phys_addr;
1096
static int hf_dvbci_lsc_netmask;
1097
static int hf_dvbci_lsc_gateway;
1098
static int hf_dvbci_lsc_dhcp_srv;
1099
static int hf_dvbci_lsc_num_dns_srv;
1100
static int hf_dvbci_lsc_dns_srv;
1101
static int hf_dvbci_afs_dom_id;
1102
static int hf_dvbci_afs_ack_code;
1103
static int hf_dvbci_info_ver_op_status;
1104
static int hf_dvbci_nit_ver;
1105
static int hf_dvbci_pro_typ;
1106
static int hf_dvbci_init_flag;
1107
static int hf_dvbci_ent_chg_flag;
1108
static int hf_dvbci_ent_val_flag;
1109
static int hf_dvbci_ref_req_flag;
1110
static int hf_dvbci_err_flag;
1111
static int hf_dvbci_dlv_sys_hint;
1112
static int hf_dvbci_dlv_sys_hint_t;
1113
static int hf_dvbci_dlv_sys_hint_s;
1114
static int hf_dvbci_dlv_sys_hint_c;
1115
static int hf_dvbci_refr_req_date;
1116
static int hf_dvbci_refr_req_time;
1117
static int hf_dvbci_nit_loop_len;
1118
static int hf_dvbci_info_valid;
1119
static int hf_dvbci_info_ver_op_info;
1120
static int hf_dvbci_cicam_onid;
1121
static int hf_dvbci_cicam_id;
1122
static int hf_dvbci_opp_char_tbl;
1123
static int hf_dvbci_sdt_rst_trusted;
1124
static int hf_dvbci_eit_rst_trusted;
1125
static int hf_dvbci_eit_pf_usage;
1126
static int hf_dvbci_eit_sch_usage;
1127
static int hf_dvbci_ext_evt_usage;
1128
static int hf_dvbci_sdt_oth_trusted;
1129
static int hf_dvbci_eit_evt_trigger;
1130
static int hf_dvbci_opp_lang_code;
1131
static int hf_dvbci_prof_name;
1132
static int hf_dvbci_unattended;
1133
static int hf_dvbci_opp_svc_type_loop_len;
1134
static int hf_dvbci_opp_svc_type;
1135
static int hf_dvbci_dlv_cap_loop_len;
1136
static int hf_dvbci_dlv_cap_byte;
1137
static int hf_dvbci_app_cap_loop_len;
1138
static int hf_dvbci_app_cap_bytes;
1139
static int hf_dvbci_desc_num;
1140
static int hf_dvbci_sig_strength;
1141
static int hf_dvbci_sig_qual;
1142
static int hf_dvbci_opp_tune_status;
1143
static int hf_dvbci_opp_desc_loop_len;
1144
static int hf_dvbci_sas_app_id;
1145
static int hf_dvbci_sas_sess_state;
1146
static int hf_dvbci_sas_msg_nb;
1147
static int hf_dvbci_sas_msg_len;
1148
1149
static int * const dvb_ci_res_id_fields[] = {
1150
  &hf_dvbci_res_id_type,
1151
  &hf_dvbci_res_class,
1152
  &hf_dvbci_res_type,
1153
  &hf_dvbci_res_ver,
1154
  NULL
1155
};
1156
1157
static int * const dvbci_opp_dlv_sys_hint_fields[] = {
1158
    &hf_dvbci_dlv_sys_hint_t,
1159
    &hf_dvbci_dlv_sys_hint_s,
1160
    &hf_dvbci_dlv_sys_hint_c,
1161
    NULL
1162
};
1163
1164
1165
static expert_field ei_dvbci_cor_addr;
1166
static expert_field ei_dvbci_buf_size;
1167
static expert_field ei_dvbci_ml;
1168
static expert_field ei_dvbci_c_tpdu_tag;
1169
static expert_field ei_dvbci_r_tpdu_status_mandatory;
1170
static expert_field ei_dvbci_r_tpdu_tag;
1171
static expert_field ei_dvbci_sb_value;
1172
static expert_field ei_dvbci_t_c_id;
1173
static expert_field ei_dvbci_tpdu_status_tag;
1174
static expert_field ei_dvbci_spdu_tag;
1175
static expert_field ei_dvbci_spdu_cam_to_host;
1176
static expert_field ei_dvbci_spdu_host_to_cam;
1177
static expert_field ei_dvbci_apdu_tag;
1178
static expert_field ei_dvbci_apu_cam_to_host;
1179
static expert_field ei_dvbci_apu_host_to_cam;
1180
static expert_field ei_dvbci_apdu_not_supported;
1181
static expert_field ei_dvbci_res_ver;
1182
static expert_field ei_dvbci_res_class;
1183
static expert_field ei_dvbci_bad_length;
1184
static expert_field ei_dvbci_invalid_char_tbl;
1185
static expert_field ei_dvbci_no_ca_desc_es;
1186
static expert_field ei_dvbci_no_ca_desc_prog;
1187
static expert_field ei_dvbci_ca_pmt_cmd_id;
1188
static expert_field ei_dvbci_time_offs_unknown;
1189
static expert_field ei_dvbci_not_text_more_or_text_last;
1190
static expert_field ei_dvbci_network_id;
1191
static expert_field ei_dvbci_cc_pin_nvr_chg;
1192
static expert_field ei_dvbci_pin_evt_cent;
1193
static expert_field ei_dvbci_sac_payload_enc;
1194
static expert_field ei_dvbci_sig_qual;
1195
static expert_field ei_dvbci_cicam_nit_table_id;
1196
static expert_field ei_dvbci_cup_progress;
1197
1198
static dissector_table_t sas_msg_dissector_table;
1199
1200
static reassembly_table tpdu_reassembly_table;
1201
static reassembly_table spdu_reassembly_table;
1202
1203
static const fragment_items tpdu_frag_items = {
1204
    &ett_dvbci_link_frag,
1205
    &ett_dvbci_link_frags,
1206
1207
    &hf_dvbci_l_frags,
1208
    &hf_dvbci_l_frag,
1209
    &hf_dvbci_l_frag_overlap,
1210
    &hf_dvbci_l_frag_overlap_conflicts,
1211
    &hf_dvbci_l_frag_multiple_tails,
1212
    &hf_dvbci_l_frag_too_long_frag,
1213
    &hf_dvbci_l_frag_err,
1214
    &hf_dvbci_l_frag_cnt,
1215
1216
    &hf_dvbci_l_reass_in,
1217
    &hf_dvbci_l_reass_len,
1218
    /* Reassembled data field */
1219
    NULL,
1220
    "Tpdu fragments"
1221
};
1222
static const fragment_items spdu_frag_items = {
1223
    &ett_dvbci_transport_frag,
1224
    &ett_dvbci_transport_frags,
1225
1226
    &hf_dvbci_t_frags,
1227
    &hf_dvbci_t_frag,
1228
    &hf_dvbci_t_frag_overlap,
1229
    &hf_dvbci_t_frag_overlap_conflicts,
1230
    &hf_dvbci_t_frag_multiple_tails,
1231
    &hf_dvbci_t_frag_too_long_frag,
1232
    &hf_dvbci_t_frag_err,
1233
    &hf_dvbci_t_frag_cnt,
1234
1235
    &hf_dvbci_t_reass_in,
1236
    &hf_dvbci_t_reass_len,
1237
    /* Reassembled data field */
1238
    NULL,
1239
    "Spdu fragments"
1240
};
1241
1242
1243
1244
typedef struct _spdu_info_t {
1245
    uint8_t tag;
1246
    uint8_t direction;
1247
    uint8_t len_field;
1248
} spdu_info_t;
1249
1250
static const value_string dvbci_hw_event[] = {
1251
    { CAM_IN,    "CI Module is inserted" },
1252
    { CAM_OUT,   "CI Module is removed" },
1253
    { POWER_ON,  "CI slot power on" },
1254
    { POWER_OFF, "CI slot power off" },
1255
    { TS_ROUTE,  "Transport stream routed through the CI Module" },
1256
    { TS_BYPASS, "Transport stream bypasses the CI Module" },
1257
    { RESET_H,   "Reset pin is high" },
1258
    { RESET_L,   "Reset pin is low" },
1259
    { READY_H,   "Ready pin is high" },
1260
    { READY_L,   "Ready pin is low" },
1261
    { 0, NULL }
1262
};
1263
static const value_string dvbci_cis_tpl_code[] = {
1264
    { CISTPL_NO_LINK, "No-link tuple" },
1265
    { CISTPL_VERS_1, "Level 1 version/product information" },
1266
    { CISTPL_CONFIG, "Configuration for a 16bit PC-Card" },
1267
    { CISTPL_CFTABLE_ENTRY, "Configuration-table entry" },
1268
    { CISTPL_DEVICE_OC, "Device information for Common Memory" },
1269
    { CISTPL_DEVICE_OA, "Device information for Attribute Memory" },
1270
    { CISTPL_MANFID, "Manufacturer identification string" },
1271
    { CISTPL_END, "End of chain" },
1272
    { 0, NULL }
1273
};
1274
static const value_string dvbci_cis_subtpl_code[] = {
1275
    { CCSTPL_CIF, "Custom interface subtuple" },
1276
    { 0, NULL }
1277
};
1278
static const value_string dvbci_cis_tpce_if_type[] = {
1279
    { TPCE_IF_TYPE_MEM,    "Memory" },
1280
    { TPCE_IF_TYPE_IO_MEM, "I/O and Memory" },
1281
    { TPCE_IF_TYPE_CUST0,  "Custom Interface 0" },
1282
    { TPCE_IF_TYPE_CUST1,  "Custom Interface 1" },
1283
    { TPCE_IF_TYPE_CUST2,  "Custom Interface 2" },
1284
    { TPCE_IF_TYPE_CUST3,  "Custom Interface 3" },
1285
    { 0, NULL }
1286
};
1287
static const value_string dvbci_cis_dev_vcc_used[] = {
1288
    { CIS_DEV_VCC50, "5.0V" },
1289
    { CIS_DEV_VCC33, "3.3V" },
1290
    { 0, NULL }
1291
};
1292
static const value_string dvbci_ml[] = {
1293
    { ML_MORE, "more TPDU fragments pending" },
1294
    { ML_LAST, "last TPDU fragment" },
1295
    { 0, NULL }
1296
};
1297
static const value_string dvbci_c_tpdu[] = {
1298
    { T_RCV, "T_RCV" },
1299
    { T_CREATE_T_C,  "T_create_t_c" },
1300
    { T_DELETE_T_C,  "T_delete_t_c" },
1301
    { T_D_T_C_REPLY, "T_d_t_c_reply" },
1302
    { T_NEW_T_C,     "T_new_t_c" },
1303
    { T_T_C_ERROR,   "T_t_c_error" },
1304
    { T_DATA_LAST,   "T_data_last" },
1305
    { T_DATA_MORE,   "T_data_more" },
1306
    { 0, NULL }
1307
};
1308
static const value_string dvbci_r_tpdu[] = {
1309
    { T_C_T_C_REPLY, "T_c_tc_reply" },
1310
    { T_DELETE_T_C,  "T_delete_t_c" },
1311
    { T_D_T_C_REPLY, "T_d_t_c_reply" },
1312
    { T_REQUEST_T_C, "T_request_t_c" },
1313
    { T_DATA_LAST,   "T_data_last" },
1314
    { T_DATA_MORE,   "T_data_more" },
1315
    { 0, NULL }
1316
};
1317
static const value_string dvbci_sb_value[] = {
1318
    { SB_VAL_MSG_AVAILABLE,    "message available" },
1319
    { SB_VAL_NO_MSG_AVAILABLE, "no message available" },
1320
    { 0, NULL }
1321
};
1322
static const value_string dvbci_spdu_tag[] = {
1323
    { T_SESSION_NUMBER,          "Session Number (payload data)" },
1324
    { T_OPEN_SESSION_REQUEST,    "Open Session Request" },
1325
    { T_OPEN_SESSION_RESPONSE,   "Open Session Response" },
1326
    { T_CREATE_SESSION,          "Create Session" },
1327
    { T_CREATE_SESSION_RESPONSE, "Create Session Response" },
1328
    { T_CLOSE_SESSION_REQUEST,   "Close Session Request" },
1329
    { T_CLOSE_SESSION_RESPONSE,  "Close Session Response" },
1330
    { 0, NULL }
1331
};
1332
static GHashTable *spdu_table;
1333
static const spdu_info_t spdu_info[] = {
1334
    { T_SESSION_NUMBER,          DIRECTION_ANY, 2 },
1335
    { T_OPEN_SESSION_REQUEST,    DATA_CAM_TO_HOST, 4 },
1336
    { T_OPEN_SESSION_RESPONSE,   DATA_HOST_TO_CAM, 7 },
1337
    { T_CREATE_SESSION,          DATA_HOST_TO_CAM, 6 },
1338
    { T_CREATE_SESSION_RESPONSE, DATA_CAM_TO_HOST, 7 },
1339
    { T_CLOSE_SESSION_REQUEST,   DIRECTION_ANY, 2 },
1340
    { T_CLOSE_SESSION_RESPONSE,  DIRECTION_ANY, 3 }
1341
};
1342
static const value_string dvbci_sess_status[] = {
1343
    { SESS_OPENED,
1344
      "Session opened" },
1345
    { SESS_NOT_OPENED_RES_NON_EXIST,
1346
      "Resource does not exist" },
1347
    { SESS_NOT_OPENED_RES_UNAVAIL,
1348
      "Resource exists but it's unavailable" },
1349
    { SESS_NOT_OPENED_RES_VER_LOWER,
1350
      "Existing resource's version is lower than requested version" },
1351
    { SESS_NOT_OPENED_RES_BUSY,
1352
      "Resource is busy" },
1353
    { 0, NULL }
1354
};
1355
static const value_string dvbci_close_sess_status[] = {
1356
    { SESS_CLOSED,       "Session closed" },
1357
    { SESS_NB_NOT_ALLOC, "Session number not allocated" },
1358
    { 0, NULL }
1359
};
1360
static const value_string dvbci_res_class[] = {
1361
    { RES_CLASS_RM,  "Resource Manager" },
1362
    { RES_CLASS_AP,  "Application Info" },
1363
    { RES_CLASS_CA,  "Conditional Access" },
1364
    { RES_CLASS_AUT, "Authentication" },
1365
    { RES_CLASS_HC,  "Host Control" },
1366
    { RES_CLASS_DT,  "Date-Time" },
1367
    { RES_CLASS_MMI, "Man-machine interface (MMI)" },
1368
    { RES_CLASS_AMI, "Application MMI" },
1369
    { RES_CLASS_LSC, "Low-Speed Communication" },
1370
    { RES_CLASS_CC,  "Content Control" },
1371
    { RES_CLASS_HLC, "Host Language & Country" },
1372
    { RES_CLASS_CUP, "CAM Upgrade" },
1373
    { RES_CLASS_OPP, "Operator Profile" },
1374
    { RES_CLASS_AFS, "Auxiliary File System" },
1375
    { RES_CLASS_SAS, "Specific Application Support" },
1376
    { 0, NULL }
1377
};
1378
static const value_string dvbci_app_type[] = {
1379
    { APP_TYPE_CA,  "Conditional Access" },
1380
    { APP_TYPE_EPG, "Electronic Program Guide" },
1381
    { 0, NULL }
1382
};
1383
static const value_string dvbci_data_rate[] = {
1384
    { DATA_RATE_72, "72 Mbit/s" },
1385
    { DATA_RATE_96, "96 Mbit/s" },
1386
    { 0, NULL }
1387
};
1388
static const value_string dvbci_ca_pmt_list_mgmt[] = {
1389
    { LIST_MGMT_MORE,   "more" },
1390
    { LIST_MGMT_FIRST,  "first" },
1391
    { LIST_MGMT_LAST,   "last" },
1392
    { LIST_MGMT_ONLY,   "only" },
1393
    { LIST_MGMT_ADD,    "add" },
1394
    { LIST_MGMT_UPDATE, "update" },
1395
    { 0, NULL }
1396
};
1397
static const value_string dvbci_ca_pmt_cmd_id[] = {
1398
    { CMD_ID_OK_DESCR,     "ok descrambling" },
1399
    { CMD_ID_OK_MMI,       "ok mmi" },
1400
    { CMD_ID_QUERY,        "query" },
1401
    { CMD_ID_NOT_SELECTED, "not selected" },
1402
    { 0, NULL }
1403
};
1404
static const value_string dvbci_ca_enable[] = {
1405
    { CA_ENAB_DESC_OK, "descrambling possible" },
1406
    { CA_ENAB_DESC_OK_PURCHASE,
1407
        "descrambling possible under conditions (purchase dialogue)" },
1408
    { CA_ENAB_DESC_OK_TECH,
1409
        "descrambling possible under conditions (technical dialogue)" },
1410
    { CA_ENAB_DESC_NG_ENTITLEMENT,
1411
        "descrambling not possible (because no entitlement)" },
1412
    { CA_ENAB_DESC_NG_TECH,
1413
        "descrambling not possible (for technical reasons)" },
1414
    { 0, NULL }
1415
};
1416
static const value_string dvbci_hc_status[] = {
1417
    { HC_STAT_OK, "ok" },
1418
    { HC_STAT_ERR_DLVRY, "unsupported delivery system descriptor" },
1419
    { HC_STAT_ERR_LOCK, "tuner not locking" },
1420
    { HC_STAT_ERR_BUSY, "tuner busy" },
1421
    { HC_STAT_ERR_PARAM, "bad or missing parameters" },
1422
    { HC_STAT_ERR_NOT_FOUND, "service not found" },
1423
    { HC_STAT_ERR_UNKNOWN, "unknown error" },
1424
    { 0, NULL }
1425
};
1426
static const value_string dvbci_hc_release_reply[] = {
1427
    { HC_RELEASE_OK, "Host regains control of the tuner" },
1428
    { HC_RELEASE_REFUSED, "CICAM retains control of the tuner" },
1429
    { 0, NULL }
1430
};
1431
static const value_string dvbci_close_mmi_cmd_id[] = {
1432
    { CLOSE_MMI_CMD_ID_IMMEDIATE, "immediate close" },
1433
    { CLOSE_MMI_CMD_ID_DELAY, "delayed close" },
1434
    { 0, NULL }
1435
};
1436
static const value_string dvbci_disp_ctl_cmd[] = {
1437
    { DISP_CMD_SET_MMI_MODE, "set MMI mode" },
1438
    { DISP_CMD_GET_DISP_TBL, "get display character tables" },
1439
    { DISP_CMD_GET_INP_TBL,  "get input character tables" },
1440
    { 0, NULL }
1441
};
1442
static const value_string dvbci_mmi_mode[] = {
1443
    { MMI_MODE_HIGH, "High-level MMI" },
1444
    { 0, NULL }
1445
};
1446
static const value_string dvbci_disp_rep_id[] = {
1447
    { DISP_REP_ID_MMI_MODE_ACK,     "MMI mode acknowledge" },
1448
    { DISP_REP_ID_DISP_CHAR_TBL,    "list display character tables" },
1449
    { DISP_REP_ID_INP_CHAR_TBL,     "list input character tables" },
1450
    { DISP_REP_ID_UNKNOWN_CMD,      "unknown display control command" },
1451
    { DISP_REP_ID_UNKNOWN_MMI_MODE, "unknown MMI mode" },
1452
    { DISP_REP_ID_UNKNOWN_CHAR_TBL, "unknown character table" },
1453
    { 0, NULL }
1454
};
1455
static const value_string dvbci_blind_ans[] = {
1456
    { VISIBLE_ANS, "visible" },
1457
    { BLIND_ANS,   "blind" },
1458
    { 0, NULL }
1459
};
1460
static const value_string dvbci_ans_id[] = {
1461
    { ANSW_ID_CANCEL, "cancel" },
1462
    { ANSW_ID_ANSWER, "answer" },
1463
    { 0, NULL }
1464
};
1465
static const value_string dvbci_cup_type[] = {
1466
    { CUP_DELAYED, "delayed" },
1467
    { CUP_IMMEDIATE, "immediate" },
1468
    { 0, NULL }
1469
};
1470
static const value_string dvbci_cup_answer[] = {
1471
    { CUP_ANS_NO,  "upgrade denied" },
1472
    { CUP_ANS_YES, "upgrade allowed" },
1473
    { CUP_ANS_ASK, "ask the user for permission" },
1474
    { 0, NULL }
1475
};
1476
static const value_string dvbci_cup_reset[] = {
1477
    { CUP_RESET_PCMCIA, "PCMCIA reset" },
1478
    { CUP_RESET_CMDIF,  "CI command interface reset" },
1479
    { CUP_RESET_NONE,   "no reset" },
1480
    { 0, NULL }
1481
};
1482
static const value_string dvbci_cc_dat_id[] = {
1483
    { CC_ID_HOST_ID,            "Host ID" },
1484
    { CC_ID_CICAM_ID,           "Cicam ID" },
1485
    { CC_ID_HOST_BRAND_CERT,    "Host brand certificate" },
1486
    { CC_ID_CICAM_BRAND_CERT,   "Cicam brand certificate" },
1487
    { CC_ID_KP,                 "Key precursor for CCK" },
1488
    { CC_ID_DHPH,               "Host Diffie-Hellman public key" },
1489
    { CC_ID_DHPM,               "Cicam Diffie-Hellman public key" },
1490
    { CC_ID_HOST_DEV_CERT,      "Host device certificate" },
1491
    { CC_ID_CICAM_DEV_CERT,     "Cicam device certificate" },
1492
    { CC_ID_SIG_A,              "Signature of host Diffie-Hellman public key" },
1493
    { CC_ID_SIG_B,              "Signature of cicam Diffie-Hellman public key" },
1494
    { CC_ID_NS_HOST,            "Host nonce" },
1495
    { CC_ID_AUTH_NONCE,         "Nonce for authentication" },
1496
    { CC_ID_NS_MODULE,          "Cicam nonce" },
1497
    { CC_ID_AKH,                "Host authentication key" },
1498
    { CC_ID_URI,                "URI" },
1499
    { CC_ID_PROG_NUM,           "Program number" },
1500
    { CC_ID_URI_CNF,            "URI confirmation" },
1501
    { CC_ID_KEY_REGISTER,       "Key register" },
1502
    { CC_ID_URI_VERSIONS,       "Supported URI versions" },
1503
    { CC_ID_STATUS_FIELD,       "Status field" },
1504
    { CC_ID_SRM_DATA,           "SRM for HDCP" },
1505
    { CC_ID_SRM_CONFIRM,        "SRM confirmation hash" },
1506
    { CC_ID_CICAM_LICENSE,      "License received from the cicam" },
1507
    { CC_ID_LICENSE_STATUS,     "Current status of the license" },
1508
    { CC_ID_LICENSE_RCV_STATUS, "Status of the license exchange" },
1509
    { CC_ID_HOST_LICENSE,
1510
        "License for which the host requests the current status" },
1511
    { CC_ID_PLAY_COUNT,         "Play count" },
1512
    { CC_ID_OPERATING_MODE,     "Operating mode" },
1513
    { CC_ID_PINCODE_DATA,       "Pincode data" },
1514
    { CC_ID_REC_START_STATUS,   "Record start status" },
1515
    { CC_ID_MODE_CHG_STATUS,    "Change operating mode status" },
1516
    { CC_ID_REC_STOP_STATUS,    "Record stop status" },
1517
    { 0, NULL }
1518
};
1519
static const value_string dvbci_cc_uri_emi[] = {
1520
    { CC_EMI_FREE,    "Copy free" },
1521
    { CC_EMI_NO_MORE, "Copy no more" },
1522
    { CC_EMI_ONCE,    "Copy once" },
1523
    { CC_EMI_NEVER,   "Copy never" },
1524
    { 0, NULL }
1525
};
1526
static const value_string dvbci_cc_key_register[] = {
1527
    { CC_KEY_EVEN,  "Even" },
1528
    { CC_KEY_ODD,   "Odd" },
1529
    { 0, NULL }
1530
};
1531
static const value_string dvbci_cc_status[] = {
1532
    { CC_STATUS_OK,                    "Ok" },
1533
    { CC_STATUS_NO_CC_SUPPORT,         "No CC support" },
1534
    { CC_STATUS_HOST_BUSY,             "Host busy" },
1535
    { CC_STATUS_AUTH_FAILED_OR_NO_SRM, "Authentication failed / SRM not required" },
1536
    { CC_STATUS_CICAM_BUSY,            "CICAM busy" },
1537
    { CC_STATUS_REC_MODE_ERR,          "Recording mode error" },
1538
    { 0, NULL }
1539
};
1540
static const value_string dvbci_cc_sac_auth[] = {
1541
    { CC_SAC_AUTH_AES128_XCBC_MAC, "AES 128 XCBC MAC" },
1542
    { 0, NULL }
1543
};
1544
static const value_string dvbci_cc_sac_enc[] = {
1545
    { CC_SAC_ENC_AES128_CBC, "AES 128 CBC" },
1546
    { 0, NULL }
1547
};
1548
static const value_string dvbci_cc_cap[] = {
1549
    { CC_CAP_NONE,
1550
        "No PIN handling capability" },
1551
    { CC_CAP_CAS_PIN,
1552
        "CAM can do PIN handling on CAS services" },
1553
    { CC_CAP_CAS_FTA_PIN,
1554
        "CAM can do PIN handling on CAS and free services" },
1555
    { CC_CAP_CAS_PIN_CACHED,
1556
        "CAM can do PIN handling on CAS services and supports PIN caching" },
1557
    { CC_CAP_CAS_FTA_PIN_CACHED,
1558
        "CAM can do PIN handling on CAS and free services, supports PIN caching" },
1559
    { 0, NULL }
1560
};
1561
static const value_string dvbci_pincode_status[] = {
1562
    { CC_PIN_BAD,         "Bad pin code" },
1563
    { CC_PIN_CAM_BUSY,    "CAM busy" },
1564
    { CC_PIN_OK,          "Pin code correct" },
1565
    { CC_PIN_UNCONFIRMED, "Pin code unconfirmed" },
1566
    { CC_PIN_VB_NOT_REQ,  "Video blanking not required" },
1567
    { CC_PIN_CSA,         "Content still CSA scrambled" },
1568
    { 0, NULL }
1569
};
1570
static const value_string dvbci_cc_op_mode[] = {
1571
    { CC_OP_MODE_WATCH_BUFFER, "Watch and buffer" },
1572
    { CC_OP_MODE_TIMESHIFT,    "Timeshift" },
1573
    { CC_OP_MODE_UNATTENDED,   "Unattended recording" },
1574
    { 0, NULL }
1575
};
1576
static const value_string dvbci_ack_code[] = {
1577
    { ACK_CODE_OK, "Ok" },
1578
    { ACK_CODE_WRONG_API,  "Application Domain unsupported" },
1579
    { ACK_CODE_API_BUSY,   "Application Domain currently unavailable" },
1580
    { 0, NULL }
1581
};
1582
static const value_string dvbci_req_type[] = {
1583
    { REQ_TYPE_FILE, "File" },
1584
    { REQ_TYPE_DATA, "Data" },
1585
    { REQ_TYPE_FILE_HASH, "FileHash" },
1586
    { REQ_TYPE_REQ, "List supported request types" },
1587
    { 0, NULL }
1588
};
1589
static const value_string dvbci_comms_cmd_id[] = {
1590
    { COMMS_CMD_ID_CONNECT_ON_CHANNEL, "connect on channel" },
1591
    { COMMS_CMD_ID_DISCONNECT_ON_CHANNEL, "disconnect on channel" },
1592
    { COMMS_CMD_ID_SET_PARAMS, "set parameters" },
1593
    { COMMS_CMD_ID_ENQUIRE_STATUS, "status enquiry" },
1594
    { COMMS_CMD_ID_GET_NEXT_BUFFER, "get next buffer" },
1595
    { 0, NULL }
1596
};
1597
static const value_string dvbci_conn_desc_type[] = {
1598
    { CONN_DESC_TEL, "DVB-SI telephone descriptor" },
1599
    { CONN_DESC_CABLE, "cable return channel" },
1600
    { CONN_DESC_IP, "IP descriptor" },
1601
    { CONN_DESC_HOSTNAME, "hostname descriptor" },
1602
    { 0, NULL }
1603
};
1604
static const value_string dvbci_lsc_desc_tag[] = {
1605
    { LSC_DESC_IP, "IP descriptor" },
1606
    { LSC_DESC_HOSTNAME, "hostname descriptor" },
1607
    { 0, NULL }
1608
};
1609
static const value_string dvbci_lsc_ip_ver[] = {
1610
    { LSC_IPV4, "IPv4" },
1611
    { LSC_IPV6, "IPv6" },
1612
    { 0, NULL }
1613
};
1614
static const value_string dvbci_lsc_proto[] = {
1615
    { LSC_TCP, "TCP" },
1616
    { LSC_UDP, "UDP" },
1617
    { 0, NULL }
1618
};
1619
static const value_string dvbci_comms_rep_id[] = {
1620
    { COMMS_REP_ID_CONNECT_ACK, "connect ack" },
1621
    { COMMS_REP_ID_DISCONNECT_ACK, "disconnect ack" },
1622
    { COMMS_REP_ID_SET_PARAMS_ACK, "set parameters ack" },
1623
    { COMMS_REP_ID_STATUS_REPLY, "status reply" },
1624
    { COMMS_REP_ID_GET_NEXT_BUFFER_ACK, "get next buffer ack" },
1625
    { COMMS_REP_ID_SEND_ACK, "send ack" },
1626
    { 0, NULL }
1627
};
1628
static const value_string dvbci_lsc_ret_val[] = {
1629
    { LSC_RET_OK, "ok" },
1630
    { 0, NULL }
1631
};
1632
static const value_string dvbci_lsc_connect[] = {
1633
    { LSC_DISCONNECTED, "disconnected" },
1634
    { LSC_CONNECTED, "connected" },
1635
    { 0, NULL }
1636
};
1637
static const value_string dvbci_lsc_ret_val_params[] = {
1638
    { LSC_RET_OK, "ok" },
1639
    { LSC_RET_TOO_BIG, "buffer size too big" },
1640
    { 0, NULL }
1641
};
1642
static const value_string dvbci_afs_ack_code[] = {
1643
    { AFS_ACK_RSV, "Reserved for future use" },
1644
    { AFS_ACK_OK, "The application environment is supported by the Host" },
1645
    { AFS_ACK_UNKNOWN, "The DomainIdentifier is not supported by the Host" },
1646
    { 0, NULL }
1647
};
1648
static const value_string dvbci_opp_ref_req_flag[] = {
1649
    { OPP_REF_REG_FLG_NONE,  "none" },
1650
    { OPP_REF_REG_FLG_ADV,   "advance warning" },
1651
    { OPP_REF_REG_FLG_URG,   "urgent" },
1652
    { OPP_REF_REG_FLG_SCHED, "scheduled" },
1653
    { 0, NULL }
1654
};
1655
static const value_string dvbci_opp_err_flag[] = {
1656
    { OPP_ERR_FLG_OK,          "no error" },
1657
    { OPP_ERR_FLG_PROF,        "CICAM can't acquire the profile" },
1658
    { OPP_ERR_FLG_UNSUPPORTED, "unsupported delivery system" },
1659
    { OPP_ERR_FLG_CANCELLED,   "operator search was cancelled" },
1660
    { 0, NULL }
1661
};
1662
static const value_string dvbci_opp_eit_pf_usage[] = {
1663
    { OPP_EIT_ABSENT, "no EIT present" },
1664
    { OPP_EIT_NOT_X,  "EIT is not fully ross-carried" },
1665
    { OPP_EIT_FULL_X, "EIT is fully cross-carried" },
1666
    { 0, NULL }
1667
};
1668
static const value_string dvbci_opp_eit_sch_usage[] = {
1669
    { OPP_EIT_ABSENT, "no EIT present" },
1670
    { OPP_EIT_NOT_X,  "EIT is not fully ross-carried" },
1671
    { OPP_EIT_FULL_X, "EIT is fully cross-carried" },
1672
    { OPP_EIT_BARKER, "EIT is available from a barker channel" },
1673
    { OPP_EPG_APP,    "EPG is delivered using an application" },
1674
    { 0, NULL }
1675
};
1676
static const value_string dvbci_opp_ext_evt[] = {
1677
    { OPP_EXT_EVT_DIFF, "extended event info is different from short event" },
1678
    { OPP_EXT_EVT_ADD,  "extended event info includes short event" },
1679
    { 0, NULL }
1680
};
1681
static const value_string dvbci_opp_dlv_cap[] = {
1682
    { OPP_DLV_CAP_S,  "DVB-S" },
1683
    { OPP_DLV_CAP_C,  "DVB-C" },
1684
    { OPP_DLV_CAP_T,  "DVB-T" },
1685
    { OPP_DLV_CAP_S2, "DVB-S2" },
1686
    { 0, NULL }
1687
};
1688
static const value_string dvbci_opp_tune_stat[] = {
1689
    { OPP_TUNE_OK,          "success" },
1690
    { OPP_TUNE_UNSUPPORTED, "unsupported delivery system descriptor" },
1691
    { OPP_TUNE_INVALID,     "invalid delivery system descriptor" },
1692
    { OPP_TUNE_ERR,         "failed" },
1693
    { 0, NULL }
1694
};
1695
static const value_string dvbci_sas_sess_state[] = {
1696
    { SAS_SESS_STATE_CONNECTED, "connected" },
1697
    { SAS_SESS_STATE_NOT_FOUND, "application not found" },
1698
    { SAS_SESS_STATE_DENIED, "denied, no more connections available" },
1699
    { 0, NULL }
1700
};
1701
1702
static uint16_t buf_size_cam;    /* buffer size proposal by the CAM */
1703
/* buffer size proposal by the host == negotiated buffer size */
1704
static uint16_t buf_size_host;
1705
1706
1707
int
1708
dvbci_set_addrs(uint8_t event, packet_info *pinfo)
1709
0
{
1710
0
    if (!IS_DATA_TRANSFER(event))
1711
0
        return -1;
1712
1713
0
    if (event == DVBCI_EVT_DATA_HOST_TO_CAM) {
1714
0
        set_address(&pinfo->src, AT_STRINGZ,
1715
0
                (int)strlen(ADDR_HOST)+1, ADDR_HOST);
1716
0
        set_address(&pinfo->dst, AT_STRINGZ,
1717
0
                (int)strlen(ADDR_CAM)+1 , ADDR_CAM);
1718
0
    }
1719
0
    else {
1720
0
        set_address(&pinfo->src, AT_STRINGZ,
1721
0
                (int)strlen(ADDR_CAM)+1 , ADDR_CAM);
1722
0
        set_address(&pinfo->dst, AT_STRINGZ,
1723
0
                (int)strlen(ADDR_HOST)+1, ADDR_HOST);
1724
0
    }
1725
1726
0
    return 1;
1727
0
}
1728
1729
static uint8_t
1730
dvbci_get_evt_from_addrs(packet_info *pinfo)
1731
0
{
1732
    /* this should be working from C89 on */
1733
0
    static const address a_cam  = ADDRESS_INIT(AT_STRINGZ, sizeof(ADDR_CAM), ADDR_CAM);
1734
0
    static const address a_host = ADDRESS_INIT(AT_STRINGZ, sizeof(ADDR_HOST), ADDR_HOST);
1735
1736
0
    if ( addresses_equal(&(pinfo->src), &a_cam) &&
1737
0
         addresses_equal(&(pinfo->dst), &a_host) ) {
1738
0
        return DVBCI_EVT_DATA_CAM_TO_HOST;
1739
0
    }
1740
0
    else if ( addresses_equal(&(pinfo->src), &a_host) &&
1741
0
              addresses_equal(&(pinfo->dst), &a_cam) ) {
1742
0
        return DVBCI_EVT_DATA_HOST_TO_CAM;
1743
0
    }
1744
0
    else
1745
0
        return DVBCI_EVT_INVALID_EVT;
1746
0
}
1747
1748
1749
/* this must be a function, not a macro,
1750
   so that we can enforce the return type */
1751
static inline int16_t two_comp_to_int16(uint16_t x)
1752
0
{
1753
0
   return (x&0x8000) ? -~(x-1) : x;
1754
0
}
1755
1756
1757
/* initialize/reset per capture state data */
1758
static void
1759
dvbci_init(void)
1760
16
{
1761
16
    buf_size_cam  = 0;
1762
16
    buf_size_host = 0;
1763
16
}
1764
1765
1766
/* dissect a delivery system descriptor loop
1767
   and the preceding length field
1768
   (used for host control and operator profile)
1769
   return the number of bytes dissected */
1770
static int
1771
dissect_desc_loop(int len_hf,
1772
        tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree)
1773
0
{
1774
0
    unsigned offset_start;
1775
0
    uint16_t desc_loop_len;
1776
0
    unsigned desc_len;
1777
1778
0
    offset_start = offset;
1779
1780
0
    desc_loop_len = tvb_get_ntohs(tvb, offset) & 0x0FFF;
1781
0
    proto_tree_add_item(tree, len_hf, tvb, offset, 2, ENC_BIG_ENDIAN);
1782
0
    offset += 2;
1783
0
    while (offset-offset_start < (unsigned)(2+desc_loop_len)) {
1784
0
        desc_len = proto_mpeg_descriptor_dissect(tvb, pinfo, offset, tree);
1785
0
        if (desc_len==0)
1786
0
            break;
1787
0
        offset += desc_len;
1788
0
    }
1789
1790
0
    return offset-offset_start;
1791
0
}
1792
1793
1794
/* dissect operator profile's status body, return its length */
1795
static int
1796
dissect_opp_status_body(tvbuff_t *tvb, unsigned offset,
1797
        packet_info *pinfo _U_, proto_tree *tree)
1798
0
{
1799
0
    unsigned offset_start;
1800
1801
0
    offset_start = offset;
1802
0
    proto_tree_add_item(tree, hf_dvbci_info_ver_op_status,
1803
0
            tvb, offset, 1, ENC_BIG_ENDIAN);
1804
0
    proto_tree_add_item(tree, hf_dvbci_nit_ver,
1805
0
            tvb, offset, 1, ENC_BIG_ENDIAN);
1806
0
    offset++;
1807
0
    proto_tree_add_item(tree, hf_dvbci_pro_typ,
1808
0
            tvb, offset, 1, ENC_BIG_ENDIAN);
1809
0
    proto_tree_add_item(tree, hf_dvbci_init_flag,
1810
0
            tvb, offset, 1, ENC_BIG_ENDIAN);
1811
0
    proto_tree_add_item(tree, hf_dvbci_ent_chg_flag,
1812
0
            tvb, offset, 1, ENC_BIG_ENDIAN);
1813
0
    proto_tree_add_item(tree, hf_dvbci_ent_val_flag,
1814
0
            tvb, offset, 1, ENC_BIG_ENDIAN);
1815
0
    proto_tree_add_item(tree, hf_dvbci_ref_req_flag,
1816
0
            tvb, offset, 1, ENC_BIG_ENDIAN);
1817
0
    offset++;
1818
0
    proto_tree_add_item(tree, hf_dvbci_err_flag,
1819
0
            tvb, offset, 1, ENC_BIG_ENDIAN);
1820
0
    proto_tree_add_bitmask(tree, tvb, offset,
1821
0
            hf_dvbci_dlv_sys_hint, ett_dvbci_dlv_sys_hint,
1822
0
            dvbci_opp_dlv_sys_hint_fields, ENC_BIG_ENDIAN);
1823
0
    offset++;
1824
0
    proto_tree_add_item(tree, hf_dvbci_refr_req_date,
1825
0
            tvb, offset, 2, ENC_BIG_ENDIAN);
1826
0
    offset += 2;
1827
0
    proto_tree_add_item(tree, hf_dvbci_refr_req_time,
1828
0
            tvb, offset, 1, ENC_BIG_ENDIAN);
1829
0
    offset++;
1830
1831
0
    return offset-offset_start;
1832
0
}
1833
1834
1835
/* dissect a capability loop in an operator_search_start apdu */
1836
static int
1837
dissect_opp_cap_loop(uint8_t cap_loop_len, const char *title,
1838
        int item_hf, unsigned item_len,
1839
        tvbuff_t *tvb, unsigned offset,
1840
        packet_info *pinfo _U_, proto_tree *tree)
1841
0
{
1842
0
    proto_tree *loop_tree = NULL;
1843
0
    unsigned    i;
1844
1845
0
    if (!title)
1846
0
        return -1;
1847
0
    if (item_len==0)
1848
0
        return -1;
1849
1850
0
    if (tree && cap_loop_len>0) {
1851
0
        loop_tree = proto_tree_add_subtree(tree, tvb, offset, cap_loop_len, ett_dvbci_opp_cap_loop, NULL, title);
1852
0
    }
1853
0
    for (i=0; i<item_len*cap_loop_len; i+=item_len) {
1854
0
        proto_tree_add_item(loop_tree, item_hf,
1855
0
                tvb, offset+i, item_len, ENC_BIG_ENDIAN);
1856
0
    }
1857
1858
0
    return cap_loop_len;
1859
0
}
1860
1861
1862
/* dissect age rating byte encoded as defined in
1863
   DVB-SI parental rating descriptor
1864
   returns rating's length in bytes or -1 for error */
1865
static int
1866
dissect_rating(tvbuff_t *tvb, unsigned offset,
1867
        packet_info *pinfo _U_, proto_tree *tree)
1868
0
{
1869
0
    uint8_t rating;
1870
1871
0
    rating = tvb_get_uint8(tvb, offset);
1872
0
    if (1<=rating && rating<=0x0F) {
1873
0
        proto_tree_add_uint_format(tree, hf_dvbci_rating,
1874
0
                tvb, offset, 1, rating,
1875
0
                "Rating is %d years (%d+3)", rating+3, rating);
1876
0
    } else {
1877
0
        proto_tree_add_uint_format(tree, hf_dvbci_rating,
1878
0
                tvb, offset, 1, rating,
1879
0
                "Rating is unknown/undefined (%d)", rating);
1880
0
    }
1881
1882
0
    return 1;
1883
0
}
1884
1885
1886
/* if there's a dissector for the protocol and target port of our
1887
    lsc connection, store it in the lsc session's circuit */
1888
static void
1889
store_lsc_msg_dissector(conversation_t *conv, uint8_t ip_proto, uint16_t port)
1890
0
{
1891
0
    dissector_handle_t msg_handle = NULL;
1892
1893
0
    if (!conv)
1894
0
        return;
1895
1896
0
    if (ip_proto==LSC_TCP)
1897
0
        msg_handle = dissector_get_uint_handle(tcp_dissector_table, port);
1898
0
    else if (ip_proto==LSC_UDP)
1899
0
        msg_handle = dissector_get_uint_handle(udp_dissector_table, port);
1900
1901
0
    conversation_set_dissector(conv, msg_handle);
1902
0
}
1903
1904
1905
/* dissect a connection_descriptor for the lsc resource
1906
   returns its length or -1 for error */
1907
static int
1908
dissect_conn_desc(tvbuff_t *tvb, unsigned offset, conversation_t *conv,
1909
        packet_info *pinfo, proto_tree *tree)
1910
0
{
1911
0
    proto_item *ti;
1912
0
    proto_tree *conn_desc_tree = NULL;
1913
0
    uint32_t    tag;
1914
0
    int         offset_start, offset_body;
1915
0
    uint32_t    len_field;
1916
0
    uint8_t     conn_desc_type;
1917
0
    uint8_t     ip_ver, ip_proto;
1918
0
    uint16_t    port;
1919
0
    proto_item *port_item      = NULL;
1920
0
    int         hostname_len;
1921
1922
0
    offset_start = offset;
1923
1924
0
    tag = tvb_get_ntoh24(tvb, offset);
1925
0
    if (tag!= T_CONNECTION_DESCRIPTOR)
1926
0
        return 0;
1927
1928
0
    conn_desc_tree = proto_tree_add_subtree(tree, tvb,
1929
0
            offset_start, -1, ett_dvbci_lsc_conn_desc, &ti, "Connection descriptor");
1930
1931
0
    proto_tree_add_item(conn_desc_tree, hf_dvbci_apdu_tag,
1932
0
            tvb, offset, APDU_TAG_SIZE, ENC_BIG_ENDIAN);
1933
0
    offset += APDU_TAG_SIZE;
1934
0
    offset = dissect_ber_length(pinfo, conn_desc_tree,
1935
0
                    tvb, offset, &len_field, NULL);
1936
0
    offset_body = offset;
1937
1938
0
    conn_desc_type = tvb_get_uint8(tvb, offset);
1939
0
    proto_tree_add_item(conn_desc_tree, hf_dvbci_conn_desc_type,
1940
0
                    tvb, offset, 1, ENC_BIG_ENDIAN);
1941
0
    offset++;
1942
1943
0
    if (conn_desc_type == CONN_DESC_IP) {
1944
0
        proto_tree_add_item(conn_desc_tree, hf_dvbci_lsc_media_tag,
1945
0
                    tvb, offset, 1, ENC_BIG_ENDIAN);
1946
0
        offset++;
1947
0
        proto_tree_add_item(conn_desc_tree, hf_dvbci_lsc_media_len,
1948
0
                    tvb, offset, 1, ENC_BIG_ENDIAN);
1949
0
        offset++;
1950
0
        ip_ver = tvb_get_uint8(tvb, offset);
1951
0
        proto_tree_add_item(conn_desc_tree, hf_dvbci_lsc_ip_ver,
1952
0
                    tvb, offset, 1, ENC_BIG_ENDIAN);
1953
0
        offset++;
1954
1955
0
        if (ip_ver == LSC_IPV4) {
1956
0
            offset += FT_IPv6_LEN-FT_IPv4_LEN;
1957
0
            proto_tree_add_item(conn_desc_tree, hf_dvbci_lsc_ipv4_addr,
1958
0
                    tvb, offset, FT_IPv4_LEN, ENC_BIG_ENDIAN);
1959
0
            offset += FT_IPv4_LEN;
1960
0
        }
1961
0
        else if (ip_ver == LSC_IPV6) {
1962
0
            proto_tree_add_item(conn_desc_tree, hf_dvbci_lsc_ipv6_addr,
1963
0
                    tvb, offset, FT_IPv6_LEN, ENC_NA);
1964
0
            offset += FT_IPv6_LEN;
1965
0
        }
1966
0
        else
1967
0
            offset += FT_IPv6_LEN;
1968
1969
0
        port_item = proto_tree_add_item_ret_uint16(conn_desc_tree,
1970
0
                hf_dvbci_lsc_dst_port, tvb, offset, 2, ENC_BIG_ENDIAN, &port);
1971
0
        offset +=2;
1972
0
        proto_tree_add_item_ret_uint8(conn_desc_tree, hf_dvbci_lsc_proto,
1973
0
                    tvb, offset, 1, ENC_BIG_ENDIAN, &ip_proto);
1974
0
        offset ++;
1975
0
        if (port_item) {
1976
0
            if (ip_proto==LSC_TCP && tcp_port_to_display(pinfo->pool, port)) {
1977
0
                proto_item_append_text(port_item, " (%s)",
1978
0
                        tcp_port_to_display(pinfo->pool, port));
1979
0
            }
1980
0
            else if (ip_proto==LSC_UDP && udp_port_to_display(pinfo->pool, port)) {
1981
0
                proto_item_append_text(port_item, " (%s)",
1982
0
                        udp_port_to_display(pinfo->pool, port));
1983
0
            }
1984
0
        }
1985
0
        store_lsc_msg_dissector(conv, ip_proto, port);
1986
1987
0
    } else if (conn_desc_type == CONN_DESC_HOSTNAME) {
1988
0
        proto_tree_add_item(conn_desc_tree, hf_dvbci_lsc_media_tag,
1989
0
                    tvb, offset, 1, ENC_BIG_ENDIAN);
1990
0
        offset++;
1991
0
        proto_tree_add_item(conn_desc_tree, hf_dvbci_lsc_media_len,
1992
0
                    tvb, offset, 1, ENC_BIG_ENDIAN);
1993
0
        offset++;
1994
0
        proto_tree_add_item_ret_uint8(conn_desc_tree, hf_dvbci_lsc_proto,
1995
0
                    tvb, offset, 1, ENC_BIG_ENDIAN, &ip_proto);
1996
0
        offset ++;
1997
0
        port_item = proto_tree_add_item_ret_uint16(conn_desc_tree,
1998
0
                hf_dvbci_lsc_dst_port, tvb, offset, 2, ENC_BIG_ENDIAN, &port);
1999
0
        offset +=2;
2000
0
        if (port_item) {
2001
0
            if (ip_proto==LSC_TCP && tcp_port_to_display(pinfo->pool, port)) {
2002
0
                proto_item_append_text(port_item, " (%s)",
2003
0
                        tcp_port_to_display(pinfo->pool, port));
2004
0
            }
2005
0
            else if (ip_proto==LSC_UDP && udp_port_to_display(pinfo->pool, port)) {
2006
0
                proto_item_append_text(port_item, " (%s)",
2007
0
                        udp_port_to_display(pinfo->pool, port));
2008
0
            }
2009
0
        }
2010
0
        store_lsc_msg_dissector(conv, ip_proto, port);
2011
2012
        /* everything from here to the descriptor's end is a hostname */
2013
0
        hostname_len = (offset_body+len_field)-offset;
2014
0
        proto_tree_add_item(conn_desc_tree, hf_dvbci_lsc_hostname,
2015
0
                tvb, offset, hostname_len, ENC_ASCII);
2016
0
        offset += hostname_len;
2017
0
    } else {
2018
0
        proto_tree_add_item(conn_desc_tree, hf_dvbci_lsc_media_data,
2019
0
                tvb, offset, len_field-1, ENC_NA);
2020
0
        offset += len_field-1;
2021
0
    }
2022
2023
0
    proto_item_set_len(ti, offset-offset_start);
2024
0
    return offset-offset_start;
2025
0
}
2026
2027
2028
/* check if the given CC resource item may appear in the clear
2029
   as part of an exported PDU */
2030
static inline bool
2031
is_cc_item_exportable(uint8_t dat_id)
2032
0
{
2033
    /* the CCK precursor value does not contain sensitive information as such
2034
       nevertheless, it is safer to prevent people from exporting this value
2035
       accidentally */
2036
0
    if (dat_id == CC_ID_KP)
2037
0
        return false;
2038
    /* we could add some more items here which do not appear in SAC messages
2039
       normally: CC_ID_DHPH, CC_ID_DHPM */
2040
2041
0
    return true;
2042
0
}
2043
2044
2045
/* dissect the URI, return the number of bytes processed or -1 for error */
2046
static int
2047
dissect_uri(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree)
2048
0
{
2049
0
    int         offset_start;
2050
0
    uint8_t     uri_ver, emi, rl;
2051
0
    proto_item *rl_item;
2052
2053
0
    offset_start = offset;
2054
2055
0
    col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "URI");
2056
2057
0
    uri_ver = tvb_get_uint8(tvb, offset);
2058
0
    proto_tree_add_item(tree, hf_dvbci_uri_ver,
2059
0
            tvb, offset, 1, ENC_BIG_ENDIAN);
2060
0
    offset++;
2061
2062
0
    proto_tree_add_item(tree, hf_dvbci_uri_aps,
2063
0
            tvb, offset, 1, ENC_BIG_ENDIAN);
2064
0
    emi = (tvb_get_uint8(tvb, offset) & 0x30) >> 4;
2065
0
    proto_tree_add_item(tree, hf_dvbci_uri_emi,
2066
0
            tvb, offset, 1, ENC_BIG_ENDIAN);
2067
0
    col_append_sep_str(pinfo->cinfo, COL_INFO, NULL,
2068
0
            val_to_str_const(emi, dvbci_cc_uri_emi, "unknown"));
2069
0
    proto_tree_add_item(tree, hf_dvbci_uri_ict,
2070
0
            tvb, offset, 1, ENC_BIG_ENDIAN);
2071
0
    if (emi==CC_EMI_FREE) {
2072
0
        proto_tree_add_item(tree, hf_dvbci_uri_rct,
2073
0
                tvb, offset, 1, ENC_BIG_ENDIAN);
2074
0
    }
2075
0
    if (uri_ver>=2 && emi==CC_EMI_NEVER) {
2076
0
        proto_tree_add_item(tree, hf_dvbci_uri_dot,
2077
0
                tvb, offset, 1, ENC_BIG_ENDIAN);
2078
0
    }
2079
0
    offset++;
2080
2081
0
    if (emi==CC_EMI_NEVER) {
2082
0
        if (uri_ver==1)
2083
0
            rl = tvb_get_uint8(tvb, offset) & 0x3F;
2084
0
        else
2085
0
            rl = tvb_get_uint8(tvb, offset);
2086
2087
0
        rl_item = proto_tree_add_uint(tree, hf_dvbci_uri_rl,
2088
0
                tvb, offset, 1, rl);
2089
2090
0
        if (rl==0x00)
2091
0
            proto_item_append_text(rl_item, " (90 minutes)");
2092
0
        else if (rl==0x01)
2093
0
            proto_item_append_text(rl_item, " (6 hours)");
2094
0
        else if (rl==0x02)
2095
0
            proto_item_append_text(rl_item, " (12 hours)");
2096
0
        else if (uri_ver>=2 && rl==0xFF)
2097
0
            proto_item_append_text(rl_item, " (unlimited)");
2098
0
        else {
2099
            /* no need for a range check, rl 0x3F mask was applied above */
2100
0
            proto_item_append_text(rl_item, " (%d days)", rl-2);
2101
0
        }
2102
0
    }
2103
2104
0
    return offset-offset_start;
2105
0
}
2106
2107
2108
/* dissect an item from cc_(sac_)data_req/cc_(sac_)data_cnf,
2109
   returns its length or -1 for error
2110
   if dat_id_ptr is not NULL, fill in the datatype id */
2111
static int
2112
dissect_cc_item(tvbuff_t *tvb, unsigned offset,
2113
        packet_info *pinfo, proto_tree *tree, uint8_t *dat_id_ptr)
2114
0
{
2115
0
    proto_item *ti;
2116
0
    proto_tree *cc_item_tree = NULL;
2117
0
    int         offset_start;
2118
0
    uint16_t    dat_len;
2119
0
    uint8_t     dat_id;
2120
0
    asn1_ctx_t  asn1_ctx;
2121
0
    int         hf_cert_index;
2122
0
    uint16_t    prog_num;
2123
0
    uint8_t     status;
2124
2125
2126
0
    offset_start = offset;
2127
0
    dat_id = tvb_get_uint8(tvb, offset);
2128
0
    if (dat_id_ptr)
2129
0
        *dat_id_ptr = dat_id;
2130
2131
0
    cc_item_tree = proto_tree_add_subtree_format(tree, tvb, offset_start, -1, ett_dvbci_cc_item, &ti,
2132
0
        "CC data item: %s", val_to_str_const(dat_id, dvbci_cc_dat_id, "unknown"));
2133
2134
0
    proto_tree_add_item(cc_item_tree, hf_dvbci_cc_dat_id,
2135
0
            tvb, offset, 1, ENC_BIG_ENDIAN);
2136
0
    offset++;
2137
0
    dat_len = tvb_get_ntohs(tvb, offset);
2138
0
    proto_tree_add_item(cc_item_tree, hf_dvbci_cc_dat_len,
2139
0
            tvb, offset, 2, ENC_BIG_ENDIAN);
2140
0
    offset += 2;
2141
0
    switch (dat_id) {
2142
0
        case CC_ID_HOST_BRAND_CERT:
2143
0
        case CC_ID_CICAM_BRAND_CERT:
2144
0
        case CC_ID_HOST_DEV_CERT:
2145
0
        case CC_ID_CICAM_DEV_CERT:
2146
0
            asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
2147
0
            hf_cert_index = (dat_id==CC_ID_HOST_BRAND_CERT ||
2148
0
                             dat_id==CC_ID_CICAM_BRAND_CERT) ?
2149
0
                hf_dvbci_brand_cert : hf_dvbci_dev_cert;
2150
2151
            /* enable dissection of CI+ specific X.509 extensions
2152
               only for our certificates */
2153
0
            x509ce_enable_ciplus();
2154
0
            dissect_x509af_Certificate(false, tvb, offset,
2155
0
                    &asn1_ctx, cc_item_tree, hf_cert_index);
2156
0
            x509ce_disable_ciplus();
2157
0
            break;
2158
0
        case CC_ID_URI:
2159
0
            dissect_uri(tvb, offset, pinfo, cc_item_tree);
2160
0
            break;
2161
0
        case CC_ID_PROG_NUM:
2162
0
            prog_num = tvb_get_ntohs(tvb, offset);
2163
0
            col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL,
2164
0
                    "Program number 0x%x", prog_num);
2165
0
            proto_tree_add_item(cc_item_tree, hf_dvbci_cc_prog_num,
2166
0
                    tvb, offset, 2, ENC_BIG_ENDIAN);
2167
0
            break;
2168
0
        case CC_ID_KEY_REGISTER:
2169
0
            proto_tree_add_item(cc_item_tree, hf_dvbci_cc_key_register,
2170
0
                    tvb, offset, 1, ENC_BIG_ENDIAN);
2171
0
            break;
2172
0
        case CC_ID_STATUS_FIELD:
2173
0
        case CC_ID_REC_START_STATUS:
2174
0
        case CC_ID_MODE_CHG_STATUS:
2175
0
        case CC_ID_REC_STOP_STATUS:
2176
0
            status = tvb_get_uint8(tvb, offset);
2177
0
            col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "Status: %s",
2178
0
                    val_to_str_const(status, dvbci_cc_status, "unknown"));
2179
0
            proto_tree_add_item(cc_item_tree, hf_dvbci_cc_status_field,
2180
0
                    tvb, offset, 1, ENC_BIG_ENDIAN);
2181
0
            break;
2182
0
        case CC_ID_OPERATING_MODE:
2183
0
            proto_tree_add_item(cc_item_tree, hf_dvbci_cc_op_mode,
2184
0
                    tvb, offset, 1, ENC_BIG_ENDIAN);
2185
0
            break;
2186
0
        default:
2187
0
            proto_tree_add_item(cc_item_tree, hf_dvbci_cc_data,
2188
0
                    tvb, offset, dat_len, ENC_NA);
2189
0
            break;
2190
0
    }
2191
0
    offset += dat_len;
2192
2193
0
    proto_item_set_len(ti, offset-offset_start);
2194
0
    return offset-offset_start;
2195
0
}
2196
2197
2198
/* add the CC protocol name and step to the info column */
2199
static void
2200
add_cc_protocol_name_step(packet_info *pinfo,
2201
    uint64_t snd_dat_ids, uint64_t req_dat_ids)
2202
0
{
2203
0
    bool chk_snd_ids = false;
2204
2205
0
    switch (req_dat_ids) {
2206
0
        case CC_ID_DHPH<<24|CC_ID_SIG_A<<16|CC_ID_HOST_DEV_CERT<<8|CC_ID_HOST_BRAND_CERT:
2207
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
2208
0
                    "(Authentication Step 1)");
2209
0
            break;
2210
0
        case CC_ID_STATUS_FIELD:
2211
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
2212
0
                    "(Authentication Step 3)");
2213
0
            break;
2214
0
        case CC_ID_AKH:
2215
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
2216
0
                    "(AuthKey Step 1)");
2217
0
            break;
2218
0
        case CC_ID_HOST_ID<<8|CC_ID_STATUS_FIELD:
2219
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
2220
0
                    "(CC key calculation Step 1)");
2221
0
            break;
2222
0
        case CC_ID_HOST_ID<<8|CC_ID_NS_HOST:
2223
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
2224
0
                    "(SAC key calculation Step 1)");
2225
0
            break;
2226
0
        case CC_ID_URI_CNF:
2227
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
2228
0
                    "(URI transmission Step 1)");
2229
0
            break;
2230
0
        case CC_ID_URI_VERSIONS:
2231
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
2232
0
                    "(URI version negotiation Step 1)");
2233
0
            break;
2234
0
        case CC_ID_LICENSE_RCV_STATUS:
2235
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
2236
0
                    "(CICAM to Host License Exchange Step 1)");
2237
0
            break;
2238
0
        case CC_ID_PROG_NUM<<24|CC_ID_LICENSE_STATUS<<16|CC_ID_URI<<8|CC_ID_CICAM_LICENSE:
2239
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
2240
0
                    "(Playback License Exchange Step 1)");
2241
0
            break;
2242
0
        case CC_ID_LICENSE_STATUS<<8|CC_ID_PLAY_COUNT:
2243
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
2244
0
                    "(License Check Exchange Step 1)");
2245
0
            break;
2246
0
        case CC_ID_REC_START_STATUS:
2247
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
2248
0
                    "(Record Start Step 1)");
2249
0
            break;
2250
0
        case CC_ID_MODE_CHG_STATUS:
2251
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
2252
0
                    "(Change Operating Mode Step 1)");
2253
0
            break;
2254
0
        case CC_ID_REC_STOP_STATUS:
2255
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
2256
0
                    "(Record Stop Step 1)");
2257
0
            break;
2258
0
        case CC_ID_STATUS_FIELD<<8|CC_ID_SRM_CONFIRM:
2259
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
2260
0
                    "(SRM Transmission Step 1)");
2261
0
            break;
2262
0
        default:
2263
            /* unable to determine the protocol from the requested ids
2264
               check the sent ids as well */
2265
0
            chk_snd_ids = true;
2266
0
            break;
2267
0
    }
2268
0
    if (!chk_snd_ids)
2269
0
        return;
2270
2271
0
    switch (snd_dat_ids) {
2272
0
        case CC_ID_DHPH<<24|CC_ID_SIG_A<<16|CC_ID_HOST_DEV_CERT<<8|CC_ID_HOST_BRAND_CERT:
2273
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
2274
0
                    "(Authentication Step 2)");
2275
0
            break;
2276
0
        case CC_ID_STATUS_FIELD:
2277
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
2278
0
                    "(Authentication Step 4)");
2279
0
            break;
2280
0
        case CC_ID_AKH:
2281
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
2282
0
                    "(AuthKey Step 2)");
2283
0
            break;
2284
0
        case CC_ID_HOST_ID<<8|CC_ID_STATUS_FIELD:
2285
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
2286
0
                    "(CC key calculation Step 2)");
2287
0
            break;
2288
0
        case CC_ID_HOST_ID<<8|CC_ID_NS_HOST:
2289
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
2290
0
                    "(SAC key calculation Step 2)");
2291
0
            break;
2292
0
        case CC_ID_URI_CNF:
2293
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
2294
0
                    "(URI transmission Step 2)");
2295
0
            break;
2296
0
        case CC_ID_URI_VERSIONS:
2297
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
2298
0
                    "(URI version negotiation Step 2)");
2299
0
            break;
2300
0
        case CC_ID_LICENSE_RCV_STATUS:
2301
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
2302
0
                    "(CICAM to Host License Exchange Step 2)");
2303
0
            break;
2304
0
        case CC_ID_PROG_NUM<<24|CC_ID_LICENSE_STATUS<<16|CC_ID_URI<<8|CC_ID_CICAM_LICENSE:
2305
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
2306
0
                    "(Playback License Exchange Step 2)");
2307
0
            break;
2308
0
        case CC_ID_LICENSE_STATUS<<8|CC_ID_PLAY_COUNT:
2309
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
2310
0
                    "(License Check Exchange Step 2)");
2311
0
            break;
2312
0
        case CC_ID_REC_START_STATUS:
2313
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
2314
0
                    "(Record Start Step 2)");
2315
0
            break;
2316
0
        case CC_ID_MODE_CHG_STATUS:
2317
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
2318
0
                    "(Change Operating Mode Step 2)");
2319
0
            break;
2320
0
        case CC_ID_REC_STOP_STATUS:
2321
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
2322
0
                    "(Record Stop Step 2)");
2323
0
            break;
2324
0
        case CC_ID_STATUS_FIELD<<8|CC_ID_SRM_CONFIRM:
2325
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
2326
0
                    "(SRM Transmission Step 2)");
2327
0
            break;
2328
0
    }
2329
0
}
2330
2331
2332
/* dissect the payload of a cc message that contains data items
2333
   if not NULL, set exportable_flag to true if the message contains no
2334
    sensitive data and can be passed to the export PDU mechanism */
2335
static int
2336
dissect_cc_data_payload(uint32_t tag, tvbuff_t *tvb, unsigned offset,
2337
        packet_info *pinfo, proto_tree *tree, bool *exportable_flag)
2338
0
{
2339
0
    int         offset_start;
2340
0
    uint8_t     i, snd_dat_nbr, req_dat_nbr;
2341
0
    uint8_t     dat_id;
2342
0
    int         item_len;
2343
    /* the last 8 sent/requested datatype ids */
2344
0
    uint64_t    snd_dat_ids=0, req_dat_ids=0;
2345
2346
    /* we only export cc_sac_data_req and cc_sac_data_cnf
2347
       the only meta info in the exported PDU is the data transfer
2348
        direction, if we only ever export  cc_sac_data_req and
2349
        cc_sac_data_cnf, this info is enough to recover the apdu tag from the
2350
        direction
2351
       cc_sac_sync req and cc_sac_sync_cnf contain no interesting data */
2352
0
    if (exportable_flag)
2353
0
        *exportable_flag = (tag==T_CC_SAC_DATA_REQ || tag==T_CC_SAC_DATA_CNF);
2354
2355
0
    offset_start = offset;
2356
2357
0
    proto_tree_add_item(
2358
0
            tree, hf_dvbci_cc_sys_id_bitmask, tvb, offset, 1, ENC_BIG_ENDIAN);
2359
0
    offset++;
2360
0
    snd_dat_nbr = tvb_get_uint8(tvb, offset);
2361
0
    proto_tree_add_item(
2362
0
            tree, hf_dvbci_cc_snd_dat_nbr, tvb, offset, 1, ENC_BIG_ENDIAN);
2363
0
    offset++;
2364
0
    for(i=0; i<snd_dat_nbr &&
2365
0
            tvb_reported_length_remaining(tvb, offset)>0; i++) {
2366
0
        item_len = dissect_cc_item(tvb, offset, pinfo, tree, &dat_id);
2367
0
        if (item_len < 0)
2368
0
            return -1;
2369
0
        offset += item_len;
2370
        /* for more than 8 sent datatype ids, some ids might get lost by
2371
         * the shift, that's ok, we're only using the last 8 ids for
2372
         * protocol detection */
2373
0
        snd_dat_ids = snd_dat_ids<<8|dat_id;
2374
0
        if (!exportable_flag || *exportable_flag==false)
2375
0
            continue;
2376
0
        if (!is_cc_item_exportable(dat_id))
2377
0
            *exportable_flag = false;
2378
0
    }
2379
2380
0
    if (tag==T_CC_DATA_REQ || tag==T_CC_SAC_DATA_REQ) {
2381
0
        req_dat_nbr = tvb_get_uint8(tvb, offset);
2382
0
        proto_tree_add_item(
2383
0
                tree, hf_dvbci_cc_req_dat_nbr, tvb, offset, 1, ENC_BIG_ENDIAN);
2384
0
        offset++;
2385
0
        for(i=0; i<req_dat_nbr &&
2386
0
                tvb_reported_length_remaining(tvb, offset)>0; i++) {
2387
0
            dat_id = tvb_get_uint8(tvb, offset);
2388
0
            req_dat_ids = req_dat_ids<<8|dat_id;
2389
0
            proto_tree_add_item(
2390
0
                    tree, hf_dvbci_cc_dat_id, tvb, offset, 1, ENC_BIG_ENDIAN);
2391
0
            offset++;
2392
0
        }
2393
0
    }
2394
2395
0
    add_cc_protocol_name_step(pinfo, snd_dat_ids, req_dat_ids);
2396
2397
0
    return offset-offset_start;
2398
0
}
2399
2400
2401
/* convert a 0-terminated preference key_string that contains a hex number
2402
 *  into its binary representation
2403
 * e.g. key_string "abcd" will be converted into two bytes 0xab, 0xcd
2404
 * return the number of binary bytes or -1 for error */
2405
static int
2406
pref_key_string_to_bin(const char *key_string, unsigned char **key_bin)
2407
32
{
2408
32
    int  key_string_len;
2409
32
    int  i, j;
2410
32
    char input[3];
2411
2412
32
    if (!key_string || !key_bin)
2413
0
        return -1;
2414
32
    key_string_len = (int)strlen(key_string);
2415
32
    if (key_string_len != 2*AES_KEY_LEN)
2416
32
        return -1;
2417
0
    *key_bin = (unsigned char*)g_malloc(key_string_len/2);
2418
0
    input[2] = '\0';
2419
2420
0
    j=0;
2421
0
    for (i=0; i<key_string_len-1; i+=2) {
2422
0
        input[0] = key_string[0+i];
2423
0
        input[1] = key_string[1+i];
2424
        /* attention, brackets are required */
2425
0
        (*key_bin)[j++] = (unsigned char)strtoul((const char*)&input, NULL, 16);
2426
0
    }
2427
2428
0
    return key_string_len/2;
2429
32
}
2430
2431
2432
static tvbuff_t *
2433
decrypt_sac_msg_body(packet_info *pinfo,
2434
        uint8_t enc_cip, tvbuff_t *encrypted_tvb, unsigned offset, int len)
2435
0
{
2436
0
    bool             opened = false;
2437
0
    gcry_cipher_hd_t cipher;
2438
0
    gcry_error_t     err;
2439
0
    int              clear_len;
2440
0
    unsigned char    *clear_data = NULL;
2441
0
    tvbuff_t         *clear_tvb = NULL;
2442
2443
0
    if (enc_cip != CC_SAC_ENC_AES128_CBC)
2444
0
        goto end;
2445
0
    if (len%AES_BLOCK_LEN != 0)
2446
0
        goto end;
2447
2448
0
    if (!dvbci_sek_bin || !dvbci_siv_bin)
2449
0
        goto end;
2450
2451
0
    err = gcry_cipher_open(&cipher, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_CBC, 0);
2452
0
    if (gcry_err_code (err))
2453
0
        goto end;
2454
0
    opened = true;
2455
0
    err = gcry_cipher_setkey (cipher, dvbci_sek_bin, AES_KEY_LEN);
2456
0
    if (gcry_err_code (err))
2457
0
        goto end;
2458
0
    err = gcry_cipher_setiv (cipher, dvbci_siv_bin, AES_BLOCK_LEN);
2459
0
    if (gcry_err_code (err))
2460
0
        goto end;
2461
2462
0
    clear_len = len;
2463
0
    clear_data = (unsigned char *)wmem_alloc(pinfo->pool, clear_len);
2464
2465
0
    err = gcry_cipher_decrypt (cipher, clear_data, clear_len,
2466
0
            tvb_memdup(pinfo->pool, encrypted_tvb, offset, len), len);
2467
0
    if (gcry_err_code (err))
2468
0
        goto end;
2469
2470
0
    clear_tvb = tvb_new_child_real_data(encrypted_tvb,
2471
0
                        (const uint8_t *)clear_data, clear_len, clear_len);
2472
2473
0
end:
2474
0
    if (opened)
2475
0
        gcry_cipher_close (cipher);
2476
0
    return clear_tvb;
2477
0
}
2478
2479
2480
/* dissect a text string that is encoded according to DVB-SI (EN 300 468) */
2481
static void
2482
dissect_si_string(tvbuff_t *tvb, unsigned offset, int str_len,
2483
        packet_info *pinfo, proto_tree *tree, int hf, const char *title,
2484
        bool show_col_info)
2485
0
{
2486
0
    unsigned        enc_len;
2487
0
    dvb_encoding_e  encoding;
2488
0
    const char     *si_str = NULL;
2489
2490
0
    if (!title)  /* we always have a title for our strings */
2491
0
        return;
2492
    /* str_len==-1 is not supported, we need an actual length */
2493
0
    if (str_len<=0)
2494
0
        return;
2495
2496
0
    enc_len = dvb_analyze_string_charset(tvb, offset, str_len, &encoding);
2497
0
    dvb_add_chartbl(tree, hf_dvbci_mmi_char_tbl, tvb, offset, enc_len, encoding);
2498
2499
0
    offset += enc_len;
2500
0
    str_len -= enc_len;
2501
2502
0
    si_str = (char*)tvb_get_string_enc(pinfo->pool,
2503
0
            tvb, offset, str_len, dvb_enc_to_item_enc(encoding));
2504
0
    if (!si_str)
2505
0
        return;
2506
2507
0
    proto_tree_add_string_format(tree, hf,
2508
0
            tvb, offset, str_len, si_str, "%s: %s", title, si_str);
2509
2510
0
    if (show_col_info)
2511
0
        col_append_sep_str(pinfo->cinfo, COL_INFO, " ", si_str);
2512
0
}
2513
2514
2515
/* dissect ca_enable_flag and ca_enable fields in the ca_pmt_reply
2516
 * return true if descrambling is possible, false otherwise */
2517
static bool
2518
dissect_ca_enable(tvbuff_t *tvb, unsigned offset, packet_info *pinfo _U_,
2519
        proto_tree *tree)
2520
0
{
2521
0
    bool desc_ok = false;
2522
0
    uint8_t  byte, ca_enab;
2523
2524
0
    byte = tvb_get_uint8(tvb,offset);
2525
0
    proto_tree_add_item(tree, hf_dvbci_ca_enable_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
2526
0
    if (byte&0x80) {
2527
0
        ca_enab = byte & ~0x80;
2528
0
        proto_tree_add_item(tree, hf_dvbci_ca_enable, tvb, offset, 1, ENC_BIG_ENDIAN);
2529
0
        if (ca_enab==CA_ENAB_DESC_OK ||
2530
0
            ca_enab==CA_ENAB_DESC_OK_PURCHASE ||
2531
0
            ca_enab==CA_ENAB_DESC_OK_TECH) {
2532
0
            desc_ok = true;
2533
0
        }
2534
0
    }
2535
2536
0
    return desc_ok;
2537
0
}
2538
2539
2540
/* dissect a ca descriptor in the ca_pmt */
2541
static unsigned
2542
dissect_ca_desc(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
2543
        proto_tree *tree)
2544
0
{
2545
0
    unsigned         offset_start;
2546
0
    uint8_t     tag, len_byte;
2547
0
    proto_item *ti;
2548
0
    proto_tree *ca_desc_tree = NULL;
2549
2550
0
    offset_start = offset;
2551
2552
0
    tag = tvb_get_uint8(tvb,offset);
2553
0
    if (tag != CA_DESC_TAG) {
2554
        /* we could skip unknown descriptors and make this a warning */
2555
0
        proto_tree_add_expert(tree, pinfo, &ei_dvbci_ca_pmt_cmd_id, tvb, offset, 1);
2556
0
        return 0;
2557
0
    }
2558
2559
0
    ca_desc_tree = proto_tree_add_subtree(
2560
0
            tree, tvb, offset_start, -1, ett_dvbci_ca_desc, &ti, "Conditional Access descriptor");
2561
0
    offset++;
2562
2563
0
    len_byte = tvb_get_uint8(tvb,offset);
2564
0
    proto_tree_add_item(
2565
0
            ca_desc_tree, hf_dvbci_descr_len, tvb, offset, 1, ENC_BIG_ENDIAN);
2566
0
    offset++;
2567
2568
0
    proto_tree_add_item(
2569
0
            ca_desc_tree, hf_dvbci_ca_sys_id, tvb, offset, 2, ENC_BIG_ENDIAN);
2570
0
    offset += 2;
2571
2572
0
    proto_tree_add_item(
2573
0
            ca_desc_tree, hf_dvbci_ca_pid, tvb, offset, 2, ENC_BIG_ENDIAN);
2574
0
    offset += 2;
2575
2576
0
    if ((len_byte-4) != 0) {
2577
0
        proto_tree_add_item(ca_desc_tree, hf_dvbci_ca_priv_data,
2578
0
                tvb, offset, len_byte-4, ENC_NA);
2579
0
        offset += (len_byte-4);
2580
0
    }
2581
2582
0
    proto_item_set_len(ti, offset-offset_start);
2583
0
    return offset-offset_start;
2584
0
}
2585
2586
2587
/* dissect an elementary stream entry in the ca_pmt */
2588
static int
2589
dissect_es(tvbuff_t *tvb, unsigned offset,
2590
        packet_info *pinfo, proto_tree *tree, bool *scrambled)
2591
0
{
2592
0
    proto_item *ti;
2593
0
    proto_tree *es_tree = NULL;
2594
0
    unsigned    offset_start, ca_desc_len;
2595
0
    unsigned    es_info_len, all_len;
2596
2597
0
    offset_start = offset;
2598
2599
0
    if (scrambled) {
2600
        /* default to free service until we found a ca descriptor
2601
           (we could have es info len > 0 and no ca descriptors) */
2602
0
        *scrambled = false;
2603
0
    }
2604
2605
0
    es_tree = proto_tree_add_subtree(tree, tvb, offset_start, -1, ett_dvbci_application, &ti, "Elementary Stream");
2606
2607
0
    proto_tree_add_item(
2608
0
            es_tree, hf_dvbci_stream_type, tvb, offset, 1, ENC_BIG_ENDIAN);
2609
0
    offset++;
2610
0
    proto_tree_add_item(
2611
0
            es_tree, hf_dvbci_es_pid, tvb, offset, 2, ENC_BIG_ENDIAN);
2612
0
    offset += 2;
2613
0
    es_info_len = tvb_get_ntohs(tvb, offset) & 0x0FFF;
2614
    /* the definition of hf_dvbci_es_info_len also applies the mask */
2615
0
    proto_tree_add_item(
2616
0
            es_tree, hf_dvbci_es_info_len, tvb, offset, 2, ENC_BIG_ENDIAN);
2617
0
    offset += 2;
2618
0
    if (es_info_len>0) {
2619
0
        all_len = offset + es_info_len;
2620
2621
0
        proto_tree_add_item(
2622
0
                es_tree, hf_dvbci_ca_pmt_cmd_id, tvb, offset, 1, ENC_BIG_ENDIAN);
2623
0
        offset++;
2624
0
        while (offset < all_len) {
2625
0
            ca_desc_len = dissect_ca_desc(tvb, offset, pinfo, es_tree);
2626
0
            if (ca_desc_len <= 0)
2627
0
                return -1;
2628
0
            offset += ca_desc_len;
2629
0
            if (scrambled)
2630
0
                *scrambled = true;
2631
0
        }
2632
0
    }
2633
0
    else {
2634
0
        proto_tree_add_expert(
2635
0
                es_tree, pinfo, &ei_dvbci_no_ca_desc_es, tvb, 0, 0);
2636
0
    }
2637
2638
0
    proto_item_set_len(ti, offset-offset_start);
2639
0
    return offset-offset_start;
2640
0
}
2641
2642
/* dissect a text pseudo-apdu */
2643
static int
2644
dissect_dvbci_text(const char *title, tvbuff_t *tvb, unsigned offset,
2645
                   packet_info *pinfo, proto_tree *tree, int hf)
2646
0
{
2647
0
    proto_item *ti;
2648
0
    proto_tree *text_tree;
2649
0
    uint32_t    tag;
2650
0
    int         offset_start;
2651
0
    uint32_t    len_field;
2652
2653
0
    offset_start = offset;
2654
2655
0
    if (!title)
2656
0
        return 0;
2657
2658
    /* check the tag before setting up the tree */
2659
0
    tag = tvb_get_ntoh24(tvb, offset);
2660
0
    if (tag!=T_TEXT_LAST && tag!=T_TEXT_MORE)
2661
0
        return 0;
2662
2663
0
    text_tree = proto_tree_add_subtree(tree, tvb, offset_start, -1, ett_dvbci_text, &ti, title);
2664
2665
0
    proto_tree_add_item(text_tree, hf_dvbci_apdu_tag,
2666
0
            tvb, offset, APDU_TAG_SIZE, ENC_BIG_ENDIAN);
2667
0
    offset += APDU_TAG_SIZE;
2668
0
    offset = dissect_ber_length(pinfo, text_tree, tvb, offset, &len_field, NULL);
2669
0
    dissect_si_string(tvb, offset, len_field, pinfo, text_tree,
2670
0
            hf, "Text", false);
2671
0
    offset += len_field;
2672
2673
0
    proto_item_set_len(ti, offset-offset_start);
2674
0
    return (offset-offset_start);
2675
0
}
2676
2677
2678
static proto_item *
2679
dissect_res_id(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
2680
        proto_tree *tree, uint32_t res_id, bool show_col_info)
2681
0
{
2682
    /* there's two possible inputs for this function
2683
        the resource id is either in a tvbuff_t (tvb!=NULL, res_id==0)
2684
        or in a uint32_t (tvb==NULL, res_id!=0) */
2685
2686
0
    if (tvb) {
2687
        /* resource id comes in via tvbuff */
2688
0
        if (res_id!=0)
2689
0
            return NULL;
2690
0
        res_id = tvb_get_ntohl(tvb, offset);
2691
0
    }
2692
0
    else {
2693
        /* resource id comes in via uint32_t */
2694
0
        if (res_id==0)
2695
0
            return NULL;
2696
        /* we'll call proto_tree_add_...( tvb==NULL, offset==0, length==0 )
2697
           this creates a filterable item without any reference to a tvb */
2698
0
        offset = 0;
2699
0
    }
2700
2701
0
    if (show_col_info) {
2702
0
        col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "%s Version %d",
2703
0
                val_to_str_const(RES_CLASS(res_id), dvbci_res_class,
2704
0
                    "Invalid Resource class"),
2705
0
                RES_VER(res_id));
2706
0
    }
2707
2708
0
    return proto_tree_add_bitmask_value_with_flags(tree, tvb, offset,
2709
0
            hf_dvbci_res_id, ett_dvbci_res, dvb_ci_res_id_fields, res_id,
2710
0
            BMT_NO_APPEND);
2711
0
}
2712
2713
/* dissect the body of a resource manager apdu */
2714
static void
2715
dissect_dvbci_payload_rm(uint32_t tag, int len_field,
2716
        tvbuff_t *tvb, unsigned offset, conversation_t *conv _U_,
2717
        packet_info *pinfo, proto_tree *tree)
2718
0
{
2719
0
    const char *tag_str;
2720
2721
0
    if (tag==T_PROFILE) {
2722
0
        if (len_field % RES_ID_LEN) {
2723
0
            tag_str = val_to_str(pinfo->pool, tag, dvbci_apdu_tag, "Unknown: %d");
2724
0
            proto_tree_add_expert_format(tree, pinfo, &ei_dvbci_bad_length, tvb, 0, APDU_TAG_SIZE,
2725
0
                   "Invalid APDU length field, %s must be a multiple of 4 bytes",
2726
0
                   tag_str);
2727
0
            return;
2728
0
        }
2729
2730
0
        while (tvb_reported_length_remaining(tvb, offset) > 0) {
2731
0
            dissect_res_id(tvb, offset, pinfo, tree, 0, false);
2732
0
            offset += RES_ID_LEN;
2733
0
        }
2734
0
    }
2735
0
}
2736
2737
static void
2738
dissect_dvbci_payload_ap(uint32_t tag, int len_field _U_,
2739
        tvbuff_t *tvb, unsigned offset, conversation_t *conv _U_,
2740
        packet_info *pinfo, proto_tree *tree)
2741
0
{
2742
0
    uint8_t         menu_str_len;
2743
0
    unsigned        enc_len;
2744
0
    dvb_encoding_e  encoding;
2745
0
    const uint8_t  *menu_string;
2746
0
    uint8_t         data_rate;
2747
2748
0
    if (tag==T_APP_INFO) {
2749
0
        proto_tree_add_item(tree, hf_dvbci_app_type, tvb, offset, 1, ENC_BIG_ENDIAN);
2750
0
        offset++;
2751
0
        proto_tree_add_item(
2752
0
                tree, hf_dvbci_app_manf, tvb, offset, 2, ENC_BIG_ENDIAN);
2753
0
        offset+=2;
2754
0
        proto_tree_add_item(
2755
0
                tree, hf_dvbci_manf_code, tvb, offset, 2, ENC_BIG_ENDIAN);
2756
0
        offset+=2;
2757
0
        menu_str_len = tvb_get_uint8(tvb,offset);
2758
0
        proto_tree_add_item(
2759
0
                tree, hf_dvbci_menu_str_len, tvb, offset, 1, ENC_BIG_ENDIAN);
2760
0
        offset++;
2761
0
        if (menu_str_len > 0) {
2762
0
            enc_len = dvb_analyze_string_charset(
2763
0
                    tvb, offset, menu_str_len, &encoding);
2764
0
            dvb_add_chartbl(
2765
0
                    tree, hf_dvbci_ap_char_tbl, tvb, offset, enc_len, encoding);
2766
0
            offset += enc_len;
2767
0
            menu_str_len -= enc_len;
2768
0
            proto_tree_add_item_ret_string(tree, hf_dvbci_menu_str,
2769
0
                    tvb, offset, menu_str_len, dvb_enc_to_item_enc(encoding),
2770
0
                    pinfo->pool, &menu_string);
2771
0
            col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL,
2772
0
                    "Module name %s", menu_string);
2773
0
        }
2774
0
    }
2775
0
    else if (tag== T_DATARATE_INFO) {
2776
0
        data_rate = tvb_get_uint8(tvb, offset);
2777
0
        col_append_sep_str(pinfo->cinfo, COL_INFO, ": ",
2778
0
                    val_to_str(pinfo->pool, data_rate, dvbci_data_rate, "unknown (0x%x)"));
2779
0
        proto_tree_add_item(tree, hf_dvbci_data_rate, tvb, offset, 1, ENC_BIG_ENDIAN);
2780
0
    }
2781
0
}
2782
2783
static void
2784
dissect_dvbci_payload_ca(uint32_t tag, int len_field,
2785
        tvbuff_t *tvb, unsigned offset, conversation_t *conv _U_,
2786
        packet_info *pinfo, proto_tree *tree)
2787
0
{
2788
0
    const char *tag_str;
2789
0
    uint16_t     prog_num;
2790
0
    unsigned     prog_info_len;
2791
0
    unsigned     es_info_len, all_len;
2792
0
    unsigned     ca_desc_len;
2793
0
    bool         scrambled = false;
2794
0
    bool         es_scrambled = false;
2795
0
    proto_tree  *es_tree = NULL;
2796
0
    bool         desc_ok = false;
2797
2798
2799
0
    if (tag==T_CA_INFO) {
2800
0
        if (len_field % 2) {
2801
0
            tag_str = val_to_str(pinfo->pool, tag, dvbci_apdu_tag, "Unknown: %d");
2802
0
            proto_tree_add_expert_format(tree, pinfo, &ei_dvbci_bad_length, tvb, 0, APDU_TAG_SIZE,
2803
0
                    "Invalid APDU length field, %s must be a multiple of 2 bytes",
2804
0
                    tag_str);
2805
0
            return;
2806
0
        }
2807
2808
0
        while (tvb_reported_length_remaining(tvb, offset) > 0) {
2809
0
            proto_tree_add_item(
2810
0
                    tree, hf_dvbci_ca_sys_id, tvb, offset, 2, ENC_BIG_ENDIAN);
2811
0
            offset += 2;
2812
0
        }
2813
0
    }
2814
0
    else if (tag==T_CA_PMT) {
2815
0
        proto_tree_add_item(
2816
0
                tree, hf_dvbci_ca_pmt_list_mgmt, tvb, offset, 1, ENC_BIG_ENDIAN);
2817
0
        offset++;
2818
0
        prog_num = tvb_get_ntohs(tvb, offset);
2819
0
        col_append_sep_fstr(
2820
0
                pinfo->cinfo, COL_INFO, NULL, "Program number %x", prog_num);
2821
0
        proto_tree_add_item(
2822
0
                tree, hf_dvbci_prog_num, tvb, offset, 2, ENC_BIG_ENDIAN);
2823
0
        offset += 2;
2824
0
        proto_tree_add_item(
2825
0
                tree, hf_dvbci_ca_ver, tvb, offset, 1, ENC_BIG_ENDIAN);
2826
0
        proto_tree_add_item(
2827
0
                tree, hf_dvbci_curr_next, tvb, offset, 1, ENC_BIG_ENDIAN);
2828
0
        offset++;
2829
0
        prog_info_len = tvb_get_ntohs(tvb, offset) & 0x0FFF;
2830
        /* the definition of hf_dvbci_prog_info_len also applies the mask */
2831
0
        proto_tree_add_item(
2832
0
                tree, hf_dvbci_prog_info_len, tvb, offset, 2, ENC_BIG_ENDIAN);
2833
0
        offset += 2;
2834
0
        if (prog_info_len != 0) {
2835
0
            all_len = offset + prog_info_len;
2836
2837
0
            proto_tree_add_item(
2838
0
                    tree, hf_dvbci_ca_pmt_cmd_id, tvb, offset, 1, ENC_BIG_ENDIAN);
2839
0
            offset++;
2840
0
            while (offset < all_len) {
2841
0
                ca_desc_len = dissect_ca_desc(tvb, offset, pinfo, tree);
2842
0
                if (ca_desc_len <= 0)
2843
0
                    return;
2844
0
                offset += ca_desc_len;
2845
                /* set this only if we've seen at least one valid ca descriptor */
2846
0
                scrambled = true;
2847
0
            }
2848
0
        }
2849
0
        else {
2850
0
            proto_tree_add_expert(
2851
0
                    tree, pinfo, &ei_dvbci_no_ca_desc_prog, tvb, 0, 0);
2852
0
        }
2853
2854
0
        while (tvb_reported_length_remaining(tvb, offset) > 0) {
2855
0
            es_info_len = dissect_es(tvb, offset, pinfo, tree, &es_scrambled);
2856
0
            if (es_info_len <= 0)
2857
0
                return;
2858
0
            offset += es_info_len;
2859
0
            if (es_scrambled)
2860
0
                scrambled = true;
2861
0
        }
2862
2863
0
        col_append_sep_str(pinfo->cinfo, COL_INFO, NULL,
2864
0
                scrambled ? "scrambled service" : "free service");
2865
0
    }
2866
0
    else if (tag==T_CA_PMT_REPLY) {
2867
0
        prog_num = tvb_get_ntohs(tvb, offset);
2868
0
        col_append_sep_fstr(
2869
0
                pinfo->cinfo, COL_INFO, NULL, "Program number %x", prog_num);
2870
0
        proto_tree_add_item(
2871
0
                tree, hf_dvbci_prog_num, tvb, offset, 2, ENC_BIG_ENDIAN);
2872
0
        offset += 2;
2873
0
        proto_tree_add_item(
2874
0
                tree, hf_dvbci_ca_ver, tvb, offset, 1, ENC_BIG_ENDIAN);
2875
0
        proto_tree_add_item(
2876
0
                tree, hf_dvbci_curr_next, tvb, offset, 1, ENC_BIG_ENDIAN);
2877
0
        offset++;
2878
0
        desc_ok |= dissect_ca_enable(tvb, offset, pinfo, tree);
2879
0
        offset++;
2880
0
        while (tvb_reported_length_remaining(tvb, offset) > 0) {
2881
            /* there's no need to check for tree==NULL */
2882
0
            es_tree = proto_tree_add_subtree(tree, tvb, offset, 3, ett_dvbci_application, NULL, "Elementary Stream");
2883
2884
0
            proto_tree_add_item(es_tree, hf_dvbci_es_pid,
2885
0
                    tvb, offset, 2, ENC_BIG_ENDIAN);
2886
0
            offset += 2;
2887
0
            desc_ok |= dissect_ca_enable(tvb, offset, pinfo, es_tree);
2888
0
            offset++;
2889
0
        }
2890
0
        if (desc_ok) {
2891
0
            col_append_sep_str(
2892
0
                pinfo->cinfo, COL_INFO, NULL, "descrambling possible");
2893
0
        }
2894
0
     }
2895
0
}
2896
2897
2898
static void
2899
dissect_dvbci_payload_aut(uint32_t tag, int len_field _U_,
2900
        tvbuff_t *tvb, unsigned offset, conversation_t *conv _U_,
2901
        packet_info *pinfo _U_, proto_tree *tree)
2902
0
{
2903
0
    int bytes_len;
2904
2905
0
    proto_tree_add_item(tree, hf_dvbci_auth_proto_id,
2906
0
            tvb, offset, 2, ENC_BIG_ENDIAN);
2907
0
    offset += 2;
2908
2909
0
    bytes_len = tvb_reported_length_remaining(tvb, offset);
2910
0
    if (bytes_len <= 0)
2911
0
        return;
2912
2913
0
    if (tag==T_AUTH_REQ) {
2914
0
        proto_tree_add_item(tree, hf_dvbci_auth_req_bytes,
2915
0
            tvb, offset, bytes_len, ENC_NA);
2916
0
    }
2917
0
    else if (tag==T_AUTH_RESP) {
2918
0
        proto_tree_add_item(tree, hf_dvbci_auth_resp_bytes,
2919
0
            tvb, offset, bytes_len, ENC_NA);
2920
0
    }
2921
0
}
2922
2923
2924
static void
2925
dissect_dvbci_payload_hc(uint32_t tag, int len_field _U_,
2926
        tvbuff_t *tvb, unsigned offset, conversation_t *conv _U_,
2927
        packet_info *pinfo, proto_tree *tree)
2928
0
{
2929
0
    proto_item *pi;
2930
0
    uint16_t    nid, onid, tsid, svcid;
2931
0
    uint8_t     ref;
2932
0
    uint16_t    old_pid, new_pid;
2933
0
    bool        pmt_flag;
2934
0
    int         desc_loop_len;
2935
0
    tvbuff_t   *pmt_tvb = NULL;
2936
0
    uint8_t     status;
2937
2938
2939
0
    switch (tag) {
2940
0
        case T_TUNE:
2941
0
            nid = tvb_get_ntohs(tvb, offset);
2942
0
            pi = proto_tree_add_item(
2943
0
                    tree, hf_dvbci_network_id, tvb, offset, 2, ENC_BIG_ENDIAN);
2944
0
            if (nid) {
2945
0
                expert_add_info(pinfo, pi, &ei_dvbci_network_id);
2946
0
            }
2947
0
            offset += 2;
2948
0
            onid = tvb_get_ntohs(tvb, offset);
2949
0
            proto_tree_add_item(tree, hf_dvbci_original_network_id,
2950
0
                    tvb, offset, 2, ENC_BIG_ENDIAN);
2951
0
            offset += 2;
2952
0
            tsid = tvb_get_ntohs(tvb, offset);
2953
0
            proto_tree_add_item(tree, hf_dvbci_transport_stream_id,
2954
0
                    tvb, offset, 2, ENC_BIG_ENDIAN);
2955
0
            offset += 2;
2956
0
            svcid = tvb_get_ntohs(tvb, offset);
2957
0
            proto_tree_add_item(
2958
0
                    tree, hf_dvbci_service_id, tvb, offset, 2, ENC_BIG_ENDIAN);
2959
0
            col_append_sep_fstr(pinfo->cinfo, COL_INFO, ": ",
2960
0
                    "nid 0x%x, onid 0x%x, tsid 0x%x, svcid 0x%x",
2961
0
                    nid, onid, tsid, svcid);
2962
0
            break;
2963
0
        case T_REPLACE:
2964
0
            proto_tree_add_item_ret_uint8(tree, hf_dvbci_replacement_ref,
2965
0
                    tvb, offset, 1, ENC_BIG_ENDIAN, &ref);
2966
0
            offset++;
2967
0
            proto_tree_add_item_ret_uint16(tree, hf_dvbci_replaced_pid,
2968
0
                    tvb, offset, 2, ENC_BIG_ENDIAN, &old_pid);
2969
0
            offset += 2;
2970
0
            proto_tree_add_item_ret_uint16( tree, hf_dvbci_replacement_pid,
2971
0
                    tvb, offset, 2, ENC_BIG_ENDIAN, &new_pid);
2972
0
            col_append_sep_fstr(pinfo->cinfo, COL_INFO, ": ",
2973
0
                    "ref 0x%x, 0x%x -> 0x%x", ref, old_pid, new_pid);
2974
0
            break;
2975
0
        case T_CLEAR_REPLACE:
2976
0
            proto_tree_add_item_ret_uint8(tree, hf_dvbci_replacement_ref,
2977
0
                    tvb, offset, 1, ENC_BIG_ENDIAN, &ref);
2978
0
            col_append_sep_fstr(pinfo->cinfo, COL_INFO, ": ", "ref 0x%x", ref);
2979
0
            break;
2980
0
        case T_TUNE_BROADCAST_REQ:
2981
0
            pmt_flag = ((tvb_get_uint8(tvb, offset) & 0x01) == 0x01);
2982
0
            proto_tree_add_item(tree, hf_dvbci_pmt_flag,
2983
0
                    tvb, offset, 1, ENC_BIG_ENDIAN);
2984
0
            offset++;
2985
0
            proto_tree_add_item(
2986
0
                    tree, hf_dvbci_service_id, tvb, offset, 2, ENC_BIG_ENDIAN);
2987
0
            offset += 2;
2988
0
            desc_loop_len = dissect_desc_loop(hf_dvbci_hc_desc_loop_len,
2989
0
                                tvb, offset, pinfo, tree);
2990
0
            if (desc_loop_len<0)
2991
0
                break;
2992
0
            offset += desc_loop_len;
2993
0
            if (pmt_flag) {
2994
0
                pmt_tvb = tvb_new_subset_remaining(tvb, offset);
2995
0
                if (mpeg_pmt_handle) {
2996
0
                    col_append_str(pinfo->cinfo, COL_INFO, ", ");
2997
                    /* prevent mpeg_pmt dissector from clearing col_info */
2998
0
                    col_set_fence(pinfo->cinfo, COL_INFO);
2999
0
                    call_dissector(mpeg_pmt_handle, pmt_tvb, pinfo, tree);
3000
0
                }
3001
0
                else
3002
0
                    call_dissector(data_handle, pmt_tvb, pinfo, tree);
3003
0
            }
3004
0
            break;
3005
0
        case T_TUNE_REPLY:
3006
0
            proto_tree_add_item_ret_uint8(tree, hf_dvbci_hc_status,
3007
0
                    tvb, offset, 1, ENC_BIG_ENDIAN, &status);
3008
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, ": ",
3009
0
                        (status == HC_STAT_OK ?  "ok" : "error"));
3010
0
            break;
3011
0
        case T_ASK_RELEASE_REPLY:
3012
0
            proto_tree_add_item(tree, hf_dvbci_hc_release_reply,
3013
0
                    tvb, offset, 1, ENC_BIG_ENDIAN);
3014
0
            break;
3015
0
        default:
3016
0
            break;
3017
0
    }
3018
0
}
3019
3020
3021
static void
3022
dissect_dvbci_payload_dt(uint32_t tag, int len_field,
3023
        tvbuff_t *tvb, unsigned offset, conversation_t *conv _U_,
3024
        packet_info *pinfo, proto_tree *tree)
3025
0
{
3026
0
    nstime_t     resp_intv;
3027
0
    proto_item  *pi = NULL;
3028
0
    const char *tag_str;
3029
0
    int          time_field_len;
3030
0
    nstime_t     utc_time;
3031
0
    int16_t      local_offset;  /* field in the apdu */
3032
3033
3034
0
    if (tag==T_DATE_TIME_ENQ) {
3035
0
        nstime_set_zero(&resp_intv);
3036
0
        resp_intv.secs = tvb_get_uint8(tvb, offset);
3037
0
        pi = proto_tree_add_time(tree, hf_dvbci_resp_intv,
3038
0
                tvb, offset, 1, &resp_intv);
3039
0
        if (resp_intv.secs==0) {
3040
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "individual query");
3041
0
            proto_item_append_text(pi, " (individual query)");
3042
0
        }
3043
0
        else {
3044
0
            col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL,
3045
0
                    "update every %s", rel_time_to_str(pinfo->pool, &resp_intv));
3046
0
        }
3047
0
    }
3048
0
    else if (tag==T_DATE_TIME) {
3049
0
        if (len_field!=5 && len_field!=7) {
3050
0
            tag_str = val_to_str_const(tag, dvbci_apdu_tag, "unknown");
3051
0
            proto_tree_add_expert_format(tree, pinfo, &ei_dvbci_bad_length, tvb, APDU_TAG_SIZE, offset-APDU_TAG_SIZE,
3052
0
                    "Invalid APDU length field, %s must be 5 or 7 bytes", tag_str);
3053
0
            return;
3054
0
        }
3055
3056
0
        time_field_len = packet_mpeg_sect_mjd_to_utc_time(tvb, offset, &utc_time);
3057
0
        if (time_field_len<0) {
3058
0
            proto_tree_add_expert_format(tree, pinfo, &ei_dvbci_bad_length, tvb, offset, 5,
3059
0
                "Invalid UTC time field, 2 bytes MJD, 3 bytes BCD time hhmmss");
3060
0
            return;
3061
0
        }
3062
0
        proto_tree_add_time(tree, hf_dvbci_utc_time,
3063
0
                tvb, offset, time_field_len, &utc_time);
3064
0
        col_append_sep_fstr(pinfo->cinfo, COL_INFO, ": ", "%s UTC",
3065
0
                abs_time_to_str(pinfo->pool, &utc_time, ABSOLUTE_TIME_UTC, false));
3066
0
        offset += time_field_len;
3067
3068
0
        if (len_field==7) {
3069
0
            local_offset = two_comp_to_int16(tvb_get_ntohs(tvb, offset));
3070
0
            proto_tree_add_int_format(tree, hf_dvbci_local_offset,
3071
0
                    tvb, offset, 2, local_offset,
3072
0
                    "offset between UTC and local time is %d minutes",
3073
0
                    local_offset);
3074
0
        }
3075
0
        else {
3076
0
            proto_tree_add_expert(tree, pinfo, &ei_dvbci_time_offs_unknown,
3077
0
                    tvb, 0, 0);
3078
0
        }
3079
0
    }
3080
0
}
3081
3082
3083
static void
3084
dissect_dvbci_payload_mmi(uint32_t tag, int len_field,
3085
        tvbuff_t *tvb, unsigned offset, conversation_t *conv _U_,
3086
        packet_info *pinfo, proto_tree *tree)
3087
0
{
3088
0
    int             offset_start;
3089
0
    proto_item     *pi;
3090
0
    uint8_t         close_mmi_cmd_id;
3091
0
    uint8_t         disp_ctl_cmd, disp_rep_id;
3092
0
    const char     *disp_ctl_cmd_str = NULL, *disp_rep_id_str = NULL;
3093
0
    int             msg_len;
3094
0
    unsigned        enc_len;
3095
0
    dvb_encoding_e  encoding;
3096
0
    uint8_t         ans_txt_len;
3097
0
    uint8_t         ans_id;
3098
0
    uint8_t         choice_or_item_nb;
3099
0
    int             text_len;
3100
0
    uint8_t         choice_ref;
3101
3102
3103
0
    offset_start = offset;
3104
3105
0
    switch(tag) {
3106
0
        case T_CLOSE_MMI:
3107
0
            close_mmi_cmd_id = tvb_get_uint8(tvb,offset);
3108
0
            proto_tree_add_item(tree, hf_dvbci_close_mmi_cmd_id,
3109
0
                    tvb, offset, 1, ENC_BIG_ENDIAN);
3110
0
            offset++;
3111
            /* apdu layer len field checks are sufficient for "immediate" */
3112
0
            if (close_mmi_cmd_id == CLOSE_MMI_CMD_ID_DELAY) {
3113
0
                if (len_field != 2) {
3114
0
                    proto_tree_add_expert_format(tree, pinfo, &ei_dvbci_bad_length, tvb,
3115
0
                            APDU_TAG_SIZE, offset_start-APDU_TAG_SIZE,
3116
0
                            "Length field must be 2");
3117
0
                    return;
3118
0
                }
3119
0
                proto_tree_add_item(tree, hf_dvbci_close_mmi_delay, tvb,
3120
0
                        offset, 1, ENC_BIG_ENDIAN);
3121
0
            }
3122
0
            break;
3123
0
        case T_DISPLAY_CONTROL:
3124
0
            disp_ctl_cmd = tvb_get_uint8(tvb,offset);
3125
0
            disp_ctl_cmd_str = val_to_str_const(disp_ctl_cmd,
3126
0
                                                dvbci_disp_ctl_cmd, "unknown command");
3127
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, ": ",
3128
0
                    disp_ctl_cmd_str);
3129
0
            proto_tree_add_item(tree, hf_dvbci_disp_ctl_cmd, tvb,
3130
0
                    offset, 1, ENC_BIG_ENDIAN);
3131
0
            offset++;
3132
0
            if (disp_ctl_cmd == DISP_CMD_SET_MMI_MODE)
3133
0
            {
3134
0
                proto_tree_add_item(tree, hf_dvbci_mmi_mode, tvb,
3135
0
                        offset, 1, ENC_BIG_ENDIAN);
3136
0
                if (len_field != 2) {
3137
0
                    proto_tree_add_expert_format(tree, pinfo, &ei_dvbci_bad_length, tvb,
3138
0
                            APDU_TAG_SIZE, offset_start-APDU_TAG_SIZE,
3139
0
                            "Length field must be 2");
3140
0
                    return;
3141
0
                }
3142
0
            }
3143
0
            break;
3144
0
        case T_DISPLAY_REPLY:
3145
0
            disp_rep_id = tvb_get_uint8(tvb,offset);
3146
0
            disp_rep_id_str = val_to_str_const(disp_rep_id,
3147
0
                    dvbci_disp_rep_id, "unknown command");
3148
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, ": ",
3149
0
                    disp_rep_id_str);
3150
0
            proto_tree_add_item(tree, hf_dvbci_disp_rep_id,
3151
0
                    tvb, offset, 1, ENC_BIG_ENDIAN);
3152
0
            offset++;
3153
0
            if (disp_rep_id == DISP_REP_ID_MMI_MODE_ACK) {
3154
0
                proto_tree_add_item(tree, hf_dvbci_mmi_mode,
3155
0
                        tvb, offset, 1, ENC_BIG_ENDIAN);
3156
0
            }
3157
0
            else if (disp_rep_id == DISP_REP_ID_DISP_CHAR_TBL ||
3158
0
                     disp_rep_id == DISP_REP_ID_INP_CHAR_TBL) {
3159
0
                while ((msg_len=tvb_reported_length_remaining(tvb, offset)) > 0) {
3160
0
                    enc_len = dvb_analyze_string_charset(
3161
0
                            tvb, offset, msg_len, &encoding);
3162
0
                    if (enc_len==0) {
3163
0
                        proto_tree_add_expert(tree, pinfo,
3164
0
                            &ei_dvbci_invalid_char_tbl, tvb, offset, msg_len);
3165
0
                        break;
3166
0
                    }
3167
0
                    dvb_add_chartbl(tree, hf_dvbci_mmi_char_tbl,
3168
0
                            tvb, offset, enc_len, encoding);
3169
0
                    offset += enc_len;
3170
0
                 }
3171
0
            }
3172
0
            break;
3173
0
        case T_ENQ:
3174
0
            proto_tree_add_item(tree, hf_dvbci_blind_ans,
3175
0
                    tvb, offset, 1, ENC_BIG_ENDIAN);
3176
0
            offset++;
3177
0
            ans_txt_len = tvb_get_uint8(tvb,offset);
3178
0
            pi = proto_tree_add_item(tree, hf_dvbci_ans_txt_len,
3179
0
                    tvb, offset, 1, ENC_BIG_ENDIAN);
3180
0
            if (ans_txt_len == NB_UNKNOWN) {
3181
0
                proto_item_append_text(pi,
3182
0
                        " (Length of expected answer is unknown)");
3183
0
            }
3184
0
            offset++;
3185
0
            dissect_si_string(tvb, offset,
3186
0
                    tvb_reported_length_remaining(tvb, offset),
3187
0
                    pinfo, tree, hf_dvbci_enq, "Enquiry string", false);
3188
0
            break;
3189
0
        case T_ANSW:
3190
0
            proto_tree_add_item_ret_uint8(tree, hf_dvbci_ans_id, tvb, offset, 1, ENC_BIG_ENDIAN, &ans_id);
3191
0
            offset++;
3192
0
            if (ans_id == ANSW_ID_ANSWER) {
3193
0
                dissect_si_string(tvb, offset,
3194
0
                    tvb_reported_length_remaining(tvb, offset),
3195
0
                    pinfo, tree, hf_dvbci_ans, "Answer", true);
3196
0
            }
3197
0
            break;
3198
0
        case T_MENU_LAST:
3199
0
        case T_MENU_MORE:
3200
0
        case T_LIST_LAST:
3201
0
        case T_LIST_MORE:
3202
0
            choice_or_item_nb = tvb_get_uint8(tvb,offset);
3203
0
            if (IS_MENU_APDU(tag)) {
3204
0
                pi = proto_tree_add_item(
3205
0
                        tree, hf_dvbci_choice_nb, tvb, offset, 1, ENC_BIG_ENDIAN);
3206
0
                if (choice_or_item_nb == NB_UNKNOWN) {
3207
0
                    proto_item_append_text(pi,
3208
0
                            " (Number of choices is unknown)");
3209
0
                }
3210
0
            }
3211
0
            else {
3212
0
                pi = proto_tree_add_item(
3213
0
                        tree, hf_dvbci_item_nb, tvb, offset, 1, ENC_BIG_ENDIAN);
3214
0
                if (choice_or_item_nb == NB_UNKNOWN) {
3215
0
                    proto_item_append_text(pi,
3216
0
                            "(Number of items is unknown)");
3217
0
                }
3218
0
            }
3219
0
            offset++;
3220
0
            text_len = dissect_dvbci_text("Title", tvb, offset,
3221
0
                    pinfo, tree, hf_dvbci_title);
3222
0
            offset += text_len;
3223
0
            text_len = dissect_dvbci_text("Sub-title", tvb, offset,
3224
0
                    pinfo, tree, hf_dvbci_subtitle);
3225
0
            offset += text_len;
3226
0
            text_len = dissect_dvbci_text("Bottom line", tvb, offset,
3227
0
                    pinfo, tree, hf_dvbci_bottom);
3228
0
            offset += text_len;
3229
0
            while (tvb_reported_length_remaining(tvb, offset) > 0) {
3230
0
                text_len = dissect_dvbci_text("Item", tvb, offset, pinfo, tree, hf_dvbci_item);
3231
                /* minimum is apdu tag + 1 byte len field */
3232
0
                if (text_len<APDU_TAG_SIZE+1) {
3233
0
                    proto_tree_add_expert_remaining(tree, pinfo, &ei_dvbci_not_text_more_or_text_last, tvb, offset);
3234
0
                    return;
3235
0
                }
3236
0
                offset += text_len;
3237
0
            }
3238
0
            break;
3239
0
        case T_MENU_ANSW:
3240
0
            choice_ref = tvb_get_uint8(tvb,offset);
3241
0
            pi = proto_tree_add_item(
3242
0
                    tree, hf_dvbci_choice_ref, tvb, offset, 1, ENC_BIG_ENDIAN);
3243
0
            if (choice_ref == 0x0) {
3244
0
                proto_item_append_text(pi, " (Selection was cancelled)");
3245
0
                col_append_sep_str(pinfo->cinfo, COL_INFO, ": ",
3246
0
                        "cancelled");
3247
0
            }
3248
0
            else {
3249
0
                col_append_sep_fstr(pinfo->cinfo, COL_INFO, ": ",
3250
0
                        "Item %d", choice_ref);
3251
0
            }
3252
0
            break;
3253
0
        default:
3254
0
            break;
3255
0
    }
3256
0
}
3257
3258
3259
static void
3260
dissect_dvbci_payload_hlc(uint32_t tag, int len_field _U_,
3261
        tvbuff_t *tvb, unsigned offset, conversation_t *conv _U_,
3262
        packet_info *pinfo, proto_tree *tree)
3263
0
{
3264
0
  const char *str;
3265
3266
0
  if (tag==T_HOST_COUNTRY) {
3267
0
      proto_tree_add_item(tree, hf_dvbci_host_country,
3268
0
              tvb, offset, tvb_reported_length_remaining(tvb, offset),
3269
0
              ENC_ISO_8859_1);
3270
0
  }
3271
0
  else if (tag==T_HOST_LANGUAGE) {
3272
0
      proto_tree_add_item(tree, hf_dvbci_host_language,
3273
0
              tvb, offset, tvb_reported_length_remaining(tvb, offset),
3274
0
              ENC_ISO_8859_1);
3275
0
  }
3276
3277
  /* both apdus' body is only a country code, this can be shared */
3278
0
  str = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset,
3279
0
              tvb_reported_length_remaining(tvb, offset),
3280
0
              ENC_ISO_8859_1|ENC_NA);
3281
0
  if (str)
3282
0
      col_append_sep_str(pinfo->cinfo, COL_INFO, ": ", str);
3283
0
}
3284
3285
3286
static void
3287
dissect_dvbci_payload_cup(uint32_t tag, int len_field _U_,
3288
        tvbuff_t *tvb, unsigned offset, conversation_t *conv _U_,
3289
        packet_info *pinfo, proto_tree *tree)
3290
0
{
3291
0
  uint8_t     upgrade_type;
3292
0
  uint16_t    download_time;
3293
0
  uint8_t     answer, progress;
3294
3295
0
  switch(tag) {
3296
0
    case T_CAM_FIRMWARE_UPGRADE:
3297
0
      proto_tree_add_item_ret_uint8(tree, hf_dvbci_cup_type, tvb, offset, 1, ENC_BIG_ENDIAN, &upgrade_type);
3298
0
      col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "(%s)",
3299
0
                    val_to_str_const(upgrade_type, dvbci_cup_type, "unknown"));
3300
0
      offset++;
3301
0
      download_time = tvb_get_ntohs(tvb, offset);
3302
0
      if (download_time == 0) {
3303
0
          proto_tree_add_uint_format(tree, hf_dvbci_cup_download_time,
3304
0
                  tvb, offset, 2, download_time,
3305
0
                  "estimated download time is unknown");
3306
0
      }
3307
0
      else {
3308
0
          proto_tree_add_uint_format(tree, hf_dvbci_cup_download_time,
3309
0
                  tvb, offset, 2, download_time,
3310
0
                  "estimated download time is %d seconds",
3311
0
                  download_time);
3312
0
      }
3313
0
      break;
3314
0
    case T_CAM_FIRMWARE_UPGRADE_REPLY:
3315
0
      proto_tree_add_item_ret_uint8(tree, hf_dvbci_cup_answer, tvb, offset, 1, ENC_BIG_ENDIAN, &answer);
3316
0
      col_append_sep_str(pinfo->cinfo, COL_INFO, ": ",
3317
0
                    val_to_str_const(answer, dvbci_cup_answer, "unknown"));
3318
0
      break;
3319
0
    case T_CAM_FIRMWARE_UPGRADE_PROGRESS:
3320
0
      progress = tvb_get_uint8(tvb, offset);
3321
0
      if (progress > 100) {
3322
0
        proto_tree_add_expert(tree, pinfo, &ei_dvbci_cup_progress, tvb, offset, 1);
3323
0
      }
3324
0
      else {
3325
0
          col_append_sep_fstr(pinfo->cinfo, COL_INFO, ": ", "%d%%", progress);
3326
0
          proto_tree_add_uint_format(tree, hf_dvbci_cup_progress,
3327
0
                  tvb, offset, 1, progress,
3328
0
                  "download progress %d%%", progress);
3329
0
      }
3330
0
      break;
3331
0
    case T_CAM_FIRMWARE_UPGRADE_COMPLETE:
3332
0
      proto_tree_add_item(tree, hf_dvbci_cup_reset, tvb, offset, 1, ENC_BIG_ENDIAN);
3333
0
      break;
3334
0
    default:
3335
0
      break;
3336
0
  }
3337
0
}
3338
3339
static int exp_pdu_data_dvbci_size(packet_info *pinfo _U_, void* data _U_)
3340
0
{
3341
0
  return EXP_PDU_TAG_DVBCI_EVT_LEN + 4;
3342
0
}
3343
3344
static int exp_pdu_data_dvbci_populate_data(packet_info *pinfo, void* data, uint8_t *tlv_buffer, uint32_t buffer_size _U_)
3345
0
{
3346
0
  phtonu16(&tlv_buffer[0], EXP_PDU_TAG_DVBCI_EVT);
3347
0
  phtonu16(&tlv_buffer[2], EXP_PDU_TAG_DVBCI_EVT_LEN);
3348
0
  tlv_buffer[4] = dvbci_get_evt_from_addrs(pinfo);
3349
3350
0
  return exp_pdu_data_dvbci_size(pinfo, data);
3351
0
}
3352
3353
static exp_pdu_data_item_t exp_pdu_dvbci = {exp_pdu_data_dvbci_size, exp_pdu_data_dvbci_populate_data, NULL};
3354
3355
static void
3356
dissect_sac_msg(uint32_t tag, tvbuff_t *tvb, unsigned offset,
3357
        packet_info *pinfo, proto_tree *tree, bool exported)
3358
0
{
3359
0
    int         offset_start;
3360
0
    uint32_t    msg_ctr;
3361
0
    uint8_t     enc_flag, enc_cip;
3362
0
    proto_item *enc_flag_pi;
3363
0
    uint16_t    sac_payload_len;          /* payload data and padding */
3364
0
    int         sac_payload_data_len = 0; /* just payload data */
3365
0
    tvbuff_t   *clear_sac_body_tvb;
3366
0
    proto_tree *sac_tree             = NULL;
3367
0
    bool        is_exportable        = false;
3368
3369
0
    offset_start = offset;
3370
3371
    /* it's not useful to move sac header dissection to a separate
3372
       function, we need enc/auth cipher etc here to handle the body */
3373
0
    msg_ctr = tvb_get_ntohl(tvb, offset);
3374
0
    proto_tree_add_item(tree, hf_dvbci_sac_msg_ctr,
3375
0
            tvb, offset, 4, ENC_BIG_ENDIAN);
3376
0
    col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL,
3377
0
            "message #%d", msg_ctr);
3378
0
    offset += 4;
3379
0
    proto_tree_add_item(tree, hf_dvbci_sac_proto_ver,
3380
0
            tvb, offset, 1, ENC_BIG_ENDIAN);
3381
0
    proto_tree_add_item(tree, hf_dvbci_sac_auth_cip,
3382
0
            tvb, offset, 1, ENC_BIG_ENDIAN);
3383
0
    enc_flag = tvb_get_uint8(tvb, offset) & 0x1;
3384
0
    enc_flag_pi = proto_tree_add_item(tree, hf_dvbci_sac_payload_enc,
3385
0
            tvb, offset, 1, ENC_BIG_ENDIAN);
3386
0
    if (exported && enc_flag) {
3387
0
        expert_add_info(pinfo, enc_flag_pi, &ei_dvbci_sac_payload_enc);
3388
0
        enc_flag = 0;
3389
0
    }
3390
0
    offset++;
3391
0
    enc_cip = (tvb_get_uint8(tvb, offset)&0xE0) >> 5;
3392
0
    proto_tree_add_item(tree, hf_dvbci_sac_enc_cip,
3393
0
            tvb, offset, 1, ENC_BIG_ENDIAN);
3394
0
    offset++;
3395
0
    sac_payload_len = tvb_get_ntohs(tvb, offset);
3396
0
    proto_tree_add_item(tree, hf_dvbci_sac_payload_len,
3397
0
            tvb, offset, 2, ENC_BIG_ENDIAN);
3398
0
    offset += 2;
3399
0
    if (enc_flag) {
3400
0
        clear_sac_body_tvb = decrypt_sac_msg_body(pinfo, enc_cip,
3401
0
                tvb, offset, tvb_reported_length_remaining(tvb, offset));
3402
0
    }
3403
0
    else {
3404
0
        clear_sac_body_tvb = tvb_new_subset_remaining(tvb, offset);
3405
0
    }
3406
0
    if (!clear_sac_body_tvb) {
3407
        /* we could not decrypt (or access) the clear sac message body */
3408
0
        proto_tree_add_item(tree, hf_dvbci_sac_enc_body, tvb, offset,
3409
0
                tvb_reported_length_remaining(tvb, offset), ENC_NA);
3410
0
        return;
3411
0
    }
3412
0
    if (enc_flag)
3413
0
        add_new_data_source(pinfo, clear_sac_body_tvb, "Clear SAC message body");
3414
0
    if (sac_payload_len>0) {
3415
0
        sac_tree = proto_tree_add_subtree(tree, clear_sac_body_tvb, 0, sac_payload_len,
3416
0
                ett_dvbci_sac_msg_body, NULL, "SAC message payload");
3417
0
        if (tag==T_CC_SAC_DATA_REQ || tag==T_CC_SAC_DATA_CNF) {
3418
0
            sac_payload_data_len = dissect_cc_data_payload(tag,
3419
0
                    clear_sac_body_tvb, 0, pinfo, sac_tree, &is_exportable);
3420
0
        }
3421
0
        else if (tag==T_CC_SAC_SYNC_REQ) {
3422
0
            sac_payload_data_len = 0;
3423
0
        }
3424
0
        else if (tag==T_CC_SAC_SYNC_CNF) {
3425
0
            proto_tree_add_item(sac_tree, hf_dvbci_cc_status_field,
3426
0
                    clear_sac_body_tvb, 0, 1, ENC_BIG_ENDIAN);
3427
0
            sac_payload_data_len = 1;
3428
0
        }
3429
3430
0
        if (sac_payload_data_len < 0)
3431
0
            return;
3432
0
        if (sac_payload_len > sac_payload_data_len) {
3433
0
            proto_tree_add_item(sac_tree, hf_dvbci_sac_padding,
3434
0
                    clear_sac_body_tvb, sac_payload_data_len,
3435
0
                    sac_payload_len-sac_payload_data_len, ENC_NA);
3436
0
        }
3437
0
    }
3438
0
    proto_tree_add_item(tree, hf_dvbci_sac_signature,
3439
0
            clear_sac_body_tvb, sac_payload_len,
3440
0
            tvb_reported_length_remaining(clear_sac_body_tvb,
3441
0
                sac_payload_len), ENC_NA);
3442
3443
    /* we call this function also to dissect exported SAC messages,
3444
        don't try to export them a second time */
3445
0
    if (!exported && is_exportable && have_tap_listener(exported_pdu_tap)) {
3446
0
        static const exp_pdu_data_item_t *dvbci_exp_pdu_items[] = {
3447
0
            &exp_pdu_dvbci,
3448
0
            NULL
3449
0
        };
3450
3451
0
        tvbuff_t       *clear_sac_msg_tvb;
3452
0
        exp_pdu_data_t *exp_pdu_data;
3453
3454
0
        clear_sac_msg_tvb = tvb_new_composite();
3455
0
        tvb_composite_append(clear_sac_msg_tvb,
3456
0
                tvb_clone_offset_len(tvb, offset_start, SAC_MSG_HDR_LEN));
3457
0
        tvb_composite_append(clear_sac_msg_tvb, clear_sac_body_tvb);
3458
0
        tvb_composite_finalize(clear_sac_msg_tvb);
3459
3460
0
        exp_pdu_data = export_pdu_create_tags(pinfo, EXPORTED_SAC_MSG_PROTO, EXP_PDU_TAG_DISSECTOR_NAME, dvbci_exp_pdu_items);
3461
3462
0
        exp_pdu_data->tvb_captured_length = tvb_captured_length(clear_sac_msg_tvb);
3463
0
        exp_pdu_data->tvb_reported_length = tvb_reported_length(clear_sac_msg_tvb);
3464
0
        exp_pdu_data->pdu_tvb = clear_sac_msg_tvb;
3465
0
        tap_queue_packet(exported_pdu_tap, pinfo, exp_pdu_data);
3466
0
    }
3467
0
}
3468
3469
3470
static int
3471
dissect_dvbci_exported_sac_msg(
3472
        tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
3473
0
{
3474
0
    uint8_t evt;
3475
0
    uint32_t tag;
3476
3477
0
    evt = dvbci_get_evt_from_addrs(pinfo);
3478
0
    if (!IS_DATA_TRANSFER(evt))
3479
0
        return 0;
3480
3481
0
    col_append_sep_str(pinfo->cinfo, COL_PROTOCOL, NULL, EXPORTED_SAC_MSG_DESCRIPTION);
3482
0
    col_clear(pinfo->cinfo, COL_INFO);
3483
3484
    /* we only export cc_sac_data_req and _cnf, therefore, the tag can be
3485
       derived from the direction of the transfer */
3486
0
    if (evt== DVBCI_EVT_DATA_CAM_TO_HOST)
3487
0
       tag = T_CC_SAC_DATA_REQ;
3488
0
    else
3489
0
       tag = T_CC_SAC_DATA_CNF;
3490
3491
0
    col_append_sep_str(pinfo->cinfo, COL_INFO, NULL,
3492
0
            val_to_str_const(tag, dvbci_apdu_tag, "unknown"));
3493
3494
0
    dissect_sac_msg(tag, tvb, 0, pinfo, tree, true);
3495
0
    return tvb_reported_length(tvb);
3496
0
}
3497
3498
3499
static void
3500
dissect_dvbci_payload_cc(uint32_t tag, int len_field _U_,
3501
        tvbuff_t *tvb, unsigned offset, conversation_t *conv _U_,
3502
        packet_info *pinfo, proto_tree *tree)
3503
0
{
3504
0
    uint8_t     status;
3505
0
    proto_item *pi;
3506
0
    nstime_t    utc_time;
3507
0
    uint8_t     pin_stat;
3508
0
    uint8_t     evt_cent;
3509
3510
0
    switch(tag) {
3511
0
        case T_CC_OPEN_CNF:
3512
0
            proto_tree_add_item(tree, hf_dvbci_cc_sys_id_bitmask,
3513
0
                    tvb, offset, 1, ENC_BIG_ENDIAN);
3514
0
            break;
3515
0
        case T_CC_DATA_REQ:
3516
0
        case T_CC_DATA_CNF:
3517
0
            dissect_cc_data_payload(tag, tvb, offset, pinfo, tree, NULL);
3518
0
            break;
3519
0
        case T_CC_SYNC_CNF:
3520
0
            status = tvb_get_uint8(tvb, offset);
3521
0
            proto_tree_add_item(
3522
0
                    tree, hf_dvbci_cc_status_field, tvb, offset, 1, ENC_BIG_ENDIAN);
3523
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, ": ",
3524
0
                    val_to_str_const(status, dvbci_cc_status, "unknown"));
3525
0
            break;
3526
0
        case T_CC_SAC_DATA_REQ:
3527
0
        case T_CC_SAC_DATA_CNF:
3528
0
        case T_CC_SAC_SYNC_REQ:
3529
0
        case T_CC_SAC_SYNC_CNF:
3530
0
            dissect_sac_msg(tag, tvb, offset, pinfo, tree, false);
3531
0
            break;
3532
0
        case T_CC_PIN_CAPABILITIES_REPLY:
3533
0
            proto_tree_add_item(tree, hf_dvbci_capability_field,
3534
0
                    tvb, offset, 1 , ENC_BIG_ENDIAN);
3535
0
            offset++;
3536
            /* we can't call packet_mpeg_sect_mjd_to_utc_time()
3537
               and check with nstime_is_zero() */
3538
0
            if (tvb_get_ntoh40(tvb, offset) == 0) {
3539
0
                proto_tree_add_expert(tree, pinfo, &ei_dvbci_cc_pin_nvr_chg,
3540
0
                        tvb, offset, UTC_TIME_LEN);
3541
0
            }
3542
0
            else {
3543
0
                if (packet_mpeg_sect_mjd_to_utc_time(tvb, offset, &utc_time) < 0) {
3544
0
                    proto_tree_add_expert_format(tree, pinfo, &ei_dvbci_bad_length, tvb, offset, UTC_TIME_LEN,
3545
0
                            "Invalid UTC time field, 2 bytes MJD, 3 bytes BCD time hhmmss");
3546
0
                    break;
3547
0
                }
3548
0
                else {
3549
0
                    proto_tree_add_time(tree, hf_dvbci_pin_chg_time,
3550
0
                            tvb, offset, UTC_TIME_LEN, &utc_time);
3551
0
                }
3552
0
            }
3553
0
            offset += UTC_TIME_LEN;
3554
0
            dissect_rating(tvb, offset, pinfo, tree);
3555
0
            break;
3556
0
        case T_CC_PIN_REPLY:
3557
0
            pin_stat = tvb_get_uint8(tvb, offset);
3558
0
            proto_tree_add_item(tree, hf_dvbci_pincode_status,
3559
0
                    tvb, offset, 1, ENC_BIG_ENDIAN);
3560
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, ": ",
3561
0
                    val_to_str_const(pin_stat, dvbci_pincode_status, "unknown"));
3562
0
            break;
3563
0
        case T_CC_PIN_EVENT:
3564
0
            proto_tree_add_item(tree, hf_dvbci_cc_prog_num,
3565
0
                    tvb, offset, 2, ENC_BIG_ENDIAN);
3566
0
            offset += 2;
3567
0
            proto_tree_add_item(tree, hf_dvbci_pincode_status,
3568
0
                    tvb, offset, 1, ENC_BIG_ENDIAN);
3569
0
            offset++;
3570
0
            dissect_rating(tvb, offset, pinfo, tree);
3571
0
            offset++;
3572
0
            if (packet_mpeg_sect_mjd_to_utc_time(tvb, offset, &utc_time) < 0) {
3573
0
                proto_tree_add_expert_format(tree, pinfo, &ei_dvbci_bad_length, tvb, offset, UTC_TIME_LEN,
3574
0
                        "Invalid UTC time field, 2 bytes MJD, 3 bytes BCD time hhmmss");
3575
0
                break;
3576
0
            }
3577
0
            else {
3578
0
                proto_tree_add_time(tree, hf_dvbci_pin_evt_time,
3579
0
                        tvb, offset, UTC_TIME_LEN, &utc_time);
3580
0
            }
3581
0
            offset += UTC_TIME_LEN;
3582
0
            evt_cent = tvb_get_uint8(tvb, offset);
3583
0
            pi = proto_tree_add_item(tree, hf_dvbci_pin_evt_cent,
3584
0
                    tvb, offset, 1, ENC_BIG_ENDIAN);
3585
0
            if (evt_cent > 100) {
3586
0
                expert_add_info(pinfo, pi, &ei_dvbci_pin_evt_cent);
3587
0
            }
3588
0
            offset++;
3589
            /* length field was already checked by the caller */
3590
0
            proto_tree_add_item(tree, hf_dvbci_cc_priv_data, tvb, offset,
3591
0
                    tvb_reported_length_remaining(tvb, offset), ENC_NA);
3592
0
            break;
3593
0
        case T_CC_PIN_PLAYBACK:
3594
0
            dissect_rating(tvb, offset, pinfo, tree);
3595
0
            offset++;
3596
            /* length field was already checked by the caller */
3597
0
            proto_tree_add_item(tree, hf_dvbci_cc_priv_data, tvb, offset,
3598
0
                    tvb_reported_length_remaining(tvb, offset), ENC_NA);
3599
0
            break;
3600
0
        case T_CC_PIN_CMD:
3601
0
        case T_CC_PIN_MMI_REQ:
3602
0
            proto_tree_add_item(tree, hf_dvbci_pincode, tvb, offset,
3603
0
                    tvb_reported_length_remaining(tvb, offset),
3604
0
                    ENC_ASCII);
3605
0
            break;
3606
0
        default:
3607
0
            break;
3608
0
    }
3609
0
}
3610
3611
3612
static void
3613
dissect_dvbci_ami_file_req(tvbuff_t *tvb, unsigned offset,
3614
        packet_info *pinfo, proto_tree *tree)
3615
0
{
3616
0
    uint8_t req_type;
3617
0
    const char *req_str;
3618
3619
0
    proto_tree_add_item_ret_uint8(tree, hf_dvbci_req_type, tvb, offset, 1, ENC_BIG_ENDIAN, &req_type);
3620
0
    col_append_sep_str(pinfo->cinfo, COL_INFO, ": ",
3621
0
            val_to_str_const(req_type, dvbci_req_type, "unknown"));
3622
0
    offset++;
3623
0
    if (req_type==REQ_TYPE_FILE_HASH) {
3624
0
        proto_tree_add_item(tree, hf_dvbci_file_hash,
3625
0
                tvb, offset, 16, ENC_NA);
3626
0
        offset += 16;
3627
0
    }
3628
0
    if (tvb_reported_length_remaining(tvb, offset) <= 0) {
3629
0
        return;
3630
0
    }
3631
0
    if (req_type==REQ_TYPE_FILE || req_type==REQ_TYPE_FILE_HASH) {
3632
0
        proto_tree_add_item_ret_string(tree, hf_dvbci_file_name,
3633
0
                tvb, offset, tvb_reported_length_remaining(tvb, offset),
3634
0
                ENC_ASCII, pinfo->pool, (const uint8_t**)&req_str);
3635
0
        col_append_sep_str(pinfo->cinfo, COL_INFO, " ", req_str);
3636
0
    }
3637
0
    else if (req_type==REQ_TYPE_DATA) {
3638
0
        proto_tree_add_item(tree, hf_dvbci_ami_priv_data, tvb, offset,
3639
0
                tvb_reported_length_remaining(tvb, offset), ENC_NA);
3640
0
    }
3641
0
}
3642
3643
3644
static void
3645
dissect_dvbci_ami_file_ack(tvbuff_t *tvb, unsigned offset,
3646
        packet_info *pinfo, proto_tree *tree)
3647
0
{
3648
0
    uint8_t     req_type;
3649
0
    bool        req_ok = false, file_ok;
3650
0
    uint8_t     file_name_len;
3651
0
    const char *file_name_str;
3652
0
    uint32_t    file_data_len;
3653
0
    proto_tree *req_tree;
3654
3655
0
    req_type = tvb_get_uint8(tvb, offset+1);
3656
0
    if (req_type==REQ_TYPE_FILE_HASH) {
3657
0
        req_ok = ((tvb_get_uint8(tvb, offset) & 0x02) == 0x02);
3658
0
        proto_tree_add_item(tree, hf_dvbci_req_ok,
3659
0
                tvb, offset, 1, ENC_BIG_ENDIAN);
3660
0
    }
3661
0
    proto_tree_add_item_ret_boolean(tree, hf_dvbci_file_ok, tvb, offset, 1, ENC_BIG_ENDIAN, &file_ok);
3662
0
    offset++;
3663
0
    proto_tree_add_item(tree, hf_dvbci_req_type, tvb, offset, 1, ENC_BIG_ENDIAN);
3664
0
    col_append_sep_str(pinfo->cinfo, COL_INFO, ": ",
3665
0
            val_to_str_const(req_type, dvbci_req_type, "unknown"));
3666
0
    offset++;
3667
0
    if (req_type==REQ_TYPE_FILE || req_type==REQ_TYPE_FILE_HASH) {
3668
0
        file_name_len = tvb_get_uint8(tvb, offset);
3669
0
        proto_tree_add_item(tree, hf_dvbci_file_name_len,
3670
0
                tvb, offset, 1, ENC_BIG_ENDIAN);
3671
0
        offset++;
3672
0
        file_name_str = (char*)tvb_get_string_enc(pinfo->pool,
3673
0
                tvb, offset, file_name_len, ENC_ASCII);
3674
0
        if (!file_name_str)
3675
0
            return;
3676
0
        col_append_sep_str(pinfo->cinfo, COL_INFO, " ",
3677
0
                file_name_str);
3678
0
        proto_tree_add_string(tree, hf_dvbci_file_name,
3679
0
                tvb, offset, file_name_len, file_name_str);
3680
0
        offset += file_name_len;
3681
0
        file_data_len = tvb_get_ntohl(tvb, offset);
3682
0
        proto_tree_add_item(tree, hf_dvbci_file_data_len,
3683
0
                tvb, offset, 4, ENC_BIG_ENDIAN);
3684
0
        offset += 4;
3685
0
        if (file_data_len > 0) {
3686
0
            col_append_str(pinfo->cinfo, COL_PROTOCOL, ", ");
3687
0
            col_set_fence(pinfo->cinfo, COL_PROTOCOL);
3688
            /* The mime_encap dissector may overwrite this part. */
3689
0
            col_append_str(pinfo->cinfo, COL_PROTOCOL, "Data");
3690
0
            col_set_fence(pinfo->cinfo, COL_INFO);
3691
0
            call_dissector(mime_handle,
3692
0
                    tvb_new_subset_length(tvb, offset, file_data_len),
3693
0
                    pinfo, tree);
3694
0
        }
3695
0
    }
3696
0
    else if (req_type==REQ_TYPE_DATA) {
3697
0
        if (tvb_reported_length_remaining(tvb, offset) <= 0)
3698
0
            return;
3699
0
        proto_tree_add_item(tree, hf_dvbci_ami_priv_data, tvb, offset,
3700
0
                tvb_reported_length_remaining(tvb, offset), ENC_NA);
3701
0
    }
3702
0
    else if (req_type==REQ_TYPE_REQ) {
3703
0
        req_tree = proto_tree_add_subtree(tree, tvb,
3704
0
                offset, tvb_reported_length_remaining(tvb, offset),
3705
0
                ett_dvbci_ami_req_types, NULL, "Supported request types");
3706
0
        while (tvb_reported_length_remaining(tvb, offset) > 0) {
3707
0
            proto_tree_add_item(req_tree, hf_dvbci_req_type,
3708
0
                    tvb, offset, 1, ENC_BIG_ENDIAN);
3709
0
            offset++;
3710
0
        }
3711
0
    }
3712
3713
0
    if (req_type==REQ_TYPE_FILE_HASH && req_ok && !file_ok) {
3714
0
        col_append_sep_str(pinfo->cinfo, COL_INFO, NULL,
3715
0
                "cached copy is valid");
3716
0
    }
3717
0
}
3718
3719
3720
static void
3721
dissect_dvbci_payload_ami(uint32_t tag, int len_field _U_,
3722
        tvbuff_t *tvb, unsigned offset, conversation_t *conv _U_,
3723
        packet_info *pinfo, proto_tree *tree)
3724
0
{
3725
0
    uint8_t app_dom_id_len, init_obj_len;
3726
0
    const uint8_t *app_dom_id;
3727
0
    uint8_t ack_code;
3728
3729
0
    switch(tag) {
3730
0
        case T_REQUEST_START:
3731
            /* no filter for length items */
3732
0
            app_dom_id_len = tvb_get_uint8(tvb, offset);
3733
0
            proto_tree_add_item(tree, hf_dvbci_app_dom_id_len,
3734
0
                    tvb, offset, 1, ENC_BIG_ENDIAN);
3735
0
            offset++;
3736
0
            init_obj_len = tvb_get_uint8(tvb, offset);
3737
0
            proto_tree_add_item(tree, hf_dvbci_init_obj_len,
3738
0
                    tvb, offset, 1, ENC_BIG_ENDIAN);
3739
0
            offset++;
3740
0
            proto_tree_add_item_ret_string(tree, hf_dvbci_app_dom_id,
3741
0
                    tvb, offset, app_dom_id_len, ENC_ASCII|ENC_NA, pinfo->pool, &app_dom_id);
3742
0
            if (app_dom_id) {
3743
0
                col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ",
3744
0
                        "for %s", app_dom_id);
3745
0
            }
3746
0
            offset += app_dom_id_len;
3747
0
            proto_tree_add_item(tree, hf_dvbci_init_obj,
3748
0
                    tvb, offset, init_obj_len, ENC_ASCII);
3749
0
            break;
3750
0
        case T_REQUEST_START_ACK:
3751
0
            ack_code = tvb_get_uint8(tvb, offset);
3752
0
            proto_tree_add_item(
3753
0
                    tree, hf_dvbci_ack_code, tvb, offset, 1, ENC_BIG_ENDIAN);
3754
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, ": ",
3755
0
                    val_to_str_const(ack_code, dvbci_ack_code, "unknown"));
3756
0
            break;
3757
0
        case T_FILE_REQUEST:
3758
0
            dissect_dvbci_ami_file_req(tvb, offset, pinfo, tree);
3759
0
            break;
3760
0
        case T_FILE_ACKNOWLEDGE:
3761
0
            dissect_dvbci_ami_file_ack(tvb, offset, pinfo, tree);
3762
0
            break;
3763
0
        case T_APP_ABORT_REQUEST:
3764
0
            if (tvb_reported_length_remaining(tvb, offset) > 0) {
3765
0
                proto_tree_add_item(tree, hf_dvbci_abort_req_code, tvb, offset,
3766
0
                        tvb_reported_length_remaining(tvb, offset), ENC_NA);
3767
0
            }
3768
0
            break;
3769
0
        case T_APP_ABORT_ACK:
3770
0
            if (tvb_reported_length_remaining(tvb, offset) > 0) {
3771
0
                proto_tree_add_item(tree, hf_dvbci_abort_ack_code, tvb, offset,
3772
0
                        tvb_reported_length_remaining(tvb, offset), ENC_NA);
3773
0
            }
3774
0
            break;
3775
0
        default:
3776
0
            break;
3777
0
    }
3778
0
}
3779
3780
3781
static void
3782
dissect_dvbci_payload_lsc(uint32_t tag, int len_field,
3783
        tvbuff_t *tvb, unsigned offset, conversation_t *conv,
3784
        packet_info *pinfo, proto_tree *tree)
3785
0
{
3786
0
    int                 offset_start;
3787
0
    uint8_t             id, timeout, ret_val, phase_id;
3788
0
    int                 conn_desc_len, param_len;
3789
0
    uint16_t            buf_size;
3790
0
    proto_item         *pi          = NULL;
3791
0
    const char         *ret_val_str = NULL;
3792
0
    int                 msg_len;
3793
0
    tvbuff_t           *msg_tvb;
3794
0
    dissector_handle_t  msg_handle;
3795
0
    uint32_t            conn_state, i, num_dns_srv;
3796
3797
0
    offset_start = offset;
3798
3799
0
    switch(tag) {
3800
0
        case T_COMMS_CMD:
3801
0
            proto_tree_add_item(tree, hf_dvbci_comms_cmd_id,
3802
0
                    tvb, offset, 1, ENC_BIG_ENDIAN);
3803
0
            id = tvb_get_uint8(tvb, offset);
3804
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, ": ",
3805
0
                    val_to_str(pinfo->pool, id, dvbci_comms_cmd_id, "Unknown: %d"));
3806
0
            offset++;
3807
0
            switch(id) {
3808
0
                case COMMS_CMD_ID_CONNECT_ON_CHANNEL:
3809
0
                    conn_desc_len = dissect_conn_desc(tvb, offset,
3810
0
                            conv, pinfo, tree);
3811
0
                    if (conn_desc_len < 0)
3812
0
                        break;
3813
0
                    offset += conn_desc_len;
3814
0
                    proto_tree_add_item(tree, hf_dvbci_lsc_retry_count,
3815
0
                            tvb, offset, 1, ENC_BIG_ENDIAN);
3816
0
                    offset++;
3817
0
                    timeout = tvb_get_uint8(tvb, offset);
3818
0
                    if (timeout==0) {
3819
0
                        proto_tree_add_uint_format(tree, hf_dvbci_lsc_timeout,
3820
0
                                tvb, offset, 1, timeout, "Infinite timeout");
3821
0
                    } else {
3822
0
                        proto_tree_add_uint_format(tree, hf_dvbci_lsc_timeout,
3823
0
                                tvb, offset, 1, timeout,
3824
0
                                "Timeout is %d seconds", timeout);
3825
0
                    }
3826
0
                    break;
3827
0
                case COMMS_CMD_ID_DISCONNECT_ON_CHANNEL:
3828
0
                case COMMS_CMD_ID_ENQUIRE_STATUS:
3829
                    /* len_field == 1 -> only id, no further parameters */
3830
0
                    if (len_field != 1) {
3831
0
                        proto_tree_add_expert_format(tree, pinfo, &ei_dvbci_bad_length, tvb,
3832
0
                            APDU_TAG_SIZE, offset_start-APDU_TAG_SIZE,
3833
0
                            "Length field must be 1");
3834
0
                    }
3835
0
                    break;
3836
0
                case COMMS_CMD_ID_SET_PARAMS:
3837
0
                    param_len = tvb_reported_length_remaining(tvb, offset);
3838
0
                    if (param_len == 2)
3839
0
                        buf_size = (uint16_t)tvb_get_uint8(tvb, offset);
3840
0
                    else if (param_len == 3)
3841
0
                        buf_size = tvb_get_ntohs(tvb, offset);
3842
0
                    else {
3843
                        /* length field == 1 byte id + param_len */
3844
0
                        proto_tree_add_expert_format(tree, pinfo, &ei_dvbci_bad_length, tvb,
3845
0
                            APDU_TAG_SIZE, offset_start-APDU_TAG_SIZE,
3846
0
                            "Length field must be 3 or 4");
3847
0
                        break;
3848
0
                    }
3849
0
                    proto_tree_add_uint_format(tree, hf_dvbci_lsc_buf_size,
3850
0
                            tvb, offset, param_len-1, buf_size,
3851
0
                            "buffer size %d bytes", buf_size);
3852
0
                    offset += param_len-1;
3853
0
                    timeout = tvb_get_uint8(tvb, offset);
3854
0
                    proto_tree_add_uint_format(tree, hf_dvbci_lsc_timeout,
3855
0
                            tvb, offset, 1, timeout,
3856
0
                            "timeout is %d milliseconds", timeout*10);
3857
0
                    break;
3858
0
                case COMMS_CMD_ID_GET_NEXT_BUFFER:
3859
0
                    phase_id = tvb_get_uint8(tvb, offset);
3860
0
                    proto_tree_add_item(tree, hf_dvbci_phase_id,
3861
0
                            tvb, offset, 1, ENC_BIG_ENDIAN);
3862
0
                    col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL,
3863
0
                            "received #%d", phase_id);
3864
0
                    break;
3865
0
                default:
3866
0
                    break;
3867
0
            }
3868
0
            break;
3869
0
        case T_COMMS_REPLY:
3870
0
            proto_tree_add_item(tree, hf_dvbci_comms_rep_id,
3871
0
                    tvb, offset, 1, ENC_BIG_ENDIAN);
3872
0
            id = tvb_get_uint8(tvb,offset);
3873
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, NULL,
3874
0
                    val_to_str(pinfo->pool, id, dvbci_comms_rep_id, "Unknown: %d"));
3875
0
            offset++;
3876
0
            ret_val = tvb_get_uint8(tvb,offset);
3877
0
            pi = proto_tree_add_item(tree, hf_dvbci_lsc_ret_val,
3878
0
                    tvb, offset, 1, ENC_BIG_ENDIAN);
3879
0
            switch (id) {
3880
0
                case COMMS_REP_ID_SEND_ACK:
3881
0
                    col_append_sep_fstr(pinfo->cinfo, COL_INFO, ": ",
3882
0
                        "sent #%d", ret_val);
3883
0
                    proto_item_append_text(pi, " (sent #%d)", ret_val);
3884
0
                    break;
3885
0
                case COMMS_REP_ID_SET_PARAMS_ACK:
3886
0
                    ret_val_str = val_to_str_const(ret_val,
3887
0
                            dvbci_lsc_ret_val_params, "unknown/error");
3888
0
                    break;
3889
0
                case COMMS_REP_ID_STATUS_REPLY:
3890
0
                    ret_val_str = val_to_str_const(ret_val,
3891
0
                            dvbci_lsc_connect, "unknown/error");
3892
0
                    break;
3893
0
                default:
3894
0
                    ret_val_str = val_to_str_const(ret_val,
3895
0
                            dvbci_lsc_ret_val, "unknown/error");
3896
0
                    break;
3897
0
            }
3898
0
            if (ret_val_str) {
3899
0
                col_append_sep_str(pinfo->cinfo, COL_INFO, ": ",
3900
0
                            ret_val_str);
3901
0
                proto_item_append_text(pi, " (%s)", ret_val_str);
3902
0
            }
3903
0
            break;
3904
0
        case T_COMMS_SEND_LAST:
3905
0
        case T_COMMS_SEND_MORE:
3906
0
        case T_COMMS_RCV_LAST:
3907
0
        case T_COMMS_RCV_MORE:
3908
0
            phase_id = tvb_get_uint8(tvb, offset);
3909
0
            proto_tree_add_item(tree, hf_dvbci_phase_id,
3910
0
                    tvb, offset, 1, ENC_BIG_ENDIAN);
3911
0
            col_append_sep_fstr(pinfo->cinfo, COL_INFO, ": ",
3912
0
                    "Phase ID %d", phase_id);
3913
0
            offset++;
3914
0
            msg_len = tvb_reported_length_remaining(tvb, offset);
3915
0
            if (msg_len<=0)
3916
0
                break;
3917
0
            msg_tvb = tvb_new_subset_remaining(tvb, offset);
3918
0
            if (!msg_tvb)
3919
0
                break;
3920
0
            if (dvbci_dissect_lsc_msg && conv && conversation_get_dissector(conv, 0)) {
3921
0
                msg_handle = conversation_get_dissector(conv, 0);
3922
0
                col_append_str(pinfo->cinfo, COL_INFO, ", ");
3923
0
                col_set_fence(pinfo->cinfo, COL_INFO);
3924
0
                col_append_str(pinfo->cinfo, COL_PROTOCOL, ", ");
3925
0
                col_set_fence(pinfo->cinfo, COL_PROTOCOL);
3926
0
            }
3927
0
            else {
3928
0
                msg_handle = data_handle;
3929
0
            }
3930
0
            if (msg_handle)
3931
0
                call_dissector(msg_handle, msg_tvb, pinfo, tree);
3932
0
            break;
3933
0
        case T_COMMS_IP_CONFIG_REPLY:
3934
0
            proto_tree_add_item_ret_uint(tree, hf_dvbci_lsc_conn_state,
3935
0
                    tvb, offset, 1, ENC_BIG_ENDIAN, &conn_state);
3936
0
            offset++;
3937
0
            proto_tree_add_item(tree, hf_dvbci_lsc_phys_addr,
3938
0
                    tvb, offset, FT_ETHER_LEN, ENC_NA);
3939
0
            offset += FT_ETHER_LEN;
3940
0
            if (conn_state == LSC_CONNECTED) {
3941
0
                proto_tree_add_item(tree, hf_dvbci_lsc_ipv6_addr,
3942
0
                        tvb, offset, FT_IPv6_LEN, ENC_NA);
3943
0
                offset += FT_IPv6_LEN;
3944
0
                proto_tree_add_item(tree, hf_dvbci_lsc_netmask,
3945
0
                        tvb, offset, FT_IPv6_LEN, ENC_NA);
3946
0
                offset += FT_IPv6_LEN;
3947
0
                proto_tree_add_item(tree, hf_dvbci_lsc_gateway,
3948
0
                        tvb, offset, FT_IPv6_LEN, ENC_NA);
3949
0
                offset += FT_IPv6_LEN;
3950
0
                proto_tree_add_item(tree, hf_dvbci_lsc_dhcp_srv,
3951
0
                        tvb, offset, FT_IPv6_LEN, ENC_NA);
3952
0
                offset += FT_IPv6_LEN;
3953
0
                proto_tree_add_item_ret_uint(tree, hf_dvbci_lsc_num_dns_srv,
3954
0
                        tvb, offset, 1, ENC_BIG_ENDIAN, &num_dns_srv);
3955
0
                offset++;
3956
0
                for(i = 0; i < num_dns_srv; i++) {
3957
0
                    proto_tree_add_item(tree, hf_dvbci_lsc_dns_srv,
3958
0
                            tvb, offset, FT_IPv6_LEN, ENC_NA);
3959
0
                    offset += FT_IPv6_LEN;
3960
0
                }
3961
0
            }
3962
0
            break;
3963
0
        default:
3964
0
            break;
3965
0
    }
3966
0
}
3967
3968
3969
static void
3970
dissect_dvbci_payload_opp(uint32_t tag, int len_field _U_,
3971
        tvbuff_t *tvb, unsigned offset, conversation_t *conv _U_,
3972
        packet_info *pinfo, proto_tree *tree)
3973
0
{
3974
0
    uint16_t        nit_loop_len, nit_loop_offset;
3975
0
    tvbuff_t       *nit_loop_tvb, *nit_loop_partial_tvb;
3976
0
    unsigned        dvb_nit_bytes;
3977
0
    uint8_t         table_id;
3978
0
    uint8_t         cap_loop_len;
3979
0
    bool            info_valid;
3980
0
    unsigned        enc_len;
3981
0
    dvb_encoding_e  encoding;
3982
0
    uint8_t         desc_num;
3983
0
    uint8_t         sig_strength, sig_qual;
3984
0
    proto_item     *pi;
3985
3986
0
    switch(tag) {
3987
0
        case T_OPERATOR_STATUS:
3988
0
        case T_OPERATOR_SEARCH_STATUS:
3989
0
            dissect_opp_status_body(tvb, offset, pinfo, tree);
3990
0
          break;
3991
0
        case T_OPERATOR_NIT:
3992
0
          nit_loop_len = tvb_get_ntohs(tvb, offset);
3993
0
          proto_tree_add_item(tree, hf_dvbci_nit_loop_len,
3994
0
                  tvb, offset, 2, ENC_BIG_ENDIAN);
3995
0
          if (nit_loop_len==0)
3996
0
              break;
3997
0
          offset += 2;
3998
0
          nit_loop_tvb = tvb_new_subset_length(
3999
0
                  tvb, offset, nit_loop_len);
4000
0
          nit_loop_offset = 0;
4001
0
          if (!dvb_nit_handle) {
4002
0
              call_dissector(data_handle, nit_loop_tvb, pinfo, tree);
4003
0
              break;
4004
0
          }
4005
          /* prevent dvb_nit dissector from clearing the dvb-ci infos */
4006
0
          col_append_str(pinfo->cinfo, COL_INFO, ", ");
4007
0
          col_set_fence(pinfo->cinfo, COL_INFO);
4008
0
          do {
4009
0
              table_id = tvb_get_uint8(nit_loop_tvb, nit_loop_offset);
4010
0
              if (table_id != TABLE_ID_CICAM_NIT) {
4011
0
                  proto_tree_add_expert(tree, pinfo, &ei_dvbci_cicam_nit_table_id,
4012
0
                          nit_loop_tvb, nit_loop_offset, 1);
4013
0
              }
4014
0
              nit_loop_partial_tvb =
4015
0
                  tvb_new_subset_remaining(nit_loop_tvb, nit_loop_offset);
4016
0
              dvb_nit_bytes = call_dissector(
4017
0
                      dvb_nit_handle, nit_loop_partial_tvb, pinfo, tree);
4018
0
              nit_loop_offset += dvb_nit_bytes;
4019
              /* offsets go from 0 to nit_loop_len-1 */
4020
0
          } while (dvb_nit_bytes>0 && nit_loop_offset<nit_loop_len-1);
4021
0
          break;
4022
0
        case T_OPERATOR_INFO:
4023
0
          info_valid = ((tvb_get_uint8(tvb, offset) & 0x08) == 0x08);
4024
0
          proto_tree_add_item(tree, hf_dvbci_info_valid,
4025
0
                  tvb, offset, 1, ENC_BIG_ENDIAN);
4026
0
          proto_tree_add_item(tree, hf_dvbci_info_ver_op_info,
4027
0
                  tvb, offset, 1, ENC_BIG_ENDIAN);
4028
0
          if (!info_valid)
4029
0
              break;
4030
0
          offset++;
4031
0
          proto_tree_add_item(tree, hf_dvbci_cicam_onid,
4032
0
                  tvb, offset, 2, ENC_BIG_ENDIAN);
4033
0
          offset += 2;
4034
0
          proto_tree_add_item(tree, hf_dvbci_cicam_id,
4035
0
                  tvb, offset, 4, ENC_BIG_ENDIAN);
4036
0
          offset += 4;
4037
4038
0
          enc_len = dvb_analyze_string_charset(tvb, offset,
4039
0
                  tvb_reported_length_remaining(tvb, offset), &encoding);
4040
0
          if (enc_len==0) {
4041
0
              proto_tree_add_expert(tree, pinfo,
4042
0
                      &ei_dvbci_invalid_char_tbl, tvb, offset,
4043
0
                      tvb_reported_length_remaining(tvb, offset));
4044
0
              break;
4045
0
          }
4046
0
          dvb_add_chartbl(tree, hf_dvbci_opp_char_tbl,
4047
0
                  tvb, offset, enc_len, encoding);
4048
0
          offset += enc_len;
4049
4050
0
          proto_tree_add_item(tree, hf_dvbci_sdt_rst_trusted,
4051
0
                  tvb, offset, 1, ENC_BIG_ENDIAN);
4052
0
          proto_tree_add_item(tree, hf_dvbci_eit_rst_trusted,
4053
0
                  tvb, offset, 1, ENC_BIG_ENDIAN);
4054
0
          proto_tree_add_item(tree, hf_dvbci_eit_pf_usage,
4055
0
                  tvb, offset, 1, ENC_BIG_ENDIAN);
4056
0
          proto_tree_add_item(tree, hf_dvbci_eit_sch_usage,
4057
0
                  tvb, offset, 1, ENC_BIG_ENDIAN);
4058
0
          proto_tree_add_item(tree, hf_dvbci_ext_evt_usage,
4059
0
                  tvb, offset, 1, ENC_BIG_ENDIAN);
4060
0
          offset++;
4061
0
          proto_tree_add_item(tree, hf_dvbci_sdt_oth_trusted,
4062
0
                  tvb, offset, 1, ENC_BIG_ENDIAN);
4063
0
          proto_tree_add_item(tree, hf_dvbci_eit_evt_trigger,
4064
0
                  tvb, offset, 1, ENC_BIG_ENDIAN);
4065
0
          offset++;
4066
0
          proto_tree_add_item(tree, hf_dvbci_opp_lang_code,
4067
0
                  tvb, offset, 3, ENC_ASCII);
4068
0
          offset += 3;
4069
          /* hf_dvbci_prof_name is an FT_UINT_STRING, one leading len byte */
4070
0
          proto_tree_add_item(tree, hf_dvbci_prof_name,
4071
0
              tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
4072
0
          break;
4073
0
        case T_OPERATOR_SEARCH_START:
4074
0
          proto_tree_add_item(tree, hf_dvbci_unattended,
4075
0
                  tvb, offset, 1, ENC_BIG_ENDIAN);
4076
4077
0
          cap_loop_len = tvb_get_uint8(tvb, offset) & 0x7F;
4078
0
          proto_tree_add_item(tree, hf_dvbci_opp_svc_type_loop_len,
4079
0
                  tvb, offset, 1, ENC_BIG_ENDIAN);
4080
0
          offset++;
4081
          /* no need for error checking, we continue anyway */
4082
0
          dissect_opp_cap_loop(cap_loop_len, "Service type loop",
4083
0
                  hf_dvbci_opp_svc_type, 1, tvb, offset, pinfo, tree);
4084
0
          offset += cap_loop_len;
4085
4086
0
          cap_loop_len = tvb_get_uint8(tvb, offset);
4087
0
          proto_tree_add_item(tree, hf_dvbci_dlv_cap_loop_len,
4088
0
                  tvb, offset, 1, ENC_BIG_ENDIAN);
4089
0
          offset++;
4090
          /* XXX - handle multi-byte delivery capabilities */
4091
0
          dissect_opp_cap_loop(cap_loop_len,
4092
0
                  "Delivery system capabilities loop",
4093
0
                  hf_dvbci_dlv_cap_byte, 1,
4094
0
                  tvb, offset, pinfo, tree);
4095
0
          offset += cap_loop_len;
4096
4097
0
          cap_loop_len = tvb_get_uint8(tvb, offset);
4098
0
          proto_tree_add_item(tree, hf_dvbci_app_cap_loop_len,
4099
0
                  tvb, offset, 1, ENC_BIG_ENDIAN);
4100
0
          offset++;
4101
0
          dissect_opp_cap_loop(cap_loop_len,
4102
0
                  "Application capabilities loop",
4103
0
                  hf_dvbci_app_cap_bytes, 2,
4104
0
                  tvb, offset, pinfo, tree);
4105
0
          break;
4106
0
        case T_OPERATOR_TUNE_STATUS:
4107
0
          desc_num = tvb_get_uint8(tvb, offset);
4108
0
          pi = proto_tree_add_item(tree, hf_dvbci_desc_num,
4109
0
                  tvb, offset, 1, ENC_BIG_ENDIAN);
4110
0
          if (desc_num==OPP_NO_MORE_DESC)
4111
0
              proto_item_append_text(pi, " (all descriptors were processed)");
4112
0
          offset++;
4113
0
          sig_strength = tvb_get_uint8(tvb, offset);
4114
0
          proto_tree_add_item(tree, hf_dvbci_sig_strength,
4115
0
                  tvb, offset, 1, ENC_BIG_ENDIAN);
4116
0
          offset++;
4117
0
          sig_qual = tvb_get_uint8(tvb, offset);
4118
0
          pi = proto_tree_add_item(tree, hf_dvbci_sig_qual,
4119
0
                  tvb, offset, 1, ENC_BIG_ENDIAN);
4120
0
          if (sig_strength>100 || sig_qual>100) {
4121
0
              expert_add_info(pinfo, pi, &ei_dvbci_sig_qual);
4122
0
          }
4123
0
          offset++;
4124
0
          proto_tree_add_item(tree, hf_dvbci_opp_tune_status,
4125
0
                  tvb, offset, 1, ENC_BIG_ENDIAN);
4126
0
          dissect_desc_loop(hf_dvbci_opp_desc_loop_len,
4127
0
                  tvb, offset, pinfo, tree);
4128
0
          break;
4129
0
        case T_OPERATOR_TUNE:
4130
0
          dissect_desc_loop(hf_dvbci_opp_desc_loop_len,
4131
0
                  tvb, offset, pinfo, tree);
4132
0
          break;
4133
0
        default:
4134
0
          break;
4135
0
    }
4136
0
}
4137
4138
4139
static void
4140
dissect_dvbci_payload_afs(uint32_t tag, int len_field _U_,
4141
        tvbuff_t *tvb, unsigned offset, conversation_t *conv _U_,
4142
        packet_info *pinfo, proto_tree *tree)
4143
0
{
4144
0
    const uint8_t *dom_id_str;
4145
4146
0
    switch(tag) {
4147
0
        case T_AFS_FILE_SYSTEM_OFFER:
4148
0
            proto_tree_add_item_ret_string(tree, hf_dvbci_afs_dom_id,
4149
0
                    tvb, offset, 1, ENC_UTF_8|ENC_BIG_ENDIAN,
4150
0
                    pinfo->pool, &dom_id_str);
4151
0
            if (dom_id_str) {
4152
0
                col_append_sep_fstr(pinfo->cinfo,
4153
0
                        COL_INFO, ": ", "%s", dom_id_str);
4154
0
            }
4155
0
            break;
4156
0
        case T_AFS_FILE_SYSTEM_ACK:
4157
0
            proto_tree_add_item(tree, hf_dvbci_afs_ack_code,
4158
0
                    tvb, offset, 1, ENC_BIG_ENDIAN);
4159
0
            break;
4160
0
        case T_AFS_FILE_REQUEST:
4161
0
            dissect_dvbci_ami_file_req(tvb, offset, pinfo, tree);
4162
0
            break;
4163
0
        case T_AFS_FILE_ACKNOWLEDGE:
4164
0
            dissect_dvbci_ami_file_ack(tvb, offset, pinfo, tree);
4165
0
            break;
4166
0
        default:
4167
0
            break;
4168
0
    }
4169
0
}
4170
4171
4172
static void
4173
dissect_dvbci_payload_sas(uint32_t tag, int len_field _U_,
4174
        tvbuff_t *tvb, unsigned offset, conversation_t *conv,
4175
        packet_info *pinfo, proto_tree *tree)
4176
0
{
4177
0
    char    app_id_str[2+16+1]; /* "0x", string of 16 hex digits, trailing 0 */
4178
0
    uint8_t sas_status;
4179
0
    dissector_handle_t msg_handle;
4180
0
    uint8_t msg_nb;
4181
0
    uint16_t msg_len;
4182
0
    tvbuff_t *msg_tvb;
4183
4184
0
    switch(tag) {
4185
0
        case T_SAS_CONNECT_RQST:
4186
0
        case T_SAS_CONNECT_CNF:
4187
0
            snprintf(app_id_str, sizeof(app_id_str),
4188
0
                    "0x%016" PRIx64, tvb_get_ntoh64(tvb, offset));
4189
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, ": ", app_id_str);
4190
0
            proto_tree_add_item(tree, hf_dvbci_sas_app_id,
4191
0
                    tvb, offset, 8, ENC_BIG_ENDIAN);
4192
0
            offset += 8;
4193
0
            if (tag == T_SAS_CONNECT_CNF) {
4194
0
                sas_status = tvb_get_uint8(tvb, offset);
4195
0
                col_append_sep_str(pinfo->cinfo, COL_INFO, NULL,
4196
0
                        (sas_status == SAS_SESS_STATE_CONNECTED ?
4197
0
                         "Ok" : "Error"));
4198
0
                proto_tree_add_item(tree, hf_dvbci_sas_sess_state,
4199
0
                        tvb, offset, 1, ENC_BIG_ENDIAN);
4200
0
                if (!conv)
4201
0
                    break;
4202
0
                if (sas_status == SAS_SESS_STATE_CONNECTED) {
4203
0
                    msg_handle = dissector_get_string_handle(
4204
0
                            sas_msg_dissector_table, app_id_str);
4205
                    /* this clears the dissector for msg_handle==NULL */
4206
0
                    conversation_set_dissector(conv, msg_handle);
4207
0
                }
4208
0
                else
4209
0
                    conversation_set_dissector(conv, NULL);
4210
0
            }
4211
0
            break;
4212
0
        case T_SAS_ASYNC_MSG:
4213
0
            msg_nb = tvb_get_uint8(tvb, offset);
4214
0
            col_append_sep_fstr(pinfo->cinfo, COL_INFO, ": ",
4215
0
                    "Message #%d ", msg_nb);
4216
0
            proto_tree_add_item(tree, hf_dvbci_sas_msg_nb,
4217
0
                    tvb, offset, 1, ENC_BIG_ENDIAN);
4218
0
            offset++;
4219
0
            msg_len = tvb_get_ntohs(tvb, offset);
4220
0
            proto_tree_add_item(tree, hf_dvbci_sas_msg_len,
4221
0
                    tvb, offset, 2, ENC_BIG_ENDIAN);
4222
0
            offset += 2;
4223
0
            msg_tvb = tvb_new_subset_length(tvb, offset, msg_len);
4224
0
            msg_handle = conv ? conversation_get_dissector(conv, 0) : NULL;
4225
0
            if (msg_handle == NULL)
4226
0
                msg_handle = data_handle;
4227
0
            call_dissector(msg_handle, msg_tvb, pinfo, tree);
4228
0
            break;
4229
0
        default:
4230
0
          break;
4231
0
    }
4232
0
}
4233
4234
4235
static void
4236
dissect_dvbci_apdu(tvbuff_t *tvb, conversation_t *conv,
4237
        packet_info *pinfo, proto_tree *tree, uint8_t direction)
4238
0
{
4239
0
    proto_tree  *app_tree;
4240
0
    uint32_t     apdu_len, tag, len_field;
4241
0
    const char *tag_str;
4242
0
    int          offset;
4243
0
    proto_item  *pi;
4244
0
    apdu_info_t *ai;
4245
0
    uint32_t     apdu_res_id;
4246
0
    const char *ai_res_class_str;
4247
4248
4249
0
    apdu_len = tvb_reported_length(tvb);
4250
4251
0
    app_tree = proto_tree_add_subtree(tree, tvb, 0, apdu_len, ett_dvbci_application, NULL, "Application Layer");
4252
4253
0
    tag = tvb_get_ntoh24(tvb, 0);
4254
0
    tag_str = try_val_to_str(tag, dvbci_apdu_tag);
4255
0
    offset = APDU_TAG_SIZE;
4256
4257
0
    col_set_str(pinfo->cinfo, COL_INFO,
4258
0
            val_to_str_const(tag, dvbci_apdu_tag, "Unknown/invalid APDU"));
4259
0
    pi = proto_tree_add_item(
4260
0
                app_tree, hf_dvbci_apdu_tag, tvb, 0, APDU_TAG_SIZE, ENC_BIG_ENDIAN);
4261
0
    if (tag_str == NULL) {
4262
0
        expert_add_info(pinfo, pi, &ei_dvbci_apdu_tag);
4263
0
        return;
4264
0
    }
4265
4266
0
    offset = dissect_ber_length(pinfo, app_tree, tvb, offset, &len_field, NULL);
4267
0
    if ((offset+len_field) != apdu_len) {
4268
0
        proto_tree_add_expert_format(app_tree, pinfo, &ei_dvbci_bad_length, tvb,
4269
0
                APDU_TAG_SIZE, offset-APDU_TAG_SIZE,
4270
0
                "Length field is different from the number of apdu payload bytes");
4271
        /* we need len_field bytes of apdu payload to call
4272
           ai->dissect_payload() and continue dissecting */
4273
0
        if (apdu_len < offset+len_field)
4274
0
            return;
4275
0
    }
4276
4277
0
    ai = (apdu_info_t *)g_hash_table_lookup(apdu_table,
4278
0
                                            GUINT_TO_POINTER((unsigned)tag));
4279
0
    if (!ai) {
4280
0
        proto_tree_add_expert(app_tree, pinfo, &ei_dvbci_apdu_not_supported, tvb, 0, APDU_TAG_SIZE);
4281
0
        return;
4282
0
    }
4283
0
    if (ai->direction!=DIRECTION_ANY && ai->direction!=direction) {
4284
0
        if (ai->direction==DATA_HOST_TO_CAM) {
4285
0
            proto_tree_add_expert(app_tree, pinfo, &ei_dvbci_apu_host_to_cam, tvb, 0, APDU_TAG_SIZE);
4286
0
        }
4287
0
        else {
4288
0
            proto_tree_add_expert(app_tree, pinfo, &ei_dvbci_apu_cam_to_host, tvb, 0, APDU_TAG_SIZE);
4289
0
        }
4290
        /* don't return, we can continue dissecting the APDU */
4291
0
    }
4292
0
    if (ai->min_len_field!=LEN_FIELD_ANY && len_field<ai->min_len_field) {
4293
0
        proto_tree_add_expert_format(app_tree, pinfo, &ei_dvbci_bad_length, tvb, 0, APDU_TAG_SIZE,
4294
0
                "Invalid APDU length field, minimum length field for %s is %d", tag_str, ai->min_len_field);
4295
0
        return;
4296
0
    }
4297
0
    if (ai->len_field!=LEN_FIELD_ANY && len_field!=ai->len_field) {
4298
0
        proto_tree_add_expert_format(app_tree, pinfo, &ei_dvbci_bad_length, tvb, 0, APDU_TAG_SIZE,
4299
0
                "Invalid APDU length field, length field for %s must be %d", tag_str, ai->len_field);
4300
0
        return;
4301
0
    }
4302
0
    if (conv) {
4303
0
        apdu_res_id = GPOINTER_TO_UINT(conversation_get_proto_data(conv, proto_dvbci));
4304
4305
0
        ai_res_class_str = val_to_str_const(ai->res_class, dvbci_res_class, "Unknown");
4306
4307
0
        if(RES_CLASS(apdu_res_id) != ai->res_class) {
4308
0
            proto_tree_add_expert_format(app_tree, pinfo, &ei_dvbci_res_class, tvb, 0, APDU_TAG_SIZE,
4309
0
                    "Invalid resource class for this apdu, %s can only be sent on a %s session",
4310
0
                    tag_str, ai_res_class_str);
4311
0
        }
4312
0
        if(RES_VER(apdu_res_id) < ai->res_min_ver) {
4313
0
            proto_tree_add_expert_format(app_tree, pinfo, &ei_dvbci_res_ver, tvb, 0, APDU_TAG_SIZE,
4314
0
                    "Invalid resource version for this apdu, %s apdu requires at least %s version %d",
4315
0
                    tag_str, ai_res_class_str, ai->res_min_ver);
4316
0
        }
4317
        /* don't return, we can continue dissecting the APDU */
4318
0
    }
4319
0
    if (ai->len_field!=0) {
4320
0
        if (!ai->dissect_payload) {
4321
            /* don't display an error, getting here means we have illegal
4322
             * data in apdu_info[] */
4323
0
            return;
4324
0
        }
4325
0
        ai->dissect_payload(
4326
0
                tag, len_field, tvb, offset, conv, pinfo, app_tree);
4327
0
    }
4328
0
}
4329
4330
static void
4331
dissect_dvbci_spdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
4332
        uint8_t direction, uint8_t tcid)
4333
0
{
4334
0
    uint32_t           spdu_len;
4335
0
    proto_item        *ti;
4336
0
    proto_tree        *sess_tree;
4337
0
    uint8_t            tag;
4338
0
    const char        *tag_str;
4339
0
    conversation_t    *conv     = NULL;
4340
0
    proto_item        *pi;
4341
0
    int                offset;
4342
0
    uint32_t           len_field;
4343
0
    const spdu_info_t *si;
4344
0
    proto_item        *res_id_it   = NULL;
4345
0
    uint32_t           res_id;
4346
0
    uint16_t ssnb                   = 0;  /* session numbers start with 1, 0 is invalid */
4347
0
    uint8_t            sess_stat;
4348
0
    tvbuff_t          *payload_tvb = NULL;
4349
4350
4351
0
    spdu_len = tvb_reported_length(tvb);
4352
4353
0
    sess_tree = proto_tree_add_subtree(tree, tvb, 0, -1, ett_dvbci_session, &ti, "Session Layer");
4354
4355
0
    tag = tvb_get_uint8(tvb,0);
4356
0
    tag_str = try_val_to_str(tag, dvbci_spdu_tag);
4357
0
    col_set_str(pinfo->cinfo, COL_INFO,
4358
0
            val_to_str_const(tag, dvbci_spdu_tag, "Invalid SPDU"));
4359
0
    pi = proto_tree_add_item(sess_tree, hf_dvbci_spdu_tag, tvb, 0, 1, ENC_BIG_ENDIAN);
4360
0
    if (tag_str == NULL) {
4361
0
        expert_add_info(pinfo, pi, &ei_dvbci_spdu_tag);
4362
0
        return;
4363
0
    }
4364
4365
0
    offset = dissect_ber_length(pinfo, sess_tree, tvb, 1, &len_field, NULL);
4366
4367
0
    si = (spdu_info_t *)g_hash_table_lookup(spdu_table,
4368
0
                                            GUINT_TO_POINTER((unsigned)tag));
4369
0
    if (!si)
4370
0
        return;
4371
0
    if (si->direction!=0 && si->direction!=direction) {
4372
0
        if (si->direction==DATA_HOST_TO_CAM) {
4373
0
            proto_tree_add_expert(sess_tree, pinfo, &ei_dvbci_spdu_host_to_cam, tvb, 0, 1);
4374
0
        }
4375
0
        else {
4376
0
            proto_tree_add_expert(sess_tree, pinfo, &ei_dvbci_spdu_cam_to_host, tvb, 0, 1);
4377
0
        }
4378
0
    }
4379
0
    if (si->len_field != len_field) {
4380
        /* offset points to 1st byte after the length field */
4381
0
        proto_tree_add_expert_format(sess_tree, pinfo, &ei_dvbci_bad_length, tvb, 1, offset-1,
4382
0
                "Invalid SPDU length field, correct length field for %s is %d", tag_str, si->len_field);
4383
0
        return;
4384
0
    }
4385
4386
0
    switch(tag)
4387
0
    {
4388
0
        case T_OPEN_SESSION_REQUEST:
4389
0
            res_id_it = dissect_res_id(tvb, offset, pinfo, sess_tree, 0, true);
4390
0
            break;
4391
0
        case T_CREATE_SESSION:
4392
0
            res_id_it = dissect_res_id(tvb, offset, pinfo, sess_tree, 0, true);
4393
            /* DVB-CI uses network byte order == big endian */
4394
0
            ssnb = tvb_get_ntohs(tvb, offset+RES_ID_LEN);
4395
0
            proto_tree_add_item(sess_tree, hf_dvbci_sess_nb,
4396
0
                    tvb, offset+RES_ID_LEN, 2, ENC_BIG_ENDIAN);
4397
0
            break;
4398
0
        case T_OPEN_SESSION_RESPONSE:
4399
0
        case T_CREATE_SESSION_RESPONSE:
4400
0
            sess_stat = tvb_get_uint8(tvb, offset);
4401
0
            proto_tree_add_item(sess_tree, hf_dvbci_sess_status,
4402
0
                    tvb, offset, 1, ENC_BIG_ENDIAN);
4403
0
            res_id = tvb_get_ntohl(tvb, offset+1);
4404
0
            res_id_it = dissect_res_id(tvb, offset+1, pinfo, sess_tree, 0, true);
4405
0
            ssnb = tvb_get_ntohs(tvb, offset+1+RES_ID_LEN);
4406
0
            proto_tree_add_item(sess_tree, hf_dvbci_sess_nb, tvb,
4407
0
                    offset+1+RES_ID_LEN, 2, ENC_BIG_ENDIAN);
4408
0
            if (sess_stat != SESS_OPENED) {
4409
0
                col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Error");
4410
0
                break;
4411
0
            }
4412
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Session opened");
4413
0
            conv = conversation_new_by_id(pinfo->num, CONVERSATION_DVBCI, CT_ID(ssnb, tcid));
4414
            /* we always add the resource id immediately after the circuit
4415
                was created */
4416
0
            conversation_add_proto_data(conv, proto_dvbci, GUINT_TO_POINTER(res_id));
4417
0
            break;
4418
0
        case T_CLOSE_SESSION_REQUEST:
4419
0
            ssnb = tvb_get_ntohs(tvb, offset);
4420
0
            proto_tree_add_item(
4421
0
                    sess_tree, hf_dvbci_sess_nb, tvb,
4422
0
                    offset, 2, ENC_BIG_ENDIAN);
4423
0
            break;
4424
0
        case T_CLOSE_SESSION_RESPONSE:
4425
0
            sess_stat = tvb_get_uint8(tvb, offset);
4426
0
            proto_tree_add_item(
4427
0
                    sess_tree, hf_dvbci_close_sess_status, tvb,
4428
0
                    offset, 1, ENC_BIG_ENDIAN);
4429
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, NULL,
4430
0
                    sess_stat==SESS_CLOSED ? "Session closed" : "Error");
4431
0
            ssnb = tvb_get_ntohs(tvb, offset+1);
4432
0
            proto_tree_add_item(sess_tree, hf_dvbci_sess_nb,
4433
0
                    tvb, offset+1, 2, ENC_BIG_ENDIAN);
4434
0
            conv = find_conversation_by_id(pinfo->num, CONVERSATION_DVBCI, CT_ID(ssnb, tcid));
4435
0
            if (conv)
4436
0
                conv->last_frame = pinfo->num;
4437
0
            break;
4438
0
        case T_SESSION_NUMBER:
4439
0
            ssnb = tvb_get_ntohs(tvb, offset);
4440
0
            proto_tree_add_item(
4441
0
                    sess_tree, hf_dvbci_sess_nb, tvb,
4442
0
                    offset, 2, ENC_BIG_ENDIAN);
4443
0
            payload_tvb =
4444
0
                tvb_new_subset_remaining(tvb, offset+2);
4445
0
            break;
4446
0
        default:
4447
0
            break;
4448
0
    }
4449
4450
0
    if (ssnb && !conv)
4451
0
        conv = find_conversation_by_id(pinfo->num, CONVERSATION_DVBCI, CT_ID(ssnb, tcid));
4452
4453
    /* if the packet contains no resource id, we add the cached id from
4454
       the circuit so that each packet has a resource id that can be
4455
       used for filtering */
4456
0
    if (conv&& !res_id_it) {
4457
        /* when a circuit is found, it always contains a valid resource id */
4458
0
        res_id = GPOINTER_TO_UINT(conversation_get_proto_data(conv, proto_dvbci));
4459
0
        res_id_it = dissect_res_id(NULL, 0, pinfo, sess_tree, res_id, true);
4460
0
        proto_item_set_generated(res_id_it);
4461
0
    }
4462
4463
0
    if (payload_tvb) {
4464
0
        proto_item_set_len(ti, spdu_len-tvb_reported_length(payload_tvb));
4465
0
        dissect_dvbci_apdu(payload_tvb, conv, pinfo, tree, direction);
4466
0
    }
4467
0
    else {
4468
0
        proto_item_set_len(ti, spdu_len);
4469
0
    }
4470
0
}
4471
4472
/* dissect the status of an r_tpdu, return its length or -1 for error */
4473
static int
4474
dissect_dvbci_tpdu_status(tvbuff_t *tvb, unsigned offset,
4475
        packet_info *pinfo, proto_tree *tree,
4476
        uint8_t lpdu_tcid, uint8_t r_tpdu_tag)
4477
0
{
4478
0
    int          offset_new, len_start_offset;
4479
0
    uint8_t      tag;
4480
0
    uint32_t     len_field;
4481
0
    uint8_t      t_c_id, sb_value;
4482
0
    const char *sb_str;
4483
0
    proto_item  *pi;
4484
4485
0
    offset_new = offset;
4486
4487
0
    tag = tvb_get_uint8(tvb, offset_new);
4488
0
    if (tag!=T_SB) {
4489
0
        proto_tree_add_expert(tree, pinfo, &ei_dvbci_tpdu_status_tag, tvb, offset_new, 1);
4490
0
        return -1;
4491
0
    }
4492
0
    proto_tree_add_item(tree, hf_dvbci_sb_tag, tvb,
4493
0
            offset_new, 1, ENC_BIG_ENDIAN);
4494
0
    col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "T_SB");
4495
0
    offset_new++;
4496
4497
0
    len_start_offset = offset_new;
4498
0
    offset_new = dissect_ber_length(
4499
0
            pinfo, tree, tvb, offset_new, &len_field, NULL);
4500
0
    if (len_field != 2) {
4501
0
        proto_tree_add_expert_format(tree, pinfo, &ei_dvbci_bad_length, tvb, len_start_offset, offset_new-len_start_offset,
4502
0
                "Invalid status length field, this must always be 2");
4503
4504
0
        return -1;
4505
0
    }
4506
4507
0
    pi = proto_tree_add_item_ret_uint8(tree, hf_dvbci_t_c_id, tvb, offset_new, 1, ENC_BIG_ENDIAN, &t_c_id);
4508
    /* tcid in transport header and link layer must only match for data
4509
     * transmission commands */
4510
0
    if (t_c_id!=lpdu_tcid) {
4511
0
        if (r_tpdu_tag==NO_TAG ||
4512
0
                r_tpdu_tag==T_DATA_MORE || r_tpdu_tag==T_DATA_LAST) {
4513
0
            expert_add_info_format(pinfo, pi, &ei_dvbci_t_c_id,
4514
0
                    "Transport Connection ID mismatch, tcid is %d in the transport layer and %d in the link layer",
4515
0
                    t_c_id, lpdu_tcid);
4516
0
            return -1;
4517
0
        }
4518
0
    }
4519
0
    offset_new++;
4520
4521
0
    sb_value = tvb_get_uint8(tvb, offset_new);
4522
0
    sb_str = try_val_to_str(sb_value, dvbci_sb_value);
4523
0
    pi = proto_tree_add_item(tree, hf_dvbci_sb_value, tvb,
4524
0
            offset_new, 1, ENC_BIG_ENDIAN);
4525
0
    if (sb_str) {
4526
0
        col_append_sep_str(pinfo->cinfo, COL_INFO, ": ", sb_str);
4527
0
    }
4528
0
    else {
4529
0
        expert_add_info(pinfo, pi, &ei_dvbci_sb_value);
4530
0
    }
4531
0
    offset_new++;
4532
4533
0
    return offset_new-offset;
4534
0
}
4535
4536
4537
/* dissect the header of a c_tpdu or r_tpdu
4538
   return the length of the header (tag, len_field, t_c_id) or -1 for error */
4539
static int
4540
dissect_dvbci_tpdu_hdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
4541
        uint8_t direction, uint8_t lpdu_tcid, uint32_t tpdu_len,
4542
        uint8_t *hdr_tag, uint32_t *body_len)
4543
0
{
4544
0
    uint8_t      c_tpdu_tag, r_tpdu_tag, *tag = NULL;
4545
0
    const char *c_tpdu_str, *r_tpdu_str;
4546
0
    proto_item  *pi;
4547
0
    int          offset;
4548
0
    uint32_t     len_field;
4549
0
    uint8_t      t_c_id;
4550
4551
0
    if (direction==DATA_HOST_TO_CAM) {
4552
0
        c_tpdu_tag = tvb_get_uint8(tvb, 0);
4553
0
        tag = &c_tpdu_tag;
4554
0
        c_tpdu_str = try_val_to_str(c_tpdu_tag, dvbci_c_tpdu);
4555
0
        pi = proto_tree_add_item(tree, hf_dvbci_c_tpdu_tag, tvb, 0, 1, ENC_BIG_ENDIAN);
4556
0
        if (c_tpdu_str) {
4557
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, c_tpdu_str);
4558
0
        }
4559
0
        else {
4560
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, NULL,
4561
0
                    "Invalid Command-TPDU tag");
4562
0
            expert_add_info(pinfo, pi, &ei_dvbci_c_tpdu_tag);
4563
0
            return -1;
4564
0
        }
4565
0
    }
4566
0
    else {
4567
0
        r_tpdu_tag = tvb_get_uint8(tvb, 0);
4568
0
        if (r_tpdu_tag == T_SB) {
4569
            /* we have an r_tpdu without header and body,
4570
               it contains only the status part */
4571
0
            if (hdr_tag)
4572
0
                *hdr_tag = NO_TAG;
4573
0
            if (body_len)
4574
0
                *body_len = 0;
4575
0
            return 0;
4576
0
        }
4577
4578
0
        tag = &r_tpdu_tag;
4579
0
        r_tpdu_str = try_val_to_str(r_tpdu_tag, dvbci_r_tpdu);
4580
0
        pi = proto_tree_add_item(tree, hf_dvbci_r_tpdu_tag, tvb, 0, 1, ENC_BIG_ENDIAN);
4581
0
        if (r_tpdu_str) {
4582
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, r_tpdu_str);
4583
0
        }
4584
0
        else {
4585
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, NULL,
4586
0
                    "Invalid Response-TPDU tag");
4587
0
            expert_add_info(pinfo, pi, &ei_dvbci_r_tpdu_tag);
4588
0
            return -1;
4589
0
        }
4590
0
    }
4591
4592
0
    offset = dissect_ber_length(pinfo, tree, tvb, 1, &len_field, NULL);
4593
    /* len_field must be at least 1 for the following t_c_id
4594
       c_tpdu's len_field must match tvbuff exactly
4595
       r_tpdu's len_field does not include the status part after the body */
4596
0
    if (len_field==0 ||
4597
0
        ((direction==DATA_HOST_TO_CAM) && ((offset+len_field)!=tpdu_len)) ||
4598
0
        ((direction==DATA_CAM_TO_HOST) && ((offset+len_field)>tpdu_len))) {
4599
        /* offset points to 1st byte after the length field */
4600
0
        proto_tree_add_expert_format(tree, pinfo, &ei_dvbci_bad_length, tvb, 1, offset-1,
4601
0
            len_field==0 ? "Invalid length field, length field must be at least 1" :
4602
0
                           "Invalid length field, length field mismatch");
4603
0
        return -1;
4604
0
    }
4605
4606
0
    pi = proto_tree_add_item_ret_uint8(tree, hf_dvbci_t_c_id, tvb, offset, 1, ENC_BIG_ENDIAN, &t_c_id);
4607
    /* tcid in transport header and link layer must only match for
4608
     * data transmission commands */
4609
0
    if (t_c_id!=lpdu_tcid) {
4610
0
        if (tag && (*tag==T_RCV || *tag==T_DATA_MORE || *tag==T_DATA_LAST)) {
4611
0
            expert_add_info_format(pinfo, pi, &ei_dvbci_t_c_id, "Transport Connection ID mismatch, tcid is %d in the transport layer and %d in the link layer",
4612
0
                    t_c_id, lpdu_tcid);
4613
0
        }
4614
0
    }
4615
0
    else {
4616
0
        col_append_sep_fstr(pinfo->cinfo, COL_INFO, ": ", "tcid %d", t_c_id);
4617
0
    }
4618
0
    offset++;
4619
4620
0
    if (hdr_tag && tag)
4621
0
        *hdr_tag = *tag;
4622
0
    if (body_len)
4623
0
        *body_len = len_field-1;  /* -1 for t_c_id */
4624
0
    return offset;
4625
0
}
4626
4627
static void
4628
dissect_dvbci_tpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
4629
        uint8_t direction, uint8_t lpdu_tcid)
4630
0
{
4631
0
    uint32_t       tpdu_len, body_len;
4632
0
    proto_item    *ti;
4633
0
    proto_tree    *trans_tree;
4634
0
    int            offset, status_len;
4635
0
    uint8_t        hdr_tag                = NO_TAG;
4636
0
    tvbuff_t      *body_tvb, *payload_tvb = NULL;
4637
0
    fragment_head *frag_msg               = NULL;
4638
4639
4640
0
    tpdu_len = tvb_reported_length(tvb);
4641
4642
0
    col_clear(pinfo->cinfo, COL_INFO);
4643
4644
0
    trans_tree = proto_tree_add_subtree(tree, tvb, 0, -1, ett_dvbci_transport, &ti, "Transport Layer");
4645
4646
0
    offset = dissect_dvbci_tpdu_hdr(tvb, pinfo, trans_tree, direction,
4647
0
            lpdu_tcid, tpdu_len, &hdr_tag, &body_len);
4648
0
    if (offset==-1)
4649
0
        return;
4650
0
    proto_item_set_len(ti, offset);
4651
0
    if ((offset>0) && (body_len!=0)) {
4652
        /* for unfragmented data, the reassembly api behaviour is unclear
4653
            if we put the body part of the tvb into fragment_add_seq_next(),
4654
            process_reassembled_data() returns the remainder of the tvb
4655
            which is body|status part
4656
           if there's more than one fragment, payload_tvb contains only
4657
            the reassembled bodies as expected
4658
           to work around this issue, we use a dedicated body_tvb as
4659
            input to reassembly routines */
4660
0
        body_tvb = tvb_new_subset_length(tvb, offset, body_len);
4661
        /* dissect_dvbci_tpdu_hdr() checked that lpdu_tcid==t_c_id */
4662
0
        frag_msg = fragment_add_seq_next(&spdu_reassembly_table,
4663
0
                body_tvb, 0, pinfo, SPDU_SEQ_ID_BASE+lpdu_tcid, NULL,
4664
0
                body_len,
4665
0
                hdr_tag == T_DATA_MORE ? 1 : 0);
4666
0
        payload_tvb = process_reassembled_data(body_tvb, 0, pinfo,
4667
0
                "Reassembled SPDU", frag_msg, &spdu_frag_items,
4668
0
                NULL, trans_tree);
4669
0
        if (!payload_tvb) {
4670
0
            if (hdr_tag == T_DATA_MORE) {
4671
0
                pinfo->fragmented = true;
4672
0
                col_append_str(pinfo->cinfo, COL_INFO, " (Message fragment)");
4673
0
            } else {
4674
0
                payload_tvb = body_tvb;
4675
0
            }
4676
0
        }
4677
0
        offset += body_len;
4678
0
    }
4679
4680
0
    if (direction==DATA_CAM_TO_HOST) {
4681
        /* minimum length of an rtpdu status is 4 bytes */
4682
0
        if (tpdu_len-offset < 4) {
4683
0
            proto_tree_add_expert(trans_tree, pinfo, &ei_dvbci_r_tpdu_status_mandatory, tvb, 0, 0);
4684
0
            return;
4685
0
        }
4686
0
        status_len = dissect_dvbci_tpdu_status(
4687
0
                tvb, offset, pinfo, trans_tree, lpdu_tcid, hdr_tag);
4688
0
        if (status_len<0)
4689
0
            return;
4690
0
        proto_tree_set_appendix(trans_tree, tvb, offset, status_len);
4691
0
    }
4692
4693
0
    if (payload_tvb)
4694
0
        dissect_dvbci_spdu(payload_tvb, pinfo, tree, direction, lpdu_tcid);
4695
0
}
4696
4697
4698
static void
4699
dissect_dvbci_lpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
4700
        uint8_t direction)
4701
0
{
4702
0
    proto_tree    *link_tree;
4703
0
    uint32_t       payload_len;
4704
0
    uint8_t        tcid, more_last;
4705
0
    proto_item    *pi;
4706
0
    tvbuff_t      *payload_tvb;
4707
0
    fragment_head *frag_msg;
4708
4709
4710
0
    payload_len = tvb_reported_length(tvb);
4711
4712
0
    col_set_str(pinfo->cinfo, COL_INFO, "LPDU");
4713
4714
0
    link_tree = proto_tree_add_subtree(tree, tvb, 0, 2, ett_dvbci_link, NULL, "Link Layer");
4715
4716
0
    tcid = tvb_get_uint8(tvb, 0);
4717
0
    col_append_sep_fstr(pinfo->cinfo, COL_INFO, ": ", "tcid %d", tcid);
4718
0
    proto_tree_add_item(link_tree, hf_dvbci_tcid, tvb, 0, 1, ENC_BIG_ENDIAN);
4719
4720
0
    more_last = tvb_get_uint8(tvb, 1);
4721
0
    pi = proto_tree_add_item(link_tree, hf_dvbci_ml, tvb, 1, 1, ENC_BIG_ENDIAN);
4722
0
    if (try_val_to_str(more_last, dvbci_ml) == NULL) {
4723
0
        expert_add_info(pinfo, pi, &ei_dvbci_ml);
4724
0
    }
4725
4726
    /* buf_size_host==0 -> we did not capture the buffer size negotiation */
4727
0
    if (buf_size_host!=0 && payload_len>buf_size_host) {
4728
0
        proto_tree_add_expert_format(link_tree, pinfo, &ei_dvbci_bad_length, tvb, 2, payload_len,
4729
0
                "Payload too large, maximum payload length is the negotiated buffer size (%d bytes)", buf_size_host);
4730
0
    }
4731
4732
0
    frag_msg = fragment_add_seq_next(&tpdu_reassembly_table,
4733
0
            tvb, 2, pinfo, TPDU_SEQ_ID_BASE+tcid, NULL,
4734
0
            tvb_reported_length_remaining(tvb, 2),
4735
0
            more_last == ML_MORE ? 1 : 0);
4736
4737
0
    payload_tvb = process_reassembled_data(tvb, 2, pinfo,
4738
0
            "Reassembled TPDU", frag_msg, &tpdu_frag_items,
4739
0
            NULL, link_tree);
4740
0
    if (!payload_tvb) {
4741
0
        if (more_last == ML_MORE) {
4742
0
            pinfo->fragmented = true;
4743
0
            col_append_str(pinfo->cinfo, COL_INFO, " (Message fragment)");
4744
0
       } else
4745
0
            payload_tvb = tvb_new_subset_remaining(tvb, 2);
4746
0
    }
4747
0
    if (payload_tvb)
4748
0
        dissect_dvbci_tpdu(payload_tvb, pinfo, tree, direction, tcid);
4749
0
}
4750
4751
/* dissect DVB-CI buffer size negotiation */
4752
static void
4753
dissect_dvbci_buf_neg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
4754
        uint8_t direction)
4755
0
{
4756
0
    uint16_t    buf_size;
4757
0
    proto_item *pi;
4758
4759
0
    buf_size = tvb_get_ntohs(tvb, 0);
4760
4761
0
    col_add_fstr(pinfo->cinfo, COL_INFO, "%s: %u bytes",
4762
0
                 direction == DATA_HOST_TO_CAM ?
4763
0
                 "negotiated buffer size" : "buffer size proposal",
4764
0
                 buf_size);
4765
4766
0
    if (direction == DATA_HOST_TO_CAM) {
4767
0
        buf_size_host = buf_size;
4768
0
        pi = proto_tree_add_uint_format(tree, hf_dvbci_buf_size, tvb,
4769
0
                0, 2, buf_size,
4770
0
                "Negotiated buffer size: %u bytes", buf_size);
4771
0
        if (buf_size_host > buf_size_cam) {
4772
            /* ATTENTION:
4773
               wireshark may run through each packet multiple times
4774
               if we didn't check the direction, we'd get the error when
4775
               wireshark runs through the initial CAM packet for the 2nd time
4776
             */
4777
0
            expert_add_info_format(pinfo, pi, &ei_dvbci_buf_size, "Illegal buffer size command. Host shall not request a buffer size larger than the CAM proposal");
4778
0
        }
4779
0
    }
4780
0
    else if (direction == DATA_CAM_TO_HOST) {
4781
0
        buf_size_cam = buf_size;
4782
0
        proto_tree_add_uint_format(tree, hf_dvbci_buf_size, tvb,
4783
0
                0, 2, buf_size,
4784
0
                "Buffer size proposal by the CAM: %u bytes", buf_size);
4785
0
    }
4786
4787
0
    if (buf_size < 16) {
4788
0
        proto_tree_add_expert_format(tree, pinfo, &ei_dvbci_buf_size, tvb, 0, 2,
4789
0
               "Illegal buffer size, minimum buffer size is 16 bytes");
4790
0
    }
4791
0
}
4792
4793
/* dissect Level 1 version/product information tuple's payload
4794
   data_tvb is a separate tvb for the tuple payload (without tag and len)
4795
   return the number of dissected bytes or -1 for error */
4796
static int
4797
dissect_dvbci_cis_payload_tpll_v1(tvbuff_t *data_tvb,
4798
        packet_info *pinfo _U_, proto_tree *tree)
4799
0
{
4800
0
    unsigned offset=0, offset_str_end;
4801
4802
    /* the CIS is defined by PCMCIA, all multi-byte values are little endian
4803
       (the rest of DVB-CI is a big-endian protocol) */
4804
0
    proto_tree_add_item(tree, hf_dvbci_cis_tpll_v1_major,
4805
0
            data_tvb, offset, 1, ENC_LITTLE_ENDIAN);
4806
0
    offset++;
4807
0
    proto_tree_add_item(tree, hf_dvbci_cis_tpll_v1_minor,
4808
0
            data_tvb, offset, 1, ENC_LITTLE_ENDIAN);
4809
0
    offset++;
4810
4811
    /* manufacturer, name and additional infos are 0-terminated strings */
4812
0
    if (!tvb_find_uint8_remaining(data_tvb, offset, 0x0, &offset_str_end))
4813
0
        return offset;
4814
0
    proto_tree_add_item(tree, hf_dvbci_cis_tpll_v1_info_manuf,
4815
0
            data_tvb, offset, offset_str_end-offset, ENC_ASCII);
4816
0
    offset = offset_str_end+1; /* +1 for 0 termination */
4817
4818
0
    if (!tvb_find_uint8_remaining(data_tvb, offset, 0x0, &offset_str_end))
4819
0
        return offset;
4820
0
    proto_tree_add_item(tree, hf_dvbci_cis_tpll_v1_info_name,
4821
0
            data_tvb, offset, offset_str_end-offset, ENC_ASCII);
4822
0
    offset = offset_str_end+1;
4823
4824
    /* the pc-card spec mentions two additional info strings,
4825
        it's unclear if both are mandatory
4826
       >1 because the last byte is the tuple end marker */
4827
0
    while (tvb_reported_length_remaining(data_tvb, offset)>1) {
4828
0
        if (!tvb_find_uint8_remaining(data_tvb, offset, 0x0, &offset_str_end))
4829
0
            break;
4830
0
        proto_tree_add_item(tree, hf_dvbci_cis_tpll_v1_info_additional,
4831
0
                data_tvb, offset, offset_str_end-offset, ENC_ASCII);
4832
0
        offset = offset_str_end+1;
4833
0
    }
4834
4835
0
    proto_tree_add_item(tree, hf_dvbci_cis_tpll_v1_end,
4836
0
            data_tvb, offset, 1, ENC_LITTLE_ENDIAN);
4837
0
    offset++;
4838
4839
0
    return offset;
4840
0
}
4841
4842
static int
4843
dissect_dvbci_cis_payload_config(tvbuff_t *data_tvb,
4844
        packet_info *pinfo _U_, proto_tree *tree)
4845
0
{
4846
0
    int          offset = 0;
4847
    /* these are the actual sizes, the CIS stores rmsz-1 and rasz-1 */
4848
0
    uint8_t      rfsz, rmsz, rasz;
4849
0
    uint8_t      st_code, st_len;
4850
0
    const char *st_code_str;
4851
0
    proto_item  *st_item = NULL;
4852
0
    proto_tree  *st_tree = NULL;
4853
0
    uint8_t      stci_ifn_size;   /* actual size, see comment above */
4854
4855
0
    rfsz = (tvb_get_uint8(data_tvb, offset)&0xC0) >> 6;
4856
0
    proto_tree_add_item(tree, hf_dvbci_cis_tpcc_rfsz,
4857
0
            data_tvb, offset, 1, ENC_LITTLE_ENDIAN);
4858
0
    rmsz = ((tvb_get_uint8(data_tvb, offset)&0x3C) >> 2) + 1;
4859
0
    proto_tree_add_item(tree, hf_dvbci_cis_tpcc_rmsz,
4860
0
            data_tvb, offset, 1, ENC_LITTLE_ENDIAN);
4861
0
    rasz = (tvb_get_uint8(data_tvb, offset)&0x03) + 1;
4862
0
    proto_tree_add_item(tree, hf_dvbci_cis_tpcc_rasz,
4863
0
            data_tvb, offset, 1, ENC_LITTLE_ENDIAN);
4864
0
    offset++;
4865
4866
0
    proto_tree_add_item(tree, hf_dvbci_cis_tpcc_last,
4867
0
            data_tvb, offset, 1, ENC_LITTLE_ENDIAN);
4868
0
    offset++;
4869
4870
0
    proto_tree_add_item(tree, hf_dvbci_cis_tpcc_radr,
4871
0
            data_tvb, offset, rasz, ENC_LITTLE_ENDIAN);
4872
0
    offset += rasz;
4873
0
    proto_tree_add_item(tree, hf_dvbci_cis_tpcc_rmsk,
4874
0
            data_tvb, offset, rmsz, ENC_NA);
4875
0
    offset += rmsz;
4876
0
    offset += rfsz; /* skip reserved bytes */
4877
4878
0
    while (tvb_reported_length_remaining(data_tvb, offset) > 0) {
4879
0
        st_code = tvb_get_uint8(data_tvb, offset);
4880
0
        st_code_str = val_to_str_const(st_code, dvbci_cis_subtpl_code, "unknown");
4881
0
        st_tree = proto_tree_add_subtree_format(tree, data_tvb, offset, -1,
4882
0
                ett_dvbci_cis_subtpl, &st_item, "Subtuple: %s (0x%x)", st_code_str, st_code);
4883
0
        proto_tree_add_item(st_tree, hf_dvbci_cis_st_code,
4884
0
            data_tvb, offset, 1, ENC_LITTLE_ENDIAN);
4885
0
        offset++;
4886
0
        st_len = tvb_get_uint8(data_tvb, offset);
4887
0
        proto_item_set_len(st_item, 2+st_len); /* tag, len byte, body */
4888
0
        proto_tree_add_item(st_tree, hf_dvbci_cis_st_len,
4889
0
            data_tvb, offset, 1, ENC_LITTLE_ENDIAN);
4890
0
        offset++;
4891
0
        if (st_code == CCSTPL_CIF) {
4892
0
            stci_ifn_size = ((tvb_get_uint8(data_tvb, offset) & 0xC0)>>6)+1;
4893
0
            proto_tree_add_item(st_tree, hf_dvbci_cis_stci_ifn_size,
4894
0
                    data_tvb, offset, 1, ENC_LITTLE_ENDIAN);
4895
            /* don't increment offset,
4896
               size and actual value's LSB share the same byte */
4897
0
            proto_tree_add_item(st_tree, hf_dvbci_cis_stci_ifn,
4898
0
                    data_tvb, offset, stci_ifn_size, ENC_LITTLE_ENDIAN);
4899
0
            offset += stci_ifn_size;
4900
            /* the stci_str field could consist of multiple strings,
4901
               this case is not supported for now */
4902
0
            proto_tree_add_item(st_tree, hf_dvbci_cis_stci_str,
4903
0
                    data_tvb, offset, st_len-stci_ifn_size, ENC_ASCII);
4904
0
            offset += st_len-stci_ifn_size;
4905
0
        }
4906
0
        else {
4907
            /* skip unknown subtuple's content */
4908
0
            offset += st_len;
4909
0
        }
4910
0
    }
4911
4912
0
    return offset;
4913
0
}
4914
4915
4916
static int
4917
dissect_dvbci_cis_payload_cftable_entry(tvbuff_t *data_tvb,
4918
        packet_info *pinfo _U_, proto_tree *tree)
4919
0
{
4920
0
    unsigned offset = 0;
4921
0
    bool intface_flag;
4922
4923
0
    intface_flag = ((tvb_get_uint8(data_tvb, offset) & 0x80) == 0x80);
4924
    /* tpce_indx byte */
4925
0
    proto_tree_add_item(tree, hf_dvbci_cis_tpce_indx_intface,
4926
0
            data_tvb, offset, 1, ENC_LITTLE_ENDIAN);
4927
0
    proto_tree_add_item(tree, hf_dvbci_cis_tpce_indx_default,
4928
0
            data_tvb, offset, 1, ENC_LITTLE_ENDIAN);
4929
0
    proto_tree_add_item(tree, hf_dvbci_cis_tpce_indx_cnf_entry,
4930
0
            data_tvb, offset, 1, ENC_LITTLE_ENDIAN);
4931
0
    offset++;
4932
4933
0
    if (intface_flag) {
4934
        /* tpce_if byte */
4935
0
        proto_tree_add_item(tree, hf_dvbci_cis_tpce_if_type,
4936
0
            data_tvb, offset, 1, ENC_LITTLE_ENDIAN);
4937
        /* XXX parse other components of tpce_if */
4938
0
        offset++;
4939
0
    }
4940
4941
    /* tpce_fs byte: this is present in any case */
4942
0
    proto_tree_add_item(tree, hf_dvbci_cis_tpce_fs_mem_space,
4943
0
            data_tvb, offset, 1, ENC_LITTLE_ENDIAN);
4944
0
    proto_tree_add_item(tree, hf_dvbci_cis_tpce_fs_irq,
4945
0
            data_tvb, offset, 1, ENC_LITTLE_ENDIAN);
4946
0
    proto_tree_add_item(tree, hf_dvbci_cis_tpce_fs_io,
4947
0
            data_tvb, offset, 1, ENC_LITTLE_ENDIAN);
4948
    /* XXX parse other components of tpce_fs */
4949
0
    offset++;
4950
4951
0
    return offset;
4952
0
}
4953
4954
/* dissect the payload of a device_oc or device_oa tuple */
4955
static int
4956
dissect_dvbci_cis_payload_device(tvbuff_t *data_tvb,
4957
        packet_info *pinfo _U_, proto_tree *tree)
4958
0
{
4959
0
    int       offset = 0;
4960
0
    bool      ext;
4961
4962
0
    ext = ((tvb_get_uint8(data_tvb, offset) & 0x80) == 0x80);
4963
4964
0
    proto_tree_add_item(tree, hf_dvbci_cis_dev_vcc_used,
4965
0
            data_tvb, offset, 1, ENC_LITTLE_ENDIAN);
4966
0
    proto_tree_add_item(tree, hf_dvbci_cis_dev_mwait,
4967
0
            data_tvb, offset, 1, ENC_LITTLE_ENDIAN);
4968
0
    offset++;
4969
4970
0
    while (ext) {
4971
0
        ext = ((tvb_get_uint8(data_tvb, offset) & 0x80) == 0x80);
4972
4973
0
        proto_tree_add_item(tree, hf_dvbci_cis_dev_oth_cond_info,
4974
0
                data_tvb, offset, 1, ENC_LITTLE_ENDIAN);
4975
0
        offset++;
4976
0
    }
4977
4978
0
    return offset;
4979
0
}
4980
4981
static void
4982
dissect_dvbci_cis(tvbuff_t *tvb, unsigned offset,
4983
        packet_info *pinfo, proto_tree *tree)
4984
0
{
4985
0
    int          offset_start;
4986
0
    proto_tree  *cis_tree = NULL, *tpl_tree = NULL;
4987
0
    proto_item  *ti_main, *ti_tpl;
4988
0
    uint8_t      tpl_code;
4989
0
    const char *tpl_code_str = NULL;
4990
0
    uint8_t      len_field;
4991
0
    tvbuff_t    *tpl_data_tvb;
4992
4993
0
    offset_start = offset;
4994
4995
0
    cis_tree = proto_tree_add_subtree(tree, tvb, offset, -1,
4996
0
            ett_dvbci_cis, &ti_main, "Card Information Structure (CIS)");
4997
4998
0
    do {
4999
0
        tpl_code = tvb_get_uint8(tvb, offset);
5000
0
        tpl_code_str = val_to_str_const(tpl_code, dvbci_cis_tpl_code, "unknown");
5001
5002
0
        tpl_tree = proto_tree_add_subtree_format(cis_tree,
5003
0
                tvb, offset, -1, ett_dvbci_cis_tpl, &ti_tpl, "CIS tuple: %s", tpl_code_str);
5004
5005
0
        proto_tree_add_uint_format(tpl_tree, hf_dvbci_cis_tpl_code,
5006
0
                tvb, offset, 1, tpl_code, "Tuple code: %s (0x%x)",
5007
0
                tpl_code_str, tpl_code);
5008
0
        offset++;
5009
5010
0
        if (tpl_code == CISTPL_END) {
5011
0
            proto_item_set_len(ti_tpl, 1); /* only tag (no len and content) */
5012
0
            break;
5013
0
        }
5014
5015
0
        len_field = tvb_get_uint8(tvb, offset);
5016
0
        proto_tree_add_item(tpl_tree, hf_dvbci_cis_tpl_len,
5017
0
                tvb, offset, 1, ENC_LITTLE_ENDIAN);
5018
0
        offset++;
5019
5020
0
        tpl_data_tvb = tvb_new_subset_length(tvb, offset, len_field);
5021
0
        switch (tpl_code) {
5022
0
            case CISTPL_VERS_1:
5023
0
                dissect_dvbci_cis_payload_tpll_v1(
5024
0
                        tpl_data_tvb, pinfo, tpl_tree);
5025
0
                offset += len_field;
5026
0
                break;
5027
0
            case CISTPL_CONFIG:
5028
0
                dissect_dvbci_cis_payload_config(tpl_data_tvb, pinfo, tpl_tree);
5029
0
                offset += len_field;
5030
0
                break;
5031
0
            case CISTPL_CFTABLE_ENTRY:
5032
0
                dissect_dvbci_cis_payload_cftable_entry(
5033
0
                        tpl_data_tvb, pinfo, tpl_tree);
5034
0
                offset += len_field;
5035
0
                break;
5036
0
            case CISTPL_DEVICE_OC:
5037
                /* fall through: those two tuples' data is identical */
5038
0
            case CISTPL_DEVICE_OA:
5039
0
                dissect_dvbci_cis_payload_device(
5040
0
                        tpl_data_tvb, pinfo, tpl_tree);
5041
0
                offset += len_field;
5042
0
                break;
5043
0
            case CISTPL_MANFID:
5044
0
                proto_tree_add_item(tpl_tree, hf_dvbci_cis_tplmid_manf,
5045
0
                        tvb, offset, 2, ENC_LITTLE_ENDIAN);
5046
0
                offset+=2;
5047
0
                proto_tree_add_item(tpl_tree, hf_dvbci_cis_tplmid_card,
5048
0
                        tvb, offset, 2, ENC_LITTLE_ENDIAN);
5049
0
                offset+=2;
5050
0
                break;
5051
0
            default:
5052
0
                if (len_field>0) {
5053
0
                    proto_tree_add_item(tpl_tree, hf_dvbci_cis_tpl_data,
5054
0
                            tvb, offset, len_field, ENC_NA);
5055
0
                }
5056
0
                offset += len_field;
5057
0
                break;
5058
0
        }
5059
5060
0
        proto_item_set_len(ti_tpl, 2+len_field); /* tag, len byte, content */
5061
5062
0
    } while (tvb_reported_length_remaining(tvb, offset) > 0);
5063
5064
0
    proto_item_set_len(ti_main, offset-offset_start);
5065
0
}
5066
5067
5068
static int
5069
dissect_dvbci(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
5070
0
{
5071
0
    int          packet_len, offset = 0, offset_ver, offset_evt, offset_len_field;
5072
0
    uint8_t      version, event;
5073
0
    const char *event_str;
5074
0
    uint16_t     len_field;
5075
0
    proto_item  *ti;
5076
0
    proto_tree  *dvbci_tree, *hdr_tree;
5077
0
    tvbuff_t    *payload_tvb;
5078
0
    uint16_t     cor_addr;
5079
0
    uint8_t      cor_value;
5080
0
    proto_item  *pi;
5081
0
    uint8_t      hw_event;
5082
5083
0
    if (tvb_captured_length(tvb) < 4)
5084
0
        return 0;
5085
5086
0
    offset_ver = offset;
5087
0
    version = tvb_get_uint8(tvb, offset++);
5088
0
    if (version != 0)
5089
0
        return 0;
5090
5091
0
    offset_evt = offset;
5092
0
    event = tvb_get_uint8(tvb, offset++);
5093
0
    event_str = try_val_to_str(event, dvbci_event);
5094
0
    if (!event_str)
5095
0
        return 0;
5096
5097
0
    packet_len = tvb_reported_length(tvb);
5098
0
    offset_len_field = offset;
5099
0
    len_field = tvb_get_ntohs(tvb, offset);
5100
0
    if (len_field != (packet_len-4))
5101
0
        return 0;
5102
0
    offset += 2;
5103
5104
0
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "DVB-CI");
5105
0
    col_set_str(pinfo->cinfo, COL_INFO, event_str);
5106
5107
0
    ti = proto_tree_add_protocol_format(tree, proto_dvbci,
5108
0
            tvb, 0, packet_len, "DVB Common Interface: %s", event_str);
5109
0
    dvbci_tree = proto_item_add_subtree(ti, ett_dvbci);
5110
0
    hdr_tree = proto_tree_add_subtree(dvbci_tree,
5111
0
            tvb, 0, offset, ett_dvbci_hdr, NULL, "Pseudo header");
5112
0
    proto_tree_add_item(hdr_tree, hf_dvbci_hdr_ver,
5113
0
            tvb, offset_ver, 1, ENC_BIG_ENDIAN);
5114
0
    proto_tree_add_item(hdr_tree, hf_dvbci_event,
5115
0
            tvb, offset_evt, 1, ENC_BIG_ENDIAN);
5116
0
    proto_tree_add_item(hdr_tree, hf_dvbci_len,
5117
0
            tvb, offset_len_field, 2, ENC_BIG_ENDIAN);
5118
5119
0
    if (IS_DATA_TRANSFER(event)) {
5120
0
        dvbci_set_addrs(event, pinfo);
5121
5122
0
        payload_tvb = tvb_new_subset_remaining(tvb, offset);
5123
0
        if (len_field == 2) {
5124
0
            dissect_dvbci_buf_neg(payload_tvb, pinfo, dvbci_tree, event);
5125
0
        }
5126
0
        else {
5127
0
            dissect_dvbci_lpdu(payload_tvb, pinfo, dvbci_tree, event);
5128
0
        }
5129
0
    }
5130
0
    else if (event==DVBCI_EVT_COR_WRITE) {
5131
        /* PCAP format for DVB-CI defines COR address as big endian */
5132
0
        pi = proto_tree_add_item(dvbci_tree, hf_dvbci_cor_addr,
5133
0
                tvb, offset, 2, ENC_BIG_ENDIAN);
5134
0
        cor_addr = tvb_get_ntohs(tvb, offset);
5135
0
        if (cor_addr == 0xFFFF) {
5136
0
            proto_item_append_text(pi, " (COR address is unknown)");
5137
0
            col_append_sep_str(pinfo->cinfo, COL_INFO, ": ", "unknown address");
5138
0
        }
5139
0
        else if (cor_addr > 0xFFE) {
5140
0
            expert_add_info(pinfo, pi, &ei_dvbci_cor_addr);
5141
0
        }
5142
0
        else {
5143
0
            col_append_sep_fstr(pinfo->cinfo, COL_INFO, ": ",
5144
0
                "address 0x%x", cor_addr);
5145
0
        }
5146
0
        offset += 2;
5147
0
        cor_value = tvb_get_uint8(tvb, offset);
5148
0
        proto_tree_add_item(dvbci_tree, hf_dvbci_cor_val,
5149
0
                tvb, offset, 1, ENC_BIG_ENDIAN);
5150
0
        col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL,
5151
0
            "value 0x%x", cor_value);
5152
0
    }
5153
0
    else if (event==DVBCI_EVT_CIS_READ) {
5154
0
        dissect_dvbci_cis(tvb, offset, pinfo, dvbci_tree);
5155
0
    }
5156
0
    else if (event==DVBCI_EVT_HW_EVT) {
5157
0
        hw_event = tvb_get_uint8(tvb, offset);
5158
0
        col_set_str(pinfo->cinfo, COL_INFO,
5159
0
                val_to_str_const(hw_event, dvbci_hw_event, "Invalid hardware event"));
5160
0
        proto_tree_add_item(dvbci_tree, hf_dvbci_hw_event,
5161
0
                tvb, offset, 1, ENC_BIG_ENDIAN);
5162
0
    }
5163
5164
0
    return packet_len;
5165
0
}
5166
5167
static void
5168
dvbci_shutdown(void)
5169
0
{
5170
0
    if (spdu_table)
5171
0
        g_hash_table_destroy(spdu_table);
5172
0
    if (apdu_table)
5173
0
        g_hash_table_destroy(apdu_table);
5174
0
}
5175
5176
void
5177
proto_register_dvbci(void)
5178
16
{
5179
16
    unsigned  i;
5180
16
    module_t *dvbci_module;
5181
16
    expert_module_t* expert_dvbci;
5182
5183
16
    static int *ett[] = {
5184
16
        &ett_dvbci,
5185
16
        &ett_dvbci_hdr,
5186
16
        &ett_dvbci_cis,
5187
16
        &ett_dvbci_cis_tpl,
5188
16
        &ett_dvbci_cis_subtpl,
5189
16
        &ett_dvbci_link,
5190
16
        &ett_dvbci_link_frag,
5191
16
        &ett_dvbci_link_frags,
5192
16
        &ett_dvbci_transport,
5193
16
        &ett_dvbci_transport_frag,
5194
16
        &ett_dvbci_transport_frags,
5195
16
        &ett_dvbci_session,
5196
16
        &ett_dvbci_res,
5197
16
        &ett_dvbci_application,
5198
16
        &ett_dvbci_es,
5199
16
        &ett_dvbci_ca_desc,
5200
16
        &ett_dvbci_text,
5201
16
        &ett_dvbci_cc_item,
5202
16
        &ett_dvbci_sac_msg_body,
5203
16
        &ett_dvbci_ami_req_types,
5204
16
        &ett_dvbci_lsc_conn_desc,
5205
16
        &ett_dvbci_opp_cap_loop,
5206
16
        &ett_dvbci_dlv_sys_hint
5207
16
    };
5208
5209
16
    static hf_register_info hf[] = {
5210
16
        { &hf_dvbci_hdr_ver,
5211
16
          { "Version", "dvb-ci.hdr_version",
5212
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
5213
16
        },
5214
16
        { &hf_dvbci_event,
5215
16
          { "Event", "dvb-ci.event",
5216
16
            FT_UINT8, BASE_HEX, VALS(dvbci_event), 0, NULL, HFILL }
5217
16
        },
5218
16
        { &hf_dvbci_len,
5219
16
          { "Length field", "dvb-ci.length_field",
5220
16
            FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }
5221
16
        },
5222
16
        { &hf_dvbci_hw_event,
5223
16
          { "Hardware event", "dvb-ci.hw_event",
5224
16
            FT_UINT8, BASE_HEX, VALS(dvbci_hw_event), 0, NULL, HFILL }
5225
16
        },
5226
16
        { &hf_dvbci_cor_addr,
5227
16
          { "COR address", "dvb-ci.cor_address",
5228
16
            FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }
5229
16
        },
5230
16
        { &hf_dvbci_cor_val,
5231
16
          { "COR value", "dvb-ci.cor_value",
5232
16
            FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
5233
16
        },
5234
16
        { &hf_dvbci_cis_tpl_code,
5235
16
          { "CIS tuple code", "dvb-ci.cis.tpl_code",
5236
16
            FT_UINT8, BASE_HEX, VALS(dvbci_cis_tpl_code), 0, NULL, HFILL }
5237
16
        },
5238
16
        { &hf_dvbci_cis_tpl_len,
5239
16
          { "Length field", "dvb-ci.cis.tpl_len",
5240
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
5241
16
        },
5242
16
        { &hf_dvbci_cis_tpl_data,
5243
16
          { "Tuple data", "dvb-ci.cis.tpl_data",
5244
16
            FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
5245
16
        },
5246
16
        { &hf_dvbci_cis_tpll_v1_major,
5247
16
          { "Major version number", "dvb-ci.cis.tpll_v1_major",
5248
16
            FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
5249
16
        },
5250
16
        { &hf_dvbci_cis_tpll_v1_minor,
5251
16
          { "Minor version number", "dvb-ci.cis.tpll_v1_minor",
5252
16
            FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
5253
16
        },
5254
16
        { &hf_dvbci_cis_tpll_v1_info_manuf,
5255
16
          { "Manufacturer", "dvb-ci.cis.tpll_v1_info.manufacturer",
5256
16
            FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
5257
16
        },
5258
16
        { &hf_dvbci_cis_tpll_v1_info_name,
5259
16
          { "Name", "dvb-ci.cis.tpll_v1_info.name",
5260
16
            FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
5261
16
        },
5262
16
        { &hf_dvbci_cis_tpll_v1_info_additional,
5263
16
          { "Additional info", "dvb-ci.cis.tpll_v1_info.additional",
5264
16
            FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
5265
16
        },
5266
16
        { &hf_dvbci_cis_tpll_v1_end,
5267
16
          { "End of chain", "dvb-ci.cis.tpll_v1_end",
5268
16
            FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
5269
16
        },
5270
16
        { &hf_dvbci_cis_tpcc_rfsz,
5271
16
          { "Size of reserved area", "dvb-ci.cis.tpcc_rfsz",
5272
16
            FT_UINT8, BASE_HEX, NULL, 0xC0, NULL, HFILL }
5273
16
        },
5274
16
        { &hf_dvbci_cis_tpcc_rmsz,
5275
16
          { "Size of TPCC_RMSK field - 1", "dvb-ci.cis.tpcc_rmsz",
5276
16
            FT_UINT8, BASE_HEX, NULL, 0x3C, NULL, HFILL }
5277
16
        },
5278
16
        { &hf_dvbci_cis_tpcc_rasz,
5279
16
          { "Size of TPCC_RADR - 1", "dvb-ci.cis.tpcc_rasz",
5280
16
            FT_UINT8, BASE_HEX, NULL, 0x03, NULL, HFILL }
5281
16
        },
5282
16
        { &hf_dvbci_cis_tpcc_last,
5283
16
          { "Index of the last cftable entry", "dvb-ci.cis.tpcc_last",
5284
16
            FT_UINT8, BASE_HEX, NULL, 0x3F, NULL, HFILL }
5285
16
        },
5286
16
        { &hf_dvbci_cis_tpcc_radr,
5287
16
          { "COR base address", "dvb-ci.cis.tpcc_radr",
5288
16
            FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }
5289
16
        },
5290
16
        { &hf_dvbci_cis_tpcc_rmsk,
5291
16
          { "Configuration register presence mask", "dvb-ci.cis.tpcc_rmsk",
5292
16
            FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
5293
16
        },
5294
16
        { &hf_dvbci_cis_st_code,
5295
16
          { "Subtuple tag", "dvb-ci.cis.st_code",
5296
16
            FT_UINT8, BASE_HEX, VALS(dvbci_cis_subtpl_code), 0, NULL, HFILL }
5297
16
        },
5298
16
        { &hf_dvbci_cis_st_len,
5299
16
          { "Subtuple length", "dvb-ci.cis.st_len",
5300
16
            FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
5301
16
        },
5302
16
        { &hf_dvbci_cis_stci_ifn_size,
5303
16
          { "Size of interface ID number - 1", "dvb-ci.cis.stci_ifn_size",
5304
16
            FT_UINT8, BASE_HEX, NULL, 0xC0, NULL, HFILL }
5305
16
        },
5306
16
        { &hf_dvbci_cis_stci_ifn,
5307
16
          { "Interface ID number", "dvb-ci.cis.stci_ifn",
5308
16
            FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }
5309
16
        },
5310
16
        { &hf_dvbci_cis_stci_str,
5311
16
          { "Interface description strings", "dvb-ci.cis.stci_str",
5312
16
            FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
5313
16
        },
5314
16
        { &hf_dvbci_cis_tpce_indx_intface,
5315
16
          { "Intface", "dvb-ci.cis.tpce_indx.intface",
5316
16
            FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL }
5317
16
        },
5318
16
        { &hf_dvbci_cis_tpce_indx_default,
5319
16
          { "Default", "dvb-ci.cis.tpce_indx.default",
5320
16
            FT_UINT8, BASE_HEX, NULL, 0x40, NULL, HFILL }
5321
16
        },
5322
16
        { &hf_dvbci_cis_tpce_indx_cnf_entry,
5323
16
          { "Configuration entry number", "dvb-ci.cis.tpce_indx.cnf_entry",
5324
16
            FT_UINT8, BASE_HEX, NULL, 0x3F, NULL, HFILL }
5325
16
        },
5326
16
        { &hf_dvbci_cis_tpce_if_type,
5327
16
          { "Interface type", "dvb-ci.cis.tpce_if.type", FT_UINT8, BASE_HEX,
5328
16
              VALS(dvbci_cis_tpce_if_type), 0x0F, NULL, HFILL }
5329
16
        },
5330
16
        { &hf_dvbci_cis_tpce_fs_mem_space,
5331
16
          { "Mem space", "dvb-ci.cis.tpce_fs.mem_space",
5332
16
            FT_UINT8, BASE_HEX, NULL, 0x60, NULL, HFILL }
5333
16
        },
5334
16
        { &hf_dvbci_cis_tpce_fs_irq,
5335
16
          { "IRQ", "dvb-ci.cis.tpce_fs.irq",
5336
16
            FT_UINT8, BASE_HEX, NULL, 0x10, NULL, HFILL }
5337
16
        },
5338
16
        { &hf_dvbci_cis_tpce_fs_io,
5339
16
          { "IO Space", "dvb-ci.cis.tpce_fs.io",
5340
16
            FT_UINT8, BASE_HEX, NULL, 0x08, NULL, HFILL }
5341
16
        },
5342
16
        { &hf_dvbci_cis_dev_vcc_used,
5343
16
          { "Vcc used", "dvb-ci.cis.device.vcc_used",
5344
16
              FT_UINT8, BASE_HEX, VALS(dvbci_cis_dev_vcc_used), 0x06, NULL, HFILL }
5345
16
        },
5346
16
        { &hf_dvbci_cis_dev_mwait,
5347
16
          { "MWait", "dvb-ci.cis.device.mwait",
5348
16
            FT_UINT8, BASE_HEX, NULL, 0x01, NULL, HFILL }
5349
16
        },
5350
16
        { &hf_dvbci_cis_dev_oth_cond_info,
5351
16
          { "Other conditions info", "dvb-ci.cis.device.other_cond",
5352
16
            FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
5353
16
        },
5354
16
        { &hf_dvbci_cis_tplmid_manf,
5355
16
          { "PC Card manufacturer code", "dvb-ci.cis.tplmid_manf",
5356
16
            FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }
5357
16
        },
5358
16
        { &hf_dvbci_cis_tplmid_card,
5359
16
          { "Manufacturer info", "dvb-ci.cis.tplmid_card",
5360
16
            FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }
5361
16
        },
5362
16
        { &hf_dvbci_buf_size,
5363
16
          { "Buffer Size", "dvb-ci.buf_size",
5364
16
            FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }
5365
16
        },
5366
16
        { &hf_dvbci_tcid,
5367
16
          { "Transport Connection ID", "dvb-ci.tcid",
5368
16
            FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
5369
16
        },
5370
16
        { &hf_dvbci_ml,
5371
16
          { "More/Last indicator", "dvb-ci.more_last",
5372
16
            FT_UINT8, BASE_HEX, VALS(dvbci_ml), 0, NULL, HFILL }
5373
16
        },
5374
        /* on the link layer, tpdus are reassembled */
5375
16
        { &hf_dvbci_l_frags,
5376
16
          { "Tpdu fragments", "dvb-ci.tpdu_fragments",
5377
16
           FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL }
5378
16
        },
5379
16
        { &hf_dvbci_l_frag,
5380
16
          { "Tpdu fragment", "dvb-ci.tpdu_fragment",
5381
16
           FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL }
5382
16
        },
5383
16
        { &hf_dvbci_l_frag_overlap,
5384
16
          { "Tpdu fragment overlap", "dvb-ci.tpdu_fragment.overlap",
5385
16
           FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL }
5386
16
        },
5387
16
        { &hf_dvbci_l_frag_overlap_conflicts,
5388
16
          { "Tpdu fragment overlapping with conflicting data",
5389
16
           "dvb-ci.tpdu_fragment.overlap.conflicts",
5390
16
           FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL }
5391
16
        },
5392
16
        { &hf_dvbci_l_frag_multiple_tails,
5393
16
          { "Tpdu has multiple tail fragments",
5394
16
           "dvb-ci.tpdu_fragment.multiple_tails",
5395
16
          FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL }
5396
16
        },
5397
16
        { &hf_dvbci_l_frag_too_long_frag,
5398
16
          { "Tpdu fragment too long", "dvb-ci.tpdu_fragment.too_long_fragment",
5399
16
           FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL }
5400
16
        },
5401
16
        { &hf_dvbci_l_frag_err,
5402
16
          { "Tpdu defragmentation error", "dvb-ci.tpdu_fragment.error",
5403
16
           FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL }
5404
16
        },
5405
16
        { &hf_dvbci_l_frag_cnt,
5406
16
          { "Tpdu fragment count", "dvb-ci.tpdu_fragment.count",
5407
16
           FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }
5408
16
        },
5409
16
        { &hf_dvbci_l_reass_in,
5410
16
          { "Tpdu reassembled in", "dvb-ci.tpdu_reassembled.in",
5411
16
           FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL }
5412
16
        },
5413
16
        { &hf_dvbci_l_reass_len,
5414
16
          { "Reassembled tpdu length", "dvb-ci.tpdu_reassembled.length",
5415
16
           FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }
5416
16
        },
5417
16
        { &hf_dvbci_c_tpdu_tag,
5418
16
          { "Command TPDU Tag", "dvb-ci.c_tpdu_tag",
5419
16
            FT_UINT8, BASE_HEX, VALS(dvbci_c_tpdu), 0, NULL, HFILL }
5420
16
        },
5421
16
        { &hf_dvbci_r_tpdu_tag,
5422
16
           { "Response TPDU Tag", "dvb-ci.r_tpdu_tag",
5423
16
             FT_UINT8, BASE_HEX, VALS(dvbci_r_tpdu), 0, NULL, HFILL }
5424
16
        },
5425
16
        { &hf_dvbci_t_c_id,
5426
16
           { "Transport Connection ID", "dvb-ci.t_c_id",
5427
16
             FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
5428
16
        },
5429
16
        { &hf_dvbci_sb_tag,
5430
16
           { "SB tag", "dvb-ci.sb_tag",
5431
16
             FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
5432
16
        },
5433
16
        { &hf_dvbci_sb_value,
5434
16
          { "SB Value", "dvb-ci.sb_value", FT_UINT8, BASE_HEX,
5435
16
            VALS(dvbci_sb_value), 0, NULL, HFILL } },
5436
5437
        /* on the transport layer, spdus are reassembled */
5438
16
        { &hf_dvbci_t_frags,
5439
16
          { "Spdu fragments", "dvb-ci.spdu_fragments",
5440
16
           FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL }
5441
16
        },
5442
16
        { &hf_dvbci_t_frag,
5443
16
          { "Spdu fragment", "dvb-ci.spdu_fragment",
5444
16
           FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL }
5445
16
        },
5446
16
        { &hf_dvbci_t_frag_overlap,
5447
16
          { "Spdu fragment overlap", "dvb-ci.spdu_fragment.overlap",
5448
16
           FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL }
5449
16
        },
5450
16
        { &hf_dvbci_t_frag_overlap_conflicts,
5451
16
          { "Spdu fragment overlapping with conflicting data",
5452
16
           "dvb-ci.tpdu_fragment.overlap.conflicts",
5453
16
          FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL }
5454
16
        },
5455
16
        { &hf_dvbci_t_frag_multiple_tails,
5456
16
          { "Spdu has multiple tail fragments",
5457
16
           "dvb-ci.spdu_fragment.multiple_tails",
5458
16
           FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL }
5459
16
        },
5460
16
        { &hf_dvbci_t_frag_too_long_frag,
5461
16
          { "Spdu fragment too long", "dvb-ci.spdu_fragment.too_long_fragment",
5462
16
           FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL }
5463
16
        },
5464
16
        { &hf_dvbci_t_frag_err,
5465
16
          { "Spdu defragmentation error", "dvb-ci.spdu_fragment.error",
5466
16
           FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL }
5467
16
        },
5468
16
        { &hf_dvbci_t_frag_cnt,
5469
16
          { "Spdu fragment count", "dvb-ci.spdu_fragment.count",
5470
16
           FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }
5471
16
        },
5472
16
        { &hf_dvbci_t_reass_in,
5473
16
          { "Spdu reassembled in", "dvb-ci.spdu_reassembled.in",
5474
16
           FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL }
5475
16
        },
5476
16
        { &hf_dvbci_t_reass_len,
5477
16
          { "Reassembled spdu length", "dvb-ci.spdu_reassembled.length",
5478
16
           FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }
5479
16
        },
5480
16
        { &hf_dvbci_spdu_tag,
5481
16
          { "SPDU Tag", "dvb-ci.spdu_tag",
5482
16
           FT_UINT8, BASE_HEX, VALS(dvbci_spdu_tag), 0, NULL, HFILL }
5483
16
        },
5484
16
        { &hf_dvbci_sess_status,
5485
16
          { "Session Status", "dvb-ci.session_status",
5486
16
            FT_UINT8, BASE_HEX, VALS(dvbci_sess_status), 0, NULL, HFILL }
5487
16
        },
5488
16
        { &hf_dvbci_sess_nb,
5489
16
          { "Session Number", "dvb-ci.session_nb",
5490
16
            FT_UINT16, BASE_DEC, NULL , 0, NULL, HFILL }
5491
16
        },
5492
16
        { &hf_dvbci_close_sess_status,
5493
16
          { "Session Status", "dvb-ci.close_session_status",
5494
16
            FT_UINT8, BASE_HEX, VALS(dvbci_close_sess_status), 0, NULL, HFILL }
5495
16
        },
5496
16
        { &hf_dvbci_res_id,
5497
16
          { "Resource ID", "dvb-ci.res.id",
5498
16
            FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }
5499
16
        },
5500
16
        { &hf_dvbci_res_id_type,
5501
16
          { "Resource ID Type", "dvb-ci.res.id_type",
5502
16
            FT_UINT32, BASE_HEX, NULL, RES_ID_TYPE_MASK, NULL, HFILL }
5503
16
        },
5504
16
        { &hf_dvbci_res_class,
5505
16
          { "Resource Class", "dvb-ci.res.class",
5506
16
            FT_UINT32, BASE_HEX, VALS(dvbci_res_class), RES_CLASS_MASK, NULL, HFILL }
5507
16
        },
5508
16
        { &hf_dvbci_res_type,
5509
16
          { "Resource Type", "dvb-ci.res.type",
5510
16
            FT_UINT32, BASE_HEX, NULL, RES_TYPE_MASK, NULL, HFILL }
5511
16
        },
5512
16
        { &hf_dvbci_res_ver,
5513
16
          { "Resource Version", "dvb-ci.res.version",
5514
16
            FT_UINT32, BASE_HEX, NULL, RES_VER_MASK, NULL, HFILL }
5515
16
        },
5516
16
        { &hf_dvbci_apdu_tag,
5517
16
          { "APDU Tag", "dvb-ci.apdu_tag",
5518
16
            FT_UINT24, BASE_HEX, VALS(dvbci_apdu_tag), 0, NULL, HFILL }
5519
16
        },
5520
16
        { &hf_dvbci_app_type,
5521
16
          { "Application type", "dvb-ci.ap.type",
5522
16
            FT_UINT8, BASE_HEX, VALS(dvbci_app_type), 0, NULL, HFILL }
5523
16
        },
5524
16
        { &hf_dvbci_app_manf,
5525
16
          { "Application manufacturer", "dvb-ci.ap.manufacturer",
5526
16
            FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }
5527
16
        },
5528
16
        { &hf_dvbci_manf_code,
5529
16
          { "Manufacturer code", "dvb-ci.ap.manufacturer_code",
5530
16
            FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }
5531
16
        },
5532
16
        { &hf_dvbci_menu_str_len,
5533
16
          { "Menu string length", "dvb-ci.ap.menu_string_length",
5534
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
5535
16
        },
5536
16
        { &hf_dvbci_ap_char_tbl,
5537
16
          { "Character table", "dvb-ci.ap.menu_char_tbl",
5538
16
            FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL}
5539
16
        },
5540
16
        { &hf_dvbci_menu_str,
5541
16
          { "Menu string", "dvb-ci.ap.menu_string",
5542
16
            FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
5543
16
        },
5544
16
        { &hf_dvbci_data_rate,
5545
16
          { "Transport stream data rate supported by the host",
5546
16
            "dvb-ci.ap.data_rate",
5547
16
            FT_UINT8, BASE_HEX, VALS(dvbci_data_rate), 0, NULL, HFILL }
5548
16
        },
5549
16
        { &hf_dvbci_ca_sys_id,
5550
16
          { "CA system ID", "dvb-ci.ca.ca_system_id",
5551
16
            FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }
5552
16
        },
5553
16
        { &hf_dvbci_ca_pmt_list_mgmt,
5554
16
          { "CA PMT list management", "dvb-ci.ca.ca_pmt_list_management",
5555
16
            FT_UINT8, BASE_HEX, VALS(dvbci_ca_pmt_list_mgmt), 0, NULL,
5556
16
            HFILL }
5557
16
        },
5558
16
        { &hf_dvbci_prog_num,
5559
16
          { "Program number", "dvb-ci.ca.program_number",
5560
16
            FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }
5561
16
        },
5562
16
        { &hf_dvbci_ca_ver,
5563
16
          { "Version number", "dvb-ci.ca.version_number",
5564
16
            FT_UINT8, BASE_HEX, NULL, 0x3E, NULL, HFILL }
5565
16
        },
5566
16
        { &hf_dvbci_curr_next,
5567
16
          { "Current-next indicator", "dvb-ci.ca.current_next_indicator",
5568
16
            FT_UINT8, BASE_HEX, NULL, 0x01, NULL, HFILL }
5569
16
        },
5570
16
        { &hf_dvbci_prog_info_len,
5571
16
          { "Program info length", "dvb-ci.ca.program_info_length",
5572
16
            FT_UINT16, BASE_HEX, NULL, 0x0FFF, NULL, HFILL }
5573
16
        },
5574
16
        { &hf_dvbci_stream_type,
5575
16
          { "Stream type", "dvb-ci.ca.stream_type", FT_UINT8,
5576
16
              BASE_HEX|BASE_EXT_STRING, &mpeg_pmt_stream_type_vals_ext,
5577
16
              0, NULL, HFILL }
5578
16
        },
5579
16
        { &hf_dvbci_es_pid,
5580
16
          { "Elementary stream PID", "dvb-ci.ca.elementary_pid",
5581
16
            FT_UINT16, BASE_HEX, NULL, 0x1FFF, NULL, HFILL }
5582
16
        },
5583
16
        { &hf_dvbci_es_info_len,
5584
16
          { "Elementary stream info length", "dvb-ci.ca.es_info_length",
5585
16
            FT_UINT16, BASE_HEX, NULL, 0x0FFF, NULL, HFILL }
5586
16
        },
5587
16
        { &hf_dvbci_ca_pmt_cmd_id,
5588
16
          { "CA PMT command ID", "dvb-ci.ca.ca_pmt_cmd_id",
5589
16
            FT_UINT8, BASE_HEX, VALS(dvbci_ca_pmt_cmd_id), 0, NULL, HFILL }
5590
16
        },
5591
16
        { &hf_dvbci_descr_len,
5592
16
          { "CA descriptor length", "dvb-ci.ca.ca_desc_len",
5593
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
5594
16
        },
5595
16
        { &hf_dvbci_ca_pid,
5596
16
          { "CA PID", "dvb-ci.ca.ca_pid",
5597
16
            FT_UINT16, BASE_HEX, NULL, 0x1FFF, NULL, HFILL }
5598
16
        },
5599
16
        { &hf_dvbci_ca_priv_data,
5600
16
          { "Private data", "dvb-ci.ca.private_data",
5601
16
            FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
5602
16
        },
5603
16
        { &hf_dvbci_ca_enable_flag,
5604
16
          { "CA enable flag", "dvb-ci.ca.ca_enable_flag",
5605
16
            FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL }
5606
16
        },
5607
16
        { &hf_dvbci_ca_enable,
5608
16
          { "CA enable", "dvb-ci.ca.ca_enable",
5609
16
            FT_UINT8, BASE_HEX, VALS(dvbci_ca_enable), 0x7F, NULL, HFILL }
5610
16
        },
5611
16
        { &hf_dvbci_auth_proto_id,
5612
16
          { "Authentication protocol ID", "dvb-ci.aut.proto_id",
5613
16
            FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }
5614
16
        },
5615
16
        { &hf_dvbci_auth_req_bytes,
5616
16
          { "Authentication request data", "dvb-ci.aut.req",
5617
16
            FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
5618
16
        },
5619
16
        { &hf_dvbci_auth_resp_bytes,
5620
16
          { "Authentication response data", "dvb-ci.aut.resp",
5621
16
            FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
5622
16
        },
5623
16
        { &hf_dvbci_network_id,
5624
16
          { "Network ID", "dvb-ci.hc.nid",
5625
16
            FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }
5626
16
        },
5627
16
        { &hf_dvbci_original_network_id,
5628
16
          { "Original network ID", "dvb-ci.hc.onid",
5629
16
            FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }
5630
16
        },
5631
16
        { &hf_dvbci_transport_stream_id,
5632
16
          { "Transport stream ID", "dvb-ci.hc.tsid",
5633
16
            FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }
5634
16
        },
5635
16
        { &hf_dvbci_service_id,
5636
16
          { "Service ID", "dvb-ci.hc.svcid",
5637
16
            FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }
5638
16
        },
5639
16
        { &hf_dvbci_replacement_ref,
5640
16
          { "Replacement reference", "dvb-ci.hc.replacement_ref",
5641
16
            FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
5642
16
        },
5643
16
        { &hf_dvbci_replaced_pid,
5644
16
          { "Replaced PID", "dvb-ci.hc.replaced_pid",
5645
16
            FT_UINT16, BASE_HEX, NULL, 0x1FFF, NULL, HFILL }
5646
16
        },
5647
16
        { &hf_dvbci_replacement_pid,
5648
16
          { "Replacement PID", "dvb-ci.hc.replacement_pid",
5649
16
            FT_UINT16, BASE_HEX, NULL, 0x1FFF, NULL, HFILL }
5650
16
        },
5651
16
        { &hf_dvbci_pmt_flag,
5652
16
          { "PMT flag", "dvb-ci.hc.pmt_flag",
5653
16
            FT_UINT8, BASE_HEX, NULL, 0x01, NULL, HFILL }
5654
16
        },
5655
16
        { &hf_dvbci_hc_desc_loop_len,
5656
16
          { "Descriptor loop length", "dvb-ci.hc.desc_loop_len",
5657
16
            FT_UINT16, BASE_DEC, NULL, 0x0FFF, NULL, HFILL }
5658
16
        },
5659
16
        { &hf_dvbci_hc_status,
5660
16
          { "Status field", "dvb-ci.hc.status_field",
5661
16
            FT_UINT8, BASE_HEX, VALS(dvbci_hc_status), 0, NULL, HFILL }
5662
16
        },
5663
16
        { &hf_dvbci_hc_release_reply,
5664
16
          { "Release reply", "dvb-ci.hc.release_reply",
5665
16
            FT_UINT8, BASE_HEX, VALS(dvbci_hc_release_reply), 0, NULL, HFILL }
5666
16
        },
5667
16
        { &hf_dvbci_resp_intv,
5668
16
          { "Response interval", "dvb-ci.dt.resp_interval",
5669
16
            FT_RELATIVE_TIME, BASE_NONE, NULL, 0, NULL, HFILL }
5670
16
        },
5671
16
        { &hf_dvbci_utc_time,
5672
16
          { "UTC time", "dvb-ci.dt.utc_time",
5673
16
            FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, NULL, HFILL }
5674
16
        },
5675
5676
        /* we have to use FT_INT16 instead of FT_RELATIVE_TIME,
5677
           local offset can be negative */
5678
16
        { &hf_dvbci_local_offset,
5679
16
          { "Local time offset", "dvb-ci.dt.local_offset",
5680
16
            FT_INT16, BASE_DEC, NULL, 0, NULL, HFILL }
5681
16
        },
5682
16
        { &hf_dvbci_close_mmi_cmd_id,
5683
16
          { "Command ID", "dvb-ci.mmi.close_mmi_cmd_id",
5684
16
            FT_UINT8, BASE_HEX, VALS(dvbci_close_mmi_cmd_id), 0, NULL, HFILL }
5685
16
        },
5686
16
        { &hf_dvbci_close_mmi_delay,
5687
16
          { "Delay (in sec)", "dvb-ci.mmi.delay",
5688
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
5689
16
        },
5690
16
        { &hf_dvbci_disp_ctl_cmd,
5691
16
          { "Command", "dvb-ci.mmi.disp_ctl_cmd",
5692
16
            FT_UINT8, BASE_HEX, VALS(dvbci_disp_ctl_cmd), 0, NULL, HFILL }
5693
16
        },
5694
16
        { &hf_dvbci_mmi_mode,
5695
16
          { "MMI mode", "dvb-ci.mmi.mode",
5696
16
            FT_UINT8, BASE_HEX, VALS(dvbci_mmi_mode), 0, NULL, HFILL }
5697
16
        },
5698
16
        { &hf_dvbci_disp_rep_id,
5699
16
          { "Reply ID", "dvb-ci.mmi.disp_rep_id",
5700
16
            FT_UINT8, BASE_HEX, VALS(dvbci_disp_rep_id), 0, NULL, HFILL }
5701
16
        },
5702
16
        { &hf_dvbci_mmi_char_tbl,
5703
16
          { "Character table", "dvb-ci.mmi.char_tbl",
5704
16
            FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL}
5705
16
        },
5706
16
        { &hf_dvbci_blind_ans,
5707
16
          { "Blind answer flag", "dvb-ci.mmi.blind_ans",
5708
16
            FT_UINT8, BASE_HEX, VALS(dvbci_blind_ans), 0x01, NULL, HFILL }
5709
16
        },
5710
16
        { &hf_dvbci_ans_txt_len,
5711
16
          { "Answer text length", "dvb-ci.mmi.ans_txt_len",
5712
16
            FT_UINT8, BASE_DEC, NULL , 0, NULL, HFILL }
5713
16
        },
5714
16
        { &hf_dvbci_enq,
5715
16
          { "Enquiry string", "dvb-ci.mmi.enq",
5716
16
            FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
5717
16
        },
5718
16
        { &hf_dvbci_ans_id,
5719
16
          { "Answer ID", "dvb-ci.mmi.ans_id",
5720
16
            FT_UINT8, BASE_HEX, VALS(dvbci_ans_id) , 0, NULL, HFILL }
5721
16
        },
5722
16
        { &hf_dvbci_ans,
5723
16
          { "Answer", "dvb-ci.mmi.ans",
5724
16
            FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
5725
16
        },
5726
16
        { &hf_dvbci_choice_nb,
5727
16
          { "Number of menu items", "dvb-ci.mmi.choice_nb",
5728
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
5729
16
        },
5730
16
        { &hf_dvbci_choice_ref,
5731
16
          { "Selected item", "dvb-ci.mmi.choice_ref",
5732
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
5733
16
        },
5734
16
        { &hf_dvbci_item_nb,
5735
16
          { "Number of list items", "dvb-ci.mmi.item_nb",
5736
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
5737
16
        },
5738
16
        { &hf_dvbci_title,
5739
16
          { "Title", "dvb-ci.mmi.title",
5740
16
            FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
5741
16
        },
5742
16
        { &hf_dvbci_subtitle,
5743
16
          { "Sub-title", "dvb-ci.mmi.subtitle",
5744
16
            FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
5745
16
        },
5746
16
        { &hf_dvbci_bottom,
5747
16
          { "Bottom line", "dvb-ci.mmi.bottom",
5748
16
            FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
5749
16
        },
5750
16
        { &hf_dvbci_item,
5751
16
          { "Item", "dvb-ci.mmi.item",
5752
16
            FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
5753
16
        },
5754
16
        { &hf_dvbci_host_country,
5755
16
          { "Host country", "dvb-ci.hlc.country",
5756
16
            FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
5757
16
        },
5758
16
        { &hf_dvbci_host_language,
5759
16
          { "Host language", "dvb-ci.hlc.language",
5760
16
            FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
5761
16
        },
5762
16
        { &hf_dvbci_cup_type,
5763
16
          { "CAM upgrade type", "dvb-ci.cup.type",
5764
16
            FT_UINT8, BASE_HEX, VALS(dvbci_cup_type), 0, NULL, HFILL }
5765
16
        },
5766
16
        { &hf_dvbci_cup_download_time,
5767
16
          { "Download time", "dvb-ci.cup.download_time",
5768
16
            FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }
5769
16
        },
5770
16
        { &hf_dvbci_cup_answer,
5771
16
          { "CAM upgrade answer", "dvb-ci.cup.answer",
5772
16
            FT_UINT8, BASE_HEX, VALS(dvbci_cup_answer), 0, NULL, HFILL }
5773
16
        },
5774
16
        { &hf_dvbci_cup_progress,
5775
16
          { "CAM upgrade progress", "dvb-ci.cup.progress",
5776
16
            FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
5777
16
        },
5778
16
        { &hf_dvbci_cup_reset,
5779
16
          { "requested CAM reset", "dvb-ci.cup.reset",
5780
16
            FT_UINT8, BASE_HEX, VALS(dvbci_cup_reset), 0, NULL, HFILL }
5781
16
        },
5782
16
        { &hf_dvbci_cc_sys_id_bitmask,
5783
16
          { "CC system id bitmask", "dvb-ci.cc.sys_id_bitmask",
5784
16
            FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
5785
16
        },
5786
16
        { &hf_dvbci_cc_snd_dat_nbr,
5787
16
          { "Number of sent data items", "dvb-ci.cc.snd_dat_nbr",
5788
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
5789
16
        },
5790
16
        { &hf_dvbci_cc_req_dat_nbr,
5791
16
          { "Number of requested data items", "dvb-ci.cc.req_dat_nbr",
5792
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
5793
16
        },
5794
16
        { &hf_dvbci_cc_dat_id,
5795
16
          { "CC datatype id", "dvb-ci.cc.datatype_id",
5796
16
            FT_UINT8, BASE_HEX, VALS(dvbci_cc_dat_id), 0, NULL, HFILL }
5797
16
        },
5798
16
        { &hf_dvbci_cc_dat_len,
5799
16
          { "Length", "dvb-ci.cc.datatype_length",
5800
16
            FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }
5801
16
        },
5802
16
        { &hf_dvbci_brand_cert,
5803
16
          { "Brand certificate", "dvb-ci.cc.brand_cert",
5804
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
5805
16
        },
5806
16
        { &hf_dvbci_dev_cert,
5807
16
          { "Device certificate", "dvb-ci.cc.dev_cert",
5808
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
5809
16
        },
5810
16
        { &hf_dvbci_uri_ver,
5811
16
          { "URI version", "dvb-ci.cc.uri.version",
5812
16
            FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
5813
16
        },
5814
16
        { &hf_dvbci_uri_aps,
5815
16
          { "APS", "dvb-ci.cc.uri.aps",
5816
16
            FT_UINT8, BASE_HEX, NULL, 0xC0, NULL, HFILL }
5817
16
        },
5818
16
        { &hf_dvbci_uri_emi,
5819
16
          { "EMI", "dvb-ci.cc.uri.emi",
5820
16
            FT_UINT8, BASE_HEX, VALS(dvbci_cc_uri_emi), 0x30, NULL, HFILL }
5821
16
        },
5822
16
        { &hf_dvbci_uri_ict,
5823
16
          { "Image constraint token", "dvb-ci.cc.uri.ict",
5824
16
            FT_UINT8, BASE_HEX, NULL, 0x08, NULL, HFILL }
5825
16
        },
5826
16
        { &hf_dvbci_uri_rct,
5827
16
          { "Redistribution control trigger (RCT)", "dvb-ci.cc.uri.rct",
5828
16
            FT_UINT8, BASE_HEX, NULL, 0x04, NULL, HFILL }
5829
16
        },
5830
16
        { &hf_dvbci_uri_dot,
5831
16
          { "Digital only token (DOT)", "dvb-ci.cc.uri.dot",
5832
16
            FT_UINT8, BASE_HEX, NULL, 0x01, NULL, HFILL }
5833
16
        },
5834
        /* retention limit is 6bit in URIv1 and 8bit in URIv2 and later
5835
           the position depends on the version, we can't define a mask here */
5836
16
        { &hf_dvbci_uri_rl,
5837
16
          { "Retention limit", "dvb-ci.cc.uri.rl",
5838
16
            FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
5839
16
        },
5840
16
        { &hf_dvbci_cc_key_register,
5841
16
          { "Key register", "dvb-ci.cc.key_register",
5842
16
            FT_UINT8, BASE_HEX, VALS(dvbci_cc_key_register), 0, NULL, HFILL }
5843
16
        },
5844
16
        { &hf_dvbci_cc_status_field,
5845
16
          { "Status field", "dvb-ci.cc.status_field",
5846
16
            FT_UINT8, BASE_HEX, VALS(dvbci_cc_status), 0, NULL, HFILL }
5847
16
        },
5848
16
        { &hf_dvbci_cc_op_mode,
5849
16
          { "Operating mode", "dvb-ci.cc.op_mode",
5850
16
            FT_UINT8, BASE_HEX, VALS(dvbci_cc_op_mode), 0, NULL, HFILL }
5851
16
        },
5852
16
        { &hf_dvbci_cc_data,
5853
16
          { "Data", "dvb-ci.cc.data",
5854
16
            FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
5855
16
        },
5856
16
        { &hf_dvbci_sac_msg_ctr,
5857
16
          { "Message counter", "dvb-ci.cc.sac.msg_ctr",
5858
16
            FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }
5859
16
        },
5860
16
        { &hf_dvbci_sac_proto_ver,
5861
16
          { "Protocol version", "dvb-ci.cc.sac.proto_ver",
5862
16
            FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL }
5863
16
        },
5864
16
        { &hf_dvbci_sac_auth_cip,
5865
16
          { "Authentication cipher", "dvb-ci.cc.sac.auth_cip",
5866
16
            FT_UINT8, BASE_HEX, VALS(dvbci_cc_sac_auth), 0x0E, NULL, HFILL }
5867
16
        },
5868
16
        { &hf_dvbci_sac_payload_enc,
5869
16
          { "Payload encryption flag", "dvb-ci.cc.sac.payload_enc",
5870
16
            FT_UINT8, BASE_HEX, NULL, 0x01, NULL, HFILL }
5871
16
        },
5872
16
        { &hf_dvbci_sac_enc_cip,
5873
16
          { "Encryption cipher", "dvb-ci.cc.sac.enc_cip",
5874
16
            FT_UINT8, BASE_HEX, VALS(dvbci_cc_sac_enc), 0xE0, NULL, HFILL }
5875
16
        },
5876
16
        { &hf_dvbci_sac_payload_len,
5877
16
          { "Payload length", "dvb-ci.cc.sac.payload_len",
5878
16
            FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }
5879
16
        },
5880
16
        { &hf_dvbci_sac_enc_body,
5881
16
          { "Encrypted SAC body", "dvb-ci.cc.sac.enc_body",
5882
16
            FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
5883
16
        },
5884
16
        { &hf_dvbci_sac_padding,
5885
16
          { "Padding", "dvb-ci.cc.sac.padding",
5886
16
            FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
5887
16
        },
5888
16
        { &hf_dvbci_sac_signature,
5889
16
          { "Signature", "dvb-ci.cc.sac.signature",
5890
16
            FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
5891
16
        },
5892
16
        { &hf_dvbci_rating,
5893
16
          { "Rating", "dvb-ci.cc.rating",
5894
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
5895
16
        },
5896
16
        { &hf_dvbci_capability_field,
5897
16
          { "Capability field", "dvb-ci.cc.capability_field",
5898
16
            FT_UINT8, BASE_HEX, VALS(dvbci_cc_cap), 0, NULL, HFILL }
5899
16
        },
5900
16
        { &hf_dvbci_pin_chg_time,
5901
16
          { "PIN change time (UTC)", "dvb-ci.cc.pin_change_time",
5902
16
            FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, NULL, HFILL }
5903
16
        },
5904
16
        { &hf_dvbci_pincode_status,
5905
16
          { "Pincode status field", "dvb-ci.cc.pincode_status_field",
5906
16
            FT_UINT8, BASE_HEX, VALS(dvbci_pincode_status), 0, NULL, HFILL }
5907
16
        },
5908
16
        { &hf_dvbci_cc_prog_num,
5909
16
          { "Program number", "dvb-ci.cc.program_number",
5910
16
            FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }
5911
16
        },
5912
16
        { &hf_dvbci_pin_evt_time,
5913
16
          { "PIN event time (UTC)", "dvb-ci.cc.pin_event_time",
5914
16
            FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, NULL, HFILL }
5915
16
        },
5916
16
        { &hf_dvbci_pin_evt_cent,
5917
16
          { "PIN event time centiseconds", "dvb-ci.cc.pin_event_time_centi",
5918
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
5919
16
        },
5920
16
        { &hf_dvbci_cc_priv_data,
5921
16
          { "Private data", "dvb-ci.cc.private_data",
5922
16
            FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
5923
16
        },
5924
16
        { &hf_dvbci_pincode,
5925
16
          { "PIN code", "dvb-ci.cc.pincode",
5926
16
            FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
5927
16
        },
5928
16
        { &hf_dvbci_app_dom_id_len,
5929
16
          { "Application Domain Identifier length", "dvb-ci.ami.app_dom_id_len",
5930
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
5931
16
        },
5932
16
        { &hf_dvbci_init_obj_len,
5933
16
          { "Initial Object length", "dvb-ci.ami.init_obj_len",
5934
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
5935
16
        },
5936
16
        { &hf_dvbci_app_dom_id,
5937
16
          { "Application Domain Identifier", "dvb-ci.ami.app_dom_id",
5938
16
            FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
5939
16
        },
5940
16
        { &hf_dvbci_init_obj,
5941
16
          { "Initial Object", "dvb-ci.ami.init_obj",
5942
16
            FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
5943
16
        },
5944
16
        { &hf_dvbci_ack_code,
5945
16
          { "Acknowledgement", "dvb-ci.ami.ack_code",
5946
16
            FT_UINT8, BASE_HEX, VALS(dvbci_ack_code), 0, NULL, HFILL }
5947
16
        },
5948
16
        { &hf_dvbci_req_type,
5949
16
          { "Request type", "dvb-ci.ami.req_type",
5950
16
            FT_UINT8, BASE_HEX, VALS(dvbci_req_type), 0, NULL, HFILL }
5951
16
        },
5952
16
        { &hf_dvbci_file_hash,
5953
16
          { "File hash", "dvb-ci.ami.file_hash",
5954
16
            FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
5955
16
        },
5956
16
        { &hf_dvbci_file_name_len,
5957
16
          { "File name length", "dvb-ci.ami.file_name_len",
5958
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
5959
16
        },
5960
16
        { &hf_dvbci_file_name,
5961
16
          { "File name", "dvb-ci.ami.file_name",
5962
16
            FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
5963
16
        },
5964
16
        { &hf_dvbci_file_data_len,
5965
16
          { "File data length", "dvb-ci.ami.file_data_len",
5966
16
            FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }
5967
16
        },
5968
16
        { &hf_dvbci_ami_priv_data,
5969
16
          { "Private data", "dvb-ci.ami.private_data",
5970
16
            FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
5971
16
        },
5972
16
        { &hf_dvbci_req_ok,
5973
16
          { "RequestOK", "dvb-ci.ami.request_ok",
5974
16
            FT_UINT8, BASE_HEX, NULL, 0x02, NULL, HFILL }
5975
16
        },
5976
16
        { &hf_dvbci_file_ok,
5977
16
          { "FileOK", "dvb-ci.ami.file_ok",
5978
16
            FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }
5979
16
        },
5980
16
        { &hf_dvbci_abort_req_code,
5981
16
          { "Abort request code", "dvb-ci.ami.abort_req_code",
5982
16
            FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
5983
16
        },
5984
16
        { &hf_dvbci_abort_ack_code,
5985
16
          { "Abort acknowledgement code", "dvb-ci.ami.abort_ack_code",
5986
16
            FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
5987
16
        },
5988
16
        { &hf_dvbci_phase_id,
5989
16
          { "Phase ID", "dvb-ci.lsc.comms_phase_id",
5990
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
5991
16
        },
5992
16
        { &hf_dvbci_comms_rep_id,
5993
16
          { "Comms reply ID", "dvb-ci.lsc.comms_reply_id",
5994
16
            FT_UINT8, BASE_HEX, VALS(dvbci_comms_rep_id), 0, NULL, HFILL }
5995
16
        },
5996
16
        { &hf_dvbci_lsc_buf_size,
5997
16
          { "Buffer size", "dvb-ci.lsc.buf_size",
5998
16
            FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }
5999
16
        },
6000
16
        { &hf_dvbci_lsc_ret_val,
6001
16
          { "Return value", "dvb-ci.lsc.return_value",
6002
16
            FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
6003
16
        },
6004
16
        { &hf_dvbci_comms_cmd_id,
6005
16
          { "Comms command ID", "dvb-ci.lsc.comms_cmd_id",
6006
16
            FT_UINT8, BASE_HEX, VALS(dvbci_comms_cmd_id), 0, NULL, HFILL }
6007
16
        },
6008
16
        { &hf_dvbci_conn_desc_type,
6009
16
          { "Type", "dvb-ci.lsc.conn_desc_type",
6010
16
            FT_UINT8, BASE_HEX, VALS(dvbci_conn_desc_type), 0, NULL, HFILL }
6011
16
        },
6012
16
        { &hf_dvbci_lsc_media_tag,
6013
16
          { "Tag", "dvb-ci.lsc.media_tag",
6014
16
            FT_UINT8, BASE_HEX, VALS(dvbci_lsc_desc_tag), 0, NULL, HFILL }
6015
16
        },
6016
16
        { &hf_dvbci_lsc_media_len,
6017
16
          { "Length", "dvb-ci.lsc.media_len",
6018
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
6019
16
        },
6020
16
        { &hf_dvbci_lsc_media_data,
6021
16
          { "Media-specific data", "dvb-ci.lsc.media_data",
6022
16
            FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL}
6023
16
        },
6024
16
        { &hf_dvbci_lsc_ip_ver,
6025
16
          { "IP version", "dvb-ci.lsc.ip_version",
6026
16
            FT_UINT8, BASE_DEC, VALS(dvbci_lsc_ip_ver), 0, NULL, HFILL }
6027
16
        },
6028
16
        { &hf_dvbci_lsc_ipv4_addr,
6029
16
          { "IP address", "dvb-ci.lsc.ipv4_addr",
6030
16
            FT_IPv4, BASE_NONE, NULL, 0, NULL, HFILL }
6031
16
        },
6032
16
        { &hf_dvbci_lsc_ipv6_addr,
6033
16
          { "IPv6 address", "dvb-ci.lsc.ipv6_addr",
6034
16
            FT_IPv6, BASE_NONE, NULL, 0, NULL, HFILL }
6035
16
        },
6036
16
        { &hf_dvbci_lsc_dst_port,
6037
16
          { "Destination port", "dvb-ci.lsc.dst_port",
6038
16
            FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }
6039
16
        },
6040
16
        { &hf_dvbci_lsc_proto,
6041
16
          { "Protocol", "dvb-ci.lsc.protocol",
6042
16
            FT_UINT8, BASE_HEX, VALS(dvbci_lsc_proto), 0, NULL, HFILL }
6043
16
        },
6044
16
        { &hf_dvbci_lsc_hostname,
6045
16
          { "Hostname", "dvb-ci.lsc.hostname",
6046
16
            FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
6047
16
        },
6048
16
        { &hf_dvbci_lsc_retry_count,
6049
16
          { "Retry count", "dvb-ci.lsc.retry_count",
6050
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
6051
16
        },
6052
16
        { &hf_dvbci_lsc_timeout,
6053
16
          { "Timeout", "dvb-ci.lsc.timeout",
6054
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
6055
16
        },
6056
16
        { &hf_dvbci_lsc_conn_state,
6057
16
          { "Connection state", "dvb-ci.lsc.connection_state",
6058
16
            FT_UINT8, BASE_HEX, VALS(dvbci_lsc_connect), 0xC0, NULL, HFILL }
6059
16
        },
6060
16
        { &hf_dvbci_lsc_phys_addr,
6061
16
          { "Physical address", "dvb-ci.lsc.physical_address",
6062
16
            FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL }
6063
16
        },
6064
16
        { &hf_dvbci_lsc_netmask,
6065
16
          { "Network mask", "dvb-ci.lsc.netmask",
6066
16
            FT_IPv6, BASE_NONE, NULL, 0, NULL, HFILL }
6067
16
        },
6068
16
        { &hf_dvbci_lsc_gateway,
6069
16
          { "Default gateway", "dvb-ci.lsc.gateway",
6070
16
            FT_IPv6, BASE_NONE, NULL, 0, NULL, HFILL }
6071
16
        },
6072
16
        { &hf_dvbci_lsc_dhcp_srv,
6073
16
          { "DHCP server", "dvb-ci.lsc.dhcp_server",
6074
16
            FT_IPv6, BASE_NONE, NULL, 0, NULL, HFILL }
6075
16
        },
6076
16
        { &hf_dvbci_lsc_num_dns_srv,
6077
16
          { "Number of DNS servers", "dvb-ci.lsc.num_dns_srv",
6078
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
6079
16
        },
6080
16
        { &hf_dvbci_lsc_dns_srv,
6081
16
          { "DNS server", "dvb-ci.lsc.dns_server",
6082
16
            FT_IPv6, BASE_NONE, NULL, 0, NULL, HFILL }
6083
16
        },
6084
16
        { &hf_dvbci_afs_dom_id,
6085
16
          { "Domain identifier", "dvb-ci.afs.domain_identifier",
6086
16
            FT_UINT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
6087
16
        },
6088
16
        { &hf_dvbci_afs_ack_code,
6089
16
          { "Ack code", "dvb-ci.afs.ack_code",
6090
16
            FT_UINT8, BASE_HEX, VALS(dvbci_afs_ack_code), 0, NULL, HFILL }
6091
16
        },
6092
        /* filter string for hf_dvbci_info_ver_op_status and
6093
         * hf_dvbci_info_ver_op_info below is the same, it seems this is ok */
6094
16
        { &hf_dvbci_info_ver_op_status,
6095
16
          { "Info version", "dvb-ci.opp.info_ver",
6096
16
            FT_UINT8, BASE_HEX, NULL, 0xE0, NULL, HFILL }
6097
16
        },
6098
16
        { &hf_dvbci_nit_ver,
6099
16
          { "NIT version", "dvb-ci.opp.nit_ver",
6100
16
            FT_UINT8, BASE_HEX, NULL, 0x1F, NULL, HFILL }
6101
16
        },
6102
16
        { &hf_dvbci_pro_typ,
6103
16
          { "Profile type", "dvb-ci.opp.profile_type",
6104
16
            FT_UINT8, BASE_HEX, NULL, 0xC0, NULL, HFILL }
6105
16
        },
6106
16
        { &hf_dvbci_init_flag,
6107
16
          { "Initialized flag", "dvb-ci.opp.init_flag",
6108
16
            FT_UINT8, BASE_HEX, NULL, 0x20, NULL, HFILL }
6109
16
        },
6110
16
        { &hf_dvbci_ent_chg_flag,
6111
16
          { "Entitlement change flag", "dvb-ci.opp.ent_chg_flag",
6112
16
            FT_UINT8, BASE_HEX, NULL, 0x10, NULL, HFILL }
6113
16
        },
6114
16
        { &hf_dvbci_ent_val_flag,
6115
16
          { "Entitlement valid flag", "dvb-ci.opp.ent_val_flag",
6116
16
            FT_UINT8, BASE_HEX, NULL, 0x08, NULL, HFILL }
6117
16
        },
6118
16
        { &hf_dvbci_ref_req_flag,
6119
16
          { "Refresh request flag", "dvb-ci.opp.refresh_req_flag",
6120
16
            FT_UINT8, BASE_HEX, VALS(dvbci_opp_ref_req_flag), 0x03, NULL, HFILL }
6121
16
        },
6122
16
        { &hf_dvbci_err_flag,
6123
16
          { "Error flag", "dvb-ci.opp.err_flag",
6124
16
            FT_UINT8, BASE_HEX, VALS(dvbci_opp_err_flag), 0xF0, NULL, HFILL }
6125
16
        },
6126
16
        { &hf_dvbci_dlv_sys_hint,
6127
16
          { "Delivery system hint", "dvb-ci.opp.dlv_sys_hint",
6128
16
            FT_UINT8, BASE_HEX, NULL, 0x0F, NULL, HFILL }
6129
16
        },
6130
16
        { &hf_dvbci_dlv_sys_hint_t,
6131
16
          { "terrestrial network (DVB-T/T2)", "dvb-ci.opp.dlv_sys_hint.t",
6132
16
             FT_BOOLEAN, 4, TFS(&tfs_set_notset), 0x4, NULL, HFILL }
6133
16
        },
6134
16
        { &hf_dvbci_dlv_sys_hint_s,
6135
16
          { "satellite network (DVB-S/S2)", "dvb-ci.opp.dlv_sys_hint.s",
6136
16
             FT_BOOLEAN, 4, TFS(&tfs_set_notset), 0x2, NULL, HFILL }
6137
16
        },
6138
16
        { &hf_dvbci_dlv_sys_hint_c,
6139
16
          { "cable network (DVB-C/C2)", "dvb-ci.opp.dlv_sys_hint.c",
6140
16
             FT_BOOLEAN, 4, TFS(&tfs_set_notset), 0x1, NULL, HFILL }
6141
16
        },
6142
16
        { &hf_dvbci_refr_req_date,
6143
16
          { "Refresh request date", "dvb-ci.opp.refresh_req_date",
6144
16
            FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }
6145
16
        },
6146
16
        { &hf_dvbci_refr_req_time,
6147
16
          { "Refresh request time", "dvb-ci.opp.refresh_req_time",
6148
16
            FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
6149
16
        },
6150
16
        { &hf_dvbci_nit_loop_len,
6151
16
          { "NIT loop length", "dvb-ci.opp.nit_loop_len",
6152
16
            FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }
6153
16
        },
6154
16
        { &hf_dvbci_info_valid,
6155
16
          { "Info valid", "dvb-ci.opp.info_valid",
6156
16
            FT_UINT8, BASE_HEX, NULL, 0x08, NULL, HFILL }
6157
16
        },
6158
16
        { &hf_dvbci_info_ver_op_info,
6159
16
          { "Info version", "dvb-ci.opp.info_ver",
6160
16
            FT_UINT8, BASE_HEX, NULL, 0x07, NULL, HFILL }
6161
16
        },
6162
16
        { &hf_dvbci_cicam_onid,
6163
16
          { "CICAM original network id", "dvb-ci.opp.cicam_onid",
6164
16
            FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }
6165
16
        },
6166
16
        { &hf_dvbci_cicam_id,
6167
16
          { "CICAM ID", "dvb-ci.opp.cicam_id",
6168
16
            FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }
6169
16
        },
6170
16
        { &hf_dvbci_opp_char_tbl,
6171
16
          { "Character table", "dvb-ci.opp.char_tbl",
6172
16
            FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL}
6173
16
        },
6174
16
        { &hf_dvbci_sdt_rst_trusted,
6175
16
          { "SDT running status trusted", "dvb-ci.opp.sdt_rst_trusted",
6176
16
            FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL }
6177
16
        },
6178
16
        { &hf_dvbci_eit_rst_trusted,
6179
16
          { "EIT running status trusted", "dvb-ci.opp.eit_rst_trusted",
6180
16
            FT_UINT8, BASE_HEX, NULL, 0x40, NULL, HFILL }
6181
16
        },
6182
16
        { &hf_dvbci_eit_pf_usage,
6183
16
          { "EIT present/following usage", "dvb-ci.opp.eit_pf_usage",
6184
16
            FT_UINT8, BASE_HEX, VALS(dvbci_opp_eit_pf_usage), 0x30, NULL, HFILL }
6185
16
        },
6186
16
        { &hf_dvbci_eit_sch_usage,
6187
16
          { "EIT schedule usage", "dvb-ci.opp.eit_sch_usage",
6188
16
            FT_UINT8, BASE_HEX, VALS(dvbci_opp_eit_sch_usage), 0x0E, NULL, HFILL }
6189
16
        },
6190
16
        { &hf_dvbci_ext_evt_usage,
6191
16
          { "Extended event usage", "dvb-ci.opp.ext_evt_usage",
6192
16
            FT_UINT8, BASE_HEX, VALS(dvbci_opp_ext_evt), 0x01, NULL, HFILL }
6193
16
        },
6194
16
        { &hf_dvbci_sdt_oth_trusted,
6195
16
          { "SDT_other trusted", "dvb-ci.opp.sdt_oth_trusted",
6196
16
            FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL }
6197
16
        },
6198
16
        { &hf_dvbci_eit_evt_trigger,
6199
16
          { "EIT event trigger", "dvb-ci.opp.eit_evt_trigger",
6200
16
            FT_UINT8, BASE_HEX, NULL, 0x40, NULL, HFILL }
6201
16
        },
6202
16
        { &hf_dvbci_opp_lang_code,
6203
16
          { "Language code", "dvb-ci.opp.lang_code",
6204
16
            FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
6205
16
        },
6206
16
        { &hf_dvbci_prof_name,
6207
16
          { "Profile name", "dvb-ci.opp.profile_name",
6208
16
            FT_UINT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
6209
16
        },
6210
16
        { &hf_dvbci_unattended,
6211
16
          { "Unattended flag", "dvb-ci.opp.unattended_flag",
6212
16
            FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL }
6213
16
        },
6214
16
        { &hf_dvbci_opp_svc_type_loop_len,
6215
16
          { "Service type loop length", "dvb-ci.opp.svc_type_loop_len",
6216
16
            FT_UINT8, BASE_DEC, NULL, 0x7F, NULL, HFILL }
6217
16
        },
6218
16
        { &hf_dvbci_opp_svc_type,
6219
16
          { "Service type", "dvb-ci.opp.service_type", FT_UINT8,
6220
16
              BASE_HEX|BASE_EXT_STRING, &mpeg_descr_service_type_vals_ext,
6221
16
              0, NULL, HFILL }
6222
16
        },
6223
16
        { &hf_dvbci_dlv_cap_loop_len,
6224
16
          { "Delivery capability loop length", "dvb-ci.opp.dlv_cap_loop_len",
6225
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
6226
16
        },
6227
16
        { &hf_dvbci_dlv_cap_byte,
6228
16
          { "Delivery capability byte", "dvb-ci.opp.dlv_cap_byte",
6229
16
            FT_UINT8, BASE_HEX, VALS(dvbci_opp_dlv_cap), 0, NULL, HFILL }
6230
16
        },
6231
16
        { &hf_dvbci_app_cap_loop_len,
6232
16
          { "Application capability loop length", "dvb-ci.opp.app_cap_loop_len",
6233
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
6234
16
        },
6235
        /* the CI+ spec is not particularly clear about this but an
6236
         * application id in the capability loop must always be 2 bytes */
6237
16
        { &hf_dvbci_app_cap_bytes,
6238
16
          { "Application capability bytes", "dvb-ci.opp.app_cap_bytes",
6239
16
            FT_UINT16, BASE_HEX|BASE_EXT_STRING,
6240
16
            &mpeg_descr_data_bcast_id_vals_ext, 0, NULL, HFILL }
6241
16
        },
6242
16
        { &hf_dvbci_desc_num,
6243
16
          { "Next unprocessed descriptor number", "dvb-ci.opp.desc_num",
6244
16
            FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
6245
16
        },
6246
16
        { &hf_dvbci_sig_strength,
6247
16
          { "Signal strength", "dvb-ci.opp.sig_strength",
6248
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
6249
16
        },
6250
16
        { &hf_dvbci_sig_qual,
6251
16
          { "Signal quality", "dvb-ci.opp.sig_qual",
6252
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
6253
16
        },
6254
16
        { &hf_dvbci_opp_tune_status,
6255
16
          { "Tuning status", "dvb-ci.opp.tune_status",
6256
16
            FT_UINT8, BASE_HEX, VALS(dvbci_opp_tune_stat), 0xF0, NULL, HFILL }
6257
16
        },
6258
16
        { &hf_dvbci_opp_desc_loop_len,
6259
16
          { "Descriptor loop length", "dvb-ci.opp.desc_loop_len",
6260
16
            FT_UINT16, BASE_DEC, NULL, 0x0FFF, NULL, HFILL }
6261
16
        },
6262
16
        { &hf_dvbci_sas_app_id,
6263
16
          { "Application ID", "dvb-ci.sas.app_id",
6264
16
            FT_UINT64, BASE_HEX, NULL, 0, NULL, HFILL }
6265
16
        },
6266
16
        { &hf_dvbci_sas_sess_state,
6267
16
          { "Connection state", "dvb-ci.sas.sess_state",
6268
16
            FT_UINT8, BASE_DEC, VALS(dvbci_sas_sess_state), 0, NULL, HFILL }
6269
16
        },
6270
16
        { &hf_dvbci_sas_msg_nb,
6271
16
          { "Message number", "dvb-ci.sas.msg_nb",
6272
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }
6273
16
        },
6274
16
        { &hf_dvbci_sas_msg_len,
6275
16
          { "Message length", "dvb-ci.sas.msg_len",
6276
16
            FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }
6277
16
        }
6278
16
    };
6279
6280
16
    static ei_register_info ei[] = {
6281
16
        { &ei_dvbci_cor_addr,
6282
16
            { "dvb-ci.cor_address.invalid", PI_PROTOCOL, PI_WARN,
6283
16
                "COR address must not be greater than 0xFFE (DVB-CI spec, A.5.6)",
6284
16
                EXPFILL }},
6285
16
        { &ei_dvbci_buf_size,
6286
16
            { "dvb-ci.buf_size.invalid", PI_PROTOCOL, PI_WARN,
6287
16
                "Illegal buffer size command", EXPFILL }},
6288
16
        { &ei_dvbci_ml,
6289
16
            { "dvb-ci.more_last.invalid", PI_PROTOCOL, PI_WARN,
6290
16
                "Invalid More/Last indicator, second byte of an LPDU must be 0x80 or 0x00", EXPFILL }},
6291
16
        { &ei_dvbci_c_tpdu_tag,
6292
16
            { "dvb-ci.c_tpdu_tag.invalid", PI_MALFORMED, PI_ERROR,
6293
16
                "Invalid Command-TPDU tag, see DVB-CI specification, table A.16 for valid values", EXPFILL }},
6294
16
        { &ei_dvbci_r_tpdu_status_mandatory,
6295
16
            { "dvb-ci.r_tpdu_status.mandatory", PI_MALFORMED, PI_ERROR,
6296
16
                "Response TPDU's status part is missing, RTPDU status is mandatory", EXPFILL }},
6297
16
        { &ei_dvbci_r_tpdu_tag,
6298
16
            { "dvb-ci.r_tpdu_tag.invalid", PI_MALFORMED, PI_ERROR,
6299
16
                "Invalid Response-TPDU tag, see DVB-CI specification, table A.16 for valid values", EXPFILL }},
6300
16
        { &ei_dvbci_sb_value,
6301
16
            { "dvb-ci.sb_value.invalid", PI_PROTOCOL, PI_WARN,
6302
16
                "Invalid SB_value, must be 0x00 or 0x80", EXPFILL }},
6303
16
        { &ei_dvbci_t_c_id,
6304
16
            { "dvb-ci.t_c_id.invalid", PI_PROTOCOL, PI_WARN,
6305
16
                "Transport Connection ID mismatch the transport layer link layer", EXPFILL }},
6306
16
        { &ei_dvbci_tpdu_status_tag,
6307
16
            { "dvb-ci.tpdu.status_tag.invalid", PI_MALFORMED, PI_ERROR,
6308
16
                "Invalid status tag, this must always be T_SB (0x80)", EXPFILL }},
6309
16
        { &ei_dvbci_spdu_tag,
6310
16
            { "dvb-ci.spdu.invalid_tag", PI_MALFORMED, PI_ERROR,
6311
16
                "Invalid SPDU tag, See table 14 in the DVB-CI specification",
6312
16
                EXPFILL }},
6313
16
        { &ei_dvbci_spdu_cam_to_host,
6314
16
            { "dvb-ci.spdu.cam_to_host", PI_PROTOCOL, PI_WARN,
6315
16
                "Invalid SPDU direction, this SPDU must be sent from CAM to host",
6316
16
                EXPFILL }},
6317
16
        { &ei_dvbci_spdu_host_to_cam,
6318
16
            { "dvb-ci.spdu.host_to_cam", PI_PROTOCOL, PI_WARN,
6319
16
                "Invalid SPDU direction, this SPDU must be sent from host to CAM",
6320
16
                EXPFILL }},
6321
16
        { &ei_dvbci_apdu_tag,
6322
16
            { "dvb-ci.apdu.invalid_tag", PI_MALFORMED, PI_ERROR,
6323
16
                "Invalid or unsupported APDU tag", EXPFILL }},
6324
16
        { &ei_dvbci_apu_cam_to_host,
6325
16
            { "dvb-ci.apu.cam_to_host", PI_PROTOCOL, PI_WARN,
6326
16
                "Invalid APDU direction, this APDU must be sent from CAM to host",
6327
16
                EXPFILL }},
6328
16
        { &ei_dvbci_apu_host_to_cam,
6329
16
            { "dvb-ci.apu.host_to_cam", PI_PROTOCOL, PI_WARN,
6330
16
                "Invalid APDU direction, this APDU must be sent from host to CAM",
6331
16
                EXPFILL }},
6332
16
        { &ei_dvbci_apdu_not_supported,
6333
16
            { "dvb-ci.apdu.not_supported", PI_PROTOCOL, PI_WARN,
6334
16
                "Dissection of this APDU is not supported", EXPFILL }},
6335
16
        { &ei_dvbci_res_ver,
6336
16
            { "dvb-ci.apdu.res_ver_old", PI_PROTOCOL, PI_WARN,
6337
16
                "Invalid resource version for this apdu", EXPFILL }},
6338
16
        { &ei_dvbci_res_class,
6339
16
            { "dvb-ci.apdu.res_class_invalid", PI_PROTOCOL, PI_WARN,
6340
16
                "Invalid resource class for this apdu", EXPFILL }},
6341
16
        { &ei_dvbci_bad_length,
6342
16
            { "dvb-ci.apdu.bad_length", PI_MALFORMED, PI_ERROR,
6343
16
                "Invalid length field",
6344
16
                EXPFILL }},
6345
        /* this is used for both MMI and operator profile */
6346
16
        { &ei_dvbci_invalid_char_tbl,
6347
16
            { "dvb-ci.apdu.invalid_char_tbl", PI_MALFORMED, PI_ERROR,
6348
16
                "Invalid character table", EXPFILL }},
6349
16
        { &ei_dvbci_no_ca_desc_es,
6350
16
            { "dvb-ci.ca.no_ca_desc_es", PI_PROTOCOL, PI_CHAT,
6351
16
                "No CA descriptors for this elementary stream", EXPFILL }},
6352
16
        { &ei_dvbci_no_ca_desc_prog,
6353
16
            { "dvb-ci.ca.no_ca_desc_prog", PI_PROTOCOL, PI_CHAT,
6354
16
                "No CA descriptors at program level", EXPFILL }},
6355
16
        { &ei_dvbci_ca_pmt_cmd_id,
6356
16
            { "dvb-ci.ca.ca_pmt_cmd_id.ca_pmt", PI_MALFORMED, PI_ERROR,
6357
16
                "The ca_pmt shall only contain ca descriptors (tag 0x9)",
6358
16
                EXPFILL }},
6359
16
        { &ei_dvbci_time_offs_unknown,
6360
16
            { "dvb-ci.dt.local_offset_unknown", PI_PROTOCOL, PI_CHAT,
6361
16
                "Offset between UTC and local time is unknown", EXPFILL }},
6362
16
        { &ei_dvbci_not_text_more_or_text_last,
6363
16
            { "dvb-ci.mmi.not_text_more_or_text_last", PI_MALFORMED, PI_ERROR,
6364
16
                "Items must be text_more() or text_last() objects", EXPFILL }},
6365
16
        { &ei_dvbci_network_id,
6366
16
            { "dvb-ci.hc.nid.ignored", PI_PROTOCOL, PI_NOTE,
6367
16
                "Network ID is usually ignored by hosts", EXPFILL }},
6368
16
        { &ei_dvbci_cc_pin_nvr_chg,
6369
16
            { "dvb-ci.cc.pin_never_changed", PI_PROTOCOL, PI_CHAT,
6370
16
                "CICAM PIN has never been changed", EXPFILL }},
6371
16
        { &ei_dvbci_pin_evt_cent,
6372
16
            { "dvb-ci.cc.pin_event_time_centi.invalid", PI_PROTOCOL, PI_WARN,
6373
16
                "Invalid value for event time centiseconds, Value must be between 0 and 100",
6374
16
                EXPFILL }},
6375
16
        { &ei_dvbci_sac_payload_enc,
6376
16
            { "dvb-ci.cc.sac.payload_enc.clear", PI_PROTOCOL, PI_NOTE,
6377
16
                "The original PDU was encrypted, this exported PDU is in the clear",
6378
16
                EXPFILL }},
6379
16
        { &ei_dvbci_sig_qual,
6380
16
            { "dvb-ci.opp.sig_qual.invalid", PI_PROTOCOL, PI_WARN,
6381
16
                "Invalid value for signal strength / signal quality, values are in percent (0 to 100)",
6382
16
                EXPFILL }},
6383
16
        { &ei_dvbci_cicam_nit_table_id,
6384
16
            { "dvb-ci.opp.cicam_nit_table_id_invalid", PI_PROTOCOL, PI_WARN,
6385
16
                "CICAM NIT must have table id 0x40 (NIT actual)", EXPFILL }},
6386
16
        { &ei_dvbci_cup_progress,
6387
16
            { "dvb-ci.cup.progress_invalid", PI_PROTOCOL, PI_WARN,
6388
16
                "progress is in percent, value must be between 0 and 100",
6389
16
                EXPFILL }},
6390
16
    };
6391
6392
16
    spdu_table = g_hash_table_new(g_direct_hash, g_direct_equal);
6393
128
    for(i=0; i<array_length(spdu_info); i++) {
6394
112
        g_hash_table_insert(spdu_table,
6395
112
                            GUINT_TO_POINTER((unsigned)spdu_info[i].tag),
6396
112
                            (void *)(&spdu_info[i]));
6397
112
    }
6398
6399
16
    apdu_table = g_hash_table_new(g_direct_hash, g_direct_equal);
6400
1.48k
    for(i=0; i<array_length(apdu_info); i++) {
6401
1.47k
        g_hash_table_insert(apdu_table,
6402
1.47k
                            GUINT_TO_POINTER((unsigned)apdu_info[i].tag),
6403
1.47k
                            (void *)(&apdu_info[i]));
6404
1.47k
    }
6405
6406
16
    proto_dvbci = proto_register_protocol("DVB Common Interface", "DVB-CI", "dvb-ci");
6407
16
    proto_register_field_array(proto_dvbci, hf, array_length(hf));
6408
16
    proto_register_subtree_array(ett, array_length(ett));
6409
16
    expert_dvbci = expert_register_protocol(proto_dvbci);
6410
16
    expert_register_field_array(expert_dvbci, ei, array_length(ei));
6411
6412
16
    dvbci_module = prefs_register_protocol(proto_dvbci, proto_reg_handoff_dvbci);
6413
16
    prefs_register_string_preference(dvbci_module,
6414
16
            "sek", "SAC Encryption Key", "SAC Encryption Key (16 hex bytes)",
6415
16
            &dvbci_sek);
6416
16
    prefs_register_string_preference(dvbci_module,
6417
16
            "siv", "SAC Init Vector", "SAC Init Vector (16 hex bytes)",
6418
16
            &dvbci_siv);
6419
16
    prefs_register_bool_preference(dvbci_module,
6420
16
            "dissect_lsc_msg",
6421
16
            "Dissect LSC messages",
6422
16
            "Dissect the content of messages transmitted "
6423
16
                "on the Low-Speed Communication resource. "
6424
16
                "This requires a dissector for the protocol and target port "
6425
16
                "contained in the connection descriptor.",
6426
16
            &dvbci_dissect_lsc_msg);
6427
6428
16
    sas_msg_dissector_table = register_dissector_table("dvb-ci.sas.app_id_str",
6429
16
                "SAS application id", proto_dvbci, FT_STRING, STRING_CASE_SENSITIVE);
6430
6431
16
    register_init_routine(dvbci_init);
6432
16
    reassembly_table_register(&tpdu_reassembly_table,
6433
16
                          &addresses_reassembly_table_functions);
6434
16
    reassembly_table_register(&spdu_reassembly_table,
6435
16
                          &addresses_reassembly_table_functions);
6436
6437
6438
    /* the dissector for decrypted CI+ SAC messages which we can export */
6439
16
    register_dissector_with_description(EXPORTED_SAC_MSG_PROTO,
6440
16
        EXPORTED_SAC_MSG_DESCRIPTION,
6441
16
        dissect_dvbci_exported_sac_msg, proto_dvbci);
6442
6443
16
    exported_pdu_tap = register_export_pdu_tap("DVB-CI");
6444
6445
16
    register_shutdown_routine(dvbci_shutdown);
6446
6447
16
    dvbci_handle = register_dissector("dvb-ci", dissect_dvbci, proto_dvbci);
6448
16
}
6449
6450
6451
void
6452
proto_reg_handoff_dvbci(void)
6453
16
{
6454
16
    static bool initialized = false;
6455
6456
16
    if (!initialized) {
6457
16
        dissector_add_uint("wtap_encap", WTAP_ENCAP_DVBCI, dvbci_handle);
6458
6459
16
        data_handle = find_dissector("data");
6460
16
        mpeg_pmt_handle = find_dissector_add_dependency("mpeg_pmt", proto_dvbci);
6461
16
        dvb_nit_handle = find_dissector_add_dependency("dvb_nit", proto_dvbci);
6462
16
        mime_handle = find_dissector_add_dependency("mime_dlt", proto_dvbci);
6463
16
        tcp_dissector_table = find_dissector_table("tcp.port");
6464
16
        udp_dissector_table = find_dissector_table("udp.port");
6465
16
        initialized = true;
6466
16
    }
6467
6468
16
    g_free(dvbci_sek_bin);
6469
16
    g_free(dvbci_siv_bin);
6470
16
    pref_key_string_to_bin(dvbci_sek, &dvbci_sek_bin);
6471
16
    pref_key_string_to_bin(dvbci_siv, &dvbci_siv_bin);
6472
16
}
6473
6474
/*
6475
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
6476
 *
6477
 * Local variables:
6478
 * c-basic-offset: 4
6479
 * tab-width: 8
6480
 * indent-tabs-mode: nil
6481
 * End:
6482
 *
6483
 * vi: set shiftwidth=4 tabstop=8 expandtab:
6484
 * :indentSize=4:tabSize=8:noTabs=true:
6485
 */