OSDN Git Service

* Added new header file.
[modchxj/mod_chxj.git] / include / chxj_apache.h
1 /*
2  * Copyright (C) 2005-2008 Atsushi Konno All rights reserved.
3  * Copyright (C) 2005 QSDN,Inc. All rights reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 #ifndef __CHXJ_APACHE_H__
18 #define __CHXJ_APACHE_H__
19
20
21 #if defined(CHXJ_TEST)
22 #  define chxj_log_rerror test_log_rerror
23 #  define chxj_log_error test_log_error
24 #  define chxj_run_http_scheme test_run_http_scheme
25 #  include "apr.h"
26 #  include "apr_pools.h"
27 #  include "apr_tables.h"
28 #  define APLOG_EMERG 0   /* system is unusable */
29 #  define APLOG_ALERT 1   /* action must be taken immediately */
30 #  define APLOG_CRIT  2   /* critical conditions */
31 #  define APLOG_ERR   3   /* error conditions */
32 #  define APLOG_WARNING   4   /* warning conditions */
33 #  define APLOG_NOTICE    5   /* normal but significant condition */
34 #  define APLOG_INFO  6   /* informational */
35 #  define APLOG_DEBUG 7   /* debug-level messages */
36 #  define APLOG_LEVELMASK 7   /* mask off the level value */
37 #  ifndef __CONFIG_H__
38 #    define __CONFIG_H__
39 #    undef PACKAGE_NAME
40 #    undef PACKAGE_STRING
41 #    undef PACKAGE_TARNAME
42 #    undef PACKAGE_VERSION
43 #    include "test_config.h"
44 #  endif
45 #  define AP_MODULE_DECLARE_DATA
46 #  define APLOG_MARK   __FILE__,__LINE__
47 typedef struct module_struct module;
48 struct module_struct {
49     int version;
50     int minor_version;
51     int module_index;
52     const char *name;
53     void *dynamic_load_handle;
54     struct module_struct *next;
55     unsigned long magic;
56     void (*rewrite_args) (void *process);
57     void *(*create_dir_config) (apr_pool_t *p, char *dir);
58     void *(*merge_dir_config) (apr_pool_t *p, void *base_conf, void *new_conf);
59     void *(*create_server_config) (apr_pool_t *p, void *s);
60     void *(*merge_server_config) (apr_pool_t *p, void *base_conf, void *new_conf);
61     const void *cmds;
62     void (*register_hooks) (apr_pool_t *p);
63 };
64 typedef struct ap_conf_vector_t ap_conf_vector_t;
65 typedef struct test_request_rec {
66   apr_pool_t *pool;
67   ap_conf_vector_t *per_dir_config;
68   apr_table_t *headers_in;
69   apr_table_t *headers_out;
70   char *uri;
71   char *args;
72   char *hostname;
73   char *unparsed_uri;
74 } request_rec;
75
76
77 extern void test_log_error(const char *file, int line, int level, apr_status_t status, const request_rec *r, const char *fmt, ...);
78 extern void test_log_rerror(const char *file, int line, int level, apr_status_t status, const request_rec *r, const char *fmt, ...);
79 extern const char *test_run_http_scheme(request_rec *r);
80 extern char *test_os_escape_path(apr_pool_t *p, const char *path, int partial);
81 extern void test_set_content_type(request_rec *r, const char *ct);
82 extern void *test_get_module_config(const ap_conf_vector_t *cv, const module *m);
83 extern char *test_ap_escape_html(apr_pool_t *p, const char *s);
84
85 #else
86 #  include "httpd.h"
87 #  include "http_config.h"
88 #  include "http_protocol.h"
89 #  include "http_request.h"
90 #  include "http_log.h"
91 #  include "ap_config.h"
92 #  include "util_filter.h"
93 #  ifndef __CONFIG_H__
94 #    define __CONFIG_H__
95
96 #    undef PACKAGE_NAME
97 #    undef PACKAGE_STRING
98 #    undef PACKAGE_TARNAME
99 #    undef PACKAGE_VERSION
100 #    include "config.h"
101 #  endif
102 #  define chxj_log_rerror ap_log_rerror
103 #  define chxj_log_error ap_log_error
104 #  define chxj_run_http_scheme chxj_apache_run_http_scheme
105 #endif
106
107 #define chxj_escape_uri(p,path) chxj_os_escape_path(p,path,1)
108
109 extern const char *chxj_apache_run_http_scheme(request_rec *r);
110 extern char * chxj_os_escape_path(apr_pool_t *p, const char *path, int partial);
111 extern void chxj_set_content_type(request_rec *r, const char *ct);
112 extern void * chxj_get_module_config(const ap_conf_vector_t *cv, const module *m);
113 extern char *chxj_ap_escape_html(apr_pool_t *p, const char *s);
114
115
116 #endif
117 /*
118  * vim:ts=2 et
119  */