Sendmail 8.13.3 Programmer's Guide

Milter APIs
Callbacks
Chapter 2 41
You must call xxfi_eoh() with the ctx argument, which specifies an
opaque context structure.
The xxfi_body() Callback
The xxfi_body() callback handles a portion of message body and
returns the SMFIS_CONTINUE value to the calling filter application. The
filter application calls xxfi_body() multiple times after calling the
xxfi_eoh() callback and before calling the xxfi_eom() callback.
The declaration of xxfi_body() is as follows:
#include <libmilter/mfapi.h>
sfsistat (*xxfi_body)(
SMFICTX * ctx,
unsigned char * bodyp,
size_t len
);
Following are some points to consider regarding xxfi_body():
The bodyp argument points to a sequence of bytes and it is not a C
string that is a sequence of characters terminated by a null character
(\0). You must not use the normal C string functions, such as
strlen() to modify the block of data. The byte sequence in the block
can also contain \0 characters. If you add a trailing \0 character, C
string functions can still fail to work in the block.
Because message bodies can be large, defining xxfi_body()
significantly impacts the filter performance.
The filter application represents end-of-lines as received from the
SMTP transaction (normally as CR or LF).
Later filter applications observe body changes made by earlier filter
applications.
You can send message bodies in multiple portions with one call to
xxfi_body() per portion.
Arguments
You must call xxfi_body() with the following arguments:
ctx Specifies an opaque context structure.