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
//! Utility library for creating integrations against the Data Diode
//! Middleware.
//!
//! ```compile_fail
//! use tokio_ddmw::ClntIfCodec;
//!
//! async fn conn_handler(
//!   socket: TcpStream
//! ) -> Result<(), Error> {
//!   let mut conn = Framed::new(socket, ClntIfCodec::new());
//!   while let Some(o) = conn.next().await {
//!     let o = o?;
//!     match o {
//!       Input::Telegram(tg) => {
//!         match tg.get_topic() {
//!           Some(t) if t == "Ok" => {
//!             if let Some(name) = tg.get_param("Id") {
//!               // ...
//!             }
//!             Some(t) if t == "Fail" => {
//!               // ...
//!             }
//!           }
//!           _ => {
//!             // ...
//!           }
//!         }
//!         Input::Bin(d, remain) => {
//!           // ...
//!         }
//!       }
//!     }
//!   }
//! }
//! ```

#[path="clntif-codec.rs"]
pub mod clntif_codec;

#[path="clntif-util.rs"]
pub mod clntif_util;

pub mod err;

pub mod clntif {
  pub use super::clntif_codec::Codec as Codec;
  pub use super::clntif_codec::Input as Input;
  pub use super::clntif_util::expect_okfail as expect_okfail;
}

pub use err::Error;

// vim: set ft=rust et sw=2 ts=2 sts=2 cinoptions=2 tw=79 :