From: Olivier Matz Date: Thu, 21 Jun 2018 20:45:29 +0000 (+0200) Subject: get config X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=6a40004beef80306d5f7dcea9febec948adf6d50;p=protos%2Flibecoli.git get config --- 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);