*/
void ec_node_type_dump(FILE *out);
-TAILQ_HEAD(ec_node_list, ec_node);
-
struct ec_node {
const struct ec_node_type *type;
char *id;
char *desc;
struct ec_keyval *attrs;
- /* XXX ensure parent and child are properly set in all nodes */
- struct ec_node *parent;
unsigned int refcnt;
-#define EC_NODE_F_BUILT 0x0001 /** set if configuration is built */
- unsigned int flags;
-
- TAILQ_ENTRY(ec_node) next;
- struct ec_node_list children;
+ struct ec_node **children; /* array of children */
+ size_t n_children; /* number of children in the array */
};
/* create a new node when the type is known, typically called from the node
struct ec_node *ec_node_clone(struct ec_node *node);
void ec_node_free(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);
+int ec_node_add_child(struct ec_node *node, struct ec_node *child);
+int ec_node_del_child(struct ec_node *node, struct ec_node *child);
+
/**
* Get the max len of strvec that can be parsed by this node
*
/* XXX add more accessors */
struct ec_keyval *ec_node_attrs(const struct ec_node *node);
-struct ec_node *ec_node_parent(const struct ec_node *node);
const char *ec_node_id(const struct ec_node *node);
const char *ec_node_desc(const struct ec_node *node);