1<HTML> 2<HEAD><TITLE>smfi_chgheader</TITLE></HEAD> 3<BODY> 4<!-- 5$Id: smfi_chgheader.html,v 1.17 2006/12/21 18:30:35 ca Exp $ 6--> 7<H1>smfi_chgheader</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 <libmilter/mfapi.h> 14int smfi_chgheader( 15 SMFICTX *ctx, 16 char *headerf, 17 mi_int32 hdridx, 18 char *headerv 19); 20</PRE> 21Change or delete a message header. 22</TD></TR> 23 24<!----------- Description ----------> 25<TR><TH valign="top" align=left>DESCRIPTION</TH><TD> 26<TABLE border="1" cellspacing=1 cellpadding=4> 27<TR align="left" valign=top> 28<TH width="80">Called When</TH> 29<TD>Called only from <A href="xxfi_eom.html">xxfi_eom</A>.</TD> 30</TR> 31<TR align="left" valign=top> 32<TH width="80">Effects</TH> 33<TD>Changes a header's value for the current message.</TD> 34</TR> 35</TABLE> 36 37<!----------- Arguments ----------> 38<TR><TH valign="top" align=left>ARGUMENTS</TH><TD> 39 <TABLE border="1" cellspacing=0> 40 <TR bgcolor="#dddddd"><TH>Argument</TH><TH>Description</TH></TR> 41 <TR valign="top"><TD>ctx</TD> 42 <TD>Opaque context structure. 43 </TD></TR> 44 <TR valign="top"><TD>headerf</TD> 45 <TD>The header name, a non-NULL, null-terminated string. 46 </TD></TR> 47 <TR valign="top"><TD>hdridx</TD> 48 <TD>Header index value (1-based). A hdridx value of 1 will modify the first occurrence of a header named headerf. If hdridx is greater than the number of times headerf appears, a new copy of headerf will be added. 49 </TD></TR> 50 <TR valign="top"><TD>headerv</TD> 51 <TD>The new value of the given header. headerv == NULL implies that the header should be deleted. 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> 61smfi_chgheader will return MI_FAILURE if 62<UL><LI>headerf is NULL 63 <LI>Modifying headers in the current connection state is invalid. 64 <LI>Memory allocation fails. 65 <LI>A network error occurs. 66 <LI>SMFIF_CHGHDRS was not set when <A href="smfi_register.html">smfi_register</A> was called. 67</UL> 68Otherwise, it returns MI_SUCCESS. 69</TR> 70 71<!----------- Notes ----------> 72<TR align="left" valign=top> 73<TH>NOTES</TH> 74<TD> 75<UL><LI>While smfi_chgheader may be used to add new headers, it is more efficient and far safer to use <A href="smfi_addheader.html">smfi_addheader</A>. 76 <LI>A filter which calls smfi_chgheader must have set the SMFIF_CHGHDRS flag in the smfiDesc_str passed to <A href="smfi_register.html">smfi_register</A>. 77 <LI>For smfi_chgheader, filter order is important. <B>Later filters will see the header changes made by earlier ones.</B> 78 <LI>Neither the name nor the value of the header is checked for 79 standards compliance. However, each line of the header must be under 80 2048 characters and should be under 998 characters. If longer headers 81 are needed, make them multi-line. To make a multi-line header, insert 82 a line feed (ASCII 0x0a, or <TT>\n</TT> in C) followed by at least 83 one whitespace character such as a space (ASCII 0x20) or tab (ASCII 0x09, 84 or <TT>\t</TT> in C). The line feed should NOT be preceded by a 85 carriage return (ASCII 0x0d); the MTA will add this automatically. 86 <B>It is the filter writer's responsibility to ensure that no standards 87 are violated.</B> 88</UL> 89</TD> 90</TR> 91 92<!----------- Example code ----------> 93<TR> 94<TH valign="top" align=left>EXAMPLE</TH> 95 96<TD> 97 <PRE> 98 int ret; 99 SMFICTX *ctx; 100 101 ... 102 103 ret = smfi_chgheader(ctx, "Content-Type", 1, 104 "multipart/mixed;\n\tboundary=\"foobar\""); 105 </PRE> 106</TD> 107</TR> 108 109</TABLE> 110 111<HR size="1"> 112<FONT size="-1"> 113Copyright (c) 2000-2003 Sendmail, Inc. and its suppliers. 114All rights reserved. 115<BR> 116By using this file, you agree to the terms and conditions set 117forth in the LICENSE. 118</FONT> 119</BODY> 120</HTML> 121