Milter smfi_setconn()

Set up for the listening connection All sendmail versions

Milters are capable of communicating with sendmail over a named pipe or over a TCP network socket. You specify which of these your Milter will use by calling smfi_setconn() before calling smfi_main(). The smfi_setconn() routine is called like this:

ret = smfi_setconn(how);

Here, how is a string of the form prefix:socket, where prefix is selected from those shown in Table 26-12, and socket is appropriate to the prefix.

Table 26-12. Prefixes used in the smfi_setconn() string

Prefix

Description

unix

The socket will be a named pipe, the path to which is specified, as for example, unix:/var/run/milter.soc

local

A synonym for unix

inet

The socket is for an IPv4 TCP/IP connection which is specified as either a hostname or an IP address, as, for example, inet:3030@127.0.0.1

inet6

The socket is for an IPv6 TCP/IP connection which is specified as either a hostname or an IP address, as, for example, inet6:3030@3ffe:8050:201:1860:42::1

Note that smfi_setconn() does not actually set up the socket. It only supplies your information to the Milter library. To actually create the socket you need to call either the smfi_main() routine (Milter smfi_main() on page 1193), which will create it automatically as part of startup, or the smfi_opensocket() routine (Milter smfi_opensocket() on page 1193), which will perform the actual socket creation. The latter is preferred if you wish to manage socket errors yourself.

For ...

Get sendmail, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.