1<HTML> 2<HEAD><TITLE>smfi_addheader</TITLE></HEAD> 3<BODY> 4<!-- 5$Id: smfi_addheader.html,v 1.21 2013-11-22 20:51:39 ca Exp $ 6--> 7<H1>smfi_addheader</H1> 8 9<TABLE border="0" cellspacing=4 cellpadding=4> 10<!---------- Synopsis -----------> 11<TR><TH valign="top" align=left width=100>SYNOPSIS</TH><TD> 12<PRE> 13#include <libmilter/mfapi.h> 14int smfi_addheader( 15 SMFICTX *ctx, 16 char *headerf, 17 char *headerv 18); 19</PRE> 20Add a header to the current message. 21</TD></TR> 22 23<!----------- Description ----------> 24<TR><TH valign="top" align=left>DESCRIPTION</TH><TD> 25<TABLE border="1" cellspacing=1 cellpadding=4> 26<TR align="left" valign=top> 27<TH width="80">Called When</TH> 28<TD>Called only from <A href="xxfi_eom.html">xxfi_eom</A>.</TD> 29</TR> 30<TR align="left" valign=top> 31<TH width="80">Effects</TH> 32<TD>Adds a header to the current message.</TD> 33</TR> 34</TABLE> 35 36<!----------- Arguments ----------> 37<TR><TH valign="top" align=left>ARGUMENTS</TH><TD> 38 <TABLE border="1" cellspacing=0> 39 <TR bgcolor="#dddddd"><TH>Argument</TH><TH>Description</TH></TR> 40 <TR valign="top"><TD>ctx</TD> 41 <TD>Opaque context structure. 42 </TD></TR> 43 <TR valign="top"><TD>headerf</TD> 44 <TD>The header name, a non-NULL, null-terminated string. 45 </TD></TR> 46 <TR valign="top"><TD>headerv</TD> 47 <TD>The header value to be added, a non-NULL, null-terminated string. 48 This may be the empty string. 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>smfi_addheader returns MI_FAILURE if: 58<UL><LI>headerf or headerv is NULL. 59 <LI>Adding headers in the current connection state is invalid. 60 <LI>Memory allocation fails. 61 <LI>A network error occurs. 62 <LI>SMFIF_ADDHDRS was not set when <A href="smfi_register.html">smfi_register</A> was called. 63</UL> 64Otherwise, it returns MI_SUCCESS. 65</TD> 66</TR> 67 68<!----------- Notes ----------> 69<TR align="left" valign=top> 70<TH>NOTES</TH> 71<TD> 72<UL><LI>smfi_addheader does not change a message's existing headers. 73To change a header's current value, use 74<A HREF="smfi_chgheader.html">smfi_chgheader</A>. 75 <LI>A filter which calls smfi_addheader must have set the SMFIF_ADDHDRS 76 flag in the smfiDesc_str passed to 77 <A href="smfi_register.html">smfi_register</A>. 78 <LI>For smfi_addheader, filter order is important. 79 <B>Later filters will see the header changes made by earlier ones.</B> 80 <LI>Neither the name nor the value of the header is checked for 81 standards compliance. 82 However, each line of the header must be under 2048 characters 83 and should be under 998 characters. 84 If longer headers are needed, make them multi-line. 85 To make a multi-line header, 86 insert a line feed (ASCII 0x0a, or <TT>\n</TT> in C) 87 followed by at least one whitespace character 88 such as a space (ASCII 0x20) or tab (ASCII 0x09, or <TT>\t</TT> in C). 89 The line feed should NOT be preceded by a carriage return (ASCII 0x0d); 90 the MTA will add this automatically. 91 <B>It is the filter writer's responsibility to ensure that no standards 92 are violated.</B> 93 <LI>The MTA adds a leading space to an added header value unless 94 the flag 95<A HREF="xxfi_negotiate.html#SMFIP_HDR_LEADSPC"><CODE>SMFIP_HDR_LEADSPC</CODE></A> 96 is set, in which case the milter 97 must include any desired leading spaces itself. 98</UL> 99</TD> 100</TR> 101 102<!----------- Example code ----------> 103<TR> 104<TH valign="top" align=left>EXAMPLE</TH> 105 106<TD> 107 <PRE> 108 int ret; 109 SMFICTX *ctx; 110 111 ... 112 113 ret = smfi_addheader(ctx, "Content-Type", 114 "multipart/mixed;\n\tboundary=\"foobar\""); 115 </PRE> 116</TD> 117</TR> 118 119</TABLE> 120 121<HR size="1"> 122<FONT size="-1"> 123Copyright (c) 2000-2003, 2006, 2009 Proofpoint, Inc. and its suppliers. 124All rights reserved. 125<BR> 126By using this file, you agree to the terms and conditions set 127forth in the LICENSE. 128</FONT> 129</BODY> 130</HTML> 131