Go to the documentation of this file.
26 #ifndef MIME_DECODE_H_
27 #define MIME_DECODE_H_
36 #define CTNT_IS_ENCAP 4
37 #define CTNT_IS_BODYPART 8
38 #define CTNT_IS_MULTIPART 16
39 #define CTNT_IS_ATTACHMENT 32
40 #define CTNT_IS_BASE64 64
41 #define CTNT_IS_QP 128
42 #define CTNT_IS_TEXT 256
43 #define CTNT_IS_HTML 512
51 #define ANOM_INVALID_BASE64 1
52 #define ANOM_INVALID_QP 2
53 #define ANOM_LONG_HEADER_NAME 4
54 #define ANOM_LONG_HEADER_VALUE 8
56 #define ANOM_LONG_LINE 16
57 #define ANOM_LONG_ENC_LINE 32
58 #define ANOM_MALFORMED_MSG 64
59 #define ANOM_LONG_BOUNDARY 128
60 #define ANOM_LONG_FILENAME 256
63 #define DATA_CHUNK_SIZE 3072
66 #define HEADER_READY 0x01
67 #define HEADER_STARTED 0x02
68 #define HEADER_DONE 0x03
69 #define BODY_STARTED 0x04
70 #define BODY_DONE 0x05
71 #define BODY_END_BOUND 0x06
72 #define PARSE_DONE 0x07
73 #define PARSE_ERROR 0x08
MimeDecEntity * MimeDecAddEntity(MimeDecEntity *parent)
Creates and adds a child entity to the specified parent entity.
uint8_t data_chunk[DATA_CHUNK_SIZE]
struct MimeDecEntity * child
MimeDecParseState * MimeDecInitParser(void *data, int(*dcpfunc)(const uint8_t *chunk, uint32_t len, MimeDecParseState *state))
Init the parser by allocating memory for the state and top-level entity.
void MimeDecFreeField(MimeDecField *field)
Iteratively frees a header field entry list.
uint32_t header_value_depth
Structure holds the top of the stack along with some free reusable nodes.
uint8_t bvremain[B64_BLOCK]
int MimeDecParseComplete(MimeDecParseState *state)
Called to indicate that the last message line has been processed and the parsing operation is complet...
uint8_t current_line_delimiter_len
MimeDecField * field_list
MimeDecRetCode
Mime Decoder Error Codes.
This represents a header field name and associated value.
MimeDecField * MimeDecAddField(MimeDecEntity *entity)
Creates and adds a header field entry to an entity.
struct MimeDecConfig MimeDecConfig
Structure for containing configuration options.
struct MimeDecParseState MimeDecParseState
Structure contains the current state of the MIME parser.
ConfNode * extract_urls_schemes
int MimeDecFindFieldsForEach(const MimeDecEntity *entity, const char *name, int(*DataCallback)(const uint8_t *val, const size_t, void *data), void *data)
Searches for header fields with the specified name.
struct DataValue DataValue
Structure contains a list of value and lengths for robust data processing.
void MimeDecSetConfig(MimeDecConfig *config)
Set global config policy.
struct MimeDecField * next
Structure contains boundary and entity for the current node (entity) in the stack.
void MimeDecRegisterTests(void)
struct MimeDecStackNode * next
Structure for containing configuration options.
const char * MimeDecParseStateGetStatus(MimeDecParseState *state)
struct MimeDecStackNode MimeDecStackNode
Structure contains boundary and entity for the current node (entity) in the stack.
void MimeDecFreeUrl(MimeDecUrl *url)
Iteratively frees a URL entry list.
MimeDecEntity * MimeDecParseFullMsg(const uint8_t *buf, uint32_t blen, void *data, int(*DataChunkProcessorFunc)(const uint8_t *chunk, uint32_t len, MimeDecParseState *state))
Parses an entire message when available in its entirety (wraps the line-based parsing functions)
struct MimeDecField MimeDecField
This represents a header field name and associated value.
bool decode_quoted_printable
struct MimeDecEntity MimeDecEntity
This represents the MIME Entity (or also top level message) in a child-sibling tree.
Structure contains the current state of the MIME parser.
MimeDecConfig * MimeDecGetConfig(void)
Get global config policy.
void MimeDecDeInitParser(MimeDecParseState *state)
De-Init parser by freeing up any residual memory.
This represents a URL value node in a linked list.
MimeDecField * MimeDecFindField(const MimeDecEntity *entity, const char *name)
Searches for a header field with the specified name.
Structure contains a list of value and lengths for robust data processing.
struct MimeDecEntity * next
MimeDecStackNode * free_nodes
struct MimeDecStack MimeDecStack
Structure holds the top of the stack along with some free reusable nodes.
void MimeDecFreeEntity(MimeDecEntity *entity)
Frees a mime entity tree.
This represents the MIME Entity (or also top level message) in a child-sibling tree.
int(* DataChunkProcessorFunc)(const uint8_t *chunk, uint32_t len, struct MimeDecParseState *state)
int MimeDecParseLine(const uint8_t *line, const uint32_t len, const uint8_t delim_len, MimeDecParseState *state)
Parse a line of a MIME message and update the parser state.
struct MimeDecUrl MimeDecUrl
This represents a URL value node in a linked list.