1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
use std::time::Duration;
/// Error of the public API (`Simulcrypt`/`Service`).
#[derive(Debug, thiserror::Error)]
pub enum Error {
/// The requested `(CasRef, ecm_pid)` pair overlaps two different live CW groups at once - an
/// unresolvable conflict.
#[error(
"ecm_pid={ecm_pid} on this CAS is already bound to stream_id={stream_id} from a different CW group"
)]
CwGroupConflict {
/// `ecm_pid` that caused the conflict.
ecm_pid: u16,
/// `stream_id` already bound to another group.
stream_id: u16,
},
/// `open_service` joins a live group, but its `crypto_period` differs from the requested one.
#[error(
"crypto_period mismatch: the running CW group already uses {expected:?}, this call requested {actual:?}"
)]
CryptoPeriodMismatch {
/// `crypto_period` the group already runs with.
expected: Duration,
/// `crypto_period` requested by this call.
actual: Duration,
},
/// `CasRef` is not registered in this `Simulcrypt` (e.g. obtained from another instance).
#[error("unknown CasRef")]
UnknownCas,
/// `ServiceConfig::cas` is empty - the service has nothing to work with.
#[error("ServiceConfig.cas must not be empty")]
EmptyService,
/// `crypto_period` does not fit into the 16-bit `nominal_cp_duration` protocol field.
#[error(
"crypto_period {crypto_period:?} does not fit into the wire's hundred-millisecond nominal_cp_duration field"
)]
InvalidCryptoPeriod {
/// The requested crypto period.
crypto_period: Duration,
},
/// Failed to bind the EMMG listening socket.
#[error("failed to bind EMMG listener: {0}")]
EmmgBind(#[source] std::io::Error),
/// Another CAS on the same EMMG port already uses this `channel_id`.
#[error("EMMG channel_id={channel_id} is already used by another CAS on this port")]
EmmgChannelInUse {
/// The clashing `channel_id`.
channel_id: u16,
},
}