xxfi_body callback Function

Purpose

The xxfi_body callback function handles a piece of a messages body.

Syntax

#include <libmilter/mfapi.h>
sfsistat (*xxfi_body)(
	SMFICTX *ctx,
	unsigned char*bodyp ,
	size_t len
);

Description

The xxfi_body callback function is not called or is called many times between the xxfi_eoh and xxfi_eom callback function and returns the SMFIS_CONTINUE flag.

Note:
  • The bodyp points to a sequence of bytes. It is not a C string (a sequence of characters that is terminated by '\0'). Therefore, do not use the usual C string functions like strlen(3) on this byte block. The byte sequence might contain '\0' characters inside the block. Hence, even if a trailing '\0' is added, C string functions might still fail to work as expected.
  • Because the message bodies can be large, defining the xxfi_body callback function can significantly affect the filter performance.
  • End-of-lines are represented as received from SMTP (normally CR/LF).
  • Old filters make body changes to the new filters.
  • Message bodies might be sent in multiple chunks with one call to the xxfi_body callback function per chunk.
  • This function returns the SMFIS_SKIP flag if a milter parameter has received sufficiently many body chunks to make a decision, but still wants to invoke message modification functions that are only allowed to be called from xxfi_eom callback function.
  • The milter parameter must negotiate this behavior with the mail transfer agent (MTA), that is, it must check whether the protocol action SMFIP_SKIP flag is available and if so, the milter parameter must request it.

Arguments

Table 1. Arguments
Item Description
ctx The opaque context structure is maintained in the libmilter parameter.
bodyp The pointer to the start of this block of body data. bodyp is not valid outside this call to the xxfi_body callback function.
len The amount of data pointed to by bodyp.

Related information

xxfi_eoh

xxfi_eom