Milter smfi_register()

Declare xxfi_ functions to call and set flags All sendmail versions

The sendmail program calls your Milter by passing information to your Milter’s socket. The Milter library wraps your program, reads from that socket, and passes that information into xxfi_ functions that you write. But the Milter library won’t call any of those functions unless you let it know which ones to call. You do that by filling out an smfiDesc structure and passing that structure to the smfi_register() routine. The smfi_register() routine, which must be called before you call smfi_main() (Milter smfi_main() on page 1193), is called like this:

ret = smfi_register(descr);

The smfi_register() routine takes a single argument, descr, which is a copy of a structure (not a pointer) of the type smfiDesc. The integer value MI_FAILURE is returned (to ret) if smfi_register() cannot allocate memory, or if the version is wrong or if one of the flags is illegal (see Table 26-11). The smfiDesc structure looks like this:

struct smfiDesc
{
    char            *name;
    int             version;
    unsigned long             flags;
    sfsistat             funct;        /* for xxfi_connect */
    sfsistat             funct;        /* for xxfi_helo */
    sfsistat             funct;        /* for xxfi_envfrom */
    sfsistat             funct;        /* for xxfi_envrcpt */
    sfsistat             funct;        /* for xxfi_header */
    sfsistat             funct;        /* for xxfi_eoh */
    sfsistat             funct;        /* for xxfi_body */
    sfsistat             funct;        /* for xxfi_eom */
    sfsistat             funct;        /* for xxfi_abort */
    sfsistat             funct;        /* for xxfi_close */
    sfsistat             funct;        /* for xxfi_unknown */              ← V8.14
and later ...

Get sendmail, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.