functions for parsing MIME messages
More...
#include "qrdata.h"
#include <sstring.h>
#include <sys/types.h>
Go to the source code of this file.
functions for parsing MIME messages
off_t find_boundary |
( |
const char * |
buf, |
|
|
const off_t |
len, |
|
|
const cstring * |
boundary |
|
) |
| |
find next mime boundary
- Parameters
-
buf | buffer to scan |
len | length of buffer |
boundary | boundary limit string |
- Returns
- offset of first character behind next boundary
- Return values
-
size_t getfieldlen |
( |
const char * |
msg, |
|
|
const size_t |
len |
|
) |
| |
get length of a MIME header field, even if it is folded
- Parameters
-
msg | message data to scan |
len | length of data |
- Returns
- length of header field
- Return values
-
0 | if field does not end until end of data |
scan "Content-Type" header line and check if type is multipart/(*)
- Parameters
-
line | header field |
boundary | reference to boundary is stored here |
- Return values
-
1 | line contains multipart/(*) declaration |
0 | other type |
-1 | syntax error |
const char* skipwhitespace |
( |
const char * |
line, |
|
|
const size_t |
len |
|
) |
| |
skip whitespaces in header line
- Parameters
-
line | header field |
len | length of data, must be > 0 |
- Returns
- pointer to first character after whitespace
- Return values
-
NULL | syntax error (e.g. unfinished comment) |
This function skips whitespace and comments from the current position. If a newline is encountered before a non-whitespace and non-comment character it is also skipped, including all following whitespace.
If it returns (line + len) everything from line until end of data block is a comment
line has to be a valid (but unparsed) and may be a folded header line. For this it has to meet this constraints: -it has to end with CR, LF or CRLF -it may have CR, LF or CRLF in the middle, but this has to be directly followed by either SPACE or TAB