php_grpc.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 
20 #ifndef PHP_GRPC_H
21 #define PHP_GRPC_H
22 
23 #ifdef HAVE_CONFIG_H
24 #include "config.h"
25 #endif
26 
27 #include <stdbool.h>
28 
29 #include <php.h>
30 #include <php_ini.h>
31 #include <ext/standard/info.h>
32 
33 #include <grpc/grpc.h>
34 
35 #include "php7_wrapper.h"
36 #include "version.h"
37 
38 extern zend_module_entry grpc_module_entry;
39 #define phpext_grpc_ptr &grpc_module_entry
40 
41 #ifdef PHP_WIN32
42 #define PHP_GRPC_API __declspec(dllexport)
43 #elif defined(__GNUC__) && __GNUC__ >= 4
44 #define PHP_GRPC_API __attribute__((visibility("default")))
45 #else
46 #define PHP_GRPC_API
47 #endif
48 
49 #if PHP_MAJOR_VERSION >= 8
50 #define TSRMLS_CC
51 #define TSRMLS_C
52 #define TSRMLS_DC
53 #define TSRMLS_D
54 #define TSRMLS_FETCH()
55 #endif
56 
57 #ifdef ZTS
58 #include "TSRM.h"
59 #endif
60 
61 /* These are all function declarations */
62 /* Code that runs at module initialization */
64 /* Code that runs at module shutdown */
66 /* Displays information about the module */
68 /* Code that runs at request start */
70 
71 /*
72  Declare any global variables you may need between the BEGIN
73  and END macros here:
74 */
75 ZEND_BEGIN_MODULE_GLOBALS(grpc)
76  zend_bool initialized;
80  char *grpc_trace;
81  char *log_filename;
82 ZEND_END_MODULE_GLOBALS(grpc)
83 
85 
86 /* In every utility function you add that needs to use variables
87  in php_grpc_globals, call TSRMLS_FETCH(); after declaring other
88  variables used by that function, or better yet, pass in TSRMLS_CC
89  after the last function argument and declare your utility function
90  with TSRMLS_DC after the last declared argument. Always refer to
91  the globals in your function as GRPC_G(variable). You are
92  encouraged to rename these macros something shorter, see
93  examples in any other php module directory.
94 */
95 
96 #ifdef ZTS
97 #define GRPC_G(v) TSRMG(grpc_globals_id, zend_grpc_globals *, v)
98 #else
99 #define GRPC_G(v) (grpc_globals.v)
100 #endif
101 
102 #define GRPC_STARTUP_FUNCTION(module) ZEND_MINIT_FUNCTION(grpc_##module)
103 #define GRPC_STARTUP(module) \
104  ZEND_MODULE_STARTUP_N(grpc_##module)(INIT_FUNC_ARGS_PASSTHRU)
105 
106 #endif /* PHP_GRPC_H */
poll_strategy
char * poll_strategy
Definition: php_grpc.h:78
grpc
Definition: grpcpp/alarm.h:33
ZEND_EXTERN_MODULE_GLOBALS
ZEND_EXTERN_MODULE_GLOBALS(grpc)
php7_wrapper.h
enable_fork_support
zend_bool enable_fork_support
Definition: php_grpc.h:77
grpc_module_entry
zend_module_entry grpc_module_entry
Definition: php_grpc.c:60
initialized
zend_bool initialized
Definition: php_grpc.h:76
grpc.h
PHP_RINIT_FUNCTION
PHP_RINIT_FUNCTION(grpc)
Definition: php_grpc.c:595
PHP_MINFO_FUNCTION
PHP_MINFO_FUNCTION(grpc)
Definition: php_grpc.c:584
PHP_MSHUTDOWN_FUNCTION
PHP_MSHUTDOWN_FUNCTION(grpc)
Definition: php_grpc.c:564
grpc_trace
char * grpc_trace
Definition: php_grpc.h:80
log_filename
char * log_filename
Definition: php_grpc.h:81
PHP_MINIT_FUNCTION
PHP_MINIT_FUNCTION(grpc)
Definition: php_grpc.c:286
grpc_verbosity
char * grpc_verbosity
Definition: php_grpc.h:79
version.h


grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:00:52