2007-04-08 21:38:51 -04:00
< HTML >
< HEAD > < TITLE > smfi_chgheader< / TITLE > < / HEAD >
< BODY >
2004-07-31 21:04:57 -04:00
<!--
2007-04-08 21:38:51 -04:00
$Id: smfi_chgheader.html,v 1.17 2006/12/21 18:30:35 ca Exp $
2004-07-31 21:04:57 -04:00
-->
2007-04-08 21:38:51 -04:00
< H1 > smfi_chgheader< / H1 >
2002-02-17 16:56:45 -05:00
2007-04-08 21:38:51 -04:00
< TABLE border = "0" cellspacing = 4 cellpadding = 4 >
2002-02-17 16:56:45 -05:00
<!-- - - - - - - - - Synopsis - - - - - - - - - -->
2007-04-08 21:38:51 -04:00
< TR > < TH valign = "top" align = left width = 100 > SYNOPSIS< / TH > < TD >
< PRE >
2002-02-17 16:56:45 -05:00
#include < libmilter/mfapi.h>
int smfi_chgheader(
SMFICTX *ctx,
char *headerf,
mi_int32 hdridx,
char *headerv
);
2007-04-08 21:38:51 -04:00
< / PRE >
2002-02-17 16:56:45 -05:00
Change or delete a message header.
2007-04-08 21:38:51 -04:00
< / TD > < / TR >
2002-02-17 16:56:45 -05:00
<!-- - - - - - - - - - Description - - - - - - - - -->
2007-04-08 21:38:51 -04:00
< TR > < TH valign = "top" align = left > DESCRIPTION< / TH > < TD >
< TABLE border = "1" cellspacing = 1 cellpadding = 4 >
< TR align = "left" valign = top >
< TH width = "80" > Called When< / TH >
< TD > Called only from < A href = "xxfi_eom.html" > xxfi_eom< / A > .< / TD >
< / TR >
< TR align = "left" valign = top >
< TH width = "80" > Effects< / TH >
< TD > Changes a header's value for the current message.< / TD >
< / TR >
< / TABLE >
2002-02-17 16:56:45 -05:00
<!-- - - - - - - - - - Arguments - - - - - - - - -->
2007-04-08 21:38:51 -04:00
< TR > < TH valign = "top" align = left > ARGUMENTS< / TH > < TD >
< TABLE border = "1" cellspacing = 0 >
< TR bgcolor = "#dddddd" > < TH > Argument< / TH > < TH > Description< / TH > < / TR >
< TR valign = "top" > < TD > ctx< / TD >
< TD > Opaque context structure.
< / TD > < / TR >
< TR valign = "top" > < TD > headerf< / TD >
< TD > The header name, a non-NULL, null-terminated string.
< / TD > < / TR >
< TR valign = "top" > < TD > hdridx< / TD >
< 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.
< / TD > < / TR >
< TR valign = "top" > < TD > headerv< / TD >
< TD > The new value of the given header. headerv == NULL implies that the header should be deleted.
< / TD > < / TR >
< / TABLE >
< / TD > < / TR >
2002-02-17 16:56:45 -05:00
<!-- - - - - - - - - - Return values - - - - - - - - -->
2007-04-08 21:38:51 -04:00
< TR >
< TH valign = "top" align = left > RETURN VALUES< / TH >
2002-02-17 16:56:45 -05:00
2007-04-08 21:38:51 -04:00
< TD >
2002-02-17 16:56:45 -05:00
smfi_chgheader will return MI_FAILURE if
2007-04-08 21:38:51 -04:00
< UL > < LI > headerf is NULL
< LI > Modifying headers in the current connection state is invalid.
< LI > Memory allocation fails.
< LI > A network error occurs.
< LI > SMFIF_CHGHDRS was not set when < A href = "smfi_register.html" > smfi_register< / A > was called.
< / UL >
2002-02-17 16:56:45 -05:00
Otherwise, it returns MI_SUCCESS.
2007-04-08 21:38:51 -04:00
< / TR >
2002-02-17 16:56:45 -05:00
<!-- - - - - - - - - - Notes - - - - - - - - -->
2007-04-08 21:38:51 -04:00
< TR align = "left" valign = top >
< TH > NOTES< / TH >
< TD >
< 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 > .
< 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 > .
< LI > For smfi_chgheader, filter order is important. < B > Later filters will see the header changes made by earlier ones.< / B >
< LI > Neither the name nor the value of the header is checked for
2002-02-17 16:56:45 -05:00
standards compliance. However, each line of the header must be under
2048 characters and should be under 998 characters. If longer headers
2002-06-11 17:12:04 -04:00
are needed, make them multi-line. To make a multi-line header, insert
2007-04-08 21:38:51 -04:00
a line feed (ASCII 0x0a, or < TT > \n< / TT > in C) followed by at least
2002-06-11 17:12:04 -04:00
one whitespace character such as a space (ASCII 0x20) or tab (ASCII 0x09,
2007-04-08 21:38:51 -04:00
or < TT > \t< / TT > in C). The line feed should NOT be preceded by a
2002-06-11 17:12:04 -04:00
carriage return (ASCII 0x0d); the MTA will add this automatically.
2007-04-08 21:38:51 -04:00
< B > It is the filter writer's responsibility to ensure that no standards
are violated.< / B >
< / UL >
< / TD >
< / TR >
2002-02-17 16:56:45 -05:00
2002-06-11 17:12:04 -04:00
<!-- - - - - - - - - - Example code - - - - - - - - -->
2007-04-08 21:38:51 -04:00
< TR >
< TH valign = "top" align = left > EXAMPLE< / TH >
2002-06-11 17:12:04 -04:00
2007-04-08 21:38:51 -04:00
< TD >
< PRE >
2002-06-11 17:12:04 -04:00
int ret;
SMFICTX *ctx;
...
2003-09-19 19:11:30 -04:00
ret = smfi_chgheader(ctx, "Content-Type", 1,
2002-06-11 17:12:04 -04:00
"multipart/mixed;\n\tboundary=\"foobar\"");
2007-04-08 21:38:51 -04:00
< / PRE >
< / TD >
< / TR >
2002-06-11 17:12:04 -04:00
2007-04-08 21:38:51 -04:00
< / TABLE >
2002-02-17 16:56:45 -05:00
2007-04-08 21:38:51 -04:00
< HR size = "1" >
< FONT size = "-1" >
2003-03-29 14:12:53 -05:00
Copyright (c) 2000-2003 Sendmail, Inc. and its suppliers.
2002-02-17 16:56:45 -05:00
All rights reserved.
2007-04-08 21:38:51 -04:00
< BR >
2002-02-17 16:56:45 -05:00
By using this file, you agree to the terms and conditions set
2003-03-29 14:12:53 -05:00
forth in the LICENSE.
2007-04-08 21:38:51 -04:00
< / FONT >
< / BODY >
< / HTML >