clean up test
[m6w6/ext-http] / src / php_http_options.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_OPTIONS_H
14 #define PHP_HTTP_OPTIONS_H
15
16 typedef struct php_http_option php_http_option_t;
17 typedef struct php_http_options php_http_options_t;
18
19 typedef ZEND_RESULT_CODE (*php_http_option_set_callback_t)(php_http_option_t *opt, zval *val, void *userdata);
20 typedef zval *(*php_http_option_get_callback_t)(php_http_option_t *opt, HashTable *options, void *userdata);
21
22 struct php_http_options {
23 HashTable options;
24
25 php_http_option_get_callback_t getter;
26 php_http_option_set_callback_t setter;
27
28 unsigned persistent:1;
29 };
30
31 struct php_http_option {
32 php_http_options_t suboptions;
33
34 zend_string *name;
35 ulong option;
36 zend_uchar type;
37 unsigned flags;
38 zval defval;
39
40 php_http_option_set_callback_t setter;
41 unsigned persistent:1;
42 };
43
44 PHP_HTTP_API php_http_options_t *php_http_options_init(php_http_options_t *registry, zend_bool persistent);
45 PHP_HTTP_API ZEND_RESULT_CODE php_http_options_apply(php_http_options_t *registry, HashTable *options, void *userdata);
46 PHP_HTTP_API void php_http_options_dtor(php_http_options_t *registry);
47 PHP_HTTP_API void php_http_options_free(php_http_options_t **registry);
48
49 PHP_HTTP_API php_http_option_t *php_http_option_register(php_http_options_t *registry, const char *name_str, size_t name_len, ulong option, zend_uchar type);
50 PHP_HTTP_API zval *php_http_option_get(php_http_option_t *opt, HashTable *options, void *userdata);
51
52 #endif /* PHP_HTTP_OPTIONS_H */
53
54 /*
55 * Local variables:
56 * tab-width: 4
57 * c-basic-offset: 4
58 * End:
59 * vim600: noet sw=4 ts=4 fdm=marker
60 * vim<600: noet sw=4 ts=4
61 */