# smfi_opensocket

SYNOPSIS

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

Attempt to create the interface socket MTAs will use to connect to the filter.

DESCRIPTION

Called When | Called only from program mainline, after calling `smfi_setconn()` and `smfi_register()`, but before calling `smfi_main()`.
Effects | smfi_opensocket attempts to create the socket specified previously by a call to `smfi_setconn()` which will be the interface between MTAs and the filter. This allows the calling application to ensure that the socket can be created. If this is not called, `smfi_main()` will create the socket implicitly (without removing a potentially existing UNIX domain socket).

ARGUMENTS

Argument | Description
--- | ---
rmsocket | A flag indicating whether or not the library should try to remove any existing UNIX domain socket before trying to create a new one.

RETURN VALUES

smfi_opensocket will fail and return MI_FAILURE if:

- The interface socket could not be created for any reason.
- `rmsocket` was `true`, and either the socket could not be examined, or exists and could not be removed.
- `smfi_setconn()` or `smfi_register()` have not been called.

Otherwise, it will return MI_SUCCESS

Copyright (c) 2003, 2008 Proofpoint, Inc. and its suppliers. All rights reserved.
By using this file, you agree to the terms and conditions set forth in the LICENSE.