1<HTML>
2<HEAD><TITLE>smfi_opensocket</TITLE></HEAD>
3<BODY>
4<!--
5$Id: smfi_opensocket.html,v 1.8 2013-11-22 20:51:39 ca Exp $
6-->
7<H1>smfi_opensocket</H1>
8
9<TABLE border="0" cellspacing=4 cellpadding=4>
10<!---------- Synopsis ----------->
11<TR><TH valign="top" align=left width=100>SYNOPSIS</TH><TD>
12<PRE>
13#include &lt;libmilter/mfapi.h&gt;
14int smfi_opensocket(
15	bool rmsocket
16);
17</PRE>
18Attempt to create the interface socket MTAs will use to connect to the
19filter.
20</TD></TR>
21
22<!----------- Description ---------->
23<TR><TH valign="top" align=left>DESCRIPTION</TH><TD>
24<TABLE border="1" cellspacing=1 cellpadding=4>
25<TR align="left" valign=top>
26<TH width="80">Called When</TH>
27<TD>Called only from program mainline,
28after calling <TT>smfi_setconn()</TT> and <TT>smfi_register()</TT>,
29but before calling <TT>smfi_main()</TT>.
30</TD>
31</TR>
32<TR align="left" valign=top>
33<TH width="80">Effects</TH>
34<TD>smfi_opensocket attempts to create the socket specified previously by
35a call to <TT>smfi_setconn()</TT> which will be the interface between MTAs
36and the filter.
37This allows the calling application to ensure that the socket can be created.
38If this is not called,
39<TT>smfi_main()</TT> will create the socket implicitly
40(without removing a potentially existing UNIX domain socket).
41</TD>
42</TR>
43</TABLE>
44</TD></TR>
45
46<!----------- Arguments ---------->
47<TR><TH valign="top" align=left>ARGUMENTS</TH><TD>
48    <TABLE border="1" cellspacing=0>
49    <TR bgcolor="#dddddd"><TH>Argument</TH><TH>Description</TH></TR>
50    <TR valign="top"><TD>rmsocket</TD>
51	<TD>A flag indicating whether or not the library should try to
52	remove any existing UNIX domain socket before trying to create
53        a new one.
54	</TD></TR>
55    </TABLE>
56</TD></TR>
57
58<!----------- Return values ---------->
59<TR>
60<TH valign="top" align=left>RETURN VALUES</TH>
61
62<TD>smfi_opensocket will fail and return MI_FAILURE if:
63<UL>
64    <LI>The interface socket could not be created for any reason.
65    <LI><TT>rmsocket</TT> was <TT>true</TT>, and either the socket could
66        not be examined, or exists and could not be removed.
67    <LI><TT>smfi_setconn()</TT> or <TT>smfi_register()</TT>
68	have not been called.
69</UL>
70Otherwise, it will return MI_SUCCESS
71</TD>
72</TR>
73
74</TABLE>
75
76<HR size="1">
77<FONT size="-1">
78Copyright (c) 2003, 2008 Proofpoint, Inc. and its suppliers.
79All rights reserved.
80<BR>
81By using this file, you agree to the terms and conditions set
82forth in the LICENSE.
83</FONT>
84</BODY>
85</HTML>
86