Milter

Trait Milter 

Source
pub trait Milter: Send {
    type Error: Send;

Show 15 methods // Required method fn abort<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; // Provided methods fn option_negotiation<'life0, 'async_trait>( &'life0 mut self, theirs: OptNeg, ) -> Pin<Box<dyn Future<Output = Result<OptNeg, Error<Self::Error>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn macro_<'life0, 'async_trait>( &'life0 mut self, _macro: Macro, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn connect<'life0, 'async_trait>( &'life0 mut self, _connect_info: Connect, ) -> Pin<Box<dyn Future<Output = Result<Action, Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn helo<'life0, 'async_trait>( &'life0 mut self, _helo: Helo, ) -> Pin<Box<dyn Future<Output = Result<Action, Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn mail<'life0, 'async_trait>( &'life0 mut self, _mail: Mail, ) -> Pin<Box<dyn Future<Output = Result<Action, Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn rcpt<'life0, 'async_trait>( &'life0 mut self, _recipient: Recipient, ) -> Pin<Box<dyn Future<Output = Result<Action, Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn data<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<Action, Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn header<'life0, 'async_trait>( &'life0 mut self, _header: Header, ) -> Pin<Box<dyn Future<Output = Result<Action, Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn end_of_header<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<Action, Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn body<'life0, 'async_trait>( &'life0 mut self, _body: Body, ) -> Pin<Box<dyn Future<Output = Result<Action, Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn end_of_body<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<ModificationResponse, Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn unknown<'life0, 'async_trait>( &'life0 mut self, _cmd: Unknown, ) -> Pin<Box<dyn Future<Output = Result<Action, Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn quit<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn quit_nc<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... }
}
Expand description

A trait to implement a working milter server.

See examples on how to implement this.

Required Associated Types§

Source

type Error: Send

A user error that might be returned handling this milter communication

Required Methods§

Source

fn abort<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Reset the message handling to accept a new connection.

Contrary to it’s name, a connection is not aborted here necessarily. This function is called at the end of every message processing, regardless of outcome, but the connection is kept open and ready to process the next message.

This is the only function not covered by a default. The implementor needs to reset it’s state to handle a new connection.

See Server::default_postfix.

Provided Methods§

Source

fn option_negotiation<'life0, 'async_trait>( &'life0 mut self, theirs: OptNeg, ) -> Pin<Box<dyn Future<Output = Result<OptNeg, Error<Self::Error>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Option negotiation for the connection between the miter client and server.

Source

fn macro_<'life0, 'async_trait>( &'life0 mut self, _macro: Macro, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

A macro sent by the milter client.

Source

fn connect<'life0, 'async_trait>( &'life0 mut self, _connect_info: Connect, ) -> Pin<Box<dyn Future<Output = Result<Action, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Connection information about the smtp connection.

Source

fn helo<'life0, 'async_trait>( &'life0 mut self, _helo: Helo, ) -> Pin<Box<dyn Future<Output = Result<Action, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

The helo name sent by the smtp client.

Source

fn mail<'life0, 'async_trait>( &'life0 mut self, _mail: Mail, ) -> Pin<Box<dyn Future<Output = Result<Action, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

The sender this email is from.

Source

fn rcpt<'life0, 'async_trait>( &'life0 mut self, _recipient: Recipient, ) -> Pin<Box<dyn Future<Output = Result<Action, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

A recipient to which this mail is to be transmitted to.

Source

fn data<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<Action, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called before data (=body + headers) is sent.

This allows to first receive sender and receiver, then the rest of the data.

Source

fn header<'life0, 'async_trait>( &'life0 mut self, _header: Header, ) -> Pin<Box<dyn Future<Output = Result<Action, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

A single header with it’s name and value.

Header names are not unique and might be received multiple times.

Source

fn end_of_header<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<Action, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called after all headers have been sent.

Source

fn body<'life0, 'async_trait>( &'life0 mut self, _body: Body, ) -> Pin<Box<dyn Future<Output = Result<Action, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

A body part was received.

This may be called multiple times until the whole body was transmitted.

Source

fn end_of_body<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<ModificationResponse, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called after all body parts have been received.

This is the only stage at which to respond with modifications to the milter client.

Source

fn unknown<'life0, 'async_trait>( &'life0 mut self, _cmd: Unknown, ) -> Pin<Box<dyn Future<Output = Result<Action, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

A command not matching any Code is received as unknown.

Source

fn quit<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called on quitting a connection from a milter client.

Some clients (postfix) do not call this method and instead call abort with the expectation the connection is closed.

See Server::default_postfix.

Source

fn quit_nc<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when a milter client want’s to re-use this milter for a new mail.

Implementors§