1d0cef73dSGregory Neil Shapiro<HTML> 2d0cef73dSGregory Neil Shapiro<HEAD><TITLE>smfi_chgheader</TITLE></HEAD> 3d0cef73dSGregory Neil Shapiro<BODY> 4e92d3f3fSGregory Neil Shapiro<!-- 5*5dd76dd0SGregory Neil Shapiro$Id: smfi_chgheader.html,v 1.19 2013/11/22 20:51:39 ca Exp $ 6e92d3f3fSGregory Neil Shapiro--> 7d0cef73dSGregory Neil Shapiro<H1>smfi_chgheader</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 <libmilter/mfapi.h> 1440266059SGregory Neil Shapiroint smfi_chgheader( 1540266059SGregory Neil Shapiro SMFICTX *ctx, 1640266059SGregory Neil Shapiro char *headerf, 1740266059SGregory Neil Shapiro mi_int32 hdridx, 1840266059SGregory Neil Shapiro char *headerv 1940266059SGregory Neil Shapiro); 20d0cef73dSGregory Neil Shapiro</PRE> 2140266059SGregory Neil ShapiroChange or delete a message header. 22d0cef73dSGregory Neil Shapiro</TD></TR> 2340266059SGregory Neil Shapiro 2440266059SGregory Neil Shapiro<!----------- Description ----------> 25d0cef73dSGregory Neil Shapiro<TR><TH valign="top" align=left>DESCRIPTION</TH><TD> 26d0cef73dSGregory Neil Shapiro<TABLE border="1" cellspacing=1 cellpadding=4> 27d0cef73dSGregory Neil Shapiro<TR align="left" valign=top> 28d0cef73dSGregory Neil Shapiro<TH width="80">Called When</TH> 29d0cef73dSGregory Neil Shapiro<TD>Called only from <A href="xxfi_eom.html">xxfi_eom</A>.</TD> 30d0cef73dSGregory Neil Shapiro</TR> 31d0cef73dSGregory Neil Shapiro<TR align="left" valign=top> 32d0cef73dSGregory Neil Shapiro<TH width="80">Effects</TH> 33d0cef73dSGregory Neil Shapiro<TD>Changes a header's value for the current message.</TD> 34d0cef73dSGregory Neil Shapiro</TR> 35d0cef73dSGregory Neil Shapiro</TABLE> 3640266059SGregory Neil Shapiro 3740266059SGregory Neil Shapiro<!----------- Arguments ----------> 38d0cef73dSGregory Neil Shapiro<TR><TH valign="top" align=left>ARGUMENTS</TH><TD> 39d0cef73dSGregory Neil Shapiro <TABLE border="1" cellspacing=0> 40d0cef73dSGregory Neil Shapiro <TR bgcolor="#dddddd"><TH>Argument</TH><TH>Description</TH></TR> 41d0cef73dSGregory Neil Shapiro <TR valign="top"><TD>ctx</TD> 42d0cef73dSGregory Neil Shapiro <TD>Opaque context structure. 43d0cef73dSGregory Neil Shapiro </TD></TR> 44d0cef73dSGregory Neil Shapiro <TR valign="top"><TD>headerf</TD> 45d0cef73dSGregory Neil Shapiro <TD>The header name, a non-NULL, null-terminated string. 46d0cef73dSGregory Neil Shapiro </TD></TR> 47d0cef73dSGregory Neil Shapiro <TR valign="top"><TD>hdridx</TD> 48d0cef73dSGregory Neil Shapiro <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. 49d0cef73dSGregory Neil Shapiro </TD></TR> 50d0cef73dSGregory Neil Shapiro <TR valign="top"><TD>headerv</TD> 51d0cef73dSGregory Neil Shapiro <TD>The new value of the given header. headerv == NULL implies that the header should be deleted. 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> 6140266059SGregory Neil Shapirosmfi_chgheader will return MI_FAILURE if 62d0cef73dSGregory Neil Shapiro<UL><LI>headerf is NULL 63d0cef73dSGregory Neil Shapiro <LI>Modifying headers in the current connection state is invalid. 64d0cef73dSGregory Neil Shapiro <LI>Memory allocation fails. 65d0cef73dSGregory Neil Shapiro <LI>A network error occurs. 66d0cef73dSGregory Neil Shapiro <LI>SMFIF_CHGHDRS was not set when <A href="smfi_register.html">smfi_register</A> was called. 67d0cef73dSGregory Neil Shapiro</UL> 6840266059SGregory Neil ShapiroOtherwise, it returns MI_SUCCESS. 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><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>. 76d0cef73dSGregory Neil Shapiro <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>. 77d0cef73dSGregory Neil Shapiro <LI>For smfi_chgheader, filter order is important. <B>Later filters will see the header changes made by earlier ones.</B> 78d0cef73dSGregory Neil Shapiro <LI>Neither the name nor the value of the header is checked for 7940266059SGregory Neil Shapiro standards compliance. However, each line of the header must be under 8040266059SGregory Neil Shapiro 2048 characters and should be under 998 characters. If longer headers 8194c01205SGregory Neil Shapiro are needed, make them multi-line. To make a multi-line header, insert 82d0cef73dSGregory Neil Shapiro a line feed (ASCII 0x0a, or <TT>\n</TT> in C) followed by at least 8394c01205SGregory Neil Shapiro one whitespace character such as a space (ASCII 0x20) or tab (ASCII 0x09, 84d0cef73dSGregory Neil Shapiro or <TT>\t</TT> in C). The line feed should NOT be preceded by a 8594c01205SGregory Neil Shapiro carriage return (ASCII 0x0d); the MTA will add this automatically. 86d0cef73dSGregory Neil Shapiro <B>It is the filter writer's responsibility to ensure that no standards 87d0cef73dSGregory Neil Shapiro are violated.</B> 889bd497b8SGregory Neil Shapiro <LI>The MTA adds a leading space to a header value unless 899bd497b8SGregory Neil Shapiro the flag 909bd497b8SGregory Neil Shapiro<A HREF="xxfi_negotiate.html#SMFIP_HDR_LEADSPC"><CODE>SMFIP_HDR_LEADSPC</CODE></A> 919bd497b8SGregory Neil Shapiro is set, in which case the milter 929bd497b8SGregory Neil Shapiro must include any desired leading spaces itself. 93d0cef73dSGregory Neil Shapiro</UL> 94d0cef73dSGregory Neil Shapiro</TD> 95d0cef73dSGregory Neil Shapiro</TR> 9640266059SGregory Neil Shapiro 9794c01205SGregory Neil Shapiro<!----------- Example code ----------> 98d0cef73dSGregory Neil Shapiro<TR> 99d0cef73dSGregory Neil Shapiro<TH valign="top" align=left>EXAMPLE</TH> 10094c01205SGregory Neil Shapiro 101d0cef73dSGregory Neil Shapiro<TD> 102d0cef73dSGregory Neil Shapiro <PRE> 10394c01205SGregory Neil Shapiro int ret; 10494c01205SGregory Neil Shapiro SMFICTX *ctx; 10594c01205SGregory Neil Shapiro 10694c01205SGregory Neil Shapiro ... 10794c01205SGregory Neil Shapiro 108a7ec597cSGregory Neil Shapiro ret = smfi_chgheader(ctx, "Content-Type", 1, 10994c01205SGregory Neil Shapiro "multipart/mixed;\n\tboundary=\"foobar\""); 110d0cef73dSGregory Neil Shapiro </PRE> 111d0cef73dSGregory Neil Shapiro</TD> 112d0cef73dSGregory Neil Shapiro</TR> 11394c01205SGregory Neil Shapiro 114d0cef73dSGregory Neil Shapiro</TABLE> 11540266059SGregory Neil Shapiro 116d0cef73dSGregory Neil Shapiro<HR size="1"> 117d0cef73dSGregory Neil Shapiro<FONT size="-1"> 118*5dd76dd0SGregory Neil ShapiroCopyright (c) 2000-2003, 2009 Proofpoint, Inc. and its suppliers. 11940266059SGregory Neil ShapiroAll rights reserved. 120d0cef73dSGregory Neil Shapiro<BR> 12140266059SGregory Neil ShapiroBy using this file, you agree to the terms and conditions set 1225ef517c0SGregory Neil Shapiroforth in the LICENSE. 123d0cef73dSGregory Neil Shapiro</FONT> 124d0cef73dSGregory Neil Shapiro</BODY> 125d0cef73dSGregory Neil Shapiro</HTML> 126