140266059SGregory Neil Shapiro<html> 240266059SGregory Neil Shapiro<head><title>smfi_addheader</title></head> 340266059SGregory Neil Shapiro<body> 440266059SGregory Neil Shapiro<h1>smfi_addheader</h1> 540266059SGregory Neil Shapiro 640266059SGregory Neil Shapiro<table border="0" cellspacing=4 cellpadding=4> 740266059SGregory Neil Shapiro<!---------- Synopsis -----------> 840266059SGregory Neil Shapiro<tr><th valign="top" align=left width=150>SYNOPSIS</th><td> 940266059SGregory Neil Shapiro<pre> 1040266059SGregory Neil Shapiro#include <libmilter/mfapi.h> 1140266059SGregory Neil Shapiroint smfi_addheader( 1240266059SGregory Neil Shapiro SMFICTX *ctx, 1340266059SGregory Neil Shapiro char *headerf, 1440266059SGregory Neil Shapiro char *headerv 1540266059SGregory Neil Shapiro); 1640266059SGregory Neil Shapiro</pre> 1740266059SGregory Neil ShapiroAdd a header to the current message. 1840266059SGregory Neil Shapiro</td></tr> 1940266059SGregory Neil Shapiro 2040266059SGregory Neil Shapiro<!----------- Description ----------> 2140266059SGregory Neil Shapiro<tr><th valign="top" align=left>DESCRIPTION</th><td> 2240266059SGregory Neil Shapiro<table border="1" cellspacing=1 cellpadding=4> 2340266059SGregory Neil Shapiro<tr align="left" valign=top> 2440266059SGregory Neil Shapiro<th width="80">Called When</th> 2540266059SGregory Neil Shapiro<td>Called only from <a href="xxfi_eom.html">xxfi_eom</a>.</td> 2640266059SGregory Neil Shapiro</tr> 2740266059SGregory Neil Shapiro<tr align="left" valign=top> 2840266059SGregory Neil Shapiro<th width="80">Effects</th> 2940266059SGregory Neil Shapiro<td>Adds a header to the current message.</td> 3040266059SGregory Neil Shapiro</tr> 3140266059SGregory Neil Shapiro</table> 3240266059SGregory Neil Shapiro 3340266059SGregory Neil Shapiro<!----------- Arguments ----------> 3440266059SGregory Neil Shapiro<tr><th valign="top" align=left>ARGUMENTS</th><td> 3540266059SGregory Neil Shapiro <table border="1" cellspacing=0> 3640266059SGregory Neil Shapiro <tr bgcolor="#dddddd"><th>Argument</th><th>Description</th></tr> 3740266059SGregory Neil Shapiro <tr valign="top"><td>ctx</td> 3840266059SGregory Neil Shapiro <td>Opaque context structure. 3940266059SGregory Neil Shapiro </td></tr> 4040266059SGregory Neil Shapiro <tr valign="top"><td>headerf</td> 4140266059SGregory Neil Shapiro <td>The header name, a non-NULL, null-terminated string. 4240266059SGregory Neil Shapiro </td></tr> 4340266059SGregory Neil Shapiro <tr valign="top"><td>headerv</td> 4440266059SGregory Neil Shapiro <td>The header value to be added, a non-NULL, null-terminated string. This may be the empty string. 4540266059SGregory Neil Shapiro </td></tr> 4640266059SGregory Neil Shapiro </table> 4740266059SGregory Neil Shapiro</td></tr> 4840266059SGregory Neil Shapiro 4940266059SGregory Neil Shapiro<!----------- Return values ----------> 5040266059SGregory Neil Shapiro<tr> 5140266059SGregory Neil Shapiro<th valign="top" align=left>RETURN VALUES</th> 5240266059SGregory Neil Shapiro 5340266059SGregory Neil Shapiro<td>smfi_addheader returns MI_FAILURE if: 5440266059SGregory Neil Shapiro<ul><li>headerf or headerv is NULL. 5540266059SGregory Neil Shapiro <li>Adding headers in the current connection state is invalid. 5640266059SGregory Neil Shapiro <li>Memory allocation fails. 5740266059SGregory Neil Shapiro <li>A network error occurs. 5840266059SGregory Neil Shapiro <li>SMFIF_ADDHDRS was not set when <a href="smfi_register.html">smfi_register</a> was called. 5940266059SGregory Neil Shapiro</ul> 6040266059SGregory Neil ShapiroOtherwise, it returns MI_SUCCESS. 6140266059SGregory Neil Shapiro</td> 6240266059SGregory Neil Shapiro</tr> 6340266059SGregory Neil Shapiro 6440266059SGregory Neil Shapiro<!----------- Notes ----------> 6540266059SGregory Neil Shapiro<tr align="left" valign=top> 6640266059SGregory Neil Shapiro<th>NOTES</th> 6740266059SGregory Neil Shapiro<td> 6840266059SGregory Neil Shapiro<ul><li>smfi_addheader does not change a message's existing headers. 6940266059SGregory Neil ShapiroTo change a header's current value, use <a 7040266059SGregory Neil Shapirohref="smfi_chgheader.html">smfi_chgheader</a>. 7140266059SGregory Neil Shapiro <li>A filter which calls smfi_addheader must have set the SMFIF_ADDHDRS flag in the smfiDesc_str passed to <a href="smfi_register.html">smfi_register</a>. 7240266059SGregory Neil Shapiro <li>For smfi_chgheader, filter order is important. <b>Later filters will see the header changes made by earlier ones.</b> 7340266059SGregory Neil Shapiro <li>Neither the name nor the value of the header is checked for 7440266059SGregory Neil Shapiro standards compliance. However, each line of the header must be under 7540266059SGregory Neil Shapiro 2048 characters and should be under 998 characters. If longer headers 7694c01205SGregory Neil Shapiro are needed, make them multi-line. To make a multi-line header, insert 7794c01205SGregory Neil Shapiro a line feed (ASCII 0x0a, or <tt>\n</tt> in C) followed by at least 7894c01205SGregory Neil Shapiro one whitespace character such as a space (ASCII 0x20) or tab (ASCII 0x09, 7994c01205SGregory Neil Shapiro or <tt>\t</tt> in C). The line feed should NOT be preceded by a 8094c01205SGregory Neil Shapiro carriage return (ASCII 0x0d); the MTA will add this automatically. 8140266059SGregory Neil Shapiro <b>It is the filter writer's responsibility to ensure that no standards 8240266059SGregory Neil Shapiro are violated.</b> 8340266059SGregory Neil Shapiro</ul> 8440266059SGregory Neil Shapiro</td> 8540266059SGregory Neil Shapiro</tr> 8640266059SGregory Neil Shapiro 8794c01205SGregory Neil Shapiro<!----------- Example code ----------> 8894c01205SGregory Neil Shapiro<tr> 8994c01205SGregory Neil Shapiro<th valign="top" align=left>EXAMPLE</th> 9094c01205SGregory Neil Shapiro 9194c01205SGregory Neil Shapiro<td> 9294c01205SGregory Neil Shapiro <pre> 9394c01205SGregory Neil Shapiro int ret; 9494c01205SGregory Neil Shapiro SMFICTX *ctx; 9594c01205SGregory Neil Shapiro 9694c01205SGregory Neil Shapiro ... 9794c01205SGregory Neil Shapiro 9894c01205SGregory Neil Shapiro ret = smfi_addheader(ctx, "Content-Type", 9994c01205SGregory Neil Shapiro "multipart/mixed;\n\tboundary=\"foobar\""); 10094c01205SGregory Neil Shapiro </pre> 10194c01205SGregory Neil Shapiro</td> 10294c01205SGregory Neil Shapiro</tr> 10394c01205SGregory Neil Shapiro 10440266059SGregory Neil Shapiro</table> 10540266059SGregory Neil Shapiro 10640266059SGregory Neil Shapiro<hr size="1"> 10740266059SGregory Neil Shapiro<font size="-1"> 10894c01205SGregory Neil ShapiroCopyright (c) 2000-2002 Sendmail, Inc. and its suppliers. 10940266059SGregory Neil ShapiroAll rights reserved. 11040266059SGregory Neil Shapiro<br> 11140266059SGregory Neil ShapiroBy using this file, you agree to the terms and conditions set 11240266059SGregory Neil Shapiroforth in the <a href="LICENSE.txt">LICENSE</a>. 11340266059SGregory Neil Shapiro</font> 11440266059SGregory Neil Shapiro</body> 11540266059SGregory Neil Shapiro</html> 116