message-header-parser.h revision 51c331377beb4a2acb81aee4d12bc8ef6c496625
#ifndef __MESSAGE_HEADER_PARSER_H
#define __MESSAGE_HEADER_PARSER_H
#define IS_LWSP(c) \
((c) == ' ' || (c) == '\t')
struct message_size;
struct message_header_parser_ctx;
struct message_header_line {
const char *name;
const unsigned char *value;
const unsigned char *full_value;
const unsigned char *middle;
};
/* called once with hdr = NULL at the end of headers */
void *context);
/* skip_initial_lwsp controls if we should skip LWSP after "header: ".
Note that there may not be the single whitespace after "header:", and that
"header : " is also possible. These two conditions can't be determined from
struct message_header_line. */
struct message_header_parser_ctx *
bool skip_initial_lwsp);
/* Read and return next header line. Returns 1 if header is returned, 0 if
input stream is non-blocking and more data needs to be read, -1 when all is
done or error occurred (see stream's error status). */
struct message_header_line **hdr_r);
/* Returns TRUE if the parser has seen NUL characters. */
/* Read and parse the header from the given stream. */
#endif