Struct vsmtp_server::Handler
pub struct Handler<Parser, ParserFactory>where
Parser: MailParser + Send + Sync,
ParserFactory: Fn() -> Parser + Send + Sync,{ /* private fields */ }
Expand description
Implementations§
§impl<Parser, ParserFactory> Handler<Parser, ParserFactory>where
Parser: MailParser + Send + Sync,
ParserFactory: Fn() -> Parser + Send + Sync,
impl<Parser, ParserFactory> Handler<Parser, ParserFactory>where Parser: MailParser + Send + Sync, ParserFactory: Fn() -> Parser + Send + Sync,
pub fn new(
config: Arc<Config>,
rustls_config: Option<Arc<ServerConfig>>,
rule_engine: Arc<RuleEngine>,
queue_manager: Arc<dyn GenericQueueManager>,
message_parser_factory: ParserFactory,
emitter: Arc<Emitter>,
client_addr: SocketAddr,
server_addr: SocketAddr,
server_name: Domain,
timestamp: OffsetDateTime,
uuid: Uuid
) -> Self
pub fn new( config: Arc<Config>, rustls_config: Option<Arc<ServerConfig>>, rule_engine: Arc<RuleEngine>, queue_manager: Arc<dyn GenericQueueManager>, message_parser_factory: ParserFactory, emitter: Arc<Emitter>, client_addr: SocketAddr, server_addr: SocketAddr, server_name: Domain, timestamp: OffsetDateTime, uuid: Uuid ) -> Self
Trait Implementations§
§impl<Parser: MailParser + Send + Sync, ParserFactory: Fn() -> Parser + Send + Sync> ReceiverHandler for Handler<Parser, ParserFactory>
impl<Parser: MailParser + Send + Sync, ParserFactory: Fn() -> Parser + Send + Sync> ReceiverHandler for Handler<Parser, ParserFactory>
§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_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_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_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_rset<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: '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,
Called after receiving a
Verb::Rset
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. Read more§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. Read more§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,
_: &'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, _: &'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).
§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.source§fn on_data<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
Self: Send + 'async_trait,
fn on_data<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: Send + 'async_trait,
Called after receiving a
Verb::Data
command.source§fn on_quit<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
Self: Send + 'async_trait,
fn on_quit<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: Send + 'async_trait,
Called after receiving a
Verb::Quit
command.source§fn on_noop<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
Self: Send + 'async_trait,
fn on_noop<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: Send + 'async_trait,
Called after receiving a
Verb::Noop
command.source§fn on_help<'life0, 'async_trait>(
&'life0 mut self,
__arg1: UnparsedArgs
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
Self: Send + 'async_trait,
fn on_help<'life0, 'async_trait>( &'life0 mut self, __arg1: UnparsedArgs ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: Send + 'async_trait,
Called after receiving a
Verb::Help
command.source§fn on_unknown<'life0, 'async_trait>(
&'life0 mut self,
buffer: Vec<u8, Global>
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
Self: Send + 'async_trait,
fn on_unknown<'life0, 'async_trait>( &'life0 mut self, buffer: Vec<u8, Global> ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: Send + 'async_trait,
Called after receiving an unknown command (unrecognized or unimplemented).
source§fn on_bad_sequence<'life0, 'async_trait>(
&'life0 mut self,
__arg1: (Verb, Stage)
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
Self: Send + 'async_trait,
fn on_bad_sequence<'life0, 'async_trait>( &'life0 mut self, __arg1: (Verb, Stage) ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: Send + 'async_trait,
Called when the stage of the transaction (obtained with
get_stage
)
and the command are not compatible.