1<HTML> 2<HEAD><TITLE>smfi_chgheader</TITLE></HEAD> 3<BODY> 4<!-- 5$Id: smfi_chgheader.html,v 1.19 2013-11-22 20:51:39 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 <LI>The MTA adds a leading space to a header value unless 89 the flag 90<A HREF="xxfi_negotiate.html#SMFIP_HDR_LEADSPC"><CODE>SMFIP_HDR_LEADSPC</CODE></A> 91 is set, in which case the milter 92 must include any desired leading spaces itself. 93</UL> 94</TD> 95</TR> 96 97<!----------- Example code ----------> 98<TR> 99<TH valign="top" align=left>EXAMPLE</TH> 100 101<TD> 102 <PRE> 103 int ret; 104 SMFICTX *ctx; 105 106 ... 107 108 ret = smfi_chgheader(ctx, "Content-Type", 1, 109 "multipart/mixed;\n\tboundary=\"foobar\""); 110 </PRE> 111</TD> 112</TR> 113 114</TABLE> 115 116<HR size="1"> 117<FONT size="-1"> 118Copyright (c) 2000-2003, 2009 Proofpoint, Inc. and its suppliers. 119All rights reserved. 120<BR> 121By using this file, you agree to the terms and conditions set 122forth in the LICENSE. 123</FONT> 124</BODY> 125</HTML> 126