summaryrefslogtreecommitdiff
path: root/src/rrdbotd.h
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2006-01-25 04:07:04 +0000
committerStef Walter <stef@memberwebs.com>2006-01-25 04:07:04 +0000
commit7fcead4473bc224bc8c6a66e2db3b3ee87f751d4 (patch)
treed92c54aed884ed001f7901bbb4bef9623975df76 /src/rrdbotd.h
parent26a677b17880a14b9345270cb15b37d27d7d4797 (diff)
Configuration file parsing for rrdbotd.
Diffstat (limited to 'src/rrdbotd.h')
-rw-r--r--src/rrdbotd.h48
1 files changed, 42 insertions, 6 deletions
diff --git a/src/rrdbotd.h b/src/rrdbotd.h
index 61aef40..9c4f2b4 100644
--- a/src/rrdbotd.h
+++ b/src/rrdbotd.h
@@ -39,14 +39,24 @@
#ifndef __RRDBOTD_H__
#define __RRDBOTD_H__
+#include "asn1.h"
#include "snmp.h"
#include "sock_any.h"
#include "hash.h"
+/* -----------------------------------------------------------------------------
+ * DATA
+ */
+
struct _rb_item;
struct _rb_poller;
struct _rb_host;
+/*
+ * Note that all the members are either in the config memory
+ * or inline. This helps us keep memory management simple.
+ */
+
typedef struct _rb_item
{
/* Specific to this item */
@@ -57,13 +67,15 @@ typedef struct _rb_item
/* Pointers to related */
const struct _rb_poller* poller;
const struct _rb_host* host;
+
+ /* Next in list of items */
+ struct _rb_item* next;
}
rb_item;
-
typedef struct _rb_host
{
- const char* host;
+ const char* name;
/* Host resolving and book keeping */
struct sockaddr_any address;
@@ -75,13 +87,17 @@ typedef struct _rb_host
}
rb_host;
-
typedef struct _rb_poller
{
+ /* The hash key is interval-rrdname */
+ char key[MAXPATHLEN];
+
+ /* This points into the memory above */
const char* rrdname;
+
uint32_t interval;
- /* The things to poll */
+ /* The things to poll. rb_poller owns this list */
rb_item* items;
/* Book keeping */
@@ -92,9 +108,12 @@ typedef struct _rb_poller
}
rb_poller;
-
typedef struct _rb_state
{
+ /* Settings from command line */
+ const char* confdir;
+ const char* rrddir;
+
/* All the pollers/hosts */
rb_poller* polls;
rb_host* hosts;
@@ -105,13 +124,30 @@ typedef struct _rb_state
}
rb_state;
+/* One global rb_state with all the main settings */
+extern rb_state g_state;
/* -----------------------------------------------------------------------------
- * LOGGING
+ * UTILITIES (rrdbotd.c)
*/
void rb_messagex (int level, const char* msg, ...);
void rb_message (int level, const char* msg, ...);
+typedef void (*voidfunc)(void*);
+void rb_atexit (voidfunc func, void* data);
+
+/* -----------------------------------------------------------------------------
+ * CONFIG (config.c)
+ */
+
+void rb_config_parse();
+void rb_config_free();
+
+/* -----------------------------------------------------------------------------
+ * SNMP HELPERS (snmp-help.c)
+ */
+
+int rb_parse_mib(const char* oid, struct snmp_value* value);
#endif /* __RRDBOTD_H__ */