Mercurial > dovecot > original-hg > dovecot-1.2
annotate src/lib-imap/imap-parser.h @ 9595:166a188f9165 HEAD
mbox: Fields weren't being added to cache file during message saving.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 30 Jul 2010 16:55:58 +0100 |
parents | c9d6ae6f10fe |
children |
rev | line source |
---|---|
6410
e4eb71ae8e96
Changed .h ifdef/defines to use <NAME>_H format.
Timo Sirainen <tss@iki.fi>
parents:
6351
diff
changeset
|
1 #ifndef IMAP_PARSER_H |
e4eb71ae8e96
Changed .h ifdef/defines to use <NAME>_H format.
Timo Sirainen <tss@iki.fi>
parents:
6351
diff
changeset
|
2 #define IMAP_PARSER_H |
0 | 3 |
5836
9f869a7a3d73
Changed imap-parser API to use standard arrays for lists instead of its own
Timo Sirainen <tss@iki.fi>
parents:
5835
diff
changeset
|
4 #include "array.h" |
9f869a7a3d73
Changed imap-parser API to use standard arrays for lists instead of its own
Timo Sirainen <tss@iki.fi>
parents:
5835
diff
changeset
|
5 |
6351
1d2b67440878
Renamed IS_ATOM_SPECIAL() to IS_ATOM_SPECIAL_INPUT() and added a new
Timo Sirainen <tss@iki.fi>
parents:
5838
diff
changeset
|
6 /* We use this macro to read atoms from input. It should probably contain |
1d2b67440878
Renamed IS_ATOM_SPECIAL() to IS_ATOM_SPECIAL_INPUT() and added a new
Timo Sirainen <tss@iki.fi>
parents:
5838
diff
changeset
|
7 everything some day, but for now we can't handle some input otherwise: |
1d2b67440878
Renamed IS_ATOM_SPECIAL() to IS_ATOM_SPECIAL_INPUT() and added a new
Timo Sirainen <tss@iki.fi>
parents:
5838
diff
changeset
|
8 |
1d2b67440878
Renamed IS_ATOM_SPECIAL() to IS_ATOM_SPECIAL_INPUT() and added a new
Timo Sirainen <tss@iki.fi>
parents:
5838
diff
changeset
|
9 ']' is required for parsing section (FETCH BODY[]) |
1d2b67440878
Renamed IS_ATOM_SPECIAL() to IS_ATOM_SPECIAL_INPUT() and added a new
Timo Sirainen <tss@iki.fi>
parents:
5838
diff
changeset
|
10 '%', '*' and ']' are valid list-chars for LIST patterns |
1d2b67440878
Renamed IS_ATOM_SPECIAL() to IS_ATOM_SPECIAL_INPUT() and added a new
Timo Sirainen <tss@iki.fi>
parents:
5838
diff
changeset
|
11 '\' is used in flags */ |
1d2b67440878
Renamed IS_ATOM_SPECIAL() to IS_ATOM_SPECIAL_INPUT() and added a new
Timo Sirainen <tss@iki.fi>
parents:
5838
diff
changeset
|
12 #define IS_ATOM_SPECIAL_INPUT(c) \ |
3488
f9a0db1ac3e8
And removed the other added atom-specials as well..
Timo Sirainen <tss@iki.fi>
parents:
3487
diff
changeset
|
13 ((c) == '(' || (c) == ')' || (c) == '{' || \ |
f9a0db1ac3e8
And removed the other added atom-specials as well..
Timo Sirainen <tss@iki.fi>
parents:
3487
diff
changeset
|
14 (c) == '"' || (c) <= 32 || (c) == 0x7f) |
3481
2d631ab1d90e
Updated IS_ATOM_SPECIAL() list and moved it to header file.
Timo Sirainen <tss@iki.fi>
parents:
1661
diff
changeset
|
15 |
6351
1d2b67440878
Renamed IS_ATOM_SPECIAL() to IS_ATOM_SPECIAL_INPUT() and added a new
Timo Sirainen <tss@iki.fi>
parents:
5838
diff
changeset
|
16 #define IS_ATOM_SPECIAL(c) \ |
1d2b67440878
Renamed IS_ATOM_SPECIAL() to IS_ATOM_SPECIAL_INPUT() and added a new
Timo Sirainen <tss@iki.fi>
parents:
5838
diff
changeset
|
17 (IS_ATOM_SPECIAL_INPUT(c) || \ |
1d2b67440878
Renamed IS_ATOM_SPECIAL() to IS_ATOM_SPECIAL_INPUT() and added a new
Timo Sirainen <tss@iki.fi>
parents:
5838
diff
changeset
|
18 (c) == ']' || (c) == '%' || (c) == '*' || (c) == '\\') |
1d2b67440878
Renamed IS_ATOM_SPECIAL() to IS_ATOM_SPECIAL_INPUT() and added a new
Timo Sirainen <tss@iki.fi>
parents:
5838
diff
changeset
|
19 |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
878
diff
changeset
|
20 enum imap_parser_flags { |
0 | 21 /* Set this flag if you wish to read only size of literal argument |
22 and not convert literal into string. Useful when you need to deal | |
23 with large literal sizes. The literal must be the last read | |
24 parameter. */ | |
444
85ab93a7693b
ImapArgList changed from linked list to array. easier to handle that way.
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
25 IMAP_PARSE_FLAG_LITERAL_SIZE = 0x01, |
85ab93a7693b
ImapArgList changed from linked list to array. easier to handle that way.
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
26 /* Don't remove '\' chars from string arguments */ |
85ab93a7693b
ImapArgList changed from linked list to array. easier to handle that way.
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
27 IMAP_PARSE_FLAG_NO_UNESCAPE = 0x02, |
1107
4044c2903ed7
Don't do x-unknown mime encoding. Correct way is to just send them as
Timo Sirainen <tss@iki.fi>
parents:
1023
diff
changeset
|
28 /* Return literals as IMAP_ARG_LITERAL instead of IMAP_ARG_STRING */ |
6889
3ec5a07d00f2
Added IMAP_PARSE_FLAG_ATOM_ALLCHARS.
Timo Sirainen <tss@iki.fi>
parents:
6739
diff
changeset
|
29 IMAP_PARSE_FLAG_LITERAL_TYPE = 0x04, |
3ec5a07d00f2
Added IMAP_PARSE_FLAG_ATOM_ALLCHARS.
Timo Sirainen <tss@iki.fi>
parents:
6739
diff
changeset
|
30 /* Don't check if atom contains invalid characters */ |
8837
c9d6ae6f10fe
imap-parser: Added IMAP_PARSE_FLAG_MULTILINE_STR flag.
Timo Sirainen <tss@iki.fi>
parents:
6889
diff
changeset
|
31 IMAP_PARSE_FLAG_ATOM_ALLCHARS = 0x08, |
c9d6ae6f10fe
imap-parser: Added IMAP_PARSE_FLAG_MULTILINE_STR flag.
Timo Sirainen <tss@iki.fi>
parents:
6889
diff
changeset
|
32 /* Allow strings to contain CRLFs */ |
c9d6ae6f10fe
imap-parser: Added IMAP_PARSE_FLAG_MULTILINE_STR flag.
Timo Sirainen <tss@iki.fi>
parents:
6889
diff
changeset
|
33 IMAP_PARSE_FLAG_MULTILINE_STR = 0x10 |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
878
diff
changeset
|
34 }; |
0 | 35 |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
878
diff
changeset
|
36 enum imap_arg_type { |
0 | 37 IMAP_ARG_NIL = 0, |
38 IMAP_ARG_ATOM, | |
39 IMAP_ARG_STRING, | |
1107
4044c2903ed7
Don't do x-unknown mime encoding. Correct way is to just send them as
Timo Sirainen <tss@iki.fi>
parents:
1023
diff
changeset
|
40 IMAP_ARG_LIST, |
4044c2903ed7
Don't do x-unknown mime encoding. Correct way is to just send them as
Timo Sirainen <tss@iki.fi>
parents:
1023
diff
changeset
|
41 |
4044c2903ed7
Don't do x-unknown mime encoding. Correct way is to just send them as
Timo Sirainen <tss@iki.fi>
parents:
1023
diff
changeset
|
42 /* literals are returned as IMAP_ARG_STRING by default */ |
4044c2903ed7
Don't do x-unknown mime encoding. Correct way is to just send them as
Timo Sirainen <tss@iki.fi>
parents:
1023
diff
changeset
|
43 IMAP_ARG_LITERAL, |
0 | 44 IMAP_ARG_LITERAL_SIZE, |
1022 | 45 IMAP_ARG_LITERAL_SIZE_NONSYNC, |
444
85ab93a7693b
ImapArgList changed from linked list to array. easier to handle that way.
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
46 |
85ab93a7693b
ImapArgList changed from linked list to array. easier to handle that way.
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
47 IMAP_ARG_EOL /* end of argument list */ |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
878
diff
changeset
|
48 }; |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
878
diff
changeset
|
49 |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
878
diff
changeset
|
50 struct imap_parser; |
0 | 51 |
5836
9f869a7a3d73
Changed imap-parser API to use standard arrays for lists instead of its own
Timo Sirainen <tss@iki.fi>
parents:
5835
diff
changeset
|
52 ARRAY_DEFINE_TYPE(imap_arg_list, struct imap_arg); |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
878
diff
changeset
|
53 struct imap_arg { |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
878
diff
changeset
|
54 enum imap_arg_type type; |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
878
diff
changeset
|
55 struct imap_arg *parent; /* always of type IMAP_ARG_LIST */ |
0 | 56 |
57 union { | |
5835
d59ed6a31b66
Added more consts to imap-parser API
Timo Sirainen <tss@iki.fi>
parents:
4823
diff
changeset
|
58 const char *str; |
50
d493b9cc265e
Introduced uoff_t which is the unsigned-equilevant of off_t. This was needed
Timo Sirainen <tss@iki.fi>
parents:
0
diff
changeset
|
59 uoff_t literal_size; |
5836
9f869a7a3d73
Changed imap-parser API to use standard arrays for lists instead of its own
Timo Sirainen <tss@iki.fi>
parents:
5835
diff
changeset
|
60 ARRAY_TYPE(imap_arg_list) list; |
877
7935347f54f1
Don't access ImapArg's union members directly - too easy to mess up. Fixes a
Timo Sirainen <tss@iki.fi>
parents:
768
diff
changeset
|
61 } _data; |
0 | 62 }; |
63 | |
5838
4906791b8256
Added IMAP_ARG_TYPE_IS_STRING()
Timo Sirainen <tss@iki.fi>
parents:
5836
diff
changeset
|
64 #define IMAP_ARG_TYPE_IS_STRING(type) \ |
4906791b8256
Added IMAP_ARG_TYPE_IS_STRING()
Timo Sirainen <tss@iki.fi>
parents:
5836
diff
changeset
|
65 ((type) == IMAP_ARG_ATOM || (type) == IMAP_ARG_STRING || \ |
4906791b8256
Added IMAP_ARG_TYPE_IS_STRING()
Timo Sirainen <tss@iki.fi>
parents:
5836
diff
changeset
|
66 (type) == IMAP_ARG_LITERAL) |
4906791b8256
Added IMAP_ARG_TYPE_IS_STRING()
Timo Sirainen <tss@iki.fi>
parents:
5836
diff
changeset
|
67 |
877
7935347f54f1
Don't access ImapArg's union members directly - too easy to mess up. Fixes a
Timo Sirainen <tss@iki.fi>
parents:
768
diff
changeset
|
68 #define IMAP_ARG_STR(arg) \ |
7935347f54f1
Don't access ImapArg's union members directly - too easy to mess up. Fixes a
Timo Sirainen <tss@iki.fi>
parents:
768
diff
changeset
|
69 ((arg)->type == IMAP_ARG_NIL ? NULL : \ |
5838
4906791b8256
Added IMAP_ARG_TYPE_IS_STRING()
Timo Sirainen <tss@iki.fi>
parents:
5836
diff
changeset
|
70 IMAP_ARG_TYPE_IS_STRING((arg)->type) ? \ |
6418
46d9ee79f292
Removed _ prefix from all public APIs.
Timo Sirainen <tss@iki.fi>
parents:
6411
diff
changeset
|
71 (arg)->_data.str : imap_arg_str_error(arg)) |
877
7935347f54f1
Don't access ImapArg's union members directly - too easy to mess up. Fixes a
Timo Sirainen <tss@iki.fi>
parents:
768
diff
changeset
|
72 |
3571 | 73 #define IMAP_ARG_STR_NONULL(arg) \ |
74 ((arg)->type == IMAP_ARG_ATOM || (arg)->type == IMAP_ARG_STRING || \ | |
75 (arg)->type == IMAP_ARG_LITERAL ? \ | |
6418
46d9ee79f292
Removed _ prefix from all public APIs.
Timo Sirainen <tss@iki.fi>
parents:
6411
diff
changeset
|
76 (arg)->_data.str : imap_arg_str_error(arg)) |
3571 | 77 |
877
7935347f54f1
Don't access ImapArg's union members directly - too easy to mess up. Fixes a
Timo Sirainen <tss@iki.fi>
parents:
768
diff
changeset
|
78 #define IMAP_ARG_LITERAL_SIZE(arg) \ |
1022 | 79 (((arg)->type == IMAP_ARG_LITERAL_SIZE || \ |
80 (arg)->type == IMAP_ARG_LITERAL_SIZE_NONSYNC) ? \ | |
6418
46d9ee79f292
Removed _ prefix from all public APIs.
Timo Sirainen <tss@iki.fi>
parents:
6411
diff
changeset
|
81 (arg)->_data.literal_size : imap_arg_literal_size_error(arg)) |
877
7935347f54f1
Don't access ImapArg's union members directly - too easy to mess up. Fixes a
Timo Sirainen <tss@iki.fi>
parents:
768
diff
changeset
|
82 |
7935347f54f1
Don't access ImapArg's union members directly - too easy to mess up. Fixes a
Timo Sirainen <tss@iki.fi>
parents:
768
diff
changeset
|
83 #define IMAP_ARG_LIST(arg) \ |
878
cc1cf8161203
Actually, don't allow NIL with IMAP_ARG_LIST().
Timo Sirainen <tss@iki.fi>
parents:
877
diff
changeset
|
84 ((arg)->type == IMAP_ARG_LIST ? \ |
6418
46d9ee79f292
Removed _ prefix from all public APIs.
Timo Sirainen <tss@iki.fi>
parents:
6411
diff
changeset
|
85 &(arg)->_data.list : imap_arg_list_error(arg)) |
5836
9f869a7a3d73
Changed imap-parser API to use standard arrays for lists instead of its own
Timo Sirainen <tss@iki.fi>
parents:
5835
diff
changeset
|
86 #define IMAP_ARG_LIST_ARGS(arg) \ |
9f869a7a3d73
Changed imap-parser API to use standard arrays for lists instead of its own
Timo Sirainen <tss@iki.fi>
parents:
5835
diff
changeset
|
87 array_idx(IMAP_ARG_LIST(arg), 0) |
9f869a7a3d73
Changed imap-parser API to use standard arrays for lists instead of its own
Timo Sirainen <tss@iki.fi>
parents:
5835
diff
changeset
|
88 #define IMAP_ARG_LIST_COUNT(arg) \ |
9f869a7a3d73
Changed imap-parser API to use standard arrays for lists instead of its own
Timo Sirainen <tss@iki.fi>
parents:
5835
diff
changeset
|
89 (array_count(IMAP_ARG_LIST(arg)) - 1) |
0 | 90 |
1591
6eca99b727a0
IMAP parser memory limits are now enforced by bytes per line rather than
Timo Sirainen <tss@iki.fi>
parents:
1107
diff
changeset
|
91 /* Create new IMAP argument parser. output is used for sending command |
6eca99b727a0
IMAP parser memory limits are now enforced by bytes per line rather than
Timo Sirainen <tss@iki.fi>
parents:
1107
diff
changeset
|
92 continuation requests for literals. |
6eca99b727a0
IMAP parser memory limits are now enforced by bytes per line rather than
Timo Sirainen <tss@iki.fi>
parents:
1107
diff
changeset
|
93 |
6eca99b727a0
IMAP parser memory limits are now enforced by bytes per line rather than
Timo Sirainen <tss@iki.fi>
parents:
1107
diff
changeset
|
94 max_line_size can be used to approximately limit the maximum amount of |
6eca99b727a0
IMAP parser memory limits are now enforced by bytes per line rather than
Timo Sirainen <tss@iki.fi>
parents:
1107
diff
changeset
|
95 memory that gets allocated when parsing a line. Input buffer size limits |
6eca99b727a0
IMAP parser memory limits are now enforced by bytes per line rather than
Timo Sirainen <tss@iki.fi>
parents:
1107
diff
changeset
|
96 the maximum size of each parsed token. |
6eca99b727a0
IMAP parser memory limits are now enforced by bytes per line rather than
Timo Sirainen <tss@iki.fi>
parents:
1107
diff
changeset
|
97 |
6eca99b727a0
IMAP parser memory limits are now enforced by bytes per line rather than
Timo Sirainen <tss@iki.fi>
parents:
1107
diff
changeset
|
98 Usually the largest lines are large only because they have a one huge |
6eca99b727a0
IMAP parser memory limits are now enforced by bytes per line rather than
Timo Sirainen <tss@iki.fi>
parents:
1107
diff
changeset
|
99 message set token, so you'll probably want to keep input buffer size the |
6eca99b727a0
IMAP parser memory limits are now enforced by bytes per line rather than
Timo Sirainen <tss@iki.fi>
parents:
1107
diff
changeset
|
100 same as max_line_size. That means the maximum memory usage is around |
6eca99b727a0
IMAP parser memory limits are now enforced by bytes per line rather than
Timo Sirainen <tss@iki.fi>
parents:
1107
diff
changeset
|
101 2 * max_line_size. */ |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
878
diff
changeset
|
102 struct imap_parser * |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
878
diff
changeset
|
103 imap_parser_create(struct istream *input, struct ostream *output, |
1591
6eca99b727a0
IMAP parser memory limits are now enforced by bytes per line rather than
Timo Sirainen <tss@iki.fi>
parents:
1107
diff
changeset
|
104 size_t max_line_size); |
3879
928229f8b3e6
deinit, unref, destroy, close, free, etc. functions now take a pointer to
Timo Sirainen <tss@iki.fi>
parents:
3863
diff
changeset
|
105 void imap_parser_destroy(struct imap_parser **parser); |
0 | 106 |
107 /* Reset the parser to initial state. */ | |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
878
diff
changeset
|
108 void imap_parser_reset(struct imap_parser *parser); |
0 | 109 |
1023
dc660f588218
Disconnect client if given non-sync literal size is too large. Better than
Timo Sirainen <tss@iki.fi>
parents:
1022
diff
changeset
|
110 /* Return the last error in parser. fatal is set to TRUE if there's no way to |
dc660f588218
Disconnect client if given non-sync literal size is too large. Better than
Timo Sirainen <tss@iki.fi>
parents:
1022
diff
changeset
|
111 continue parsing, currently only if too large non-sync literal size was |
dc660f588218
Disconnect client if given non-sync literal size is too large. Better than
Timo Sirainen <tss@iki.fi>
parents:
1022
diff
changeset
|
112 given. */ |
3863
55df57c028d4
Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents:
3571
diff
changeset
|
113 const char *imap_parser_get_error(struct imap_parser *parser, bool *fatal); |
768
8b3518bb327e
Limited max. command argument elements to 128. Added more verbose error
Timo Sirainen <tss@iki.fi>
parents:
764
diff
changeset
|
114 |
764
f57c52738f90
Renamed IBuffer and OBuffer to IStream and OStream which describes their
Timo Sirainen <tss@iki.fi>
parents:
444
diff
changeset
|
115 /* Read a number of arguments. This function doesn't call i_stream_read(), you |
0 | 116 need to do that. Returns number of arguments read (may be less than count |
3520 | 117 in case of EOL), -2 if more data is needed or -1 if error occurred. |
0 | 118 |
119 count-sized array of arguments are stored into args when return value is | |
120 0 or larger. If all arguments weren't read, they're set to NIL. count | |
444
85ab93a7693b
ImapArgList changed from linked list to array. easier to handle that way.
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
121 can be set to 0 to read all arguments in the line. Last element in |
922 | 122 args is always of type IMAP_ARG_EOL. */ |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
878
diff
changeset
|
123 int imap_parser_read_args(struct imap_parser *parser, unsigned int count, |
5835
d59ed6a31b66
Added more consts to imap-parser API
Timo Sirainen <tss@iki.fi>
parents:
4823
diff
changeset
|
124 enum imap_parser_flags flags, |
d59ed6a31b66
Added more consts to imap-parser API
Timo Sirainen <tss@iki.fi>
parents:
4823
diff
changeset
|
125 const struct imap_arg **args_r); |
6739
d145669ed45a
Added imap_parser_get_literal_size() and imap_parser_read_last_literal() to
Timo Sirainen <tss@iki.fi>
parents:
6418
diff
changeset
|
126 /* If parsing ended with literal size, return it. */ |
d145669ed45a
Added imap_parser_get_literal_size() and imap_parser_read_last_literal() to
Timo Sirainen <tss@iki.fi>
parents:
6418
diff
changeset
|
127 bool imap_parser_get_literal_size(struct imap_parser *parser, uoff_t *size_r); |
d145669ed45a
Added imap_parser_get_literal_size() and imap_parser_read_last_literal() to
Timo Sirainen <tss@iki.fi>
parents:
6418
diff
changeset
|
128 /* IMAP_PARSE_FLAG_LITERAL_SIZE is set and last read argument was a literal. |
d145669ed45a
Added imap_parser_get_literal_size() and imap_parser_read_last_literal() to
Timo Sirainen <tss@iki.fi>
parents:
6418
diff
changeset
|
129 Calling this function causes the literal size to be replaced with the actual |
d145669ed45a
Added imap_parser_get_literal_size() and imap_parser_read_last_literal() to
Timo Sirainen <tss@iki.fi>
parents:
6418
diff
changeset
|
130 literal data when continuing argument parsing. */ |
d145669ed45a
Added imap_parser_get_literal_size() and imap_parser_read_last_literal() to
Timo Sirainen <tss@iki.fi>
parents:
6418
diff
changeset
|
131 void imap_parser_read_last_literal(struct imap_parser *parser); |
0 | 132 |
1661
566fb4bf7066
Fixes for parsing BODYSTRUCTURE
Timo Sirainen <tss@iki.fi>
parents:
1591
diff
changeset
|
133 /* just like imap_parser_read_args(), but assume \n at end of data in |
566fb4bf7066
Fixes for parsing BODYSTRUCTURE
Timo Sirainen <tss@iki.fi>
parents:
1591
diff
changeset
|
134 input stream. */ |
566fb4bf7066
Fixes for parsing BODYSTRUCTURE
Timo Sirainen <tss@iki.fi>
parents:
1591
diff
changeset
|
135 int imap_parser_finish_line(struct imap_parser *parser, unsigned int count, |
566fb4bf7066
Fixes for parsing BODYSTRUCTURE
Timo Sirainen <tss@iki.fi>
parents:
1591
diff
changeset
|
136 enum imap_parser_flags flags, |
5835
d59ed6a31b66
Added more consts to imap-parser API
Timo Sirainen <tss@iki.fi>
parents:
4823
diff
changeset
|
137 const struct imap_arg **args_r); |
1661
566fb4bf7066
Fixes for parsing BODYSTRUCTURE
Timo Sirainen <tss@iki.fi>
parents:
1591
diff
changeset
|
138 |
0 | 139 /* Read one word - used for reading tag and command name. |
140 Returns NULL if more data is needed. */ | |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
878
diff
changeset
|
141 const char *imap_parser_read_word(struct imap_parser *parser); |
0 | 142 |
143 /* Returns the imap argument as string. NIL returns "" and list returns NULL. */ | |
5835
d59ed6a31b66
Added more consts to imap-parser API
Timo Sirainen <tss@iki.fi>
parents:
4823
diff
changeset
|
144 const char *imap_arg_string(const struct imap_arg *arg); |
0 | 145 |
877
7935347f54f1
Don't access ImapArg's union members directly - too easy to mess up. Fixes a
Timo Sirainen <tss@iki.fi>
parents:
768
diff
changeset
|
146 /* Error functions */ |
6418
46d9ee79f292
Removed _ prefix from all public APIs.
Timo Sirainen <tss@iki.fi>
parents:
6411
diff
changeset
|
147 char *imap_arg_str_error(const struct imap_arg *arg) ATTR_NORETURN; |
46d9ee79f292
Removed _ prefix from all public APIs.
Timo Sirainen <tss@iki.fi>
parents:
6411
diff
changeset
|
148 uoff_t imap_arg_literal_size_error(const struct imap_arg *arg) |
6411
6a64e64fa3a3
Renamed __attr_*__ to ATTR_*. Renamed __attrs_used__ to ATTRS_DEFINED.
Timo Sirainen <tss@iki.fi>
parents:
6410
diff
changeset
|
149 ATTR_NORETURN; |
6418
46d9ee79f292
Removed _ prefix from all public APIs.
Timo Sirainen <tss@iki.fi>
parents:
6411
diff
changeset
|
150 ARRAY_TYPE(imap_arg_list) *imap_arg_list_error(const struct imap_arg *arg) |
6411
6a64e64fa3a3
Renamed __attr_*__ to ATTR_*. Renamed __attrs_used__ to ATTRS_DEFINED.
Timo Sirainen <tss@iki.fi>
parents:
6410
diff
changeset
|
151 ATTR_NORETURN; |
877
7935347f54f1
Don't access ImapArg's union members directly - too easy to mess up. Fixes a
Timo Sirainen <tss@iki.fi>
parents:
768
diff
changeset
|
152 |
0 | 153 #endif |