costin 01/12/16 15:17:23 Modified: jk/native2/include jk_channel.h jk_endpoint.h jk_env.h jk_handler.h jk_logger.h jk_map.h jk_msg.h jk_objCache.h jk_pool.h jk_requtil.h jk_service.h jk_uriEnv.h jk_uriMap.h jk_webapp.h jk_worker.h jk_workerEnv.h Log: As previously discussed, add jk_env param to all methods. This is for now just a 'cosmetic' change - all functions will now follow the same pattern ( previously most but not all had access to logger, etc). The actual implementation of env is not completed, but should work the same as it did before - it's just one level of indirection to access the logger. We still use a single shared logger, etc. In future we may improve this to give each thread a env instance ( that will include a per thread logger and per thread temp pool ) that will allow us to implement error handling and get rid of the last 3 mallocs ( and use pools exclusively ). This should be my last 'major' change in jk2 refactoring. Revision Changes Path 1.4 +10 -9 jakarta-tomcat-connectors/jk/native2/include/jk_channel.h Index: jk_channel.h =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_channel.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- jk_channel.h 2001/12/12 22:02:30 1.3 +++ jk_channel.h 2001/12/16 23:17:23 1.4 @@ -59,6 +59,7 @@ #define JK_CHANNEL_H #include "jk_global.h" +#include "jk_env.h" #include "jk_logger.h" #include "jk_pool.h" #include "jk_msg.h" @@ -67,6 +68,7 @@ extern "C" { #endif /* __cplusplus */ +struct jk_env; struct jk_worker; struct jk_endpoint; struct jk_channel; @@ -116,43 +118,42 @@ * the inet addr, etc ) * XXX revisit this - we may pass too much that is not needed */ - int (JK_METHOD *init)(jk_channel_t *_this, + int (JK_METHOD *init)(struct jk_env *env, jk_channel_t *_this, jk_map_t *properties, char *worker_name, - struct jk_worker *worker, - jk_logger_t *l ); + struct jk_worker *worker ); /** Open the communication channel */ - int (JK_METHOD *open)(jk_channel_t *_this, + int (JK_METHOD *open)(struct jk_env *env, jk_channel_t *_this, struct jk_endpoint *endpoint ); /** Close the communication channel */ - int (JK_METHOD *close)(jk_channel_t *_this, + int (JK_METHOD *close)(struct jk_env *env, jk_channel_t *_this, struct jk_endpoint *endpoint ); /** Send a packet */ - int (JK_METHOD *send)(jk_channel_t *_this, + int (JK_METHOD *send)(struct jk_env *env, jk_channel_t *_this, struct jk_endpoint *endpoint, char *b, int len ); /** Receive a packet */ - int (JK_METHOD *recv)(jk_channel_t *_this, + int (JK_METHOD *recv)(struct jk_env *env, jk_channel_t *_this, struct jk_endpoint *endpoint, char *b, int len ); /** Set a channel property. Properties are used to configure the * communication channel ( example: port, host, file, shmem_name, etc). */ - int (JK_METHOD *setProperty)(jk_channel_t *_this, + int (JK_METHOD *setProperty)(struct jk_env *env, jk_channel_t *_this, char *name, char *value); /** Get a channel property */ - int (JK_METHOD *getProperty)(jk_channel_t *_this, + int (JK_METHOD *getProperty)(struct jk_env *env, jk_channel_t *_this, char *name, char **value); void *_privatePtr; 1.8 +6 -7 jakarta-tomcat-connectors/jk/native2/include/jk_endpoint.h Index: jk_endpoint.h =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_endpoint.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- jk_endpoint.h 2001/12/14 07:09:01 1.7 +++ jk_endpoint.h 2001/12/16 23:17:23 1.8 @@ -61,12 +61,13 @@ * Author: Gal Shachor <[EMAIL PROTECTED]> * Author: Dan Milstein <[EMAIL PROTECTED]> * Author: Henri Gomez <[EMAIL PROTECTED]> - * Version: $Revision: 1.7 $ + * Version: $Revision: 1.8 $ ***************************************************************************/ #ifndef JK_ENDPOINT_H #define JK_ENDPOINT_H +#include "jk_env.h" #include "jk_map.h" #include "jk_service.h" #include "jk_logger.h" @@ -132,12 +133,12 @@ /** 'main' pool for this endpoint. Used to store properties of the endpoint. Will be alive until the endpoint is destroyed. */ - jk_pool_t *pool; + struct jk_pool *pool; /** Connection pool. Used to store temporary data. It'll be recycled after each transaction. */ - jk_pool_t *cPool; + struct jk_pool *cPool; int proto; /* PROTOCOL USED AJP13/AJP14 */ @@ -177,9 +178,8 @@ * by the jk_ws_service_t object. I'm not sure exactly how * is_recoverable_error is being used. */ - int (JK_METHOD *service)(jk_endpoint_t *e, + int (JK_METHOD *service)(struct jk_env *env, jk_endpoint_t *_this, struct jk_ws_service *s, - struct jk_logger *l, int *is_recoverable_error); /* @@ -195,8 +195,7 @@ * XXX This is the 'pair' of worker.getEndpoint - it should be part of * worker. */ - int (JK_METHOD *done)(jk_endpoint_t **p, - struct jk_logger *l); + int (JK_METHOD *done)(struct jk_env *env, jk_endpoint_t *p ); }; #ifdef __cplusplus 1.4 +15 -5 jakarta-tomcat-connectors/jk/native2/include/jk_env.h Index: jk_env.h =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_env.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- jk_env.h 2001/12/14 07:09:01 1.3 +++ jk_env.h 2001/12/16 23:17:23 1.4 @@ -104,7 +104,7 @@ * jk_worker_list.h). */ typedef int (JK_METHOD *jk_env_objectFactory_t)(jk_env_t *env, - jk_pool_t *pool, + struct jk_pool *pool, void **result, const char *type, const char *name); @@ -123,8 +123,8 @@ * the other methods parameters. */ struct jk_env { - struct jk_logger *logger; - jk_pool_t *globalPool; + struct jk_logger *l; + struct jk_pool *globalPool; /** Global properties ( similar with System properties in java) */ @@ -140,9 +140,19 @@ call it. This is a very frequent operation. */ void * - (JK_METHOD *getInstance)( jk_env_t *env, jk_pool_t *pool, const char *type, + (JK_METHOD *getInstance)( jk_env_t *env, struct jk_pool *pool, + const char *type, const char *name ); - + + /** Report an error. + * TODO: create a 'stack trace' (i.e. a stack of errors ) + * TODO: set 'error state' + * Right now is equivalent with l->jkLog(env, JK_LOG_ERROR,... ) + */ + void *(JK_METHOD *error)(jk_env_t *env, + const char *file, int line, + const char *fmt, ...); + /** Register a factory for a type ( channel, worker ). */ 1.4 +5 -3 jakarta-tomcat-connectors/jk/native2/include/jk_handler.h Index: jk_handler.h =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_handler.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- jk_handler.h 2001/12/12 21:25:56 1.3 +++ jk_handler.h 2001/12/16 23:17:23 1.4 @@ -70,6 +70,7 @@ #define JK_HANDLER_H #include "jk_global.h" +#include "jk_env.h" #include "jk_map.h" #include "jk_workerEnv.h" #include "jk_logger.h" @@ -120,11 +121,12 @@ struct jk_ws_service; struct jk_endpoint; struct jk_logger; +struct jk_env; -typedef int (JK_METHOD *jk_handler_callback)(struct jk_msg *msg, +typedef int (JK_METHOD *jk_handler_callback)(struct jk_env *env, + struct jk_msg *msg, struct jk_ws_service *r, - struct jk_endpoint *ae, - struct jk_logger *l); + struct jk_endpoint *ae); struct jk_handler; typedef struct jk_handler jk_handler_t; 1.4 +14 -7 jakarta-tomcat-connectors/jk/native2/include/jk_logger.h Index: jk_logger.h =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_logger.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- jk_logger.h 2001/12/06 22:48:49 1.3 +++ jk_logger.h 2001/12/16 23:17:23 1.4 @@ -58,12 +58,13 @@ /*************************************************************************** * Description: Logger object definitions * * Author: Gal Shachor <[EMAIL PROTECTED]> * - * Version: $Revision: 1.3 $ * + * Version: $Revision: 1.4 $ * ***************************************************************************/ #ifndef JK_LOGGER_H #define JK_LOGGER_H +#include "jk_env.h" #include "jk_global.h" #include "jk_map.h" @@ -72,6 +73,7 @@ #endif /* __cplusplus */ struct jk_map; +struct jk_env; struct jk_logger; typedef struct jk_logger jk_logger_t; @@ -84,24 +86,29 @@ void *logger_private; int level; - void (JK_METHOD *setProperty)(jk_logger_t *_this, + void (JK_METHOD *setProperty)(struct jk_env *env, + jk_logger_t *_this, const char *name, const char *value ); - char *(JK_METHOD *getProperty)(jk_logger_t *_this, + char *(JK_METHOD *getProperty)(struct jk_env *env, + jk_logger_t *_this, const char *name, const char *def ); - int (JK_METHOD *open)( jk_logger_t *_this, + int (JK_METHOD *open)( struct jk_env *env, + jk_logger_t *_this, struct jk_map *properties ); - void (JK_METHOD *close)( jk_logger_t *_this ); + void (JK_METHOD *close)( struct jk_env *env, jk_logger_t *_this ); - int (JK_METHOD *log)(jk_logger_t *_this, + int (JK_METHOD *log)(struct jk_env *env, + jk_logger_t *_this, int level, const char *what); - int (JK_METHOD *jkLog)(jk_logger_t *_this, + int (JK_METHOD *jkLog)(struct jk_env *env, + jk_logger_t *_this, const char *file, int line, int level, 1.6 +2 -2 jakarta-tomcat-connectors/jk/native2/include/jk_map.h Index: jk_map.h =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_map.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- jk_map.h 2001/12/15 17:19:26 1.5 +++ jk_map.h 2001/12/16 23:17:23 1.6 @@ -58,7 +58,7 @@ /*************************************************************************** * Description: Map object header file * * Author: Gal Shachor <[EMAIL PROTECTED]> * - * Version: $Revision: 1.5 $ * + * Version: $Revision: 1.6 $ * ***************************************************************************/ #ifndef JK_MAP_H @@ -191,7 +191,7 @@ /* XXX Very strange hack to deal with special properties */ -int jk_is_some_property(const char *prp_name, const char *suffix); +int jk_is_some_property(struct jk_env *env, const char *prp_name, const char *suffix); #ifdef __cplusplus } 1.3 +24 -22 jakarta-tomcat-connectors/jk/native2/include/jk_msg.h Index: jk_msg.h =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_msg.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- jk_msg.h 2001/12/12 21:23:57 1.2 +++ jk_msg.h 2001/12/16 23:17:23 1.3 @@ -59,6 +59,7 @@ #define JK_REQ_H #include "jk_global.h" +#include "jk_env.h" #include "jk_logger.h" #include "jk_pool.h" #include "jk_endpoint.h" @@ -68,6 +69,7 @@ extern "C" { #endif /* __cplusplus */ +struct jk_env; struct jk_msg; typedef struct jk_msg jk_msg_t; @@ -108,66 +110,66 @@ /* * Prepare the buffer for a new invocation */ - void (*reset)(struct jk_msg *_this); + void (*reset)(struct jk_env *env, struct jk_msg *_this); /* * Finalize the buffer before sending - set length fields, etc */ - void (*end)(struct jk_msg *_this); + void (*end)(struct jk_env *env, struct jk_msg *_this); /* * Dump the buffer header * @param err Message text */ - void (*dump)(struct jk_msg *_this, struct jk_logger *log, char *err); + void (*dump)(struct jk_env *env, struct jk_msg *_this, char *err); - int (*appendByte)(struct jk_msg *_this, unsigned char val); + int (*appendByte)(struct jk_env *env, struct jk_msg *_this, unsigned char val); - int (*appendBytes)(struct jk_msg *_this, - const unsigned char * param, - const int len); + int (*appendBytes)(struct jk_env *env, struct jk_msg *_this, + const unsigned char * param, + const int len); - int (*appendInt)(struct jk_msg *_this, + int (*appendInt)(struct jk_env *env, struct jk_msg *_this, const unsigned short val); - int (*appendLong)(struct jk_msg *_this, + int (*appendLong)(struct jk_env *env, struct jk_msg *_this, const unsigned long val); - int (*appendString)(struct jk_msg *_this, + int (*appendString)(struct jk_env *env, struct jk_msg *_this, const char *param); - unsigned char (*getByte)(struct jk_msg *_this); + unsigned char (*getByte)(struct jk_env *env, struct jk_msg *_this); - unsigned short (*getInt)(struct jk_msg *_this); + unsigned short (*getInt)(struct jk_env *env, struct jk_msg *_this); /** Look at the next int, without reading it */ - unsigned short (*peekInt)(struct jk_msg *_this); + unsigned short (*peekInt)(struct jk_env *env, struct jk_msg *_this); - unsigned long (*getLong)(struct jk_msg *_this); + unsigned long (*getLong)(struct jk_env *env, struct jk_msg *_this); /** Return a string. The buffer is internal to the message, you must save or make sure the message lives long enough. */ - unsigned char *(*getString)(struct jk_msg *_this); + unsigned char *(*getString)(struct jk_env *env, struct jk_msg *_this); /** Return a byte[] and it's length. The buffer is internal to the message, you must save or make sure the message lives long enough. */ - unsigned char *(*getBytes)(struct jk_msg *_this, int *len); + unsigned char *(*getBytes)(struct jk_env *env, struct jk_msg *_this, int *len); /* * Receive a message from endpoint */ - int (*receive)(jk_msg_t *_this, struct jk_endpoint *ae ); + int (*receive)(struct jk_env *env, jk_msg_t *_this, struct jk_endpoint *ae ); /* * Send a message to endpoint */ - int (*send)(jk_msg_t *_this, struct jk_endpoint *ae ); + int (*send)(struct jk_env *env, jk_msg_t *_this, struct jk_endpoint *ae ); /** * Special method. Will read data from the server and add them as @@ -177,7 +179,8 @@ * * Returns -1 on error, else number of bytes read */ - int (*appendFromServer)(struct jk_msg *_this, + int (*appendFromServer)(struct jk_env *env, + struct jk_msg *_this, struct jk_ws_service *r, struct jk_endpoint *ae, int len ); @@ -186,7 +189,6 @@ /* Temporary, don't use */ struct jk_pool *pool; - struct jk_logger *l; unsigned char *buf; int pos; @@ -196,8 +198,8 @@ }; /* Temp */ -jk_msg_t *jk_msg_ajp_create(struct jk_pool *p, - struct jk_logger *l, int buffSize); +jk_msg_t *jk_msg_ajp_create(struct jk_env *env, struct jk_pool *p, + int buffSize); #ifdef __cplusplus } 1.4 +7 -6 jakarta-tomcat-connectors/jk/native2/include/jk_objCache.h Index: jk_objCache.h =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_objCache.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- jk_objCache.h 2001/12/12 22:02:30 1.3 +++ jk_objCache.h 2001/12/16 23:17:23 1.4 @@ -59,6 +59,7 @@ #define JK_OBJCACHE_H #include "jk_global.h" +#include "jk_env.h" #include "jk_logger.h" #include "jk_pool.h" #include "jk_msg.h" @@ -68,6 +69,7 @@ extern "C" { #endif /* __cplusplus */ +struct jk_env; struct jk_objCache; struct jk_logger; struct jk_pool; @@ -76,7 +78,7 @@ #define JK_OBJCACHE_DEFAULT_SZ (128) -jk_objCache_t *jk_objCache_create(struct jk_pool *pool, struct jk_logger *l ); +jk_objCache_t *jk_objCache_create(struct jk_env *env, struct jk_pool *pool ); /** * Simple object cache ( or pool for java people - don't confuse with the @@ -95,19 +97,18 @@ /** Return an object to the pool. * @return JK_FALSE the object can't be taken back, caller must free it. */ - int (*put)(jk_objCache_t *_this, void *obj); + int (*put)(struct jk_env *env, jk_objCache_t *_this, void *obj); - void *(*get)(jk_objCache_t *_this); + void *(*get)(struct jk_env *env, jk_objCache_t *_this); - int (*init)(jk_objCache_t *_this, int cacheSize); + int (*init)(struct jk_env *env, jk_objCache_t *_this, int cacheSize); - int (*destroy)(jk_objCache_t *_this); + int (*destroy)(struct jk_env *env, jk_objCache_t *_this); /* private, move to impl ( if any other impl is available) */ int ep_cache_sz; JK_CRIT_SEC cs; void **ep_cache; - struct jk_logger *l; struct jk_pool *pool; }; 1.5 +11 -9 jakarta-tomcat-connectors/jk/native2/include/jk_pool.h Index: jk_pool.h =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_pool.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- jk_pool.h 2001/12/06 22:48:49 1.4 +++ jk_pool.h 2001/12/16 23:17:23 1.5 @@ -58,12 +58,13 @@ /*************************************************************************** * Description: Memory Pool object header file * * Author: Gal Shachor <[EMAIL PROTECTED]> * - * Version: $Revision: 1.4 $ * + * Version: $Revision: 1.5 $ * ***************************************************************************/ #ifndef _JK_POOL_H #define _JK_POOL_H #include "jk_global.h" +#include "jk_env.h" #ifdef __cplusplus extern "C" { @@ -117,6 +118,7 @@ #define HUGE_POOL_SIZE 2*BIG_POOL_SIZE /* Huge 2K atom pool. */ struct jk_pool; +struct jk_env; typedef struct jk_pool jk_pool_t; @@ -126,26 +128,26 @@ /** Create a child pool. Size is a hint for the * estimated needs of the child. */ - jk_pool_t *(*create)(jk_pool_t *_this, + jk_pool_t *(*create)(struct jk_env *env, jk_pool_t *_this, int size ); - void (*close)(jk_pool_t *_this); + void (*close)(struct jk_env *env, jk_pool_t *_this); /** Empty the pool using the same space. * XXX should we rename it to clear() - consistent with apr ? */ - void (*reset)(jk_pool_t *_this); + void (*reset)(struct jk_env *env, jk_pool_t *_this); /* Memory allocation */ - void *(*alloc)(jk_pool_t *_this, size_t size); + void *(*alloc)(struct jk_env *env, jk_pool_t *_this, size_t size); - void *(*realloc)(jk_pool_t *_this, size_t size, + void *(*realloc)(struct jk_env *env, jk_pool_t *_this, size_t size, const void *old, size_t old_sz); - void *(*calloc)(jk_pool_t *_this, size_t size); + void *(*calloc)(struct jk_env *env, jk_pool_t *_this, size_t size); - void *(*pstrdup)(jk_pool_t *_this, const char *s); + void *(*pstrdup)(struct jk_env *env, jk_pool_t *_this, const char *s); /** Points to the private data. In the case of APR, it's a apr_pool you can use directly */ @@ -157,7 +159,7 @@ XXX move this to the factory */ -int jk_pool_create( jk_pool_t **newPool, jk_pool_t *parent, int size ); +int jk_pool_create( struct jk_env *env, jk_pool_t **newPool, jk_pool_t *parent, int size ); #ifdef __cplusplus 1.3 +9 -9 jakarta-tomcat-connectors/jk/native2/include/jk_requtil.h Index: jk_requtil.h =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_requtil.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- jk_requtil.h 2001/12/12 22:02:30 1.2 +++ jk_requtil.h 2001/12/16 23:17:23 1.3 @@ -154,50 +154,50 @@ /** Get header value using a lookup table. */ -const char *jk_requtil_getHeaderById(int sc); +const char *jk_requtil_getHeaderById(struct jk_env *env, int sc); /** * Get method id. */ -int jk_requtil_getMethodId(const char *method, +int jk_requtil_getMethodId(struct jk_env *env, const char *method, unsigned char *sc); /** * Get header id. */ -int jk_requtil_getHeaderId(const char *header_name, +int jk_requtil_getHeaderId(struct jk_env *env, const char *header_name, unsigned short *sc); /** Retrieve session id from the cookie or the parameter * (parameter first) */ -char *jk_requtil_getSessionId(jk_ws_service_t *s); +char *jk_requtil_getSessionId(struct jk_env *env, jk_ws_service_t *s); /** Retrieve the cookie with the given name */ -char *jk_requtil_getCookieByName(jk_ws_service_t *s, +char *jk_requtil_getCookieByName(struct jk_env *env, jk_ws_service_t *s, const char *name); /* Retrieve the parameter with the given name */ -char *jk_requtil_getPathParam(jk_ws_service_t *s, const char *name); +char *jk_requtil_getPathParam(struct jk_env *env, jk_ws_service_t *s, const char *name); /** Extract the 'route' from the session id. The route is * the id of the worker that generated the session and where all * further requests in that session will be sent. */ -char *jk_requtil_getSessionRoute(jk_ws_service_t *s); +char *jk_requtil_getSessionRoute(struct jk_env *env, jk_ws_service_t *s); /** Initialize the request * * jk_init_ws_service */ -void jk_requtil_initRequest(jk_ws_service_t *s); +void jk_requtil_initRequest(struct jk_env *env, jk_ws_service_t *s); -int jk_requtil_readFully(jk_ws_service_t *s, +int jk_requtil_readFully(struct jk_env *env, jk_ws_service_t *s, unsigned char *buf, unsigned len); 1.7 +11 -9 jakarta-tomcat-connectors/jk/native2/include/jk_service.h Index: jk_service.h =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_service.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- jk_service.h 2001/12/15 17:19:26 1.6 +++ jk_service.h 2001/12/16 23:17:23 1.7 @@ -63,7 +63,7 @@ * Author: Gal Shachor <[EMAIL PROTECTED]> * * Author: Dan Milstein <[EMAIL PROTECTED]> * * Author: Henri Gomez <[EMAIL PROTECTED]> * - * Version: $Revision: 1.6 $ * + * Version: $Revision: 1.7 $ * ***************************************************************************/ #ifndef JK_SERVICE_H @@ -71,6 +71,7 @@ #include "jk_global.h" #include "jk_map.h" +#include "jk_env.h" #include "jk_workerEnv.h" #include "jk_logger.h" #include "jk_pool.h" @@ -87,6 +88,8 @@ struct jk_worker; struct jk_workerEnv; struct jk_channel; +struct jk_pool; +struct jk_env; typedef struct jk_ws_service jk_ws_service_t; /* @@ -138,7 +141,7 @@ * Alive as long as the request is alive. * You can use endpoint pool for communication - it is recycled. */ - jk_pool_t *pool; + struct jk_pool *pool; /* * CGI Environment needed by servlets @@ -226,25 +229,25 @@ /* Initialize the service structure */ - int (*init)( jk_ws_service_t *_this, + int (*init)( struct jk_env *env, jk_ws_service_t *_this, struct jk_endpoint *e, void *serverObj); /* Post request cleanup. */ - void (*afterRequest)( jk_ws_service_t *_this ); + void (*afterRequest)( struct jk_env *env, jk_ws_service_t *_this ); /* * Set the response head in the server structures. This will be called * before the first write. */ - int (JK_METHOD *head)(jk_ws_service_t *s); + int (JK_METHOD *head)(struct jk_env *env, jk_ws_service_t *s); /* * Read a chunk of the request body into a buffer. Attempt to read len * bytes into the buffer. Write the number of bytes actually read into * actually_read. */ - int (JK_METHOD *read)(jk_ws_service_t *s, + int (JK_METHOD *read)(struct jk_env *env, jk_ws_service_t *s, void *buffer, unsigned len, unsigned *actually_read); @@ -252,9 +255,8 @@ /* * Write a chunk of response data back to the browser. */ - int (JK_METHOD *write)(jk_ws_service_t *s, - const void *buffer, - unsigned len); + int (JK_METHOD *write)(struct jk_env *env, jk_ws_service_t *s, + const void *buffer, int len); }; #ifdef __cplusplus 1.5 +1 -0 jakarta-tomcat-connectors/jk/native2/include/jk_uriEnv.h Index: jk_uriEnv.h =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_uriEnv.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- jk_uriEnv.h 2001/12/06 22:48:49 1.4 +++ jk_uriEnv.h 2001/12/16 23:17:23 1.5 @@ -125,6 +125,7 @@ int match_type; + int debug; /* -------------------- Methods -------------------- */ /* get/setProperty */ 1.7 +11 -6 jakarta-tomcat-connectors/jk/native2/include/jk_uriMap.h Index: jk_uriMap.h =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_uriMap.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- jk_uriMap.h 2001/12/14 07:09:01 1.6 +++ jk_uriMap.h 2001/12/16 23:17:23 1.7 @@ -79,9 +79,11 @@ #define JK_URIMAP_H #include "jk_global.h" +#include "jk_env.h" #include "jk_logger.h" #include "jk_uriEnv.h" #include "jk_map.h" +#include "jk_pool.h" #ifdef __cplusplus extern "C" { @@ -89,6 +91,9 @@ struct jk_uriMap; struct jk_map; +struct jk_env; +struct jk_pool; + typedef struct jk_uriMap jk_uriMap_t; struct jk_uriMap { @@ -104,22 +109,22 @@ /** Initialize the map. This should be called after all workers were added. It'll check if mappings have valid workers. */ - int (*init)( jk_uriMap_t *_this, + int (*init)( struct jk_env *env, jk_uriMap_t *_this, struct jk_workerEnv *workerEnv, struct jk_map *init_data ); - void (*destroy)( jk_uriMap_t *_this ); + void (*destroy)( struct jk_env *env, jk_uriMap_t *_this ); /** Add a servlet mapping. Can be done before init() */ - jk_uriEnv_t *(*addMapping)( jk_uriMap_t *_this, + jk_uriEnv_t *(*addMapping)( struct jk_env *env, jk_uriMap_t *_this, const char *vhost, const char *uri, const char *worker); /** Check the uri for potential security problems */ - int (*checkUri)( jk_uriMap_t *_this, + int (*checkUri)( struct jk_env *env, jk_uriMap_t *_this, const char *uri ); /** Mapping the uri. To be thread safe, we need to pass a pool. @@ -132,7 +137,7 @@ to do what we need ). Even when we'll know, uriMap will be needed for other servers. */ - struct jk_uriEnv *(*mapUri)(jk_uriMap_t *_this, + struct jk_uriEnv *(*mapUri)(struct jk_env *env, jk_uriMap_t *_this, const char *vhost, const char *uri ); @@ -142,7 +147,7 @@ /* pool for mappings. Mappings will change at runtime, we can't * recycle the main pool. */ - jk_pool_t *pool; + struct jk_pool *pool; }; #ifdef __cplusplus 1.3 +6 -0 jakarta-tomcat-connectors/jk/native2/include/jk_webapp.h Index: jk_webapp.h =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_webapp.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- jk_webapp.h 2001/12/14 07:09:01 1.2 +++ jk_webapp.h 2001/12/16 23:17:23 1.3 @@ -81,6 +81,7 @@ struct jk_env; struct jk_uri_worker_map; struct jk_map; +struct jk_uriMap; struct jk_logger; struct jk_webapp; @@ -108,6 +109,11 @@ * worker will be set on init. */ char *workerName; + + /* 'Local' mappings. This is the information from web.xml, either + read from file or received from tomcat + */ + struct jk_uriMap *uriMap; /* Virtual server handled - NULL means 'global' ( visible in all * virtual servers ). This is the canonical name. 1.9 +11 -12 jakarta-tomcat-connectors/jk/native2/include/jk_worker.h Index: jk_worker.h =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_worker.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- jk_worker.h 2001/12/14 07:09:01 1.8 +++ jk_worker.h 2001/12/16 23:17:23 1.9 @@ -58,12 +58,14 @@ /*************************************************************************** * Description: Workers controller header file * * Author: Gal Shachor <[EMAIL PROTECTED]> * - * Version: $Revision: 1.8 $ * + * Version: $Revision: 1.9 $ * ***************************************************************************/ #ifndef JK_WORKER_H #define JK_WORKER_H +#include "jk_env.h" +#include "jk_pool.h" #include "jk_logger.h" #include "jk_service.h" #include "jk_endpoint.h" @@ -133,7 +135,7 @@ In future we may start/stop/reload workers at runtime, but that's far away */ - jk_pool_t *pool; + struct jk_pool *pool; /* * A 'this' pointer which is used by the subclasses of this class to @@ -205,28 +207,25 @@ * * You can skip this by setting it to NULL. */ - int (JK_METHOD *validate)(jk_worker_t *_this, + int (JK_METHOD *validate)(struct jk_env *env, jk_worker_t *_this, struct jk_map *props, - struct jk_workerEnv *we, - struct jk_logger *l); + struct jk_workerEnv *we); /* * Do whatever initialization needs to be done to start this worker up. * Configuration options are passed in via the props parameter. */ - int (JK_METHOD *init)(jk_worker_t *_this, + int (JK_METHOD *init)(struct jk_env *env, jk_worker_t *_this, struct jk_map *props, - struct jk_workerEnv *we, - struct jk_logger *l ); + struct jk_workerEnv *we ); /* * Obtain an endpoint to service a particular request. A pointer to * the endpoint is stored in pend. The done() method in the * endpoint will be called when the endpoint is no longer needed. */ - int (JK_METHOD *get_endpoint)(jk_worker_t *_this, - struct jk_endpoint **pend, - struct jk_logger *l ); + int (JK_METHOD *get_endpoint)(struct jk_env *env, jk_worker_t *_this, + struct jk_endpoint **pend ); /* * Called when this particular endpoint has finished processing a @@ -242,7 +241,7 @@ /* * Shutdown this worker. */ - int (JK_METHOD *destroy)(jk_worker_t **_thisP, struct jk_logger *l ); + int (JK_METHOD *destroy)(struct jk_env *env, jk_worker_t *_thisP ); }; #ifdef __cplusplus 1.7 +14 -12 jakarta-tomcat-connectors/jk/native2/include/jk_workerEnv.h Index: jk_workerEnv.h =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_workerEnv.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- jk_workerEnv.h 2001/12/14 07:09:01 1.6 +++ jk_workerEnv.h 2001/12/16 23:17:23 1.7 @@ -58,7 +58,7 @@ /*************************************************************************** * Description: Workers controller header file * * Author: Gal Shachor <[EMAIL PROTECTED]> * - * Version: $Revision: 1.6 $ * + * Version: $Revision: 1.7 $ * ***************************************************************************/ #ifndef JK_WORKERENV_H @@ -110,6 +110,8 @@ */ struct jk_map *worker_map; + struct jk_env *globalEnv; + /** Number of workers that are configured. XXX same as size( worker_map ) */ @@ -135,7 +137,7 @@ /** Root env, used to register object types, etc */ - struct jk_env *env; + struct jk_env *rootEnv; /* * Log options. Extracted from init_data. @@ -143,10 +145,6 @@ char *log_file; int log_level; - /** Global logger for jk messages. Set at init. - */ - struct jk_logger *l; - /* * Worker stuff */ @@ -208,20 +206,24 @@ /** Get worker by name */ - struct jk_worker *(*getWorkerForName)(struct jk_workerEnv *_this, + struct jk_worker *(*getWorkerForName)(struct jk_env *env, + struct jk_workerEnv *_this, const char *name); - struct jk_worker *(*createWorker)(struct jk_workerEnv *_this, + struct jk_worker *(*createWorker)(struct jk_env *env, + struct jk_workerEnv *_this, const char *name, struct jk_map *init_data); - struct jk_webapp *(*createWebapp)(struct jk_workerEnv *_this, + struct jk_webapp *(*createWebapp)(struct jk_env *env, + struct jk_workerEnv *_this, const char *vhost, const char *name, struct jk_map *init_data); - int (*processCallbacks)(struct jk_workerEnv *_this, + int (*processCallbacks)(struct jk_env *env, + struct jk_workerEnv *_this, struct jk_endpoint *e, struct jk_ws_service *r ); @@ -230,12 +232,12 @@ * * Replaces wc_open */ - int (*init)(struct jk_workerEnv *_this); + int (*init)(struct jk_env *env, struct jk_workerEnv *_this); /** Close all workers, clean up * */ - void (*close)(struct jk_workerEnv *_this); + void (*close)(struct jk_env *env, struct jk_workerEnv *_this); };
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>