You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by pi...@apache.org on 2001/04/24 18:30:27 UTC

cvs commit: jakarta-tomcat-4.0/connectors/include wa_webserver.h wa.h wa_general.h wa_provider.h wa_request.h

pier        01/04/24 09:30:27

  Modified:    connectors/include wa.h wa_general.h wa_provider.h
                        wa_request.h
  Added:       connectors/include wa_webserver.h
  Log:
  Updated Includes.
  
  Revision  Changes    Path
  1.2       +6 -4      jakarta-tomcat-4.0/connectors/include/wa.h
  
  Index: wa.h
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/connectors/include/wa.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- wa.h	2001/04/17 13:13:48	1.1
  +++ wa.h	2001/04/24 16:30:24	1.2
  @@ -57,7 +57,7 @@
   
   /**
    * @author  Pier Fumagalli <ma...@eng.sun.com>
  - * @version $Id: wa.h,v 1.1 2001/04/17 13:13:48 pier Exp $
  + * @version $Id: wa.h,v 1.2 2001/04/24 16:30:24 pier Exp $
    */
   #ifndef _WA_H_
   #define _WA_H_
  @@ -75,14 +75,16 @@
   
   /* WebApp Library type definitions. */
   typedef int boolean;
  -typedef struct wa_connection wa_connection;
   typedef struct wa_application wa_application;
  -typedef struct wa_deployer wa_deployer;
  +typedef struct wa_connection wa_connection;
  +typedef struct wa_provider wa_provider;
   typedef struct wa_request wa_request;
  -typedef void wa_provider;
  +typedef struct wa_webserver wa_webserver;
   
   /* WebApp Library includes */
   #include <wa_general.h>
  +#include <wa_provider.h>
   #include <wa_request.h>
  +#include <wa_webserver.h>
   
   #endif /* ifndef _WA_H_ */
  
  
  
  1.2       +22 -3     jakarta-tomcat-4.0/connectors/include/wa_general.h
  
  Index: wa_general.h
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/connectors/include/wa_general.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- wa_general.h	2001/04/17 13:13:49	1.1
  +++ wa_general.h	2001/04/24 16:30:24	1.2
  @@ -56,14 +56,19 @@
    * ========================================================================= */
   
   /**
  - * @package WebApp General Package
  + * @package General
    * @author  Pier Fumagalli <ma...@eng.sun.com>
  - * @version $Id: wa_general.h,v 1.1 2001/04/17 13:13:49 pier Exp $
  + * @version $Id: wa_general.h,v 1.2 2001/04/24 16:30:24 pier Exp $
    */
   #ifndef _WA_GENERAL_H_
   #define _WA_GENERAL_H_
   
   /**
  + * A freakin' int.
  + */
  +extern int errno;
  +
  +/**
    * The WebApp Library connection structure.
    * <br>
    * This structure holds all required data required by a connection provider
  @@ -110,9 +115,10 @@
    * function is called before this function has been invoked will result in
    * impredictable results.
    *
  + * @param w The Web Server structure used for callbacks.
    * @return <b>NULL</b> on success or an error message on faliure.
    */
  -const char *wa_init(void);
  +const char *wa_init(wa_webserver *w);
   
   /**
    * Clean up the WebApp Library.
  @@ -151,5 +157,18 @@
    */
   const char *wa_deploy(wa_application **a, wa_connection *c, const char *n,
                         const char *p);
  +
  +/**
  + * Attempt to match an URL against a web application.
  + * <br>
  + * This function will return <b>TRUE</b> only if the root URL path of the
  + * application matches the beginning of the specified URL.
  + *
  + * @param u The request URL to be matched against the web application.
  + * @param a The application against which the URL must be matched.
  + * @return <b>TRUE</b> if the URL can be handled by the web application without
  + *         raising a &quot;404 Not Found&quot; error, <b>FALSE</b> otherwise.
  + */
  +boolean wa_match(const char *u, wa_application *a);
   
   #endif /* ifndef _WA_GENERAL_H_ */
  
  
  
  1.2       +13 -5     jakarta-tomcat-4.0/connectors/include/wa_provider.h
  
  Index: wa_provider.h
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/connectors/include/wa_provider.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- wa_provider.h	2001/04/17 13:13:49	1.1
  +++ wa_provider.h	2001/04/24 16:30:25	1.2
  @@ -56,12 +56,12 @@
    * ========================================================================= */
   
   /**
  - * @package WebApp General Package
  + * @package Connection Provider
    * @author  Pier Fumagalli <ma...@eng.sun.com>
  - * @version $Id: wa_provider.h,v 1.1 2001/04/17 13:13:49 pier Exp $
  + * @version $Id: wa_provider.h,v 1.2 2001/04/24 16:30:25 pier Exp $
    */
  -#ifndef _WA_GENERAL_H_
  -#define _WA_GENERAL_H_
  +#ifndef _WA_PROVIDER_H_
  +#define _WA_PROVIDER_H_
   
   /**
    * The WebApp Library connection provider structure.
  @@ -138,4 +138,12 @@
       void (*handle) (wa_request *req);
   };
   
  -#endif /* ifndef _WA_GENERAL_H_ */
  +/**
  + * Retrieve a provider by its name.
  + *
  + * @param n The provider name.
  + * @return A pointer to a <code>wa_provider</code> structure or <b>NULL</b>.
  + */
  +wa_provider *wa_getprovider(const char *n);
  +
  +#endif /* ifndef _WA_PROVIDER_H_ */
  
  
  
  1.2       +17 -13    jakarta-tomcat-4.0/connectors/include/wa_request.h
  
  Index: wa_request.h
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/connectors/include/wa_request.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- wa_request.h	2001/04/17 13:13:50	1.1
  +++ wa_request.h	2001/04/24 16:30:25	1.2
  @@ -56,9 +56,9 @@
    * ========================================================================= */
   
   /**
  - * @package WebApp Request Package
  + * @package Request
    * @author  Pier Fumagalli <ma...@eng.sun.com>
  - * @version $Id: wa_request.h,v 1.1 2001/04/17 13:13:50 pier Exp $
  + * @version $Id: wa_request.h,v 1.2 2001/04/24 16:30:25 pier Exp $
    */
   #ifndef _WA_REQUEST_H_
   #define _WA_REQUEST_H_
  @@ -153,19 +153,23 @@
   	apr_table_t *hdrs;
   };
   
  - 
   /**
  - * Attempt to match an URL against a web application.
  - * <br>
  - * This function will return <b>TRUE</b> only if the root URL path of the
  - * application matches the beginning of the specified URL.
  + * Allocate a new request structure.
  + *
  + * @param r A pointer to where the newly allocated <code>wa_request</code>
  + *          structure must be allocated.
  + * @param d The web-server specific data for this request.
  + * @return An error message on faliure or <b>NULL</b>.
  + */
  +const char *wa_request_alloc(wa_request **r, void *d);
  +
  +/**
  + * Clean up and free the memory used by a request structure.
    *
  - * @param u The request URL to be matched against the web application.
  - * @param a The application against which the URL must be matched.
  - * @return <b>TRUE</b> if the URL can be handled by the web application without
  - *         raising a &quot;404 Not Found&quot; error, <b>FALSE</b> otherwise.
  + * @param r The request structure to destroy.
  + * @return An error message on faliure or <b>NULL</b>.
    */
  -boolean wa_match(const char *u, wa_application *a);
  +const char *wa_request_free(wa_request *r);
   
   /**
    * Invoke a request in a web application.
  @@ -173,6 +177,6 @@
    * @param r The WebApp Library request structure.
    * @return The HTTP result code of this operation.
    */
  -int wa_invoke(wa_request *r, wa_application *a);
  +int wa_request_invoke(wa_request *r, wa_application *a);
   
   #endif /* ifndef _WA_REQUEST_H_ */
  
  
  
  1.1                  jakarta-tomcat-4.0/connectors/include/wa_webserver.h
  
  Index: wa_webserver.h
  ===================================================================
  /* ========================================================================= *
   *                                                                           *
   *                 The Apache Software License,  Version 1.1                 *
   *                                                                           *
   *          Copyright (c) 1999-2001 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",  "WebApp",  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 <ap...@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/>.   *
   *                                                                           *
   * ========================================================================= */
  
  /**
   * @package Web-Server Plug-In
   * @author  Pier Fumagalli <ma...@eng.sun.com>
   * @version $Id: wa_webserver.h,v 1.1 2001/04/24 16:30:25 pier Exp $
   */
  #ifndef _WA_WEBSERVER_H_
  #define _WA_WEBSERVER_H_
  
  /**
   * The wa_callbacks structure contains function pointers for callbacks to the
   * web server.
   */
  struct wa_webserver {
      /**
       * Log data on the web server log file.
       *
       * @param d The web-server specific callback data specified in
       *          <code>wa_request-&gt;data</code>.
       * @param f The source file of this log entry.
       * @param l The line number within the source file of this log entry.
       * @param msg The message to be logged.
       */
      void (*log)(void *d, const char *f, int l, char *msg);
  
      /**
       * Read part of the request content.
       *
       * @param d The web-server specific callback data specified in
       *          <code>wa_request-&gt;data</code>.
       * @param buf The buffer that will hold the data.
       * @param len The buffer length.
       * @return The number of bytes read, 0 on end of file or -1 on error.
       */
      int (*read)(void *d, char *buf, int len);
  
      /**
       * Set the HTTP response status code.
       *
       * @param d The web-server specific callback data specified in
       *          <code>wa_request-&gt;data</code>.
       * @param status The HTTP status code for the response.
       * @return TRUE on success, FALSE otherwise
       */
      boolean (*status)(void *d, int status);
  
      /**
       * Set the HTTP response mime content type.
       *
       * @param d The web-server specific callback data specified in
       *          <code>wa_request-&gt;data</code>.
       * @param type The mime content type of the HTTP response.
       * @return TRUE on success, FALSE otherwise
       */
      boolean (*ctype)(void *d, char *type);
  
      /**
       * Set an HTTP mime header.
       *
       * @param d The web-server specific callback data specified in
       *          <code>wa_request-&gt;data</code>.
       * @param name The mime header name.
       * @param value The mime header value.
       * @return TRUE on success, FALSE otherwise
       */
      boolean (*header)(void *d, char *name, char *value);
  
      /**
       * Commit the first part of the response (status and headers).
       *
       * @param d The web-server specific callback data specified in
       *          <code>wa_request-&gt;data</code>.
       * @return TRUE on success, FALSE otherwise
       */
      boolean (*commit)(void *d);
  
      /**
       * Write part of the response data back to the client.
       *
       * @param d The web-server specific callback data specified in
       *          <code>wa_request-&gt;data</code>.
       * @param buf The buffer containing the data to be written.
       * @param len The number of characters to be written.
       * @return The number of characters written to the client or -1 on error.
       */
      int (*write)(void *d, char *buf, int len);
  
      /**
       * Flush any unwritten response data to the client.
       *
       * @param d The web-server specific callback data specified in
       *          <code>wa_request-&gt;data</code>.
       * @return TRUE on success, FALSE otherwise
       */
      boolean (*flush)(void *d);
  };
  
  /**
   * Log data on the web server log file.
   *
   * @param r The wa_request structure associated with the current request.
   * @param f The source file of this log entry.
   * @param l The line number within the source file of this log entry.
   * @param msg The message to be logged.
   */
  void wa_log(wa_request *r, const char *f, int l, char *msg);
  
  /**
   * Read part of the request content.
   *
   * @param req The request member associated with this call.
   * @param buf The buffer that will hold the data.
   * @param len The buffer length.
   * @return The number of bytes read, 0 on end of file or -1 on error.
   */
  int wa_read(wa_request *req, char *buf, int len);
  
  /**
   * Set the HTTP response status code.
   *
   * @param req The request member associated with this call.
   * @param status The HTTP status code for the response.
   * @return TRUE on success, FALSE otherwise
   */
  boolean wa_status(wa_request *req, int status);
  
  /**
   * Set the HTTP response mime content type.
   *
   * @param req The request member associated with this call.
   * @param type The mime content type of the HTTP response.
   * @return TRUE on success, FALSE otherwise
   */
  boolean wa_ctype(wa_request *req, char *type);
  
  /**
   * Set an HTTP mime header.
   *
   * @param req The request member associated with this call.
   * @param name The mime header name.
   * @param value The mime header value.
   * @return TRUE on success, FALSE otherwise
   */
  boolean wa_header(wa_request *req, char *name, char *value);
  
  /**
   * Commit the first part of the response (status and headers).
   *
   * @param req The request member associated with this call.
   * @return TRUE on success, FALSE otherwise
   */
  boolean wa_commit(wa_request *req);
  
  /**
   * Write part of the response data back to the client.
   *
   * @param req The request member associated with this call.
   * @param buf The buffer containing the data to be written.
   * @param len The number of characters to be written.
   * @return The number of characters written to the client or -1 on error.
   */
  int wa_write(wa_request *req, char *buf, int len);
  
  /**
   * Flush any unwritten response data to the client.
   *
   * @param req The request member associated with this call.
   * @return TRUE on success, FALSE otherwise
   */
  boolean wa_flush(wa_request *req);
  
  #endif /* ifndef _WA_WEBSERVER_H_ */