smfi_opensocket Function

Purpose

The smfi_opensocket function attempts to create the interface socket mail transfer agents (MTA) that are used to connect to the filter.

Syntax

#include <libmilter/mfapi.h>
int smfi_opensocket(
bool rmsocket
);

Description

The smfi_opensocket function is called only from program mainline, after calling the smfi_setconn function and the smfi_register function, but before calling the smfi_main function. The smfi_opensocket function creates the socket specified previously by calling the smfi_setconn function which is the interface between MTAs and the filter. The smfi_opensocket function allows the calling application to create the socket. If the smfi_opensocket function is not called, the smfi_main function calls the function implicitly.

Arguments

Table 1. Arguments
Item Description
rmsocket A flag indicates if the library must try to remove any existing UNIX domain socket before trying to create a new one.

Return values

The smfi_opensocket function returns the MI_FAILURE value in the following cases. Otherwise, the function returns MI_SUCCESS.
  • The interface socket could not be created.
  • The rmsocket value is true, and either the socket could not be examined, or the existing socket could not be removed.
  • The smfi_setconn function or smfi_register function is not called.

Related information

libmilter_smfi_register.html

libmilter_smfi_setconn.html