Skip to main content

dvb_ci_runtime/
lib.rs

1//! Pure-Rust EN 50221 DVB Common Interface **runtime** — the driver loop over
2//! the [`dvb_ci`] codecs.
3//!
4//! [`dvb_ci`] is `no_std` and owns the *wire* layer (TPDU / SPDU / APDU
5//! parse+serialize, CA_PMT building, CI Plus extensions). This crate adds the
6//! *runtime*: device I/O, the TPDU poll loop, SPDU session management, and the
7//! per-resource state machines that together drive a physical CAM, per
8//! ETSI EN 50221 and TS 101 699.
9//!
10//! # Design
11//!
12//! The whole runtime is written against the [`CaDevice`] trait (the
13//! hardware-abstraction boundary), so it runs against either:
14//! - a real Linux CA device (`/dev/dvb/adapterN/caM`, the `linux` feature), or
15//! - the in-memory [`MockCaDevice`], which makes the state machines testable
16//!   without hardware and enables differential testing against an external
17//!   reference (drive both with the same scripted mock CAM and assert the
18//!   emitted `write`/ioctl byte sequences match).
19//!
20//! Implemented from the EN 50221 specification.
21//!
22//! # Status
23//!
24//! Foundation: the [`CaDevice`] abstraction + mock. The TPDU/SPDU/resource state
25//! machines and the Linux device implementation land incrementally.
26
27// The portable core is unsafe-free; only the optional Linux device leaf
28// (`#[allow(unsafe_code)]` in `linux`) uses ioctls, so this is `deny`, not
29// `forbid`.
30#![deny(unsafe_code)]
31#![warn(missing_docs)]
32
33pub mod device;
34pub mod driver;
35pub mod event;
36pub mod resource;
37pub mod session;
38pub mod stack;
39pub mod transport;
40
41#[cfg(all(feature = "linux", target_os = "linux"))]
42pub mod linux;
43
44pub use device::{CaDevice, DeviceOp, MockCaDevice, SlotInfo};
45pub use driver::Driver;
46pub use event::{Action, Event, HostRequest, Notification};
47#[cfg(all(feature = "linux", target_os = "linux"))]
48pub use linux::LinuxCaDevice;
49pub use stack::CiStack;
50
51/// Re-export of the wire-codec crate this runtime drives.
52pub use dvb_ci;