rfc822-parser.h revision 5bbce06405dd5fc0d67411e48856953785f109f5
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen (rfc822_atext_chars[(int)(unsigned char)(c)] != 0)
573f0491a5733fe21fa062a455acb4790b4e0499Timo Sirainen ((rfc822_atext_chars[(int)(unsigned char)(c)] & 3) != 0)
3ed2d0f6b5e67e2663d44489d9da3176823789a8Timo Sirainen/* Parse given data using RFC 822 token parser. */
65f8fb656051f1059f7b5a2da9c5555adcc30439Timo Sirainenvoid rfc822_parser_init(struct rfc822_parser_context *ctx,
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen/* The functions below return 1 = more data available, 0 = no more data
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen available (but a value might have been returned now), -1 = invalid input.
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen LWSP is automatically skipped after value, but not before it. So typically
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen you begin with skipping LWSP and then start using the parse functions. */
a64adf62fa33f2463a86f990217b0c9078531a40Timo Sirainen/* Parse comment. Assumes parser's data points to '(' */
a64adf62fa33f2463a86f990217b0c9078531a40Timo Sirainenint rfc822_skip_comment(struct rfc822_parser_context *ctx);
f7539a17ea306191b53b8f5e752e228937df9ec3Timo Sirainen/* Skip LWSP if there is any */
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainenint rfc822_skip_lwsp(struct rfc822_parser_context *ctx);
2dd39e478269d6fb0bb26d12b394aa30ee965e38Timo Sirainen/* Stop at next non-atext char */
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenint rfc822_parse_atom(struct rfc822_parser_context *ctx, string_t *str);
563273bdac80393af63b9520cbf4d24cc0efd028Timo Sirainen/* Like parse_atom() but don't stop at '.' */
563273bdac80393af63b9520cbf4d24cc0efd028Timo Sirainenint rfc822_parse_dot_atom(struct rfc822_parser_context *ctx, string_t *str);
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen/* Like parse_dot_atom() but stops for '/', '?' and '='.
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen Also it doesn't allow LWSP around '.' chars. */
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainenint rfc822_parse_mime_token(struct rfc822_parser_context *ctx, string_t *str);
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen/* "quoted string" */
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainenint rfc822_parse_quoted_string(struct rfc822_parser_context *ctx,
1d2b188f0eedc3cab6e27ceac5425a037f38042eTimo Sirainen/* atom or quoted-string */
1d2b188f0eedc3cab6e27ceac5425a037f38042eTimo Sirainenint rfc822_parse_phrase(struct rfc822_parser_context *ctx, string_t *str);
c0a87e5f3316a57e6f915882fa1951d0fbb74a61Timo Sirainen/* dot-atom / domain-literal */
1d2b188f0eedc3cab6e27ceac5425a037f38042eTimo Sirainenint rfc822_parse_domain(struct rfc822_parser_context *ctx, string_t *str);
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen/* Parse Content-Type header's type/subtype. */
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainenint rfc822_parse_content_type(struct rfc822_parser_context *ctx, string_t *str);
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen/* For Content-Type style parameter parsing. Expect ";" key "=" value.
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen value is unescaped if needed. The returned strings are allocated from data
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen stack. Returns 1 = key/value set, 0 = no more data, -1 = invalid input. */