Skip to main content

Crate smpp_codec

Crate smpp_codec 

Source
Expand description

§SMPP Codec

smpp-codec is a Rust library for encoding and decoding SMPP 3.4 PDUs (Protocol Data Units). It provides a type-safe and efficient way to handle SMPP messages, suitable for building SMSCs (Short Message Service Centers) or ESMEs (External Short Message Entities).

§Features

  • Full support for SMPP 3.4 PDUs.
  • Strongly typed structures for all standard operations (Bind, SubmitSm, DeliverSm, etc.).
  • Support for TLVs (Tagged Length Values) / Optional Parameters.
  • Easy-to-use API for encoding and decoding.

§Performance Tips

this library is designed to be compatible with any std::io::Write implementation. When encoding PDUs directly to a network stream, always use buffering.

  • Recommended: Encode to a Vec<u8> first, then write the vector to the stream.
  • Alternative: Wrap your TcpStream in a std::io::BufWriter.

Passing a raw TcpStream to encode will result in many small system calls, significantly reducing throughput.

See docs/PERFORMANCE.md for a detailed guide.

§Example

use smpp_codec::pdus::BindRequest;
use smpp_codec::common::BindMode;

let mut bind_req = BindRequest::new(
    1, // Sequence number
    BindMode::Transmitter,
    "my_system_id".to_string(),
    "password".to_string(),
);

// Encode to bytes
let mut buffer = Vec::new();
bind_req.encode(&mut buffer).unwrap();

Modules§

common
Common Definitions
encoding
pdus
splitter
tlv
Tagged Length Value (TLV) Parameters