4#ifndef RUDIMENTS_APACHEMODULE_H
5#define RUDIMENTS_APACHEMODULE_H
7#ifndef HTTP_MODULE_NAME
8 #error HTTP_MODULE_NAME not defined
11#define XDO_CHILD_INIT_FUNCTION(NM) DO_CHILD_INIT_FUNCTION(NM)
12#define DO_CHILD_INIT_FUNCTION(NM) do_##NM##_init
13#define XCHILD_INIT_FUNCTION(NM) CHILD_INIT_FUNCTION(NM)
14#define CHILD_INIT_FUNCTION(NM) NM##_init
16#define XDO_HANDLER_FUNCTION(NM) DO_HANDLER_FUNCTION(NM)
17#define DO_HANDLER_FUNCTION(NM) do_##NM##_handler
18#define XHANDLER_FUNCTION(NM) HANDLER_FUNCTION(NM)
19#define HANDLER_FUNCTION(NM) NM##_handler
21#define XDO_CHILD_EXIT_FUNCTION(NM) DO_CHILD_EXIT_FUNCTION(NM)
22#define DO_CHILD_EXIT_FUNCTION(NM) do_##NM##_exit
23#define XCHILD_EXIT_FUNCTION(NM) CHILD_EXIT_FUNCTION(NM)
24#define CHILD_EXIT_FUNCTION(NM) NM##_exit
26#define XMODULE_STRUCT(NM) MODULE_STRUCT(NM)
27#define MODULE_STRUCT(NM) NM##_module
29#define XXFILE_NAME(NM) XFILE_NAME(NM)
30#define XFILE_NAME(NM) FILE_NAME(mod_##NM)
31#define FILE_NAME(NM) #NM".c"
33#define XMOD_NAME(NM) MOD_NAME(NM)
34#define MOD_NAME(NM) #NM
36#include <rudiments/apachehttpserverapi.h>
37#include <rudiments/private/apacheincludes.h>
40 #include <rudiments/charstring.h>
56 static void XCHILD_INIT_FUNCTION(HTTP_MODULE_NAME)(
59 static apr_status_t XHANDLER_FUNCTION(HTTP_MODULE_NAME)(
61 static apr_status_t XCHILD_EXIT_FUNCTION(HTTP_MODULE_NAME)(
void *);
64 static void XDO_CHILD_INIT_FUNCTION(HTTP_MODULE_NAME)(
67 XCHILD_INIT_FUNCTION(HTTP_MODULE_NAME)(p,s);
68 apr_pool_cleanup_register(p,s,
69 XCHILD_EXIT_FUNCTION(HTTP_MODULE_NAME),
70 XCHILD_EXIT_FUNCTION(HTTP_MODULE_NAME));
73 static apr_status_t XDO_HANDLER_FUNCTION(HTTP_MODULE_NAME)(
76 XMOD_NAME(HTTP_MODULE_NAME))) {
79 return XHANDLER_FUNCTION(HTTP_MODULE_NAME)(r);
83 static void register_hooks(apr_pool_t *pool) {
84 ap_hook_child_init(XDO_CHILD_INIT_FUNCTION(HTTP_MODULE_NAME),
85 NULL,NULL,APR_HOOK_FIRST);
86 ap_hook_handler(XDO_HANDLER_FUNCTION(HTTP_MODULE_NAME),
87 NULL,NULL,APR_HOOK_FIRST);
91 module AP_MODULE_DECLARE_DATA XMODULE_STRUCT(HTTP_MODULE_NAME) = {
92 MODULE_MAGIC_NUMBER_MAJOR,
93 MODULE_MAGIC_NUMBER_MINOR,
95 XXFILE_NAME(HTTP_MODULE_NAME),
109 static void XCHILD_INIT_FUNCTION(HTTP_MODULE_NAME)(apr_pool_t *p,
116 httpModuleInit(&sapi);
119 static apr_status_t XHANDLER_FUNCTION(HTTP_MODULE_NAME)(
124 aas.serverrec=r->server;
127 return (httpModuleMain(&sapi))?OK:DECLINED;
130 static apr_status_t XCHILD_EXIT_FUNCTION(HTTP_MODULE_NAME)(
void *v) {
134 aas.serverrec=(server_rec *)v;
137 return (httpModuleExit(&sapi))?OK:DECLINED;
142 static void XCHILD_INIT_FUNCTION(HTTP_MODULE_NAME)(
143 server_rec *s, pool *p);
144 static int XHANDLER_FUNCTION(HTTP_MODULE_NAME)(
146 static void XCHILD_EXIT_FUNCTION(HTTP_MODULE_NAME)(
147 server_rec *s, pool *p);
150 static const handler_rec handler_struct[] = {
151 { XMOD_NAME(HTTP_MODULE_NAME),
152 XHANDLER_FUNCTION(HTTP_MODULE_NAME) },
157 #ifdef MODULE_MAGIC_COOKIE
158 #define GW_MODULE_MAGIC_COOKIE MODULE_MAGIC_COOKIE,
160 #define GW_MODULE_MAGIC_COOKIE
163 module MODULE_VAR_EXPORT XMODULE_STRUCT(HTTP_MODULE_NAME) = {
164 MODULE_MAGIC_NUMBER_MAJOR,
165 MODULE_MAGIC_NUMBER_MINOR,
167 XXFILE_NAME(HTTP_MODULE_NAME),
170 GW_MODULE_MAGIC_COOKIE
186 XCHILD_INIT_FUNCTION(HTTP_MODULE_NAME),
187 XCHILD_EXIT_FUNCTION(HTTP_MODULE_NAME),
198 static void XCHILD_INIT_FUNCTION(HTTP_MODULE_NAME)(
199 server_rec *s, pool *p) {
205 httpModuleInit(&sapi);
208 static int XHANDLER_FUNCTION(HTTP_MODULE_NAME)(request_rec *r) {
212 aas.serverrec=r->server;
215 return (httpModuleMain(&sapi))?OK:DECLINED;
218 static void XCHILD_EXIT_FUNCTION(HTTP_MODULE_NAME)(
219 server_rec *s, pool *p) {
226 httpModuleExit(&sapi);
Definition apachehttpserverapi.h:20
static int32_t compare(const char *str1, const char *str2)
Definition httpserverapi.h:22
Definition apachemodule.h:43