1<html> 2<head><title>smfi_chgheader</title></head> 3<body> 4<h1>smfi_chgheader</h1> 5 6<table border="0" cellspacing=4 cellpadding=4> 7<!---------- Synopsis -----------> 8<tr><th valign="top" align=left width=150>SYNOPSIS</th><td> 9<pre> 10#include <libmilter/mfapi.h> 11int smfi_chgheader( 12 SMFICTX *ctx, 13 char *headerf, 14 mi_int32 hdridx, 15 char *headerv 16); 17</pre> 18Change or delete a message header. 19</td></tr> 20 21<!----------- Description ----------> 22<tr><th valign="top" align=left>DESCRIPTION</th><td> 23<table border="1" cellspacing=1 cellpadding=4> 24<tr align="left" valign=top> 25<th width="80">Called When</th> 26<td>Called only from <a href="xxfi_eom.html">xxfi_eom</a>.</td> 27</tr> 28<tr align="left" valign=top> 29<th width="80">Effects</th> 30<td>Changes a header's value for the current message.</td> 31</tr> 32</table> 33 34<!----------- Arguments ----------> 35<tr><th valign="top" align=left>ARGUMENTS</th><td> 36 <table border="1" cellspacing=0> 37 <tr bgcolor="#dddddd"><th>Argument</th><th>Description</th></tr> 38 <tr valign="top"><td>ctx</td> 39 <td>Opaque context structure. 40 </td></tr> 41 <tr valign="top"><td>headerf</td> 42 <td>The header name, a non-NULL, null-terminated string. 43 </td></tr> 44 <tr valign="top"><td>hdridx</td> 45 <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. 46 </td></tr> 47 <tr valign="top"><td>headerv</td> 48 <td>The new value of the given header. headerv == NULL implies that the header should be deleted. 49 </td></tr> 50 </table> 51</td></tr> 52 53<!----------- Return values ----------> 54<tr> 55<th valign="top" align=left>RETURN VALUES</th> 56 57<td> 58smfi_chgheader will return MI_FAILURE if 59<ul><li>headerf is NULL 60 <li>Modifying headers in the current connection state is invalid. 61 <li>Memory allocation fails. 62 <li>A network error occurs. 63 <li>SMFIF_CHGHDRS was not set when <a href="smfi_register.html">smfi_register</a> was called. 64</ul> 65Otherwise, it returns MI_SUCCESS. 66</tr> 67 68<!----------- Notes ----------> 69<tr align="left" valign=top> 70<th>NOTES</th> 71<td> 72<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>. 73 <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>. 74 <li>For smfi_chgheader, filter order is important. <b>Later filters will see the header changes made by earlier ones.</b> 75 <li>Neither the name nor the value of the header is checked for 76 standards compliance. However, each line of the header must be under 77 2048 characters and should be under 998 characters. If longer headers 78 are needed, make them multi-line. To make a multi-line header, insert 79 a line feed (ASCII 0x0a, or <tt>\n</tt> in C) followed by at least 80 one whitespace character such as a space (ASCII 0x20) or tab (ASCII 0x09, 81 or <tt>\t</tt> in C). The line feed should NOT be preceded by a 82 carriage return (ASCII 0x0d); the MTA will add this automatically. 83 <b>It is the filter writer's responsibility to ensure that no standards 84 are violated.</b> 85</ul> 86</td> 87</tr> 88 89<!----------- Example code ----------> 90<tr> 91<th valign="top" align=left>EXAMPLE</th> 92 93<td> 94 <pre> 95 int ret; 96 SMFICTX *ctx; 97 98 ... 99 100 ret = smfi_chgheader(ctx, "Content-Type", 101 "multipart/mixed;\n\tboundary=\"foobar\""); 102 </pre> 103</td> 104</tr> 105 106</table> 107 108<hr size="1"> 109<font size="-1"> 110Copyright (c) 2000-2003 Sendmail, Inc. and its suppliers. 111All rights reserved. 112<br> 113By using this file, you agree to the terms and conditions set 114forth in the LICENSE. 115</font> 116</body> 117</html> 118