File: php_mailparse_rfc822.h

package info (click to toggle)
php-mailparse 3.1.4%2B2.1.7~dev20160128-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,484 kB
  • sloc: ansic: 4,080; xml: 363; php: 38; makefile: 2
file content (68 lines) | stat: -rw-r--r-- 2,719 bytes parent folder | download | duplicates (4)
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
68
/*
   +----------------------------------------------------------------------+
   | 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          |
   | license@php.net so we can mail you a copy immediately.               |
   +----------------------------------------------------------------------+
   | Author: Wez Furlong <wez@thebrainroom.com>                           |
   +----------------------------------------------------------------------+
 */

#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 TSRMLS_DC);
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