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§
Required Methods§
Sourcefn 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,
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.
Provided Methods§
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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<'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.