smfi_setpriv Function

Purpose

The smfi_setpriv function sets the private data pointer for this connection.

Syntax

#include <libmilter/mfapi.h>
int smfi_setpriv
SMFICTX *ctx,
void *privatedata
();

Description

The smfi_setpriv function is called from any of the xxfi_* callback functions, to set the private data pointer for the ctx.
Note: There is one private data pointer per connection; multiple calls to the smfi_setpriv function with different values cause previous values to be lost. Before a filter terminates, the filter must release the private data and set the pointer to NULL.

Arguments

Table 1. Arguments
Item Description
ctx The opaque context structure is maintained in the libmilter parameter.
privatedata The argument points to private data. This value is returned by subsequent calls to the smfi_getpriv function by using ctx.

Return values

The smfi_setpriv function returns the MI_FAILURE value if ctx is an invalid context. Otherwise, the function returns MI_SUCCESS.

Related information

libmilter_smfi_setpriv.html#smfi_setpriv