1 /*
2  * Mod Defender for HAProxy
3  *
4  * Support for the Mod Defender code on non-Apache platforms.
5  *
6  * Copyright 2017 HAProxy Technologies, Dragan Dosen <ddosen@haproxy.com>
7  *
8  * Parts of code based on Apache HTTP Server source
9  * Copyright 2015 The Apache Software Foundation (http://www.apache.org/)
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version
14  * 3 of the License, or (at your option) any later version.
15  *
16  */
17 #ifndef __STANDALONE_H__
18 #define __STANDALONE_H__
19 
20 #include <http_core.h>
21 #include <http_main.h>
22 #include <http_config.h>
23 
24 #include <apr_pools.h>
25 #include <apr_hooks.h>
26 
27 #define INSERT_BEFORE(f, before_this) ((before_this) == NULL                \
28                            || (before_this)->frec->ftype > (f)->frec->ftype \
29                            || (before_this)->r != (f)->r)
30 
31 #define DECLARE_EXTERNAL_HOOK(ns,link,ret,name,args)                           \
32 ns##_HOOK_##name##_t *run_##ns##_hook_##name = NULL;                           \
33 link##_DECLARE(void) ns##_hook_##name(ns##_HOOK_##name##_t *pf,                \
34                                       const char * const *aszPre,              \
35                                       const char * const *aszSucc, int nOrder) \
36 {                                                                              \
37 	run_##ns##_hook_##name = pf;                                           \
38 }
39 
40 #define DECLARE_HOOK(ret,name,args) \
41 	DECLARE_EXTERNAL_HOOK(ap,AP,ret,name,args)
42 
43 #define UNKNOWN_METHOD (-1)
44 
45 extern void (*logger)(int level, char *str);
46 extern const char *read_module_config(server_rec *s, void *mconfig,
47                                       const command_rec *cmds,
48                                       apr_pool_t *p, apr_pool_t *ptemp,
49                                       const char *filename);
50 extern int lookup_builtin_method(const char *method, apr_size_t len);
51 
52 #endif /* __STANDALONE_H__ */
53