From ba30ceeb705e9b4d40ce0d98f6a4e047d47ce919 Mon Sep 17 00:00:00 2001 From: Edward Rudd Date: Sun, 21 Sep 2008 15:54:12 +0000 Subject: moved all modules source to src subdirectory.. Moved header files into include subdirectory cleaned up makefiles. --- (limited to 'include') 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 @@ +/* $Id: apache13.h 175 2007-10-20 13:18:20Z urkle@drip.ws $ */ +#ifndef APACHE13_H +#define APACHE13_H + +#include "httpd.h" +#include "http_config.h" +#include "http_log.h" +#include "http_core.h" + +/* Defines */ +#define AP_MODULE_DECLARE_DATA MODULE_VAR_EXPORT +#define APR_OFF_T_FMT "ld" +#define APR_PID_T_FMT "d" +#define APR_SUCCESS 0 +#define APR_OFFSETOF XtOffsetOf + +/** method of declaring a directive with raw argument parsing */ +# define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help) \ + { directive, func, mconfig, where, RAW_ARGS, help } +/** method of declaring a directive which takes 1 argument */ +# define AP_INIT_TAKE1(directive, func, mconfig, where, help) \ + { directive, func, mconfig, where, TAKE1, help } +/** method of declaring a directive which takes 2 argument */ +# define AP_INIT_TAKE2(directive, func, mconfig, where, help) \ + { directive, func, mconfig, where, TAKE2, help } +/** method of declaring a directive which takes multiple arguments */ +# define AP_INIT_ITERATE(directive, func, mconfig, where, help) \ + { directive, func, mconfig, where, ITERATE, help } +/** method of declaring a directive which takes 1 or 3 arguments */ +# define AP_INIT_TAKE13(directive, func, mconfig, where, help) \ + { directive, func, mconfig, where, TAKE13, help } +/** method of declaring a directive which takes 3 arguments */ +# define AP_INIT_TAKE3(directive, func, mconfig, where, help) \ + { directive, func, mconfig, where, TAKE3, help } +/** method of declaring a directive which takes a flag (on/off) as an argument */ +# define AP_INIT_FLAG(directive, func, mconfig, where, help) \ + { directive, func, mconfig, where, FLAG, help } + +/* Types */ +#define apr_pool_t pool +#define apr_array_header_t array_header +#define apr_table_t table + +#define apr_status_t int +#define apr_uri_t uri_components + +/* Functions */ +#define ap_get_remote_host(a,b,c,d) ap_get_remote_host(a,b,c) +#define ap_set_deprecated NULL + +#define apr_uri_unparse ap_unparse_uri_components +#define apr_uri_parse ap_parse_uri_components +#define ap_add_version_component(p,s) ap_add_version_component(s) + +#define apr_pool_create(a,b) *(a) = ap_make_sub_pool(b) +#define apr_pool_destroy ap_destroy_pool +#define apr_pool_cleanup_register ap_register_cleanup +#define apr_palloc ap_palloc +#define apr_pcalloc ap_pcalloc +#define apr_pstrdup ap_pstrdup +#define apr_pstrcat ap_pstrcat +#define apr_psprintf ap_psprintf +#define apr_snprintf ap_snprintf +#define ap_strchr strchr +#define ap_strchr_c strchr +#define ap_strstr strstr +#define ap_strstr_c strstr + +#define apr_table_set ap_table_set +#define apr_table_get ap_table_get +#define apr_table_make ap_make_table + +#define apr_array_push ap_push_array +#define apr_array_make ap_make_array +#define apr_array_cat ap_array_cat +#define apr_is_empty_array(t) (((t) == NULL)||((t)->nelts == 0)) + +#define apr_file_t FILE +#define apr_file_printf fprintf + +#define apr_tolower ap_tolower + +void log_error(char *file, int line, int level, apr_status_t status, + const server_rec *s, const char *fmt, ...) __attribute__ ((format (printf, 6,7))); + +#ifndef WIN32 +inline +#endif +void log_error(char *file, int line, int level, + apr_status_t status, const server_rec *s, const char *fmt, ...) +{ + static char buff[MAX_STRING_LEN]; + va_list args; + va_start(args, fmt); + ap_vsnprintf(buff,MAX_STRING_LEN, fmt,args); + ap_log_error(file,line,level | APLOG_NOERRNO ,s,"%s",buff); + va_end(args); +} + + +#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 @@ +/* $Id: apache20.h 125 2004-04-29 18:05:25Z urkle@drip.ws $ */ +#ifndef APACHE20_H +#define APACHE20_H + +#include "apr_strings.h" +#include "apr_lib.h" +#include "apr_hash.h" +#include "apr_optional.h" +#define APR_WANT_STRFUNC +#include "apr_want.h" +#include "apr_tables.h" + +#include "ap_config.h" + +#include "httpd.h" +#include "http_config.h" +#include "http_core.h" +#include "http_log.h" +#include "http_protocol.h" + +#include "util_time.h" + +#define log_error ap_log_error + +#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 @@ +/* $Id$ */ + +#ifndef MOD_LOG_SQL_H +#define MOD_LOG_SQL_H + +/* Create a set of LOGSQL_DECLARE(type), LOGSQL_DECLARE_NONSTD(type) and + * LOGSQL_DECLARE_DATA with appropriate export and import tags for the platform + */ +#if !defined(WIN32) +#define LOGSQL_DECLARE(type) type +#define LOGSQL_DECLARE_NONSTD(type) type +#define LOGSQL_DECLARE_DATA +#elif defined(LOGSQL_DECLARE_STATIC) +#define LOGSQL_DECLARE(type) type __stdcall +#define LOGSQL_DECLARE_NONSTD(type) type +#define LOGSQL_DECLARE_DATA +#elif defined(LOGSQL_DECLARE_EXPORT) +#define LOGSQL_DECLARE(type) __declspec(dllexport) type __stdcall +#define LOGSQL_DECLARE_NONSTD(type) __declspec(dllexport) type +#define LOGSQL_DECLARE_DATA __declspec(dllexport) +#else +#define LOGSQL_DECLARE(type) __declspec(dllimport) type __stdcall +#define LOGSQL_DECLARE_NONSTD(type) __declspec(dllimport) type +#define LOGSQL_DECLARE_DATA __declspec(dllimport) +#endif + +#define LOG_SQL_PLUGIN_VERSION 20080318 + +/* Registration function for extract functions */ + +typedef const char *logsql_item_func(request_rec *r, char *a); + + +typedef enum { + LOGSQL_FUNCTION_REQ_FINAL = 0, + LOGSQL_FUNCTION_REQ_ORIG +} logsql_function_req; + +LOGSQL_DECLARE(void) log_sql_register_function(apr_pool_t *p, + const char *alias, logsql_item_func *func, + logsql_function_req want_orig_default); + +LOGSQL_DECLARE(void) log_sql_register_alias(server_rec *s, apr_pool_t *p, + char key, const char *alias); + +typedef enum { + LOGSQL_DATATYPE_INT = 0, + LOGSQL_DATATYPE_SMALLINT, + LOGSQL_DATATYPE_VARCHAR, + LOGSQL_DATATYPE_CHAR, + LOGSQL_DATATYPE_BIGINT +} logsql_field_datatype; + +LOGSQL_DECLARE(void) log_sql_register_field(apr_pool_t *p, + const char *alias, + const char *funcalias, const char *param, + const char *sql_field_name, + logsql_field_datatype datatype, apr_size_t size); + +LOGSQL_DECLARE(void) log_sql_register_finish(server_rec *s); + +/* DB Connection structure holds connection handle */ +typedef struct { + int connected; /* Are we connected to the DB */ + void *handle; /* DB specific connection pointer */ + apr_pool_t *p; /* Pool to allocate handle off of */ + apr_table_t *parms; /* DB connection parameters */ +} logsql_dbconnection; + +/* open db handle return values*/ +typedef enum { + LOGSQL_OPENDB_FAIL = 0, + LOGSQL_OPENDB_SUCCESS, + LOGSQL_OPENDB_ALREADY, + LOGSQL_OPENDB_PRESERVE +} logsql_opendb_ret; + +typedef enum { + LOGSQL_QUERY_SUCCESS = 0, + LOGSQL_QUERY_FAIL, + LOGSQL_QUERY_NOLINK, + LOGSQL_QUERY_NOTABLE, + LOGSQL_QUERY_PRESERVED +} logsql_query_ret; + +typedef enum { + LOGSQL_TABLE_SUCCESS = 0, + LOGSQL_TABLE_FAIL +} logsql_table_ret; + +/* Table type to create/log to */ +typedef enum { + LOGSQL_TABLE_ACCESS = 0, + LOGSQL_TABLE_NOTES, + LOGSQL_TABLE_HEADERSOUT, + LOGSQL_TABLE_HEADERSIN, + LOGSQL_TABLE_COOKIES +} logsql_tabletype; + +/* All Tables */ +#define LOGSQL_TABLE_ALL LOGSQL_TABLE_ACCESS | LOGSQL_TABLE_NOTES | \ + LOGSQL_TABLE_HEADERSIN | LOGSQL_TABLE_HEADERSOUT | LOGSQL_TABLE_COOKIES + +/* MySQL module calls */ + +/* Registration function for database drivers */ + +typedef struct { + /* name of the provider */ + const char *providername; + /* NULL terminated list of drivers strings */ + const char **provided_drivers; + /* create a connection to the underlying database layer */ + logsql_opendb_ret (*connect)(server_rec *s, logsql_dbconnection *db); + /* disconnect from the underlying database layer */ + void (*disconnect)(logsql_dbconnection *db); + /* escape the SQL statement according to database rules */ + const char *(*escape)(request_rec *r,const char *from_str, apr_pool_t *p, + logsql_dbconnection *db); + /* insert a SQL query statement */ + logsql_query_ret (*insert)(request_rec *r,logsql_dbconnection *db, + const char *query); + /* create a SQL table named table_name of table_type */ + logsql_table_ret (*create_table)(request_rec *r, logsql_dbconnection *db, + logsql_tabletype table_type, const char *table_name); +} logsql_dbdriver; + +LOGSQL_DECLARE(void) log_sql_register_driver(apr_pool_t *p, + logsql_dbdriver *driver); + +/* Module initialization Macros */ +#define LOGSQL_MODULE(driver) log_sql_##driver##_module +#if defined(WITH_APACHE20) +# define LOGSQL_MODULE_FORWARD(driver) module AP_MODULE_DECLARE_DATA LOGSQL_MODULE(driver) +# define LOGSQL_REGISTER(driver) \ + static int post_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s); \ + static void register_hooks(apr_pool_t *p) { \ + ap_hook_post_config(post_config, NULL, NULL, APR_HOOK_REALLY_FIRST); \ + } \ + \ + LOGSQL_MODULE_FORWARD(driver) = { \ + STANDARD20_MODULE_STUFF, \ + NULL, NULL, NULL, NULL, NULL, register_hooks }; \ + static int post_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) +#elif defined(WITH_APACHE13) +# define LOGSQL_MODULE_FORWARD(driver) module MODULE_VAR_EXPORT LOGSQL_MODULE(driver) +# define LOGSQL_REGISTER(driver) \ + static void module_init(server_rec *s, apr_pool_t *p); \ + LOGSQL_MODULE_FORWARD(driver) = { \ + STANDARD_MODULE_STUFF, module_init }; \ + static void module_init(server_rec *s, apr_pool_t *p) +#endif + +#if defined(WITH_APACHE20) +# define LOGSQL_SHUTDOWN \ + static +#endif + + +#if defined(WITH_APACHE20) +#define LOGSQL_REGISTER_RETURN log_sql_register_finish(s); return OK; +#elif defined(WITH_APACHE13) +#define LOGSQL_REGISTER_RETURN log_sql_register_finish(s); +#endif + +#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 @@ +/* config.h. Generated by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_INTTYPES_H */ + +/* Define to 1 if you have the `m' library (-lm). */ +/* #undef HAVE_LIBM */ + +/* Define to 1 if you have the `mysqlclient' library (-lmysqlclient). */ +#define HAVE_LIBMYSQLCLIENT 1 + +/* Define to 1 if you have the `z' library (-lz). */ +/* #undef HAVE_LIBZ */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MOD_SSL_H */ + +/* Define to 1 if you have the `mysql_real_escape_string' function. */ +#define HAVE_MYSQL_REAL_ESCAPE_STRING 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_STDINT_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_STRINGS_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_STRING_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_STAT_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_TYPES_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_UNISTD_H */ + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "mod_log_sql" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "mod_log_sql 1.100" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "mod-log-sql" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "1.100" + +/* Define to 1 if you have the ANSI C header files. */ +/* #undef STDC_HEADERS */ + +/* Define if we want to compile in SSL support. */ +/* #undef WANT_SSL_LOGGING */ + +/* Define to 1 if we are compiling with Apache 1.3.x */ +/* #undef WITH_APACHE13 */ + +/* Define to 1 if we are compiling with Apache 2.0.x */ +/* #undef WITH_APACHE20 */ + +/* Define to 1 if we are compiling with mysql */ +#define WITH_MYSQL 1 + -- cgit v0.9.2