From 6a40004beef80306d5f7dcea9febec948adf6d50 Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Thu, 21 Jun 2018 22:45:29 +0200 Subject: [PATCH] get config --- lib/ecoli_node.c | 5 +++++ lib/ecoli_node.h | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/ecoli_node.c b/lib/ecoli_node.c index b710a40..a181835 100644 --- a/lib/ecoli_node.c +++ b/lib/ecoli_node.c @@ -215,6 +215,11 @@ fail: return -1; } +const struct ec_config *ec_node_get_config(struct ec_node *node) +{ + return node->config; +} + #if 0 /* later */ int ec_node_del_child(struct ec_node *node, struct ec_node *child) { diff --git a/lib/ecoli_node.h b/lib/ecoli_node.h index 1035778..63178f7 100644 --- a/lib/ecoli_node.h +++ b/lib/ecoli_node.h @@ -149,10 +149,14 @@ struct ec_node *ec_node_clone(struct ec_node *node); void ec_node_free(struct ec_node *node); /* set configuration of a node - * after a call to this function, the config is owned by the node and - * must not be used by the caller */ + * after a call to this function, the config is + * owned by the node and must not be used by the caller + * on error, the config is freed. */ int ec_node_set_config(struct ec_node *node, struct ec_config *config); +/* get the current node configuration. Return NULL if no configuration. */ +const struct ec_config *ec_node_get_config(struct ec_node *node); + size_t ec_node_get_children_count(const struct ec_node *node); struct ec_node * ec_node_get_child(const struct ec_node *node, size_t i); -- 2.20.1