message-parser.h revision 7c424aa51c956c628e3512055841aa2f9eef4833
#ifndef __MESSAGE_PARSER_H
#define __MESSAGE_PARSER_H
#include "message-size.h"
#define IS_LWSP(c) \
((c) == ' ' || (c) == '\t')
enum message_part_flags {
MESSAGE_PART_FLAG_MULTIPART = 0x01,
MESSAGE_PART_FLAG_MESSAGE_RFC822 = 0x04,
/* content-type: text/... */
MESSAGE_PART_FLAG_TEXT = 0x08,
/* content-transfer-encoding: binary */
MESSAGE_PART_FLAG_BINARY = 0x10
};
struct message_part {
struct message_part *parent;
struct message_part *next;
struct message_part *children;
struct message_size header_size;
struct message_size body_size;
enum message_part_flags flags;
void *context;
};
/* NOTE: name and value aren't \0-terminated. Also called once at end of
headers with name_len = value_len = 0. */
const unsigned char *name,
const unsigned char *value,
void *context);
/* callback is called for each field in message header. */
void *context);
/* Call callback for each field in message header. Fills the hdr_size.
part can be NULL, just make sure your header function works with it.
This function doesn't use data stack so your header function may save
values to it. When finished, input will point to beginning of message
body. */
struct message_size *hdr_size,
#endif