xref: /freebsd/contrib/sendmail/libmilter/docs/smfi_replacebody.html (revision d39bd2c1388b520fcba9abed1932acacead60fba)
1d0cef73dSGregory Neil Shapiro<HTML>
2d0cef73dSGregory Neil Shapiro<HEAD><TITLE>smfi_replacebody</TITLE></HEAD>
3d0cef73dSGregory Neil Shapiro<BODY>
4e92d3f3fSGregory Neil Shapiro<!--
54313cc83SGregory Neil Shapiro$Id: smfi_replacebody.html,v 1.16 2013-11-22 20:51:39 ca Exp $
6e92d3f3fSGregory Neil Shapiro-->
7d0cef73dSGregory Neil Shapiro<H1>smfi_replacebody</H1>
840266059SGregory Neil Shapiro
9d0cef73dSGregory Neil Shapiro<TABLE border="0" cellspacing=4 cellpadding=4>
1040266059SGregory Neil Shapiro<!---------- Synopsis ----------->
11d0cef73dSGregory Neil Shapiro<TR><TH valign="top" align=left width=100>SYNOPSIS</TH><TD>
12d0cef73dSGregory Neil Shapiro<PRE>
1340266059SGregory Neil Shapiro#include &lt;libmilter/mfapi.h&gt;
1440266059SGregory Neil Shapiroint smfi_replacebody(
1540266059SGregory Neil Shapiro	SMFICTX *ctx,
1640266059SGregory Neil Shapiro	unsigned char *bodyp,
1740266059SGregory Neil Shapiro	int bodylen
1840266059SGregory Neil Shapiro);
19d0cef73dSGregory Neil Shapiro</PRE>
2040266059SGregory Neil ShapiroReplace message-body data.
21d0cef73dSGregory Neil Shapiro</TD></TR>
2240266059SGregory Neil Shapiro
2340266059SGregory Neil Shapiro<!----------- Description ---------->
24d0cef73dSGregory Neil Shapiro<TR><TH valign="top" align=left>DESCRIPTION</TH><TD>
25d0cef73dSGregory Neil Shapiro<TABLE border="1" cellspacing=1 cellpadding=4>
26d0cef73dSGregory Neil Shapiro<TR align="left" valign=top>
27d0cef73dSGregory Neil Shapiro<TH width="80">Called When</TH>
28d0cef73dSGregory Neil Shapiro<TD>Called only from <A href="xxfi_eom.html">xxfi_eom</A>.  smfi_replacebody may be called more than once.</TD>
29d0cef73dSGregory Neil Shapiro</TR>
30d0cef73dSGregory Neil Shapiro<TR align="left" valign=top>
31d0cef73dSGregory Neil Shapiro<TH width="80">Effects</TH>
32d0cef73dSGregory Neil Shapiro<TD>smfi_replacebody replaces the body of the current message.  If called
3340266059SGregory Neil Shapiromore than once, subsequent calls result in data being appended to the new
3440266059SGregory Neil Shapirobody.
35d0cef73dSGregory Neil Shapiro</TD>
36d0cef73dSGregory Neil Shapiro</TR>
37d0cef73dSGregory Neil Shapiro</TABLE>
385b0945b5SGregory Neil Shapiro</TD></TR>
3940266059SGregory Neil Shapiro
4040266059SGregory Neil Shapiro<!----------- Arguments ---------->
41d0cef73dSGregory Neil Shapiro<TR><TH valign="top" align=left>ARGUMENTS</TH><TD>
42d0cef73dSGregory Neil Shapiro    <TABLE border="1" cellspacing=0>
43d0cef73dSGregory Neil Shapiro    <TR bgcolor="#dddddd"><TH>Argument</TH><TH>Description</TH></TR>
44d0cef73dSGregory Neil Shapiro    <TR valign="top"><TD>ctx</TD>
45d0cef73dSGregory Neil Shapiro	<TD>Opaque context structure.
46d0cef73dSGregory Neil Shapiro	</TD></TR>
47d0cef73dSGregory Neil Shapiro    <TR valign="top"><TD>bodyp</TD>
48*d39bd2c1SGregory Neil Shapiro	<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 CRLF form.
49d0cef73dSGregory Neil Shapiro	</TD></TR>
50d0cef73dSGregory Neil Shapiro    <TR valign="top"><TD>bodylen</TD>
51d0cef73dSGregory Neil Shapiro	<TD>The number of data bytes pointed to by bodyp.
52d0cef73dSGregory Neil Shapiro	</TD></TR>
53d0cef73dSGregory Neil Shapiro    </TABLE>
54d0cef73dSGregory Neil Shapiro</TD></TR>
5540266059SGregory Neil Shapiro
5640266059SGregory Neil Shapiro<!----------- Return values ---------->
57d0cef73dSGregory Neil Shapiro<TR>
58d0cef73dSGregory Neil Shapiro<TH valign="top" align=left>RETURN VALUES</TH>
5940266059SGregory Neil Shapiro
60d0cef73dSGregory Neil Shapiro<TD>smfi_replacebody fails and returns MI_FAILURE if:
61d0cef73dSGregory Neil Shapiro<UL>
62d0cef73dSGregory Neil Shapiro    <LI>bodyp == NULL and bodylen &gt; 0.
63d0cef73dSGregory Neil Shapiro    <LI>Changing the body in the current connection state is invalid.
64d0cef73dSGregory Neil Shapiro    <LI>A network error occurs.
655b0945b5SGregory Neil Shapiro    <LI><A HREF="smfi_register.html#SMFIF_CHGBODY">SMFIF_CHGBODY</A> is not set.
66d0cef73dSGregory Neil Shapiro</UL>
6740266059SGregory Neil ShapiroOtherwise, it will return MI_SUCCESS.
68d0cef73dSGregory Neil Shapiro</TD>
69d0cef73dSGregory Neil Shapiro</TR>
7040266059SGregory Neil Shapiro
7140266059SGregory Neil Shapiro<!----------- Notes ---------->
72d0cef73dSGregory Neil Shapiro<TR align="left" valign=top>
73d0cef73dSGregory Neil Shapiro<TH>NOTES</TH>
74d0cef73dSGregory Neil Shapiro<TD>
75d0cef73dSGregory Neil Shapiro<UL>
765b0945b5SGregory Neil Shapiro    <LI>Since the message body may be very large, calling smfi_replacebody may significantly affect filter performance.
77d0cef73dSGregory Neil Shapiro    <LI>If a filter sets SMFIF_CHGBODY but does not call smfi_replacebody, the original body remains unchanged.
78d0cef73dSGregory Neil Shapiro    <LI>For smfi_replacebody, filter order is important.  <B>Later filters will see the new body contents created by earlier ones.</B>
795b0945b5SGregory Neil Shapiro    <LI>A filter which calls smfi_replacebody must have set the
805b0945b5SGregory Neil Shapiro    <A HREF="smfi_register.html#SMFIF_CHGBODY">SMFIF_CHGBODY</A> flag.
81d0cef73dSGregory Neil Shapiro</UL>
82d0cef73dSGregory Neil Shapiro</TD>
83d0cef73dSGregory Neil Shapiro</TR>
8440266059SGregory Neil Shapiro
85d0cef73dSGregory Neil Shapiro</TABLE>
8640266059SGregory Neil Shapiro
87d0cef73dSGregory Neil Shapiro<HR size="1">
88d0cef73dSGregory Neil Shapiro<FONT size="-1">
895dd76dd0SGregory Neil ShapiroCopyright (c) 2000-2001, 2003 Proofpoint, Inc. and its suppliers.
9040266059SGregory Neil ShapiroAll rights reserved.
91d0cef73dSGregory Neil Shapiro<BR>
9240266059SGregory Neil ShapiroBy using this file, you agree to the terms and conditions set
935ef517c0SGregory Neil Shapiroforth in the LICENSE.
94d0cef73dSGregory Neil Shapiro</FONT>
95d0cef73dSGregory Neil Shapiro</BODY>
96d0cef73dSGregory Neil Shapiro</HTML>
97