void validate_node(std_config_node_t node) { const struct test_config_node *test_node_ptr=NULL; std_config_node_t child_node; int attr_id=0; const char *attr_name; test_node_ptr=&(test_config_data[node_id]); printf("%s:%d node_id: %d names: expected:%s found %s\n", __FUNCTION__, __LINE__, node_id, std_config_name_get(node), test_node_ptr->name); ASSERT_EQ(strcmp(std_config_name_get(node), test_node_ptr->name), 0); for(; (attr_id<TEST_MAX_ATTRS) && (test_node_ptr->attrs[attr_id].name != NULL); attr_id++) { attr_name=test_node_ptr->attrs[attr_id].name; printf("%s:%d attribute %s: expected:%s found %s\n", __FUNCTION__, __LINE__, attr_name, test_node_ptr->attrs[attr_id].value, std_config_attr_get(node, attr_name)); ASSERT_EQ(strcmp(test_node_ptr->attrs[attr_id].value, std_config_attr_get(node, attr_name)), 0); } /* Check the child nodes */ for (child_node=std_config_get_child(node); (child_node != NULL); child_node=std_config_next_node(child_node)) { node_id++; validate_node(child_node); } }
static t_std_error sdi_pseudo_bus_register (std_config_node_t node, sdi_bus_hdl_t *bus_hdl) { sdi_bus_hdl_t bus = NULL; STD_ASSERT(bus_hdl != NULL); bus = (sdi_bus_hdl_t) calloc(sizeof(sdi_bus_t), 1); STD_ASSERT(bus != NULL); bus->bus_type = SDI_PSEUDO_BUS; bus->bus_id = 0; bus->bus_init = sdi_pseudo_bus_init; safestrncpy(bus->bus_name, std_config_name_get(node), SDI_MAX_NAME_LEN); sdi_bus_register(bus); *bus_hdl = bus; sdi_bus_register_device_list(node, bus); return STD_ERR_OK; }
void __process_single_file(const char * file) { std_config_hdl_t h = std_config_load(file); if (h==nullptr) { EV_LOG(TRACE,DSAPI,0,"CPS-META","Invalid file contents %s",file); return ; } std_config_node_t node = std_config_get_root(h); if (node!=nullptr) { do { const char * _node_name = std_config_name_get(node); if (_node_name==nullptr || (strcmp(_node_name,"cps-class-map")!=0)) { break; } std_config_for_each_node(node,__process_file,nullptr); } while (0); } std_config_unload(h); }