xref: /freebsd/contrib/sendmail/libmilter/docs/smfi_replacebody.html (revision f4f33ea0c752ff0f9bfad34991d5bbb54e71133d)
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
39<!----------- Arguments ---------->
40<TR><TH valign="top" align=left>ARGUMENTS</TH><TD>
41    <TABLE border="1" cellspacing=0>
42    <TR bgcolor="#dddddd"><TH>Argument</TH><TH>Description</TH></TR>
43    <TR valign="top"><TD>ctx</TD>
44	<TD>Opaque context structure.
45	</TD></TR>
46    <TR valign="top"><TD>bodyp</TD>
47	<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.
48	</TD></TR>
49    <TR valign="top"><TD>bodylen</TD>
50	<TD>The number of data bytes pointed to by bodyp.
51	</TD></TR>
52    </TABLE>
53</TD></TR>
54
55<!----------- Return values ---------->
56<TR>
57<TH valign="top" align=left>RETURN VALUES</TH>
58
59<TD>smfi_replacebody fails and returns MI_FAILURE if:
60<UL>
61    <LI>bodyp == NULL and bodylen &gt; 0.
62    <LI>Changing the body in the current connection state is invalid.
63    <LI>A network error occurs.
64    <LI>SMFIF_CHGBODY was not set when <A href="smfi_register.html">smfi_register</A> was called.
65</UL>
66Otherwise, it will return MI_SUCCESS.
67</TD>
68</TR>
69
70<!----------- Notes ---------->
71<TR align="left" valign=top>
72<TH>NOTES</TH>
73<TD>
74<UL>
75    <LI>Since the message body may be very large, setting SMFIF_CHGBODY may significantly affect filter performance.
76    <LI>If a filter sets SMFIF_CHGBODY but does not call smfi_replacebody, the original body remains unchanged.
77    <LI>For smfi_replacebody, filter order is important.  <B>Later filters will see the new body contents created by earlier ones.</B>
78</UL>
79</TD>
80</TR>
81
82</TABLE>
83
84<HR size="1">
85<FONT size="-1">
86Copyright (c) 2000-2001, 2003 Proofpoint, Inc. and its suppliers.
87All rights reserved.
88<BR>
89By using this file, you agree to the terms and conditions set
90forth in the LICENSE.
91</FONT>
92</BODY>
93</HTML>
94