summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
author/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org </C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org>2005-12-15 12:37:58 +0000
committer/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org </C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org>2005-12-15 12:37:58 +0000
commitedacb6372310667af624ba8c9273aca9e02945f7 (patch)
tree96ab73855079d422a147d2ee1f01ec14c78af87b /include
parent524d429a3789c81166affecf3c5b1e93cb32e73d (diff)
don't "#include" a .c file but rather compile db.c on it's own
Diffstat (limited to 'include')
-rw-r--r--include/ulogd/db.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/include/ulogd/db.h b/include/ulogd/db.h
new file mode 100644
index 0000000..b4b4325
--- /dev/null
+++ b/include/ulogd/db.h
@@ -0,0 +1,61 @@
+#ifndef _ULOGD_DB_H
+#define _ULOGD_DB_H
+
+#include <ulogd/ulogd.h>
+
+struct db_driver {
+ int (*get_columns)(struct ulogd_pluginstance *upi);
+ int (*open_db)(struct ulogd_pluginstance *upi);
+ int (*close_db)(struct ulogd_pluginstance *upi);
+ int (*escape_string)(struct ulogd_pluginstance *upi,
+ char *dst, const char *src, unsigned int len);
+ int (*execute)(struct ulogd_pluginstance *upi,
+ const char *stmt, unsigned int len);
+ char *(*strerror)(struct ulogd_pluginstance *upi);
+};
+
+struct db_instance {
+ char *stmt; /* buffer for our insert statement */
+ char *stmt_val; /* pointer to the beginning of the "VALUES" part */
+ char *stmt_ins; /* pointer to current inser position in statement */
+ char *schema;
+ time_t reconnect;
+ int (*interp)(struct ulogd_pluginstance *upi);
+ struct db_driver *driver;
+};
+#define TIME_ERR ((time_t)-1) /* Be paranoid */
+
+#define DB_CES \
+ { \
+ .key = "table", \
+ .type = CONFIG_TYPE_STRING, \
+ .options = CONFIG_OPT_MANDATORY, \
+ }, \
+ { \
+ .key = "reconnect", \
+ .type = CONFIG_TYPE_INT, \
+ }, \
+ { \
+ .key = "ip_as_string", \
+ .type = CONFIG_TYPE_INT, \
+ }, \
+ { \
+ .key = "connect_timeout", \
+ .type = CONFIG_TYPE_INT, \
+ }
+
+#define DB_CE_NUM 4
+#define table_ce(x) (x->ces[0])
+#define reconnect_ce(x) (x->ces[1])
+#define asstring_ce(x) (x->ces[2])
+#define timeout_ce(x) (x->ces[3])
+
+void ulogd_db_signal(struct ulogd_pluginstance *upi, int signal);
+int ulogd_db_start(struct ulogd_pluginstance *upi);
+int ulogd_db_stop(struct ulogd_pluginstance *upi);
+int ulogd_db_interp(struct ulogd_pluginstance *upi);
+int ulogd_db_configure(struct ulogd_pluginstance *upi,
+ struct ulogd_pluginstance_stack *stack);
+
+
+#endif