Finalize basic configuration logic
[staging/agl-audio-plugin.git] / config.c
index 4c4ed7d..26d725e 100644 (file)
--- a/config.c
+++ b/config.c
@@ -20,8 +20,9 @@
  *
  */
 #include "config.h"
+#include "zone.h"
 
-const char *pa_config_file_get_path (const char *dir, const char *file, char *buf, size_t len)
+const char *agl_config_file_get_path (const char *dir, const char *file, char *buf, size_t len)
 {
        pa_assert (file);
        pa_assert (buf);
@@ -32,7 +33,7 @@ const char *pa_config_file_get_path (const char *dir, const char *file, char *bu
        return buf;
 }
 
-bool pa_config_parse_file (struct userdata *u, const char *path)
+bool agl_config_parse_file (struct userdata *u, const char *path)
 {
        bool success;
 
@@ -42,7 +43,7 @@ bool pa_config_parse_file (struct userdata *u, const char *path)
                return false;
        else {
                pa_log_info ("parsing configuration file '%s'", path);
-               success = pa_config_dofile (u, path);
+               success = agl_config_dofile (u, path);
        }
 
        if (!success) {
@@ -53,7 +54,7 @@ bool pa_config_parse_file (struct userdata *u, const char *path)
        return success;
 }
 
-bool pa_config_dofile (struct userdata *u, const char *path)
+bool agl_config_dofile (struct userdata *u, const char *path)
 {
        /* TODO */
        return false;
@@ -117,5 +118,23 @@ bool use_default_configuration (struct userdata *u)
        typemap_def *t;
        prior_def *p;
 
+       pa_assert (u);
+
+       for (z = zones; z->name; z++)
+               agl_zoneset_add_zone (u, z->name, (uint32_t)(z - zones));
+
+       for (r = rtgroups; r->name; r++)
+               agl_router_create_rtgroup (u, r->type, r->name, r->accept, r->compare);
+
+       for (c = classmap; c->rtgroup; c++)
+               agl_router_assign_class_to_rtgroup (u, c->class, c->zone,
+                                                      c->type, c->rtgroup);
+
+       for (t = typemap; t->id; t++) 
+               agl_nodeset_add_role (u, t->id, t->type, NULL);
+
+       for (p = priormap; p->class; p++)
+               agl_router_assign_class_priority (u, p->class, p->priority);
+
        return true;
 }