Skip to main content

Crate simulcrypt

Crate simulcrypt 

Source
Expand description

DVB SimulCrypt (ETSI TS 103 197) - the protocol between a scrambler and conditional access systems (CAS). The crate runs the ECMG client, the EMMG server, control word generation, the ECM carousel and EMM packetization; scrambling and PSI/SI stay with the application.

The main API is Simulcrypt: CAS registration (acquire_cas), opening services (open_service) and one Cw/Ecm/Ts/Emm/State event stream per service. The messages codec with the protocol constants in messages::ecmg and messages::emmg is public for building test peers.

Modules§

messages
SimulCrypt message codec: header, TLV variables, parsing and serialization.

Structs§

CasConfig
One CAS description: the ECMG client and an optional EMMG server.
CasError
Last ECMG error of a CAS channel (see CasStatus::last_error).
CasLease
A CAS registered with Simulcrypt::acquire_cas. The CAS is removed when the last lease of it drops: its ECMG and EMMG channels close and its streams are detached from open services, which keep running on their other CAS. Drop the services that use the CAS first. The EMMG listener closes with the last CAS on its port.
CasParams
Parameters negotiated in CHANNEL_STATUS. format and rep_period affect the crate’s behavior, the other fields are informational.
CasRef
Cheap copyable reference to a CAS channel; survives reconnects.
CasStatus
State of one CAS channel for diagnostics and monitoring (Simulcrypt::status).
EcmgConfig
ECMG server connection settings.
EmmgConfig
EMMG server settings of one CAS channel.
EmmgPortStatus
EMMG listener of one port (see Simulcrypt::emmg_status).
Service
Service handle. Several Services may share one CW group fully or partially (see open_service); each (CasRef, stream_id) is released when the last Service referencing it lets go, and the whole group when no members are left. If afterwards a CasRef has no streams at all, its ECMG driver is stopped - the CasRef stays valid and comes back on the next open_service with it.
ServiceCas
One CAS channel of a service.
ServiceConfig
Scrambled service: one CW group shared by any number of CAS.
Simulcrypt
Process registry: CAS channels and open services. Cheap to clone (an Arc inside), can be passed freely to several tasks.
StreamInfo
Stream assigned by the crate: the CAS, the caller’s ecm_pid and the actual protocol stream_id.
StreamStatus
One stream of a CAS channel (see CasStatus::streams). Counters run since the stream was opened.

Enums§

CasState
State of the ECMG connection of one CAS channel.
DatagramFormat
ECM/EMM datagram format. The crate reports it together with the data, so the application does not have to track section_TSpkt_flag itself.
Error
Error of the public API (Simulcrypt/Service).
Event
One ordered event queue per service. Clone is needed to deliver the same event to several Services sharing one CW group.
Parity
Crypto period parity: selects which physical CSA slot to update.