aboutsummaryrefslogtreecommitdiffstats
path: root/src/cfg_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cfg_utils.c')
-rw-r--r--src/cfg_utils.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/src/cfg_utils.c b/src/cfg_utils.c
index 720d931ef..6bd16d620 100644
--- a/src/cfg_utils.c
+++ b/src/cfg_utils.c
@@ -751,7 +751,7 @@ parse_comma_list (memory_pool_t * pool, gchar *line)
}
struct classifier_config *
-check_classifier_cfg (struct config_file *cfg, struct classifier_config *c)
+check_classifier_conf (struct config_file *cfg, struct classifier_config *c)
{
if (c == NULL) {
c = memory_pool_alloc0 (cfg->cfg_pool, sizeof (struct classifier_config));
@@ -764,6 +764,20 @@ check_classifier_cfg (struct config_file *cfg, struct classifier_config *c)
return c;
}
+struct statfile*
+check_statfile_conf (struct config_file *cfg, struct statfile *c)
+{
+ if (c == NULL) {
+ c = memory_pool_alloc0 (cfg->cfg_pool, sizeof (struct statfile));
+ }
+ if (c->opts == NULL) {
+ c->opts = g_hash_table_new (g_str_hash, g_str_equal);
+ memory_pool_add_destructor (cfg->cfg_pool, (pool_destruct_func) g_hash_table_destroy, c->opts);
+ }
+
+ return c;
+}
+
struct metric *
check_metric_conf (struct config_file *cfg, struct metric *c)
{
@@ -1006,6 +1020,30 @@ insert_classifier_symbols (struct config_file *cfg)
g_hash_table_foreach (cfg->classifiers_symbols, symbols_classifiers_callback, cfg);
}
+struct classifier_config*
+find_classifier_conf (struct config_file *cfg, const gchar *name)
+{
+ GList *cur;
+ struct classifier_config *cf;
+
+ if (name == NULL) {
+ return NULL;
+ }
+
+ cur = cfg->classifiers;
+ while (cur) {
+ cf = cur->data;
+
+ if (g_ascii_strcasecmp (cf->classifier->name, name) == 0) {
+ return cf;
+ }
+
+ cur = g_list_next (cur);
+ }
+
+ return NULL;
+}
+
/*
* vi:ts=4
*/