summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--router.c28
-rw-r--r--router.h1
2 files changed, 29 insertions, 0 deletions
diff --git a/router.c b/router.c
index 4ef0180..df46981 100644
--- a/router.c
+++ b/router.c
@@ -252,6 +252,34 @@ bool agl_router_assign_class_to_rtgroup (struct userdata *u, agl_node_type class
return true;
}
+agl_rtgroup * agl_router_get_rtgroup_from_class (struct userdata *u, agl_node_type class, uint32_t zone, agl_direction type)
+{
+ agl_router *router;
+ pa_hashmap *rtable;
+ agl_rtgroup ***classmap;
+ agl_rtgroup **zonemap;
+ agl_rtgroup * rtg;
+
+ pa_assert (u);
+ pa_assert_se (router = u->router);
+ pa_assert (class >= 0 && class < router->maplen);
+ pa_assert (zone < AGL_ZONE_MAX);
+ pa_assert (type == agl_input || type == agl_output);
+
+ if (type == agl_input) {
+ rtable = router->rtgroups.input;
+ classmap = router->classmap.input;
+ } else {
+ rtable = router->rtgroups.output;
+ classmap = router->classmap.output;
+ }
+
+ zonemap = classmap[zone];
+ rtg = zonemap[class];
+
+ return rtg;
+}
+
void agl_router_assign_class_priority (struct userdata *u, agl_node_type class, int priority)
{
agl_router *router;
diff --git a/router.h b/router.h
index cc7bf95..1a139b5 100644
--- a/router.h
+++ b/router.h
@@ -79,6 +79,7 @@ int agl_router_phone_effect (struct userdata *, agl_rtgroup *, agl_node *, bool)
agl_rtgroup *agl_router_create_rtgroup (struct userdata *, agl_direction, const char *, const char *, agl_rtgroup_accept_t, agl_rtgroup_effect_t);
void agl_router_destroy_rtgroup (struct userdata *, agl_direction, const char *);
bool agl_router_assign_class_to_rtgroup (struct userdata *, agl_node_type, uint32_t, agl_direction, const char *);
+agl_rtgroup * agl_router_get_rtgroup_from_class (struct userdata *u, agl_node_type class, uint32_t zone, agl_direction type);
void agl_router_assign_class_priority (struct userdata *, agl_node_type, int);
int agl_router_get_node_priority (struct userdata *, agl_node *);
bool agl_router_apply_node_priority_effect (struct userdata *, agl_node *, bool);