headers.texi 2.74 KB
@c This is part of the GNU Mailutils manual.
@c Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
@c See file mailutils.texi for copying conditions.
@comment *******************************************************************

@smallexample
@code{/* Prefix @emph{header_} is reserved */}
@code{#include <mailutils/header.h>}

@end smallexample

So far we plan support for RFC822 and plan for RFC1522. with RFC1522 non ASCII
characters will be encoded.

@deftypefun int header_create (header_t *@var{hdr}, const char *@var{blurb}, size_t @var{len}, void *@var{owner})
Initialize a @var{hdr} to a supported type.  If @var{blurb} is not NULL, it is
parsed.
@end deftypefun

@deftypefun void header_destroy (header_t *@var{hdr}, void *@var{owner})
The resources allocated for @var{hdr} are freed.
@end deftypefun

@deftypefun int header_set_value (header_t @var{hdr}, const char *@var{fn}, const char *@var{fv}, size_t n, int @var{replace})
Set the field-name @var{fn} to field-value @var{fv} of size @var{n} in
@var{hdr}.  If @var{replace} is non-zero the initial value is replaced, if zero
it is appended.

Some basic macros are already provided for rfc822.

@table @code
@item MU_HEADER_RETURN_PATH
Return-Path
@item MU_HEADER_RECEIVED
Received
@item MU_HEADER_DATE
Date
@item MU_HEADER_FROM
From
@item MU_HEADER_RESENT_FROM
Resent-From
@item MU_HEADER_SUBJECT
Subject
@item MU_HEADER_SENDER
Sender
@item MU_HEADER_RESENT_SENDER
Resent-SENDER
@item MU_HEADER_TO
To
@item MU_HEADER_RESENT_TO
Resent-To
@item MU_HEADER_CC
Cc
@item MU_HEADER_RESENT_CC
Resent-Cc
@item MU_HEADER_BCC
Bcc
@item MU_HEADER_RESENT_BCC
Resent-Bcc
@item MU_HEADER_REPLY_TO
Reply-To
@item MU_HEADER_RESENT_REPLY_TO
Resent-Reply-To
@item MU_HEADER_MESSAGE_ID
Message-ID
@item MU_HEADER_RESENT_MESSAGE_ID
Resent-Message-ID
@item MU_HEADER_IN_REPLY_TO
In-Reply-To
@item MU_HEADER_ENCRYPTED
Encrypted
@item MU_HEADER_PRECEDENCE
Precedence
@item MU_HEADER_STATUS
Status
@item MU_HEADER_CONTENT_LENGTH
Content-Length
@item MU_HEADER_CONTENT_TYPE
Content-Type
@item MU_HEADER_MIME_VERSION
MIME-Version
@end table
@end deftypefun

@deftypefun int header_get_value (header_t @var{hdr}, const char *@var{fn}, char *@var{fv}, size_t @var{len}, size_t *@var{n})
Value of field-name @var{fn} is returned in buffer @var{fv} of size @var{len}.
The number of bytes written is put in @var{n}.
@end deftypefun

@deftypefun int header_aget_value (header_t @var{hdr}, const char *@var{fn}, char **@var{fv})
The value is allocated.
@end deftypefun

@deftypefun int header_get_stream (header_t @var{hdr}, stream_t *@var{pstream})
@end deftypefun

@deftypefun int header_set_size (header_t @var{hdr}, size_t *@var{size})
@end deftypefun

@deftypefun int header_set_lines (header_t @var{hdr}, size_t *@var{lpines})
@end deftypefun