Sendmail 8.13.3 Programmer's Guide

Control Flow of Milter APIs
Call Order Sequence
Chapter 348
A filter application cannot process any message untill it registers its
callbacks with Sendmail.
A filter application initiates a filter session using the smfi_setconn()
API. The filter application initiates the session once and before calling
the smfi_main() API.
The smfi_setconn() API sets the socket through which the filter
application communicates with Sendmail. The filter application can
optionally call the smfi_opensocket() API, which attempts to open the
specified socket and ensures that the interface works properly. The filter
application can also make optional calls to smfi_settimeout(),
smfi_setbacklog(), and smfi_setdbg() before passing control to the
smfi_main() API. After initiating the session and calling the optional
APIs, the filter application must register with Sendmail, using the
smfi_register() API, which informs Sendmail about the filter
callbacks and the actual information the filter application requires. The
filter application then passes control to the smfi_main() API.
The smfi_main() API starts the listener for the filter application and
seeks for messages from Sendmail. The smfi_main() API makes
respective calls to the callback functions before validating the message.
For example, during a HELO message, smfi_main() invokes the filter
callback xxfi_helo().