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

apreq_env.h

Go to the documentation of this file.
00001 /*
00002 **  Copyright 2003-2004  The Apache Software Foundation
00003 **
00004 **  Licensed under the Apache License, Version 2.0 (the "License");
00005 **  you may not use this file except in compliance with the License.
00006 **  You may obtain a copy of the License at
00007 **
00008 **      http://www.apache.org/licenses/LICENSE-2.0
00009 **
00010 **  Unless required by applicable law or agreed to in writing, software
00011 **  distributed under the License is distributed on an "AS IS" BASIS,
00012 **  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013 **  See the License for the specific language governing permissions and
00014 **  limitations under the License.
00015 */
00016 
00017 #ifndef APREQ_ENV_H
00018 #define APREQ_ENV_H
00019 
00020 #include "apreq_params.h"
00021 #include "apreq_cookie.h"
00022 
00023 #ifdef HAVE_SYSLOG
00024 #include <syslog.h>
00025 
00026 #ifndef LOG_PRIMASK
00027 #define LOG_PRIMASK 7
00028 #endif
00029 
00030 
00031 #define APREQ_LOG_EMERG     LOG_EMERG     /* system is unusable */
00032 #define APREQ_LOG_ALERT     LOG_ALERT     /* action must be taken immediately */
00033 #define APREQ_LOG_CRIT      LOG_CRIT      /* critical conditions */
00034 #define APREQ_LOG_ERR       LOG_ERR       /* error conditions */
00035 #define APREQ_LOG_WARNING   LOG_WARNING   /* warning conditions */
00036 #define APREQ_LOG_NOTICE    LOG_NOTICE    /* normal but significant condition */
00037 #define APREQ_LOG_INFO      LOG_INFO      /* informational */
00038 #define APREQ_LOG_DEBUG     LOG_DEBUG     /* debug-level messages */
00039 
00040 #define APREQ_LOG_LEVELMASK LOG_PRIMASK   /* mask off the level value */
00041 
00042 #else
00043 
00044 #define APREQ_LOG_EMERG     0   /* system is unusable */
00045 #define APREQ_LOG_ALERT     1   /* action must be taken immediately */
00046 #define APREQ_LOG_CRIT      2   /* critical conditions */
00047 #define APREQ_LOG_ERR       3   /* error conditions */
00048 #define APREQ_LOG_WARNING   4   /* warning conditions */
00049 #define APREQ_LOG_NOTICE    5   /* normal but significant condition */
00050 #define APREQ_LOG_INFO      6   /* informational */
00051 #define APREQ_LOG_DEBUG     7   /* debug-level messages */
00052 
00053 #define APREQ_LOG_LEVELMASK     7       /* mask off the level value */
00054 
00055 #endif
00056 
00057 #define APREQ_LOG_MARK  __FILE__ , __LINE__
00058 
00059 #define APREQ_DEBUG  APREQ_LOG_MARK, APREQ_LOG_DEBUG,
00060 #define APREQ_WARN   APREQ_LOG_MARK, APREQ_LOG_WARNING,
00061 #define APREQ_ERROR  APREQ_LOG_MARK, APREQ_LOG_ERR,
00062 
00063 #ifdef  __cplusplus
00064  extern "C" {
00065 #endif 
00066 
00087 APREQ_DECLARE_NONSTD(void) apreq_log(const char *file, int line,
00088                                      int level, apr_status_t status,
00089                                      void *env, const char *fmt, ...);
00096 APREQ_DECLARE(apr_pool_t *) apreq_env_pool(void *env);
00097 
00106 APREQ_DECLARE(apreq_jar_t *) apreq_env_jar(void *env, apreq_jar_t *jar);
00107 
00116 APREQ_DECLARE(apreq_request_t *) apreq_env_request(void *env,
00117                                                    apreq_request_t *req);
00118 
00124 APREQ_DECLARE(const char *) apreq_env_query_string(void *env);
00125 
00133 APREQ_DECLARE(const char *) apreq_env_header_in(void *env, const char *name);
00134 
00135 
00141 #define apreq_env_content_type(env) apreq_env_header_in(env, "Content-Type")
00142 
00143 
00149 #define apreq_env_cookie(env) apreq_env_header_in(env, "Cookie")
00150 
00156 #define apreq_env_cookie2(env) apreq_env_header_in(env, "Cookie2")
00157 
00165 APREQ_DECLARE(apr_status_t)apreq_env_header_out(void *env, 
00166                                                 const char *name,
00167                                                 char *val);
00168 
00175 #define apreq_env_set_cookie(e,s) apreq_env_header_out(e,"Set-Cookie",s)
00176 
00183 #define apreq_env_set_cookie2(e,s) apreq_env_header_out(e,"Set-Cookie2",s)
00184 
00194 APREQ_DECLARE(apr_status_t) apreq_env_read(void *env,
00195                                            apr_read_type_e block,
00196                                            apr_off_t bytes);
00197 
00206 APREQ_DECLARE(const char *) apreq_env_temp_dir(void *env, const char *path);
00207 
00218 APREQ_DECLARE(apr_off_t) apreq_env_max_body(void *env, apr_off_t bytes);
00219 
00230 APREQ_DECLARE(apr_ssize_t) apreq_env_max_brigade(void *env, apr_ssize_t bytes);
00231 
00237 typedef struct apreq_env_t {
00238     const char *name;
00239     apr_uint32_t magic_number;
00240     void (*log)(const char *,int,int,apr_status_t,void *,const char *,va_list);
00241     apr_pool_t *(*pool)(void *);
00242     apreq_jar_t *(*jar)(void *,apreq_jar_t *);
00243     apreq_request_t *(*request)(void *,apreq_request_t *);
00244     const char *(*query_string)(void *);
00245     const char *(*header_in)(void *,const char *);
00246     apr_status_t (*header_out)(void *, const char *,char *);
00247     apr_status_t (*read)(void *,apr_read_type_e,apr_off_t);
00248     const char *(*temp_dir)(void *, const char *);
00249     apr_off_t (*max_body)(void *,apr_off_t);
00250     apr_ssize_t (*max_brigade)(void *, apr_ssize_t);
00251 } apreq_env_t;
00252 
00262 #define APREQ_ENV_MODULE(pre, name, mmn) const apreq_env_t pre##_module = { \
00263   name, mmn, pre##_log, pre##_pool, pre##_jar, pre##_request,               \
00264   pre##_query_string, pre##_header_in, pre##_header_out, pre##_read,        \
00265   pre##_temp_dir, pre##_max_body, pre##_max_brigade }
00266 
00267 
00275 APREQ_DECLARE(const apreq_env_t *) apreq_env_module(const apreq_env_t *mod);
00276 
00280 #define apreq_env_name (apreq_env_module(NULL)->name)
00281 
00285 #define apreq_env_magic_number (apreq_env_module(NULL)->magic_number)
00286 
00288 #ifdef __cplusplus
00289  }
00290 #endif
00291 
00292 #endif

Generated on Sat Jun 12 10:16:30 2004 for libapreq2 by doxygen1.2.15