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