forked from php/pecl-caching-varnish
-
Notifications
You must be signed in to change notification settings - Fork 0
/
php_varnish.h
205 lines (180 loc) · 5.67 KB
/
php_varnish.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
/*-
* Copyright (c) 2011-2018 Anatol Belski
* All rights reserved.
*
* Author: Anatol Belski <ab@php.net>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id$
*/
#ifndef PHP_VARNISH_H
#define PHP_VARNISH_H
extern zend_module_entry varnish_module_entry;
#define phpext_varnish_ptr &varnish_module_entry
#ifdef PHP_WIN32
# define PHP_VARNISH_API __declspec(dllexport)
#elif defined(__GNUC__) && __GNUC__ >= 4
# define PHP_VARNISH_API __attribute__ ((visibility("default")))
#else
# define PHP_VARNISH_API
#endif
#ifdef ZTS
#include "TSRM.h"
#endif
#if PHP_MAJOR_VERSION < 7
typedef long zend_long;
#endif
/*#define PHP_VARNISH_DEBUG*/
#define PHP_VARNISH_VERSION "1.2.7-dev"
PHP_MINIT_FUNCTION(varnish);
PHP_MSHUTDOWN_FUNCTION(varnish);
PHP_RINIT_FUNCTION(varnish);
PHP_RSHUTDOWN_FUNCTION(varnish);
PHP_MINFO_FUNCTION(varnish);
PHP_METHOD(VarnishAdmin, __construct);
PHP_METHOD(VarnishAdmin, connect);
PHP_METHOD(VarnishAdmin, auth);
PHP_METHOD(VarnishAdmin, getParams);
PHP_METHOD(VarnishAdmin, setParam);
PHP_METHOD(VarnishAdmin, stop);
PHP_METHOD(VarnishAdmin, start);
PHP_METHOD(VarnishAdmin, banUrl);
PHP_METHOD(VarnishAdmin, ban);
PHP_METHOD(VarnishAdmin, isRunning);
PHP_METHOD(VarnishAdmin, getPanic);
PHP_METHOD(VarnishAdmin, clearPanic);
PHP_METHOD(VarnishAdmin, setHost);
PHP_METHOD(VarnishAdmin, setIdent);
PHP_METHOD(VarnishAdmin, setPort);
PHP_METHOD(VarnishAdmin, setTimeout);
PHP_METHOD(VarnishAdmin, setSecret);
PHP_METHOD(VarnishAdmin, setCompat);
PHP_METHOD(VarnishAdmin, getVclList);
PHP_METHOD(VarnishAdmin, vclUse);
PHP_METHOD(VarnishAdmin, disconnect);
PHP_METHOD(VarnishStat, __construct);
#if defined(HAVE_VARNISHAPILIB) && HAVE_VARNISHAPILIB < 40
PHP_METHOD(VarnishStat, getSnapshot);
#endif
PHP_METHOD(VarnishLog, __construct);
#if defined(HAVE_VARNISHAPILIB) && HAVE_VARNISHAPILIB < 40
PHP_METHOD(VarnishLog, getLine);
PHP_METHOD(VarnishLog, getTagName);
#endif
/*ZEND_BEGIN_MODULE_GLOBALS(varnish)
ZEND_END_MODULE_GLOBALS(varnish)*/
#ifdef ZTS
#define VARNISH_G(v) TSRMG(varnish_globals_id, zend_varnish_globals *, v)
#else
#define VARNISH_G(v) (varnish_globals.v)
#endif
/*ZEND_EXTERN_MODULE_GLOBALS(varnish)*/
extern zend_class_entry *VarnishException_ce;
#if PHP_MAJOR_VERSION >= 7
extern zend_object *php_varnish_adm_obj_init(zend_class_entry *);
extern zend_object *php_varnish_stat_obj_init(zend_class_entry *);
extern zend_object *php_varnish_log_obj_init(zend_class_entry *);
extern void php_varnish_adm_obj_destroy(zend_object *);
extern void php_varnish_stat_obj_destroy(zend_object *);
extern void php_varnish_log_obj_destroy(zend_object *);
#else
extern zend_object_value php_varnish_adm_obj_init(zend_class_entry *ze TSRMLS_DC);
extern zend_object_value php_varnish_stat_obj_init(zend_class_entry *ze TSRMLS_DC);
extern zend_object_value php_varnish_log_obj_init(zend_class_entry *ze TSRMLS_DC);
#endif
struct ze_varnish_conn {
char *host;
char *ident;
char *secret;
int host_len;
int ident_len;
int secret_len;
int port;
int timeout;
int sock;
int authok;
};
#if PHP_MAJOR_VERSION >= 8
#define TSRMLS_D void
#define TSRMLS_DC
#define TSRMLS_C
#define TSRMLS_CC
#define TSRMLS_FETCH()
#endif
#if PHP_MAJOR_VERSION >= 7
struct ze_varnish_adm_obj {
struct ze_varnish_conn zvc;
int status;
int compat;
zend_object zo;
};
struct ze_varnish_stat_obj {
struct ze_varnish_conn zvc;
zend_object zo;
};
struct ze_varnish_log_obj {
struct ze_varnish_conn zvc;
struct VSM_data *vd;
zend_object zo;
};
static zend_always_inline struct ze_varnish_adm_obj *
php_fetch_varnish_adm_obj(zend_object *obj)
{/*{{{*/
return (struct ze_varnish_adm_obj *)((char *)obj - XtOffsetOf(struct ze_varnish_adm_obj, zo));
}/*}}}*/
static zend_always_inline struct ze_varnish_stat_obj *
php_fetch_varnish_stat_obj(zend_object *obj)
{/*{{{*/
return (struct ze_varnish_stat_obj *)((char *)obj - XtOffsetOf(struct ze_varnish_stat_obj, zo));
}/*}}}*/
static zend_always_inline struct ze_varnish_log_obj *
php_fetch_varnish_log_obj(zend_object *obj)
{/*{{{*/
return (struct ze_varnish_log_obj *)((char *)obj - XtOffsetOf(struct ze_varnish_log_obj, zo));
}/*}}}*/
#else
struct ze_varnish_adm_obj {
zend_object zo;
struct ze_varnish_conn zvc;
int status;
int compat;
};
struct ze_varnish_stat_obj {
zend_object zo;
struct ze_varnish_conn zvc;
};
struct ze_varnish_log_obj {
zend_object zo;
struct ze_varnish_conn zvc;
struct VSM_data *vd;
};
#endif
#endif /* PHP_VARNISH_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
*/