tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/connectors/webapplib wa_application.h wa_config.h wa_memorypool.c wa_memorypool.h wa_virtualhost.h wa_webserver.h wa.c wa.h wa_connection.h wa_host.h wa_provider.h
Date Thu, 08 Mar 2001 11:33:50 GMT
pier        01/03/08 03:33:50

  Modified:    connectors/webapplib wa.c wa.h wa_connection.h wa_host.h
                        wa_provider.h
  Added:       connectors/webapplib wa_application.h wa_config.h
                        wa_memorypool.c wa_memorypool.h wa_virtualhost.h
                        wa_webserver.h
  Log:
  First addition of a memory pool, code restructuration.
  
  Revision  Changes    Path
  1.6       +1 -105    jakarta-tomcat-4.0/connectors/webapplib/wa.c
  
  Index: wa.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/connectors/webapplib/wa.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- wa.c	2001/01/23 18:44:14	1.5
  +++ wa.c	2001/03/08 11:33:35	1.6
  @@ -1,208 +1,104 @@
   /* ========================================================================= *
  -
    *                                                                           *
  -
    *                 The Apache Software License,  Version 1.1                 *
  -
    *                                                                           *
  -
    *         Copyright (c) 1999, 2000  The Apache Software Foundation.         *
  -
    *                           All rights reserved.                            *
  -
    *                                                                           *
  -
    * ========================================================================= *
  -
    *                                                                           *
  -
    * Redistribution and use in source and binary forms,  with or without modi- *
  -
    * fication, are permitted provided that the following conditions are met:   *
  -
    *                                                                           *
  -
    * 1. Redistributions of source code  must retain the above copyright notice *
  -
    *    notice, this list of conditions and the following disclaimer.          *
  -
    *                                                                           *
  -
    * 2. Redistributions  in binary  form  must  reproduce the  above copyright *
  -
    *    notice,  this list of conditions  and the following  disclaimer in the *
  -
    *    documentation and/or other materials provided with the distribution.   *
  -
    *                                                                           *
  -
    * 3. The end-user documentation  included with the redistribution,  if any, *
  -
    *    must include the following acknowlegement:                             *
  -
    *                                                                           *
  -
    *       "This product includes  software developed  by the Apache  Software *
  -
    *        Foundation <http://www.apache.org/>."                              *
  -
    *                                                                           *
  -
    *    Alternately, this acknowlegement may appear in the software itself, if *
  -
    *    and wherever such third-party acknowlegements normally appear.         *
  -
    *                                                                           *
  -
    * 4. The names  "The  Jakarta  Project",  "Tomcat",  and  "Apache  Software *
  -
    *    Foundation"  must not be used  to endorse or promote  products derived *
  -
    *    from this  software without  prior  written  permission.  For  written *
  -
    *    permission, please contact <apache@apache.org>.                        *
  -
    *                                                                           *
  -
    * 5. Products derived from this software may not be called "Apache" nor may *
  -
    *    "Apache" appear in their names without prior written permission of the *
  -
    *    Apache Software Foundation.                                            *
  -
    *                                                                           *
  -
    * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES *
  -
    * INCLUDING, BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
  -
    * AND FITNESS FOR  A PARTICULAR PURPOSE  ARE DISCLAIMED.  IN NO EVENT SHALL *
  -
    * THE APACHE  SOFTWARE  FOUNDATION OR  ITS CONTRIBUTORS  BE LIABLE  FOR ANY *
  -
    * DIRECT,  INDIRECT,   INCIDENTAL,  SPECIAL,  EXEMPLARY,  OR  CONSEQUENTIAL *
  -
    * DAMAGES (INCLUDING,  BUT NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE GOODS *
  -
    * OR SERVICES;  LOSS OF USE,  DATA,  OR PROFITS;  OR BUSINESS INTERRUPTION) *
  -
    * HOWEVER CAUSED AND  ON ANY  THEORY  OF  LIABILITY,  WHETHER IN  CONTRACT, *
  -
    * STRICT LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN *
  -
    * ANY  WAY  OUT OF  THE  USE OF  THIS  SOFTWARE,  EVEN  IF  ADVISED  OF THE *
  -
    * POSSIBILITY OF SUCH DAMAGE.                                               *
  -
    *                                                                           *
  -
    * ========================================================================= *
  -
    *                                                                           *
  -
    * This software  consists of voluntary  contributions made  by many indivi- *
  -
    * duals on behalf of the  Apache Software Foundation.  For more information *
  -
    * on the Apache Software Foundation, please see <http://www.apache.org/>.   *
  -
    *                                                                           *
  -
    * ========================================================================= */
  -
   
  -
  -// CVS $Id: wa.c,v 1.5 2001/01/23 18:44:14 pier Exp $
  -
  +// CVS $Id: wa.c,v 1.6 2001/03/08 11:33:35 pier Exp $
   // Author: Pier Fumagalli <mailto:pier.fumagalli@eng.sun.com>
   
  -
  -
   #include <wa.h>
   
  -
  -
   /**
  -
    * Initialize the webapp library and all connections.
  -
    *
  -
    * @param cb The wa_callback structure specified by the web server.
  -
    */
  -
   void wa_init(wa_callback *cb) {
  -
       wa_connection *c=wa_connections;
   
  -
  -
       // Set our callbacks structure
  -
       if (cb==NULL) return;
  -
       wa_callbacks=cb;
   
  -
  -
       // Set the SERVER_SOFTWARE string.
  -
       wa_callback_debug(WA_LOG,NULL,"Initializing WebApp library");
  -
       wa_callback_serverinfo(WA_NAME "/" WA_VERSION);
   
  -
  -
       // Iterate thru our connections chain
  -
       while(c!=NULL) {
  -
           wa_callback_debug(WA_LOG,NULL,"Initializing connection \"%s\"",c->name);
  -
           (*c->prov->init)(c);
  -
           wa_callback_debug(WA_LOG,NULL,"Connection \"%s\" initialized",c->name);
  -
           c=c->next;
  -
       }
  -
       wa_callback_debug(WA_LOG,NULL,"WebApp library initialized");
  -
       return;
  -
   }
   
  -
  -
   /**
  -
    * Reset the webapp library and all connections.
  -
    */
  -
   void wa_destroy(void) {
  -
       wa_connection *c=wa_connections;
   
  -
  -
       // Iterate thru our hosts chain
  -
       while(c!=NULL) {
  -
           (*c->prov->destroy)(c);
  -
           wa_callback_debug(WA_LOG,NULL,"Connection \"%s\" destroyed",c->name);
  -
           c=c->next;
  -
       }
   
  -
  -
       wa_callbacks=NULL;
  -
   }
  -
  
  
  
  1.8       +13 -197   jakarta-tomcat-4.0/connectors/webapplib/wa.h
  
  Index: wa.h
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/connectors/webapplib/wa.h,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- wa.h	2001/01/23 18:44:17	1.7
  +++ wa.h	2001/03/08 11:33:37	1.8
  @@ -1,288 +1,104 @@
   /* ========================================================================= *
  -
    *                                                                           *
  -
    *                 The Apache Software License,  Version 1.1                 *
  -
    *                                                                           *
  -
    *         Copyright (c) 1999, 2000  The Apache Software Foundation.         *
  -
    *                           All rights reserved.                            *
  -
    *                                                                           *
  -
    * ========================================================================= *
  -
    *                                                                           *
  -
    * Redistribution and use in source and binary forms,  with or without modi- *
  -
    * fication, are permitted provided that the following conditions are met:   *
  -
    *                                                                           *
  -
    * 1. Redistributions of source code  must retain the above copyright notice *
  -
    *    notice, this list of conditions and the following disclaimer.          *
  -
    *                                                                           *
  -
    * 2. Redistributions  in binary  form  must  reproduce the  above copyright *
  -
    *    notice,  this list of conditions  and the following  disclaimer in the *
  -
    *    documentation and/or other materials provided with the distribution.   *
  -
    *                                                                           *
  -
    * 3. The end-user documentation  included with the redistribution,  if any, *
  -
    *    must include the following acknowlegement:                             *
  -
    *                                                                           *
  -
    *       "This product includes  software developed  by the Apache  Software *
  -
    *        Foundation <http://www.apache.org/>."                              *
  -
    *                                                                           *
  -
    *    Alternately, this acknowlegement may appear in the software itself, if *
  -
    *    and wherever such third-party acknowlegements normally appear.         *
  -
    *                                                                           *
  -
    * 4. The names  "The  Jakarta  Project",  "Tomcat",  and  "Apache  Software *
  -
    *    Foundation"  must not be used  to endorse or promote  products derived *
  -
    *    from this  software without  prior  written  permission.  For  written *
  -
    *    permission, please contact <apache@apache.org>.                        *
  -
    *                                                                           *
  -
    * 5. Products derived from this software may not be called "Apache" nor may *
  -
    *    "Apache" appear in their names without prior written permission of the *
  -
    *    Apache Software Foundation.                                            *
  -
    *                                                                           *
  -
    * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES *
  -
    * INCLUDING, BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
  -
    * AND FITNESS FOR  A PARTICULAR PURPOSE  ARE DISCLAIMED.  IN NO EVENT SHALL *
  -
    * THE APACHE  SOFTWARE  FOUNDATION OR  ITS CONTRIBUTORS  BE LIABLE  FOR ANY *
  -
    * DIRECT,  INDIRECT,   INCIDENTAL,  SPECIAL,  EXEMPLARY,  OR  CONSEQUENTIAL *
  -
    * DAMAGES (INCLUDING,  BUT NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE GOODS *
  -
    * OR SERVICES;  LOSS OF USE,  DATA,  OR PROFITS;  OR BUSINESS INTERRUPTION) *
  -
    * HOWEVER CAUSED AND  ON ANY  THEORY  OF  LIABILITY,  WHETHER IN  CONTRACT, *
  -
    * STRICT LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN *
  -
    * ANY  WAY  OUT OF  THE  USE OF  THIS  SOFTWARE,  EVEN  IF  ADVISED  OF THE *
  -
    * POSSIBILITY OF SUCH DAMAGE.                                               *
  -
    *                                                                           *
  -
    * ========================================================================= *
  -
    *                                                                           *
  -
    * This software  consists of voluntary  contributions made  by many indivi- *
  -
    * duals on behalf of the  Apache Software Foundation.  For more information *
  -
    * on the Apache Software Foundation, please see <http://www.apache.org/>.   *
  -
    *                                                                           *
  -
    * ========================================================================= */
  -
  -
   
  -// CVS $Id: wa.h,v 1.7 2001/01/23 18:44:17 pier Exp $
  -
  +// CVS $Id: wa.h,v 1.8 2001/03/08 11:33:37 pier Exp $
   // Author: Pier Fumagalli <mailto:pier.fumagalli@eng.sun.com>
   
  -
  -
   #ifndef _WA_H_
  -
   #define _WA_H_
   
  -
  -
   /* Generic includes */
  -
   #include <stdio.h>
  -
   #include <stdlib.h>
  -
   #include <unistd.h>
  -
   #include <stdarg.h>
  -
   #include <string.h>
  -
   #include <netdb.h>
  -
   #include <errno.h>
  -
   #include <time.h>
  -
   #include <sys/errno.h>
  -
   #include <sys/types.h>
  -
   #include <sys/socket.h>
  -
   #include <netinet/in.h>
   
  -
  -
  -/* Our name and version */
  -
  -#ifndef WA_NAME
  -
  -#define WA_NAME "WebApp"
  -
  -#endif
  -
  -#ifndef WA_VERSION
  -
  -#define WA_VERSION "0.5-dev"
  -
  -#endif
  -
  -
  -
   /* Define TRUE and FALSE */
  -
   #ifndef TRUE
  -
   #define TRUE 1
  -
   #endif
   
  -
  -
   #ifndef FALSE
  -
   #define FALSE 0
  -
   #endif
   
  -
  -
  -/* Define the log mark */
  -
  -#define WA_LOG __FILE__,__LINE__
  -
  -
  -
   /* Types definitions */
  -
   typedef int boolean;
  -
  -typedef struct wa_connection wa_connection;
  -
   typedef struct wa_application wa_application;
  -
  -typedef struct wa_host wa_host;
  -
  -typedef struct wa_provider wa_provider;
  -
  -typedef struct wa_header wa_header;
  -
  -typedef struct wa_request wa_request;
  -
  -typedef struct wa_callback wa_callback;
  -
  -
  -
  -/* Other includes from the webapp lib */
  -
  -#include <wa_host.h>
  -
  +typedef struct wa_config      wa_config;
  +typedef struct wa_connection  wa_connection;
  +typedef struct wa_memorypool  wa_memorypool;
  +typedef struct wa_virtualhost wa_virtualhost;
  +typedef struct wa_webserver   wa_webserver;
  +
  +/* Other includes from the webapp library. */
  +#include <wa_application.h>
  +#include <wa_config.h>
   #include <wa_connection.h>
  +#include <wa_memorypool.h>
  +#include <wa_virtualhost.h>
  +#include <wa_webserver.h>
   
  -#include <wa_provider.h>
  -
  -#include <wa_request.h>
  -
  -#include <wa_callback.h>
  -
  -
  -
  -/* Function prototype declaration */
  -
  -// Initialize the webapp library and all connections.
  -
  -void wa_init(wa_callback *);
  -
  -// Reset the webapp library and all connections.
  -
  -void wa_destroy(void);
  -
  -
  -
  -//
  -
   #endif // ifdef _WA_H_
  -
  -
  -
  -/* Where are the different servlet methods in our wa_request structure?
  -
  - * (Comparison between methods, CGI variables and wa_request pointers
  -
  - *
  -
  - *   c.getServerInfo()       SERVER_SOFTWARE         wa_callback->serverinfo()
  -
  - *   r.getProtocol()         SERVER_PROTOCOL         r->prot
  -
  - *   r.getMethod()           REQUEST_METHOD          r->meth
  -
  - *   r.getScheme()           -                       r->schm
  -
  - *   r.getQueryString()      QUERY_STRING            r->args
  -
  - *   r.getPathInfo()         PATH_INFO               -
  -
  - *   r.getPathTranslated()   PATH_TRANSLATED         -
  -
  - *   r.getServletPath()      SCRIPT_NAME             -
  -
  - *   r.isSecure()            -                       -
  -
  - *   r.getContentType()      CONTENT_TYPE            [header]
  -
  - *   r.getContentLength()    CONTENT_LENGTH          r->clen
  -
  - *   r.getServerName()       SERVER_NAME             r->name
  -
  - *   r.getServerPort()       SERVER_PORT             r->port
  -
  - *   r.getRemoteHost()       REMOTE_HOST             r->rhst
  -
  - *   r.getRemoteAddr()       REMOTE_ADDR             r->radr
  -
  - *   r.getRemoteUser()       REMOTE_USER             r->user
  -
  - *   r.getAuthType()         AUTH_TYPE               r->auth
  -
  - */
  -
  
  
  
  1.5       +6 -98     jakarta-tomcat-4.0/connectors/webapplib/wa_connection.h
  
  Index: wa_connection.h
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/connectors/webapplib/wa_connection.h,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- wa_connection.h	2001/01/23 18:44:24	1.4
  +++ wa_connection.h	2001/03/08 11:33:38	1.5
  @@ -1,166 +1,74 @@
   /* ========================================================================= *
  -
    *                                                                           *
  -
    *                 The Apache Software License,  Version 1.1                 *
  -
    *                                                                           *
  -
    *         Copyright (c) 1999, 2000  The Apache Software Foundation.         *
  -
    *                           All rights reserved.                            *
  -
    *                                                                           *
  -
    * ========================================================================= *
  -
    *                                                                           *
  -
    * Redistribution and use in source and binary forms,  with or without modi- *
  -
    * fication, are permitted provided that the following conditions are met:   *
  -
    *                                                                           *
  -
    * 1. Redistributions of source code  must retain the above copyright notice *
  -
    *    notice, this list of conditions and the following disclaimer.          *
  -
    *                                                                           *
  -
    * 2. Redistributions  in binary  form  must  reproduce the  above copyright *
  -
    *    notice,  this list of conditions  and the following  disclaimer in the *
  -
    *    documentation and/or other materials provided with the distribution.   *
  -
    *                                                                           *
  -
    * 3. The end-user documentation  included with the redistribution,  if any, *
  -
    *    must include the following acknowlegement:                             *
  -
    *                                                                           *
  -
    *       "This product includes  software developed  by the Apache  Software *
  -
    *        Foundation <http://www.apache.org/>."                              *
  -
    *                                                                           *
  -
    *    Alternately, this acknowlegement may appear in the software itself, if *
  -
    *    and wherever such third-party acknowlegements normally appear.         *
  -
    *                                                                           *
  -
    * 4. The names  "The  Jakarta  Project",  "Tomcat",  and  "Apache  Software *
  -
    *    Foundation"  must not be used  to endorse or promote  products derived *
  -
    *    from this  software without  prior  written  permission.  For  written *
  -
    *    permission, please contact <apache@apache.org>.                        *
  -
    *                                                                           *
  -
    * 5. Products derived from this software may not be called "Apache" nor may *
  -
    *    "Apache" appear in their names without prior written permission of the *
  -
    *    Apache Software Foundation.                                            *
  -
    *                                                                           *
  -
    * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES *
  -
    * INCLUDING, BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
  -
    * AND FITNESS FOR  A PARTICULAR PURPOSE  ARE DISCLAIMED.  IN NO EVENT SHALL *
  -
    * THE APACHE  SOFTWARE  FOUNDATION OR  ITS CONTRIBUTORS  BE LIABLE  FOR ANY *
  -
    * DIRECT,  INDIRECT,   INCIDENTAL,  SPECIAL,  EXEMPLARY,  OR  CONSEQUENTIAL *
  -
    * DAMAGES (INCLUDING,  BUT NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE GOODS *
  -
    * OR SERVICES;  LOSS OF USE,  DATA,  OR PROFITS;  OR BUSINESS INTERRUPTION) *
  -
    * HOWEVER CAUSED AND  ON ANY  THEORY  OF  LIABILITY,  WHETHER IN  CONTRACT, *
  -
    * STRICT LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN *
  -
    * ANY  WAY  OUT OF  THE  USE OF  THIS  SOFTWARE,  EVEN  IF  ADVISED  OF THE *
  -
    * POSSIBILITY OF SUCH DAMAGE.                                               *
  -
    *                                                                           *
  -
    * ========================================================================= *
  -
    *                                                                           *
  -
    * This software  consists of voluntary  contributions made  by many indivi- *
  -
    * duals on behalf of the  Apache Software Foundation.  For more information *
  -
    * on the Apache Software Foundation, please see <http://www.apache.org/>.   *
  -
    *                                                                           *
  -
    * ========================================================================= */
  -
  -
   
  -// CVS $Id: wa_connection.h,v 1.4 2001/01/23 18:44:24 pier Exp $
  -
  +// CVS $Id: wa_connection.h,v 1.5 2001/03/08 11:33:38 pier Exp $
   // Author: Pier Fumagalli <mailto:pier.fumagalli@eng.sun.com>
   
  -
  -
   #ifndef _WA_CONNECTION_H_
  -
   #define _WA_CONNECTION_H_
   
  -
  -
   /**
  -
  - * The wa_connection structure represents a connection to a webapp server.
  -
  + * Struct definition for a connection to a web application container.
    */
  -
   struct wa_connection {
  -
  -    char *name;             // The connection unique name
  -
  -    wa_provider *prov;      // The connection provider
  -
  -    void *conf;             // Provider specific configurations
  -
  -    wa_connection *next;    // The next configured provider
  -
  +    char          *name; // The connection unique name
  +//    wa_provider   *prov; // The connection provider
  +    void          *conf; // Provider specific configurations
  +    wa_connection *next; // The next configured provider
   };
   
  -
  -
  -/* The list of configured connections */
  -
  -extern wa_connection *wa_connections;
  -
  -
  -
  -/* Function prototype declaration */
  -
  -// Create a new connection.
  -
  -const char *wa_connection_create(char *, char *, char *);
  -
  -// Get a specific webapp connection.
  -
  -wa_connection *wa_connection_get(char *);
  -
  -
  -
   #endif // ifdef _WA_CONNECTION_H_
  -
  
  
  
  1.5       +1 -104    jakarta-tomcat-4.0/connectors/webapplib/wa_host.h
  
  Index: wa_host.h
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/connectors/webapplib/wa_host.h,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- wa_host.h	2001/01/23 18:44:27	1.4
  +++ wa_host.h	2001/03/08 11:33:39	1.5
  @@ -1,206 +1,103 @@
   /* ========================================================================= *
  -
    *                                                                           *
  -
    *                 The Apache Software License,  Version 1.1                 *
  -
    *                                                                           *
  -
    *         Copyright (c) 1999, 2000  The Apache Software Foundation.         *
  -
    *                           All rights reserved.                            *
  -
    *                                                                           *
  -
    * ========================================================================= *
  -
    *                                                                           *
  -
    * Redistribution and use in source and binary forms,  with or without modi- *
  -
    * fication, are permitted provided that the following conditions are met:   *
  -
    *                                                                           *
  -
    * 1. Redistributions of source code  must retain the above copyright notice *
  -
    *    notice, this list of conditions and the following disclaimer.          *
  -
    *                                                                           *
  -
    * 2. Redistributions  in binary  form  must  reproduce the  above copyright *
  -
    *    notice,  this list of conditions  and the following  disclaimer in the *
  -
    *    documentation and/or other materials provided with the distribution.   *
  -
    *                                                                           *
  -
    * 3. The end-user documentation  included with the redistribution,  if any, *
  -
    *    must include the following acknowlegement:                             *
  -
    *                                                                           *
  -
    *       "This product includes  software developed  by the Apache  Software *
  -
    *        Foundation <http://www.apache.org/>."                              *
  -
    *                                                                           *
  -
    *    Alternately, this acknowlegement may appear in the software itself, if *
  -
    *    and wherever such third-party acknowlegements normally appear.         *
  -
    *                                                                           *
  -
    * 4. The names  "The  Jakarta  Project",  "Tomcat",  and  "Apache  Software *
  -
    *    Foundation"  must not be used  to endorse or promote  products derived *
  -
    *    from this  software without  prior  written  permission.  For  written *
  -
    *    permission, please contact <apache@apache.org>.                        *
  -
    *                                                                           *
  -
    * 5. Products derived from this software may not be called "Apache" nor may *
  -
    *    "Apache" appear in their names without prior written permission of the *
  -
    *    Apache Software Foundation.                                            *
  -
    *                                                                           *
  -
    * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES *
  -
    * INCLUDING, BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
  -
    * AND FITNESS FOR  A PARTICULAR PURPOSE  ARE DISCLAIMED.  IN NO EVENT SHALL *
  -
    * THE APACHE  SOFTWARE  FOUNDATION OR  ITS CONTRIBUTORS  BE LIABLE  FOR ANY *
  -
    * DIRECT,  INDIRECT,   INCIDENTAL,  SPECIAL,  EXEMPLARY,  OR  CONSEQUENTIAL *
  -
    * DAMAGES (INCLUDING,  BUT NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE GOODS *
  -
    * OR SERVICES;  LOSS OF USE,  DATA,  OR PROFITS;  OR BUSINESS INTERRUPTION) *
  -
    * HOWEVER CAUSED AND  ON ANY  THEORY  OF  LIABILITY,  WHETHER IN  CONTRACT, *
  -
    * STRICT LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN *
  -
    * ANY  WAY  OUT OF  THE  USE OF  THIS  SOFTWARE,  EVEN  IF  ADVISED  OF THE *
  -
    * POSSIBILITY OF SUCH DAMAGE.                                               *
  -
    *                                                                           *
  -
    * ========================================================================= *
  -
    *                                                                           *
  -
    * This software  consists of voluntary  contributions made  by many indivi- *
  -
    * duals on behalf of the  Apache Software Foundation.  For more information *
  -
    * on the Apache Software Foundation, please see <http://www.apache.org/>.   *
  -
    *                                                                           *
  -
    * ========================================================================= */
  -
   
  -
  -// CVS $Id: wa_host.h,v 1.4 2001/01/23 18:44:27 pier Exp $
  -
  +// CVS $Id: wa_host.h,v 1.5 2001/03/08 11:33:39 pier Exp $
   // Author: Pier Fumagalli <mailto:pier.fumagalli@eng.sun.com>
   
  -
  -
   #ifndef _WA_HOST_H_
  -
   #define _WA_HOST_H_
   
  -
  -
   /**
  -
    * The wa_application structure contains all required configuration data for
  -
    * web applications.
  -
    */
  -
   struct wa_application {
  -
       char *name;             // The name of this web application
  -
       char *path;             // The web application root URI path
  -
       void *conf;             // Provider specific configurations
  -
       wa_connection *conn;    // Pointer to the appropriate connection
  -
       wa_application *next;   // Pointer to the next web application
  -
   };
   
  -
  -
   /**
  -
    * The wa_host structure represents a configured host.
  -
    */
  -
   struct wa_host {
  -
       char *name;             // The main name of this host
  -
       int port;               // The main port server
  -
       wa_application *apps;   // The list of configured web applications
  -
       wa_host *next;          // Pointer to the next configured host
  -
   };
   
  -
  -
   /* The list of configured hosts */
  -
   extern wa_host *wa_hosts;
   
  -
  -
   /* Function prototype declaration */
  -
   // Create configuration for a new host.
  -
   const char *wa_host_create(char *, int);
  -
   // Get the host configuration.
  -
   wa_host *wa_host_get(char *, int);
  -
   // Configure a web application for a specific host.
  -
   const char *wa_host_setapp(wa_host *, char *, char *, wa_connection *);
  -
   // Configure a web application for a specific host.
  -
   const char *wa_host_setapp_byname(char *, int, char *, char *, wa_connection *);
  -
   // Retrieve a web application for a specific host.
  -
   wa_application *wa_host_findapp(wa_host *, char *);
  -
   // Retrieve a web application for a specific host.
  -
   wa_application *wa_host_findapp_byname(char *, int , char *);
   
  -
  -
   #endif // ifdef _WA_HOST_H_
  -
  
  
  
  1.9       +1 -138    jakarta-tomcat-4.0/connectors/webapplib/wa_provider.h
  
  Index: wa_provider.h
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/connectors/webapplib/wa_provider.h,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- wa_provider.h	2001/01/23 18:44:30	1.8
  +++ wa_provider.h	2001/03/08 11:33:41	1.9
  @@ -1,274 +1,137 @@
   /* ========================================================================= *
  -
    *                                                                           *
  -
    *                 The Apache Software License,  Version 1.1                 *
  -
    *                                                                           *
  -
    *         Copyright (c) 1999, 2000  The Apache Software Foundation.         *
  -
    *                           All rights reserved.                            *
  -
    *                                                                           *
  -
    * ========================================================================= *
  -
    *                                                                           *
  -
    * Redistribution and use in source and binary forms,  with or without modi- *
  -
    * fication, are permitted provided that the following conditions are met:   *
  -
    *                                                                           *
  -
    * 1. Redistributions of source code  must retain the above copyright notice *
  -
    *    notice, this list of conditions and the following disclaimer.          *
  -
    *                                                                           *
  -
    * 2. Redistributions  in binary  form  must  reproduce the  above copyright *
  -
    *    notice,  this list of conditions  and the following  disclaimer in the *
  -
    *    documentation and/or other materials provided with the distribution.   *
  -
    *                                                                           *
  -
    * 3. The end-user documentation  included with the redistribution,  if any, *
  -
    *    must include the following acknowlegement:                             *
  -
    *                                                                           *
  -
    *       "This product includes  software developed  by the Apache  Software *
  -
    *        Foundation <http://www.apache.org/>."                              *
  -
    *                                                                           *
  -
    *    Alternately, this acknowlegement may appear in the software itself, if *
  -
    *    and wherever such third-party acknowlegements normally appear.         *
  -
    *                                                                           *
  -
    * 4. The names  "The  Jakarta  Project",  "Tomcat",  and  "Apache  Software *
  -
    *    Foundation"  must not be used  to endorse or promote  products derived *
  -
    *    from this  software without  prior  written  permission.  For  written *
  -
    *    permission, please contact <apache@apache.org>.                        *
  -
    *                                                                           *
  -
    * 5. Products derived from this software may not be called "Apache" nor may *
  -
    *    "Apache" appear in their names without prior written permission of the *
  -
    *    Apache Software Foundation.                                            *
  -
    *                                                                           *
  -
    * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES *
  -
    * INCLUDING, BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
  -
    * AND FITNESS FOR  A PARTICULAR PURPOSE  ARE DISCLAIMED.  IN NO EVENT SHALL *
  -
    * THE APACHE  SOFTWARE  FOUNDATION OR  ITS CONTRIBUTORS  BE LIABLE  FOR ANY *
  -
    * DIRECT,  INDIRECT,   INCIDENTAL,  SPECIAL,  EXEMPLARY,  OR  CONSEQUENTIAL *
  -
    * DAMAGES (INCLUDING,  BUT NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE GOODS *
  -
    * OR SERVICES;  LOSS OF USE,  DATA,  OR PROFITS;  OR BUSINESS INTERRUPTION) *
  -
    * HOWEVER CAUSED AND  ON ANY  THEORY  OF  LIABILITY,  WHETHER IN  CONTRACT, *
  -
    * STRICT LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN *
  -
    * ANY  WAY  OUT OF  THE  USE OF  THIS  SOFTWARE,  EVEN  IF  ADVISED  OF THE *
  -
    * POSSIBILITY OF SUCH DAMAGE.                                               *
  -
    *                                                                           *
  -
    * ========================================================================= *
  -
    *                                                                           *
  -
    * This software  consists of voluntary  contributions made  by many indivi- *
  -
    * duals on behalf of the  Apache Software Foundation.  For more information *
  -
    * on the Apache Software Foundation, please see <http://www.apache.org/>.   *
  -
    *                                                                           *
  -
    * ========================================================================= */
  -
  -
   
  -// CVS $Id: wa_provider.h,v 1.8 2001/01/23 18:44:30 pier Exp $
  -
  +// CVS $Id: wa_provider.h,v 1.9 2001/03/08 11:33:41 pier Exp $
   // Author: Pier Fumagalli <mailto:pier.fumagalli@eng.sun.com>
   
  -
  -
   #ifndef _WA_PROVIDER_H_
  -
   #define _WA_PROVIDER_H_
   
  -
  -
   /**
  -
    * The wa_provider structure describes a connection provider.
  -
    */
  -
   struct wa_provider {
  -
       /**
  -
        * The name of this provider.
  -
        */
  -
       const char *name;
   
  -
  -
       /**
  -
        * Configure a connection with the parameter from the web server
  -
        * configuration file.
  -
        *
  -
        * @param conn The connection to configure.
  -
        * @param param The extra parameter from web server configuration.
  -
        * @return An error message or NULL.
  -
        */
  -
       const char *(*configure) (wa_connection *conn, char *param);
   
  -
  -
       /**
  -
        * Initialize a connection.
  -
        *
  -
        * @param conn The connection to initialize.
  -
        */
  -
       void (*init) (wa_connection *conn);
   
  -
  -
       /**
  -
        * Destroys a connection.
  -
        *
  -
        * @param conn The connection to destroy.
  -
        */
  -
       void (*destroy) (wa_connection *conn);
   
  -
  -
       /**
  -
        * Describe the configuration member found in a connection.
  -
        *
  -
        * @param conn The connection for wich a description must be produced.
  -
        * @param buf The buffer where the description must be stored.
  -
        * @param len The buffer length.
  -
        * @return The number of bytes written to the buffer (terminator included).
  -
        */
  -
       int (*conninfo) (wa_connection *conn, char *buf, int len);
   
  -
  -
       /**
  -
        * Describe the configuration member found in a web application.
  -
        *
  -
        * @param appl The application for wich a description must be produced.
  -
        * @param buf The buffer where the description must be stored.
  -
        * @param len The buffer length.
  -
        * @return The number of bytes written to the buffer (terminator included).
  -
        */
  -
       int (*applinfo) (wa_application *appl, char *buf, int len);
   
   
  -
  -
  -
       /**
  -
        * Handle a connection from the web server.
  -
        *
  -
        * @param req The request data.
  -
        */
  -
       void (*handle) (wa_request *req);
  -
   };
   
  -
  -
   /* The list of all compiled in providers */
  -
   extern wa_provider *wa_providers[];
   
  -
  -
   /* Pointers to the different providers */
  -
   extern wa_provider wa_provider_info;
  -
   extern wa_provider wa_provider_warp;
   
  -
  -
   /* Function prototype declaration */
  -
   // Retrieve a provider.
  -
   wa_provider *wa_provider_get(char *);
   
  -
  -
   #endif // ifndef _WA_PROVIDER_H_
  -
  
  
  
  1.1                  jakarta-tomcat-4.0/connectors/webapplib/wa_application.h
  
  Index: wa_application.h
  ===================================================================
  /* ========================================================================= *
   *                                                                           *
   *                 The Apache Software License,  Version 1.1                 *
   *                                                                           *
   *         Copyright (c) 1999, 2000  The Apache Software Foundation.         *
   *                           All rights reserved.                            *
   *                                                                           *
   * ========================================================================= *
   *                                                                           *
   * Redistribution and use in source and binary forms,  with or without modi- *
   * fication, are permitted provided that the following conditions are met:   *
   *                                                                           *
   * 1. Redistributions of source code  must retain the above copyright notice *
   *    notice, this list of conditions and the following disclaimer.          *
   *                                                                           *
   * 2. Redistributions  in binary  form  must  reproduce the  above copyright *
   *    notice,  this list of conditions  and the following  disclaimer in the *
   *    documentation and/or other materials provided with the distribution.   *
   *                                                                           *
   * 3. The end-user documentation  included with the redistribution,  if any, *
   *    must include the following acknowlegement:                             *
   *                                                                           *
   *       "This product includes  software developed  by the Apache  Software *
   *        Foundation <http://www.apache.org/>."                              *
   *                                                                           *
   *    Alternately, this acknowlegement may appear in the software itself, if *
   *    and wherever such third-party acknowlegements normally appear.         *
   *                                                                           *
   * 4. The names  "The  Jakarta  Project",  "Tomcat",  and  "Apache  Software *
   *    Foundation"  must not be used  to endorse or promote  products derived *
   *    from this  software without  prior  written  permission.  For  written *
   *    permission, please contact <apache@apache.org>.                        *
   *                                                                           *
   * 5. Products derived from this software may not be called "Apache" nor may *
   *    "Apache" appear in their names without prior written permission of the *
   *    Apache Software Foundation.                                            *
   *                                                                           *
   * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES *
   * INCLUDING, BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
   * AND FITNESS FOR  A PARTICULAR PURPOSE  ARE DISCLAIMED.  IN NO EVENT SHALL *
   * THE APACHE  SOFTWARE  FOUNDATION OR  ITS CONTRIBUTORS  BE LIABLE  FOR ANY *
   * DIRECT,  INDIRECT,   INCIDENTAL,  SPECIAL,  EXEMPLARY,  OR  CONSEQUENTIAL *
   * DAMAGES (INCLUDING,  BUT NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE GOODS *
   * OR SERVICES;  LOSS OF USE,  DATA,  OR PROFITS;  OR BUSINESS INTERRUPTION) *
   * HOWEVER CAUSED AND  ON ANY  THEORY  OF  LIABILITY,  WHETHER IN  CONTRACT, *
   * STRICT LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN *
   * ANY  WAY  OUT OF  THE  USE OF  THIS  SOFTWARE,  EVEN  IF  ADVISED  OF THE *
   * POSSIBILITY OF SUCH DAMAGE.                                               *
   *                                                                           *
   * ========================================================================= *
   *                                                                           *
   * This software  consists of voluntary  contributions made  by many indivi- *
   * duals on behalf of the  Apache Software Foundation.  For more information *
   * on the Apache Software Foundation, please see <http://www.apache.org/>.   *
   *                                                                           *
   * ========================================================================= */
  
  // CVS $Id: wa_application.h,v 1.1 2001/03/08 11:33:38 pier Exp $
  // Author: Pier Fumagalli <mailto:pier.fumagalli@eng.sun.com>
  
  #ifndef _WA_APPLICATION_H_
  #define _WA_APPLICATION_H_
  
  /**
   * Structure definition for a web application.
   */
  struct wa_application {
      char           *name; // The name of this web application.
      char           *base; // The web application base URI path.
      char           *root; // The web application root file path.
      void           *conf; // Provider specific configurations.
      wa_connection  *conn; // Pointer to the appropriate connection
      wa_application *next; // Pointer to the next web application
  };
  
  #endif // ifdef _WA_APPLICATION_H_
  
  
  
  1.1                  jakarta-tomcat-4.0/connectors/webapplib/wa_config.h
  
  Index: wa_config.h
  ===================================================================
  /* ========================================================================= *
   *                                                                           *
   *                 The Apache Software License,  Version 1.1                 *
   *                                                                           *
   *         Copyright (c) 1999, 2000  The Apache Software Foundation.         *
   *                           All rights reserved.                            *
   *                                                                           *
   * ========================================================================= *
   *                                                                           *
   * Redistribution and use in source and binary forms,  with or without modi- *
   * fication, are permitted provided that the following conditions are met:   *
   *                                                                           *
   * 1. Redistributions of source code  must retain the above copyright notice *
   *    notice, this list of conditions and the following disclaimer.          *
   *                                                                           *
   * 2. Redistributions  in binary  form  must  reproduce the  above copyright *
   *    notice,  this list of conditions  and the following  disclaimer in the *
   *    documentation and/or other materials provided with the distribution.   *
   *                                                                           *
   * 3. The end-user documentation  included with the redistribution,  if any, *
   *    must include the following acknowlegement:                             *
   *                                                                           *
   *       "This product includes  software developed  by the Apache  Software *
   *        Foundation <http://www.apache.org/>."                              *
   *                                                                           *
   *    Alternately, this acknowlegement may appear in the software itself, if *
   *    and wherever such third-party acknowlegements normally appear.         *
   *                                                                           *
   * 4. The names  "The  Jakarta  Project",  "Tomcat",  and  "Apache  Software *
   *    Foundation"  must not be used  to endorse or promote  products derived *
   *    from this  software without  prior  written  permission.  For  written *
   *    permission, please contact <apache@apache.org>.                        *
   *                                                                           *
   * 5. Products derived from this software may not be called "Apache" nor may *
   *    "Apache" appear in their names without prior written permission of the *
   *    Apache Software Foundation.                                            *
   *                                                                           *
   * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES *
   * INCLUDING, BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
   * AND FITNESS FOR  A PARTICULAR PURPOSE  ARE DISCLAIMED.  IN NO EVENT SHALL *
   * THE APACHE  SOFTWARE  FOUNDATION OR  ITS CONTRIBUTORS  BE LIABLE  FOR ANY *
   * DIRECT,  INDIRECT,   INCIDENTAL,  SPECIAL,  EXEMPLARY,  OR  CONSEQUENTIAL *
   * DAMAGES (INCLUDING,  BUT NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE GOODS *
   * OR SERVICES;  LOSS OF USE,  DATA,  OR PROFITS;  OR BUSINESS INTERRUPTION) *
   * HOWEVER CAUSED AND  ON ANY  THEORY  OF  LIABILITY,  WHETHER IN  CONTRACT, *
   * STRICT LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN *
   * ANY  WAY  OUT OF  THE  USE OF  THIS  SOFTWARE,  EVEN  IF  ADVISED  OF THE *
   * POSSIBILITY OF SUCH DAMAGE.                                               *
   *                                                                           *
   * ========================================================================= *
   *                                                                           *
   * This software  consists of voluntary  contributions made  by many indivi- *
   * duals on behalf of the  Apache Software Foundation.  For more information *
   * on the Apache Software Foundation, please see <http://www.apache.org/>.   *
   *                                                                           *
   * ========================================================================= */
  
  // CVS $Id: wa_config.h,v 1.1 2001/03/08 11:33:38 pier Exp $
  // Author: Pier Fumagalli <mailto:pier.fumagalli@eng.sun.com>
  
  #ifndef _WA_CONFIG_H_
  #define _WA_CONFIG_H_
  
  /**
   * Structure definition for the main configuration member.
   */
  struct wa_config {
      wa_memorypool  *memp; // The memory pool used in this configuration.
      wa_connection  *conn; // The list of configured connections.
      wa_virtualhost *host; // The list of configured virtual hosts.
      wa_application *appl; // The list of configured applications.
  };
  
  /** Retrieve the main configuration member. */
  wa_config *wa_config_get();
  
  
  #endif // ifdef _WA__CONFIG_H_
  
  
  
  1.1                  jakarta-tomcat-4.0/connectors/webapplib/wa_memorypool.c
  
  Index: wa_memorypool.c
  ===================================================================
  /* ========================================================================= *
   *                                                                           *
   *                 The Apache Software License,  Version 1.1                 *
   *                                                                           *
   *         Copyright (c) 1999, 2000  The Apache Software Foundation.         *
   *                           All rights reserved.                            *
   *                                                                           *
   * ========================================================================= *
   *                                                                           *
   * Redistribution and use in source and binary forms,  with or without modi- *
   * fication, are permitted provided that the following conditions are met:   *
   *                                                                           *
   * 1. Redistributions of source code  must retain the above copyright notice *
   *    notice, this list of conditions and the following disclaimer.          *
   *                                                                           *
   * 2. Redistributions  in binary  form  must  reproduce the  above copyright *
   *    notice,  this list of conditions  and the following  disclaimer in the *
   *    documentation and/or other materials provided with the distribution.   *
   *                                                                           *
   * 3. The end-user documentation  included with the redistribution,  if any, *
   *    must include the following acknowlegement:                             *
   *                                                                           *
   *       "This product includes  software developed  by the Apache  Software *
   *        Foundation <http://www.apache.org/>."                              *
   *                                                                           *
   *    Alternately, this acknowlegement may appear in the software itself, if *
   *    and wherever such third-party acknowlegements normally appear.         *
   *                                                                           *
   * 4. The names  "The  Jakarta  Project",  "Tomcat",  and  "Apache  Software *
   *    Foundation"  must not be used  to endorse or promote  products derived *
   *    from this  software without  prior  written  permission.  For  written *
   *    permission, please contact <apache@apache.org>.                        *
   *                                                                           *
   * 5. Products derived from this software may not be called "Apache" nor may *
   *    "Apache" appear in their names without prior written permission of the *
   *    Apache Software Foundation.                                            *
   *                                                                           *
   * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES *
   * INCLUDING, BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
   * AND FITNESS FOR  A PARTICULAR PURPOSE  ARE DISCLAIMED.  IN NO EVENT SHALL *
   * THE APACHE  SOFTWARE  FOUNDATION OR  ITS CONTRIBUTORS  BE LIABLE  FOR ANY *
   * DIRECT,  INDIRECT,   INCIDENTAL,  SPECIAL,  EXEMPLARY,  OR  CONSEQUENTIAL *
   * DAMAGES (INCLUDING,  BUT NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE GOODS *
   * OR SERVICES;  LOSS OF USE,  DATA,  OR PROFITS;  OR BUSINESS INTERRUPTION) *
   * HOWEVER CAUSED AND  ON ANY  THEORY  OF  LIABILITY,  WHETHER IN  CONTRACT, *
   * STRICT LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN *
   * ANY  WAY  OUT OF  THE  USE OF  THIS  SOFTWARE,  EVEN  IF  ADVISED  OF THE *
   * POSSIBILITY OF SUCH DAMAGE.                                               *
   *                                                                           *
   * ========================================================================= *
   *                                                                           *
   * This software  consists of voluntary  contributions made  by many indivi- *
   * duals on behalf of the  Apache Software Foundation.  For more information *
   * on the Apache Software Foundation, please see <http://www.apache.org/>.   *
   *                                                                           *
   * ========================================================================= */
  
  // CVS $Id: wa_memorypool.c,v 1.1 2001/03/08 11:33:40 pier Exp $
  // Author: Pier Fumagalli <mailto:pier.fumagalli@eng.sun.com>
  
  #include <wa.h>
  
  /**
   * Create a new memory pool.
   */
  wa_memorypool *wa_memorypool_create() {
      wa_memorypool *pool=(wa_memorypool *)malloc(sizeof(wa_memorypool));
      pool->curr=0;
      pool->next=NULL;
  }
  
  /**
   * Allocate memory into a memory pool.
   */
  void *wa_memorypool_alloc(wa_memorypool *pool, size_t size) {
      // Check the pool
      if (pool==NULL) return(NULL);
      
      // If we still have space in the current pool, allocate memory here.
      if (pool->curr<WA_MEMORYPOOL_SIZE) {
          void *ptr=(void *)malloc(size);
          if (ptr==NULL) return(NULL);
          pool->ptrs[pool->curr]=ptr;
          pool->curr++;
          return(ptr);
      }
  
      // Aparently we don't have space left in the current pool, allocate
      // a new child memory pool (if we don't have it) and go from there.
      if (pool->next==NULL) {
          wa_memorypool *child=wa_memorypool_create();
          child->next=pool->next;
          pool->next=child;
      }
  
      // Allocate memory in the child memory pool.
      return(wa_memorypool_alloc(pool->next,size));
  }
  
  /**
   * Clear a memory pool and free all allocated space.
   */
  void wa_memorypool_free(wa_memorypool *pool) {
      int x=0;
  
      // Check the pool
      if (pool==NULL) return;
      
      // If we have a child memory pool free that up first (recursively)
      if (pool->next!=NULL) {
          wa_memorypool_free(pool->next);
      }
      // Now that all children are clear we can clear up this memory pool.
      for (x=0; x<pool->curr; x++) free(pool->ptrs[x]);
      free(pool);
  }
  
  /**
   * Format a string allocating memory from a pool.
   */
  char *wa_memorypool_sprintf(wa_memorypool *pool, const char *fmt, ...) {
      char buf[4096];
      va_list ap;
      int len=0;
      
      // Check the pool and the format string
      if (pool==NULL) return(NULL);
      if (fmt==NULL) return(NULL);
      
      // Print the string to the buffer
      va_start(ap,fmt);
      len=vsnprintf(buf,4096,fmt,ap);
      va_end(ap);
  
      // Trim the buffer (just to be on the safe side)
      if (len==4096) len--;
      buf[len]='\0';
  
      // Duplicate and return the string
      return(wa_memorypool_strdup(pool,buf));
  }
  
  /**
   * Duplicate a string allocating memory in a pool.
   */
  char *wa_memorypool_strdup(wa_memorypool *pool, char *string) {
      char *buf=NULL;
      int x=0;
      int l=0;
  
      // Check the pool and the format string
      if (pool==NULL) return(NULL);
      if (string==NULL) return(NULL);
  
      // Count the characters and allocate some memory
      while(string[l++]!='\0');
      buf=(char *)wa_memorypool_alloc(pool,l*sizeof(char));
      if (buf==NULL) return(NULL);
  
      // Copy the source string in the allocated buffer
      for (x=0;x<l;x++) buf[x]=string[x];
      return(buf);
  }
  
  
  
  1.1                  jakarta-tomcat-4.0/connectors/webapplib/wa_memorypool.h
  
  Index: wa_memorypool.h
  ===================================================================
  /* ========================================================================= *
   *                                                                           *
   *                 The Apache Software License,  Version 1.1                 *
   *                                                                           *
   *         Copyright (c) 1999, 2000  The Apache Software Foundation.         *
   *                           All rights reserved.                            *
   *                                                                           *
   * ========================================================================= *
   *                                                                           *
   * Redistribution and use in source and binary forms,  with or without modi- *
   * fication, are permitted provided that the following conditions are met:   *
   *                                                                           *
   * 1. Redistributions of source code  must retain the above copyright notice *
   *    notice, this list of conditions and the following disclaimer.          *
   *                                                                           *
   * 2. Redistributions  in binary  form  must  reproduce the  above copyright *
   *    notice,  this list of conditions  and the following  disclaimer in the *
   *    documentation and/or other materials provided with the distribution.   *
   *                                                                           *
   * 3. The end-user documentation  included with the redistribution,  if any, *
   *    must include the following acknowlegement:                             *
   *                                                                           *
   *       "This product includes  software developed  by the Apache  Software *
   *        Foundation <http://www.apache.org/>."                              *
   *                                                                           *
   *    Alternately, this acknowlegement may appear in the software itself, if *
   *    and wherever such third-party acknowlegements normally appear.         *
   *                                                                           *
   * 4. The names  "The  Jakarta  Project",  "Tomcat",  and  "Apache  Software *
   *    Foundation"  must not be used  to endorse or promote  products derived *
   *    from this  software without  prior  written  permission.  For  written *
   *    permission, please contact <apache@apache.org>.                        *
   *                                                                           *
   * 5. Products derived from this software may not be called "Apache" nor may *
   *    "Apache" appear in their names without prior written permission of the *
   *    Apache Software Foundation.                                            *
   *                                                                           *
   * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES *
   * INCLUDING, BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
   * AND FITNESS FOR  A PARTICULAR PURPOSE  ARE DISCLAIMED.  IN NO EVENT SHALL *
   * THE APACHE  SOFTWARE  FOUNDATION OR  ITS CONTRIBUTORS  BE LIABLE  FOR ANY *
   * DIRECT,  INDIRECT,   INCIDENTAL,  SPECIAL,  EXEMPLARY,  OR  CONSEQUENTIAL *
   * DAMAGES (INCLUDING,  BUT NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE GOODS *
   * OR SERVICES;  LOSS OF USE,  DATA,  OR PROFITS;  OR BUSINESS INTERRUPTION) *
   * HOWEVER CAUSED AND  ON ANY  THEORY  OF  LIABILITY,  WHETHER IN  CONTRACT, *
   * STRICT LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN *
   * ANY  WAY  OUT OF  THE  USE OF  THIS  SOFTWARE,  EVEN  IF  ADVISED  OF THE *
   * POSSIBILITY OF SUCH DAMAGE.                                               *
   *                                                                           *
   * ========================================================================= *
   *                                                                           *
   * This software  consists of voluntary  contributions made  by many indivi- *
   * duals on behalf of the  Apache Software Foundation.  For more information *
   * on the Apache Software Foundation, please see <http://www.apache.org/>.   *
   *                                                                           *
   * ========================================================================= */
  
  // CVS $Id: wa_memorypool.h,v 1.1 2001/03/08 11:33:41 pier Exp $
  // Author: Pier Fumagalli <mailto:pier.fumagalli@eng.sun.com>
  
  #ifndef _WA_MEMORYPOOL_H_
  #define _WA_MEMORYPOOL_H_
  
  /** The size in number of pointers of a memory pool. */
  #define WA_MEMORYPOOL_SIZE 4096
  
  /**
   * Structure definition for a memory pool.
   */
  struct wa_memorypool {
      void          *ptrs[WA_MEMORYPOOL_SIZE]; // The allocated pointers array
      int            curr; // The position to the last non allocated pointer
      wa_memorypool *next; // The next memorypool child of this one
  };
  
  /** Create a new memory pool. */
  wa_memorypool *wa_memorypool_create();
  /** Allocate memory into a memory pool. */
  void *wa_memorypool_alloc(wa_memorypool *pool, size_t size);
  /** Clear a memory pool and free all allocated space. */
  void wa_memorypool_free(wa_memorypool *pool);
  
  /** Format a string allocating memory from a pool. */
  char *wa_memorypool_sprintf(wa_memorypool *pool, const char *fmt, ...);
  /** Duplicate a string allocating memory in a pool. */
  char *wa_memorypool_strdup(wa_memorypool *pool, char *string);
  
  #endif // ifdef _WA_MEMORYPOOL_H_
  
  
  
  1.1                  jakarta-tomcat-4.0/connectors/webapplib/wa_virtualhost.h
  
  Index: wa_virtualhost.h
  ===================================================================
  /* ========================================================================= *
   *                                                                           *
   *                 The Apache Software License,  Version 1.1                 *
   *                                                                           *
   *         Copyright (c) 1999, 2000  The Apache Software Foundation.         *
   *                           All rights reserved.                            *
   *                                                                           *
   * ========================================================================= *
   *                                                                           *
   * Redistribution and use in source and binary forms,  with or without modi- *
   * fication, are permitted provided that the following conditions are met:   *
   *                                                                           *
   * 1. Redistributions of source code  must retain the above copyright notice *
   *    notice, this list of conditions and the following disclaimer.          *
   *                                                                           *
   * 2. Redistributions  in binary  form  must  reproduce the  above copyright *
   *    notice,  this list of conditions  and the following  disclaimer in the *
   *    documentation and/or other materials provided with the distribution.   *
   *                                                                           *
   * 3. The end-user documentation  included with the redistribution,  if any, *
   *    must include the following acknowlegement:                             *
   *                                                                           *
   *       "This product includes  software developed  by the Apache  Software *
   *        Foundation <http://www.apache.org/>."                              *
   *                                                                           *
   *    Alternately, this acknowlegement may appear in the software itself, if *
   *    and wherever such third-party acknowlegements normally appear.         *
   *                                                                           *
   * 4. The names  "The  Jakarta  Project",  "Tomcat",  and  "Apache  Software *
   *    Foundation"  must not be used  to endorse or promote  products derived *
   *    from this  software without  prior  written  permission.  For  written *
   *    permission, please contact <apache@apache.org>.                        *
   *                                                                           *
   * 5. Products derived from this software may not be called "Apache" nor may *
   *    "Apache" appear in their names without prior written permission of the *
   *    Apache Software Foundation.                                            *
   *                                                                           *
   * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES *
   * INCLUDING, BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
   * AND FITNESS FOR  A PARTICULAR PURPOSE  ARE DISCLAIMED.  IN NO EVENT SHALL *
   * THE APACHE  SOFTWARE  FOUNDATION OR  ITS CONTRIBUTORS  BE LIABLE  FOR ANY *
   * DIRECT,  INDIRECT,   INCIDENTAL,  SPECIAL,  EXEMPLARY,  OR  CONSEQUENTIAL *
   * DAMAGES (INCLUDING,  BUT NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE GOODS *
   * OR SERVICES;  LOSS OF USE,  DATA,  OR PROFITS;  OR BUSINESS INTERRUPTION) *
   * HOWEVER CAUSED AND  ON ANY  THEORY  OF  LIABILITY,  WHETHER IN  CONTRACT, *
   * STRICT LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN *
   * ANY  WAY  OUT OF  THE  USE OF  THIS  SOFTWARE,  EVEN  IF  ADVISED  OF THE *
   * POSSIBILITY OF SUCH DAMAGE.                                               *
   *                                                                           *
   * ========================================================================= *
   *                                                                           *
   * This software  consists of voluntary  contributions made  by many indivi- *
   * duals on behalf of the  Apache Software Foundation.  For more information *
   * on the Apache Software Foundation, please see <http://www.apache.org/>.   *
   *                                                                           *
   * ========================================================================= */
  
  // CVS $Id: wa_virtualhost.h,v 1.1 2001/03/08 11:33:42 pier Exp $
  // Author: Pier Fumagalli <mailto:pier.fumagalli@eng.sun.com>
  
  #ifndef _WA_VIRTUALHOST_H_
  #define _WA_VIRTUALHOST_H_
  
  /**
   * Structure definition for a virtual host.
   */
  struct wa_virtualhost {
      char           *name; // The name of this virtual host.
      int             port; // The port of this virtual host.
      wa_virtualhost *next; // Pointer to the next configured virtual host.
  };
  
  #endif // ifdef _WA_VIRTUALHOST_H_
  
  
  
  1.1                  jakarta-tomcat-4.0/connectors/webapplib/wa_webserver.h
  
  Index: wa_webserver.h
  ===================================================================
  /* ========================================================================= *
   *                                                                           *
   *                 The Apache Software License,  Version 1.1                 *
   *                                                                           *
   *         Copyright (c) 1999, 2000  The Apache Software Foundation.         *
   *                           All rights reserved.                            *
   *                                                                           *
   * ========================================================================= *
   *                                                                           *
   * Redistribution and use in source and binary forms,  with or without modi- *
   * fication, are permitted provided that the following conditions are met:   *
   *                                                                           *
   * 1. Redistributions of source code  must retain the above copyright notice *
   *    notice, this list of conditions and the following disclaimer.          *
   *                                                                           *
   * 2. Redistributions  in binary  form  must  reproduce the  above copyright *
   *    notice,  this list of conditions  and the following  disclaimer in the *
   *    documentation and/or other materials provided with the distribution.   *
   *                                                                           *
   * 3. The end-user documentation  included with the redistribution,  if any, *
   *    must include the following acknowlegement:                             *
   *                                                                           *
   *       "This product includes  software developed  by the Apache  Software *
   *        Foundation <http://www.apache.org/>."                              *
   *                                                                           *
   *    Alternately, this acknowlegement may appear in the software itself, if *
   *    and wherever such third-party acknowlegements normally appear.         *
   *                                                                           *
   * 4. The names  "The  Jakarta  Project",  "Tomcat",  and  "Apache  Software *
   *    Foundation"  must not be used  to endorse or promote  products derived *
   *    from this  software without  prior  written  permission.  For  written *
   *    permission, please contact <apache@apache.org>.                        *
   *                                                                           *
   * 5. Products derived from this software may not be called "Apache" nor may *
   *    "Apache" appear in their names without prior written permission of the *
   *    Apache Software Foundation.                                            *
   *                                                                           *
   * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES *
   * INCLUDING, BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
   * AND FITNESS FOR  A PARTICULAR PURPOSE  ARE DISCLAIMED.  IN NO EVENT SHALL *
   * THE APACHE  SOFTWARE  FOUNDATION OR  ITS CONTRIBUTORS  BE LIABLE  FOR ANY *
   * DIRECT,  INDIRECT,   INCIDENTAL,  SPECIAL,  EXEMPLARY,  OR  CONSEQUENTIAL *
   * DAMAGES (INCLUDING,  BUT NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE GOODS *
   * OR SERVICES;  LOSS OF USE,  DATA,  OR PROFITS;  OR BUSINESS INTERRUPTION) *
   * HOWEVER CAUSED AND  ON ANY  THEORY  OF  LIABILITY,  WHETHER IN  CONTRACT, *
   * STRICT LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN *
   * ANY  WAY  OUT OF  THE  USE OF  THIS  SOFTWARE,  EVEN  IF  ADVISED  OF THE *
   * POSSIBILITY OF SUCH DAMAGE.                                               *
   *                                                                           *
   * ========================================================================= *
   *                                                                           *
   * This software  consists of voluntary  contributions made  by many indivi- *
   * duals on behalf of the  Apache Software Foundation.  For more information *
   * on the Apache Software Foundation, please see <http://www.apache.org/>.   *
   *                                                                           *
   * ========================================================================= */
  
  // CVS $Id: wa_webserver.h,v 1.1 2001/03/08 11:33:42 pier Exp $
  // Author: Pier Fumagalli <mailto:pier.fumagalli@eng.sun.com>
  
  #ifndef _WA_WEBSERVER_H_
  #define _WA_WEBSERVER_H_
  
  /**
   * Callbacks to the webserver using the webapp library.
   */
  struct wa_webserver {
  };
  
  #endif // ifdef _WA_WEBSERVER_H_
  
  
  

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


Mime
View raw message