--- a/trunk/php-java-bridge/protocol.h +++ b/trunk/php-java-bridge/protocol.h @@ -96,116 +96,4 @@ #define RECV_SIZE 8192 // initial size of the receive buffer #define MAX_ARGS 100 // max # of method arguments -/* checks if we use a servlet backend (re-directed or not) */ -#define IS_SERVLET_BACKEND(env) (((*env)->servlet_ctx || EXT_GLOBAL (get_servlet_context) (TSRMLS_C))) - -/* checks if the servlet backend uses HTTP, either because we do not - re-direct or because we override re-direct */ -#define IS_OVERRIDE_REDIRECT(env) ((((*env)->peer0!=-1) || EXT_GLOBAL (get_servlet_context) (TSRMLS_C))) - -typedef struct sfile SFILE; -typedef struct proxyenv_ *proxyenv; - -/** A procedure type which can be used to create a procedure to create - a proxy environment, e.g. a secure (SSL) or a standard environment */ -typedef proxyenv* (environment_factory) - (short (*handle_request)(proxyenv *env), - short (*handle_cached)(proxyenv *env), - short *is_local); - -struct proxyenv_ { - - /* peer */ - int peer, peerr, peer0; /* peer0 contains peer during override - redirect */ - short is_shared; /* 1, if peer, peerr, servlet_ctx is shared */ - short peer_redirected; /* remains true during override - redirect */ - struct sockaddr orig_peer_saddr; /* only valid if peer is a servlet, it - points to the original peer */ - - /* the name of the comm. pipe */ - struct pipe { - char*channel, *in, *out; - int lockfile; - } pipe; - - /* used by the parser implementation */ - unsigned char*s; size_t len; - ssize_t pos, c; - unsigned char recv_buf[RECV_SIZE]; - - /* the send buffer */ - unsigned char*send; - size_t send_len, send_size; - - char *server_name; - - /* local server (not a servlet engine) */ - short is_local; - - /* for servlets: re-open connection */ - short must_reopen, must_share; - short connection_is_closed; - - struct async_ctx { - short (*handle_request)(proxyenv *env); - unsigned long nextValue; - void *result; - SFILE *peer; - ssize_t (*f_send)(proxyenv*env, const void *buf, size_t len); - } async_ctx; - - /* for servlet engines only */ - char *servlet_ctx; /* the # of the server context runner */ - char *current_servlet_ctx; /* the ctx # for this request only, used when persistent connections are enabled */ - char *servlet_context_string; /* original rinit value from - get_servlet_context() */ - short backend_has_session_proxy; - struct saved_cfg { /* copy of JG(cfg) used in activate/passivate connection */ - int ini_user; - short java_socket_inet; - char *hosts, *servlet; - } cfg; - - short (*handle)(proxyenv *env); - short (*handle_request)(proxyenv *env); - - void (*checkSession)(proxyenv *env); - void (*redirect)(proxyenv *env); - - void (*writeCreateObjectBegin)(proxyenv *env, char*name, size_t strlen, char createInstance, void *result); - short (*writeCreateObjectEnd)(proxyenv *env); - void (*writeInvokeBegin)(proxyenv *env, unsigned long object, char*method, size_t strlen, char property, void* result); - short (*writeInvokeEnd)(proxyenv *env); - void (*writeResultBegin)(proxyenv *env, void* result); - void (*writeResultEnd)(proxyenv *env); - void (*writeString)(proxyenv *env, char*name, size_t strlen); - void (*writeBoolean)(proxyenv *env, short boolean); - void (*writeLong)(proxyenv *env, long l); - void (*writeULong)(proxyenv *env, unsigned long l); - void (*writeDouble)(proxyenv *env, double d); - void (*writeObject)(proxyenv *env, unsigned long object); - void (*writeException)(proxyenv *env, unsigned long object, char*str, size_t len); - void (*writeCompositeBegin_a)(proxyenv *env); - void (*writeCompositeBegin_h)(proxyenv *env); - void (*writeCompositeEnd)(proxyenv *env); - void (*writePairBegin_s)(proxyenv *env, char*key, size_t strlen); - void (*writePairBegin_n)(proxyenv *env, unsigned long key); - void (*writePairBegin)(proxyenv *env); - void (*writePairEnd)(proxyenv *env); - void (*writeUnref)(proxyenv *env, unsigned long object); - short (*writeEndConnection)(proxyenv *env, char property); - short (*finish)(proxyenv *env); - short (*endSession)(proxyenv *env); - - short (*f_close)(proxyenv *env); - ssize_t (*f_recv)(proxyenv*env, void *buf, size_t len); - ssize_t (*f_recv0)(proxyenv*env, void *buf, size_t len); - ssize_t (*f_send)(proxyenv*env, const void *buf, size_t len); - ssize_t (*f_send0)(proxyenv*env, const void *buf, size_t len); - - void (*destruct)(proxyenv *env); -}; - #endif