pub struct Client { /* private fields */ }Expand description
SMPP Client.
The client is a handle to communicate with the SMPP server through a managed connection in the background.
Implementations§
Source§impl Client
impl Client
Sourcepub fn builder() -> ConnectionBuilder
pub fn builder() -> ConnectionBuilder
Creates a new SMPP connection builder.
See ConnectionBuilder::new for more details.
Sourcepub async fn bind_transmitter(
&self,
bind: impl Into<BindTransmitter>,
) -> Result<BindTransmitterResp, Error>
pub async fn bind_transmitter( &self, bind: impl Into<BindTransmitter>, ) -> Result<BindTransmitterResp, Error>
Sends a BindTransmitter command to the server and waits for a successful BindTransmitterResp.
Sourcepub async fn bind_receiver(
&self,
bind: impl Into<BindReceiver>,
) -> Result<BindReceiverResp, Error>
pub async fn bind_receiver( &self, bind: impl Into<BindReceiver>, ) -> Result<BindReceiverResp, Error>
Sends a BindReceiver command to the server and waits for a successful BindReceiverResp.
Sourcepub async fn bind_transceiver(
&self,
bind: impl Into<BindTransceiver>,
) -> Result<BindTransceiverResp, Error>
pub async fn bind_transceiver( &self, bind: impl Into<BindTransceiver>, ) -> Result<BindTransceiverResp, Error>
Sends a BindTransceiver command to the server and waits for a successful BindTransceiverResp.
Sourcepub async fn submit_sm(
&self,
submit_sm: impl Into<SubmitSm>,
) -> Result<SubmitSmResp, Error>
pub async fn submit_sm( &self, submit_sm: impl Into<SubmitSm>, ) -> Result<SubmitSmResp, Error>
Sends a SubmitSm command to the server and waits for a successful SubmitSmResp.
Sourcepub async fn deliver_sm_resp(
&self,
sequence_number: u32,
deliver_sm_resp: impl Into<DeliverSmResp>,
) -> Result<(), Error>
pub async fn deliver_sm_resp( &self, sequence_number: u32, deliver_sm_resp: impl Into<DeliverSmResp>, ) -> Result<(), Error>
Sends a DeliverSmResp command to the server.
Sourcepub async fn unbind(&self) -> Result<(), Error>
pub async fn unbind(&self) -> Result<(), Error>
Sends an Unbind command to the server and waits for a successful UnbindResp.
Sourcepub async fn unbind_resp(&self, sequence_number: u32) -> Result<(), Error>
pub async fn unbind_resp(&self, sequence_number: u32) -> Result<(), Error>
Sends an UnbindResp command to the server.
Sourcepub async fn enquire_link(&self) -> Result<(), Error>
pub async fn enquire_link(&self) -> Result<(), Error>
Sends an EnquireLink command to the server and waits for a successful EnquireLinkResp.
Sourcepub async fn enquire_link_resp(&self, sequence_number: u32) -> Result<(), Error>
pub async fn enquire_link_resp(&self, sequence_number: u32) -> Result<(), Error>
Sends an EnquireLinkResp command to the server.
Sourcepub async fn generic_nack(&self, sequence_number: u32) -> Result<(), Error>
pub async fn generic_nack(&self, sequence_number: u32) -> Result<(), Error>
Sends a GenericNack command to the server.
Sourcepub async fn close(&self) -> Result<(), Error>
pub async fn close(&self) -> Result<(), Error>
Closes the connection.
This method completes, when the connection has registered the close request. The connection will stop reading from the server, stop time keeping, close the requests channel, flush pending requests and terminate.
After calling this method, clients can no longer send requests to the server.
Sourcepub fn is_closed(&self) -> bool
pub fn is_closed(&self) -> bool
Checks if the connection is closed.
§Note
If the connection is not closed, this does not mean that it is active. The connection may be in the process of closing.
To check if the connection is active, use Client::is_active().
Sourcepub async fn close_and_wait(&self) -> Result<(), Error>
pub async fn close_and_wait(&self) -> Result<(), Error>
Closes the connection and waits for it to terminate.
Sourcepub fn is_active(&self) -> bool
pub fn is_active(&self) -> bool
Checks if the connection is active.
The connection is considered active if:
Client::close()was never called.- The connection did not encounter an error.
- The connection can receive requests form the client.
§Note
If the connection is not active, this does not mean that it is closed. The connection may be in the process of closing.
To check if the connection is closed, use Client::is_closed().
Sourcepub async fn pending_responses(&self) -> Result<Vec<u32>, Error>
pub async fn pending_responses(&self) -> Result<Vec<u32>, Error>
Returns a vector of pending responses.
Sourcepub const fn status(
&self,
status: CommandStatus,
) -> UnregisteredRequestBuilder<'_>
pub const fn status( &self, status: CommandStatus, ) -> UnregisteredRequestBuilder<'_>
Sets the command status for the next request.
Sourcepub fn response_timeout(
&self,
timeout: Duration,
) -> RegisteredRequestBuilder<'_>
pub fn response_timeout( &self, timeout: Duration, ) -> RegisteredRequestBuilder<'_>
Sets the response timeout for the next request.
Sourcepub fn no_response_timeout(&self) -> RegisteredRequestBuilder<'_>
pub fn no_response_timeout(&self) -> RegisteredRequestBuilder<'_>
Disables the response timeout for the next request.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnwindSafe for Client
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)