forked from php/pecl-mail-mailparse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
php_mailparse_rfc822.h
68 lines (56 loc) · 2.65 KB
/
php_mailparse_rfc822.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2015 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available at through the world-wide-web at |
| http://www.php.net/license/3_01.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| [email protected] so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Wez Furlong <[email protected]> |
+----------------------------------------------------------------------+
*/
#ifndef php_mailparse_rfc822_h
#define php_mailparse_rfc822_h
typedef struct _php_rfc822_token php_rfc822_token_t;
typedef struct _php_rfc822_tokenized php_rfc822_tokenized_t;
typedef struct _php_rfc822_address php_rfc822_address_t;
typedef struct _php_rfc822_addresses php_rfc822_addresses_t;
#define php_rfc822_token_is_atom(tok) ( (tok) == 0 || (tok) == '"' || (tok) == '(' )
struct _php_rfc822_token {
int token;
const char *value;
int valuelen;
};
struct _php_rfc822_tokenized {
php_rfc822_token_t *tokens;
int ntokens;
char *buffer;
};
struct _php_rfc822_address {
char *name;
char *address;
int is_group;
};
struct _php_rfc822_addresses {
php_rfc822_address_t *addrs;
int naddrs;
};
PHP_MAILPARSE_API php_rfc822_tokenized_t *php_mailparse_rfc822_tokenize(const char *header, int report_errors);
PHP_MAILPARSE_API void php_rfc822_tokenize_free(php_rfc822_tokenized_t *toks);
PHP_MAILPARSE_API php_rfc822_addresses_t *php_rfc822_parse_address_tokens(php_rfc822_tokenized_t *toks);
PHP_MAILPARSE_API void php_rfc822_free_addresses(php_rfc822_addresses_t *addrs);
#define PHP_RFC822_RECOMBINE_IGNORE_COMMENTS 1
#define PHP_RFC822_RECOMBINE_STRTOLOWER 2
#define PHP_RFC822_RECOMBINE_COMMENTS_TO_QUOTES 4
#define PHP_RFC822_RECOMBINE_SPACE_ATOMS 8
#define PHP_RFC822_RECOMBINE_INCLUDE_QUOTES 16
#define PHP_RFC822_RECOMBINE_COMMENTS_ONLY 32
PHP_MAILPARSE_API char *php_rfc822_recombine_tokens(php_rfc822_tokenized_t *toks, int first_token, int n_tokens, int flags);
void php_rfc822_print_tokens(php_rfc822_tokenized_t *toks);
#endif