unfold url tests
[m6w6/ext-http] / 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 STATUS (*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 struct {
35 const char *s;
36 size_t l;
37 ulong h;
38 } name;
39
40 ulong option;
41 zend_uchar type;
42 unsigned flags;
43 zval defval;
44
45 php_http_option_set_callback_t setter;
46 };
47
48 PHP_HTTP_API php_http_options_t *php_http_options_init(php_http_options_t *registry, zend_bool persistent);
49 PHP_HTTP_API STATUS php_http_options_apply(php_http_options_t *registry, HashTable *options, void *userdata);
50 PHP_HTTP_API void php_http_options_dtor(php_http_options_t *registry);
51 PHP_HTTP_API void php_http_options_free(php_http_options_t **registry);
52
53 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);
54 PHP_HTTP_API zval *php_http_option_get(php_http_option_t *opt, HashTable *options, void *userdata);
55
56 #endif /* PHP_HTTP_OPTIONS_H */
57
58 /*
59 * Local variables:
60 * tab-width: 4
61 * c-basic-offset: 4
62 * End:
63 * vim600: noet sw=4 ts=4 fdm=marker
64 * vim<600: noet sw=4 ts=4
65 */