Mercurial > dovecot > core-2.2
view src/lib-mail/message-parser.h @ 896:21ffcce83c70 HEAD
Rewrote rfc822-tokenize.c to work one token at a time so it won't uselessly
take memory, maybe also a bit faster. This caused pretty large changes all
around.
Also moved all string (un)escaping code to lib/strescape.c.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 03 Jan 2003 17:57:12 +0200 |
parents | f57c52738f90 |
children | 0d5be52d7131 |
line wrap: on
line source
#ifndef __MESSAGE_PARSER_H #define __MESSAGE_PARSER_H #define IS_LWSP(c) \ ((c) == ' ' || (c) == '\t') typedef struct _MessagePart MessagePart; typedef struct _MessagePosition MessagePosition; typedef struct _MessageSize MessageSize; typedef enum { MESSAGE_PART_FLAG_MULTIPART = 0x01, MESSAGE_PART_FLAG_MULTIPART_DIGEST = 0x02, MESSAGE_PART_FLAG_MESSAGE_RFC822 = 0x04, /* content-type: text/... */ MESSAGE_PART_FLAG_TEXT = 0x08, /* content-transfer-encoding: binary */ MESSAGE_PART_FLAG_BINARY = 0x10 } MessagePartFlags; struct _MessageSize { uoff_t physical_size; uoff_t virtual_size; unsigned int lines; }; struct _MessagePart { MessagePart *parent; MessagePart *next; MessagePart *children; uoff_t physical_pos; /* absolute position from beginning of message */ MessageSize header_size; MessageSize body_size; MessagePartFlags flags; void *context; }; /* NOTE: name and value aren't \0-terminated. Also called once at end of headers with name_len = value_len = 0. */ typedef void (*MessageHeaderFunc)(MessagePart *part, const char *name, size_t name_len, const char *value, size_t value_len, void *context); /* func is called for each field in message header. */ MessagePart *message_parse(Pool pool, IStream *input, MessageHeaderFunc func, void *context); /* Call func 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. */ void message_parse_header(MessagePart *part, IStream *input, MessageSize *hdr_size, MessageHeaderFunc func, void *context); #endif