-
-
Notifications
You must be signed in to change notification settings - Fork 319
/
php_yar.h
136 lines (117 loc) · 4.04 KB
/
php_yar.h
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/*
+----------------------------------------------------------------------+
| Yar - Light, concurrent RPC framework |
+----------------------------------------------------------------------+
| Copyright (c) 2012-2013 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 through the world-wide-web at the following url: |
| 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 |
| [email protected] so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Xinchen Hui <[email protected]> |
| Zhenyu Zhang <[email protected]> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef PHP_YAR_H
#define PHP_YAR_H
extern zend_module_entry yar_module_entry;
#define phpext_yar_ptr &yar_module_entry
#ifdef PHP_WIN32
# define PHP_YAR_API __declspec(dllexport)
#elif defined(__GNUC__) && __GNUC__ >= 4
# define PHP_YAR_API __attribute__ ((visibility("default")))
#else
# define PHP_YAR_API
#endif
#ifdef ZTS
#include "TSRM.h"
#endif
#define PHP_YAR_VERSION "2.3.4-dev"
PHP_MINIT_FUNCTION(yar);
PHP_MSHUTDOWN_FUNCTION(yar);
PHP_RINIT_FUNCTION(yar);
PHP_RSHUTDOWN_FUNCTION(yar);
PHP_MINFO_FUNCTION(yar);
ZEND_BEGIN_MODULE_GLOBALS(yar)
char *default_packager;
const struct _yar_packager *packager;
char *content_type;
zend_bool debug;
zend_bool expose_info;
zend_bool allow_persistent;
zend_ulong timeout;
zend_ulong connect_timeout;
struct {
zend_bool start;
struct {
zend_fcall_info fci;
zend_fcall_info_cache fcc;
} callback;
struct {
zend_fcall_info fci;
zend_fcall_info_cache fcc;
} ecallback;
void *clist; /* call data list */
} cctx; /* concurrent context */
ZEND_END_MODULE_GLOBALS(yar)
#ifdef ZTS
#define YAR_G(v) TSRMG(yar_globals_id, zend_yar_globals *, v)
#else
#define YAR_G(v) (yar_globals.v)
#endif
extern ZEND_DECLARE_MODULE_GLOBALS(yar);
#define YAR_STARTUP_FUNCTION(module) ZEND_MINIT_FUNCTION(yar_##module)
#define YAR_STARTUP(module) ZEND_MODULE_STARTUP_N(yar_##module)(INIT_FUNC_ARGS_PASSTHRU)
#define YAR_SHUTDOWN_FUNCTION(module) ZEND_MSHUTDOWN_FUNCTION(yar_##module)
#define YAR_SHUTDOWN(module) ZEND_MODULE_SHUTDOWN_N(yar_##module)(SHUTDOWN_FUNC_ARGS_PASSTHRU)
#define YAR_ACTIVATE_FUNCTION(module) ZEND_MODULE_ACTIVATE_D(yar_##module)
#define YAR_ACTIVATE(module) ZEND_MODULE_ACTIVATE_N(yar_##module)(INIT_FUNC_ARGS_PASSTHRU)
#define YAR_DEACTIVATE_FUNCTION(module) ZEND_MODULE_DEACTIVATE_D(yar_##module)
#define YAR_DEACTIVATE(module) ZEND_MODULE_DEACTIVATE_N(yar_##module)(SHUTDOWN_FUNC_ARGS_PASSTHRU)
#if PHP_VERSION_ID < 70200
extern zend_string *php_yar_char_str[26];
#define ZSTR_CHAR(i) php_yar_char_str[i - 'a']
#endif
# if PHP_VERSION_ID < 70300
# define GC_ADDREF(gc) (++GC_REFCOUNT(gc))
# define GC_DELREF(gc) (--GC_REFCOUNT(gc))
# endif
typedef enum _yar_opt {
YAR_OPT_PACKAGER,
YAR_OPT_PERSISTENT,
YAR_OPT_TIMEOUT,
YAR_OPT_CONNECT_TIMEOUT,
YAR_OPT_HEADER,
YAR_OPT_RESOLVE,
YAR_OPT_PROXY,
YAR_OPT_TOKEN,
YAR_OPT_PROVIDER,
YAR_OPT_MAX
} yar_opt;
#define DEBUG_S(fmt, ...) \
do { \
if (UNEXPECTED(YAR_G(debug))) { \
php_yar_debug(1, fmt, ##__VA_ARGS__); \
} \
} while (0)
#define DEBUG_C(fmt, ...) \
do { \
if (UNEXPECTED(YAR_G(debug))) { \
php_yar_debug(0, fmt, ##__VA_ARGS__); \
} \
} while (0)
void php_yar_debug(int server_side, const char *format, ...);
#endif /* PHP_YAR_H */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/