summaryrefslogtreecommitdiff
path: root/common/config-parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/config-parser.c')
-rw-r--r--common/config-parser.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/common/config-parser.c b/common/config-parser.c
index 63c1bbb..c8f2155 100644
--- a/common/config-parser.c
+++ b/common/config-parser.c
@@ -42,6 +42,9 @@
#include <stdarg.h>
#include <dirent.h>
+#include <bsnmp/asn1.h>
+#include <bsnmp/snmp.h>
+
#include "config-parser.h"
static void
@@ -364,3 +367,24 @@ cfg_parse_uri (char *uri, char** scheme, char** host, char** user, char** path)
return NULL;
}
+
+#define CONFIG_SNMP "snmp"
+#define CONFIG_SNMP2 "snmp2"
+#define CONFIG_SNMP2C "snmp2c"
+
+/* Parsing snmp, snmp2 snmp2c etc... */
+const char*
+cfg_parse_scheme(const char *str, enum snmp_version *scheme)
+{
+ /* Currently we only support SNMP pollers */
+ if(strcmp(str, CONFIG_SNMP) == 0)
+ *scheme = SNMP_V1;
+ else if(strcmp(str, CONFIG_SNMP2) == 0)
+ *scheme = SNMP_V2c;
+ else if(strcmp(str, CONFIG_SNMP2C) == 0)
+ *scheme = SNMP_V2c;
+ else
+ return "invalid scheme";
+ return NULL;
+}
+