summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/apache13.h101
-rw-r--r--include/apache20.h25
-rw-r--r--include/mod_log_sql.h166
-rw-r--r--include/winconfig.h78
4 files changed, 370 insertions, 0 deletions
diff --git a/include/apache13.h b/include/apache13.h
new file mode 100644
index 0000000..5659420
--- /dev/null
+++ b/include/apache13.h
@@ -0,0 +1,101 @@
1/* $Id: apache13.h 175 2007-10-20 13:18:20Z urkle@drip.ws $ */
2#ifndef APACHE13_H
3#define APACHE13_H
4
5#include "httpd.h"
6#include "http_config.h"
7#include "http_log.h"
8#include "http_core.h"
9
10/* Defines */
11#define AP_MODULE_DECLARE_DATA MODULE_VAR_EXPORT
12#define APR_OFF_T_FMT "ld"
13#define APR_PID_T_FMT "d"
14#define APR_SUCCESS 0
15#define APR_OFFSETOF XtOffsetOf
16
17/** method of declaring a directive with raw argument parsing */
18# define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help) \
19 { directive, func, mconfig, where, RAW_ARGS, help }
20/** method of declaring a directive which takes 1 argument */
21# define AP_INIT_TAKE1(directive, func, mconfig, where, help) \
22 { directive, func, mconfig, where, TAKE1, help }
23/** method of declaring a directive which takes 2 argument */
24# define AP_INIT_TAKE2(directive, func, mconfig, where, help) \
25 { directive, func, mconfig, where, TAKE2, help }
26/** method of declaring a directive which takes multiple arguments */
27# define AP_INIT_ITERATE(directive, func, mconfig, where, help) \
28 { directive, func, mconfig, where, ITERATE, help }
29/** method of declaring a directive which takes 1 or 3 arguments */
30# define AP_INIT_TAKE13(directive, func, mconfig, where, help) \
31 { directive, func, mconfig, where, TAKE13, help }
32/** method of declaring a directive which takes 3 arguments */
33# define AP_INIT_TAKE3(directive, func, mconfig, where, help) \
34 { directive, func, mconfig, where, TAKE3, help }
35/** method of declaring a directive which takes a flag (on/off) as an argument */
36# define AP_INIT_FLAG(directive, func, mconfig, where, help) \
37 { directive, func, mconfig, where, FLAG, help }
38
39/* Types */
40#define apr_pool_t pool
41#define apr_array_header_t array_header
42#define apr_table_t table
43
44#define apr_status_t int
45#define apr_uri_t uri_components
46
47/* Functions */
48#define ap_get_remote_host(a,b,c,d) ap_get_remote_host(a,b,c)
49#define ap_set_deprecated NULL
50
51#define apr_uri_unparse ap_unparse_uri_components
52#define apr_uri_parse ap_parse_uri_components
53#define ap_add_version_component(p,s) ap_add_version_component(s)
54
55#define apr_pool_create(a,b) *(a) = ap_make_sub_pool(b)
56#define apr_pool_destroy ap_destroy_pool
57#define apr_pool_cleanup_register ap_register_cleanup
58#define apr_palloc ap_palloc
59#define apr_pcalloc ap_pcalloc
60#define apr_pstrdup ap_pstrdup
61#define apr_pstrcat ap_pstrcat
62#define apr_psprintf ap_psprintf
63#define apr_snprintf ap_snprintf
64#define ap_strchr strchr
65#define ap_strchr_c strchr
66#define ap_strstr strstr
67#define ap_strstr_c strstr
68
69#define apr_table_set ap_table_set
70#define apr_table_get ap_table_get
71#define apr_table_make ap_make_table
72
73#define apr_array_push ap_push_array
74#define apr_array_make ap_make_array
75#define apr_array_cat ap_array_cat
76#define apr_is_empty_array(t) (((t) == NULL)||((t)->nelts == 0))
77
78#define apr_file_t FILE
79#define apr_file_printf fprintf
80
81#define apr_tolower ap_tolower
82
83void log_error(char *file, int line, int level, apr_status_t status,
84 const server_rec *s, const char *fmt, ...) __attribute__ ((format (printf, 6,7)));
85
86#ifndef WIN32
87inline
88#endif
89void log_error(char *file, int line, int level,
90 apr_status_t status, const server_rec *s, const char *fmt, ...)
91{
92 static char buff[MAX_STRING_LEN];
93 va_list args;
94 va_start(args, fmt);
95 ap_vsnprintf(buff,MAX_STRING_LEN, fmt,args);
96 ap_log_error(file,line,level | APLOG_NOERRNO ,s,"%s",buff);
97 va_end(args);
98}
99
100
101#endif /* APACHE13_H */
diff --git a/include/apache20.h b/include/apache20.h
new file mode 100644
index 0000000..4c755ab
--- /dev/null
+++ b/include/apache20.h
@@ -0,0 +1,25 @@
1/* $Id: apache20.h 125 2004-04-29 18:05:25Z urkle@drip.ws $ */
2#ifndef APACHE20_H
3#define APACHE20_H
4
5#include "apr_strings.h"
6#include "apr_lib.h"
7#include "apr_hash.h"
8#include "apr_optional.h"
9#define APR_WANT_STRFUNC
10#include "apr_want.h"
11#include "apr_tables.h"
12
13#include "ap_config.h"
14
15#include "httpd.h"
16#include "http_config.h"
17#include "http_core.h"
18#include "http_log.h"
19#include "http_protocol.h"
20
21#include "util_time.h"
22
23#define log_error ap_log_error
24
25#endif /* APACHE20_H */
diff --git a/include/mod_log_sql.h b/include/mod_log_sql.h
new file mode 100644
index 0000000..c1d9bff
--- /dev/null
+++ b/include/mod_log_sql.h
@@ -0,0 +1,166 @@
1/* $Id$ */
2
3#ifndef MOD_LOG_SQL_H
4#define MOD_LOG_SQL_H
5
6/* Create a set of LOGSQL_DECLARE(type), LOGSQL_DECLARE_NONSTD(type) and
7 * LOGSQL_DECLARE_DATA with appropriate export and import tags for the platform
8 */
9#if !defined(WIN32)
10#define LOGSQL_DECLARE(type) type
11#define LOGSQL_DECLARE_NONSTD(type) type
12#define LOGSQL_DECLARE_DATA
13#elif defined(LOGSQL_DECLARE_STATIC)
14#define LOGSQL_DECLARE(type) type __stdcall
15#define LOGSQL_DECLARE_NONSTD(type) type
16#define LOGSQL_DECLARE_DATA
17#elif defined(LOGSQL_DECLARE_EXPORT)
18#define LOGSQL_DECLARE(type) __declspec(dllexport) type __stdcall
19#define LOGSQL_DECLARE_NONSTD(type) __declspec(dllexport) type
20#define LOGSQL_DECLARE_DATA __declspec(dllexport)
21#else
22#define LOGSQL_DECLARE(type) __declspec(dllimport) type __stdcall
23#define LOGSQL_DECLARE_NONSTD(type) __declspec(dllimport) type
24#define LOGSQL_DECLARE_DATA __declspec(dllimport)
25#endif
26
27#define LOG_SQL_PLUGIN_VERSION 20080318
28
29/* Registration function for extract functions */
30
31typedef const char *logsql_item_func(request_rec *r, char *a);
32
33
34typedef enum {
35 LOGSQL_FUNCTION_REQ_FINAL = 0,
36 LOGSQL_FUNCTION_REQ_ORIG
37} logsql_function_req;
38
39LOGSQL_DECLARE(void) log_sql_register_function(apr_pool_t *p,
40 const char *alias, logsql_item_func *func,
41 logsql_function_req want_orig_default);
42
43LOGSQL_DECLARE(void) log_sql_register_alias(server_rec *s, apr_pool_t *p,
44 char key, const char *alias);
45
46typedef enum {
47 LOGSQL_DATATYPE_INT = 0,
48 LOGSQL_DATATYPE_SMALLINT,
49 LOGSQL_DATATYPE_VARCHAR,
50 LOGSQL_DATATYPE_CHAR,
51 LOGSQL_DATATYPE_BIGINT
52} logsql_field_datatype;
53
54LOGSQL_DECLARE(void) log_sql_register_field(apr_pool_t *p,
55 const char *alias,
56 const char *funcalias, const char *param,
57 const char *sql_field_name,
58 logsql_field_datatype datatype, apr_size_t size);
59
60LOGSQL_DECLARE(void) log_sql_register_finish(server_rec *s);
61
62/* DB Connection structure holds connection handle */
63typedef struct {
64 int connected; /* Are we connected to the DB */
65 void *handle; /* DB specific connection pointer */
66 apr_pool_t *p; /* Pool to allocate handle off of */
67 apr_table_t *parms; /* DB connection parameters */
68} logsql_dbconnection;
69
70/* open db handle return values*/
71typedef enum {
72 LOGSQL_OPENDB_FAIL = 0,
73 LOGSQL_OPENDB_SUCCESS,
74 LOGSQL_OPENDB_ALREADY,
75 LOGSQL_OPENDB_PRESERVE
76} logsql_opendb_ret;
77
78typedef enum {
79 LOGSQL_QUERY_SUCCESS = 0,
80 LOGSQL_QUERY_FAIL,
81 LOGSQL_QUERY_NOLINK,
82 LOGSQL_QUERY_NOTABLE,
83 LOGSQL_QUERY_PRESERVED
84} logsql_query_ret;
85
86typedef enum {
87 LOGSQL_TABLE_SUCCESS = 0,
88 LOGSQL_TABLE_FAIL
89} logsql_table_ret;
90
91/* Table type to create/log to */
92typedef enum {
93 LOGSQL_TABLE_ACCESS = 0,
94 LOGSQL_TABLE_NOTES,
95 LOGSQL_TABLE_HEADERSOUT,
96 LOGSQL_TABLE_HEADERSIN,
97 LOGSQL_TABLE_COOKIES
98} logsql_tabletype;
99
100/* All Tables */
101#define LOGSQL_TABLE_ALL LOGSQL_TABLE_ACCESS | LOGSQL_TABLE_NOTES | \
102 LOGSQL_TABLE_HEADERSIN | LOGSQL_TABLE_HEADERSOUT | LOGSQL_TABLE_COOKIES
103
104/* MySQL module calls */
105
106/* Registration function for database drivers */
107
108typedef struct {
109 /* name of the provider */
110 const char *providername;
111 /* NULL terminated list of drivers strings */
112 const char **provided_drivers;
113 /* create a connection to the underlying database layer */
114 logsql_opendb_ret (*connect)(server_rec *s, logsql_dbconnection *db);
115 /* disconnect from the underlying database layer */
116 void (*disconnect)(logsql_dbconnection *db);
117 /* escape the SQL statement according to database rules */
118 const char *(*escape)(request_rec *r,const char *from_str, apr_pool_t *p,
119 logsql_dbconnection *db);
120 /* insert a SQL query statement */
121 logsql_query_ret (*insert)(request_rec *r,logsql_dbconnection *db,
122 const char *query);
123 /* create a SQL table named table_name of table_type */
124 logsql_table_ret (*create_table)(request_rec *r, logsql_dbconnection *db,
125 logsql_tabletype table_type, const char *table_name);
126} logsql_dbdriver;
127
128LOGSQL_DECLARE(void) log_sql_register_driver(apr_pool_t *p,
129 logsql_dbdriver *driver);
130
131/* Module initialization Macros */
132#define LOGSQL_MODULE(driver) log_sql_##driver##_module
133#if defined(WITH_APACHE20)
134# define LOGSQL_MODULE_FORWARD(driver) module AP_MODULE_DECLARE_DATA LOGSQL_MODULE(driver)
135# define LOGSQL_REGISTER(driver) \
136 static int post_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s); \
137 static void register_hooks(apr_pool_t *p) { \
138 ap_hook_post_config(post_config, NULL, NULL, APR_HOOK_REALLY_FIRST); \
139 } \
140 \
141 LOGSQL_MODULE_FORWARD(driver) = { \
142 STANDARD20_MODULE_STUFF, \
143 NULL, NULL, NULL, NULL, NULL, register_hooks }; \
144 static int post_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
145#elif defined(WITH_APACHE13)
146# define LOGSQL_MODULE_FORWARD(driver) module MODULE_VAR_EXPORT LOGSQL_MODULE(driver)
147# define LOGSQL_REGISTER(driver) \
148 static void module_init(server_rec *s, apr_pool_t *p); \
149 LOGSQL_MODULE_FORWARD(driver) = { \
150 STANDARD_MODULE_STUFF, module_init }; \
151 static void module_init(server_rec *s, apr_pool_t *p)
152#endif
153
154#if defined(WITH_APACHE20)
155# define LOGSQL_SHUTDOWN \
156 static
157#endif
158
159
160#if defined(WITH_APACHE20)
161#define LOGSQL_REGISTER_RETURN log_sql_register_finish(s); return OK;
162#elif defined(WITH_APACHE13)
163#define LOGSQL_REGISTER_RETURN log_sql_register_finish(s);
164#endif
165
166#endif /* MOD_LOG_SQL_H */
diff --git a/include/winconfig.h b/include/winconfig.h
new file mode 100644
index 0000000..702c35f
--- /dev/null
+++ b/include/winconfig.h
@@ -0,0 +1,78 @@
1/* config.h. Generated by configure. */
2/* config.h.in. Generated from configure.ac by autoheader. */
3
4/* Define to 1 if you have the <inttypes.h> header file. */
5/* #undef HAVE_INTTYPES_H */
6
7/* Define to 1 if you have the `m' library (-lm). */
8/* #undef HAVE_LIBM */
9
10/* Define to 1 if you have the `mysqlclient' library (-lmysqlclient). */
11#define HAVE_LIBMYSQLCLIENT 1
12
13/* Define to 1 if you have the `z' library (-lz). */
14/* #undef HAVE_LIBZ */
15
16/* Define to 1 if you have the <limits.h> header file. */
17#define HAVE_LIMITS_H 1
18
19/* Define to 1 if you have the <memory.h> header file. */
20#define HAVE_MEMORY_H 1
21
22/* Define to 1 if you have the <mod_ssl.h> header file. */
23/* #undef HAVE_MOD_SSL_H */
24
25/* Define to 1 if you have the `mysql_real_escape_string' function. */
26#define HAVE_MYSQL_REAL_ESCAPE_STRING 1
27
28/* Define to 1 if you have the <stdint.h> header file. */
29/* #undef HAVE_STDINT_H */
30
31/* Define to 1 if you have the <stdlib.h> header file. */
32/* #undef HAVE_STDLIB_H 1
33
34/* Define to 1 if you have the <strings.h> header file. */
35/* #undef HAVE_STRINGS_H */
36
37/* Define to 1 if you have the <string.h> header file. */
38/* #undef HAVE_STRING_H */
39
40/* Define to 1 if you have the <sys/stat.h> header file. */
41/* #undef HAVE_SYS_STAT_H */
42
43/* Define to 1 if you have the <sys/types.h> header file. */
44/* #undef HAVE_SYS_TYPES_H */
45
46/* Define to 1 if you have the <unistd.h> header file. */
47/* #undef HAVE_UNISTD_H */
48
49/* Define to the address where bug reports for this package should be sent. */
50#define PACKAGE_BUGREPORT ""
51
52/* Define to the full name of this package. */
53#define PACKAGE_NAME "mod_log_sql"
54
55/* Define to the full name and version of this package. */
56#define PACKAGE_STRING "mod_log_sql 1.100"
57
58/* Define to the one symbol short name of this package. */
59#define PACKAGE_TARNAME "mod-log-sql"
60
61/* Define to the version of this package. */
62#define PACKAGE_VERSION "1.100"
63
64/* Define to 1 if you have the ANSI C header files. */
65/* #undef STDC_HEADERS */
66
67/* Define if we want to compile in SSL support. */
68/* #undef WANT_SSL_LOGGING */
69
70/* Define to 1 if we are compiling with Apache 1.3.x */
71/* #undef WITH_APACHE13 */
72
73/* Define to 1 if we are compiling with Apache 2.0.x */
74/* #undef WITH_APACHE20 */
75
76/* Define to 1 if we are compiling with mysql */
77#define WITH_MYSQL 1
78