pub struct Command {
pub status: CommandStatus,
pub sequence_number: u32,
/* private fields */
}
Expand description
SMPP
command.
The following PDU example illustrates how a SMPP
PDU is decoded:
Sample PDU (Values are shown in Hex format):
00 00 00 2F 00 00 00 02 00 00 00 00 00 00 00 01
53 4D 50 50 33 54 45 53 54 00 73 65 63 72 65 74
30 38 00 53 55 42 4D 49 54 31 00 50 01 01 00
The 16-octet header would be decoded as follows:
Octets | Description |
---|---|
00 00 00 2F | Command Length (47) |
00 00 00 02 | Command ID (bind_transmitter) |
00 00 00 00 | Command Status (0) |
00 00 00 01 | Sequence Number (1) |
The remaining data represents the PDU body (which in this example relates to the bind_transmitter PDU). This is diagnosed as follows:
Octets | Value |
---|---|
53 4D 50 50 33 54 45 53 54 00 | system_id (“SMPP3TEST”) |
73 65 63 72 65 74 30 38 00 | password (“secret08”) |
53 55 42 4D 49 54 31 00 | system_type (“SUBMIT1”) |
50 | interface_version (0x50 “V5.0 compliant”) |
01 | addr_ton (0x01) |
01 | addr_npi (0x01) |
00 | addr_range (NULL) |
Fields§
§status: CommandStatus
See CommandStatus
sequence_number: u32
The sequence_number represents a means of uniquely
identifying each PDU within a SMPP
session. It also provides a means of correlating request
and response PDUs based on matching sequence number.
Implementations§
Source§impl Command
impl Command
pub fn into_parts(self) -> CommandParts
Source§impl Command
impl Command
pub fn new( status: CommandStatus, sequence_number: u32, pdu: impl Into<Pdu>, ) -> Self
pub const fn new_const( status: CommandStatus, sequence_number: u32, pdu: Pdu, ) -> Self
pub const fn id(&self) -> CommandId
pub const fn status(&self) -> CommandStatus
pub const fn sequence_number(&self) -> u32
pub const fn pdu(&self) -> Option<&Pdu>
pub fn set_pdu(&mut self, pdu: impl Into<Pdu>)
pub fn builder() -> CommandStatusBuilder
Sourcepub fn from_parts(parts: CommandParts) -> Self
pub fn from_parts(parts: CommandParts) -> Self
Trait Implementations§
Source§impl<'arbitrary> Arbitrary<'arbitrary> for Command
impl<'arbitrary> Arbitrary<'arbitrary> for Command
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
Generate an arbitrary value of
Self
from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
Generate an arbitrary value of
Self
from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Get a size hint for how many bytes out of an
Unstructured
this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Get a size hint for how many bytes out of an
Unstructured
this type
needs to construct itself. Read moreSource§impl DecodeWithLength for Command
impl DecodeWithLength for Command
Source§impl<'de> Deserialize<'de> for Command
impl<'de> Deserialize<'de> for Command
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Encoder<&Command> for CommandCodec
Available on crate feature tokio-codec
only.
impl Encoder<&Command> for CommandCodec
Available on crate feature
tokio-codec
only.Source§impl Encoder<Command> for CommandCodec
Available on crate feature tokio-codec
only.
impl Encoder<Command> for CommandCodec
Available on crate feature
tokio-codec
only.Source§impl Ord for Command
impl Ord for Command
Source§impl PartialOrd for Command
impl PartialOrd for Command
impl Eq for Command
impl StructuralPartialEq for Command
Auto Trait Implementations§
impl Freeze for Command
impl RefUnwindSafe for Command
impl Send for Command
impl Sync for Command
impl Unpin for Command
impl UnwindSafe for Command
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more