Menu

[r356]: / trunk / php-java-bridge / php_java.h  Maximize  Restore  History

Download this file

157 lines (128 with data), 3.7 kB

  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
/*-*- mode: C; tab-width:4 -*-*/
#ifndef PHP_JAVA_H
#define PHP_JAVA_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php_wrapper.h"
#include "php_config.h"
#include "zend_compile.h"
#include "php_ini.h"
#include "php_globals.h"
#include "protocol.h"
#ifdef ZTS
#include "TSRM.h"
#endif
/* socket */
#ifdef __MINGW32__
# include <winsock2.h>
# define close closesocket
#else
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#ifndef CFG_JAVA_SOCKET_INET
# include <sys/un.h>
# ifdef HAVE_CONFIG_H
# if !HAVE_DECL_AF_LOCAL
# define AF_LOCAL AF_UNIX
# endif
# if !HAVE_DECL_PF_LOCAL
# define PF_LOCAL PF_UNIX
# endif
# endif
#endif
#endif
#ifdef ZEND_ENGINE_2
/* for try/catch emulation */
#include <setjmp.h>
#endif
extern zend_module_entry EXT_GLOBAL(module_entry);
extern zend_class_entry *EXT_GLOBAL(class_entry);
extern zend_class_entry *EXT_GLOBAL(class_class_entry);
extern zend_class_entry *EXT_GLOBAL(class_class_entry_jsr);
extern zend_class_entry *EXT_GLOBAL(exception_class_entry);
extern function_entry EXT_GLOBAL(class_functions[]);
#ifdef ZEND_ENGINE_2
extern zend_object_handlers EXT_GLOBAL(handlers);
#endif
extern const char * const EXT_GLOBAL(bridge_version);
extern int EXT_GLOBAL(ini_updated), EXT_GLOBAL (ini_user), EXT_GLOBAL (ini_set);
#define U_LOGFILE (1<<1)
#define U_LOGLEVEL (1<<2)
#define U_JAVA_HOME (1<<3)
#define U_JAVA (1<<4)
#define U_LIBRARY_PATH (1<<5)
#define U_CLASSPATH (1<<6)
#define U_SOCKNAME (1<<7)
#define U_HOSTS (1<<8)
#define U_SERVLET (1<<9)
#if EXTENSION == JAVA
#define phpext_java_ptr &EXT_GLOBAL(module_entry)
#elif EXTENSION == MONO
#define phpext_mono_ptr &EXT_GLOBAL(module_entry)
#else
# error EXT must be mono or java.
#endif
PHP_MINIT_FUNCTION(EXT);
PHP_MSHUTDOWN_FUNCTION(EXT);
PHP_MINFO_FUNCTION(EXT);
/**
* The following structure contains shared variables.
*/
struct cfg {
#ifdef CFG_JAVA_SOCKET_INET
struct sockaddr_in saddr;
#else
struct sockaddr_un saddr;
#endif
int cid; // server's process id
int err; // file descriptor: server's return code
char*sockname, *default_sockname;
char*hosts;
char*classpath;
char*ld_library_path;
char*vm;
char*vm_home;
char*logLevel;
unsigned short logLevel_val;
char*logFile;
short can_fork; /* 0 if user has hard-coded the socketname */
char* servlet; /* On or servlet context */
short is_cgi_servlet; /* 1: cgi env available */
};
extern struct cfg *EXT_GLOBAL(cfg);
/**
* The following structure contains per-request variables.
*/
EXT_BEGIN_MODULE_GLOBALS(EXT)
proxyenv *jenv;
short is_closed; /* PR1176522: GC must not re-open the connection */
/* local copy of the shared variables above. Needed for channel
re-directs */
char *hosts, *servlet;
int ini_user;
/* for user CB's */
zval*exception;
zval **object;
zval *func;
zval **retval_ptr;
zval *func_params;
EXT_END_MODULE_GLOBALS(EXT)
#ifdef ZTS
# define JG(v) EXT_TSRMG(EXT_GLOBAL(globals_id), EXT_GLOBAL_EX(zend_,, _globals) *, v)
#else
# define JG(v) EXT_GLOBAL(globals).v
#endif
extern char* EXT_GLOBAL(get_server_string)(TSRMLS_D);
extern proxyenv *EXT_GLOBAL(try_connect_to_server)(TSRMLS_D);
extern proxyenv *EXT_GLOBAL(connect_to_server)(TSRMLS_D);
extern void EXT_GLOBAL(start_server)(TSRMLS_D);
extern char* EXT_GLOBAL(test_server)(int *socket, short *is_local, struct sockaddr*saddr TSRMLS_DC);
/* returns the servlet context or null */
extern char *EXT_GLOBAL(get_servlet_context)(TSRMLS_D);
/* returns the local socketname or the default local socketname*/
extern char *EXT_GLOBAL(get_sockname)(TSRMLS_D);
#endif
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.