Attribute Macro milter_callback::on_negotiate [−][src]
#[on_negotiate]
Generates a callback function of type NegotiateCallback
that delegates
to the annotated function.
As its sole argument on_negotiate
takes an identifier to be used as the
name of the generated function.
The on_negotiate
callback is called just before the connect
stage. It
enables negotiation of certain protocol features that apply to the current
connection. The function arguments indicate what capabilities are available.
The milter can then return a subset of these to signal the desired ones. The
signature of the annotated function must be as specified below.
Arguments:
Context<T>
– the callback contextActions
– the available actionsProtocolOpts
– the available milter protocol options
Return type:
- a tuple containing the fields
Status
– the response status. The special response statusStatus::AllOpts
enables all available actions and protocol stages; useStatus::Continue
to apply your own set of actions and protocol options.Actions
– the desired actionsProtocolOpts
– the desired protocol options
Examples
use milter::{Actions, Context, ProtocolOpts, Status}; #[on_negotiate(negotiate_callback)] fn handle_negotiate( context: Context<MyData>, actions: Actions, protocol_opts: ProtocolOpts, ) -> (Status, Actions, ProtocolOpts) { (Status::AllOpts, Default::default(), Default::default()) }