1 /* rfc822parse.h - Simple mail and MIME parser
2 * Copyright (C) 1999 Werner Koch, Duesseldorf
3 * Copyright (C) 2003, g10 Code GmbH
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public License
7 * as published by the Free Software Foundation; either version 3 of
8 * the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this program; if not, see <http://www.gnu.org/licenses/>.
22 struct rfc822parse_context
;
23 typedef struct rfc822parse_context
*rfc822parse_t
;
32 RFC822PARSE_RCVD_SEEN
,
33 RFC822PARSE_LEVEL_DOWN
,
36 RFC822PARSE_LAST_BOUNDARY
,
37 RFC822PARSE_BEGIN_HEADER
,
43 struct rfc822parse_field_context
;
44 typedef struct rfc822parse_field_context
*rfc822parse_field_t
;
47 typedef int (*rfc822parse_cb_t
) (void *opaque
,
48 rfc822parse_event_t event
,
52 rfc822parse_t
rfc822parse_open (rfc822parse_cb_t cb
, void *opaque_value
);
54 void rfc822parse_close (rfc822parse_t msg
);
56 void rfc822parse_cancel (rfc822parse_t msg
);
57 int rfc822parse_finish (rfc822parse_t msg
);
59 int rfc822parse_insert (rfc822parse_t msg
,
60 const unsigned char *line
, size_t length
);
62 char *rfc822parse_get_field (rfc822parse_t msg
, const char *name
, int which
,
65 const char *rfc822parse_enum_header_lines (rfc822parse_t msg
, void **context
);
67 rfc822parse_field_t
rfc822parse_parse_field (rfc822parse_t msg
,
71 void rfc822parse_release_field (rfc822parse_field_t field
);
73 const char *rfc822parse_query_parameter (rfc822parse_field_t ctx
,
74 const char *attr
, int lower_value
);
76 const char *rfc822parse_query_media_type (rfc822parse_field_t ctx
,
77 const char **subtype
);
79 #endif /*RFC822PARSE_H */