Trait vsmtp_protocol::ReceiverHandler
pub trait ReceiverHandler {
Show 23 methods
// Required methods
fn get_stage(&self) -> Stage;
fn generate_sasl_callback(&self) -> CallbackWrap;
fn on_accept<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut ReceiverContext,
args: AcceptArgs
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn on_starttls<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut ReceiverContext
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn on_post_tls_handshake<'life0, 'async_trait>(
&'life0 mut self,
sni: Option<String>,
protocol_version: ProtocolVersion,
cipher_suite: CipherSuite,
peer_certificates: Option<Vec<Certificate>>,
alpn_protocol: Option<Vec<u8>>
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn on_auth<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut ReceiverContext,
args: AuthArgs
) -> Pin<Box<dyn Future<Output = Option<Reply>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn on_post_auth<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut ReceiverContext,
result: Result<(), AuthError>
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn on_helo<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut ReceiverContext,
args: HeloArgs
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn on_ehlo<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut ReceiverContext,
args: EhloArgs
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn on_mail_from<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut ReceiverContext,
args: MailFromArgs
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn on_rcpt_to<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut ReceiverContext,
args: RcptToArgs
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn on_message<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut ReceiverContext,
stream: impl 'async_trait + Stream<Item = Result<Vec<u8>, Error>> + Send + Unpin
) -> Pin<Box<dyn Future<Output = (Reply, Option<Vec<(ContextFinished, MessageBody)>>)> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn on_message_completed<'life0, 'async_trait>(
&'life0 mut self,
ctx: ContextFinished,
msg: MessageBody
) -> Pin<Box<dyn Future<Output = Option<Reply>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn on_hard_error<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut ReceiverContext,
reply: Reply
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn on_soft_error<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut ReceiverContext,
reply: Reply
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn on_rset<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn on_data<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait { ... }
fn on_quit<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait { ... }
fn on_noop<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait { ... }
fn on_help<'life0, 'async_trait>(
&'life0 mut self,
__arg1: UnparsedArgs
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait { ... }
fn on_unknown<'life0, 'async_trait>(
&'life0 mut self,
buffer: Vec<u8>
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait { ... }
fn on_bad_sequence<'life0, 'async_trait>(
&'life0 mut self,
__arg1: (Verb, Stage)
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait { ... }
fn on_args_error<'life0, 'async_trait>(
&'life0 mut self,
__arg1: ParseArgsError
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Trait to implement to handle the SMTP commands in pair with the Receiver.
Required Methods§
fn get_stage(&self) -> Stage
fn get_stage(&self) -> Stage
The Receiver does not store the context.
This function is called after each command to get the context stage.
fn generate_sasl_callback(&self) -> CallbackWrap
fn generate_sasl_callback(&self) -> CallbackWrap
Create an instance capable to handle the SASL handshake.
fn on_accept<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut ReceiverContext,
args: AcceptArgs
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_accept<'life0, 'life1, 'async_trait>( &'life0 mut self, ctx: &'life1 mut ReceiverContext, args: AcceptArgs ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Called when the client connects to the server.
fn on_starttls<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut ReceiverContext
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_starttls<'life0, 'life1, 'async_trait>( &'life0 mut self, ctx: &'life1 mut ReceiverContext ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Called after receiving a Verb::StartTls command.
fn on_post_tls_handshake<'life0, 'async_trait>(
&'life0 mut self,
sni: Option<String>,
protocol_version: ProtocolVersion,
cipher_suite: CipherSuite,
peer_certificates: Option<Vec<Certificate>>,
alpn_protocol: Option<Vec<u8>>
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_post_tls_handshake<'life0, 'async_trait>( &'life0 mut self, sni: Option<String>, protocol_version: ProtocolVersion, cipher_suite: CipherSuite, peer_certificates: Option<Vec<Certificate>>, alpn_protocol: Option<Vec<u8>> ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Called after a successful TLS handshake.
fn on_auth<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut ReceiverContext,
args: AuthArgs
) -> Pin<Box<dyn Future<Output = Option<Reply>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_auth<'life0, 'life1, 'async_trait>( &'life0 mut self, ctx: &'life1 mut ReceiverContext, args: AuthArgs ) -> Pin<Box<dyn Future<Output = Option<Reply>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Called after receiving a Verb::Auth command.
fn on_post_auth<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut ReceiverContext,
result: Result<(), AuthError>
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_post_auth<'life0, 'life1, 'async_trait>( &'life0 mut self, ctx: &'life1 mut ReceiverContext, result: Result<(), AuthError> ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Called after a successful SASL handshake.
fn on_helo<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut ReceiverContext,
args: HeloArgs
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_helo<'life0, 'life1, 'async_trait>( &'life0 mut self, ctx: &'life1 mut ReceiverContext, args: HeloArgs ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Called after receiving a Verb::Helo command.
fn on_ehlo<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut ReceiverContext,
args: EhloArgs
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_ehlo<'life0, 'life1, 'async_trait>( &'life0 mut self, ctx: &'life1 mut ReceiverContext, args: EhloArgs ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Called after receiving a Verb::Ehlo command.
fn on_mail_from<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut ReceiverContext,
args: MailFromArgs
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_mail_from<'life0, 'life1, 'async_trait>( &'life0 mut self, ctx: &'life1 mut ReceiverContext, args: MailFromArgs ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Called after receiving a Verb::MailFrom command.
fn on_rcpt_to<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut ReceiverContext,
args: RcptToArgs
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_rcpt_to<'life0, 'life1, 'async_trait>( &'life0 mut self, ctx: &'life1 mut ReceiverContext, args: RcptToArgs ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Called after receiving a Verb::RcptTo command.
fn on_message<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut ReceiverContext,
stream: impl 'async_trait + Stream<Item = Result<Vec<u8>, Error>> + Send + Unpin
) -> Pin<Box<dyn Future<Output = (Reply, Option<Vec<(ContextFinished, MessageBody)>>)> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_message<'life0, 'life1, 'async_trait>( &'life0 mut self, ctx: &'life1 mut ReceiverContext, stream: impl 'async_trait + Stream<Item = Result<Vec<u8>, Error>> + Send + Unpin ) -> Pin<Box<dyn Future<Output = (Reply, Option<Vec<(ContextFinished, MessageBody)>>)> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Called after receiving a Verb::Data command.
The stream is the body of the message, with dot-stuffing handled.
The stream return None when the message is finished (.<CRLF>).
fn on_message_completed<'life0, 'async_trait>(
&'life0 mut self,
ctx: ContextFinished,
msg: MessageBody
) -> Pin<Box<dyn Future<Output = Option<Reply>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_message_completed<'life0, 'async_trait>( &'life0 mut self, ctx: ContextFinished, msg: MessageBody ) -> Pin<Box<dyn Future<Output = Option<Reply>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Called for each message produced by the ReceiverHandler::on_message() method.
If this callback returns Some, the reply produced by ReceiverHandler::on_message() is discarded.
fn on_hard_error<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut ReceiverContext,
reply: Reply
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_hard_error<'life0, 'life1, 'async_trait>( &'life0 mut self, ctx: &'life1 mut ReceiverContext, reply: Reply ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Called when the number of reply considered as error reached a threshold (hard).
fn on_soft_error<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut ReceiverContext,
reply: Reply
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_soft_error<'life0, 'life1, 'async_trait>( &'life0 mut self, ctx: &'life1 mut ReceiverContext, reply: Reply ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Called when the number of reply considered as error reached a threshold (soft).
Provided Methods§
fn on_data<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
fn on_data<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where Self: Send + 'async_trait, 'life0: 'async_trait,
Called after receiving a Verb::Data command.
fn on_quit<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
fn on_quit<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where Self: Send + 'async_trait, 'life0: 'async_trait,
Called after receiving a Verb::Quit command.
fn on_noop<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
fn on_noop<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where Self: Send + 'async_trait, 'life0: 'async_trait,
Called after receiving a Verb::Noop command.
fn on_help<'life0, 'async_trait>(
&'life0 mut self,
__arg1: UnparsedArgs
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
fn on_help<'life0, 'async_trait>( &'life0 mut self, __arg1: UnparsedArgs ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where Self: Send + 'async_trait, 'life0: 'async_trait,
Called after receiving a Verb::Help command.
fn on_unknown<'life0, 'async_trait>(
&'life0 mut self,
buffer: Vec<u8>
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
fn on_unknown<'life0, 'async_trait>( &'life0 mut self, buffer: Vec<u8> ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where Self: Send + 'async_trait, 'life0: 'async_trait,
Called after receiving an unknown command (unrecognized or unimplemented).
fn on_bad_sequence<'life0, 'async_trait>(
&'life0 mut self,
__arg1: (Verb, Stage)
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
fn on_bad_sequence<'life0, 'async_trait>( &'life0 mut self, __arg1: (Verb, Stage) ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where Self: Send + 'async_trait, 'life0: 'async_trait,
Called when the stage of the transaction (obtained with get_stage)
and the command are not compatible.
fn on_args_error<'life0, 'async_trait>(
&'life0 mut self,
__arg1: ParseArgsError
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
fn on_args_error<'life0, 'async_trait>( &'life0 mut self, __arg1: ParseArgsError ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where Self: Send + 'async_trait, 'life0: 'async_trait,
Called when an argument of a command is invalid.