kaiser.cx

Welcome to the homepage of Martin Kaiser

PCAP format for DVB-CI

Introduction

This page defines a format to store captured DVB-CI (Common Interface) data in a pcap or a pcapng file. The wireshark dissector for DVB-CI uses this format as its input data.

Global Header

235 (DLT_DVB_CI) was assigned for DVB-CI.

For pcap files, this value shall be set in the global header’s network field. Pcapng defines an Interface Description Block, its LinkType must be set to this value.

Time stamps

Time stamps must be set as required by the pcap or pcapng specifications.

Not all DVB-CI capturing hardware may be capable of delivering time stamps. In this case, the software that writes the pcap files has to fill in reasonable values.

Packet Data

The packet data consists of a DVB-CI pseudo header plus the DVB-CI data.

pseudo header

data

pseudo-header

The pseudo-header has information about the type of the captured data.

struct dvbci_header {
    u_int8_t    version;
    u_int8_t    event;
    u_int16_t   len;
} __attribute__((__packed__));
  • version is set to 0 for now

  • event describes the captured event, the possible values are listed below

event name value description

DATA_CAM_TO_HOST

0xFF

data transfer from CI Module to Host

DATA_HOST_TO_CAM

0xFE

data transfer from Host to CI Module

CIS_READ

0xFD

Host reads the Card Information Structure (CIS)

COR_WRITE

0xFC

Host writes the configuration option register (COR)

HW_EVT

0xFB

hardware event

  • len is the length of the bytes following the pseudo header. It’s stored in network byte order (big endian).

data

The data following the dvbci_header depend on dvbci_header.event

DATA_HOST_TO_CAM or DATA_CAM_TO_HOST

if dvbci_header.len == 2

2 bytes buffer size

The buffer size protocol is defined in the DVB-CI specification, annex A.2.2.1.1. It is used for negotiating the maximum size of subsequent link layer messages (LPDUs). The CI module proposes a size, the host compares the proposal with its maximum supported size and sends back the highest value supported by both ends.

if dvbci_header.len >= 3

a DVB-CI LPDU as defined in the DVB-CI specification, figure A.3, page 62

1 bytes transport connection id

1 byte more/last

TPDU fragment

transport connection id is a value > 0. The more/last byte is 0x00 if the LPDU is the last fragment or 0x80 if more fragments follow. The remainder of the LPDU is filled with a fragment of a transport layer message (TPDU), this part shall not be empty.

(The size of an LPDU is defined during the data transfer by writing to a size register, therefore it contains no length field.)

CIS_READ

The Card Information Structure (CIS) of the CI module. The CIS is defined in volume 4 (metaformat) of the PC-Card specification. A CIS consists of tuples using the following format, the last tuple has tuple code 0xff and no length and body.

1 byte tuple code

1 byte length field

length field bytes tuple body

The CIS must start at the beginning of the data buffer. The data buffer must include the complete CIS. If a capture tool can’t determine the length of the CIS, the capture may include random data after the end of this CIS.

COR_WRITE

2 bytes COR address

1 byte COR value

The address of the Configuration Option Register (COR) is in network byte order. According to the DVB-CI specification annex A 5.6, 5, the COR address shall not be greater than 0xFFE. If a capture tool doesn’t log the COR address, it may set the address bytes to 0xFF 0xFF instead.

HW_EVT

8 bit for the event type according to the following table

event name value description

CAM_IN

0x01

CI Module is inserted into the slot

CAM_OUT

0x02

CI Module is removed from the slot

POWER_ON

0x03

CI Module is powered on

POWER_OFF

0x04

CI Module is powered off

TS_ROUTE

0x05

DVB Transport Stream is routed through the CI Module

TS_BYPASS

0x06

DVB Transport Stream bypasses the CI Module

RESET_H

0x07

Reset Pin goes into High state

RESET_L

0x08

Reset Pin goes into Low state

READY_H

0x09

Ready/IRQ# Pin goes into High state

READY_L

0x0A

Ready/IRQ# Pin goes into Low state

The events for the Reset and Ready/IRQ# pins reflect the actual voltage level on the line.

Examples

This is the Packet Data when the CI Module is removed from the slot

0x00 0xFB 0x00 0x01 0x02

The host sends data to the CI Module. The data part in this example contains an LPDU that is 5 bytes long.

0x00 0xFE 0x00 0x05 0x01 0x00 0xa0 0x01 0x01

Questions, comments

Please send any questions or comments to 'www(at)kaiser(dot)cx'