pub struct OutbindRequest {
pub sequence_number: u32,
pub system_id: String,
pub password: String,
}Expand description
Represents an Outbind PDU.
Sent by the SMSC to the ESME to request the ESME to initiate a Bind.
Fields§
§sequence_number: u32§system_id: String§password: StringImplementations§
Source§impl OutbindRequest
impl OutbindRequest
Sourcepub fn new(sequence_number: u32, system_id: String, password: String) -> Self
pub fn new(sequence_number: u32, system_id: String, password: String) -> Self
Create a new Outbind Request.
§Examples
use smpp_codec::pdus::OutbindRequest;
let sequence_number: u32 = 1;
let outbind = OutbindRequest::new(
sequence_number, // Sequence number
"my_system_id".to_string(),
"password".to_string(),
);Examples found in repository?
examples/outbind.rs (lines 8-12)
3fn main() {
4 println!("=== SMPP Outbind Example ===");
5
6 // 1. Create Outbind Request
7 // Outbind is sent by the MC to the ESME to request the ESME to bind.
8 let outbind = OutbindRequest::new(
9 100, // Sequence Number
10 "system_id".to_string(),
11 "password".to_string(),
12 );
13
14 println!("Outbind Request: {:?}", outbind);
15
16 // 2. Encode
17 let mut buffer = Vec::new();
18 outbind.encode(&mut buffer).unwrap();
19 println!("Encoded {} bytes", buffer.len());
20}Sourcepub fn encode(&self, writer: &mut impl Write) -> Result<(), PduError>
pub fn encode(&self, writer: &mut impl Write) -> Result<(), PduError>
Encode the struct into raw bytes for the network.
§Errors
Returns a PduError if:
system_idexceeds 16 characters.passwordexceeds 9 characters.- An I/O error occurs while writing.
§Examples
let mut buffer = Vec::new();
outbind.encode(&mut buffer).expect("Encoding failed");Examples found in repository?
examples/outbind.rs (line 18)
3fn main() {
4 println!("=== SMPP Outbind Example ===");
5
6 // 1. Create Outbind Request
7 // Outbind is sent by the MC to the ESME to request the ESME to bind.
8 let outbind = OutbindRequest::new(
9 100, // Sequence Number
10 "system_id".to_string(),
11 "password".to_string(),
12 );
13
14 println!("Outbind Request: {:?}", outbind);
15
16 // 2. Encode
17 let mut buffer = Vec::new();
18 outbind.encode(&mut buffer).unwrap();
19 println!("Encoded {} bytes", buffer.len());
20}Trait Implementations§
Source§impl Clone for OutbindRequest
impl Clone for OutbindRequest
Source§fn clone(&self) -> OutbindRequest
fn clone(&self) -> OutbindRequest
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for OutbindRequest
impl RefUnwindSafe for OutbindRequest
impl Send for OutbindRequest
impl Sync for OutbindRequest
impl Unpin for OutbindRequest
impl UnwindSafe for OutbindRequest
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