Diffstat (limited to 'kmicromail/libetpan/include/libetpan/mailimf_types.h') (more/less context) (show whitespace changes)
-rw-r--r-- | kmicromail/libetpan/include/libetpan/mailimf_types.h | 793 |
1 files changed, 793 insertions, 0 deletions
diff --git a/kmicromail/libetpan/include/libetpan/mailimf_types.h b/kmicromail/libetpan/include/libetpan/mailimf_types.h new file mode 100644 index 0000000..288feb6 --- a/dev/null +++ b/kmicromail/libetpan/include/libetpan/mailimf_types.h | |||
@@ -0,0 +1,793 @@ | |||
1 | /* | ||
2 | * libEtPan! -- a mail stuff library | ||
3 | * | ||
4 | * Copyright (C) 2001 - 2003 - 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 | /* | ||
34 | * $Id$ | ||
35 | */ | ||
36 | |||
37 | #ifndef MAILIMF_TYPES_H | ||
38 | |||
39 | #define MAILIMF_TYPES_H | ||
40 | |||
41 | #ifdef __cplusplus | ||
42 | extern "C" { | ||
43 | #endif | ||
44 | |||
45 | #include <libetpan/clist.h> | ||
46 | #include <sys/types.h> | ||
47 | |||
48 | /* | ||
49 | IMPORTANT NOTE: | ||
50 | |||
51 | All allocation functions will take as argument allocated data | ||
52 | and will store these data in the structure they will allocate. | ||
53 | Data should be persistant during all the use of the structure | ||
54 | and will be freed by the free function of the structure | ||
55 | |||
56 | allocation functions will return NULL on failure | ||
57 | */ | ||
58 | |||
59 | /* | ||
60 | mailimf_date_time is a date | ||
61 | |||
62 | - day is the day of month (1 to 31) | ||
63 | |||
64 | - month (1 to 12) | ||
65 | |||
66 | - year (4 digits) | ||
67 | |||
68 | - hour (0 to 23) | ||
69 | |||
70 | - min (0 to 59) | ||
71 | |||
72 | - sec (0 to 59) | ||
73 | |||
74 | - zone (this is the decimal value that we can read, for example: | ||
75 | for "-0200", the value is -200) | ||
76 | */ | ||
77 | |||
78 | struct mailimf_date_time { | ||
79 | int dt_day; | ||
80 | int dt_month; | ||
81 | int dt_year; | ||
82 | int dt_hour; | ||
83 | int dt_min; | ||
84 | int dt_sec; | ||
85 | int dt_zone; | ||
86 | }; | ||
87 | |||
88 | struct mailimf_date_time * | ||
89 | mailimf_date_time_new(int dt_day, int dt_month, int dt_year, | ||
90 | int dt_hour, int dt_min, int dt_sec, int dt_zone); | ||
91 | |||
92 | void mailimf_date_time_free(struct mailimf_date_time * date_time); | ||
93 | |||
94 | |||
95 | |||
96 | /* this is the type of address */ | ||
97 | |||
98 | enum { | ||
99 | MAILIMF_ADDRESS_ERROR, /* on parse error */ | ||
100 | MAILIMF_ADDRESS_MAILBOX, /* if this is a mailbox (mailbox@domain) */ | ||
101 | MAILIMF_ADDRESS_GROUP, /* if this is a group | ||
102 | (group_name: address1@domain1, | ||
103 | address2@domain2; ) */ | ||
104 | }; | ||
105 | |||
106 | /* | ||
107 | mailimf_address is an address | ||
108 | |||
109 | - type can be MAILIMF_ADDRESS_MAILBOX or MAILIMF_ADDRESS_GROUP | ||
110 | |||
111 | - mailbox is a mailbox if type is MAILIMF_ADDRESS_MAILBOX | ||
112 | |||
113 | - group is a group if type is MAILIMF_ADDRESS_GROUP | ||
114 | */ | ||
115 | |||
116 | struct mailimf_address { | ||
117 | int ad_type; | ||
118 | union { | ||
119 | struct mailimf_mailbox * ad_mailbox; /* can be NULL */ | ||
120 | struct mailimf_group * ad_group; /* can be NULL */ | ||
121 | } ad_data; | ||
122 | }; | ||
123 | |||
124 | |||
125 | struct mailimf_address * | ||
126 | mailimf_address_new(int ad_type, struct mailimf_mailbox * ad_mailbox, | ||
127 | struct mailimf_group * ad_group); | ||
128 | |||
129 | void mailimf_address_free(struct mailimf_address * address); | ||
130 | |||
131 | |||
132 | |||
133 | /* | ||
134 | mailimf_mailbox is a mailbox | ||
135 | |||
136 | - display_name is the name that will be displayed for this mailbox, | ||
137 | for example 'name' in '"name" <mailbox@domain>, | ||
138 | should be allocated with malloc() | ||
139 | |||
140 | - addr_spec is the mailbox, for example 'mailbox@domain' | ||
141 | in '"name" <mailbox@domain>, should be allocated with malloc() | ||
142 | */ | ||
143 | |||
144 | struct mailimf_mailbox { | ||
145 | char * mb_display_name; /* can be NULL */ | ||
146 | char * mb_addr_spec; /* != NULL */ | ||
147 | }; | ||
148 | |||
149 | struct mailimf_mailbox * | ||
150 | mailimf_mailbox_new(char * mb_display_name, char * mb_addr_spec); | ||
151 | |||
152 | void mailimf_mailbox_free(struct mailimf_mailbox * mailbox); | ||
153 | |||
154 | |||
155 | |||
156 | /* | ||
157 | mailimf_group is a group | ||
158 | |||
159 | - display_name is the name that will be displayed for this group, | ||
160 | for example 'group_name' in | ||
161 | 'group_name: address1@domain1, address2@domain2;', should be allocated | ||
162 | with malloc() | ||
163 | |||
164 | - mb_list is a list of mailboxes | ||
165 | */ | ||
166 | |||
167 | struct mailimf_group { | ||
168 | char * grp_display_name; /* != NULL */ | ||
169 | struct mailimf_mailbox_list * grp_mb_list; /* can be NULL */ | ||
170 | }; | ||
171 | |||
172 | struct mailimf_group * | ||
173 | mailimf_group_new(char * grp_display_name, | ||
174 | struct mailimf_mailbox_list * grp_mb_list); | ||
175 | |||
176 | void mailimf_group_free(struct mailimf_group * group); | ||
177 | |||
178 | |||
179 | |||
180 | /* | ||
181 | mailimf_mailbox_list is a list of mailboxes | ||
182 | |||
183 | - list is a list of mailboxes | ||
184 | */ | ||
185 | |||
186 | struct mailimf_mailbox_list { | ||
187 | clist * mb_list; /* list of (struct mailimf_mailbox *), != NULL */ | ||
188 | }; | ||
189 | |||
190 | struct mailimf_mailbox_list * | ||
191 | mailimf_mailbox_list_new(clist * mb_list); | ||
192 | |||
193 | void mailimf_mailbox_list_free(struct mailimf_mailbox_list * mb_list); | ||
194 | |||
195 | |||
196 | |||
197 | /* | ||
198 | mailimf_address_list is a list of addresses | ||
199 | |||
200 | - list is a list of addresses | ||
201 | */ | ||
202 | |||
203 | struct mailimf_address_list { | ||
204 | clist * ad_list; /* list of (struct mailimf_address *), != NULL */ | ||
205 | }; | ||
206 | |||
207 | struct mailimf_address_list * | ||
208 | mailimf_address_list_new(clist * ad_list); | ||
209 | |||
210 | void mailimf_address_list_free(struct mailimf_address_list * addr_list); | ||
211 | |||
212 | |||
213 | |||
214 | |||
215 | |||
216 | /* | ||
217 | mailimf_body is the text part of a message | ||
218 | |||
219 | - text is the beginning of the text part, it is a substring | ||
220 | of an other string | ||
221 | |||
222 | - size is the size of the text part | ||
223 | */ | ||
224 | |||
225 | struct mailimf_body { | ||
226 | const char * bd_text; /* != NULL */ | ||
227 | size_t bd_size; | ||
228 | }; | ||
229 | |||
230 | struct mailimf_body * mailimf_body_new(const char * bd_text, size_t bd_size); | ||
231 | |||
232 | void mailimf_body_free(struct mailimf_body * body); | ||
233 | |||
234 | |||
235 | |||
236 | |||
237 | /* | ||
238 | mailimf_message is the content of the message | ||
239 | |||
240 | - msg_fields is the header fields of the message | ||
241 | |||
242 | - msg_body is the text part of the message | ||
243 | */ | ||
244 | |||
245 | struct mailimf_message { | ||
246 | struct mailimf_fields * msg_fields; /* != NULL */ | ||
247 | struct mailimf_body * msg_body; /* != NULL */ | ||
248 | }; | ||
249 | |||
250 | struct mailimf_message * | ||
251 | mailimf_message_new(struct mailimf_fields * msg_fields, | ||
252 | struct mailimf_body * msg_body); | ||
253 | |||
254 | void mailimf_message_free(struct mailimf_message * message); | ||
255 | |||
256 | |||
257 | |||
258 | |||
259 | /* | ||
260 | mailimf_fields is a list of header fields | ||
261 | |||
262 | - fld_list is a list of header fields | ||
263 | */ | ||
264 | |||
265 | struct mailimf_fields { | ||
266 | clist * fld_list; /* list of (struct mailimf_field *), != NULL */ | ||
267 | }; | ||
268 | |||
269 | struct mailimf_fields * mailimf_fields_new(clist * fld_list); | ||
270 | |||
271 | void mailimf_fields_free(struct mailimf_fields * fields); | ||
272 | |||
273 | |||
274 | |||
275 | /* this is a type of field */ | ||
276 | |||
277 | enum { | ||
278 | MAILIMF_FIELD_NONE, /* on parse error */ | ||
279 | MAILIMF_FIELD_RETURN_PATH, /* Return-Path */ | ||
280 | MAILIMF_FIELD_RESENT_DATE, /* Resent-Date */ | ||
281 | MAILIMF_FIELD_RESENT_FROM, /* Resent-From */ | ||
282 | MAILIMF_FIELD_RESENT_SENDER, /* Resent-Sender */ | ||
283 | MAILIMF_FIELD_RESENT_TO, /* Resent-To */ | ||
284 | MAILIMF_FIELD_RESENT_CC, /* Resent-Cc */ | ||
285 | MAILIMF_FIELD_RESENT_BCC, /* Resent-Bcc */ | ||
286 | MAILIMF_FIELD_RESENT_MSG_ID, /* Resent-Message-ID */ | ||
287 | MAILIMF_FIELD_ORIG_DATE, /* Date */ | ||
288 | MAILIMF_FIELD_FROM, /* From */ | ||
289 | MAILIMF_FIELD_SENDER, /* Sender */ | ||
290 | MAILIMF_FIELD_REPLY_TO, /* Reply-To */ | ||
291 | MAILIMF_FIELD_TO, /* To */ | ||
292 | MAILIMF_FIELD_CC, /* Cc */ | ||
293 | MAILIMF_FIELD_BCC, /* Bcc */ | ||
294 | MAILIMF_FIELD_MESSAGE_ID, /* Message-ID */ | ||
295 | MAILIMF_FIELD_IN_REPLY_TO, /* In-Reply-To */ | ||
296 | MAILIMF_FIELD_REFERENCES, /* References */ | ||
297 | MAILIMF_FIELD_SUBJECT, /* Subject */ | ||
298 | MAILIMF_FIELD_COMMENTS, /* Comments */ | ||
299 | MAILIMF_FIELD_KEYWORDS, /* Keywords */ | ||
300 | MAILIMF_FIELD_OPTIONAL_FIELD, /* other field */ | ||
301 | }; | ||
302 | |||
303 | /* | ||
304 | mailimf_field is a field | ||
305 | |||
306 | - fld_type is the type of the field | ||
307 | |||
308 | - fld_data.fld_return_path is the parsed content of the Return-Path | ||
309 | field if type is MAILIMF_FIELD_RETURN_PATH | ||
310 | |||
311 | - fld_data.fld_resent_date is the parsed content of the Resent-Date field | ||
312 | if type is MAILIMF_FIELD_RESENT_DATE | ||
313 | |||
314 | - fld_data.fld_resent_from is the parsed content of the Resent-From field | ||
315 | |||
316 | - fld_data.fld_resent_sender is the parsed content of the Resent-Sender field | ||
317 | |||
318 | - fld_data.fld_resent_to is the parsed content of the Resent-To field | ||
319 | |||
320 | - fld_data.fld_resent_cc is the parsed content of the Resent-Cc field | ||
321 | |||
322 | - fld_data.fld_resent_bcc is the parsed content of the Resent-Bcc field | ||
323 | |||
324 | - fld_data.fld_resent_msg_id is the parsed content of the Resent-Message-ID | ||
325 | field | ||
326 | |||
327 | - fld_data.fld_orig_date is the parsed content of the Date field | ||
328 | |||
329 | - fld_data.fld_from is the parsed content of the From field | ||
330 | |||
331 | - fld_data.fld_sender is the parsed content of the Sender field | ||
332 | |||
333 | - fld_data.fld_reply_to is the parsed content of the Reply-To field | ||
334 | |||
335 | - fld_data.fld_to is the parsed content of the To field | ||
336 | |||
337 | - fld_data.fld_cc is the parsed content of the Cc field | ||
338 | |||
339 | - fld_data.fld_bcc is the parsed content of the Bcc field | ||
340 | |||
341 | - fld_data.fld_message_id is the parsed content of the Message-ID field | ||
342 | |||
343 | - fld_data.fld_in_reply_to is the parsed content of the In-Reply-To field | ||
344 | |||
345 | - fld_data.fld_references is the parsed content of the References field | ||
346 | |||
347 | - fld_data.fld_subject is the content of the Subject field | ||
348 | |||
349 | - fld_data.fld_comments is the content of the Comments field | ||
350 | |||
351 | - fld_data.fld_keywords is the parsed content of the Keywords field | ||
352 | |||
353 | - fld_data.fld_optional_field is an other field and is not parsed | ||
354 | */ | ||
355 | |||
356 | #define LIBETPAN_MAILIMF_FIELD_UNION | ||
357 | |||
358 | struct mailimf_field { | ||
359 | int fld_type; | ||
360 | union { | ||
361 | struct mailimf_return * fld_return_path; /* can be NULL */ | ||
362 | struct mailimf_orig_date * fld_resent_date; /* can be NULL */ | ||
363 | struct mailimf_from * fld_resent_from; /* can be NULL */ | ||
364 | struct mailimf_sender * fld_resent_sender; /* can be NULL */ | ||
365 | struct mailimf_to * fld_resent_to; /* can be NULL */ | ||
366 | struct mailimf_cc * fld_resent_cc; /* can be NULL */ | ||
367 | struct mailimf_bcc * fld_resent_bcc; /* can be NULL */ | ||
368 | struct mailimf_message_id * fld_resent_msg_id; /* can be NULL */ | ||
369 | struct mailimf_orig_date * fld_orig_date; /* can be NULL */ | ||
370 | struct mailimf_from * fld_from; /* can be NULL */ | ||
371 | struct mailimf_sender * fld_sender; /* can be NULL */ | ||
372 | struct mailimf_reply_to * fld_reply_to; /* can be NULL */ | ||
373 | struct mailimf_to * fld_to; /* can be NULL */ | ||
374 | struct mailimf_cc * fld_cc; /* can be NULL */ | ||
375 | struct mailimf_bcc * fld_bcc; /* can be NULL */ | ||
376 | struct mailimf_message_id * fld_message_id; /* can be NULL */ | ||
377 | struct mailimf_in_reply_to * fld_in_reply_to; /* can be NULL */ | ||
378 | struct mailimf_references * fld_references; /* can be NULL */ | ||
379 | struct mailimf_subject * fld_subject; /* can be NULL */ | ||
380 | struct mailimf_comments * fld_comments; /* can be NULL */ | ||
381 | struct mailimf_keywords * fld_keywords; /* can be NULL */ | ||
382 | struct mailimf_optional_field * fld_optional_field; /* can be NULL */ | ||
383 | } fld_data; | ||
384 | }; | ||
385 | |||
386 | struct mailimf_field * | ||
387 | mailimf_field_new(int fld_type, | ||
388 | struct mailimf_return * fld_return_path, | ||
389 | struct mailimf_orig_date * fld_resent_date, | ||
390 | struct mailimf_from * fld_resent_from, | ||
391 | struct mailimf_sender * fld_resent_sender, | ||
392 | struct mailimf_to * fld_resent_to, | ||
393 | struct mailimf_cc * fld_resent_cc, | ||
394 | struct mailimf_bcc * fld_resent_bcc, | ||
395 | struct mailimf_message_id * fld_resent_msg_id, | ||
396 | struct mailimf_orig_date * fld_orig_date, | ||
397 | struct mailimf_from * fld_from, | ||
398 | struct mailimf_sender * fld_sender, | ||
399 | struct mailimf_reply_to * fld_reply_to, | ||
400 | struct mailimf_to * fld_to, | ||
401 | struct mailimf_cc * fld_cc, | ||
402 | struct mailimf_bcc * fld_bcc, | ||
403 | struct mailimf_message_id * fld_message_id, | ||
404 | struct mailimf_in_reply_to * fld_in_reply_to, | ||
405 | struct mailimf_references * fld_references, | ||
406 | struct mailimf_subject * fld_subject, | ||
407 | struct mailimf_comments * fld_comments, | ||
408 | struct mailimf_keywords * fld_keywords, | ||
409 | struct mailimf_optional_field * fld_optional_field); | ||
410 | |||
411 | void mailimf_field_free(struct mailimf_field * field); | ||
412 | |||
413 | |||
414 | |||
415 | /* | ||
416 | mailimf_orig_date is the parsed Date field | ||
417 | |||
418 | - date_time is the parsed date | ||
419 | */ | ||
420 | |||
421 | struct mailimf_orig_date { | ||
422 | struct mailimf_date_time * dt_date_time; /* != NULL */ | ||
423 | }; | ||
424 | |||
425 | struct mailimf_orig_date * mailimf_orig_date_new(struct mailimf_date_time * | ||
426 | dt_date_time); | ||
427 | |||
428 | void mailimf_orig_date_free(struct mailimf_orig_date * orig_date); | ||
429 | |||
430 | |||
431 | |||
432 | |||
433 | /* | ||
434 | mailimf_from is the parsed From field | ||
435 | |||
436 | - mb_list is the parsed mailbox list | ||
437 | */ | ||
438 | |||
439 | struct mailimf_from { | ||
440 | struct mailimf_mailbox_list * frm_mb_list; /* != NULL */ | ||
441 | }; | ||
442 | |||
443 | struct mailimf_from * | ||
444 | mailimf_from_new(struct mailimf_mailbox_list * frm_mb_list); | ||
445 | |||
446 | void mailimf_from_free(struct mailimf_from * from); | ||
447 | |||
448 | |||
449 | |||
450 | /* | ||
451 | mailimf_sender is the parsed Sender field | ||
452 | |||
453 | - snd_mb is the parsed mailbox | ||
454 | */ | ||
455 | |||
456 | struct mailimf_sender { | ||
457 | struct mailimf_mailbox * snd_mb; /* != NULL */ | ||
458 | }; | ||
459 | |||
460 | struct mailimf_sender * mailimf_sender_new(struct mailimf_mailbox * snd_mb); | ||
461 | |||
462 | void mailimf_sender_free(struct mailimf_sender * sender); | ||
463 | |||
464 | |||
465 | |||
466 | |||
467 | /* | ||
468 | mailimf_reply_to is the parsed Reply-To field | ||
469 | |||
470 | - rt_addr_list is the parsed address list | ||
471 | */ | ||
472 | |||
473 | struct mailimf_reply_to { | ||
474 | struct mailimf_address_list * rt_addr_list; /* != NULL */ | ||
475 | }; | ||
476 | |||
477 | struct mailimf_reply_to * | ||
478 | mailimf_reply_to_new(struct mailimf_address_list * rt_addr_list); | ||
479 | |||
480 | void mailimf_reply_to_free(struct mailimf_reply_to * reply_to); | ||
481 | |||
482 | |||
483 | |||
484 | |||
485 | /* | ||
486 | mailimf_to is the parsed To field | ||
487 | |||
488 | - to_addr_list is the parsed address list | ||
489 | */ | ||
490 | |||
491 | struct mailimf_to { | ||
492 | struct mailimf_address_list * to_addr_list; /* != NULL */ | ||
493 | }; | ||
494 | |||
495 | struct mailimf_to * mailimf_to_new(struct mailimf_address_list * to_addr_list); | ||
496 | |||
497 | void mailimf_to_free(struct mailimf_to * to); | ||
498 | |||
499 | |||
500 | |||
501 | |||
502 | /* | ||
503 | mailimf_cc is the parsed Cc field | ||
504 | |||
505 | - cc_addr_list is the parsed addres list | ||
506 | */ | ||
507 | |||
508 | struct mailimf_cc { | ||
509 | struct mailimf_address_list * cc_addr_list; /* != NULL */ | ||
510 | }; | ||
511 | |||
512 | struct mailimf_cc * mailimf_cc_new(struct mailimf_address_list * cc_addr_list); | ||
513 | |||
514 | void mailimf_cc_free(struct mailimf_cc * cc); | ||
515 | |||
516 | |||
517 | |||
518 | |||
519 | /* | ||
520 | mailimf_bcc is the parsed Bcc field | ||
521 | |||
522 | - bcc_addr_list is the parsed addres list | ||
523 | */ | ||
524 | |||
525 | struct mailimf_bcc { | ||
526 | struct mailimf_address_list * bcc_addr_list; /* can be NULL */ | ||
527 | }; | ||
528 | |||
529 | struct mailimf_bcc * | ||
530 | mailimf_bcc_new(struct mailimf_address_list * bcc_addr_list); | ||
531 | |||
532 | void mailimf_bcc_free(struct mailimf_bcc * bcc); | ||
533 | |||
534 | |||
535 | |||
536 | /* | ||
537 | mailimf_message_id is the parsed Message-ID field | ||
538 | |||
539 | - mid_value is the message identifier | ||
540 | */ | ||
541 | |||
542 | struct mailimf_message_id { | ||
543 | char * mid_value; /* != NULL */ | ||
544 | }; | ||
545 | |||
546 | struct mailimf_message_id * mailimf_message_id_new(char * mid_value); | ||
547 | |||
548 | void mailimf_message_id_free(struct mailimf_message_id * message_id); | ||
549 | |||
550 | |||
551 | |||
552 | |||
553 | /* | ||
554 | mailimf_in_reply_to is the parsed In-Reply-To field | ||
555 | |||
556 | - mid_list is the list of message identifers | ||
557 | */ | ||
558 | |||
559 | struct mailimf_in_reply_to { | ||
560 | clist * mid_list; /* list of (char *), != NULL */ | ||
561 | }; | ||
562 | |||
563 | struct mailimf_in_reply_to * mailimf_in_reply_to_new(clist * mid_list); | ||
564 | |||
565 | void mailimf_in_reply_to_free(struct mailimf_in_reply_to * in_reply_to); | ||
566 | |||
567 | |||
568 | |||
569 | /* | ||
570 | mailimf_references is the parsed References field | ||
571 | |||
572 | - msg_id_list is the list of message identifiers | ||
573 | */ | ||
574 | |||
575 | struct mailimf_references { | ||
576 | clist * mid_list; /* list of (char *) */ | ||
577 | /* != NULL */ | ||
578 | }; | ||
579 | |||
580 | struct mailimf_references * mailimf_references_new(clist * mid_list); | ||
581 | |||
582 | void mailimf_references_free(struct mailimf_references * references); | ||
583 | |||
584 | |||
585 | |||
586 | /* | ||
587 | mailimf_subject is the parsed Subject field | ||
588 | |||
589 | - sbj_value is the value of the field | ||
590 | */ | ||
591 | |||
592 | struct mailimf_subject { | ||
593 | char * sbj_value; /* != NULL */ | ||
594 | }; | ||
595 | |||
596 | struct mailimf_subject * mailimf_subject_new(char * sbj_value); | ||
597 | |||
598 | void mailimf_subject_free(struct mailimf_subject * subject); | ||
599 | |||
600 | |||
601 | /* | ||
602 | mailimf_comments is the parsed Comments field | ||
603 | |||
604 | - cm_value is the value of the field | ||
605 | */ | ||
606 | |||
607 | struct mailimf_comments { | ||
608 | char * cm_value; /* != NULL */ | ||
609 | }; | ||
610 | |||
611 | struct mailimf_comments * mailimf_comments_new(char * cm_value); | ||
612 | |||
613 | void mailimf_comments_free(struct mailimf_comments * comments); | ||
614 | |||
615 | |||
616 | /* | ||
617 | mailimf_keywords is the parsed Keywords field | ||
618 | |||
619 | - kw_list is the list of keywords | ||
620 | */ | ||
621 | |||
622 | struct mailimf_keywords { | ||
623 | clist * kw_list; /* list of (char *), != NULL */ | ||
624 | }; | ||
625 | |||
626 | struct mailimf_keywords * mailimf_keywords_new(clist * kw_list); | ||
627 | |||
628 | void mailimf_keywords_free(struct mailimf_keywords * keywords); | ||
629 | |||
630 | |||
631 | /* | ||
632 | mailimf_return is the parsed Return-Path field | ||
633 | |||
634 | - ret_path is the parsed value of Return-Path | ||
635 | */ | ||
636 | |||
637 | struct mailimf_return { | ||
638 | struct mailimf_path * ret_path; /* != NULL */ | ||
639 | }; | ||
640 | |||
641 | struct mailimf_return * | ||
642 | mailimf_return_new(struct mailimf_path * ret_path); | ||
643 | |||
644 | void mailimf_return_free(struct mailimf_return * return_path); | ||
645 | |||
646 | |||
647 | /* | ||
648 | mailimf_path is the parsed value of Return-Path | ||
649 | |||
650 | - pt_addr_spec is a mailbox | ||
651 | */ | ||
652 | |||
653 | struct mailimf_path { | ||
654 | char * pt_addr_spec; /* can be NULL */ | ||
655 | }; | ||
656 | |||
657 | struct mailimf_path * mailimf_path_new(char * pt_addr_spec); | ||
658 | |||
659 | void mailimf_path_free(struct mailimf_path * path); | ||
660 | |||
661 | |||
662 | /* | ||
663 | mailimf_optional_field is a non-parsed field | ||
664 | |||
665 | - fld_name is the name of the field | ||
666 | |||
667 | - fld_value is the value of the field | ||
668 | */ | ||
669 | |||
670 | struct mailimf_optional_field { | ||
671 | char * fld_name; /* != NULL */ | ||
672 | char * fld_value; /* != NULL */ | ||
673 | }; | ||
674 | |||
675 | struct mailimf_optional_field * | ||
676 | mailimf_optional_field_new(char * fld_name, char * fld_value); | ||
677 | |||
678 | void mailimf_optional_field_free(struct mailimf_optional_field * opt_field); | ||
679 | |||
680 | |||
681 | /* | ||
682 | mailimf_fields is the native structure that IMF module will use, | ||
683 | this module will provide an easier structure to use when parsing fields. | ||
684 | |||
685 | mailimf_single_fields is an easier structure to get parsed fields, | ||
686 | rather than iteration over the list of fields | ||
687 | |||
688 | - fld_orig_date is the parsed "Date" field | ||
689 | |||
690 | - fld_from is the parsed "From" field | ||
691 | |||
692 | - fld_sender is the parsed "Sender "field | ||
693 | |||
694 | - fld_reply_to is the parsed "Reply-To" field | ||
695 | |||
696 | - fld_to is the parsed "To" field | ||
697 | |||
698 | - fld_cc is the parsed "Cc" field | ||
699 | |||
700 | - fld_bcc is the parsed "Bcc" field | ||
701 | |||
702 | - fld_message_id is the parsed "Message-ID" field | ||
703 | |||
704 | - fld_in_reply_to is the parsed "In-Reply-To" field | ||
705 | |||
706 | - fld_references is the parsed "References" field | ||
707 | |||
708 | - fld_subject is the parsed "Subject" field | ||
709 | |||
710 | - fld_comments is the parsed "Comments" field | ||
711 | |||
712 | - fld_keywords is the parsed "Keywords" field | ||
713 | */ | ||
714 | |||
715 | struct mailimf_single_fields { | ||
716 | struct mailimf_orig_date * fld_orig_date; /* can be NULL */ | ||
717 | struct mailimf_from * fld_from; /* can be NULL */ | ||
718 | struct mailimf_sender * fld_sender; /* can be NULL */ | ||
719 | struct mailimf_reply_to * fld_reply_to; /* can be NULL */ | ||
720 | struct mailimf_to * fld_to; /* can be NULL */ | ||
721 | struct mailimf_cc * fld_cc; /* can be NULL */ | ||
722 | struct mailimf_bcc * fld_bcc; /* can be NULL */ | ||
723 | struct mailimf_message_id * fld_message_id; /* can be NULL */ | ||
724 | struct mailimf_in_reply_to * fld_in_reply_to; /* can be NULL */ | ||
725 | struct mailimf_references * fld_references; /* can be NULL */ | ||
726 | struct mailimf_subject * fld_subject; /* can be NULL */ | ||
727 | struct mailimf_comments * fld_comments; /* can be NULL */ | ||
728 | struct mailimf_keywords * fld_keywords; /* can be NULL */ | ||
729 | }; | ||
730 | |||
731 | |||
732 | |||
733 | |||
734 | |||
735 | |||
736 | /* internal use */ | ||
737 | |||
738 | void mailimf_atom_free(char * atom); | ||
739 | |||
740 | void mailimf_dot_atom_free(char * dot_atom); | ||
741 | |||
742 | void mailimf_dot_atom_text_free(char * dot_atom); | ||
743 | |||
744 | void mailimf_quoted_string_free(char * quoted_string); | ||
745 | |||
746 | void mailimf_word_free(char * word); | ||
747 | |||
748 | void mailimf_phrase_free(char * phrase); | ||
749 | |||
750 | void mailimf_unstructured_free(char * unstructured); | ||
751 | |||
752 | void mailimf_angle_addr_free(char * angle_addr); | ||
753 | |||
754 | void mailimf_display_name_free(char * display_name); | ||
755 | |||
756 | void mailimf_addr_spec_free(char * addr_spec); | ||
757 | |||
758 | void mailimf_local_part_free(char * local_part); | ||
759 | |||
760 | void mailimf_domain_free(char * domain); | ||
761 | |||
762 | void mailimf_domain_literal_free(char * domain); | ||
763 | |||
764 | void mailimf_msg_id_free(char * msg_id); | ||
765 | |||
766 | void mailimf_id_left_free(char * id_left); | ||
767 | |||
768 | void mailimf_id_right_free(char * id_right); | ||
769 | |||
770 | void mailimf_no_fold_quote_free(char * nfq); | ||
771 | |||
772 | void mailimf_no_fold_literal_free(char * nfl); | ||
773 | |||
774 | void mailimf_field_name_free(char * field_name); | ||
775 | |||
776 | |||
777 | |||
778 | /* these are the possible returned error codes */ | ||
779 | |||
780 | enum { | ||
781 | MAILIMF_NO_ERROR = 0, | ||
782 | MAILIMF_ERROR_PARSE, | ||
783 | MAILIMF_ERROR_MEMORY, | ||
784 | MAILIMF_ERROR_INVAL, | ||
785 | MAILIMF_ERROR_FILE, | ||
786 | }; | ||
787 | |||
788 | |||
789 | #ifdef __cplusplus | ||
790 | } | ||
791 | #endif | ||
792 | |||
793 | #endif | ||