The version is the literal constant SMFI_VERSION.
The 13 funct expressions are each either the address of an appropriate xxfi_ function you
wrote, or the value NULL. If a funct points to an xxfi_ function, that function will be called
by the Milter library. If the funct is NULL, the Milter library will act as though the xxfi_
function is called but always returns SMFIS_CONTINUE.
Table 26-11. Flags for the flags entry in the smfiDesc structure
Flag Description
SMFIF_ADDHDRS This Milter may call smfi_addheader() (?§26.5.1 on page 1184) to add headers, and may
call smfi_insheader() (?§26.5.9 on page 1192) to insert headers.
SMFIF_ADDRCPT This Milter may call smfi_addrcpt() (?§26.5.2 on page 1185) to add an envelope recipient to
the message.
SMFIF_ADDRCPT_PAR This Milter may call smfi_addrcpt_par() (?§26.5.3 on page 1186) to add an envelope
recipient with ESMTP extensions to the message.
SMFIF_CHGBODY This Milter may call smfi_replacebody() (?§26.5.15 on page 1196) to replace all or part of
the message body.
SMFIF_CHGFROM This Milter may call smfi_chgfrom() (?§26.5.4 on page 1187) to add or change the envelope
sender and its ESMTP extensions.
This is the Title of the Book, eMatter Edition
Copyright ?© 2007 O??™Reilly & Associates, Inc. All rights reserved.
1196 | Chapter 26: The X (Milters) Configuration Command
When you specify multiple flags, you must separate each from the others with a vertical bar
(the bitwise-OR operator):
SMFIF_ADDHDRS|SMFIF_CHGBODY|SMFIF_ADDRCPT; /* flags */
A full declaration of an smfiDesc structure followed by a call to smfi_negotiate() might
look like this:
struct smfiDesc MyDesc = {
"my_milter", /* name */
SMFI_VERSION, /* version */
SMFIF_ADDHDRS|SMFIF_CHGBODY|SMFIF_ADDRCPT; /* flags */
xxfi_connect,
xxfi_helo,
xxfi_envfrom,
xxfi_envrcpt,
xxfi_header,
xxfi_eoh,
xxfi_body,
xxfi_eom,
xxfi_abort,
xxfi_close,
xxfi_unknown,
xxfi_data,
xxfi_negotiate,
};
ret = smfi_register(MyDesc);
if (ret == MI_FAILURE)
/* handle error here */
The smfi_register() routine should be called only once at Milter startup, but beware that
the Milter library will not warn if it is called multiple times, and undesirable behavior may
result.
Pages:
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152