#include <libmilter/mfapi.h>
int smfi_chgheader(
SMFICTX *ctx,
char *headerf,
mi_int32 hdridx,
char *headerv
);
smfi_chgheader description
The smfi_chgheader
API changes a header's value for the current message. It is called
only from xxfi_eom.
smfi_chgheader parameters
- ctx
- Opaque context structure.
- headerf
- The header name, a non-NULL, null-terminated string.
- hdridx
- Header index value (1-based). A hdridx value of 1 modifies the
first occurrence of a header named headerf. If hdridx is greater than
the number of times headerf appears, a new copy of headerf is added.
- headerv
- The new value of the given header. A headerv value of NULL implies
that the header should be deleted.
smfi_chgheader result
smfi_chgheader returns
MI_FAILURE in the following cases:
- headerf is NULL.
- Modifying headers in the current connection state is not valid.
- Memory allocation fails.
- A network error occurs.
- SMFIF_CHGHDRS was not set when smfi_register was called.
Otherwise, it returns MI_SUCCESS.
Notes: - While smfi_chgheader can be used to add new headers, it is more
efficient and safer to use smfi_addheader to add new headers.
- A filter that calls smfi_chgheader must have set the SMFIF_CHGHDRS
flag in the smfiDesc_str passed to smfi_register.
- Filter order is important for smfi_chgheader; later filters see
the header changes made by previous filters.
- Neither the name nor the value of the header is checked for standards
compliance. However, each line of the header must be less than 2048
characters in length and should be less than 998 characters in length.
If longer headers are needed, make them multiline. It is the filter
writer's responsibility to ensure that no standards are violated.