summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlaforge <laforge>2005-11-20 13:20:57 +0000
committerlaforge <laforge>2005-11-20 13:20:57 +0000
commite6459a06dbc4057ec1680c76075bc12c1774d385 (patch)
tree455096d3fac90b900e0e45c767f72a69f5b1bf59
parent3913a9084585dc691270d2faa9677132cf96c80f (diff)
use bitmask instead of enum for input/output data type
-rw-r--r--configure.in3
-rw-r--r--include/ulogd/ulogd.h20
-rw-r--r--src/ulogd.c9
3 files changed, 18 insertions, 14 deletions
diff --git a/configure.in b/configure.in
index e3b73fd..f586426 100644
--- a/configure.in
+++ b/configure.in
@@ -28,6 +28,9 @@ dnl Checks for library functions.
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(socket strerror)
+AC_CHECK_HEADER([libnetfilter_log/linux_nfnetlink_log.h], [AC_MSG_RESULT([found])],
+ [AC_MSG_ERROR([libnetfilter_log Version 0.0.11 or later needed])])
+
DATABASE_DIR=""
DATABASE_LIB=""
DATABASE_LIB_DIR=""
diff --git a/include/ulogd/ulogd.h b/include/ulogd/ulogd.h
index 16a2f7a..6ca6a6e 100644
--- a/include/ulogd/ulogd.h
+++ b/include/ulogd/ulogd.h
@@ -71,12 +71,12 @@
/* ulogd data type */
enum ulogd_dtype {
- ULOGD_DTYPE_NULL,
- ULOGD_DTYPE_SOURCE, /* source of data, no input keys */
- ULOGD_DTYPE_RAW, /* raw packet data */
- ULOGD_DTYPE_PACKET, /* packet metadata */
- ULOGD_DTYPE_FLOW, /* flow metadata */
- ULOGD_DTYPE_SINK, /* sink of data, no output keys */
+ ULOGD_DTYPE_NULL = 0x0000,
+ ULOGD_DTYPE_SOURCE = 0x0001, /* source of data, no input keys */
+ ULOGD_DTYPE_RAW, = 0x0002, /* raw packet data */
+ ULOGD_DTYPE_PACKET = 0x0004, /* packet metadata */
+ ULOGD_DTYPE_FLOW = 0x0008, /* flow metadata */
+ ULOGD_DTYPE_SINK = 0x0010, /* sink of data, no output keys */
};
/* structure describing an input / output parameter of a plugin */
@@ -129,16 +129,16 @@ struct ulogd_plugin {
struct ulogd_key *keys;
/* number of input keys */
unsigned int num_keys;
- /* type */
- enum ulogd_dtype type;
+ /* bitmask of possible types */
+ unsigned int type;
} input;
struct {
/* possible input keys of this interpreter */
struct ulogd_key *keys;
/* number of keys this interpreter has */
unsigned int num_keys;
- /* type */
- enum ulogd_dtype type;
+ /* bitmask of possible types */
+ unsigned int type;
} output;
/* function to call for each packet */
diff --git a/src/ulogd.c b/src/ulogd.c
index 4ae6470..614d965 100644
--- a/src/ulogd.c
+++ b/src/ulogd.c
@@ -415,7 +415,7 @@ create_stack_resolve_keys(struct ulogd_pluginstance_stack *stack)
if (i == 1) {
/* first round: output plugin */
- if (pi_cur->plugin->output.type != ULOGD_DTYPE_SINK) {
+ if (!(pi_cur->plugin->output.type & ULOGD_DTYPE_SINK)) {
ulogd_log(ULOGD_ERROR, "last plugin in stack "
"has to be output plugin\n");
return -EINVAL;
@@ -425,7 +425,8 @@ create_stack_resolve_keys(struct ulogd_pluginstance_stack *stack)
if (&pi_prev->list == &stack->list) {
/* this is the last one in the stack */
- if (pi_cur->plugin->input.type != ULOGD_DTYPE_SOURCE) {
+ if (!(pi_cur->plugin->input.type
+ & ULOGD_DTYPE_SOURCE)) {
ulogd_log(ULOGD_ERROR, "first plugin in stack "
"has to be source plugin\n");
return -EINVAL;
@@ -435,8 +436,8 @@ create_stack_resolve_keys(struct ulogd_pluginstance_stack *stack)
int j;
/* not the last one in the stack */
- if (pi_cur->plugin->input.type !=
- pi_prev->plugin->output.type) {
+ if (!(pi_cur->plugin->input.type &
+ pi_prev->plugin->output.type)) {
ulogd_log(ULOGD_ERROR, "type mismatch between "
"%s and %s in stack\n",
pi_cur->plugin->name,