headers.texi
3.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
So far we plan support for RFC822 and plan for RFC1522. with RFC1522 non ASCII
characters will be encoded.
@section Init/Destroy
The header should be initiliaze before any use.
@deftypefun int header_init (header_t *@var{hdr}, const char *@var{blurb}, size_t @var{len}, int @var{flag})
Initialize a @var{hdr} to a supported type. If @var{blurb} is not NULL, it is
parsed. @var{Flag} can be set to RFC8222 or RFC1522 so far onlyr rfc822 is
supported.
@defmac MU_HDR_RFC822
Supports rfc 822, header style.
@end defmac
@defmac MU_HDR_RFC1522
Supports rfc 1522, encoding policy.
@end defmac
@end deftypefun
@deftypefun void header_destroy (header_t *@var{hdr})
The ressources allocate 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 replace, if zero
it is append.
Some basic macros is already provided for rfc822.
@defmac MU_HDR_UNIX_FROM
"From "
@end defmac
@defmac MU_HDR_RETURN_PATH
"Return-Path"
@end defmac
@defmac MU_HDR_RECEIVED
"Received"
@end defmac
@defmac MU_HDR_DATE
"Date"
@end defmac
@defmac MU_HDR_FROM
"From"
@end defmac
@defmac MU_HDR_RESENT_FROM
"Resent-From"
@end defmac
@defmac MU_HDR_SUBJECT
"Subject"
@end defmac
@defmac MU_HDR_SENDER
"Sender"
@end defmac
@defmac MU_HDR_RESENT_SENDER
"Resent-SENDER"
@end defmac
@defmac MU_HDR_TOs
"To"
@end defmac
@defmac MU_HDR_RESENT_TO
"Resent-To"
@end defmac
@defmac MU_HDR_CC
"Cc"
@end defmac
@defmac MU_HDR_RESENT_CC
"Resent-Cc"
@end defmac
@defmac MU_HDR_BCC
"Bcc"
@end defmac
@defmac MU_HDR_RESENT_BCC
"Resent-Bcc"
@end defmac
@defmac MU_HDR_REPLY_TO
"Reply-To"
@end defmac
@defmac MU_HDR_RESENT_REPLY_TO
"Resent-Reply-To"
@end defmac
@defmac MU_HDR_MESSAGE_ID
"Message-ID"
@end defmac
@defmac MU_HDR_RESENT_MESSAGE_ID
"Resent-Message-ID"
@end defmac
@defmac MU_HDR_IN_REPLY_TO
"In-Reply-To"
@end defmac
@defmac MU_HDR_ENCRYPTED
"Encrypted"
@end defmac
@defmac MU_HDR_PRECEDENCE
"Precedence"
@end defmac
@defmac MU_HDR_STATUS
"Status"
@end defmac
@defmac MU_HDR_CONTENT_LENGTH
"Content-Length"
@end defmac
@defmac MU_HDR_CONTENT_TYPE
"Content-Type"
@end defmac
@defmac MU_HDR_MIME_VERSION
"MIME-Version"
@end defmac
@end deftypefun
@deftypefun int header_get_value (header_t @var{hdr}, const char *fn, char *fv, size_t len, size_t *n)
Value of field-name @var{fn} is return in buffer @var{fv} of size @var{len}.
The number of bytes written is put in @var{n}.
@end deftypefun
@deftypefun int header_get_mvalue (header_t @var{hdr}, const char *fn, char **fv, size_t *n)
Value of field-name @var{fn} is return in allocated buffer @var{fn} from
@code{malloc(3)}. The number of bytes written is put in @var{n}.
@end deftypefun
@deftypefun int header_gvalue (const char *@var{blurb}, size_t @var{bl}, const char *@var{fn}, char *@var{fv}, size_t @var{len}, size_t *@var{n})
Field-name @var{fn} is extract form @var{blurb} of size @var{bl} and put in
buffer @var{fv} of size @var{len}.
The number of bytes written is put in @var{n}.
@end deftypefun
@deftypefun int header_gmvalue (const char *@var{blurb}, size_t @var{bl}, const char *@var{fn}, char **@var{fv}, size_t *@var{nv})
Field-name @var{fn} is extract form @var{blurb} of size @var{bl} and put in
@code{malloc(3)}ted buffer @var{fv}. The number of bytes written is put in
@var{n}.
@end deftypefun
@section Headers Regex
@cindex Headers Regex
Using regular expression ?