]> granicus.if.org Git - apache/blob - server/util_debug.c
Correct build order. Seems mod_session was misimplemented to require
[apache] / server / util_debug.c
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements.  See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License.  You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #define APR_WANT_STRFUNC
18 #include "apr_want.h"
19
20 #include "httpd.h"
21 #include "http_config.h"
22
23 /* Possibly get rid of the macros we defined in httpd.h */
24 #if defined(strchr)
25 #undef strchr
26 #endif
27
28 #if defined (strrchr)
29 #undef strrchr
30 #endif
31
32 #if defined (strstr)
33 #undef strstr
34 #endif
35
36
37 #if defined(ap_strchr)
38 #undef ap_strchr
39 AP_DECLARE(char *) ap_strchr(char *s, int c);
40 #endif
41
42 AP_DECLARE(char *) ap_strchr(char *s, int c)
43 {
44     return strchr(s,c);
45 }
46
47 #if defined(ap_strchr_c)
48 #undef ap_strchr_c
49 AP_DECLARE(const char *) ap_strchr_c(const char *s, int c);
50 #endif
51
52 AP_DECLARE(const char *) ap_strchr_c(const char *s, int c)
53 {
54     return strchr(s,c);
55 }
56
57 #if defined(ap_strrchr)
58 #undef ap_strrchr
59 AP_DECLARE(char *) ap_strrchr(char *s, int c);
60 #endif
61
62 AP_DECLARE(char *) ap_strrchr(char *s, int c)
63 {
64     return strrchr(s,c);
65 }
66
67 #if defined(ap_strrchr_c)
68 #undef ap_strrchr_c
69 AP_DECLARE(const char *) ap_strrchr_c(const char *s, int c);
70 #endif
71
72 AP_DECLARE(const char *) ap_strrchr_c(const char *s, int c)
73 {
74     return strrchr(s,c);
75 }
76
77 #if defined(ap_strstr)
78 #undef ap_strstr
79 AP_DECLARE(char *) ap_strstr(char *s, const char *c);
80 #endif
81
82 AP_DECLARE(char *) ap_strstr(char *s, const char *c)
83 {
84     return strstr(s,c);
85 }
86
87 #if defined(ap_strstr_c)
88 #undef ap_strstr_c
89 AP_DECLARE(const char *) ap_strstr_c(const char *s, const char *c);
90 #endif
91
92 AP_DECLARE(const char *) ap_strstr_c(const char *s, const char *c)
93 {
94     return strstr(s,c);
95 }
96
97 #if defined(ap_get_module_config)
98 #undef ap_get_module_config
99 AP_DECLARE(void *) ap_get_module_config(const ap_conf_vector_t *cv,
100                                         const module *m);
101 #endif
102
103 AP_DECLARE(void *) ap_get_module_config(const ap_conf_vector_t *cv,
104                                         const module *m)
105 {
106     return ((void **)cv)[m->module_index];
107 }
108
109 #if defined(ap_get_server_module_loglevel)
110 #undef ap_get_server_module_loglevel
111 AP_DECLARE(int) ap_get_server_module_loglevel(const server_rec *s, int module_index);
112 #endif
113
114 AP_DECLARE(int) ap_get_server_module_loglevel(const server_rec *s, int module_index)
115 {
116     if (module_index < 0 || s->log.module_levels == NULL ||
117         s->log.module_levels[module_index] < 0)
118     {
119         return s->log.level;
120     }
121
122     return s->log.module_levels[module_index];
123 }
124
125 #if defined(ap_get_conn_module_loglevel)
126 #undef ap_get_conn_module_loglevel
127 AP_DECLARE(int) ap_get_conn_module_loglevel(const conn_rec *c, int module_index);
128 #endif
129
130 AP_DECLARE(int) ap_get_conn_module_loglevel(const conn_rec *c, int module_index)
131 {
132     const struct ap_logconf *l = (c)->log ? (c)->log : &(c)->base_server->log;
133     if (module_index < 0 || l->module_levels == NULL ||
134         l->module_levels[module_index] < 0)
135     {
136         return l->level;
137     }
138
139     return l->module_levels[module_index];
140 }
141
142 #if defined(ap_get_conn_server_module_loglevel)
143 #undef ap_get_conn_server_module_loglevel
144 AP_DECLARE(int) ap_get_conn_server_module_loglevel(const conn_rec *c,
145                                                    const server_rec *s,
146                                                    int module_index);
147 #endif
148
149 AP_DECLARE(int) ap_get_conn_server_module_loglevel(const conn_rec *c,
150                                                    const server_rec *s,
151                                                    int module_index)
152 {
153     const struct ap_logconf *l = (c->log && c->log != &c->base_server->log) ?
154                                  c->log : &s->log;
155     if (module_index < 0 || l->module_levels == NULL ||
156         l->module_levels[module_index] < 0)
157     {
158         return l->level;
159     }
160
161     return l->module_levels[module_index];
162 }
163
164 #if defined(ap_get_request_module_loglevel)
165 #undef ap_get_request_module_loglevel
166 AP_DECLARE(int) ap_get_request_module_loglevel(const request_rec *c, int module_index);
167 #endif
168
169 AP_DECLARE(int) ap_get_request_module_loglevel(const request_rec *r, int module_index)
170 {
171     const struct ap_logconf *l = r->log             ? r->log             :
172                                  r->connection->log ? r->connection->log :
173                                  &r->server->log;
174     if (module_index < 0 || l->module_levels == NULL ||
175         l->module_levels[module_index] < 0)
176     {
177         return l->level;
178     }
179
180     return l->module_levels[module_index];
181 }
182
183 /**
184  * Generic accessors for other modules to set at their own module-specific
185  * data
186  * @param conf_vector The vector in which the modules configuration is stored.
187  *        usually r->per_dir_config or s->module_config
188  * @param m The module to set the data for.
189  * @param val The module-specific data to set
190  * @fn void ap_set_module_config(ap_conf_vector_t *cv, const module *m, void *val)
191  */
192 #if defined(ap_set_module_config)
193 #undef ap_set_module_config
194 AP_DECLARE(void) ap_set_module_config(ap_conf_vector_t *cv, const module *m,
195                                       void *val);
196 #endif
197
198 AP_DECLARE(void) ap_set_module_config(ap_conf_vector_t *cv, const module *m,
199                                       void *val)
200 {
201     ((void **)cv)[m->module_index] = val;
202 }