summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/libmilter/docs/smfi_register.html
blob: 083d12264b0b460bffe8359b510a8a84ede3262b (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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
<HTML>
<HEAD><TITLE>smfi_register</TITLE></HEAD>
<BODY>
<!--
$Id: smfi_register.html,v 1.19 2013/11/22 20:51:39 ca Exp $
-->
<H1>smfi_register</H1>

<TABLE border="0" cellspacing=4 cellpadding=4>
<!---------- Synopsis ----------->
<TR><TH valign="top" align=left width=100>SYNOPSIS</TH><TD>
<PRE>
#include &lt;libmilter/mfapi.h&gt;
int smfi_register(
	smfiDesc 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 argument.
Multiple (successful) calls to smfi_register within a
single process are not allowed,
i.e., only one filter can be successfully registered.
Note, however, that the library may not check whether this restriction
is obeyed.
</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 describing the filter's functions.
<A NAME="smfiDesc">The structure</A> 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 *);

	/* any unrecognized or unimplemented command filter */
	sfsistat	(*xxfi_unknown)(SMFICTX *, const char *);

	/* SMTP DATA command filter */
	sfsistat	(*xxfi_data)(SMFICTX *);

	/* negotiation callback */
	sfsistat (*<A HREF="xxfi_negotiate.html">xxfi_negotiate</A>)(SMFICTX *,
		unsigned long, unsigned long, unsigned long, unsigned long,
		unsigned long *, unsigned long *, unsigned long *, unsigned long *);
};
</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">The xxfi_flags</A>
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 <A HREF="smfi_addheader.html">add headers</A>.
    </TD>
  </TR>
  <TR align="left" valign=top>
    <TD>
        SMFIF_CHGHDRS
    </TD>
    <TD>
        This filter may
	<A HREF="smfi_chgheader.html">change and/or delete headers</A>.
    </TD>
  </TR>
  <TR align="left" valign=top>
    <TD VALIGN="TOP">
        SMFIF_CHGBODY
    </TD>
    <TD>
        This filter may
	<A HREF="smfi_replacebody.html">replace the body</A> 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
	<A HREF="smfi_addrcpt.html">add recipients</A>
	to the message.
    </TD>
  </TR>
  <TR>
    <TD VALIGN="TOP">
	SMFIF_ADDRCPT_PAR
    </TD>
    <TD>
	This filter may
	<A HREF="smfi_addrcpt_par.html">add recipients including ESMTP args</A>.
    </TD>
  </TR>
  <TR>
    <TD VALIGN="TOP">
        SMFIF_DELRCPT
    </TD>
    <TD>
        This filter may
	<A HREF="smfi_delrcpt.html">remove recipients</A> from the message.
    </TD>
  </TR>
  <TR>
    <TD VALIGN="TOP">
	SMFIF_QUARANTINE
    </TD>
    <TD>
	This filter may
	<A HREF="smfi_quarantine.html">quarantine</A> a message.
    </TD>
  </TR>

  <TR>
    <TD VALIGN="TOP">
	SMFIF_CHGFROM
    </TD>
    <TD>
	This filter may
	<A HREF="smfi_chgfrom.html">change the envelope sender</A> (MAIL).
    </TD>
  </TR>

  <TR>
    <TD VALIGN="TOP">
	SMFIF_SETSYMLIST
    </TD>
    <TD>
	This filter can
	<A HREF="smfi_setsymlist.html">send a set of symbols (macros)</A>
	that it wants.
    </TD>
  </TR>

</TABLE>

</TD>
</TR>

</TABLE>

<HR size="1">
<FONT size="-1">
Copyright (c) 2000-2001, 2003, 2006 Proofpoint, Inc. and its suppliers.
All rights reserved.
<BR>
By using this file, you agree to the terms and conditions set
forth in the LICENSE.
</FONT>
</BODY>
</HTML>
OpenPOWER on IntegriCloud