xxfi_negotiate callback Function

Purpose

The xxfi_negotiate callback function handles negotiation.

Syntax

#include <libmilter/mfapi.h>
#include <libmilter/mfdef.h>
sfsistat (*xxfi_negotiate)(
        SMFICTX *ctx, 
	unsigned long f0,
	unsigned long f1,
	unsigned long f2,
	unsigned long f3,
	unsigned long *pf0,
	unsigned long *pf1,
	unsigned long *pf2,
	unsigned long *pf3);

Description

The xxfi_negotiate callback function is called at the start of each simple mail transfer protocol (SMTP) connection and returns SMFIS_ALL_OPTS flag.

With this function, a milter parameter could dynamically determine and request operations and actions during startup. In previous versions, the actions (f0) were fixed in the flags field of the smfiDesc structure and the protocol steps (f1) were implicitly derived by checking whether a callback was defined. Due to the extensions in the new milter version, such a static selection would not work if a milter parameter requires new actions that are not available when talking to an older mail transfer agent (MTA). Hence, in the negotiation a callback can determine which operations are available and dynamically select those callback function which it needs and which are offered. If some operations are not available, the milter parameter might either fall back to an older mode or stop the session and ask the user to upgrade.

Protocol steps
(f1, *pf1)
:
The available actions
(f0, *pf0)
are described in (xxfi_flags).

If a milter returns the SMFIS_CONTINUE flag, the milter sets the desired actions and protocol steps via the (output) parameters pf0 and pf1 (which correspond to f0 and f1, respectively). The (output) parameters pf2 and pf3 should be set to 0 for compatibility with future versions.

Arguments

Table 1. Arguments
Item Description
ctx The opaque context structure maintained in libmilter parameter.
f0 The actions offered by the MTA.
f1 The protocol steps offered by the MTA.
f2 For future extensions.
f3 For future extensions.
pf0 The actions requested by the milter
pf1 The protocol steps requested by the milter.
pf2 For future extensions.
pf3 For future extensions.

Return values

Table 2. Return Values
Item Description
SMFIS_ALL_OPTS If a milter just wants to inspect the available protocol steps and actions, then it can return the SMFIS_ALL_OPTS flag and the MTA would make all protocol steps and actions available to the milter. In this case, no values should be assigned to the output parameters pf0 -pf3 as they would be ignored.
SMFIS_REJECT The milter startup fails and it would not be contacted again (for the current connection).
SMFIS_CONTINUE Continue processing. In this case the milter parameter must set all output parameters pf0 - pf3. See the following for an explanation how to set those output parameters.