NAME
smfi_register() — registers a set of filter callbacks for sendmail
SYNOPSIS
#include <libmilter/mfapi.h>
int smfi_register(
smfiDesc descr
);
PAMAMETERS
- descr
Specifies a filter descriptor of type
smfiDesc
describing the
filter's functions.
DESCRIPTION
The
smfi_register()
creates a filter using the information given in the
smfiDesc
argument.
smfi_register()
must be called before the
smfi_main()
routine.
Multiple calls to the
smfi_register()
routine within a single process is not allowed.
The
smfiDesc
structure has the following
members:
struct smfiDesc
{
char *xxfi_name; /* filter name */
int xfi_version; /* version code -- do not change */
unsigned long xxfi_flags; /* flags */
/* connection info filter */
sfsistat (*xxfi_connect)(SMFICTX *, char *, SOCK_ADDR *);
/* SMTP HELO command filter */
sfsistat (*xxfi_helo)(SMFICTX *, char *);
/* envelope sender filter */
sfsistat (*xxfi_envfrom)(SMFICTX *, char **);
/* envelope recipient filter */
sfsistat (*xxfi_envrcpt)(SMFICTX *, char **);
/* header filter */
sfsistat (*xxfi_header)(SMFICTX *, char *, char *);
/* end of header */
sfsistat (*xxfi_eoh)(SMFICTX *);
/* body block */
sfsistat (*xxfi_body)(SMFICTX *, unsigned char *, size_t);
/* end of message */
sfsistat (*xxfi_eom)(SMFICTX *);
/* message aborted */
sfsistat (*xxfi_abort)(SMFICTX *);
/* connection cleanup */
sfsistat (*xxfi_close)(SMFICTX *);
};
A NULL
value for any callback function indicates that the filter does not
wish to process the given type of information and the filter returns
the
SMFIS_CONTINUE
value.
Notes
The
xxfi
flags
field must contain the bitwise OR of 0 (zero) or more
of the following values:
- SMFIF_ADDHDRS
This filter adds headers.
- SMFIF_CHGHDRS
This filter changes and deletes headers.
- SMFIF_CHGBODY
This filter replaces the body of the message during the filtering process.
SMFIF_CHGBODY
may have significant performance impact if other
filters do body filtering after
SMFIF_CHGBODY.
- SMFIF_ADDRCPT
This filter adds recipients to the message.
- SMFIF_DELRCPT
This filter removes recipients from the
message.
RETURN VALUE
The
smfi_register()
routine may return
MI_FAILURE
for any of the following reasons:
Memory allocation failure
Incompatible version or illegal flags value
AUTHOR
smfi_register()
was developed by the Sendmail Inc.
SEE ASLO
smfi_main(3N),
smfi_setconn(3N),
smfi_settimeout(3N),
smfi_opensocket(3N),
smfi_setbacklog(3N),
smfi_setdbg(3N),
smfi_stop(3N).
Sendmail 8.13.3 Programmer's Guide
on
docs.hp.com.