summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2006-03-11 04:10:01 +0000
committerStef Walter <stef@memberwebs.com>2006-03-11 04:10:01 +0000
commit134fb023d41f6115b75242394dc4dcb97b49d30e (patch)
tree0da8d4af52e2abde216f39813a1a9d973c2e460c
parente5a80cae26f015e59e3fce266aae41306251b1c7 (diff)
Configuration for the FIFO
-rw-r--r--src/bsnmp-regex.c46
-rw-r--r--src/regex-tree.def7
2 files changed, 49 insertions, 4 deletions
diff --git a/src/bsnmp-regex.c b/src/bsnmp-regex.c
index 2d20655..785659b 100644
--- a/src/bsnmp-regex.c
+++ b/src/bsnmp-regex.c
@@ -53,9 +53,11 @@ TAILQ_HEAD(data_entry_list, data_entry);
static struct data_entry_list entries = TAILQ_HEAD_INITIALIZER(entries);
static uint32_t entry_count = 0;
+static char *config_memory = NULL;
+
/* configuration */
static u_char *regex_config = NULL;
-static char *config_memory = NULL;
+static u_char *regex_fifo = NULL;
/* -----------------------------------------------------------------------------
* HELPERS
@@ -409,6 +411,39 @@ op_regexconfig (struct snmp_context *ctx, struct snmp_value *value,
}
return SNMP_ERR_NOERROR;
+
+
+ case LEAF_regexFifo:
+
+ if (op == SNMP_OP_GET)
+ return string_get (value, regex_fifo, -1);
+
+ /* Remainder only at initialization */
+ if (community != COMM_INITIALIZE)
+ return SNMP_ERR_NOT_WRITEABLE;
+
+ switch (op) {
+ case SNMP_OP_SET:
+ if ((r = string_save (value, ctx, -1, &regex_fifo)) != SNMP_ERR_NOERROR)
+ return r;
+ /* TODO: Make and open the FIFO here....
+ if (config_parse () < 0) {
+ string_rollback (ctx, &regex_config);
+ return SNMP_ERR_GENERR;
+ } */
+ break;
+ case SNMP_OP_COMMIT:
+ string_commit (ctx);
+ break;
+ case SNMP_OP_ROLLBACK:
+ string_rollback (ctx, &regex_fifo);
+ break;
+ default:
+ ASSERT(0);
+ break;
+ }
+
+ return SNMP_ERR_NOERROR;
}
ASSERT(0);
@@ -528,6 +563,12 @@ module_init (struct lmodule *mod, int argc, char *argv[])
if (!regex_config)
return ENOMEM;
+ regex_fifo = strdup ("");
+ if (!regex_fifo) {
+ free (regex_config);
+ return ENOMEM;
+ }
+
return 0;
}
@@ -548,6 +589,9 @@ module_fini (void)
ASSERT (regex_config);
free (regex_config);
+ ASSERT (regex_fifo);
+ free (regex_fifo);
+
return 0;
}
diff --git a/src/regex-tree.def b/src/regex-tree.def
index 23e0508..3305ada 100644
--- a/src/regex-tree.def
+++ b/src/regex-tree.def
@@ -5,9 +5,10 @@
# Valid only during configuration
(0 regexConfig OCTETSTRING op_regexconfig GET SET)
-
- (1 regexCount INTEGER op_regex GET)
- (2 regexEntry : INTEGER op_regexentry
+ (1 regexFifo OCTETSTRING op_regexconfig GET SET)
+
+ (10 regexCount INTEGER op_regex GET)
+ (11 regexEntry : INTEGER op_regexentry
(1 regexIndex INTEGER GET)
(2 regexDescr OCTETSTRING GET)
(3 regexLast TIMETICKS GET)