Struct vsmtp_server::Handler

pub struct Handler<M: OnMail> { /* private fields */ }
Expand description

Implementations§

§

impl<M: OnMail> Handler<M>

pub fn new(
    on_mail: Box<M>,
    config: Arc<Config>,
    rustls_config: Option<Arc<ServerConfig>>,
    rule_engine: Arc<RuleEngine>,
    queue_manager: Arc<dyn GenericQueueManager>
) -> Self

Trait Implementations§

§

impl<M: OnMail + Send + Sync> ReceiverHandler for Handler<M>

§

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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> + 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_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,

Called when the number of reply considered as error reached a threshold (soft).
§

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,

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,

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,

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,

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,

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,

Called when the stage of the transaction (obtained with get_stage) and the command are not compatible.
source§

fn on_args_error<'life0, 'async_trait>(
    &'life0 mut self,
    __arg1: ParseArgsError
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait, Global>>where
    'life0: 'async_trait,
    Self: Send + 'async_trait,

Called when an argument of a command is invalid.

Auto Trait Implementations§

§

impl<M> !RefUnwindSafe for Handler<M>

§

impl<M> Send for Handler<M>where
    M: Send,

§

impl<M> Sync for Handler<M>where
    M: Sync,

§

impl<M> Unpin for Handler<M>

§

impl<M> !UnwindSafe for Handler<M>

Blanket Implementations§

source§

impl<T> Any for Twhere
    T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere
    U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere
    U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere
    U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere
    V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
    S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more