OSDN Git Service

* version up.
[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_perror test_log_perror
24 #  define chxj_log_error test_log_error
25 #  define chxj_run_http_scheme test_run_http_scheme
26 #  include "apr.h"
27 #  include "apr_pools.h"
28 #  include "apr_tables.h"
29 #  define APLOG_EMERG 0   /* system is unusable */
30 #  define APLOG_ALERT 1   /* action must be taken immediately */
31 #  define APLOG_CRIT  2   /* critical conditions */
32 #  define APLOG_ERR   3   /* error conditions */
33 #  define APLOG_WARNING   4   /* warning conditions */
34 #  define APLOG_NOTICE    5   /* normal but significant condition */
35 #  define APLOG_INFO  6   /* informational */
36 #  define APLOG_DEBUG 7   /* debug-level messages */
37 #  define APLOG_LEVELMASK 7   /* mask off the level value */
38 #  ifndef __CONFIG_H__
39 #    define __CONFIG_H__
40 #    undef PACKAGE_NAME
41 #    undef PACKAGE_STRING
42 #    undef PACKAGE_TARNAME
43 #    undef PACKAGE_VERSION
44 #    include "test_config.h"
45 #  endif
46 #  define AP_MODULE_DECLARE_DATA
47 #  define APLOG_MARK   __FILE__,__LINE__
48 typedef struct module_struct module;
49 struct module_struct {
50     int version;
51     int minor_version;
52     int module_index;
53     const char *name;
54     void *dynamic_load_handle;
55     struct module_struct *next;
56     unsigned long magic;
57     void (*rewrite_args) (void *process);
58     void *(*create_dir_config) (apr_pool_t *p, char *dir);
59     void *(*merge_dir_config) (apr_pool_t *p, void *base_conf, void *new_conf);
60     void *(*create_server_config) (apr_pool_t *p, void *s);
61     void *(*merge_server_config) (apr_pool_t *p, void *base_conf, void *new_conf);
62     const void *cmds;
63     void (*register_hooks) (apr_pool_t *p);
64 };
65 typedef struct ap_conf_vector_t ap_conf_vector_t;
66 typedef struct test_request_rec {
67   apr_pool_t *pool;
68   ap_conf_vector_t *per_dir_config;
69   apr_table_t *headers_in;
70   apr_table_t *headers_out;
71   char *uri;
72   char *args;
73   char *hostname;
74   char *unparsed_uri;
75 } request_rec;
76
77
78 extern void test_log_error(const char *file, int line, int level, apr_status_t status, const request_rec *r, const char *fmt, ...);
79 extern void test_log_rerror(const char *file, int line, int level, apr_status_t status, const request_rec *r, const char *fmt, ...);
80 extern void test_log_perror(const char *file, int line, int level, apr_status_t status, apr_pool_t *p, const char *fmt, ...);
81 extern const char *test_run_http_scheme(request_rec *r);
82 extern char *test_os_escape_path(apr_pool_t *p, const char *path, int partial);
83 extern void test_set_content_type(request_rec *r, const char *ct);
84 extern void *test_get_module_config(const ap_conf_vector_t *cv, const module *m);
85 extern char *test_ap_escape_html(apr_pool_t *p, const char *s);
86
87 #else
88 #  include "httpd.h"
89 #  include "http_config.h"
90 #  include "http_protocol.h"
91 #  include "http_request.h"
92 #  include "http_log.h"
93 #  include "ap_config.h"
94 #  include "util_filter.h"
95 #  ifndef __CONFIG_H__
96 #    define __CONFIG_H__
97
98 #    undef PACKAGE_NAME
99 #    undef PACKAGE_STRING
100 #    undef PACKAGE_TARNAME
101 #    undef PACKAGE_VERSION
102 #    include "config.h"
103 #  endif
104 #  define chxj_log_rerror ap_log_rerror
105 #  define chxj_log_error ap_log_error
106 #  define chxj_log_perror ap_log_perror
107 #  define chxj_run_http_scheme chxj_apache_run_http_scheme
108 #endif
109
110 #define chxj_escape_uri(p,path) chxj_os_escape_path(p,path,1)
111
112 extern const char *chxj_apache_run_http_scheme(request_rec *r);
113 extern char * chxj_os_escape_path(apr_pool_t *p, const char *path, int partial);
114 extern void chxj_set_content_type(request_rec *r, const char *ct);
115 extern void * chxj_get_module_config(const ap_conf_vector_t *cv, const module *m);
116 extern char *chxj_ap_escape_html(apr_pool_t *p, const char *s);
117
118
119 #endif
120 /*
121  * vim:ts=2 et
122  */