tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_handler_logon.c jk_handler_response.c
Date Thu, 25 Apr 2002 19:14:31 GMT
costin      02/04/25 12:14:31

  Modified:    jk/native2/common jk_handler_logon.c jk_handler_response.c
  Log:
  Update rc, use the simpler registration for handlers and the new signature.
  
  Revision  Changes    Path
  1.14      +23 -51    jakarta-tomcat-connectors/jk/native2/common/jk_handler_logon.c
  
  Index: jk_handler_logon.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_handler_logon.c,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- jk_handler_logon.c	12 Apr 2002 21:49:03 -0000	1.13
  +++ jk_handler_logon.c	25 Apr 2002 19:14:31 -0000	1.14
  @@ -58,7 +58,7 @@
   /**
    * Description: AJP14 Login handler
    * Author:      Henri Gomez <hgomez@slib.fr>
  - * Version:     $Revision: 1.13 $                                          
  + * Version:     $Revision: 1.14 $                                          
    */
   
   #include "jk_global.h"
  @@ -74,25 +74,10 @@
   /* Private definitions */
   
   /*
  - * Second Login Phase (servlet engine -> web server), md5 seed is received
  - */
  -#define AJP14_LOGSEED_CMD	(unsigned char)0x11
  -
  -/*
    * Third Login Phase (web server -> servlet engine), md5 of seed + secret is sent
    */
   #define AJP14_LOGCOMP_CMD	(unsigned char)0x12
   
  -/*
  - * Login Accepted (servlet engine -> web server)
  - */
  -#define AJP14_LOGOK_CMD		(unsigned char)0x13
  -
  -/*
  - * Login Rejected (servlet engine -> web server), will be logged
  - */
  -#define AJP14_LOGNOK_CMD	(unsigned char)0x14
  -
   /* web-server want context info after login */
   #define AJP14_CONTEXT_INFO_NEG      0x80000000 
   
  @@ -119,8 +104,8 @@
    *   String  serverName
    *
    */
  -static int JK_METHOD jk2_handler_login(jk_env_t *env, jk_msg_t *msg,
  -                            jk_ws_service_t *s, jk_endpoint_t *ae)
  +static int JK_METHOD jk2_handler_login(jk_env_t *env, void *target, 
  +                                       jk_endpoint_t *ae, jk_msg_t   *msg )
   {
       int rc;
       char *entropy;
  @@ -150,12 +135,12 @@
                     "Into ajp14_marshal_login_comp_into_msgb\n");
   
       rc=msg->appendByte( env, msg, AJP14_LOGCOMP_CMD);
  -    if (rc!=JK_TRUE )
  +    if (rc!=JK_OK )
           return JK_HANDLER_FATAL;
   
       /* COMPUTED-SEED */
       rc= msg->appendString( env, msg, (const unsigned char *)computedKey);
  -    if( rc!=JK_TRUE ) {
  +    if( rc!=JK_OK ) {
           env->l->jkLog(env, env->l, JK_LOG_ERROR,
                    "handler.loginSecret() error serializing computed secret\n");
           return JK_HANDLER_FATAL;
  @@ -166,7 +151,7 @@
       
       rc=msg->appendString(env, msg, ae->worker->workerEnv->server_name);
   
  -    if ( rc != JK_TRUE)
  +    if ( rc != JK_OK)
           return JK_HANDLER_FATAL;
       
       return JK_HANDLER_RESPONSE;
  @@ -182,8 +167,8 @@
    * +--------------------+------------------------+---------------------------
    *
    */
  -static int JK_METHOD jk2_handler_logok(jk_env_t *env, jk_msg_t *msg,
  -                            jk_ws_service_t *s, jk_endpoint_t *ae )
  +static int JK_METHOD jk2_handler_logok(jk_env_t *env, void *target, 
  +                                       jk_endpoint_t *ae, jk_msg_t   *msg )
   {
       unsigned long nego;
       char *sname;
  @@ -229,8 +214,8 @@
    * +---------------------+-----------------------+
    *
    */
  -static int JK_METHOD jk2_handler_lognok(jk_env_t *env, jk_msg_t *msg,
  -                             jk_ws_service_t *s, jk_endpoint_t *ae )
  +static int JK_METHOD jk2_handler_lognok(jk_env_t *env, void *target, 
  +                                        jk_endpoint_t *ae, jk_msg_t   *msg )
   {
       unsigned long   status;
       
  @@ -245,31 +230,18 @@
   int JK_METHOD jk2_handler_logon_init( jk_env_t *env, jk_handler_t *_this,
                                         jk_workerEnv_t *wEnv) 
   {
  -    jk_pool_t *pool=wEnv->pool;
  -    jk_handler_t *h;
  -    
  -    h=(jk_handler_t *)pool->calloc( env, pool, sizeof( jk_handler_t));
  -    h->name="login";
  -    h->messageId=AJP14_LOGSEED_CMD;
  -    h->callback=jk2_handler_login;
  -    h->workerEnv=wEnv;
  -    wEnv->registerHandler( env, wEnv, h );
  -
  -    h=(jk_handler_t *)pool->calloc( env, pool, sizeof( jk_handler_t));
  -    h->name="logOk";
  -    h->messageId=AJP14_LOGOK_CMD;
  -    h->callback=jk2_handler_logok;
  -    h->workerEnv=wEnv;
  -    wEnv->registerHandler( env, wEnv, h );
  -
  -    h=(jk_handler_t *)pool->calloc( env, pool, sizeof( jk_handler_t));
  -    h->name="logNok";
  -    h->messageId=AJP14_LOGNOK_CMD;
  -    h->callback=jk2_handler_lognok;
  -    h->workerEnv=wEnv;
  -    wEnv->registerHandler( env, wEnv, h );
  -    
  -    return JK_TRUE;
  +    wEnv->registerHandler( env, wEnv, "handler.logon",
  +                           "login", JK_HANDLE_LOGON_SEED,
  +                           jk2_handler_login, NULL );
  +    
  +    wEnv->registerHandler( env, wEnv, "handler.logon",
  +                           "logOk", JK_HANDLE_LOGON_OK, 
  +                           jk2_handler_logok, NULL );
  +    
  +    wEnv->registerHandler( env, wEnv, "handler.logon",
  +                           "logNok", JK_HANDLE_LOGON_ERR,
  +                           jk2_handler_lognok, NULL );
  +    return JK_OK;
   }
   
   
  @@ -287,5 +259,5 @@
   
       result->object=h;
       
  -    return JK_TRUE;
  +    return JK_OK;
   }
  
  
  
  1.16      +32 -65    jakarta-tomcat-connectors/jk/native2/common/jk_handler_response.c
  
  Index: jk_handler_response.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_handler_response.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- jk_handler_response.c	12 Apr 2002 21:49:03 -0000	1.15
  +++ jk_handler_response.c	25 Apr 2002 19:14:31 -0000	1.16
  @@ -66,26 +66,6 @@
   
   #include "jk_registry.h"
   
  -/*
  - * Write a body chunk from the servlet container to the web server
  - */
  -#define JK_AJP13_SEND_BODY_CHUNK    (unsigned char)3
  -
  -/*
  - * Send response headers from the servlet container to the web server.
  - */
  -#define JK_AJP13_SEND_HEADERS       (unsigned char)4
  -
  -/*
  - * Marks the end of response.
  - */
  -#define JK_AJP13_GET_BODY_CHUNK     (unsigned char)6
  -
  -/*
  - * Marks the end of response.
  - */
  -#define JK_AJP13_END_RESPONSE       (unsigned char)5
  -
   
   /** SEND_HEADERS handler
      AJPV13_RESPONSE/AJPV14_RESPONSE:=
  @@ -111,10 +91,11 @@
       body    length*(var binary)
   
    */
  -static int JK_METHOD jk2_handler_startResponse(jk_env_t *env, jk_msg_t   *msg,
  -                                    jk_ws_service_t  *s, jk_endpoint_t *ae )
  +static int JK_METHOD jk2_handler_startResponse(jk_env_t *env, void *target, 
  +                                               jk_endpoint_t *ae, jk_msg_t   *msg )
   {
  -    int err=JK_FALSE;
  +    jk_ws_service_t  *s=target;
  +    int err=JK_ERR;
       int i;
       jk_pool_t * pool = s->pool;
       int headerCount;
  @@ -186,7 +167,7 @@
                     s->status, headerCount);
   
       err=s->head(env, s);
  -    if( err!=JK_TRUE ) {
  +    if( err!=JK_OK ) {
           env->l->jkLog(env, env->l, JK_LOG_ERROR,
                         "handler.response() Error sending response");
           return JK_HANDLER_ERROR;
  @@ -197,9 +178,10 @@
   
   /** SEND_BODY_CHUNK handler
    */
  -static int JK_METHOD jk2_handler_sendChunk(jk_env_t *env, jk_msg_t   *msg,
  -                                jk_ws_service_t  *r, jk_endpoint_t *ae)
  +static int JK_METHOD jk2_handler_sendChunk(jk_env_t *env, void *target, 
  +                                           jk_endpoint_t *ae, jk_msg_t   *msg )
   {
  +    jk_ws_service_t  *r=target;
       int err;
       int len;
       char *buf;
  @@ -207,7 +189,7 @@
       buf=msg->getBytes( env, msg, &len );
   
       err=r->write(env, r, buf, len);
  -    if( err!= JK_TRUE ) {
  +    if( err!= JK_OK ) {
           env->l->jkLog(env, env->l, JK_LOG_ERROR, "Error ajp_process_callback -
write failed\n");
           return JK_HANDLER_ERROR;
       }
  @@ -215,8 +197,8 @@
       return JK_HANDLER_OK;
   }
   
  -static int JK_METHOD jk2_handler_endResponse(jk_env_t *env, jk_msg_t   *msg,
  -                                  jk_ws_service_t  *r,jk_endpoint_t *ae)
  +static int JK_METHOD jk2_handler_endResponse(jk_env_t *env, void *target, 
  +                                           jk_endpoint_t *ae, jk_msg_t   *msg )
   {
       ae->reuse = (int)msg->getByte(env, msg);
               
  @@ -229,11 +211,12 @@
       return JK_HANDLER_LAST;
   }
   
  -/** SEND_BODY_CHUNK handler
  +/** GET_BODY_CHUNK handler
    */
  -static int JK_METHOD jk2_handler_getChunk(jk_env_t *env, jk_msg_t   *msg,
  -                               jk_ws_service_t  *r, jk_endpoint_t *ae)
  +static int JK_METHOD jk2_handler_getChunk(jk_env_t *env, void *target, 
  +                                          jk_endpoint_t *ae, jk_msg_t   *msg )
   {
  +    jk_ws_service_t  *r=target;
       int len = msg->getInt(env, msg);
       
       if(len > AJP13_MAX_SEND_BODY_SZ) {
  @@ -261,45 +244,29 @@
   int JK_METHOD jk2_handler_response_init( jk_env_t *env, jk_handler_t *_this,
                                            jk_workerEnv_t *wEnv) 
   {
  -    jk_pool_t *pool=wEnv->pool;
  -    jk_handler_t *h;
  -    
  -    h=(jk_handler_t *)pool->calloc( env, pool, sizeof( jk_handler_t));
  -    h->name="sendHeaders";
  -    h->messageId=JK_AJP13_SEND_HEADERS;
  -    h->callback=jk2_handler_startResponse;
  -    h->workerEnv=wEnv;
  -    wEnv->registerHandler( env, wEnv, h );
  -
  -    h=(jk_handler_t *)pool->calloc( env, pool, sizeof( jk_handler_t));
  -    h->name="sendChunk";
  -    h->messageId=JK_AJP13_SEND_BODY_CHUNK;
  -    h->callback=jk2_handler_sendChunk;
  -    h->workerEnv=wEnv;
  -    wEnv->registerHandler( env, wEnv, h );
  -    
  -    h=(jk_handler_t *)pool->calloc( env, pool, sizeof( jk_handler_t));
  -    h->name="endResponse";
  -    h->messageId=JK_AJP13_END_RESPONSE;
  -    h->callback=jk2_handler_endResponse;
  -    h->workerEnv=wEnv;
  -    wEnv->registerHandler( env, wEnv, h );
  -
  -    h=(jk_handler_t *)pool->calloc( env, pool, sizeof( jk_handler_t));
  -    h->name="getChunk";
  -    h->messageId=JK_AJP13_GET_BODY_CHUNK;
  -    h->callback=jk2_handler_getChunk;
  -    h->workerEnv=wEnv;
  -    wEnv->registerHandler( env, wEnv, h );
  +    wEnv->registerHandler( env, wEnv, "handler.response",
  +                           "sendHeaders", JK_HANDLE_AJP13_SEND_HEADERS,
  +                           jk2_handler_startResponse, NULL );
  +    
  +    wEnv->registerHandler( env, wEnv, "handler.response",
  +                           "sendChunk", JK_HANDLE_AJP13_SEND_BODY_CHUNK,
  +                           jk2_handler_sendChunk, NULL );
  +    
  +    wEnv->registerHandler( env, wEnv, "handler.response",
  +                           "endResponse", JK_HANDLE_AJP13_END_RESPONSE,
  +                           jk2_handler_endResponse, NULL );
  +    
  +    wEnv->registerHandler( env, wEnv, "handler.response",
  +                           "getChunk", JK_HANDLE_AJP13_GET_BODY_CHUNK,
  +                           jk2_handler_getChunk, NULL );
   
  -    return JK_TRUE;
  +    return JK_OK;
   }
   
   int JK_METHOD jk2_handler_response_factory( jk_env_t *env, jk_pool_t *pool,
                                               jk_bean_t *result,
                                               const char *type, const char *name)
   {
  -//    jk_map_t *map;
       jk_handler_t *h;
       
       h=(jk_handler_t *)pool->calloc( env, pool, sizeof( jk_handler_t));
  @@ -308,6 +275,6 @@
   
       result->object=h;
       
  -    return JK_TRUE;
  +    return JK_OK;
   }
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message