telco_interop/lib.rs
1//! # telco-interop — the German carrier interfaces in one dependency
2//!
3//! A provider switch in Germany crosses two interfaces: the gaining and the losing provider
4//! agree it over **WBCI** (§ 59 TKG), then the gaining provider orders the line from the
5//! network owner over **S/PRI** with a `PV` order that carries the WBCI Vorabstimmungs-ID.
6//! This crate gives you both under one name and one version:
7//!
8//! | Module | Interface | Feature (default on) |
9//! |---|---|---|
10//! | [`wbci`] | WBCI 2.0 — provider ↔ provider | `wbci` |
11//! | [`spri`] | S/PRI 4.x — service provider ↔ network owner | `spri` |
12//!
13//! The identifiers both interfaces carry are one type each, so a value from one goes into the
14//! other as it is:
15//!
16//! ```
17//! use telco_interop::{VorabstimmungsId, spri, wbci};
18//!
19//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
20//! // Agreed over WBCI …
21//! let id: wbci::VorabstimmungsId = "DEU.EKP1.V000000013".parse()?;
22//! // … and the very same type in an S/PRI provider-switch order.
23//! let in_spri: spri::VorabstimmungsId = id.clone();
24//! let shared: VorabstimmungsId = in_spri;
25//! assert_eq!(shared.as_str(), "DEU.EKP1.V000000013");
26//! # Ok(())
27//! # }
28//! ```
29//!
30//! ## One switch across both: [`Wechsel`]
31//!
32//! [`Wechsel`] (both features) holds the WBCI [`wbci::Process`] of one pre-agreement and every
33//! S/PRI order carrying its Vorabstimmungs-ID, and recomputes from them on every call: one
34//! [`timeline`](Wechsel::timeline) of both interfaces, their [`deadlines`](Wechsel::deadlines),
35//! the [`next_actions`](Wechsel::next_actions) of each [`Partei`], and six
36//! [`befunde`](Wechsel::befunde) rules that the interfaces agree (agreed before ordered, the line
37//! the AKM-TR takes over, the dates, postponement in WBCI first, a WBCI cancellation reaching
38//! S/PRI, completion within a working day of the switch date). See the [`wechsel`] module.
39//!
40//! ## A sandbox: [`sim`]
41//!
42//! [`sim`] (both features) is a catalogue of named scenarios that play a whole switch or order
43//! from both sides against simulated peers ([`wbci::sim`], [`spri::sim`]): every request, order,
44//! message and receipt with its time, each valid and inside its deadline — to test your own
45//! side without a partner. `telco-interop simulate` writes them as files.
46//!
47//! ## The command line's output as a library: [`report`]
48//!
49//! [`report`] (feature `report`, not on by default) turns payload bytes into the lines
50//! `telco-interop read`, `check` and `code` print — value-free, control characters replaced —
51//! for another front end; the site's in-browser playground uses it.
52//!
53//! Need only one interface? Depend on [`wbci`](https://docs.rs/wbci) or
54//! [`spri`](https://docs.rs/spri) directly, or turn the other feature off:
55//! `telco-interop = { version = "0.1", default-features = false, features = ["spri"] }`.
56//!
57//! Guides: <https://hupe1980.github.io/telco-interop/>.
58//!
59//! Unofficial; not affiliated with or endorsed by the AK S&P, VATM, BUGLAS or Deutsche Telekom.
60#![cfg_attr(docsrs, feature(doc_cfg))]
61
62#[doc(inline)]
63pub use carrier_core::{Calendar, CarrierCode, LineId, VorabstimmungsId};
64
65/// WBCI 2.0: the § 59 TKG provider switch between providers.
66#[cfg(feature = "wbci")]
67#[cfg_attr(docsrs, doc(cfg(feature = "wbci")))]
68pub use wbci;
69
70/// S/PRI 4.x: open-access orders between service provider and network owner.
71#[cfg(feature = "spri")]
72#[cfg_attr(docsrs, doc(cfg(feature = "spri")))]
73pub use spri;
74
75#[cfg(all(feature = "wbci", feature = "spri"))]
76#[cfg_attr(docsrs, doc(cfg(all(feature = "wbci", feature = "spri"))))]
77pub mod wechsel;
78
79#[cfg(feature = "report")]
80#[cfg_attr(docsrs, doc(cfg(feature = "report")))]
81pub mod report;
82
83#[cfg(all(feature = "wbci", feature = "spri"))]
84#[cfg_attr(docsrs, doc(cfg(all(feature = "wbci", feature = "spri"))))]
85pub mod sim;
86
87#[cfg(all(feature = "wbci", feature = "spri"))]
88#[cfg_attr(docsrs, doc(cfg(all(feature = "wbci", feature = "spri"))))]
89#[doc(inline)]
90pub use wechsel::{Aktion, Befund, Eintrag, Frist, FristDetail, Mismatch, Partei, Richtung, Schnittstelle, Wechsel};
91
92/// The README and the site's cross-interface page, compiled and run as a doctest so it cannot drift.
93#[cfg(all(doctest, feature = "wbci", feature = "spri"))]
94mod site_guides {
95 // The README's samples include `report`.
96 #[cfg(feature = "report")]
97 #[doc = include_str!("../README.md")]
98 struct Readme;
99 #[doc = include_str!("../../../site/content/docs/across-both/one-switch.md")]
100 struct Wechsel;
101 #[doc = include_str!("../../../site/content/docs/across-both/sandbox.md")]
102 struct Sandbox;
103}