new Parser from Sam.
Showing
1 changed file
with
91 additions
and
0 deletions
include/mailutils/parse822.h
0 → 100644
1 | /* GNU mailutils - a suite of utilities for electronic mail | ||
2 | Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Library Public License as published by | ||
6 | the Free Software Foundation; either version 2, or (at your option) | ||
7 | any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU Library General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU Library General Public License | ||
15 | along with this program; if not, write to the Free Software | ||
16 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | ||
17 | |||
18 | /** | ||
19 | * Parses syntatic elements defined in RFC 822. | ||
20 | */ | ||
21 | |||
22 | #ifndef _MAILUTILS_PARSE822_H | ||
23 | #define _MAILUTILS_PARSE822_H | ||
24 | |||
25 | #include <mailutils/address.h> | ||
26 | |||
27 | #ifndef __P | ||
28 | # ifdef __STDC__ | ||
29 | # define __P(args) args | ||
30 | # else | ||
31 | # define __P(args) () | ||
32 | # endif | ||
33 | #endif /*__P */ | ||
34 | |||
35 | #ifdef __cplusplus | ||
36 | extern "C" { | ||
37 | #endif | ||
38 | |||
39 | /** | ||
40 | * Reads an RFC822 defined lexical token from an input. If some of | ||
41 | * the names seem strange, they are taken from the names as defined | ||
42 | * in the extended BNF of the RFC. | ||
43 | */ | ||
44 | |||
45 | /* From RFC 822, 3.3 Lexical Tokens */ | ||
46 | |||
47 | extern int parse822_is_char __P ((char c)); | ||
48 | extern int parse822_is_digit __P ((char c)); | ||
49 | extern int parse822_is_ctl __P ((char c)); | ||
50 | extern int parse822_is_space __P ((char c)); | ||
51 | extern int parse822_is_htab __P ((char c)); | ||
52 | extern int parse822_is_lwsp_char __P ((char c)); | ||
53 | extern int parse822_is_special __P ((char c)); | ||
54 | extern int parse822_is_atom_char __P ((char c)); | ||
55 | extern int parse822_is_q_text __P ((char c)); | ||
56 | extern int parse822_is_d_text __P ((char c)); | ||
57 | extern int parse822_is_smtp_q __P ((char c)); | ||
58 | |||
59 | extern int parse822_skip_ws __P ((const char** p, const char* e)); | ||
60 | extern int parse822_skip_comments __P ((const char** p, const char* e)); | ||
61 | |||
62 | extern int parse822_digits __P ((const char** p, const char* e, int min, int max, int* digits)); | ||
63 | extern int parse822_special __P ((const char** p, const char* e, char c)); | ||
64 | extern int parse822_comment __P ((const char** p, const char* e, char** comment)); | ||
65 | extern int parse822_atom __P ((const char** p, const char* e, char** atom)); | ||
66 | extern int parse822_quoted_pair __P ((const char** p, const char* e, char** qpair)); | ||
67 | extern int parse822_quoted_string __P ((const char** p, const char* e, char** qstr)); | ||
68 | extern int parse822_word __P ((const char** p, const char* e, char** word)); | ||
69 | extern int parse822_phrase __P ((const char** p, const char* e, char** phrase)); | ||
70 | |||
71 | /* From RFC 822, 6.1 Address Specification Syntax */ | ||
72 | |||
73 | extern int parse822_address_list __P ((address_t* a, const char* s)); | ||
74 | extern int parse822_mail_box __P ((const char** p, const char* e, address_t* a)); | ||
75 | extern int parse822_group __P ((const char** p, const char* e, address_t* a)); | ||
76 | extern int parse822_address __P ((const char** p, const char* e, address_t* a)); | ||
77 | extern int parse822_route_addr __P ((const char** p, const char* e, address_t* a)); | ||
78 | extern int parse822_route __P ((const char** p, const char* e, char** route)); | ||
79 | extern int parse822_addr_spec __P ((const char** p, const char* e, address_t* a)); | ||
80 | extern int parse822_local_part __P ((const char** p, const char* e, char** local_part)); | ||
81 | extern int parse822_domain __P ((const char** p, const char* e, char** domain)); | ||
82 | extern int parse822_sub_domain __P ((const char** p, const char* e, char** sub_domain)); | ||
83 | extern int parse822_domain_ref __P ((const char** p, const char* e, char** domain_ref)); | ||
84 | extern int parse822_domain_literal __P ((const char** p, const char* e, char** domain_literal)); | ||
85 | |||
86 | #ifdef __cplusplus | ||
87 | } | ||
88 | #endif | ||
89 | |||
90 | #endif /* _MAILUTILS_PARSE822_H */ | ||
91 |
-
Please register or sign in to post a comment