Apache HTTPD
util_debug.c
Go to the documentation of this file.
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#include "http_core.h"
23
24/* Possibly get rid of the macros we defined in httpd.h */
25#if defined(strchr)
26#undef strchr
27#endif
28
29#if defined (strrchr)
30#undef strrchr
31#endif
32
33#if defined (strstr)
34#undef strstr
35#endif
36
37
38#if defined(ap_strchr)
39#undef ap_strchr
40AP_DECLARE(char *) ap_strchr(char *s, int c);
41#endif
42
43AP_DECLARE(char *) ap_strchr(char *s, int c)
44{
45 return strchr(s,c);
46}
47
48#if defined(ap_strchr_c)
49#undef ap_strchr_c
50AP_DECLARE(const char *) ap_strchr_c(const char *s, int c);
51#endif
52
53AP_DECLARE(const char *) ap_strchr_c(const char *s, int c)
54{
55 return strchr(s,c);
56}
57
58#if defined(ap_strrchr)
59#undef ap_strrchr
60AP_DECLARE(char *) ap_strrchr(char *s, int c);
61#endif
62
63AP_DECLARE(char *) ap_strrchr(char *s, int c)
64{
65 return strrchr(s,c);
66}
67
68#if defined(ap_strrchr_c)
69#undef ap_strrchr_c
70AP_DECLARE(const char *) ap_strrchr_c(const char *s, int c);
71#endif
72
73AP_DECLARE(const char *) ap_strrchr_c(const char *s, int c)
74{
75 return strrchr(s,c);
76}
77
78#if defined(ap_strstr)
79#undef ap_strstr
80AP_DECLARE(char *) ap_strstr(char *s, const char *c);
81#endif
82
83AP_DECLARE(char *) ap_strstr(char *s, const char *c)
84{
85 return strstr(s,c);
86}
87
88#if defined(ap_strstr_c)
89#undef ap_strstr_c
90AP_DECLARE(const char *) ap_strstr_c(const char *s, const char *c);
91#endif
92
93AP_DECLARE(const char *) ap_strstr_c(const char *s, const char *c)
94{
95 return strstr(s,c);
96}
97
98#if defined(ap_get_module_config)
99#undef ap_get_module_config
101 const module *m);
102#endif
103
105 const module *m)
106{
107 return ((void **)cv)[m->module_index];
108}
109
111{
112 if (m->version < AP_MODULE_FLAGS_MMN_MAJOR
113 || (m->version == AP_MODULE_FLAGS_MMN_MAJOR
114 && (m->minor_version < AP_MODULE_FLAGS_MMN_MINOR))) {
115 return 0;
116 }
117
118 return m->flags;
119}
120
121#if defined(ap_get_core_module_config)
122#undef ap_get_core_module_config
124#endif
125
127{
128 return ((void **)cv)[AP_CORE_MODULE_INDEX];
129}
130
131
132#if defined(ap_get_server_module_loglevel)
133#undef ap_get_server_module_loglevel
134AP_DECLARE(int) ap_get_server_module_loglevel(const server_rec *s, int module_index);
135#endif
136
138{
139 if (module_index < 0 || s->log.module_levels == NULL ||
140 s->log.module_levels[module_index] < 0)
141 {
142 return s->log.level;
143 }
144
145 return s->log.module_levels[module_index];
146}
147
148#if defined(ap_get_conn_module_loglevel)
149#undef ap_get_conn_module_loglevel
150AP_DECLARE(int) ap_get_conn_module_loglevel(const conn_rec *c, int module_index);
151#endif
152
153AP_DECLARE(int) ap_get_conn_module_loglevel(const conn_rec *c, int module_index)
154{
155 const struct ap_logconf *l = (c)->log ? (c)->log : &(c)->base_server->log;
157 l->module_levels[module_index] < 0)
158 {
159 return l->level;
160 }
161
162 return l->module_levels[module_index];
163}
164
165#if defined(ap_get_conn_server_module_loglevel)
166#undef ap_get_conn_server_module_loglevel
168 const server_rec *s,
169 int module_index);
170#endif
171
173 const server_rec *s,
174 int module_index)
175{
176 const struct ap_logconf *l = (c->log && c->log != &c->base_server->log) ?
177 c->log : &s->log;
179 l->module_levels[module_index] < 0)
180 {
181 return l->level;
182 }
183
184 return l->module_levels[module_index];
185}
186
187#if defined(ap_get_request_module_loglevel)
188#undef ap_get_request_module_loglevel
189AP_DECLARE(int) ap_get_request_module_loglevel(const request_rec *c, int module_index);
190#endif
191
193{
194 const struct ap_logconf *l = r->log ? r->log :
196 &r->server->log;
198 l->module_levels[module_index] < 0)
199 {
200 return l->level;
201 }
202
203 return l->module_levels[module_index];
204}
205
215#if defined(ap_set_module_config)
216#undef ap_set_module_config
218 void *val);
219#endif
220
222 void *val)
223{
224 ((void **)cv)[m->module_index] = val;
225}
226
227
228#if defined(ap_set_core_module_config)
229#undef ap_set_core_module_config
231#endif
232
#define AP_DECLARE(type)
Definition ap_config.h:67
char * strstr(char *s1, char *s2)
APR Standard Headers Support.
#define ap_get_module_config(v, m)
#define ap_get_request_module_loglevel(r, i)
struct ap_conf_vector_t ap_conf_vector_t
#define ap_get_server_module_loglevel(s, i)
#define ap_get_conn_server_module_loglevel(c, s, i)
int ap_get_module_flags(const module *m)
Definition util_debug.c:110
#define ap_get_conn_module_loglevel(c, i)
#define ap_set_module_config(v, m, val)
#define AP_MODULE_FLAGS_MMN_MAJOR
#define AP_MODULE_FLAGS_MMN_MINOR
request_rec * r
#define ap_get_core_module_config(v)
Definition http_core.h:383
#define AP_CORE_MODULE_INDEX
Definition http_core.h:382
#define ap_set_core_module_config(v, val)
Definition http_core.h:385
#define ap_strchr(s, c)
Definition httpd.h:2351
#define ap_strstr(s, c)
Definition httpd.h:2359
#define ap_strrchr(s, c)
Definition httpd.h:2355
#define ap_strrchr_c(s, c)
Definition httpd.h:2357
#define ap_strstr_c(s, c)
Definition httpd.h:2361
#define ap_strchr_c(s, c)
Definition httpd.h:2353
apr_size_t size
apr_uint32_t val
Definition apr_atomic.h:66
apr_vformatter_buff_t * c
Definition apr_lib.h:175
const char * s
Definition apr_strings.h:95
const void * m
Apache Configuration.
CORE HTTP Daemon.
HTTP Daemon routines.
return NULL
Definition mod_so.c:359
signed char * module_levels
Definition httpd.h:1314
int level
Definition httpd.h:1317
Structure to store things which are per connection.
Definition httpd.h:1152
const struct ap_logconf * log
Definition httpd.h:1230
A structure that represents the current request.
Definition httpd.h:845
conn_rec * connection
Definition httpd.h:849
const struct ap_logconf * log
Definition httpd.h:1054
server_rec * server
Definition httpd.h:851
A structure to store information for each virtual server.
Definition httpd.h:1322
struct ap_logconf log
Definition httpd.h:1335