140266059SGregory Neil Shapiro<html> 240266059SGregory Neil Shapiro<head><title>smfi_chgheader</title></head> 340266059SGregory Neil Shapiro<body> 4e92d3f3fSGregory Neil Shapiro<!-- 5e92d3f3fSGregory Neil Shapiro$Id: smfi_chgheader.html,v 1.15 2003/04/30 22:10:53 ca Exp $ 6e92d3f3fSGregory Neil Shapiro--> 740266059SGregory Neil Shapiro<h1>smfi_chgheader</h1> 840266059SGregory Neil Shapiro 940266059SGregory Neil Shapiro<table border="0" cellspacing=4 cellpadding=4> 1040266059SGregory Neil Shapiro<!---------- Synopsis -----------> 1140266059SGregory Neil Shapiro<tr><th valign="top" align=left width=150>SYNOPSIS</th><td> 1240266059SGregory 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); 2040266059SGregory Neil Shapiro</pre> 2140266059SGregory Neil ShapiroChange or delete a message header. 2240266059SGregory Neil Shapiro</td></tr> 2340266059SGregory Neil Shapiro 2440266059SGregory Neil Shapiro<!----------- Description ----------> 2540266059SGregory Neil Shapiro<tr><th valign="top" align=left>DESCRIPTION</th><td> 2640266059SGregory Neil Shapiro<table border="1" cellspacing=1 cellpadding=4> 2740266059SGregory Neil Shapiro<tr align="left" valign=top> 2840266059SGregory Neil Shapiro<th width="80">Called When</th> 2940266059SGregory Neil Shapiro<td>Called only from <a href="xxfi_eom.html">xxfi_eom</a>.</td> 3040266059SGregory Neil Shapiro</tr> 3140266059SGregory Neil Shapiro<tr align="left" valign=top> 3240266059SGregory Neil Shapiro<th width="80">Effects</th> 3340266059SGregory Neil Shapiro<td>Changes a header's value for the current message.</td> 3440266059SGregory Neil Shapiro</tr> 3540266059SGregory Neil Shapiro</table> 3640266059SGregory Neil Shapiro 3740266059SGregory Neil Shapiro<!----------- Arguments ----------> 3840266059SGregory Neil Shapiro<tr><th valign="top" align=left>ARGUMENTS</th><td> 3940266059SGregory Neil Shapiro <table border="1" cellspacing=0> 4040266059SGregory Neil Shapiro <tr bgcolor="#dddddd"><th>Argument</th><th>Description</th></tr> 4140266059SGregory Neil Shapiro <tr valign="top"><td>ctx</td> 4240266059SGregory Neil Shapiro <td>Opaque context structure. 4340266059SGregory Neil Shapiro </td></tr> 4440266059SGregory Neil Shapiro <tr valign="top"><td>headerf</td> 4540266059SGregory Neil Shapiro <td>The header name, a non-NULL, null-terminated string. 4640266059SGregory Neil Shapiro </td></tr> 4740266059SGregory Neil Shapiro <tr valign="top"><td>hdridx</td> 4840266059SGregory 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. 4940266059SGregory Neil Shapiro </td></tr> 5040266059SGregory Neil Shapiro <tr valign="top"><td>headerv</td> 5140266059SGregory Neil Shapiro <td>The new value of the given header. headerv == NULL implies that the header should be deleted. 5240266059SGregory Neil Shapiro </td></tr> 5340266059SGregory Neil Shapiro </table> 5440266059SGregory Neil Shapiro</td></tr> 5540266059SGregory Neil Shapiro 5640266059SGregory Neil Shapiro<!----------- Return values ----------> 5740266059SGregory Neil Shapiro<tr> 5840266059SGregory Neil Shapiro<th valign="top" align=left>RETURN VALUES</th> 5940266059SGregory Neil Shapiro 6040266059SGregory Neil Shapiro<td> 6140266059SGregory Neil Shapirosmfi_chgheader will return MI_FAILURE if 6240266059SGregory Neil Shapiro<ul><li>headerf is NULL 6340266059SGregory Neil Shapiro <li>Modifying headers in the current connection state is invalid. 6440266059SGregory Neil Shapiro <li>Memory allocation fails. 6540266059SGregory Neil Shapiro <li>A network error occurs. 6640266059SGregory Neil Shapiro <li>SMFIF_CHGHDRS was not set when <a href="smfi_register.html">smfi_register</a> was called. 6740266059SGregory Neil Shapiro</ul> 6840266059SGregory Neil ShapiroOtherwise, it returns MI_SUCCESS. 6940266059SGregory Neil Shapiro</tr> 7040266059SGregory Neil Shapiro 7140266059SGregory Neil Shapiro<!----------- Notes ----------> 7240266059SGregory Neil Shapiro<tr align="left" valign=top> 7340266059SGregory Neil Shapiro<th>NOTES</th> 7440266059SGregory Neil Shapiro<td> 7540266059SGregory 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>. 7640266059SGregory 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>. 7740266059SGregory Neil Shapiro <li>For smfi_chgheader, filter order is important. <b>Later filters will see the header changes made by earlier ones.</b> 7840266059SGregory 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 8294c01205SGregory 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, 8494c01205SGregory 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. 8640266059SGregory Neil Shapiro <b>It is the filter writer's responsibility to ensure that no standards 8740266059SGregory Neil Shapiro are violated.</b> 8840266059SGregory Neil Shapiro</ul> 8940266059SGregory Neil Shapiro</td> 9040266059SGregory Neil Shapiro</tr> 9140266059SGregory Neil Shapiro 9294c01205SGregory Neil Shapiro<!----------- Example code ----------> 9394c01205SGregory Neil Shapiro<tr> 9494c01205SGregory Neil Shapiro<th valign="top" align=left>EXAMPLE</th> 9594c01205SGregory Neil Shapiro 9694c01205SGregory Neil Shapiro<td> 9794c01205SGregory Neil Shapiro <pre> 9894c01205SGregory Neil Shapiro int ret; 9994c01205SGregory Neil Shapiro SMFICTX *ctx; 10094c01205SGregory Neil Shapiro 10194c01205SGregory Neil Shapiro ... 10294c01205SGregory Neil Shapiro 103a7ec597cSGregory Neil Shapiro ret = smfi_chgheader(ctx, "Content-Type", 1, 10494c01205SGregory Neil Shapiro "multipart/mixed;\n\tboundary=\"foobar\""); 10594c01205SGregory Neil Shapiro </pre> 10694c01205SGregory Neil Shapiro</td> 10794c01205SGregory Neil Shapiro</tr> 10894c01205SGregory Neil Shapiro 10940266059SGregory Neil Shapiro</table> 11040266059SGregory Neil Shapiro 11140266059SGregory Neil Shapiro<hr size="1"> 11240266059SGregory Neil Shapiro<font size="-1"> 1135ef517c0SGregory Neil ShapiroCopyright (c) 2000-2003 Sendmail, Inc. and its suppliers. 11440266059SGregory Neil ShapiroAll rights reserved. 11540266059SGregory Neil Shapiro<br> 11640266059SGregory Neil ShapiroBy using this file, you agree to the terms and conditions set 1175ef517c0SGregory Neil Shapiroforth in the LICENSE. 11840266059SGregory Neil Shapiro</font> 11940266059SGregory Neil Shapiro</body> 12040266059SGregory Neil Shapiro</html> 121