Config.w32 chack for both instances of event.h
[m6w6/ext-http] / src / php_http_info.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-2014, Michael Wallner <mike@php.net> |
10 +--------------------------------------------------------------------+
11 */
12
13 #ifndef PHP_HTTP_INFO_H
14 #define PHP_HTTP_INFO_H
15
16 #include "php_http_version.h"
17 #include "php_http_url.h"
18
19 typedef struct php_http_info_data {
20 union {
21 /* GET /foo/bar */
22 struct { char *method; php_http_url_t *url; } request;
23 /* 200 Ok */
24 struct { unsigned code; char *status; } response;
25 } info;
26 php_http_version_t version;
27 } php_http_info_data_t;
28
29 #undef PHP_HTTP_REQUEST
30 #undef PHP_HTTP_RESPONSE
31 typedef enum php_http_info_type {
32 PHP_HTTP_NONE = 0,
33 PHP_HTTP_REQUEST,
34 PHP_HTTP_RESPONSE
35 } php_http_info_type_t;
36
37 #define PHP_HTTP_INFO(ptr) (ptr)->http.info
38 #define PHP_HTTP_INFO_IMPL(_http, _type) \
39 php_http_info_data_t _http; \
40 php_http_info_type_t _type;
41
42 typedef struct php_http_info {
43 PHP_HTTP_INFO_IMPL(http, type)
44 } php_http_info_t;
45
46 typedef zend_bool (*php_http_info_callback_t)(void **callback_data, HashTable **headers, php_http_info_t *info);
47
48 PHP_HTTP_API php_http_info_t *php_http_info_init(php_http_info_t *info);
49 PHP_HTTP_API php_http_info_t *php_http_info_parse(php_http_info_t *info, const char *pre_header);
50 PHP_HTTP_API void php_http_info_to_string(php_http_info_t *info, char **str, size_t *len, const char *eol);
51 PHP_HTTP_API void php_http_info_dtor(php_http_info_t *info);
52 PHP_HTTP_API void php_http_info_free(php_http_info_t **info);
53
54 #endif
55
56 /*
57 * Local variables:
58 * tab-width: 4
59 * c-basic-offset: 4
60 * End:
61 * vim600: noet sw=4 ts=4 fdm=marker
62 * vim<600: noet sw=4 ts=4
63 */
64