smpp_codec/lib.rs
1//! # SMPP Codec
2//!
3//! `smpp-codec` is a Rust library for encoding and decoding SMPP 3.4 / 5.0 PDUs (Protocol Data Units).
4//! It provides a type-safe and efficient way to handle SMPP messages, suitable for building SMSCs (Short Message Service Centers)
5//! or ESMEs (External Short Message Entities).
6//!
7//! ## Features
8//!
9//! * Full support for SMPP 3.4 / 5.0 PDUs.
10//! * Strongly typed structures for all standard operations (Bind, SubmitSm, DeliverSm, etc.).
11//! * Support for TLVs (Tagged Length Values) / Optional Parameters.
12//! * Easy-to-use API for encoding and decoding.
13//!
14//! ## Performance Tips
15//!
16//! This library is designed to be compatible with any `std::io::Write` implementation.
17//! When encoding PDUs directly to a network stream, **always use buffering**.
18//!
19//! * **Recommended**: Encode to a `Vec<u8>` first, then write the vector to the stream.
20//! * **Alternative**: Wrap your `TcpStream` in a `std::io::BufWriter`.
21//!
22//! *Passing a raw `TcpStream` to `encode` will result in many small system calls, significantly reducing throughput.*
23//!
24//! See [docs/PERFORMANCE.md](docs/PERFORMANCE.md) for a detailed guide.
25//!
26//! ## Example
27//!
28//! ```rust
29//! use smpp_codec::pdus::BindRequest;
30//! use smpp_codec::common::BindMode;
31//!
32//! let mut bind_req = BindRequest::new(
33//! 1, // Sequence number
34//! BindMode::Transmitter,
35//! "my_system_id".to_string(),
36//! "password".to_string(),
37//! );
38//!
39//! // Encode to bytes
40//! let mut buffer = Vec::new();
41//! bind_req.encode(&mut buffer).unwrap();
42//! ```
43
44#![warn(missing_docs)]
45// Expose the common module (constants, errors, enums)
46/// Common constants, enums, and error types.
47pub mod common;
48/// Encoding and decoding utilities (GSM 7-bit, etc.).
49pub mod encoding;
50/// Tag-Length-Value (TLV) support.
51pub mod tlv;
52
53// Expose the PDUs module (the structs for specific operations)
54/// PDU definitions and submodules.
55pub mod pdus;
56/// Message splitting and concatenation utilities.
57pub mod splitter;
58
59#[cfg(test)]
60mod tests {
61 doc_comment::doctest!("../README.md");
62}