1d0cef73dSGregory Neil Shapiro<HTML> 2d0cef73dSGregory Neil Shapiro<HEAD><TITLE>smfi_addheader</TITLE></HEAD> 3d0cef73dSGregory Neil Shapiro<BODY> 4e92d3f3fSGregory Neil Shapiro<!-- 5*5dd76dd0SGregory Neil Shapiro$Id: smfi_addheader.html,v 1.21 2013/11/22 20:51:39 ca Exp $ 6e92d3f3fSGregory Neil Shapiro--> 7d0cef73dSGregory Neil Shapiro<H1>smfi_addheader</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_addheader( 1540266059SGregory Neil Shapiro SMFICTX *ctx, 1640266059SGregory Neil Shapiro char *headerf, 1740266059SGregory Neil Shapiro char *headerv 1840266059SGregory Neil Shapiro); 19d0cef73dSGregory Neil Shapiro</PRE> 2040266059SGregory Neil ShapiroAdd a header to the current message. 21d0cef73dSGregory Neil Shapiro</TD></TR> 2240266059SGregory Neil Shapiro 2340266059SGregory Neil Shapiro<!----------- Description ----------> 24d0cef73dSGregory Neil Shapiro<TR><TH valign="top" align=left>DESCRIPTION</TH><TD> 25d0cef73dSGregory Neil Shapiro<TABLE border="1" cellspacing=1 cellpadding=4> 26d0cef73dSGregory Neil Shapiro<TR align="left" valign=top> 27d0cef73dSGregory Neil Shapiro<TH width="80">Called When</TH> 28d0cef73dSGregory Neil Shapiro<TD>Called only from <A href="xxfi_eom.html">xxfi_eom</A>.</TD> 29d0cef73dSGregory Neil Shapiro</TR> 30d0cef73dSGregory Neil Shapiro<TR align="left" valign=top> 31d0cef73dSGregory Neil Shapiro<TH width="80">Effects</TH> 32d0cef73dSGregory Neil Shapiro<TD>Adds a header to the current message.</TD> 33d0cef73dSGregory Neil Shapiro</TR> 34d0cef73dSGregory Neil Shapiro</TABLE> 3540266059SGregory Neil Shapiro 3640266059SGregory Neil Shapiro<!----------- Arguments ----------> 37d0cef73dSGregory Neil Shapiro<TR><TH valign="top" align=left>ARGUMENTS</TH><TD> 38d0cef73dSGregory Neil Shapiro <TABLE border="1" cellspacing=0> 39d0cef73dSGregory Neil Shapiro <TR bgcolor="#dddddd"><TH>Argument</TH><TH>Description</TH></TR> 40d0cef73dSGregory Neil Shapiro <TR valign="top"><TD>ctx</TD> 41d0cef73dSGregory Neil Shapiro <TD>Opaque context structure. 42d0cef73dSGregory Neil Shapiro </TD></TR> 43d0cef73dSGregory Neil Shapiro <TR valign="top"><TD>headerf</TD> 44d0cef73dSGregory Neil Shapiro <TD>The header name, a non-NULL, null-terminated string. 45d0cef73dSGregory Neil Shapiro </TD></TR> 46d0cef73dSGregory Neil Shapiro <TR valign="top"><TD>headerv</TD> 47d0cef73dSGregory Neil Shapiro <TD>The header value to be added, a non-NULL, null-terminated string. 48d0cef73dSGregory Neil Shapiro This may be the empty string. 49d0cef73dSGregory Neil Shapiro </TD></TR> 50d0cef73dSGregory Neil Shapiro </TABLE> 51d0cef73dSGregory Neil Shapiro</TD></TR> 5240266059SGregory Neil Shapiro 5340266059SGregory Neil Shapiro<!----------- Return values ----------> 54d0cef73dSGregory Neil Shapiro<TR> 55d0cef73dSGregory Neil Shapiro<TH valign="top" align=left>RETURN VALUES</TH> 5640266059SGregory Neil Shapiro 57d0cef73dSGregory Neil Shapiro<TD>smfi_addheader returns MI_FAILURE if: 58d0cef73dSGregory Neil Shapiro<UL><LI>headerf or headerv is NULL. 59d0cef73dSGregory Neil Shapiro <LI>Adding headers in the current connection state is invalid. 60d0cef73dSGregory Neil Shapiro <LI>Memory allocation fails. 61d0cef73dSGregory Neil Shapiro <LI>A network error occurs. 62d0cef73dSGregory Neil Shapiro <LI>SMFIF_ADDHDRS was not set when <A href="smfi_register.html">smfi_register</A> was called. 63d0cef73dSGregory Neil Shapiro</UL> 6440266059SGregory Neil ShapiroOtherwise, it returns MI_SUCCESS. 65d0cef73dSGregory Neil Shapiro</TD> 66d0cef73dSGregory Neil Shapiro</TR> 6740266059SGregory Neil Shapiro 6840266059SGregory Neil Shapiro<!----------- Notes ----------> 69d0cef73dSGregory Neil Shapiro<TR align="left" valign=top> 70d0cef73dSGregory Neil Shapiro<TH>NOTES</TH> 71d0cef73dSGregory Neil Shapiro<TD> 72d0cef73dSGregory Neil Shapiro<UL><LI>smfi_addheader does not change a message's existing headers. 73d0cef73dSGregory Neil ShapiroTo change a header's current value, use 74d0cef73dSGregory Neil Shapiro<A HREF="smfi_chgheader.html">smfi_chgheader</A>. 75d0cef73dSGregory Neil Shapiro <LI>A filter which calls smfi_addheader must have set the SMFIF_ADDHDRS 76d0cef73dSGregory Neil Shapiro flag in the smfiDesc_str passed to 77d0cef73dSGregory Neil Shapiro <A href="smfi_register.html">smfi_register</A>. 78d0cef73dSGregory Neil Shapiro <LI>For smfi_addheader, filter order is important. 79d0cef73dSGregory Neil Shapiro <B>Later filters will see the header changes made by earlier ones.</B> 80d0cef73dSGregory Neil Shapiro <LI>Neither the name nor the value of the header is checked for 81d0cef73dSGregory Neil Shapiro standards compliance. 82d0cef73dSGregory Neil Shapiro However, each line of the header must be under 2048 characters 83d0cef73dSGregory Neil Shapiro and should be under 998 characters. 84d0cef73dSGregory Neil Shapiro If longer headers are needed, make them multi-line. 85d0cef73dSGregory Neil Shapiro To make a multi-line header, 86d0cef73dSGregory Neil Shapiro insert a line feed (ASCII 0x0a, or <TT>\n</TT> in C) 87d0cef73dSGregory Neil Shapiro followed by at least one whitespace character 88d0cef73dSGregory Neil Shapiro such as a space (ASCII 0x20) or tab (ASCII 0x09, or <TT>\t</TT> in C). 89d0cef73dSGregory Neil Shapiro The line feed should NOT be preceded by a carriage return (ASCII 0x0d); 90d0cef73dSGregory Neil Shapiro the MTA will add this automatically. 91d0cef73dSGregory Neil Shapiro <B>It is the filter writer's responsibility to ensure that no standards 92d0cef73dSGregory Neil Shapiro are violated.</B> 939bd497b8SGregory Neil Shapiro <LI>The MTA adds a leading space to an added header value unless 949bd497b8SGregory Neil Shapiro the flag 959bd497b8SGregory Neil Shapiro<A HREF="xxfi_negotiate.html#SMFIP_HDR_LEADSPC"><CODE>SMFIP_HDR_LEADSPC</CODE></A> 969bd497b8SGregory Neil Shapiro is set, in which case the milter 979bd497b8SGregory Neil Shapiro must include any desired leading spaces itself. 98d0cef73dSGregory Neil Shapiro</UL> 99d0cef73dSGregory Neil Shapiro</TD> 100d0cef73dSGregory Neil Shapiro</TR> 10140266059SGregory Neil Shapiro 10294c01205SGregory Neil Shapiro<!----------- Example code ----------> 103d0cef73dSGregory Neil Shapiro<TR> 104d0cef73dSGregory Neil Shapiro<TH valign="top" align=left>EXAMPLE</TH> 10594c01205SGregory Neil Shapiro 106d0cef73dSGregory Neil Shapiro<TD> 107d0cef73dSGregory Neil Shapiro <PRE> 10894c01205SGregory Neil Shapiro int ret; 10994c01205SGregory Neil Shapiro SMFICTX *ctx; 11094c01205SGregory Neil Shapiro 11194c01205SGregory Neil Shapiro ... 11294c01205SGregory Neil Shapiro 11394c01205SGregory Neil Shapiro ret = smfi_addheader(ctx, "Content-Type", 11494c01205SGregory Neil Shapiro "multipart/mixed;\n\tboundary=\"foobar\""); 115d0cef73dSGregory Neil Shapiro </PRE> 116d0cef73dSGregory Neil Shapiro</TD> 117d0cef73dSGregory Neil Shapiro</TR> 11894c01205SGregory Neil Shapiro 119d0cef73dSGregory Neil Shapiro</TABLE> 12040266059SGregory Neil Shapiro 121d0cef73dSGregory Neil Shapiro<HR size="1"> 122d0cef73dSGregory Neil Shapiro<FONT size="-1"> 123*5dd76dd0SGregory Neil ShapiroCopyright (c) 2000-2003, 2006, 2009 Proofpoint, Inc. and its suppliers. 12440266059SGregory Neil ShapiroAll rights reserved. 125d0cef73dSGregory Neil Shapiro<BR> 12640266059SGregory Neil ShapiroBy using this file, you agree to the terms and conditions set 1275ef517c0SGregory Neil Shapiroforth in the LICENSE. 128d0cef73dSGregory Neil Shapiro</FONT> 129d0cef73dSGregory Neil Shapiro</BODY> 130d0cef73dSGregory Neil Shapiro</HTML> 131