Sendmail 8.13.3 Programmer's Guide

Milter APIs
Library Control APIs
Chapter 2 15
otimeout Specifies the timeout value in seconds. You must
specify a timeout value greater than 0 (zero). A value of
0 signifies that a filter does not to wait and, it does not
signify that a filter must wait forever.
Return Value
The smfi_settimeout() API always returns MI_SUCCESS to the filter
program.
The smfi_main() API
You can use the smfi_main() API to transfer control to the libmilter
event loop. You must call smfi_main() after initializing a filter.
The declaration of smfi_main() is as follows:
#include <libmilter/mfapi.h>
int smfi_main(
);
The smfi_main() API does not contain any arguments.
Return Value
When smfi_main() fails to establish a connection, it returns
MI_FAILURE to the filter application. The failure can occur because of
many reasons, such as invalid address passed to smfi_setconn(). The
reason for the failure is logged in the syslog file.
The smfi_main() API returns MI_SUCCESS on success.
The smfi_opensocket() API
You can use the smfi_opensocket() API to create the interface socket
that MTAs use to connect to the filter.
You can call smfi_opensocket() only from the program mainline, before
calling smfi_main(). You can use smfi_opensocket() to create the
socket previously specified by a call to the smfi_setconn() API, which is
the interface between MTAs and the filter. This allows the calling
application to ensure that the socket can be created.
If you do not call smfi_opensocket(), smfi_main() will do so implicitly.
The declaration for smfi_opensocket() is as follows: