add current state of refactoring
[m6w6/ext-http] / php_http_header_parser.h
1 /*
2 +--------------------------------------------------------------------+
3 | PECL :: http |
4 +--------------------------------------------------------------------+
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted provided that the conditions mentioned |
7 | in the accompanying LICENSE file are met. |
8 +--------------------------------------------------------------------+
9 | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
10 +--------------------------------------------------------------------+
11 */
12
13 #ifndef PHP_HTTP_HEADER_PARSER_H
14 #define PHP_HTTP_HEADER_PARSER_H
15
16 #include "php_http_info.h"
17
18 typedef enum php_http_header_parser_state {
19 PHP_HTTP_HEADER_PARSER_STATE_FAILURE = FAILURE,
20 PHP_HTTP_HEADER_PARSER_STATE_START = 0,
21 PHP_HTTP_HEADER_PARSER_STATE_KEY,
22 PHP_HTTP_HEADER_PARSER_STATE_VALUE,
23 PHP_HTTP_HEADER_PARSER_STATE_HEADER_DONE,
24 PHP_HTTP_HEADER_PARSER_STATE_DONE
25 } php_http_header_parser_state_t;
26
27 #define PHP_HTTP_HEADER_PARSER_CLEANUP 0x1
28
29 typedef struct php_http_header_parser {
30 zend_stack stack;
31 php_http_info_t info;
32 struct {
33 char *str;
34 size_t len;
35 } _key;
36 struct {
37 char *str;
38 size_t len;
39 } _val;
40 #ifdef ZTS
41 void ***ts;
42 #endif
43 } php_http_header_parser_t;
44
45 PHP_HTTP_API php_http_header_parser_t *php_http_header_parser_init(php_http_header_parser_t *parser TSRMLS_DC);
46 PHP_HTTP_API php_http_header_parser_state_t php_http_header_parser_state_push(php_http_header_parser_t *parser, unsigned argc, ...);
47 PHP_HTTP_API php_http_header_parser_state_t php_http_header_parser_state_is(php_http_header_parser_t *parser);
48 PHP_HTTP_API php_http_header_parser_state_t php_http_header_parser_state_pop(php_http_header_parser_t *parser);
49 PHP_HTTP_API void php_http_header_parser_dtor(php_http_header_parser_t *parser);
50 PHP_HTTP_API void php_http_header_parser_free(php_http_header_parser_t **parser);
51 PHP_HTTP_API php_http_header_parser_state_t php_http_header_parser_parse(php_http_header_parser_t *parser, php_http_buffer_t *buffer, unsigned flags, HashTable *headers, php_http_info_callback_t callback_func, void *callback_arg);
52
53 #endif /* PHP_HTTP_HEADER_PARSER_H */
54
55 /*
56 * Local variables:
57 * tab-width: 4
58 * c-basic-offset: 4
59 * End:
60 * vim600: noet sw=4 ts=4 fdm=marker
61 * vim<600: noet sw=4 ts=4
62 */
63