hgomez 02/02/21 03:11:15 Modified: jk/native2/common jk_lb_worker.c jk_logger_file.c jk_map.c jk_md5.c jk_msg_ajp.c Log: Third Batch of jk2 renaming Revision Changes Path 1.14 +21 -21 jakarta-tomcat-connectors/jk/native2/common/jk_lb_worker.c Index: jk_lb_worker.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_lb_worker.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- jk_lb_worker.c 26 Jan 2002 06:56:25 -0000 1.13 +++ jk_lb_worker.c 21 Feb 2002 11:11:15 -0000 1.14 @@ -60,7 +60,7 @@ * several workers. * * Author: Gal Shachor <[EMAIL PROTECTED]> * * Based on: * - * Version: $Revision: 1.13 $ * + * Version: $Revision: 1.14 $ * ***************************************************************************/ #include "jk_pool.h" @@ -77,7 +77,7 @@ #define ADDITINAL_WAIT_LOAD (20) -int JK_METHOD jk_worker_lb_factory(jk_env_t *env, jk_pool_t *pool, +int JK_METHOD jk2_worker_lb_factory(jk_env_t *env, jk_pool_t *pool, void **result,char *type, char *name); @@ -86,7 +86,7 @@ * This + ADDITIONAL_WAIT_LOAD will be set on all the workers * that recover after an error. */ -static double get_max_lb(jk_worker_t *p) +static double jk2_get_max_lb(jk_worker_t *p) { int i; double rc = 0.0; @@ -109,13 +109,13 @@ It'll also adjust the load balancing factors. */ -static jk_worker_t *get_most_suitable_worker(jk_env_t *env, jk_worker_t *p, - jk_ws_service_t *s, int attempt) +static jk_worker_t *jk2_get_most_suitable_worker(jk_env_t *env, jk_worker_t *p, + jk_ws_service_t *s, int attempt) { jk_worker_t *rc = NULL; double lb_min = 0.0; int i; - char *session_route = jk_requtil_getSessionRoute(env, s); + char *session_route = jk2_requtil_getSessionRoute(env, s); if(session_route) { for(i = 0 ; i < p->num_of_workers ; i++) { @@ -163,9 +163,9 @@ Since we don't directly connect to anything, there's no need for an endpoint. */ -static int JK_METHOD service(jk_env_t *env, - jk_worker_t *w, - jk_ws_service_t *s) +static int JK_METHOD jk2_lb_service(jk_env_t *env, + jk_worker_t *w, + jk_ws_service_t *s) { int attempt=0; @@ -179,7 +179,7 @@ s->realWorker=NULL; while(1) { - jk_worker_t *rec = get_most_suitable_worker(env, w, s, attempt++); + jk_worker_t *rec = jk2_get_most_suitable_worker(env, w, s, attempt++); int rc; s->is_recoverable_error = JK_FALSE; @@ -200,7 +200,7 @@ if(rc==JK_TRUE) { if(rec->in_recovering) { - rec->lb_value = get_max_lb(rec) + ADDITINAL_WAIT_LOAD; + rec->lb_value = jk2_get_max_lb(rec) + ADDITINAL_WAIT_LOAD; } rec->in_error_state = JK_FALSE; rec->in_recovering = JK_FALSE; @@ -236,8 +236,8 @@ return JK_FALSE; } -static int JK_METHOD validate(jk_env_t *env, jk_worker_t *_this, - jk_map_t *props, jk_workerEnv_t *we) +static int JK_METHOD jk2_lb_validate(jk_env_t *env, jk_worker_t *_this, + jk_map_t *props, jk_workerEnv_t *we) { int err; char **worker_names; @@ -251,7 +251,7 @@ return JK_FALSE; } - tmp=jk_map_getStrProp( env, props, "worker", _this->name, + tmp=jk2_map_getStrProp( env, props, "worker", _this->name, "balanced_workers", NULL ); if( tmp==NULL ) { env->l->jkLog(env, env->l, JK_LOG_ERROR, @@ -259,7 +259,7 @@ return JK_FALSE; } - worker_names=jk_map_split( env, props, props->pool, + worker_names=jk2_map_split( env, props, props->pool, tmp, NULL, &num_of_workers ); if( worker_names==NULL || num_of_workers==0 ) { @@ -293,7 +293,7 @@ continue; } - tmp=jk_map_getStrProp( env, props, "worker", name, "lbfactor", NULL ); + tmp=jk2_map_getStrProp( env, props, "worker", name, "lbfactor", NULL ); if( tmp==NULL ) _this->lb_workers[i]->lb_factor = DEFAULT_LB_FACTOR; else @@ -320,7 +320,7 @@ return JK_TRUE; } -static int JK_METHOD destroy(jk_env_t *env, jk_worker_t *w) +static int JK_METHOD jk2_lb_destroy(jk_env_t *env, jk_worker_t *w) { int i = 0; @@ -345,7 +345,7 @@ } -int JK_METHOD jk_worker_lb_factory(jk_env_t *env,jk_pool_t *pool, +int JK_METHOD jk2_worker_lb_factory(jk_env_t *env,jk_pool_t *pool, void **result, char *type, char *name) { jk_worker_t *_this; @@ -370,10 +370,10 @@ _this->lb_workers = NULL; _this->num_of_workers = 0; _this->worker_private = NULL; - _this->validate = validate; + _this->validate = jk2_lb_validate; _this->init = NULL; - _this->destroy = destroy; - _this->service = service; + _this->destroy = jk2_lb_destroy; + _this->service = jk2_lb_service; *result=_this; 1.11 +32 -32 jakarta-tomcat-connectors/jk/native2/common/jk_logger_file.c Index: jk_logger_file.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_logger_file.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- jk_logger_file.c 31 Dec 2001 19:17:51 -0000 1.10 +++ jk_logger_file.c 21 Feb 2002 11:11:15 -0000 1.11 @@ -59,7 +59,7 @@ * Description: Utility functions (mainly configuration) * * Author: Gal Shachor <[EMAIL PROTECTED]> * * Author: Henri Gomez <[EMAIL PROTECTED]> * - * Version: $Revision: 1.10 $ * + * Version: $Revision: 1.11 $ * ***************************************************************************/ #include "jk_env.h" @@ -74,7 +74,7 @@ #define HUGE_BUFFER_SIZE (8*1024) #define LOG_LINE_SIZE (1024) -int JK_METHOD jk_logger_file_factory(jk_env_t *env, jk_pool_t *pool, void **result, +int JK_METHOD jk2_logger_file_factory(jk_env_t *env, jk_pool_t *pool, void **result, const char *type, const char *name); @@ -88,21 +88,21 @@ #define JK_TIME_FORMAT "[%a %b %d %H:%M:%S %Y] " #endif -const char * jk_logger_file_logFmt = JK_TIME_FORMAT; +static const char * jk2_logger_file_logFmt = JK_TIME_FORMAT; -static void jk_logger_file_setTimeStr(jk_env_t *env,char * str, int len) +static void jk2_logger_file_setTimeStr(jk_env_t *env,char * str, int len) { time_t t = time(NULL); struct tm *tms; tms = gmtime(&t); if( tms==NULL ) return; - strftime(str, len, jk_logger_file_logFmt, tms); + strftime(str, len, jk2_logger_file_logFmt, tms); } -static int jk_logger_file_log(jk_env_t *env,jk_logger_t *l, - int level, - const char *what) +static int jk2_logger_file_log(jk_env_t *env,jk_logger_t *l, + int level, + const char *what) { FILE *f = (FILE *)l->logger_private; @@ -126,7 +126,7 @@ return JK_FALSE; } -static int jk_logger_file_parseLogLevel(jk_env_t *env, const char *level) +static int jk2_logger_file_parseLogLevel(jk_env_t *env, const char *level) { if( level == NULL ) return JK_LOG_ERROR_LEVEL; @@ -145,19 +145,19 @@ return JK_LOG_DEBUG_LEVEL; } -static int jk_logger_file_open(jk_env_t *env,jk_logger_t *_this, - jk_map_t *properties ) +static int jk2_logger_file_open(jk_env_t *env,jk_logger_t *_this, + jk_map_t *properties ) { - char *file=jk_map_getStrProp(NULL, properties,"logger","file", + char *file=jk2_map_getStrProp(NULL, properties,"logger","file", "name","mod_jk.log"); int level; - char *levelS=jk_map_getStrProp(NULL, properties,"logger","file", + char *levelS=jk2_map_getStrProp(NULL, properties,"logger","file", "level", "ERROR"); - char *logformat=jk_map_getStrProp(NULL, properties,"logger","file", + char *logformat=jk2_map_getStrProp(NULL, properties,"logger","file", "timeFormat", JK_TIME_FORMAT); FILE *f; - _this->level = jk_logger_file_parseLogLevel(env, levelS); + _this->level = jk2_logger_file_parseLogLevel(env, levelS); if( _this->level == 0 ) _this->jkLog( env, _this, JK_LOG_ERROR, "Level %s %d \n", levelS, _this->level ); @@ -165,7 +165,7 @@ if( logformat==NULL ) { logformat=JK_TIME_FORMAT; } - jk_logger_file_logFmt = logformat; + jk2_logger_file_logFmt = logformat; f = fopen(file, "a+"); if(f==NULL) { @@ -177,7 +177,7 @@ return JK_TRUE; } -static int jk_logger_file_close(jk_env_t *env,jk_logger_t *_this) +static int jk2_logger_file_close(jk_env_t *env,jk_logger_t *_this) { FILE *f = _this->logger_private; if( f==NULL ) return JK_TRUE; @@ -190,11 +190,11 @@ return JK_TRUE; } -static int jk_logger_file_jkLog(jk_env_t *env, jk_logger_t *l, - const char *file, - int line, - int level, - const char *fmt, ...) +static int jk2_logger_file_jkLog(jk_env_t *env, jk_logger_t *l, + const char *file, + int line, + int level, + const char *fmt, ...) { int rc = 0; @@ -232,12 +232,12 @@ if (NULL == buf) return -1; - jk_logger_file_setTimeStr(buf, HUGE_BUFFER_SIZE); + jk2_logger_file_setTimeStr(buf, HUGE_BUFFER_SIZE); used = strlen(buf); if( level >= JK_LOG_DEBUG_LEVEL ) used += sprintf(&buf[used], " [%s (%d)]: ", f, line); #else - jk_logger_file_setTimeStr(env, buf, HUGE_BUFFER_SIZE); + jk2_logger_file_setTimeStr(env, buf, HUGE_BUFFER_SIZE); used = strlen(buf); if( level >= JK_LOG_DEBUG_LEVEL ) used += snprintf(&buf[used], HUGE_BUFFER_SIZE, " [%s (%d)]: ", f, line); @@ -266,11 +266,11 @@ } -int jk_logger_file_factory(jk_env_t *env, - jk_pool_t *pool, - void **result, - const char *type, - const char *name) +int jk2_logger_file_factory(jk_env_t *env, + jk_pool_t *pool, + void **result, + const char *type, + const char *name) { jk_logger_t *l = (jk_logger_t *)pool->alloc(env, pool, sizeof(jk_logger_t)); @@ -278,10 +278,10 @@ return JK_FALSE; } - l->log = jk_logger_file_log; + l->log = jk2_logger_file_log; l->logger_private = NULL; - l->open =jk_logger_file_open; - l->jkLog = jk_logger_file_jkLog; + l->open =jk2_logger_file_open; + l->jkLog = jk2_logger_file_jkLog; *result=(void *)l; l->level=JK_LOG_ERROR_LEVEL; 1.14 +76 -80 jakarta-tomcat-connectors/jk/native2/common/jk_map.c Index: jk_map.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_map.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- jk_map.c 15 Jan 2002 09:43:13 -0000 1.13 +++ jk_map.c 21 Feb 2002 11:11:15 -0000 1.14 @@ -58,7 +58,7 @@ /*************************************************************************** * Description: General purpose map object * * Author: Gal Shachor <[EMAIL PROTECTED]> * - * Version: $Revision: 1.13 $ * + * Version: $Revision: 1.14 $ * ***************************************************************************/ #include "jk_global.h" @@ -77,12 +77,12 @@ int size; } jk_map_private_t; -static int jk_map_default_realloc(jk_env_t *env, jk_map_t *m); -static void trim_prp_comment(char *prp); -static int trim(char *s); +static int jk2_map_default_realloc(jk_env_t *env, jk_map_t *m); +static void jk2_trim_prp_comment(char *prp); +static int jk2_trim(char *s); -static void *jk_map_default_get(jk_env_t *env, jk_map_t *m, - const char *name) +static void *jk2_map_default_get(jk_env_t *env, jk_map_t *m, + const char *name) { int i; jk_map_private_t *mPriv; @@ -101,9 +101,9 @@ } -static int jk_map_default_put(jk_env_t *env, jk_map_t *m, - const char *name, void *value, - void **old) +static int jk2_map_default_put(jk_env_t *env, jk_map_t *m, + const char *name, void *value, + void **old) { int rc = JK_FALSE; int i; @@ -128,7 +128,7 @@ return JK_TRUE; } - jk_map_default_realloc(env, m); + jk2_map_default_realloc(env, m); if(mPriv->size < mPriv->capacity) { mPriv->values[mPriv->size] = value; @@ -146,8 +146,8 @@ return rc; } -static int jk_map_default_add(jk_env_t *env, jk_map_t *m, - const char *name, void *value) +static int jk2_map_default_add(jk_env_t *env, jk_map_t *m, + const char *name, void *value) { int rc = JK_FALSE; int i; @@ -158,7 +158,7 @@ mPriv=(jk_map_private_t *)m->_private; - jk_map_default_realloc(env, m); + jk2_map_default_realloc(env, m); if(mPriv->size < mPriv->capacity) { mPriv->values[mPriv->size] = value; @@ -174,7 +174,7 @@ return rc; } -static int jk_map_default_size(jk_env_t *env, jk_map_t *m) +static int jk2_map_default_size(jk_env_t *env, jk_map_t *m) { jk_map_private_t *mPriv; @@ -183,8 +183,8 @@ return mPriv->size; } -static char *jk_map_default_nameAt(jk_env_t *env, jk_map_t *m, - int idex) +static char *jk2_map_default_nameAt(jk_env_t *env, jk_map_t *m, + int idex) { jk_map_private_t *mPriv; @@ -196,8 +196,8 @@ return (char *)mPriv->names[idex]; } -static void *jk_map_default_valueAt(jk_env_t *env, jk_map_t *m, - int idex) +static void *jk2_map_default_valueAt(jk_env_t *env, jk_map_t *m, + int idex) { jk_map_private_t *mPriv; @@ -209,7 +209,7 @@ return (void *) mPriv->values[idex]; } -static void jk_map_default_clear(jk_env_t *env, jk_map_t *m ) +static void jk2_map_default_clear(jk_env_t *env, jk_map_t *m ) { jk_map_private_t *mPriv; @@ -219,13 +219,13 @@ } -static void jk_map_default_init(jk_env_t *env, jk_map_t *m, int initialSize, - void *wrappedObj) +static void jk2_map_default_init(jk_env_t *env, jk_map_t *m, int initialSize, + void *wrappedObj) { } -int jk_map_append(jk_env_t *env, jk_map_t * dst, jk_map_t * src ) +int jk2_map_append(jk_env_t *env, jk_map_t * dst, jk_map_t * src ) { /* This was badly broken in the original ! */ int sz = src->size(env, src); @@ -248,8 +248,8 @@ /* General purpose map utils - independent of the map impl */ -char *jk_map_getString(jk_env_t *env, jk_map_t *m, - const char *name, char *def) +char *jk2_map_getString(jk_env_t *env, jk_map_t *m, + const char *name, char *def) { char *val= m->get( env, m, name ); if( val==NULL ) @@ -257,21 +257,17 @@ return val; } -int jk_map_getBool(jk_env_t *env, jk_map_t *m, - const char *prop, const char *def) +int jk2_map_getBool(jk_env_t *env, jk_map_t *m, + const char *prop, const char *def) { - char *val=jk_map_getString( env, m, prop, (char *)def ); + char *val=jk2_map_getString( env, m, prop, (char *)def ); if( val==NULL ) return JK_FALSE; if( strcmp( val, "1" ) == 0 || - strcmp( val, "true" ) == 0 || - strcmp( val, "TRUE" ) == 0 || - strcmp( val, "True" ) == 0 || - strcmp( val, "on" ) == 0 || - strcmp( val, "On" ) == 0 || - strcmp( val, "ON" ) == 0 ) { + strcasecmp( val, "TRUE" ) == 0 || + strcasecmp( val, "ON" ) == 0 ) { return JK_TRUE; } return JK_FALSE; @@ -281,10 +277,10 @@ for properties. Example worker.ajp13.host=localhost. */ -char *jk_map_getStrProp(jk_env_t *env, jk_map_t *m, - const char *objType, const char *objName, - const char *pname, - char *def) +char *jk2_map_getStrProp(jk_env_t *env, jk_map_t *m, + const char *objType, const char *objName, + const char *pname, + char *def) { char buf[1024]; char *res; @@ -302,17 +298,17 @@ return res; } -int jk_map_getIntProp(jk_env_t *env, jk_map_t *m, - const char *objType, const char *objName, - const char *pname, - int def) +int jk2_map_getIntProp(jk_env_t *env, jk_map_t *m, + const char *objType, const char *objName, + const char *pname, + int def) { - char *val=jk_map_getStrProp( env, m, objType, objName, pname, NULL ); + char *val=jk2_map_getStrProp( env, m, objType, objName, pname, NULL ); if( val==NULL ) return def; - return jk_map_str2int( env, val ); + return jk2_map_str2int( env, val ); } /* ==================== */ @@ -320,7 +316,7 @@ /* Convert a string to int, using 'M', 'K' suffixes */ -int jk_map_str2int(jk_env_t *env, char *val ) +int jk2_map_str2int(jk_env_t *env, char *val ) { /* map2int: char *v=getString(); return (c==NULL) ? def : str2int( v ); @@ -358,11 +354,11 @@ return int_res * multit; } -char **jk_map_split(jk_env_t *env, jk_map_t *m, - jk_pool_t *pool, - const char *listStr, - const char *sep, - unsigned *list_len ) +char **jk2_map_split(jk_env_t *env, jk_map_t *m, + jk_pool_t *pool, + const char *listStr, + const char *sep, + unsigned *list_len ) { char **ar = NULL; unsigned capacity = 0; @@ -422,8 +418,8 @@ /* ==================== */ /* Reading / parsing */ -int jk_map_readFileProperties(jk_env_t *env, jk_map_t *m, - const char *f) +int jk2_map_readFileProperties(jk_env_t *env, jk_map_t *m, + const char *f) { int rc = JK_FALSE; FILE *fp; @@ -444,9 +440,9 @@ while(NULL != (prp = fgets(buf, LENGTH_OF_LINE, fp))) { char *oldv; - trim_prp_comment(prp); + jk2_trim_prp_comment(prp); - if( trim(prp)==0 ) + if( jk2_trim(prp)==0 ) continue; v = strchr(prp, '='); @@ -459,7 +455,7 @@ if(strlen(v)==0 || strlen(prp)==0) continue; - v = jk_map_replaceProperties(env, m, m->pool, v); + v = jk2_map_replaceProperties(env, m, m->pool, v); /* We don't contatenate the values - but use multi-value fields. This eliminates the ugly hack where readProperties @@ -486,10 +482,10 @@ * values or values separated by one of the sep's chars ) * */ -char *jk_map_getValuesString(jk_env_t *env, jk_map_t *m, - struct jk_pool *resultPool, - char *name, - char *sep ) +char *jk2_map_getValuesString(jk_env_t *env, jk_map_t *m, + struct jk_pool *resultPool, + char *name, + char *sep ) { char **values; int valuesCount; @@ -501,9 +497,9 @@ char sepStr[2]; if(sep==NULL) - values=jk_map_getValues( env, m, resultPool, name," \t,*", &valuesCount ); + values=jk2_map_getValues( env, m, resultPool, name," \t,*", &valuesCount ); else - values=jk_map_getValues( env, m, resultPool, name, sep, &valuesCount ); + values=jk2_map_getValues( env, m, resultPool, name, sep, &valuesCount ); if( values==NULL ) return NULL; if( valuesCount<=0 ) return NULL; @@ -539,11 +535,11 @@ * @param sep Optional separator, it'll be used to split existing values. * Curently only single-char separators are supported. */ -char **jk_map_getValues(jk_env_t *env, jk_map_t *m, - struct jk_pool *resultPool, - char *name, - char *sep, - int *countP) +char **jk2_map_getValues(jk_env_t *env, jk_map_t *m, + struct jk_pool *resultPool, + char *name, + char *sep, + int *countP) { char **result; int count=0; @@ -586,9 +582,9 @@ * Replace $(property) in value. * */ -char *jk_map_replaceProperties(jk_env_t *env, jk_map_t *m, - struct jk_pool *resultPool, - char *value) +char *jk2_map_replaceProperties(jk_env_t *env, jk_map_t *m, + struct jk_pool *resultPool, + char *value) { char *rc = value; char *env_start = rc; @@ -642,7 +638,7 @@ /* Internal utils */ -int jk_map_default_create(jk_env_t *env, jk_map_t **m, jk_pool_t *pool ) +int jk2_map_default_create(jk_env_t *env, jk_map_t **m, jk_pool_t *pool ) { jk_map_t *_this; jk_map_private_t *mPriv; @@ -665,14 +661,14 @@ mPriv->names = NULL; mPriv->values = NULL; - _this->get=jk_map_default_get; - _this->put=jk_map_default_put; - _this->add=jk_map_default_add; - _this->size=jk_map_default_size; - _this->nameAt=jk_map_default_nameAt; - _this->valueAt=jk_map_default_valueAt; - _this->init=jk_map_default_init; - _this->clear=jk_map_default_clear; + _this->get=jk2_map_default_get; + _this->put=jk2_map_default_put; + _this->add=jk2_map_default_add; + _this->size=jk2_map_default_size; + _this->nameAt=jk2_map_default_nameAt; + _this->valueAt=jk2_map_default_valueAt; + _this->init=jk2_map_default_init; + _this->clear=jk2_map_default_clear; return JK_TRUE; @@ -691,7 +687,7 @@ /* } */ -static void trim_prp_comment(char *prp) +static void jk2_trim_prp_comment(char *prp) { char *comment = strchr(prp, '#'); if(comment) { @@ -699,7 +695,7 @@ } } -static int trim(char *s) +static int jk2_trim(char *s) { int i; @@ -718,7 +714,7 @@ return strlen(s); } -static int jk_map_default_realloc(jk_env_t *env, jk_map_t *m) +static int jk2_map_default_realloc(jk_env_t *env, jk_map_t *m) { jk_map_private_t *mPriv=m->_private; 1.4 +37 -37 jakarta-tomcat-connectors/jk/native2/common/jk_md5.c Index: jk_md5.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_md5.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- jk_md5.c 20 Dec 2001 17:55:43 -0000 1.3 +++ jk_md5.c 21 Feb 2002 11:11:15 -0000 1.4 @@ -103,7 +103,7 @@ /*************************************************************************** * Description: MD5 encoding wrapper * * Author: Henri Gomez <[EMAIL PROTECTED]> * - * Version: $Revision: 1.3 $ * + * Version: $Revision: 1.4 $ * ***************************************************************************/ /* @@ -123,7 +123,7 @@ #include "jk_env.h" #include "jk_md5.h" -char * JK_METHOD jk_hextocstr(unsigned char *org, char * dst, int n) +char * JK_METHOD jk2_hextocstr(unsigned char *org, char * dst, int n) { char * os = dst; unsigned char v; @@ -141,7 +141,7 @@ #ifndef USE_APACHE_MD5 -/* Constants for MD5Transform routine. +/* Constants for jk2_MD5Transform routine. */ #define S11 7 @@ -161,12 +161,12 @@ #define S43 15 #define S44 21 -static void MD5Transform(JK_UINT4 state[4], const unsigned char block[64]); -static void Encode(unsigned char *output, const JK_UINT4 *input, unsigned int len); -static void Decode(JK_UINT4 *output, const unsigned char *input, unsigned int len); -static void jk_MD5Init(JK_MD5_CTX *context); -static void jk_MD5Update(JK_MD5_CTX *context, const unsigned char *input, unsigned int inputLen); -/*static void jk_MD5Final(unsigned char digest[JK_MD5_DIGESTSIZE], JK_MD5_CTX *context);*/ +static void jk2_MD5Transform(JK_UINT4 state[4], const unsigned char block[64]); +static void jk2_Encode(unsigned char *output, const JK_UINT4 *input, unsigned int len); +static void jk2_Decode(JK_UINT4 *output, const unsigned char *input, unsigned int len); +static void jk2_MD5Init(JK_MD5_CTX *context); +static void jk2_MD5Update(JK_MD5_CTX *context, const unsigned char *input, unsigned int inputLen); +/*static void jk2_MD5Final(unsigned char digest[JK_MD5_DIGESTSIZE], JK_MD5_CTX *context);*/ static unsigned char PADDING[64] = { @@ -212,7 +212,7 @@ /* MD5 initialization. Begins an MD5 operation, writing a new context. */ -static void jk_MD5Init(JK_MD5_CTX *context) +static void jk2_MD5Init(JK_MD5_CTX *context) { context->count[0] = context->count[1] = 0; /* Load magic initialization constants. */ @@ -226,7 +226,7 @@ operation, processing another message block, and updating the context. */ -static void jk_MD5Update(JK_MD5_CTX *context, const unsigned char *input, +static void jk2_MD5Update(JK_MD5_CTX *context, const unsigned char *input, unsigned int inputLen) { unsigned int i, idx, partLen; @@ -247,10 +247,10 @@ #ifndef CHARSET_EBCDIC if (inputLen >= partLen) { memcpy(&context->buffer[idx], input, partLen); - MD5Transform(context->state, context->buffer); + jk2_MD5Transform(context->state, context->buffer); for (i = partLen; i + 63 < inputLen; i += 64) { - MD5Transform(context->state, &input[i]); + jk2_MD5Transform(context->state, &input[i]); } idx = 0; @@ -264,12 +264,12 @@ #else /*CHARSET_EBCDIC*/ if (inputLen >= partLen) { ebcdic2ascii(&context->buffer[idx], input, partLen); - MD5Transform(context->state, context->buffer); + jk2_MD5Transform(context->state, context->buffer); for (i = partLen; i + 63 < inputLen; i += 64) { unsigned char inp_tmp[64]; ebcdic2ascii(inp_tmp, &input[i], 64); - MD5Transform(context->state, inp_tmp); + jk2_MD5Transform(context->state, inp_tmp); } idx = 0; @@ -286,25 +286,25 @@ /* MD5 finalization. Ends an MD5 message-digest operation, writing the the message digest and zeroizing the context. */ -void JK_METHOD jk_MD5Final(unsigned char digest[16], JK_MD5_CTX *context) +void JK_METHOD jk2_MD5Final(unsigned char digest[16], JK_MD5_CTX *context) { unsigned char bits[8]; unsigned int idx, padLen; /* Save number of bits */ - Encode(bits, context->count, 8); + jk2_Encode(bits, context->count, 8); #ifdef CHARSET_EBCDIC /* XXX: @@@: In order to make this no more complex than necessary, * this kludge converts the bits[] array using the ascii-to-ebcdic - * table, because the following jk_MD5Update() re-translates + * table, because the following jk2_MD5Update() re-translates * its input (ebcdic-to-ascii). - * Otherwise, we would have to pass a "conversion" flag to jk_MD5Update() + * Otherwise, we would have to pass a "conversion" flag to jk2_MD5Update() */ ascii2ebcdic(bits,bits,8); - /* Since everything is converted to ascii within jk_MD5Update(), + /* Since everything is converted to ascii within jk2_MD5Update(), * the initial 0x80 (PADDING[0]) must be stored as 0x20 */ ascii2ebcdic(PADDING,PADDING,1); @@ -313,24 +313,24 @@ /* Pad out to 56 mod 64. */ idx = (unsigned int) ((context->count[0] >> 3) & 0x3f); padLen = (idx < 56) ? (56 - idx) : (120 - idx); - jk_MD5Update(context, (const unsigned char *)PADDING, padLen); + jk2_MD5Update(context, (const unsigned char *)PADDING, padLen); /* Append length (before padding) */ - jk_MD5Update(context, (const unsigned char *)bits, 8); + jk2_MD5Update(context, (const unsigned char *)bits, 8); /* Store state in digest */ - Encode(digest, context->state, 16); + jk2_Encode(digest, context->state, 16); /* Zeroize sensitive information. */ memset(context, 0, sizeof(*context)); } /* MD5 basic transformation. Transforms state based on block. */ -static void MD5Transform(JK_UINT4 state[4], const unsigned char block[64]) +static void jk2_MD5Transform(JK_UINT4 state[4], const unsigned char block[64]) { JK_UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; - Decode(x, block, 64); + jk2_Decode(x, block, 64); /* Round 1 */ FF(a, b, c, d, x[0], S11, 0xd76aa478); /* 1 */ @@ -416,7 +416,7 @@ /* Encodes input (JK_UINT4) into output (unsigned char). Assumes len is a multiple of 4. */ -static void Encode(unsigned char *output, const JK_UINT4 *input, unsigned int len) +static void jk2_Encode(unsigned char *output, const JK_UINT4 *input, unsigned int len) { unsigned int i, j; JK_UINT4 k; @@ -433,7 +433,7 @@ /* Decodes input (unsigned char) into output (JK_UINT4). Assumes len is * a multiple of 4. */ -static void Decode(JK_UINT4 *output, const unsigned char *input, unsigned int len) +static void jk2_Decode(JK_UINT4 *output, const unsigned char *input, unsigned int len) { unsigned int i, j; @@ -447,7 +447,7 @@ * the FreeBSD 3.0 /usr/src/lib/libcrypt/crypt.c file, which is * licenced as stated at the top of this file. */ -static void jk_to64(char *s, unsigned long v, int n) +static void jk2_to64(char *s, unsigned long v, int n) { static unsigned char itoa64[] = /* 0 ... 63 => ASCII - 64 */ "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; @@ -458,19 +458,19 @@ } } -char * JK_METHOD jk_md5(const unsigned char *org, const unsigned char *org2, char *dst) +char * JK_METHOD jk2_md5(const unsigned char *org, const unsigned char *org2, char *dst) { JK_MD5_CTX ctx; char buf[JK_MD5_DIGESTSIZE + 1]; - jk_MD5Init(&ctx); - jk_MD5Update(&ctx, org, strlen((const char *)org)); + jk2_MD5Init(&ctx); + jk2_MD5Update(&ctx, org, strlen((const char *)org)); if (org2 != NULL) - jk_MD5Update(&ctx, org2, strlen((const char *)org2)); + jk2_MD5Update(&ctx, org2, strlen((const char *)org2)); - jk_MD5Final((unsigned char *)buf, &ctx); - return (jk_hextocstr((unsigned char *)buf, dst, JK_MD5_DIGESTSIZE)); + jk2_MD5Final((unsigned char *)buf, &ctx); + return (jk2_hextocstr((unsigned char *)buf, dst, JK_MD5_DIGESTSIZE)); } #else /* USE_APACHE_MD5 */ @@ -492,7 +492,7 @@ #endif /* STANDARD20_MODULE_STUFF */ -char * JK_METHOD jk_md5(const unsigned char *org, const unsigned char *org2, char *dst) +char * JK_METHOD jk2_md5(const unsigned char *org, const unsigned char *org2, char *dst) { AP_MD5_CTX ctx; char buf[JK_MD5_DIGESTSIZE + 1]; @@ -504,7 +504,7 @@ ap_MD5Update(&ctx, org2, strlen(org2)); ap_MD5Final(buf, &ctx); - return (jk_hextocstr(buf, dst, JK_MD5_DIGESTSIZE)); + return (jk2_hextocstr(buf, dst, JK_MD5_DIGESTSIZE)); } #endif /* USE_APACHE_MD5 */ @@ -524,7 +524,7 @@ char xxx[(2 * JK_MD5_DIGESTSIZE) + 1]; if (argc > 1) - printf("%s => %s\n", argv[1], jk_md5(argv[1], NULL, xxx)); + printf("%s => %s\n", argv[1], jk2_md5(argv[1], NULL, xxx)); } #endif 1.6 +53 -53 jakarta-tomcat-connectors/jk/native2/common/jk_msg_ajp.c Index: jk_msg_ajp.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_msg_ajp.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- jk_msg_ajp.c 26 Jan 2002 07:07:13 -0000 1.5 +++ jk_msg_ajp.c 21 Feb 2002 11:11:15 -0000 1.6 @@ -60,7 +60,7 @@ * Author: Costin Manolache * Author: Gal Shachor <[EMAIL PROTECTED]> * * Author: Henri Gomez <[EMAIL PROTECTED]> * - * Version: $Revision: 1.5 $ * + * Version: $Revision: 1.6 $ * ***************************************************************************/ #include "jk_pool.h" @@ -70,15 +70,15 @@ #include "jk_channel.h" #include "jk_requtil.h" -#define AJP13_WS_HEADER 0x1234 +#define AJP13_WS_HEADER 0x1234 #define AJP_HEADER_LEN (4) #define AJP_HEADER_SZ_LEN (2) /* * Simple marshaling code. */ -static void jk_msg_ajp_dump(jk_env_t *env, struct jk_msg *_this, - char *err) +static void jk2_msg_ajp_dump(jk_env_t *env, struct jk_msg *_this, + char *err) { int i=0; env->l->jkLog( env, env->l, JK_LOG_INFO, @@ -114,13 +114,13 @@ } -static void jk_msg_ajp_reset(jk_env_t *env, jk_msg_t *_this) +static void jk2_msg_ajp_reset(jk_env_t *env, jk_msg_t *_this) { _this->len = 4; _this->pos = 4; } -static void jk_msg_ajp_end(jk_env_t *env, jk_msg_t *msg) +static void jk2_msg_ajp_end(jk_env_t *env, jk_msg_t *msg) { unsigned short len=msg->len - 4; @@ -133,8 +133,8 @@ -static int jk_msg_ajp_appendLong(jk_env_t *env, jk_msg_t *msg, - unsigned long val) +static int jk2_msg_ajp_appendLong(jk_env_t *env, jk_msg_t *msg, + unsigned long val) { int len=msg->len; @@ -153,8 +153,8 @@ } -static int jk_msg_ajp_appendInt(jk_env_t *env, jk_msg_t *msg, - unsigned short val) +static int jk2_msg_ajp_appendInt(jk_env_t *env, jk_msg_t *msg, + unsigned short val) { int len=msg->len; if(len + 2 > msg->maxlen) { @@ -169,8 +169,8 @@ return 0; } -static int jk_msg_ajp_appendByte(jk_env_t *env, jk_msg_t *msg, - unsigned char val) +static int jk2_msg_ajp_appendByte(jk_env_t *env, jk_msg_t *msg, + unsigned char val) { int len=msg->len; if(len + 1 > msg->maxlen) { @@ -183,8 +183,8 @@ return 0; } -static int jk_msg_ajp_appendString(jk_env_t *env, jk_msg_t *msg, - const char *param) +static int jk2_msg_ajp_appendString(jk_env_t *env, jk_msg_t *msg, + const char *param) { int len; @@ -210,9 +210,9 @@ } -static int jk_msg_ajp_appendBytes(jk_env_t *env, jk_msg_t *msg, - const unsigned char *param, - int len) +static int jk2_msg_ajp_appendBytes(jk_env_t *env, jk_msg_t *msg, + const unsigned char *param, + int len) { if (! len) { return 0; @@ -229,7 +229,7 @@ return 0; } -static unsigned long jk_msg_ajp_getLong(jk_env_t *env, jk_msg_t *msg) +static unsigned long jk2_msg_ajp_getLong(jk_env_t *env, jk_msg_t *msg) { unsigned long i; @@ -246,7 +246,7 @@ return i; } -static unsigned short jk_msg_ajp_getInt(jk_env_t *env, jk_msg_t *msg) +static unsigned short jk2_msg_ajp_getInt(jk_env_t *env, jk_msg_t *msg) { int i; if(msg->pos + 1 > msg->len) { @@ -260,7 +260,7 @@ return i; } -static unsigned short jk_msg_ajp_peekInt(jk_env_t *env, jk_msg_t *msg) +static unsigned short jk2_msg_ajp_peekInt(jk_env_t *env, jk_msg_t *msg) { int i; if(msg->pos + 1 > msg->len) { @@ -274,7 +274,7 @@ return i; } -static unsigned char jk_msg_ajp_getByte(jk_env_t *env, jk_msg_t *msg) +static unsigned char jk2_msg_ajp_getByte(jk_env_t *env, jk_msg_t *msg) { unsigned char rc; if(msg->pos > msg->len) { @@ -288,9 +288,9 @@ return rc; } -static unsigned char *jk_msg_ajp_getString(jk_env_t *env, jk_msg_t *msg) +static unsigned char *jk2_msg_ajp_getString(jk_env_t *env, jk_msg_t *msg) { - int size = jk_msg_ajp_getInt(env, msg); + int size = jk2_msg_ajp_getInt(env, msg); int start = msg->pos; if((size < 0 ) || (size + start > msg->maxlen)) { @@ -306,9 +306,9 @@ return (unsigned char *)(msg->buf + start); } -static unsigned char *jk_msg_ajp_getBytes(jk_env_t *env, jk_msg_t *msg, int *lenP) +static unsigned char *jk2_msg_ajp_getBytes(jk_env_t *env, jk_msg_t *msg, int *lenP) { - int size = jk_msg_ajp_getInt(env, msg); + int size = jk2_msg_ajp_getInt(env, msg); int start = msg->pos; *lenP=size; @@ -330,7 +330,7 @@ /** Shame-less copy from somewhere. assert (src != dst) */ -static void swap_16(unsigned char *src, unsigned char *dst) +static void jk2_swap_16(unsigned char *src, unsigned char *dst) { *dst++ = *(src + 1 ); *dst= *src; @@ -340,8 +340,8 @@ available - the channel may get more data it it can, to avoid multiple system calls. */ -static int jk_msg_ajp_checkHeader(jk_env_t *env, jk_msg_t *msg, - jk_endpoint_t *ae ) +static int jk2_msg_ajp_checkHeader(jk_env_t *env, jk_msg_t *msg, + jk_endpoint_t *ae ) { char *head=msg->buf; int msglen; @@ -373,20 +373,20 @@ /** * Special method. Will read data from the server and add them as - * bytes. It is equivalent with jk_requtil_readFully() in a buffer + * bytes. It is equivalent with jk2_requtil_readFully() in a buffer * and then jk_msg_appendBytes(), except that we use directly the * internal buffer. * * Returns -1 on error, else number of bytes read */ -static int jk_msg_ajp_appendFromServer(jk_env_t *env, jk_msg_t *msg, +static int jk2_msg_ajp_appendFromServer(jk_env_t *env, jk_msg_t *msg, jk_ws_service_t *r, jk_endpoint_t *ae, int len ) { unsigned char *read_buf = msg->buf; - jk_msg_ajp_reset(env, msg); + jk2_msg_ajp_reset(env, msg); read_buf += AJP_HEADER_LEN; /* leave some space for the buffer headers */ read_buf += AJP_HEADER_SZ_LEN; /* leave some space for the read length */ @@ -396,7 +396,7 @@ len = AJP13_MAX_SEND_BODY_SZ; } - if ((len = jk_requtil_readFully(env, r, read_buf, len)) < 0) { + if ((len = jk2_requtil_readFully(env, r, read_buf, len)) < 0) { env->l->jkLog(env, env->l, JK_LOG_ERROR, "msgAjp.appendFromServer() error reading from server\n"); return -1; @@ -409,7 +409,7 @@ if (len > 0) { /* Recipient recognizes empty packet as end of stream, not an empty body packet */ - if(0 != jk_msg_ajp_appendInt(env, msg, (unsigned short)len)) { + if(0 != jk2_msg_ajp_appendInt(env, msg, (unsigned short)len)) { env->l->jkLog(env, env->l, JK_LOG_ERROR, "msg.appendFromServer(): appendInt failed\n"); return -1; @@ -422,7 +422,7 @@ } -jk_msg_t *jk_msg_ajp_create(jk_env_t *env, jk_pool_t *pool, int buffSize) +jk_msg_t *jk2_msg_ajp_create(jk_env_t *env, jk_pool_t *pool, int buffSize) { jk_msg_t *msg = (jk_msg_t *)pool->calloc(env, pool, sizeof(jk_msg_t)); @@ -445,26 +445,26 @@ msg->headerLength=4; - msg->reset=jk_msg_ajp_reset; - msg->end=jk_msg_ajp_end; - msg->dump=jk_msg_ajp_dump; - - msg->appendByte=jk_msg_ajp_appendByte; - msg->appendBytes=jk_msg_ajp_appendBytes; - msg->appendInt=jk_msg_ajp_appendInt; - msg->appendLong=jk_msg_ajp_appendLong; - msg->appendString=jk_msg_ajp_appendString; - - msg->appendFromServer=jk_msg_ajp_appendFromServer; - - msg->getByte=jk_msg_ajp_getByte; - msg->getInt=jk_msg_ajp_getInt; - msg->peekInt=jk_msg_ajp_peekInt; - msg->getLong=jk_msg_ajp_getLong; - msg->getString=jk_msg_ajp_getString; - msg->getBytes=jk_msg_ajp_getBytes; + msg->reset=jk2_msg_ajp_reset; + msg->end=jk2_msg_ajp_end; + msg->dump=jk2_msg_ajp_dump; + + msg->appendByte=jk2_msg_ajp_appendByte; + msg->appendBytes=jk2_msg_ajp_appendBytes; + msg->appendInt=jk2_msg_ajp_appendInt; + msg->appendLong=jk2_msg_ajp_appendLong; + msg->appendString=jk2_msg_ajp_appendString; + + msg->appendFromServer=jk2_msg_ajp_appendFromServer; + + msg->getByte=jk2_msg_ajp_getByte; + msg->getInt=jk2_msg_ajp_getInt; + msg->peekInt=jk2_msg_ajp_peekInt; + msg->getLong=jk2_msg_ajp_getLong; + msg->getString=jk2_msg_ajp_getString; + msg->getBytes=jk2_msg_ajp_getBytes; - msg->checkHeader=jk_msg_ajp_checkHeader; + msg->checkHeader=jk2_msg_ajp_checkHeader; return msg; }
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>