author | zautrix <zautrix> | 2004-07-03 16:33:12 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-07-03 16:33:12 (UTC) |
commit | e3b89230f065c48c84b48c88edb6eb088374c487 (patch) (unidiff) | |
tree | 162ea2ef909a6f82ccfcedf45d80d6c821174912 /kmicromail/libetpan/imf/mailimf.h | |
parent | 2dd6ac0b2d24c91d35ce674a6c26351352df2b15 (diff) | |
download | kdepimpi-e3b89230f065c48c84b48c88edb6eb088374c487.zip kdepimpi-e3b89230f065c48c84b48c88edb6eb088374c487.tar.gz kdepimpi-e3b89230f065c48c84b48c88edb6eb088374c487.tar.bz2 |
Initial revision
Diffstat (limited to 'kmicromail/libetpan/imf/mailimf.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kmicromail/libetpan/imf/mailimf.h | 345 |
1 files changed, 345 insertions, 0 deletions
diff --git a/kmicromail/libetpan/imf/mailimf.h b/kmicromail/libetpan/imf/mailimf.h new file mode 100644 index 0000000..3248e73 --- a/dev/null +++ b/kmicromail/libetpan/imf/mailimf.h | |||
@@ -0,0 +1,345 @@ | |||
1 | /* | ||
2 | * libEtPan! -- a mail stuff library | ||
3 | * | ||
4 | * Copyright (C) 2001, 2002 - DINH Viet Hoa | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * Redistribution and use in source and binary forms, with or without | ||
8 | * modification, are permitted provided that the following conditions | ||
9 | * are met: | ||
10 | * 1. Redistributions of source code must retain the above copyright | ||
11 | * notice, this list of conditions and the following disclaimer. | ||
12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer in the | ||
14 | * documentation and/or other materials provided with the distribution. | ||
15 | * 3. Neither the name of the libEtPan! project nor the names of its | ||
16 | * contributors may be used to endorse or promote products derived | ||
17 | * from this software without specific prior written permission. | ||
18 | * | ||
19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | ||
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||
23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
29 | * SUCH DAMAGE. | ||
30 | */ | ||
31 | |||
32 | /* | ||
33 | * $Id$ | ||
34 | */ | ||
35 | |||
36 | #ifndef MAILIMF_H | ||
37 | |||
38 | #define MAILIMF_H | ||
39 | |||
40 | #ifdef __cplusplus | ||
41 | extern "C" { | ||
42 | #endif | ||
43 | |||
44 | #include <libetpan/mailimf_types.h> | ||
45 | #include <libetpan/mailimf_write.h> | ||
46 | #include <libetpan/mailimf_types_helper.h> | ||
47 | |||
48 | #include <inttypes.h> | ||
49 | #include <sys/types.h> | ||
50 | |||
51 | /* | ||
52 | mailimf_message_parse will parse the given message | ||
53 | |||
54 | @param message this is a string containing the message content | ||
55 | @param length this is the size of the given string | ||
56 | @param index this is a pointer to the start of the message in | ||
57 | the given string, (* index) is modified to point at the end | ||
58 | of the parsed data | ||
59 | @param result the result of the parse operation is stored in | ||
60 | (* result) | ||
61 | |||
62 | @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error | ||
63 | */ | ||
64 | |||
65 | int mailimf_message_parse(const char * message, size_t length, | ||
66 | size_t * index, | ||
67 | struct mailimf_message ** result); | ||
68 | |||
69 | /* | ||
70 | mailimf_body_parse will parse the given text part of a message | ||
71 | |||
72 | @param message this is a string containing the message text part | ||
73 | @param length this is the size of the given string | ||
74 | @param index this is a pointer to the start of the message text part in | ||
75 | the given string, (* index) is modified to point at the end | ||
76 | of the parsed data | ||
77 | @param result the result of the parse operation is stored in | ||
78 | (* result) | ||
79 | |||
80 | @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error | ||
81 | */ | ||
82 | |||
83 | int mailimf_body_parse(const char * message, size_t length, | ||
84 | size_t * index, | ||
85 | struct mailimf_body ** result); | ||
86 | |||
87 | /* | ||
88 | mailimf_fields_parse will parse the given header fields | ||
89 | |||
90 | @param message this is a string containing the header fields | ||
91 | @param length this is the size of the given string | ||
92 | @param index this is a pointer to the start of the header fields in | ||
93 | the given string, (* index) is modified to point at the end | ||
94 | of the parsed data | ||
95 | @param result the result of the parse operation is stored in | ||
96 | (* result) | ||
97 | |||
98 | @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error | ||
99 | */ | ||
100 | |||
101 | int mailimf_fields_parse(const char * message, size_t length, | ||
102 | size_t * index, | ||
103 | struct mailimf_fields ** result); | ||
104 | |||
105 | /* | ||
106 | mailimf_mailbox_list_parse will parse the given mailbox list | ||
107 | |||
108 | @param message this is a string containing the mailbox list | ||
109 | @param length this is the size of the given string | ||
110 | @param index this is a pointer to the start of the mailbox list in | ||
111 | the given string, (* index) is modified to point at the end | ||
112 | of the parsed data | ||
113 | @param result the result of the parse operation is stored in | ||
114 | (* result) | ||
115 | |||
116 | @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error | ||
117 | */ | ||
118 | |||
119 | int | ||
120 | mailimf_mailbox_list_parse(const char * message, size_t length, | ||
121 | size_t * index, | ||
122 | struct mailimf_mailbox_list ** result); | ||
123 | |||
124 | /* | ||
125 | mailimf_address_list_parse will parse the given address list | ||
126 | |||
127 | @param message this is a string containing the address list | ||
128 | @param length this is the size of the given string | ||
129 | @param index this is a pointer to the start of the address list in | ||
130 | the given string, (* index) is modified to point at the end | ||
131 | of the parsed data | ||
132 | @param result the result of the parse operation is stored in | ||
133 | (* result) | ||
134 | |||
135 | @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error | ||
136 | */ | ||
137 | |||
138 | int | ||
139 | mailimf_address_list_parse(const char * message, size_t length, | ||
140 | size_t * index, | ||
141 | struct mailimf_address_list ** result); | ||
142 | |||
143 | /* | ||
144 | mailimf_address_parse will parse the given address | ||
145 | |||
146 | @param message this is a string containing the address | ||
147 | @param length this is the size of the given string | ||
148 | @param index this is a pointer to the start of the address in | ||
149 | the given string, (* index) is modified to point at the end | ||
150 | of the parsed data | ||
151 | @param result the result of the parse operation is stored in | ||
152 | (* result) | ||
153 | |||
154 | @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error | ||
155 | */ | ||
156 | |||
157 | int mailimf_address_parse(const char * message, size_t length, | ||
158 | size_t * index, | ||
159 | struct mailimf_address ** result); | ||
160 | |||
161 | /* | ||
162 | mailimf_mailbox_parse will parse the given address | ||
163 | |||
164 | @param message this is a string containing the mailbox | ||
165 | @param length this is the size of the given string | ||
166 | @param index this is a pointer to the start of the mailbox in | ||
167 | the given string, (* index) is modified to point at the end | ||
168 | of the parsed data | ||
169 | @param result the result of the parse operation is stored in | ||
170 | (* result) | ||
171 | |||
172 | @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error | ||
173 | */ | ||
174 | |||
175 | int mailimf_mailbox_parse(const char * message, size_t length, | ||
176 | size_t * index, | ||
177 | struct mailimf_mailbox ** result); | ||
178 | |||
179 | /* | ||
180 | mailimf_date_time_parse will parse the given RFC 2822 date | ||
181 | |||
182 | @param message this is a string containing the date | ||
183 | @param length this is the size of the given string | ||
184 | @param index this is a pointer to the start of the date in | ||
185 | the given string, (* index) is modified to point at the end | ||
186 | of the parsed data | ||
187 | @param result the result of the parse operation is stored in | ||
188 | (* result) | ||
189 | |||
190 | @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error | ||
191 | */ | ||
192 | |||
193 | int mailimf_date_time_parse(const char * message, size_t length, | ||
194 | size_t * index, | ||
195 | struct mailimf_date_time ** result); | ||
196 | |||
197 | /* | ||
198 | mailimf_envelope_fields_parse will parse the given fields (Date, | ||
199 | From, Sender, Reply-To, To, Cc, Bcc, Message-ID, In-Reply-To, | ||
200 | References and Subject) | ||
201 | |||
202 | @param message this is a string containing the header fields | ||
203 | @param length this is the size of the given string | ||
204 | @param index this is a pointer to the start of the header fields in | ||
205 | the given string, (* index) is modified to point at the end | ||
206 | of the parsed data | ||
207 | @param result the result of the parse operation is stored in | ||
208 | (* result) | ||
209 | |||
210 | @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error | ||
211 | */ | ||
212 | |||
213 | int mailimf_envelope_fields_parse(const char * message, size_t length, | ||
214 | size_t * index, | ||
215 | struct mailimf_fields ** result); | ||
216 | |||
217 | /* | ||
218 | mailimf_ignore_field_parse will skip the given field | ||
219 | |||
220 | @param message this is a string containing the header field | ||
221 | @param length this is the size of the given string | ||
222 | @param index this is a pointer to the start of the header field in | ||
223 | the given string, (* index) is modified to point at the end | ||
224 | of the parsed data | ||
225 | |||
226 | @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error | ||
227 | */ | ||
228 | |||
229 | |||
230 | int mailimf_ignore_field_parse(const char * message, size_t length, | ||
231 | size_t * index); | ||
232 | |||
233 | /* | ||
234 | mailimf_envelope_fields will parse the given fields (Date, | ||
235 | From, Sender, Reply-To, To, Cc, Bcc, Message-ID, In-Reply-To, | ||
236 | References and Subject), other fields will be added as optional | ||
237 | fields. | ||
238 | |||
239 | @param message this is a string containing the header fields | ||
240 | @param length this is the size of the given string | ||
241 | @param index this is a pointer to the start of the header fields in | ||
242 | the given string, (* index) is modified to point at the end | ||
243 | of the parsed data | ||
244 | @param result the result of the parse operation is stored in | ||
245 | (* result) | ||
246 | |||
247 | @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error | ||
248 | */ | ||
249 | |||
250 | |||
251 | int | ||
252 | mailimf_envelope_and_optional_fields_parse(const char * message, size_t length, | ||
253 | size_t * index, | ||
254 | struct mailimf_fields ** result); | ||
255 | |||
256 | /* | ||
257 | mailimf_envelope_fields will parse the given fields as optional | ||
258 | fields. | ||
259 | |||
260 | @param message this is a string containing the header fields | ||
261 | @param length this is the size of the given string | ||
262 | @param index this is a pointer to the start of the header fields in | ||
263 | the given string, (* index) is modified to point at the end | ||
264 | of the parsed data | ||
265 | @param result the result of the parse operation is stored in | ||
266 | (* result) | ||
267 | |||
268 | @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error | ||
269 | */ | ||
270 | |||
271 | int | ||
272 | mailimf_optional_fields_parse(const char * message, size_t length, | ||
273 | size_t * index, | ||
274 | struct mailimf_fields ** result); | ||
275 | |||
276 | |||
277 | /* internal use, exported for MIME */ | ||
278 | |||
279 | int mailimf_fws_parse(const char * message, size_t length, size_t * index); | ||
280 | |||
281 | int mailimf_cfws_parse(const char * message, size_t length, | ||
282 | size_t * index); | ||
283 | |||
284 | int mailimf_char_parse(const char * message, size_t length, | ||
285 | size_t * index, char token); | ||
286 | |||
287 | int mailimf_unstrict_char_parse(const char * message, size_t length, | ||
288 | size_t * index, char token); | ||
289 | |||
290 | int mailimf_crlf_parse(const char * message, size_t length, size_t * index); | ||
291 | |||
292 | int | ||
293 | mailimf_custom_string_parse(const char * message, size_t length, | ||
294 | size_t * index, char ** result, | ||
295 | int (* is_custom_char)(char)); | ||
296 | |||
297 | int | ||
298 | mailimf_token_case_insensitive_len_parse(const char * message, size_t length, | ||
299 | size_t * index, char * token, | ||
300 | size_t token_length); | ||
301 | |||
302 | #define mailimf_token_case_insensitive_parse(message, length, index, token) \ | ||
303 | mailimf_token_case_insensitive_len_parse(message, length, index, token, \ | ||
304 | sizeof(token) - 1) | ||
305 | |||
306 | int mailimf_quoted_string_parse(const char * message, size_t length, | ||
307 | size_t * index, char ** result); | ||
308 | |||
309 | int | ||
310 | mailimf_number_parse(const char * message, size_t length, | ||
311 | size_t * index, uint32_t * result); | ||
312 | |||
313 | int mailimf_msg_id_parse(const char * message, size_t length, | ||
314 | size_t * index, | ||
315 | char ** result); | ||
316 | |||
317 | int mailimf_msg_id_list_parse(const char * message, size_t length, | ||
318 | size_t * index, clist ** result); | ||
319 | |||
320 | int mailimf_word_parse(const char * message, size_t length, | ||
321 | size_t * index, char ** result); | ||
322 | |||
323 | int mailimf_atom_parse(const char * message, size_t length, | ||
324 | size_t * index, char ** result); | ||
325 | |||
326 | int mailimf_fws_atom_parse(const char * message, size_t length, | ||
327 | size_t * index, char ** result); | ||
328 | |||
329 | int mailimf_fws_word_parse(const char * message, size_t length, | ||
330 | size_t * index, char ** result); | ||
331 | |||
332 | int mailimf_fws_quoted_string_parse(const char * message, size_t length, | ||
333 | size_t * index, char ** result); | ||
334 | |||
335 | /* exported for IMAP */ | ||
336 | |||
337 | int mailimf_references_parse(const char * message, size_t length, | ||
338 | size_t * index, | ||
339 | struct mailimf_references ** result); | ||
340 | |||
341 | #ifdef __cplusplus | ||
342 | } | ||
343 | #endif | ||
344 | |||
345 | #endif | ||