Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

apreq_env.h

Go to the documentation of this file.
00001 /* ====================================================================
00002  * The Apache Software License, Version 1.1
00003  *
00004  * Copyright (c) 2003 The Apache Software Foundation.  All rights
00005  * reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions
00009  * are met:
00010  *
00011  * 1. Redistributions of source code must retain the above copyright
00012  *    notice, this list of conditions and the following disclaimer.
00013  *
00014  * 2. Redistributions in binary form must reproduce the above copyright
00015  *    notice, this list of conditions and the following disclaimer in
00016  *    the documentation and/or other materials provided with the
00017  *    distribution.
00018  *
00019  * 3. The end-user documentation included with the redistribution,
00020  *    if any, must include the following acknowledgment:
00021  *       "This product includes software developed by the
00022  *        Apache Software Foundation (http://www.apache.org/)."
00023  *    Alternately, this acknowledgment may appear in the software itself,
00024  *    if and wherever such third-party acknowledgments normally appear.
00025  *
00026  * 4. The names "Apache" and "Apache Software Foundation" must
00027  *    not be used to endorse or promote products derived from this
00028  *    software without prior written permission. For written
00029  *    permission, please contact apache@apache.org.
00030  *
00031  * 5. Products derived from this software may not be called "Apache",
00032  *    nor may "Apache" appear in their name, without prior written
00033  *    permission of the Apache Software Foundation.
00034  *
00035  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
00036  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00037  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00038  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
00039  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00040  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00041  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
00042  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00043  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00044  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
00045  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00046  * SUCH DAMAGE.
00047  * ====================================================================
00048  *
00049  * This software consists of voluntary contributions made by many
00050  * individuals on behalf of the Apache Software Foundation.  For more
00051  * information on the Apache Software Foundation, please see
00052  * <http://www.apache.org/>.
00053  */
00054 #ifndef APREQ_ENV_H
00055 #define APREQ_ENV_H
00056 
00057 #include "apreq_params.h"
00058 #include "apreq_cookie.h"
00059 #include "apreq_parsers.h"
00060 
00061 #ifdef HAVE_SYSLOG
00062 #include <syslog.h>
00063 
00064 #ifndef LOG_PRIMASK
00065 #define LOG_PRIMASK 7
00066 #endif
00067 
00068 
00069 #define APREQ_LOG_EMERG     LOG_EMERG     /* system is unusable */
00070 #define APREQ_LOG_ALERT     LOG_ALERT     /* action must be taken immediately */
00071 #define APREQ_LOG_CRIT      LOG_CRIT      /* critical conditions */
00072 #define APREQ_LOG_ERR       LOG_ERR       /* error conditions */
00073 #define APREQ_LOG_WARNING   LOG_WARNING   /* warning conditions */
00074 #define APREQ_LOG_NOTICE    LOG_NOTICE    /* normal but significant condition */
00075 #define APREQ_LOG_INFO      LOG_INFO      /* informational */
00076 #define APREQ_LOG_DEBUG     LOG_DEBUG     /* debug-level messages */
00077 
00078 #define APREQ_LOG_LEVELMASK LOG_PRIMASK   /* mask off the level value */
00079 
00080 #else
00081 
00082 #define APREQ_LOG_EMERG     0   /* system is unusable */
00083 #define APREQ_LOG_ALERT     1   /* action must be taken immediately */
00084 #define APREQ_LOG_CRIT      2   /* critical conditions */
00085 #define APREQ_LOG_ERR       3   /* error conditions */
00086 #define APREQ_LOG_WARNING   4   /* warning conditions */
00087 #define APREQ_LOG_NOTICE    5   /* normal but significant condition */
00088 #define APREQ_LOG_INFO      6   /* informational */
00089 #define APREQ_LOG_DEBUG     7   /* debug-level messages */
00090 
00091 #define APREQ_LOG_LEVELMASK     7       /* mask off the level value */
00092 
00093 #endif
00094 
00095 #define APREQ_LOG_MARK  __FILE__ , __LINE__
00096 
00097 #define APREQ_DEBUG  APREQ_LOG_MARK, APREQ_LOG_DEBUG,
00098 #define APREQ_WARN   APREQ_LOG_MARK, APREQ_LOG_WARNING,
00099 #define APREQ_ERROR  APREQ_LOG_MARK, APREQ_LOG_ERR,
00100 
00101 #ifdef  __cplusplus
00102  extern "C" {
00103 #endif 
00104 
00115 APREQ_DECLARE_NONSTD(void) apreq_log(const char *file, int line,
00116                                      int level, apr_status_t status,
00117                                      void *env, const char *fmt, ...);
00118 
00119 APREQ_DECLARE(apr_pool_t *) apreq_env_pool(void *env);
00120 APREQ_DECLARE(apreq_jar_t *) apreq_env_jar(void *env, apreq_jar_t *jar);
00121 APREQ_DECLARE(apreq_request_t *) apreq_env_request(void *env,
00122                                                    apreq_request_t *req);
00123 
00124 APREQ_DECLARE(const char *) apreq_env_query_string(void *env);
00125 APREQ_DECLARE(const char *) apreq_env_header_in(void *env, const char *name);
00126 
00127 
00128 #define apreq_env_content_type(env) apreq_env_header_in(env, "Content-Type")
00129 #define apreq_env_cookie(env) apreq_env_header_in(env, "Cookie")
00130 #define apreq_env_cookie2(env) apreq_env_header_in(env, "Cookie2")
00131 
00132 APREQ_DECLARE(apr_status_t)apreq_env_header_out(void *env, 
00133                                                 const char *name,
00134                                                 char *val);
00135 
00136 #define apreq_env_set_cookie(e,s) apreq_env_header_out(e,"Set-Cookie",s)
00137 #define apreq_env_set_cookie2(e,s) apreq_env_header_out(e,"Set-Cookie2",s)
00138 
00139 APREQ_DECLARE(apr_status_t) apreq_env_read(void *env,
00140                                            apr_read_type_e block,
00141                                            apr_off_t bytes);
00142 
00143 typedef struct apreq_env_t {
00144     const char *name;
00145     apr_uint32_t magic_number;
00146     void (*log)(const char *,int,int,apr_status_t,void *,const char *,va_list);
00147     apr_pool_t *(*pool)(void *);
00148     apreq_jar_t *(*jar)(void *,apreq_jar_t *);
00149     apreq_request_t *(*request)(void *,apreq_request_t *);
00150     const char *(*query_string)(void *);
00151     const char *(*header_in)(void *,const char *);
00152     apr_status_t (*header_out)(void *, const char *,char *);
00153     apr_status_t (*read)(void *,apr_read_type_e,apr_off_t);
00154 } apreq_env_t;
00155 
00156 #define APREQ_ENV_MODULE(pre, name, mmn) const apreq_env_t pre##_module = { \
00157   name, mmn, pre##_log, pre##_pool, pre##_jar, pre##_request,               \
00158   pre##_query_string, pre##_header_in, pre##_header_out, pre##_read }
00159 
00160 
00161 APREQ_DECLARE(const apreq_env_t *) apreq_env_module(const apreq_env_t *mod);
00162 
00163 #define apreq_env_name (apreq_env_module(NULL)->name)
00164 #define apreq_env_magic_number (apreq_env_module(NULL)->magic_number)
00165 
00167 #ifdef __cplusplus
00168  }
00169 #endif
00170 
00171 #endif

Generated on Sat Nov 15 23:04:48 2003 for libapreq2 by doxygen1.3