[][src]Attribute Macro milter_callback::on_negotiate

#[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, to negotiate certain connection parameters. The function arguments indicate what parameters are available. The milter can then return a subset of these to signal desired options. The signature of the annotated function must be as specified below.

Arguments:

Return type:

  • a tuple containing the fields
    • Status – the response status. The special response status Status::AllOpts enables all available actions and protocol options; use Status::Continue to apply your own set of actions and protocol options.
    • Actions – the desired actions
    • ProtocolOpts – 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())
}