summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/libmilter/docs/smfi_register.html
blob: 705b3a4a9dae5d97ea5503496cd3c0975d22e8c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<html>
<head><title>smfi_register</title></head>
<body>
<h1>smfi_register</h1>

<table border="0" cellspacing=4 cellpadding=4>
<!---------- Synopsis ----------->
<tr><th valign="top" align=left width=150>SYNOPSIS</th><td>
<pre>
#include &lt;libmilter/mfapi.h&gt;
int smfi_register(
	smfiDesc_str descr
);
</pre>
Register a set of filter callbacks.
</td></tr>

<!----------- Description ---------->
<tr><th valign="top" align=left>DESCRIPTION</th><td>
<table border="1" cellspacing=1 cellpadding=1>
<tr align="left" valign=top>
<th width="80">Called When</th>
<td>smfi_register must be called before smfi_main</td>
</tr>
<tr align="left" valign=top>
<th width="80">Effects</th>
<td>smfi_register creates a filter using the information given in the
smfiDesc_str argument.  Multiple calls to smfi_register within a
single process are not allowed.</td>
</tr>
</table>

<!----------- Arguments ---------->
<tr><th valign="top" align=left>ARGUMENTS</th><td>
    <table border="1" cellspacing=0>
    <tr bgcolor="#dddddd"><th>Argument</th><th>Description</th></tr>
    <tr valign="top"><td>descr</td>
	<td>
A filter descriptor of type smfiDesc_str describing the filter's
functions.  The structure has the following members:
<pre>
struct smfiDesc
{
	char		*xxfi_name;	/* filter name */
	int		xxfi_version;	/* version code -- do not change */
	unsigned long	xxfi_flags;	/* <a href="#flags">flags</a> */

	/* connection info filter */
	sfsistat	(*<a href="xxfi_connect.html">xxfi_connect</a>)(SMFICTX *, char *, _SOCK_ADDR *);
	/* SMTP HELO command filter */
	sfsistat	(*<a href="xxfi_helo.html">xxfi_helo</a>)(SMFICTX *, char *);
	/* envelope sender filter */
	sfsistat	(*<a href="xxfi_envfrom.html">xxfi_envfrom</a>)(SMFICTX *, char **);
	/* envelope recipient filter */
	sfsistat	(*<a href="xxfi_envrcpt.html">xxfi_envrcpt</a>)(SMFICTX *, char **);
	/* header filter */
	sfsistat	(*<a href="xxfi_header.html">xxfi_header</a>)(SMFICTX *, char *, char *);
	/* end of header */
	sfsistat	(*<a href="xxfi_eoh.html">xxfi_eoh</a>)(SMFICTX *);
	/* body block */
	sfsistat	(*<a href="xxfi_body.html">xxfi_body</a>)(SMFICTX *, unsigned char *, size_t);
	/* end of message */
	sfsistat	(*<a href="xxfi_eom.html">xxfi_eom</a>)(SMFICTX *);
	/* message aborted */
	sfsistat	(*<a href="xxfi_abort.html">xxfi_abort</a>)(SMFICTX *);
	/* connection cleanup */
	sfsistat	(*<a href="xxfi_close.html">xxfi_close</a>)(SMFICTX *);
};
</pre>

A NULL value for any callback function indicates that the filter does
not wish to process the given type of information, simply returning
SMFIS_CONTINUE.
	</td></tr>
    </table>
</td></tr>

<!----------- Return values ---------->
<tr>
<th valign="top" align=left>RETURN VALUES</th> 

<td>
smfi_register may return MI_FAILURE for any of the following reasons:
<ul>
<li>memory allocation failed.  
<li>incompatible version or illegal flags value.
</ul>

</td>
</tr>

<!----------- Notes ---------->
<tr align="left" valign=top>
<th>NOTES</th> 
<td>

<a name="flags"></A>
The xxfi_flags field should contain the bitwise OR of zero or more of
the following values, describing the actions the filter may take:
<TABLE BORDER CELLPADDING="1" cellspacing=1>
<tr valign="top" bgcolor="#dddddd"><th align="left">Flag</th><th align="center">Description</th></tr>
  <TR align="left" valign=top>
    <TD>
        SMFIF_ADDHDRS
    </TD>
    <TD>
        This filter may add headers.
    </TD>
  </TR>
  <TR align="left" valign=top>
    <TD>
        SMFIF_CHGHDRS
    </TD>
    <TD>
        This filter may change and/or delete headers.
    </TD>
  </TR>
  <TR align="left" valign=top>
    <TD VALIGN="TOP">
        SMFIF_CHGBODY
    </TD>
    <TD>
        This filter may replace the body during filtering.
        This may have significant performance impact
        if other filters do body filtering after this filter.
    </TD>
  </TR>
  <TR>
    <TD VALIGN="TOP">
        SMFIF_ADDRCPT
    </TD>
    <TD>
        This filter may add recipients to the message.
    </TD>
  </TR>
  <TR>
    <TD VALIGN="TOP">
        SMFIF_DELRCPT
    </TD>
    <TD>
        This filter may remove recipients from the message.
    </TD>
  </TR>
</TABLE>

</td>
</tr>

</table>

<hr size="1">
<font size="-1">
Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
All rights reserved.
<br>
By using this file, you agree to the terms and conditions set
forth in the <a href="LICENSE.txt">LICENSE</a>.
</font>
</body>
</html>
OpenPOWER on IntegriCloud