diff --git a/config.c b/config.c index 934caa2..9ef8be1 100644 --- a/config.c +++ b/config.c @@ -24,6 +24,7 @@ #include #include "config.h" #include "ether.h" +#include "hash.h" #include "print.h" #include "util.h" @@ -803,6 +804,15 @@ void config_init_interface(struct interface *iface, struct config *cfg) iface->boundary_clock_jbod = cfg->dds.boundary_clock_jbod; } +int config_init(struct config *cfg) +{ + cfg->htab = hash_create(); + if (!cfg->htab) { + return -1; + } + return 0; +} + void config_destroy(struct config *cfg) { struct interface *iface; @@ -811,4 +821,5 @@ void config_destroy(struct config *cfg) STAILQ_REMOVE_HEAD(&cfg->interfaces, list); free(iface); } + hash_destroy(cfg->htab, free); } diff --git a/config.h b/config.h index 7bff11f..222883a 100644 --- a/config.h +++ b/config.h @@ -60,6 +60,10 @@ struct config { /* configured interfaces */ STAILQ_HEAD(interfaces_head, interface) interfaces; + /* hash of all non-legacy items */ + struct hash *htab; + + /* the rest are legacy fields */ enum timestamp_type timestamping; enum transport_type transport; enum delay_mechanism dm;