diff options
author | Stef Walter <stef@memberwebs.com> | 2006-03-11 04:10:01 +0000 |
---|---|---|
committer | Stef Walter <stef@memberwebs.com> | 2006-03-11 04:10:01 +0000 |
commit | 134fb023d41f6115b75242394dc4dcb97b49d30e (patch) | |
tree | 0da8d4af52e2abde216f39813a1a9d973c2e460c /src/bsnmp-regex.c | |
parent | e5a80cae26f015e59e3fce266aae41306251b1c7 (diff) |
Configuration for the FIFO
Diffstat (limited to 'src/bsnmp-regex.c')
-rw-r--r-- | src/bsnmp-regex.c | 46 |
1 files changed, 45 insertions, 1 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, ®ex_fifo)) != SNMP_ERR_NOERROR) + return r; + /* TODO: Make and open the FIFO here.... + if (config_parse () < 0) { + string_rollback (ctx, ®ex_config); + return SNMP_ERR_GENERR; + } */ + break; + case SNMP_OP_COMMIT: + string_commit (ctx); + break; + case SNMP_OP_ROLLBACK: + string_rollback (ctx, ®ex_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; } |