sbd/lib.rs
1//! Parse and write Iridium Short Burst Data (SBD) messages.
2//!
3//! # Background
4//!
5//! Iridium is both a
6//! [satellite constellation](https://en.wikipedia.org/wiki/Iridium_satellite_constellation)
7//! and a [company](https://en.wikipedia.org/wiki/Iridium_Communications) that provides satellite
8//! communications. The Iridium network is used by phones, modems, and other communication devices.
9//!
10//! One mode of transmitting data over the Iridium network is via Short Burst Data (SBD) messages.
11//! These messages carry a payload of some small number of bytes, usually less than one thousand.
12//! Messages can be Mobile-Originated (MO), meaning that they are sent *from* an Iridium modem, or
13//! Mobile-Terminated (MT), meaning that the are sent *to* an Iridium modem. Mobile-Originated
14//! messages are delivered either to an email address via MIME attachment, or directly to a given
15//! IP address and port via TCP; this second method is called `DirectIP`.
16//!
17//! # Usage
18//!
19//! This is a simple library for reading mobile originated SBD messages from a stream, decoding
20//! their headers and data payloads, and writing them back to a stream. This library does not
21//! handle mobile terminated messages.
22//!
23//! MO messages can be read from a byte stream:
24//!
25//! ```
26//! let mut file = std::fs::File::open("data/0-mo.sbd").unwrap();
27//! let message = sbd::mo::Message::read_from(file).unwrap();
28//! ```
29//!
30//! To receive MO messages via `DirectIP`, a server is provided.
31//! This server will listen for incoming messages forever, storing them in a `Storage`:
32//!
33//! ```no_run
34//! let storage = sbd::storage::FilesystemStorage::open("/var/iridium").unwrap();
35//! let mut server = sbd::directip::Server::new("0.0.0.0:10800", storage);
36//! server.serve_forever();
37//! ```
38//!
39//! Most of the functionality of this library is exposed by a single executable, named `sbd`. Use
40//! the `sbd` executable to inspect raw sbd files stores on a filesystem, interrogate sbd files on a
41//! filesystem, and start that forever-running server to receive Iridium SBD `DirectIP` messages.
42
43#![deny(
44 missing_copy_implementations,
45 missing_debug_implementations,
46 missing_docs,
47 trivial_casts,
48 trivial_numeric_casts,
49 unsafe_code,
50 unstable_features,
51 unused_extern_crates,
52 unused_import_braces,
53 unused_qualifications
54)]
55#![recursion_limit = "128"]
56
57pub mod directip;
58mod error;
59pub mod mo;
60pub mod storage;
61
62pub use error::Error;