xref: /freebsd/contrib/sendmail/libmilter/docs/smfi_replacebody.html (revision 18054d0220cfc8df9c9568c437bd6fbb59d53c3c)
1<HTML>
2<HEAD><TITLE>smfi_replacebody</TITLE></HEAD>
3<BODY>
4<!--
5$Id: smfi_replacebody.html,v 1.16 2013-11-22 20:51:39 ca Exp $
6-->
7<H1>smfi_replacebody</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_replacebody(
15	SMFICTX *ctx,
16	unsigned char *bodyp,
17	int bodylen
18);
19</PRE>
20Replace message-body data.
21</TD></TR>
22
23<!----------- Description ---------->
24<TR><TH valign="top" align=left>DESCRIPTION</TH><TD>
25<TABLE border="1" cellspacing=1 cellpadding=4>
26<TR align="left" valign=top>
27<TH width="80">Called When</TH>
28<TD>Called only from <A href="xxfi_eom.html">xxfi_eom</A>.  smfi_replacebody may be called more than once.</TD>
29</TR>
30<TR align="left" valign=top>
31<TH width="80">Effects</TH>
32<TD>smfi_replacebody replaces the body of the current message.  If called
33more than once, subsequent calls result in data being appended to the new
34body.
35</TD>
36</TR>
37</TABLE>
38</TD></TR>
39
40<!----------- Arguments ---------->
41<TR><TH valign="top" align=left>ARGUMENTS</TH><TD>
42    <TABLE border="1" cellspacing=0>
43    <TR bgcolor="#dddddd"><TH>Argument</TH><TH>Description</TH></TR>
44    <TR valign="top"><TD>ctx</TD>
45	<TD>Opaque context structure.
46	</TD></TR>
47    <TR valign="top"><TD>bodyp</TD>
48	<TD>A pointer to the start of the new body data, which does not have to be null-terminated.  If bodyp is NULL, it is treated as having length == 0.  Body data should be in CR/LF form.
49	</TD></TR>
50    <TR valign="top"><TD>bodylen</TD>
51	<TD>The number of data bytes pointed to by bodyp.
52	</TD></TR>
53    </TABLE>
54</TD></TR>
55
56<!----------- Return values ---------->
57<TR>
58<TH valign="top" align=left>RETURN VALUES</TH>
59
60<TD>smfi_replacebody fails and returns MI_FAILURE if:
61<UL>
62    <LI>bodyp == NULL and bodylen &gt; 0.
63    <LI>Changing the body in the current connection state is invalid.
64    <LI>A network error occurs.
65    <LI><A HREF="smfi_register.html#SMFIF_CHGBODY">SMFIF_CHGBODY</A> is not set.
66</UL>
67Otherwise, it will return MI_SUCCESS.
68</TD>
69</TR>
70
71<!----------- Notes ---------->
72<TR align="left" valign=top>
73<TH>NOTES</TH>
74<TD>
75<UL>
76    <LI>Since the message body may be very large, calling smfi_replacebody may significantly affect filter performance.
77    <LI>If a filter sets SMFIF_CHGBODY but does not call smfi_replacebody, the original body remains unchanged.
78    <LI>For smfi_replacebody, filter order is important.  <B>Later filters will see the new body contents created by earlier ones.</B>
79    <LI>A filter which calls smfi_replacebody must have set the
80    <A HREF="smfi_register.html#SMFIF_CHGBODY">SMFIF_CHGBODY</A> flag.
81</UL>
82</TD>
83</TR>
84
85</TABLE>
86
87<HR size="1">
88<FONT size="-1">
89Copyright (c) 2000-2001, 2003 Proofpoint, Inc. and its suppliers.
90All rights reserved.
91<BR>
92By using this file, you agree to the terms and conditions set
93forth in the LICENSE.
94</FONT>
95</BODY>
96</HTML>
97