diff --git a/libbbfdm-api/dmapi.h b/libbbfdm-api/dmapi.h index e2001b07..6790370b 100644 --- a/libbbfdm-api/dmapi.h +++ b/libbbfdm-api/dmapi.h @@ -422,6 +422,14 @@ struct dmmap_dup { struct uci_section *dmmap_section; }; +struct dm_data { + struct list_head list; + struct uci_section *config_section; + struct uci_section *dmmap_section; + struct json_object *json_object; + void *additional_data; +}; + struct dm_fault { int code; char *description; diff --git a/libbbfdm-api/dmbbf.h b/libbbfdm-api/dmbbf.h index cb1d928f..b76abf15 100644 --- a/libbbfdm-api/dmbbf.h +++ b/libbbfdm-api/dmbbf.h @@ -75,6 +75,12 @@ static inline int DM_LINK_INST_OBJ(struct dmctx *dmctx, DMNODE *parent_node, voi } \ } while(0) +#define BBF_WARNING(MESSAGE, ...) do { \ + if (gLogLevel >= 2) { \ + syslog(LOG_WARNING, "[%s:%d] " MESSAGE, __FUNCTION__, __LINE__, ##__VA_ARGS__); /* Flawfinder: ignore */ \ + } \ +} while(0) + #define BBF_INFO(MESSAGE, ...) do { \ if (gLogLevel >= 3) { \ syslog(LOG_INFO, "[%s:%d] " MESSAGE, __FUNCTION__, __LINE__, ##__VA_ARGS__); /* Flawfinder: ignore */ \ diff --git a/libbbfdm-api/dmcommon.c b/libbbfdm-api/dmcommon.c index 1cda30ef..d777fe81 100644 --- a/libbbfdm-api/dmcommon.c +++ b/libbbfdm-api/dmcommon.c @@ -410,25 +410,21 @@ void hex_to_ip(char *address, char *ret, size_t size) */ void add_dmmap_config_dup_list(struct list_head *dup_list, struct uci_section *config_section, struct uci_section *dmmap_section) { - struct dmmap_dup *dmmap_config; + struct dm_data *dm_data = NULL; - dmmap_config = dmcalloc(1, sizeof(struct dmmap_dup)); - list_add_tail(&dmmap_config->list, dup_list); - dmmap_config->config_section = config_section; - dmmap_config->dmmap_section = dmmap_section; -} - -static void dmmap_config_dup_delete(struct dmmap_dup *dmmap_config) -{ - list_del(&dmmap_config->list); + dm_data = dmcalloc(1, sizeof(struct dm_data)); + list_add_tail(&dm_data->list, dup_list); + dm_data->config_section = config_section; + dm_data->dmmap_section = dmmap_section; } void free_dmmap_config_dup_list(struct list_head *dup_list) { - struct dmmap_dup *dmmap_config = NULL; - while (dup_list->next != dup_list) { - dmmap_config = list_entry(dup_list->next, struct dmmap_dup, list); - dmmap_config_dup_delete(dmmap_config); + struct dm_data *dm_data = NULL, *tmp = NULL; + + list_for_each_entry_safe(dm_data, tmp, dup_list, list) { + list_del(&dm_data->list); + dmfree(dm_data); } } diff --git a/libbbfdm-api/plugin/json_plugin.c b/libbbfdm-api/plugin/json_plugin.c index be962d83..5d9b9ea2 100644 --- a/libbbfdm-api/plugin/json_plugin.c +++ b/libbbfdm-api/plugin/json_plugin.c @@ -112,7 +112,7 @@ int get_json_plugin_version(json_object *json_obj) return JSON_VERSION_0; // Return JSON_VERSION_0 for invalid input int version = json_object_get_int(json_obj); - int json_plugin_version = JSON_VERSION_0; // Initialize to JSON_VERSION_0 + int json_plugin_version = 0; // Initialize to 0 switch (version) { case 1: @@ -123,6 +123,7 @@ int get_json_plugin_version(json_object *json_obj) json_plugin_version |= JSON_VERSION_1; // Set JSON_VERSION_1 for version 2 break; default: + json_plugin_version |= JSON_VERSION_0; break; } @@ -333,7 +334,7 @@ static void resolve_all_symbols(struct dmctx *ctx, void *data, char *instance, c if (strcmp(pch, "@Name") == 0) { char *sec_name = NULL; - dmuci_get_section_name(section_name((struct uci_section *)data), &sec_name); + dmuci_get_section_name(section_name(((struct dm_data *)data)->config_section), &sec_name); pos += snprintf(&new_key[pos], key_len - pos, "%s.", sec_name ? sec_name : ""); } else if (strcmp(pch, "@Value") == 0) pos += snprintf(&new_key[pos], key_len - pos, "%s.", value); @@ -431,7 +432,7 @@ static int browse_obj(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, struct json_object *section_type = NULL; struct json_object *dmmap_file = NULL; char *inst = NULL; - struct dmmap_dup *p = NULL; + struct dm_data *curr_data = NULL; LIST_HEAD(dup_list); json_object_object_get_ex((mapping_0 && (json_version & JSON_VERSION_1)) ? mapping_0 : mapping_obj, "uci", &uci_obj); @@ -442,18 +443,18 @@ static int browse_obj(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, if (file && section_type && dmmap_file) { synchronize_specific_config_sections_with_dmmap(json_object_get_string(file), json_object_get_string(section_type), json_object_get_string(dmmap_file), &dup_list); - list_for_each_entry(p, &dup_list, list) { + list_for_each_entry(curr_data, &dup_list, list) { char *dm_parent = NULL; - dmuci_get_value_by_section_string(p->config_section, "dm_parent", &dm_parent); + dmuci_get_value_by_section_string(curr_data->config_section, "dm_parent", &dm_parent); if (prev_data && DM_STRLEN(dm_parent)) { - if (strcmp(section_name((struct uci_section *)prev_data), dm_parent) != 0) + if (strcmp(section_name(((struct dm_data *)prev_data)->config_section), dm_parent) != 0) continue; } - inst = handle_instance(dmctx, parent_node, p->dmmap_section, "instance", "alias"); + inst = handle_instance(dmctx, parent_node, curr_data->dmmap_section, "instance", "alias"); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP) + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)curr_data, inst) == DM_STOP) break; } } @@ -468,6 +469,7 @@ static int browse_obj(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, struct json_object *method = NULL; struct json_object *args_obj = NULL; struct json_object *key = NULL; + struct dm_data curr_data = {0}; struct ubus_arg u_args[16] = {0}; char buf_object[256] = {0}; char buf_method[256] = {0}; @@ -501,8 +503,12 @@ static int browse_obj(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, json_object *arr_obj = get_requested_json_obj(res, prev_instance, json_object_get_string(key), arr_name, sizeof(arr_name)); dmjson_foreach_obj_in_array(arr_obj, arrobj, dyn_obj, i, 1, arr_name) { + + curr_data.json_object = dyn_obj; + char *inst = handle_instance_without_section(dmctx, parent_node, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)dyn_obj, inst) == DM_STOP) + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP) break; } } @@ -555,7 +561,7 @@ static int add_obj(char *refparam, struct dmctx *ctx, void *data, char **instanc char *uci_sec_name = json_object_get_string(section_type); - snprintf(sec_name, sizeof(sec_name), "%s%s%s_%s", data ? section_name((struct uci_section *)data) : "", data ? "_" : "", uci_sec_name, *instance); + snprintf(sec_name, sizeof(sec_name), "%s%s%s_%s", data ? section_name(((struct dm_data *)data)->config_section) : "", data ? "_" : "", uci_sec_name, *instance); replace_special_char(sec_name, '_'); @@ -565,7 +571,7 @@ static int add_obj(char *refparam, struct dmctx *ctx, void *data, char **instanc if (dmuci_rename_section_by_section(s, sec_name)) return -1; - if (dmuci_set_value_by_section(s, "dm_parent", section_name((struct uci_section *)data))) + if (dmuci_set_value_by_section(s, "dm_parent", data ? section_name(((struct dm_data *)data)->config_section) : "")) return -1; if (dmuci_add_section_bbfdm(json_object_get_string(dmmap_file), uci_sec_name, &dmmap_s)) @@ -574,7 +580,7 @@ static int add_obj(char *refparam, struct dmctx *ctx, void *data, char **instanc if (dmuci_set_value_by_section(dmmap_s, "section_name", section_name(s))) return -1; - if (dmuci_set_value_by_section(dmmap_s, "dm_parent", section_name((struct uci_section *)data))) + if (dmuci_set_value_by_section(dmmap_s, "dm_parent", data ? section_name(((struct dm_data *)data)->config_section) : "")) return -1; if (dmuci_set_value_by_section(dmmap_s, "instance", *instance)) @@ -632,17 +638,17 @@ static int delete_obj(char *refparam, struct dmctx *ctx, void *data, char *insta char *dm_parent = NULL; dmuci_get_value_by_section_string(s, "dm_parent", &dm_parent); - if (DM_STRLEN(dm_parent) && strcmp(section_name((struct uci_section *)data), dm_parent) == 0) { + if (DM_STRLEN(dm_parent) && strcmp(section_name(((struct dm_data *)data)->config_section), dm_parent) == 0) { if (dmuci_delete_by_section(s, NULL, NULL)) return -1; } } - get_dmmap_section_of_config_section(json_object_get_string(dmmap_file), json_object_get_string(section_type), section_name((struct uci_section *)data), &dmmap_section); + get_dmmap_section_of_config_section(json_object_get_string(dmmap_file), json_object_get_string(section_type), section_name(((struct dm_data *)data)->config_section), &dmmap_section); if (dmuci_delete_by_section(dmmap_section, NULL, NULL)) return -1; - if (dmuci_delete_by_section((struct uci_section *)data, NULL, NULL)) + if (dmuci_delete_by_section(((struct dm_data *)data)->config_section, NULL, NULL)) return -1; break; @@ -726,7 +732,7 @@ static char *uci_get_value(json_object *mapping_obj, int json_version, char *ref dmuci_get_value_by_section_string(s, "dm_parent", &dm_parent); if (data && DM_STRLEN(dm_parent)) { - if (strcmp(section_name((struct uci_section *)data), dm_parent) != 0) + if (strcmp(section_name(((struct dm_data *)data)->config_section), dm_parent) != 0) continue; } @@ -736,9 +742,14 @@ static char *uci_get_value(json_object *mapping_obj, int json_version, char *ref goto end; } + if (opt_temp && strstr(refparam, ".Alias")) { + bbf_get_alias(ctx, ((struct dm_data *)data)->dmmap_section, opt_temp, instance, &value); + goto end; + } + if (data && file && type && opt_temp) { if (strcmp(opt_temp, "@Name") == 0) { - dmuci_get_section_name(section_name((struct uci_section *)data), &value); + dmuci_get_section_name(section_name(((struct dm_data *)data)->config_section), &value); } else { char uci_type[32] = {0}; @@ -747,7 +758,7 @@ static char *uci_get_value(json_object *mapping_obj, int json_version, char *ref if (option) { char *res = NULL; - dmuci_get_value_by_section_string((struct uci_section *)data, opt_temp, &res); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, opt_temp, &res); if (DM_STRLEN(res) == 0) dmuci_get_option_value_string(json_object_get_string(file), uci_type, opt_temp, &res); @@ -758,7 +769,7 @@ static char *uci_get_value(json_object *mapping_obj, int json_version, char *ref } else { struct uci_list *list_val; - dmuci_get_value_by_section_list((struct uci_section *)data, opt_temp, &list_val); + dmuci_get_value_by_section_list(((struct dm_data *)data)->config_section, opt_temp, &list_val); if (list_val == NULL) dmuci_get_option_value_list(json_object_get_string(file), uci_type, opt_temp, &list_val); value = dmuci_list_to_string(list_val, ","); @@ -781,9 +792,6 @@ static char *uci_get_value(json_object *mapping_obj, int json_version, char *ref } } - if (strstr(refparam, "Alias") && value[0] == '\0') - dmasprintf(&value, "cpe-%s", instance); - end: FREE(linker); return value; @@ -842,11 +850,11 @@ static char *ubus_get_value(json_object *mapping_obj, int json_version, char *re char *is_array = strstr(key_buf, ((json_version & JSON_VERSION_1)) ? "[@index]" : "[@i-1]"); if (data && is_array) { char *arguments = ((json_version & JSON_VERSION_1)) ? is_array + sizeof("[@index]") : is_array + sizeof("[@i-1]"); - json_obj = get_requested_json_obj((json_object *)data, instance, arguments, key_name, sizeof(key_name)); - /* If the json object is already extracted from array object then use that object - to extract the value */ - if (!json_obj && data) - json_obj = (json_object*)data; + json_obj = get_requested_json_obj(((struct dm_data *)data)->json_object, instance, arguments, key_name, sizeof(key_name)); + + /* If the json object is already extracted from array object then use that object to extract the value */ + if (!json_obj && data) + json_obj = ((struct dm_data *)data)->json_object; } else { json_obj = get_requested_json_obj(res, instance, key_buf, key_name, sizeof(key_name)); } @@ -879,9 +887,11 @@ static char *uci_v1_get_value(json_object *mapping_obj, char *refparam, struct d if (key) { if (strcmp(json_object_get_string(key), "@Name") == 0) { - dmuci_get_section_name(section_name((struct uci_section *)data), &value); + dmuci_get_section_name(section_name(((struct dm_data *)data)->config_section), &value); + } else if (strstr(refparam, ".Alias")) { + bbf_get_alias(ctx, ((struct dm_data *)data)->dmmap_section, json_object_get_string(key), instance, &value); } else { - dmuci_get_value_by_section_string((struct uci_section *)data, json_object_get_string(key), &value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, json_object_get_string(key), &value); } } @@ -904,7 +914,7 @@ static char *ubus_v1_get_value(json_object *mapping_obj, char *refparam, struct if (key) { char key_name[128] = {32}; - json_object *json_obj = get_requested_json_obj((json_object *)data, instance, json_object_get_string(key), key_name, sizeof(key_name)); + json_object *json_obj = get_requested_json_obj(((struct dm_data *)data)->json_object, instance, json_object_get_string(key), key_name, sizeof(key_name)); value = dmjson_get_value(json_obj, 1, key_name); } @@ -1361,6 +1371,10 @@ static int uci_set_value(json_object *mapping_obj, int json_version, char *refpa opt_temp = json_object_get_string(option_name); } + if (opt_temp && strstr(refparam, ".Alias")) { + return bbf_set_alias(ctx, ((struct dm_data *)data)->dmmap_section, opt_temp, instance, value); + } + if (data && file && type && opt_temp) { char uci_type[32] = {0}; @@ -1376,32 +1390,32 @@ static int uci_set_value(json_object *mapping_obj, int json_version, char *refpa return -1; snprintf(buf, sizeof(buf), "dmmap_%s", json_object_get_string(file)); - get_dmmap_section_of_config_section(buf, json_object_get_string(type), section_name((struct uci_section *)data), &dmmap_section); + get_dmmap_section_of_config_section(buf, json_object_get_string(type), section_name(((struct dm_data *)data)->config_section), &dmmap_section); if (!dmmap_section) return -1; if (dmuci_set_value_by_section(dmmap_section, "section_name", sec_name)) return -1; - if ((res = dmuci_rename_section_by_section((struct uci_section *)data, sec_name))) + if ((res = dmuci_rename_section_by_section(((struct dm_data *)data)->config_section, sec_name))) res = dmuci_rename_section(json_object_get_string(file), uci_type, sec_name); return res; } if (option) { - if ((res = dmuci_set_value_by_section((struct uci_section *)data, opt_temp, value))) + if ((res = dmuci_set_value_by_section(((struct dm_data *)data)->config_section, opt_temp, value))) res = dmuci_set_value(json_object_get_string(file), uci_type, opt_temp, value); } else { if (value != NULL) { - if (dmuci_delete_by_section((struct uci_section *)data, opt_temp, NULL)) + if (dmuci_delete_by_section(((struct dm_data *)data)->config_section, opt_temp, NULL)) dmuci_delete(json_object_get_string(file), uci_type, opt_temp, NULL); char *p = strtok(value, ","); while (p) { strip_lead_trail_whitespace(p); - if ((res = dmuci_add_list_value_by_section((struct uci_section *)data, opt_temp, p))) + if ((res = dmuci_add_list_value_by_section(((struct dm_data *)data)->config_section, opt_temp, p))) res = dmuci_add_list_value(json_object_get_string(file), uci_type, opt_temp, p); if (res) @@ -1482,8 +1496,11 @@ static int uci_v1_set_value(json_object *mapping_obj, int json_version, char *re if (data == NULL || key == NULL || data_s == NULL || strcmp(json_object_get_string(data_s), "@Parent") != 0) return -1; - return dmuci_set_value_by_section((struct uci_section *)data, json_object_get_string(key), value); - + if (strstr(refparam, ".Alias")) { + return bbf_set_alias(ctx, ((struct dm_data *)data)->dmmap_section, json_object_get_string(key), instance, value); + } else { + return dmuci_set_value_by_section(((struct dm_data *)data)->config_section, json_object_get_string(key), value); + } } static int set_value_from_mapping(json_object *param_obj, int json_version, char *refparam, struct dmctx *ctx, void *data, char *instance, char *value) @@ -1876,7 +1893,7 @@ void parse_obj(char *object, json_object *jobj, DMOBJ *pobj, int index, int json } if (strcmp(key, "mapping") == 0 && - ((json_object_get_type(json_obj) == json_type_object && json_version == JSON_VERSION_0) || + ((json_object_get_type(json_obj) == json_type_object && (json_version & JSON_VERSION_0)) || (json_object_get_type(json_obj) == json_type_array && (json_version & JSON_VERSION_1)))) { parse_mapping_obj(full_obj, json_obj, (const char **)keys_p, json_version, list); } @@ -1966,6 +1983,10 @@ int load_json_plugins(DMOBJ *entryobj, const char *plugin_path) continue; } + if (json_plugin_version & JSON_VERSION_0) { + BBF_WARNING("Currently, JSON plugin only supports version 2, So please upgrade (%s) to version 2", plugin_path); + } + replace_str(key, "{BBF_VENDOR_PREFIX}", BBF_VENDOR_PREFIX, obj_path, sizeof(obj_path)); if (strlen(obj_path) == 0) { BBF_DEBUG("ERROR: Can't get the node object"); diff --git a/libbbfdm/dmtree/tr181/bridging.c b/libbbfdm/dmtree/tr181/bridging.c index ad0fd0d1..a70c8dbd 100644 --- a/libbbfdm/dmtree/tr181/bridging.c +++ b/libbbfdm/dmtree/tr181/bridging.c @@ -1066,16 +1066,16 @@ static void Update_BridgeVLANPort_VLAN_Layer(char *path, struct uci_section *bri static int browseBridgingBridgeInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { struct bridge_args curr_bridging_args = {0}; - struct dmmap_dup *p = NULL; + struct dm_data *curr_data = NULL; char *inst = NULL; LIST_HEAD(dup_list); synchronize_bridge_config_sections_with_dmmap_bridge_eq("network", "device", "dmmap_bridge", "type", "bridge", &dup_list); - list_for_each_entry(p, &dup_list, list) { + list_for_each_entry(curr_data, &dup_list, list) { - inst = handle_instance(dmctx, parent_node, p->dmmap_section, "bridge_instance", "bridge_alias"); + inst = handle_instance(dmctx, parent_node, curr_data->dmmap_section, "bridge_instance", "bridge_alias"); - init_bridging_args(&curr_bridging_args, p->config_section ? p->config_section : p->dmmap_section, p->dmmap_section, inst); + init_bridging_args(&curr_bridging_args, curr_data->config_section ? curr_data->config_section : curr_data->dmmap_section, curr_data->dmmap_section, inst); if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_bridging_args, inst) == DM_STOP) break; diff --git a/libbbfdm/dmtree/tr181/deviceinfo.c b/libbbfdm/dmtree/tr181/deviceinfo.c index 51776c63..1c663d4f 100644 --- a/libbbfdm/dmtree/tr181/deviceinfo.c +++ b/libbbfdm/dmtree/tr181/deviceinfo.c @@ -828,16 +828,16 @@ static int browseVcfInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_da static int browseVlfInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - struct dmmap_dup *p = NULL; - char *inst = NULL; + struct dm_data *curr_data = NULL; LIST_HEAD(dup_list); + char *inst = NULL; synchronize_specific_config_sections_with_dmmap("system", "system", "dmmap", &dup_list); - list_for_each_entry(p, &dup_list, list) { + list_for_each_entry(curr_data, &dup_list, list) { - inst = handle_instance(dmctx, parent_node, p->dmmap_section, "vlf_instance", "vlf_alias"); + inst = handle_instance(dmctx, parent_node, curr_data->dmmap_section, "vlf_instance", "vlf_alias"); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP) + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)curr_data, inst) == DM_STOP) break; } free_dmmap_config_dup_list(&dup_list); @@ -1247,25 +1247,25 @@ static int set_vcf_alias(char *refparam, struct dmctx *ctx, void *data, char *in static int get_vlf_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - return bbf_get_alias(ctx, ((struct dmmap_dup *)data)->dmmap_section, "vlf_alias", instance, value); + return bbf_get_alias(ctx, ((struct dm_data *)data)->dmmap_section, "vlf_alias", instance, value); } static int set_vlf_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) { - return bbf_set_alias(ctx, ((struct dmmap_dup *)data)->dmmap_section, "vlf_alias", instance, value); + return bbf_set_alias(ctx, ((struct dm_data *)data)->dmmap_section, "vlf_alias", instance, value); } static int get_vlf_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "log_file", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "log_file", value); return 0; } -static int get_vlf_max_size (char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +static int get_vlf_max_size(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { int size = 0; - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "log_size", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "log_size", value); // Value defined in system is in KiB in datamodel this is in bytes, convert the value in bytes size = (*value && **value) ? DM_STRTOL(*value) * 1000 : 0; @@ -1612,7 +1612,7 @@ static int operate_DeviceInfoVendorLogFile_Upload(char *refparam, struct dmctx * if (url[0] == '\0') return USP_FAULT_INVALID_ARGUMENT; - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "log_file", &vlf_file_path); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "log_file", &vlf_file_path); if (DM_STRLEN(vlf_file_path) == 0) { vlf_file_path = DEF_VENDOR_LOG_FILE; diff --git a/libbbfdm/dmtree/tr181/firewall.c b/libbbfdm/dmtree/tr181/firewall.c index ef85cefd..0e352ae4 100644 --- a/libbbfdm/dmtree/tr181/firewall.c +++ b/libbbfdm/dmtree/tr181/firewall.c @@ -205,8 +205,8 @@ static int delService(char *refparam, struct dmctx *ctx, void *data, char *insta switch (del_action) { case DEL_INST: - dmuci_delete_by_section(((struct dmmap_dup *)data)->config_section, NULL, NULL); - dmuci_delete_by_section(((struct dmmap_dup *)data)->dmmap_section, NULL, NULL); + dmuci_delete_by_section(((struct dm_data *)data)->config_section, NULL, NULL); + dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL); break; case DEL_ALL: uci_foreach_sections_safe("firewall", "service", stmp, s) { @@ -377,16 +377,16 @@ static int browseRuleInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_d /*#Device.Firewall.DMZ.{i}.!UCI:firewall/dmz/dmmap_dmz*/ static int browseFirewallDMZInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - struct dmmap_dup *p = NULL; - char *inst = NULL; + struct dm_data *curr_data = NULL; LIST_HEAD(dup_list); + char *inst = NULL; synchronize_specific_config_sections_with_dmmap("firewall", "dmz", "dmmap_dmz", &dup_list); - list_for_each_entry(p, &dup_list, list) { + list_for_each_entry(curr_data, &dup_list, list) { - inst = handle_instance(dmctx, parent_node, p->dmmap_section, "dmz_instance", "dmz_alias"); + inst = handle_instance(dmctx, parent_node, curr_data->dmmap_section, "dmz_instance", "dmz_alias"); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP) + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)curr_data, inst) == DM_STOP) break; } free_dmmap_config_dup_list(&dup_list); @@ -395,15 +395,15 @@ static int browseFirewallDMZInst(struct dmctx *dmctx, DMNODE *parent_node, void static int browseServiceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - char *inst = NULL; - struct dmmap_dup *p = NULL; + struct dm_data *curr_data = NULL; LIST_HEAD(dup_list); + char *inst = NULL; synchronize_specific_config_sections_with_dmmap("firewall", "service", "dmmap_firewall", &dup_list); - list_for_each_entry(p, &dup_list, list) { - inst = handle_instance(dmctx, parent_node, p->dmmap_section, "service_instance", "service_alias"); + list_for_each_entry(curr_data, &dup_list, list) { + inst = handle_instance(dmctx, parent_node, curr_data->dmmap_section, "service_instance", "service_alias"); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP) + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)curr_data, inst) == DM_STOP) break; } free_dmmap_config_dup_list(&dup_list); @@ -513,8 +513,8 @@ static int delObjFirewallDMZ(char *refparam, struct dmctx *ctx, void *data, char switch (del_action) { case DEL_INST: - dmuci_delete_by_section(((struct dmmap_dup *)data)->config_section, NULL, NULL); - dmuci_delete_by_section(((struct dmmap_dup *)data)->dmmap_section, NULL, NULL); + dmuci_delete_by_section(((struct dm_data *)data)->config_section, NULL, NULL); + dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL); break; case DEL_ALL: uci_foreach_sections_safe("firewall", "dmz", stmp, s) { @@ -1981,18 +1981,18 @@ static int get_firewall_dmz_number_of_entries(char *refparam, struct dmctx *ctx, /*#Device.Firewall.DMZ.{i}.Alias!UCI:dmmap_dmz/DMZ,@i-1/alias*/ static int get_FirewallDMZ_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - return bbf_get_alias(ctx, ((struct dmmap_dup *)data)->dmmap_section, "dmz_alias", instance, value); + return bbf_get_alias(ctx, ((struct dm_data *)data)->dmmap_section, "dmz_alias", instance, value); } static int set_FirewallDMZ_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) { - return bbf_set_alias(ctx, ((struct dmmap_dup *)data)->dmmap_section, "dmz_alias", instance, value); + return bbf_set_alias(ctx, ((struct dm_data *)data)->dmmap_section, "dmz_alias", instance, value); } /*#Device.Firewall.DMZ.{i}.Enable!UCI:firewall/dmz,@i-1/enabled*/ static int get_FirewallDMZ_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "enabled", "0"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "enabled", "0"); return 0; } @@ -2007,7 +2007,7 @@ static int set_FirewallDMZ_Enable(char *refparam, struct dmctx *ctx, void *data, break; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "enabled", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "enabled", b ? "1" : "0"); break; } return 0; @@ -2016,7 +2016,7 @@ static int set_FirewallDMZ_Enable(char *refparam, struct dmctx *ctx, void *data, /*#Device.Firewall.DMZ.{i}.Status!UCI:firewall/dmz,@i-1/status*/ static int get_FirewallDMZ_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - struct dmmap_dup *dmz_args = (struct dmmap_dup *)data; + struct dm_data *dmz_args = (struct dm_data *)data; char *v, *destip, *interface; dmuci_get_value_by_section_string(dmz_args->config_section, "interface", &interface); @@ -2034,7 +2034,7 @@ static int get_FirewallDMZ_Status(char *refparam, struct dmctx *ctx, void *data, /*#Device.Firewall.DMZ.{i}.Origin!UCI:firewall/dmz,@i-1/origin*/ static int get_FirewallDMZ_Origin(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "origin", "Controller"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "origin", "Controller"); return 0; } @@ -2048,7 +2048,7 @@ static int set_FirewallDMZ_Origin(char *refparam, struct dmctx *ctx, void *data, return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "origin", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "origin", value); break; } return 0; @@ -2057,7 +2057,7 @@ static int set_FirewallDMZ_Origin(char *refparam, struct dmctx *ctx, void *data, /*#Device.Firewall.DMZ.{i}.Description!UCI:firewall/dmz,@i-1/description*/ static int get_FirewallDMZ_Description(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "description", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "description", value); return 0; } @@ -2069,7 +2069,7 @@ static int set_FirewallDMZ_Description(char *refparam, struct dmctx *ctx, void * return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "description", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "description", value); break; } return 0; @@ -2080,7 +2080,7 @@ static int get_FirewallDMZ_Interface(char *refparam, struct dmctx *ctx, void *da { char *interf = NULL; - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "interface", &interf); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "interface", &interf); adm_entry_get_reference_param(ctx, "Device.IP.Interface.*.Name", interf, value); return 0; @@ -2103,7 +2103,7 @@ static int set_FirewallDMZ_Interface(char *refparam, struct dmctx *ctx, void *da break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "interface", reference.value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "interface", reference.value); break; } return 0; @@ -2112,7 +2112,7 @@ static int set_FirewallDMZ_Interface(char *refparam, struct dmctx *ctx, void *da /*#Device.Firewall.DMZ.{i}.DestIP!UCI:firewall/dmz,@i-1/dest_ip*/ static int get_FirewallDMZ_DestIP(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "dest_ip", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "dest_ip", value); return 0; } @@ -2124,7 +2124,7 @@ static int set_FirewallDMZ_DestIP(char *refparam, struct dmctx *ctx, void *data, return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "dest_ip", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "dest_ip", value); break; } return 0; @@ -2133,7 +2133,7 @@ static int set_FirewallDMZ_DestIP(char *refparam, struct dmctx *ctx, void *data, /*#Device.Firewall.DMZ.{i}.SourcePrefix!UCI:firewall/dmz,@i-1/source_prefix*/ static int get_FirewallDMZ_SourcePrefix(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "source_prefix", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "source_prefix", value); return 0; } @@ -2145,7 +2145,7 @@ static int set_FirewallDMZ_SourcePrefix(char *refparam, struct dmctx *ctx, void return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "source_prefix", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "source_prefix", value); break; } return 0; @@ -2153,17 +2153,17 @@ static int set_FirewallDMZ_SourcePrefix(char *refparam, struct dmctx *ctx, void static int get_service_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - return bbf_get_alias(ctx, ((struct dmmap_dup *)data)->dmmap_section, "service_alias", instance, value); + return bbf_get_alias(ctx, ((struct dm_data *)data)->dmmap_section, "service_alias", instance, value); } static int set_service_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) { - return bbf_set_alias(ctx, ((struct dmmap_dup *)data)->dmmap_section, "service_alias", instance, value); + return bbf_set_alias(ctx, ((struct dm_data *)data)->dmmap_section, "service_alias", instance, value); } static int get_service_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "enable", "0"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "enable", "0"); return 0; } @@ -2178,7 +2178,7 @@ static int set_service_enable(char *refparam, struct dmctx *ctx, void *data, cha break; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "enable", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "enable", b ? "1" : "0"); break; } @@ -2189,7 +2189,7 @@ static int get_service_intf(char *refparam, struct dmctx *ctx, void *data, char { char *intf = NULL; - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "interface", &intf); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "interface", &intf); if (intf == NULL || *intf == '\0') return 0; @@ -2221,7 +2221,7 @@ static int set_service_intf(char *refparam, struct dmctx *ctx, void *data, char if (!firewall_zone_exists(reference.value)) firewall__create_zone_section(reference.value); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "interface", reference.value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "interface", reference.value); } break; } @@ -2232,7 +2232,7 @@ static int set_service_intf(char *refparam, struct dmctx *ctx, void *data, char static int get_service_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { struct uci_list *val = NULL; - dmuci_get_value_by_section_list(((struct dmmap_dup *)data)->config_section, "dest_port", &val); + dmuci_get_value_by_section_list(((struct dm_data *)data)->config_section, "dest_port", &val); *value = dmuci_list_to_string(val, ","); return 0; } @@ -2250,9 +2250,9 @@ static int set_service_port(char *refparam, struct dmctx *ctx, void *data, char break; case VALUESET: arr = strsplit(value, ",", &length); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "dest_port", ""); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "dest_port", ""); for (i = 0; i < length; i++) - dmuci_add_list_value_by_section(((struct dmmap_dup *)data)->config_section, "dest_port", arr[i]); + dmuci_add_list_value_by_section(((struct dm_data *)data)->config_section, "dest_port", arr[i]); break; } @@ -2263,7 +2263,7 @@ static int get_service_ipver(char *refparam, struct dmctx *ctx, void *data, char { char *ipversion; - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "family", &ipversion); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "family", &ipversion); if (strcasecmp(ipversion, "ipv4") == 0) { *value = "4"; } else if (strcasecmp(ipversion, "ipv6") == 0) { @@ -2284,11 +2284,11 @@ static int set_service_ipver(char *refparam, struct dmctx *ctx, void *data, char break; case VALUESET: if (DM_LSTRCMP(value, "4") == 0) - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "family", "ipv4"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "family", "ipv4"); else if (DM_LSTRCMP(value, "6") == 0) - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "family", "ipv6"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "family", "ipv6"); else if (DM_LSTRCMP(value, "-1") == 0) - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "family", ""); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "family", ""); break; } return 0; @@ -2297,7 +2297,7 @@ static int set_service_ipver(char *refparam, struct dmctx *ctx, void *data, char static int get_service_protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { struct uci_list *val = NULL; - dmuci_get_value_by_section_list(((struct dmmap_dup *)data)->config_section, "proto", &val); + dmuci_get_value_by_section_list(((struct dm_data *)data)->config_section, "proto", &val); *value = dmuci_list_to_string(val, ","); return 0; } @@ -2315,9 +2315,9 @@ static int set_service_protocol(char *refparam, struct dmctx *ctx, void *data, c break; case VALUESET: arr = strsplit(value, ",", &length); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "proto", ""); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "proto", ""); for (i = 0; i < length; i++) - dmuci_add_list_value_by_section(((struct dmmap_dup *)data)->config_section, "proto", arr[i]); + dmuci_add_list_value_by_section(((struct dm_data *)data)->config_section, "proto", arr[i]); break; } @@ -2326,7 +2326,7 @@ static int set_service_protocol(char *refparam, struct dmctx *ctx, void *data, c static int get_service_icmp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "icmp_type", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "icmp_type", value); return 0; } @@ -2338,7 +2338,7 @@ static int set_service_icmp(char *refparam, struct dmctx *ctx, void *data, char return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "icmp_type", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "icmp_type", value); break; } return 0; @@ -2347,7 +2347,7 @@ static int set_service_icmp(char *refparam, struct dmctx *ctx, void *data, char static int get_service_src_prefix(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { struct uci_list *val = NULL; - dmuci_get_value_by_section_list(((struct dmmap_dup *)data)->config_section, "src_prefix", &val); + dmuci_get_value_by_section_list(((struct dm_data *)data)->config_section, "src_prefix", &val); *value = dmuci_list_to_string(val, ","); return 0; } @@ -2364,9 +2364,9 @@ static int set_service_src_prefix(char *refparam, struct dmctx *ctx, void *data, break; case VALUESET: arr = strsplit(value, ",", &length); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "src_prefix", ""); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "src_prefix", ""); for (i = 0; i < length; i++) - dmuci_add_list_value_by_section(((struct dmmap_dup *)data)->config_section, "src_prefix", arr[i]); + dmuci_add_list_value_by_section(((struct dm_data *)data)->config_section, "src_prefix", arr[i]); break; } return 0; @@ -2374,7 +2374,7 @@ static int set_service_src_prefix(char *refparam, struct dmctx *ctx, void *data, static int get_service_action(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "target", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "target", value); return 0; } @@ -2388,7 +2388,7 @@ static int set_service_action(char *refparam, struct dmctx *ctx, void *data, cha return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "target", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "target", value); break; } return 0; @@ -2412,7 +2412,7 @@ static int get_service_status(char *refparam, struct dmctx *ctx, void *data, cha return 0; } - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "status", "Enabled"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "status", "Enabled"); return 0; } diff --git a/libbbfdm/dmtree/tr181/gre.c b/libbbfdm/dmtree/tr181/gre.c index 3309d9ca..daa919bd 100644 --- a/libbbfdm/dmtree/tr181/gre.c +++ b/libbbfdm/dmtree/tr181/gre.c @@ -15,16 +15,16 @@ *************************************************************/ static int browseGRETunnelInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - char *inst = NULL; - struct dmmap_dup *p = NULL; + struct dm_data *curr_data = NULL; LIST_HEAD(dup_list); + char *inst = NULL; synchronize_specific_config_sections_with_dmmap_eq("network", "interface", "dmmap_network", "proto", "gre", &dup_list); - list_for_each_entry(p, &dup_list, list) { + list_for_each_entry(curr_data, &dup_list, list) { - inst = handle_instance(dmctx, parent_node, p->dmmap_section, "gretunnel_instance", "gretunnel_alias"); + inst = handle_instance(dmctx, parent_node, curr_data->dmmap_section, "gretunnel_instance", "gretunnel_alias"); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP) + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)curr_data, inst) == DM_STOP) break; } free_dmmap_config_dup_list(&dup_list); @@ -44,20 +44,21 @@ static struct uci_section *has_tunnel_interface_route(char *interface) static int browseGRETunnelInterfaceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { char *inst = NULL, device[128] = {0}; - struct dmmap_dup *p = NULL, *dm = (struct dmmap_dup *)prev_data; - struct uci_section *s = NULL; + struct dm_data *curr_data = NULL; LIST_HEAD(dup_list); - snprintf(device, sizeof(device), "@%s", section_name(dm->config_section)); - synchronize_specific_config_sections_with_dmmap_eq("network", "interface", "dmmap_network", "device", device, &dup_list); - list_for_each_entry(p, &dup_list, list) { + snprintf(device, sizeof(device), "@%s", section_name(((struct dm_data *)prev_data)->config_section)); - if ((s = has_tunnel_interface_route(section_name(p->config_section))) == NULL) + synchronize_specific_config_sections_with_dmmap_eq("network", "interface", "dmmap_network", "device", device, &dup_list); + list_for_each_entry(curr_data, &dup_list, list) { + struct uci_section *s = NULL; + + if ((s = has_tunnel_interface_route(section_name(curr_data->config_section))) == NULL) continue; - inst = handle_instance(dmctx, parent_node, p->dmmap_section, "greiface_instance", "greiface_alias"); + inst = handle_instance(dmctx, parent_node, curr_data->dmmap_section, "greiface_instance", "greiface_alias"); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP) + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)curr_data, inst) == DM_STOP) break; } free_dmmap_config_dup_list(&dup_list); @@ -86,9 +87,9 @@ static int delObjGRETunnel(char *refparam, struct dmctx *ctx, void *data, char * switch (del_action) { case DEL_INST: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->dmmap_section, "gretunnel_instance", ""); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->dmmap_section, "gretunnel_alias", ""); - dmuci_delete_by_section(((struct dmmap_dup *)data)->config_section, NULL, NULL); + dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "gretunnel_instance", ""); + dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "gretunnel_alias", ""); + dmuci_delete_by_section(((struct dm_data *)data)->config_section, NULL, NULL); break; case DEL_ALL: uci_foreach_option_eq_safe("network", "interface", "proto", "gre", stmp, s) { @@ -111,7 +112,7 @@ static int addObjGRETunnelInterface(char *refparam, struct dmctx *ctx, void *dat char device_buf[32]; dmuci_add_section("network", "interface", &greiface_sec); - snprintf(device_buf, sizeof(device_buf), "@%s", section_name(((struct dmmap_dup *)data)->config_section)); + snprintf(device_buf, sizeof(device_buf), "@%s", section_name(((struct dm_data *)data)->config_section)); dmuci_set_value_by_section(greiface_sec, "device", device_buf); dmuci_add_section("network", "route", &route_sec); @@ -119,7 +120,7 @@ static int addObjGRETunnelInterface(char *refparam, struct dmctx *ctx, void *dat dmuci_add_section_bbfdm("dmmap_network", "interface", &dmmap_sec); dmuci_set_value_by_section(dmmap_sec, "section_name", section_name(greiface_sec)); - dmuci_set_value_by_section(dmmap_sec, "gre_tunnel_sect", section_name(((struct dmmap_dup *)data)->config_section)); + dmuci_set_value_by_section(dmmap_sec, "gre_tunnel_sect", section_name(((struct dm_data *)data)->config_section)); dmuci_set_value_by_section(dmmap_sec, "greiface_instance", *instance); return 0; } @@ -130,13 +131,13 @@ static int delObjGRETunnelInterface(char *refparam, struct dmctx *ctx, void *dat switch (del_action) { case DEL_INST: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->dmmap_section, "greiface_instance", ""); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->dmmap_section, "greiface_alias", ""); + dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "greiface_instance", ""); + dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "greiface_alias", ""); - if ((s = has_tunnel_interface_route(section_name(((struct dmmap_dup *)data)->config_section))) != NULL) + if ((s = has_tunnel_interface_route(section_name(((struct dm_data *)data)->config_section))) != NULL) dmuci_delete_by_section(s, NULL, NULL); - dmuci_delete_by_section(((struct dmmap_dup *)data)->config_section, NULL, NULL); + dmuci_delete_by_section(((struct dm_data *)data)->config_section, NULL, NULL); break; case DEL_ALL: uci_foreach_sections_safe("network", "interface", stmp, s) { @@ -145,7 +146,7 @@ static int delObjGRETunnelInterface(char *refparam, struct dmctx *ctx, void *dat char *device = NULL; dmuci_get_value_by_section_string(s, "device", &device); - snprintf(device_buf, sizeof(device_buf), "@%s", section_name(((struct dmmap_dup *)data)->config_section)); + snprintf(device_buf, sizeof(device_buf), "@%s", section_name(((struct dm_data *)data)->config_section)); if (!device || DM_STRCMP(device, device_buf) != 0) continue; @@ -193,17 +194,17 @@ static int get_GRE_TunnelNumberOfEntries(char *refparam, struct dmctx *ctx, void /*#Device.GRE.Tunnel.{i}.Alias!UCI:dmmap_network/interface,@i-1/gretunnel_alias*/ static int get_GRETunnel_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - return bbf_get_alias(ctx, ((struct dmmap_dup *)data)->dmmap_section, "gretunnel_alias", instance, value); + return bbf_get_alias(ctx, ((struct dm_data *)data)->dmmap_section, "gretunnel_alias", instance, value); } static int set_GRETunnel_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) { - return bbf_set_alias(ctx, ((struct dmmap_dup *)data)->dmmap_section, "gretunnel_alias", instance, value); + return bbf_set_alias(ctx, ((struct dm_data *)data)->dmmap_section, "gretunnel_alias", instance, value); } static int get_GRETunnel_KeepAliveThreshold(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "keepalive", "3"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "keepalive", "3"); return 0; } @@ -215,7 +216,7 @@ static int set_GRETunnel_KeepAliveThreshold(char *refparam, struct dmctx *ctx, v return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "keepalive", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "keepalive", value); break; } return 0; @@ -223,7 +224,7 @@ static int set_GRETunnel_KeepAliveThreshold(char *refparam, struct dmctx *ctx, v static int get_GRETunnel_ConnectedRemoteEndpoint(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "peeraddr", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "peeraddr", value); return 0; } @@ -236,90 +237,90 @@ static int get_GRETunnel_InterfaceNumberOfEntries(char *refparam, struct dmctx * static int get_GRETunnelStats_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value= get_gre_tunnel_interface_statistics(section_name(((struct dmmap_dup *)data)->config_section), "tx_bytes"); + *value= get_gre_tunnel_interface_statistics(section_name(((struct dm_data *)data)->config_section), "tx_bytes"); return 0; } static int get_GRETunnelStats_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value= get_gre_tunnel_interface_statistics(section_name(((struct dmmap_dup *)data)->config_section), "rx_bytes"); + *value= get_gre_tunnel_interface_statistics(section_name(((struct dm_data *)data)->config_section), "rx_bytes"); return 0; } static int get_GRETunnelStats_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value= get_gre_tunnel_interface_statistics(section_name(((struct dmmap_dup *)data)->config_section), "tx_packets"); + *value= get_gre_tunnel_interface_statistics(section_name(((struct dm_data *)data)->config_section), "tx_packets"); return 0; } static int get_GRETunnelStats_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value= get_gre_tunnel_interface_statistics(section_name(((struct dmmap_dup *)data)->config_section), "rx_packets"); + *value= get_gre_tunnel_interface_statistics(section_name(((struct dm_data *)data)->config_section), "rx_packets"); return 0; } static int get_GRETunnelStats_ErrorsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value= get_gre_tunnel_interface_statistics(section_name(((struct dmmap_dup *)data)->config_section), "tx_errors"); + *value= get_gre_tunnel_interface_statistics(section_name(((struct dm_data *)data)->config_section), "tx_errors"); return 0; } static int get_GRETunnelStats_ErrorsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value= get_gre_tunnel_interface_statistics(section_name(((struct dmmap_dup *)data)->config_section), "rx_errors"); + *value= get_gre_tunnel_interface_statistics(section_name(((struct dm_data *)data)->config_section), "rx_errors"); return 0; } /*#Device.GRE.Tunnel.{i}.Interface.{i}.Alias!UCI:dmmap_network/interface,@i-1/greiface_alias*/ static int get_GRETunnelInterface_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - return bbf_get_alias(ctx, ((struct dmmap_dup *)data)->dmmap_section, "greiface_alias", instance, value); + return bbf_get_alias(ctx, ((struct dm_data *)data)->dmmap_section, "greiface_alias", instance, value); } static int set_GRETunnelInterface_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) { - return bbf_set_alias(ctx, ((struct dmmap_dup *)data)->dmmap_section, "greiface_alias", instance, value); + return bbf_set_alias(ctx, ((struct dm_data *)data)->dmmap_section, "greiface_alias", instance, value); } static int get_GRETunnelInterface_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmstrdup(section_name(((struct dmmap_dup *)data)->config_section)); + *value = dmstrdup(section_name(((struct dm_data *)data)->config_section)); return 0; } static int get_GRETunnelInterfaceStats_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = get_gre_tunnel_interface_statistics(section_name(((struct dmmap_dup *)data)->config_section), "tx_bytes"); + *value = get_gre_tunnel_interface_statistics(section_name(((struct dm_data *)data)->config_section), "tx_bytes"); return 0; } static int get_GRETunnelInterfaceStats_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = get_gre_tunnel_interface_statistics(section_name(((struct dmmap_dup *)data)->config_section), "rx_bytes"); + *value = get_gre_tunnel_interface_statistics(section_name(((struct dm_data *)data)->config_section), "rx_bytes"); return 0; } static int get_GRETunnelInterfaceStats_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = get_gre_tunnel_interface_statistics(section_name(((struct dmmap_dup *)data)->config_section), "tx_packets"); + *value = get_gre_tunnel_interface_statistics(section_name(((struct dm_data *)data)->config_section), "tx_packets"); return 0; } static int get_GRETunnelInterfaceStats_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = get_gre_tunnel_interface_statistics(section_name(((struct dmmap_dup *)data)->config_section), "rx_packets"); + *value = get_gre_tunnel_interface_statistics(section_name(((struct dm_data *)data)->config_section), "rx_packets"); return 0; } static int get_GRETunnelInterfaceStats_ErrorsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = get_gre_tunnel_interface_statistics(section_name(((struct dmmap_dup *)data)->config_section), "tx_errors"); + *value = get_gre_tunnel_interface_statistics(section_name(((struct dm_data *)data)->config_section), "tx_errors"); return 0; } static int get_GRETunnelInterfaceStats_ErrorsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = get_gre_tunnel_interface_statistics(section_name(((struct dmmap_dup *)data)->config_section), "rx_errors"); + *value = get_gre_tunnel_interface_statistics(section_name(((struct dm_data *)data)->config_section), "rx_errors"); return 0; } diff --git a/libbbfdm/dmtree/tr181/ieee1905.c b/libbbfdm/dmtree/tr181/ieee1905.c index da98b6e1..fe302485 100644 --- a/libbbfdm/dmtree/tr181/ieee1905.c +++ b/libbbfdm/dmtree/tr181/ieee1905.c @@ -84,16 +84,16 @@ static int browseIEEE1905ALInterfaceLinkInst(struct dmctx *dmctx, DMNODE *parent /*#Device.IEEE1905.AL.ForwardingTable.ForwardingRule.{i}.!UCI:ieee1905/forwarding_rule/dmmap_forwarding_rule*/ static int browseIEEE1905ALForwardingTableForwardingRuleInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - char *inst = NULL; - struct dmmap_dup *p = NULL; + struct dm_data *curr_data = NULL; LIST_HEAD(dup_list); + char *inst = NULL; synchronize_specific_config_sections_with_dmmap("ieee1905", "forwarding_rule", "dmmap_forwarding_rule", &dup_list); - list_for_each_entry(p, &dup_list, list) { + list_for_each_entry(curr_data, &dup_list, list) { - inst = handle_instance(dmctx, parent_node, p->dmmap_section, "forwardingruleinstance", "forwardingrulealias"); + inst = handle_instance(dmctx, parent_node, curr_data->dmmap_section, "forwardingruleinstance", "forwardingrulealias"); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP) + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)curr_data, inst) == DM_STOP) break; } free_dmmap_config_dup_list(&dup_list); @@ -386,8 +386,8 @@ static int delObjIEEE1905ALForwardingTableForwardingRule(char *refparam, struct switch (del_action) { case DEL_INST: - dmuci_delete_by_section(((struct dmmap_dup *)data)->config_section, NULL, NULL); - dmuci_delete_by_section(((struct dmmap_dup *)data)->dmmap_section, NULL, NULL); + dmuci_delete_by_section(((struct dm_data *)data)->config_section, NULL, NULL); + dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL); break; case DEL_ALL: uci_foreach_sections_safe("ieee1905", "forwarding_rule", stmp, s) { @@ -828,7 +828,7 @@ static int get_IEEE1905ALForwardingTable_ForwardingRuleNumberOfEntries(char *ref /*#Device.IEEE1905.AL.ForwardingTable.ForwardingRule.{i}.InterfaceList!UCI:dmmap_forwarding_rule/forwarding_rule,@i-1/interface_list*/ static int get_IEEE1905ALForwardingTableForwardingRule_InterfaceList(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "interface_list", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "interface_list", value); return 0; } @@ -840,7 +840,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_InterfaceList(char *refpa return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "interface_list", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "interface_list", value); break; } return 0; @@ -849,7 +849,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_InterfaceList(char *refpa /*#Device.IEEE1905.AL.ForwardingTable.ForwardingRule.{i}.MACDestinationAddress!UCI:dmmap_forwarding_rule/forwarding_rule,@i-1/mac_destination_addr*/ static int get_IEEE1905ALForwardingTableForwardingRule_MACDestinationAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "mac_destination_addr", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "mac_destination_addr", value); return 0; } @@ -861,7 +861,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_MACDestinationAddress(cha return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "mac_destination_addr", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "mac_destination_addr", value); break; } return 0; @@ -870,7 +870,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_MACDestinationAddress(cha /*#Device.IEEE1905.AL.ForwardingTable.ForwardingRule.{i}.MACDestinationAddressFlag!UCI:dmmap_forwarding_rule/forwarding_rule,@i-1/mac_destination_addr_flag*/ static int get_IEEE1905ALForwardingTableForwardingRule_MACDestinationAddressFlag(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "mac_destination_addr_flag", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "mac_destination_addr_flag", value); return 0; } @@ -885,7 +885,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_MACDestinationAddressFlag break; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "mac_destination_addr_flag", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "mac_destination_addr_flag", b ? "1" : "0"); break; } return 0; @@ -894,7 +894,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_MACDestinationAddressFlag /*#Device.IEEE1905.AL.ForwardingTable.ForwardingRule.{i}.MACSourceAddress!UCI:dmmap_forwarding_rule/forwarding_rule,@i-1/mac_source_addr*/ static int get_IEEE1905ALForwardingTableForwardingRule_MACSourceAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "mac_source_addr", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "mac_source_addr", value); return 0; } @@ -906,7 +906,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_MACSourceAddress(char *re return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "mac_source_addr", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "mac_source_addr", value); break; } return 0; @@ -915,7 +915,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_MACSourceAddress(char *re /*#Device.IEEE1905.AL.ForwardingTable.ForwardingRule.{i}.MACSourceAddressFlag!UCI:dmmap_forwarding_rule/forwarding_rule,@i-1/mac_source_addr_flag*/ static int get_IEEE1905ALForwardingTableForwardingRule_MACSourceAddressFlag(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "mac_source_addr_flag", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "mac_source_addr_flag", value); return 0; } @@ -930,7 +930,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_MACSourceAddressFlag(char break; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "mac_source_addr_flag", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "mac_source_addr_flag", b ? "1" : "0"); break; } return 0; @@ -939,7 +939,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_MACSourceAddressFlag(char /*#Device.IEEE1905.AL.ForwardingTable.ForwardingRule.{i}.EtherType!UCI:dmmap_forwarding_rule/forwarding_rule,@i-1/ether_type*/ static int get_IEEE1905ALForwardingTableForwardingRule_EtherType(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "ether_type", "0"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "ether_type", "0"); return 0; } @@ -951,7 +951,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_EtherType(char *refparam, return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "ether_type", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "ether_type", value); break; } return 0; @@ -960,7 +960,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_EtherType(char *refparam, /*#Device.IEEE1905.AL.ForwardingTable.ForwardingRule.{i}.EtherTypeFlag!UCI:dmmap_forwarding_rule/forwarding_rule,@i-1/ether_type_flag*/ static int get_IEEE1905ALForwardingTableForwardingRule_EtherTypeFlag(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "ether_type_flag", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "ether_type_flag", value); return 0; } @@ -975,7 +975,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_EtherTypeFlag(char *refpa break; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "ether_type_flag", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "ether_type_flag", b ? "1" : "0"); break; } return 0; @@ -984,7 +984,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_EtherTypeFlag(char *refpa /*#Device.IEEE1905.AL.ForwardingTable.ForwardingRule.{i}.Vid!UCI:dmmap_forwarding_rule/forwarding_rule,@i-1/vid*/ static int get_IEEE1905ALForwardingTableForwardingRule_Vid(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "vid", "0"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "vid", "0"); return 0; } @@ -996,7 +996,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_Vid(char *refparam, struc return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "vid", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "vid", value); break; } return 0; @@ -1005,7 +1005,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_Vid(char *refparam, struc /*#Device.IEEE1905.AL.ForwardingTable.ForwardingRule.{i}.VidFlag!UCI:dmmap_forwarding_rule/forwarding_rule,@i-1/vid_flag*/ static int get_IEEE1905ALForwardingTableForwardingRule_VidFlag(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "vid_flag", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "vid_flag", value); return 0; } @@ -1020,7 +1020,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_VidFlag(char *refparam, s break; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "vid_flag", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "vid_flag", b ? "1" : "0"); break; } return 0; @@ -1029,7 +1029,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_VidFlag(char *refparam, s /*#Device.IEEE1905.AL.ForwardingTable.ForwardingRule.{i}.PCP!UCI:dmmap_forwarding_rule/forwarding_rule,@i-1/pcp*/ static int get_IEEE1905ALForwardingTableForwardingRule_PCP(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "pcp", "0"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "pcp", "0"); return 0; } @@ -1041,7 +1041,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_PCP(char *refparam, struc return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "pcp", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "pcp", value); break; } return 0; @@ -1050,7 +1050,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_PCP(char *refparam, struc /*#Device.IEEE1905.AL.ForwardingTable.ForwardingRule.{i}.PCPFlag!UCI:dmmap_forwarding_rule/forwarding_rule,@i-1/pcp_flag*/ static int get_IEEE1905ALForwardingTableForwardingRule_PCPFlag(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "pcp_flag", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "pcp_flag", value); return 0; } @@ -1065,7 +1065,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_PCPFlag(char *refparam, s break; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "pcp_flag", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "pcp_flag", b ? "1" : "0"); break; } return 0; diff --git a/libbbfdm/dmtree/tr181/ip.c b/libbbfdm/dmtree/tr181/ip.c index a9459dc1..f16b2cc1 100644 --- a/libbbfdm/dmtree/tr181/ip.c +++ b/libbbfdm/dmtree/tr181/ip.c @@ -542,26 +542,25 @@ static int delObjIPInterfaceIPv6(void *data, unsigned char del_action, char *dmm /*#Device.IP.Interface.{i}.!UCI:network/interface/dmmap_network*/ static int browseIPInterfaceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - char *inst = NULL; - char *proto, *device; - struct dmmap_dup *p = NULL; + char *proto = NULL, *device = NULL, *inst = NULL; + struct dm_data *curr_data = NULL; LIST_HEAD(dup_list); synchronize_specific_config_sections_with_dmmap("network", "interface", "dmmap_network", &dup_list); - list_for_each_entry(p, &dup_list, list) { + list_for_each_entry(curr_data, &dup_list, list) { - dmuci_get_value_by_section_string(p->config_section, "proto", &proto); - dmuci_get_value_by_section_string(p->config_section, "device", &device); + dmuci_get_value_by_section_string(curr_data->config_section, "proto", &proto); + dmuci_get_value_by_section_string(curr_data->config_section, "device", &device); - if (strcmp(section_name(p->config_section), "loopback") == 0 || + if (strcmp(section_name(curr_data->config_section), "loopback") == 0 || *proto == '\0' || DM_STRCHR(device, '@') || - ip___is_ip_interface_instance_exists(section_name(p->config_section), device)) + ip___is_ip_interface_instance_exists(section_name(curr_data->config_section), device)) continue; - inst = handle_instance(dmctx, parent_node, p->dmmap_section, "ip_int_instance", "ip_int_alias"); + inst = handle_instance(dmctx, parent_node, curr_data->dmmap_section, "ip_int_instance", "ip_int_alias"); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP) + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)curr_data->config_section, inst) == DM_STOP) break; } free_dmmap_config_dup_list(&dup_list); diff --git a/libbbfdm/dmtree/tr181/mqtt.c b/libbbfdm/dmtree/tr181/mqtt.c index c959a280..e753a5b1 100644 --- a/libbbfdm/dmtree/tr181/mqtt.c +++ b/libbbfdm/dmtree/tr181/mqtt.c @@ -54,15 +54,17 @@ static int delMQTTBroker(char *refparam, struct dmctx *ctx, void *data, char *in switch (del_action) { case DEL_INST: - dmuci_delete_by_section(((struct dmmap_dup *)data)->config_section, NULL, NULL); - dmuci_delete_by_section(((struct dmmap_dup *)data)->dmmap_section, NULL, NULL); + dmuci_delete_by_section(((struct dm_data *)data)->config_section, NULL, NULL); + dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL); break; case DEL_ALL: uci_foreach_sections_safe("mosquitto", "listener", stmp, s) { struct uci_section *dmmap_section = NULL; + get_dmmap_section_of_config_section("dmmap_mqtt", "listener", section_name(s), &dmmap_section); - dmuci_delete_by_section(s, NULL, NULL); dmuci_delete_by_section(dmmap_section, NULL, NULL); + + dmuci_delete_by_section(s, NULL, NULL); } break; } @@ -74,16 +76,16 @@ static int delMQTTBroker(char *refparam, struct dmctx *ctx, void *data, char *in *************************************************************/ static int browseMQTTBrokerInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - struct dmmap_dup *p = NULL; - char *inst = NULL; + struct dm_data *curr_data = NULL; LIST_HEAD(dup_list); + char *inst = NULL; synchronize_specific_config_sections_with_dmmap("mosquitto", "listener", "dmmap_mqtt", &dup_list); - list_for_each_entry(p, &dup_list, list) { + list_for_each_entry(curr_data, &dup_list, list) { - inst = handle_instance(dmctx, parent_node, p->dmmap_section, "listener_instance", "listener_alias"); + inst = handle_instance(dmctx, parent_node, curr_data->dmmap_section, "listener_instance", "listener_alias"); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP) + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)curr_data, inst) == DM_STOP) break; } free_dmmap_config_dup_list(&dup_list); @@ -102,17 +104,17 @@ static int get_MQTT_BrokerNumberOfEntries(char *refparam, struct dmctx *ctx, voi static int get_MQTTBroker_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - return bbf_get_alias(ctx, ((struct dmmap_dup *)data)->dmmap_section, "listener_alias", instance, value); + return bbf_get_alias(ctx, ((struct dm_data *)data)->dmmap_section, "listener_alias", instance, value); } static int set_MQTTBroker_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) { - return bbf_set_alias(ctx, ((struct dmmap_dup *)data)->dmmap_section, "listener_alias", instance, value); + return bbf_set_alias(ctx, ((struct dm_data *)data)->dmmap_section, "listener_alias", instance, value); } static int get_MQTTBroker_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "enabled", "0"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "enabled", "0"); return 0; } @@ -126,7 +128,7 @@ static int set_MQTTBroker_Enable(char *refparam, struct dmctx *ctx, void *data, break; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "enabled", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "enabled", b ? "1" : "0"); break; } return 0; @@ -134,7 +136,7 @@ static int set_MQTTBroker_Enable(char *refparam, struct dmctx *ctx, void *data, static int get_MQTTBroker_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->dmmap_section, "section_name", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->dmmap_section, "section_name", value); return 0; } @@ -154,7 +156,7 @@ static int set_MQTTBroker_Name(char *refparam, struct dmctx *ctx, void *data, ch } // Check if new name is same as current name - curr_name = section_name(((struct dmmap_dup *)data)->config_section); + curr_name = section_name(((struct dm_data *)data)->config_section); if (DM_STRCMP(curr_name, value) == 0) break; @@ -167,18 +169,18 @@ static int set_MQTTBroker_Name(char *refparam, struct dmctx *ctx, void *data, ch break; case VALUESET: // If new name is same as current name then nothing to do - curr_name = section_name(((struct dmmap_dup *)data)->config_section); + curr_name = section_name(((struct dm_data *)data)->config_section); if (DM_STRCMP(curr_name, value) == 0) break; // Update mosquitto config - if (0 != dmuci_rename_section_by_section(((struct dmmap_dup *)data)->config_section, value)) { + if (0 != dmuci_rename_section_by_section(((struct dm_data *)data)->config_section, value)) { bbfdm_set_fault_message(ctx, "Rename the entry name with '%s' value was failed.", value); return FAULT_9001; } // Update dmmap_mqtt file - dmuci_set_value_by_section(((struct dmmap_dup *)data)->dmmap_section, "section_name", value); + dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "section_name", value); break; } @@ -187,7 +189,7 @@ static int set_MQTTBroker_Name(char *refparam, struct dmctx *ctx, void *data, ch static int get_MQTTBroker_Port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "port", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "port", value); return 0; } @@ -199,7 +201,7 @@ static int set_MQTTBroker_Port(char *refparam, struct dmctx *ctx, void *data, ch return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "port", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "port", value); break; } return 0; @@ -209,7 +211,7 @@ static int get_MQTTBroker_Interface(char *refparam, struct dmctx *ctx, void *dat { char *intf = NULL; - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "interface", &intf); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "interface", &intf); adm_entry_get_reference_param(ctx, "Device.IP.Interface.*.Name", intf, value); return 0; } @@ -231,7 +233,7 @@ static int set_MQTTBroker_Interface(char *refparam, struct dmctx *ctx, void *dat break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "interface", reference.value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "interface", reference.value); break; } return 0; @@ -239,7 +241,7 @@ static int set_MQTTBroker_Interface(char *refparam, struct dmctx *ctx, void *dat static int get_MQTTBroker_Username(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "username", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "username", value); return 0; } @@ -258,7 +260,7 @@ static int set_MQTTBroker_Username(char *refparam, struct dmctx *ctx, void *data break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "username", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "username", value); break; } return 0; @@ -266,7 +268,7 @@ static int set_MQTTBroker_Username(char *refparam, struct dmctx *ctx, void *data static int get_MQTTBroker_Password(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "password", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "password", value); return 0; } @@ -278,7 +280,7 @@ static int set_MQTTBroker_Password(char *refparam, struct dmctx *ctx, void *data return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "password", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "password", value); break; } return 0; diff --git a/libbbfdm/dmtree/tr181/nat.c b/libbbfdm/dmtree/tr181/nat.c index 3c4594f2..3dc7e31f 100644 --- a/libbbfdm/dmtree/tr181/nat.c +++ b/libbbfdm/dmtree/tr181/nat.c @@ -21,15 +21,15 @@ static int get_nat_port_mapping_external_port_end_range(char *refparam, struct d static int browseInterfaceSettingInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { char *inst = NULL; - struct dmmap_dup *p = NULL; + struct dm_data *curr_data = NULL; LIST_HEAD(dup_list); synchronize_specific_config_sections_with_dmmap("firewall", "zone", "dmmap_firewall", &dup_list); - list_for_each_entry(p, &dup_list, list) { + list_for_each_entry(curr_data, &dup_list, list) { - inst = handle_instance(dmctx, parent_node, p->dmmap_section, "interface_setting_instance", "interface_setting_alias"); + inst = handle_instance(dmctx, parent_node, curr_data->dmmap_section, "interface_setting_instance", "interface_setting_alias"); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP) + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)curr_data, inst) == DM_STOP) break; } free_dmmap_config_dup_list(&dup_list); @@ -39,14 +39,14 @@ static int browseInterfaceSettingInst(struct dmctx *dmctx, DMNODE *parent_node, /*#Device.NAT.PortMapping.{i}.!UCI:firewall/redirect/dmmap_firewall*/ static int browsePortMappingInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - char *inst = NULL, *target; - struct dmmap_dup *p = NULL; + char *inst = NULL, *target = NULL; + struct dm_data *curr_data = NULL; LIST_HEAD(dup_list); synchronize_specific_config_sections_with_dmmap("firewall", "redirect", "dmmap_firewall", &dup_list); - list_for_each_entry(p, &dup_list, list) { - dmuci_get_value_by_section_string(p->config_section, "target", &target); + list_for_each_entry(curr_data, &dup_list, list) { + dmuci_get_value_by_section_string(curr_data->config_section, "target", &target); if (*target != '\0' && DM_LSTRCMP(target, "DNAT") != 0) continue; @@ -54,16 +54,16 @@ static int browsePortMappingInst(struct dmctx *dmctx, DMNODE *parent_node, void * Add port range end in dmmap section if needed */ char *src_dport = NULL; - dmuci_get_value_by_section_string(p->config_section, "src_dport", &src_dport); + dmuci_get_value_by_section_string(curr_data->config_section, "src_dport", &src_dport); if (DM_STRLEN(src_dport) != 0) { char *tmp = DM_STRCHR(src_dport, '-'); if (tmp) - dmuci_set_value_by_section(p->dmmap_section, "src_dport_end", tmp + 1); + dmuci_set_value_by_section(curr_data->dmmap_section, "src_dport_end", tmp + 1); } - inst = handle_instance(dmctx, parent_node, p->dmmap_section, "port_mapping_instance", "port_mapping_alias"); + inst = handle_instance(dmctx, parent_node, curr_data->dmmap_section, "port_mapping_instance", "port_mapping_alias"); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP) + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)curr_data, inst) == DM_STOP) break; } free_dmmap_config_dup_list(&dup_list); @@ -101,8 +101,8 @@ static int delete_NAT_InterfaceSetting(char *refparam, struct dmctx *ctx, void * switch (del_action) { case DEL_INST: - dmuci_delete_by_section(((struct dmmap_dup *)data)->config_section, NULL, NULL); - dmuci_delete_by_section(((struct dmmap_dup *)data)->dmmap_section, NULL, NULL); + dmuci_delete_by_section(((struct dm_data *)data)->config_section, NULL, NULL); + dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL); break; case DEL_ALL: uci_foreach_sections_safe("firewall", "zone", stmp, s) { @@ -144,8 +144,8 @@ static int delete_NAT_PortMapping(char *refparam, struct dmctx *ctx, void *data, switch (del_action) { case DEL_INST: - dmuci_delete_by_section(((struct dmmap_dup *)data)->config_section, NULL, NULL); - dmuci_delete_by_section(((struct dmmap_dup *)data)->dmmap_section, NULL, NULL); + dmuci_delete_by_section(((struct dm_data *)data)->config_section, NULL, NULL); + dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL); break; case DEL_ALL: uci_foreach_sections_safe("firewall", "redirect", stmp, s) { @@ -184,7 +184,7 @@ static int get_nat_port_mapping_number_of_entries(char *refparam, struct dmctx * static int get_nat_interface_setting_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { char *val; - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "masq", &val); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "masq", &val); *value = (*val == '1') ? "1" : "0"; return 0; } @@ -199,7 +199,7 @@ static int set_nat_interface_setting_enable(char *refparam, struct dmctx *ctx, v return 0; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "masq", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "masq", b ? "1" : "0"); return 0; } return 0; @@ -209,7 +209,7 @@ static int set_nat_interface_setting_enable(char *refparam, struct dmctx *ctx, v static int get_nat_interface_setting_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { char *val; - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "masq", &val); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "masq", &val); *value = (*val == '1') ? "Enabled" : "Disabled"; return 0; } @@ -217,12 +217,12 @@ static int get_nat_interface_setting_status(char *refparam, struct dmctx *ctx, v /*#Device.NAT.InterfaceSetting.{i}.Alias!UCI:dmmap_firewall/zone,@i-1/interface_setting_alias*/ static int get_nat_interface_setting_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - return bbf_get_alias(ctx, ((struct dmmap_dup *)data)->dmmap_section, "interface_setting_alias", instance, value); + return bbf_get_alias(ctx, ((struct dm_data *)data)->dmmap_section, "interface_setting_alias", instance, value); } static int set_nat_interface_setting_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) { - return bbf_set_alias(ctx, ((struct dmmap_dup *)data)->dmmap_section, "interface_setting_alias", instance, value); + return bbf_set_alias(ctx, ((struct dm_data *)data)->dmmap_section, "interface_setting_alias", instance, value); } static int get_nat_interface_setting_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) @@ -232,7 +232,7 @@ static int get_nat_interface_setting_interface(char *refparam, struct dmctx *ctx unsigned pos = 0; buf[0] = 0; - dmuci_get_value_by_section_list(((struct dmmap_dup *)data)->config_section, "network", &v); + dmuci_get_value_by_section_list(((struct dm_data *)data)->config_section, "network", &v); if (v) { struct uci_element *e = NULL; char *ifaceobj = NULL; @@ -269,8 +269,8 @@ static int set_nat_interface_setting_interface(char *refparam, struct dmctx *ctx return 0; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "network", ""); - dmuci_add_list_value_by_section(((struct dmmap_dup *)data)->config_section, "network", reference.value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "network", ""); + dmuci_add_list_value_by_section(((struct dm_data *)data)->config_section, "network", reference.value); return 0; } return 0; @@ -279,7 +279,7 @@ static int set_nat_interface_setting_interface(char *refparam, struct dmctx *ctx /*#Device.NAT.PortMapping.{i}.Enable!UCI:firewall/redirect,@i-1/enabled*/ static int get_nat_port_mapping_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->dmmap_section, "enabled", "1"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->dmmap_section, "enabled", "1"); return 0; } @@ -294,8 +294,8 @@ static int set_nat_port_mapping_enable(char *refparam, struct dmctx *ctx, void * return 0; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->dmmap_section, "enabled", b ? "1" : "0"); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "enabled", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "enabled", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "enabled", b ? "1" : "0"); } return 0; } @@ -311,12 +311,12 @@ static int get_nat_port_mapping_status(char *refparam, struct dmctx *ctx, void * /*#Device.NAT.PortMapping.{i}.Alias!UCI:dmmap_firewall/redirect,@i-1/port_mapping_alias*/ static int get_nat_port_mapping_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - return bbf_get_alias(ctx, ((struct dmmap_dup *)data)->dmmap_section, "port_mapping_alias", instance, value); + return bbf_get_alias(ctx, ((struct dm_data *)data)->dmmap_section, "port_mapping_alias", instance, value); } static int set_nat_port_mapping_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) { - return bbf_set_alias(ctx, ((struct dmmap_dup *)data)->dmmap_section, "port_mapping_alias", instance, value); + return bbf_set_alias(ctx, ((struct dm_data *)data)->dmmap_section, "port_mapping_alias", instance, value); } static int get_nat_port_mapping_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) @@ -326,12 +326,12 @@ static int get_nat_port_mapping_interface(char *refparam, struct dmctx *ctx, voi char *zone_name = NULL, *name = NULL, *src_dip = NULL, buf[256]; unsigned pos = 0; - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "src_dip", &src_dip); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "src_dip", &src_dip); if (src_dip && DM_LSTRCMP(src_dip, "*") == 0) return 0; buf[0] = 0; - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "src", &zone_name); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "src", &zone_name); uci_foreach_sections("firewall", "zone", s) { dmuci_get_value_by_section_string(s, "name", &name); if (zone_name && name && DM_STRCMP(zone_name, name) == 0) { @@ -391,20 +391,20 @@ static int set_nat_port_mapping_interface(char *refparam, struct dmctx *ctx, voi dmuci_get_value_by_section_string(s, "name", &zone_name); dmuci_get_value_by_section_string(s, "masq", &zone_masq); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "src", zone_name); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "src", zone_name); // set this section enable parameter based on the configured zone masq value - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->dmmap_section, "enabled", &val); + dmuci_get_value_by_section_string(((struct dm_data *)data)->dmmap_section, "enabled", &val); sect_enable = (*val == '1') ? true : false; zone_enable = (*zone_masq == '1') ? true : false; sect_enable = sect_enable && zone_enable; - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "enabled", sect_enable ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "enabled", sect_enable ? "1" : "0"); break; } } } else { - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "src", ""); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "src", ""); } break; } @@ -415,7 +415,7 @@ static int get_nat_port_mapping_all_interface(char *refparam, struct dmctx *ctx, { char *src_dip = NULL; - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "src_dip", &src_dip); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "src_dip", &src_dip); *value = (src_dip && *src_dip == '*') ? "1" : "0"; return 0; } @@ -432,11 +432,11 @@ static int set_nat_port_mapping_all_interface(char *refparam, struct dmctx *ctx, break; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "src_dip", b ? "*" : ""); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "src_dip", b ? "*" : ""); if (b) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "src", &src); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "src", &src); if (src == NULL || *src == '\0') - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "src", "wan"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "src", "wan"); } break; } @@ -448,7 +448,7 @@ static int get_nat_port_mapping_lease_duration(char *refparam, struct dmctx *ctx { char *expiry_date = NULL; - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "expiry", &expiry_date); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "expiry", &expiry_date); if (expiry_date && *expiry_date != '\0' && DM_STRTOL(expiry_date) > 0) { dmasprintf(value, "%lld", (long long)(DM_STRTOL(expiry_date) - time(NULL))); } else { @@ -471,7 +471,7 @@ static int set_nat_port_mapping_lease_duration(char *refparam, struct dmctx *ctx break; snprintf(expiry_date, sizeof(expiry_date), "%lld", (long long)(DM_STRTOL(value) + time(NULL))); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "expiry", expiry_date); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "expiry", expiry_date); break; } return 0; @@ -480,7 +480,7 @@ static int set_nat_port_mapping_lease_duration(char *refparam, struct dmctx *ctx /*#Device.NAT.PortMapping.{i}.RemoteHost!UCI:firewall/redirect,@i-1/src_dip*/ static int get_nat_port_mapping_remote_host(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "src_ip", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "src_ip", value); return 0; } @@ -492,7 +492,7 @@ static int set_nat_port_mapping_remote_host(char *refparam, struct dmctx *ctx, v return FAULT_9007; return 0; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "src_ip", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "src_ip", value); return 0; } return 0; @@ -502,7 +502,7 @@ static int set_nat_port_mapping_remote_host(char *refparam, struct dmctx *ctx, v static int get_nat_port_mapping_external_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { char *src_dport = NULL; - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "src_dport", &src_dport); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "src_dport", &src_dport); if (src_dport && *src_dport == '\0') { *value = "0"; return 0; @@ -537,7 +537,7 @@ static int set_nat_port_mapping_external_port(char *refparam, struct dmctx *ctx, return 0; case VALUESET: if (strcmp(value, "0") == 0) { /* 0 means no external port */ - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "src_dport", ""); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "src_dport", ""); return 0; } @@ -547,7 +547,7 @@ static int set_nat_port_mapping_external_port(char *refparam, struct dmctx *ctx, else snprintf(buffer, sizeof(buffer), "%d-%d", start_port, end_port); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "src_dport", buffer); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "src_dport", buffer); return 0; } return 0; @@ -556,7 +556,7 @@ static int set_nat_port_mapping_external_port(char *refparam, struct dmctx *ctx, /*#Device.NAT.PortMapping.{i}.ExternalPortEndRange!UCI:firewall/redirect,@i-1/src_dport*/ static int get_nat_port_mapping_external_port_end_range(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->dmmap_section, "src_dport_end", "0"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->dmmap_section, "src_dport_end", "0"); return 0; } @@ -583,7 +583,7 @@ static int set_nat_port_mapping_external_port_end_range(char *refparam, struct d return 0; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->dmmap_section, "src_dport_end", value); + dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "src_dport_end", value); dport = DM_STRTOL(value); @@ -593,7 +593,7 @@ static int set_nat_port_mapping_external_port_end_range(char *refparam, struct d else snprintf(buffer, sizeof(buffer), "%d", sport); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "src_dport", buffer); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "src_dport", buffer); } return 0; @@ -604,7 +604,7 @@ static int set_nat_port_mapping_external_port_end_range(char *refparam, struct d /*#Device.NAT.PortMapping.{i}.InternalPort!UCI:firewall/redirect,@i-1/dest_port*/ static int get_nat_port_mapping_internal_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "dest_port", "0"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "dest_port", "0"); return 0; } @@ -616,7 +616,7 @@ static int set_nat_port_mapping_internal_port(char *refparam, struct dmctx *ctx, return FAULT_9007; return 0; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "dest_port", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "dest_port", value); return 0; } return 0; @@ -626,7 +626,7 @@ static int set_nat_port_mapping_internal_port(char *refparam, struct dmctx *ctx, static int get_nat_port_mapping_protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { char *proto = NULL; - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "proto", &proto); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "proto", &proto); *value = (proto && DM_LSTRCMP(proto, "udp") == 0) ? "UDP" : "TCP"; return 0; } @@ -641,7 +641,7 @@ static int set_nat_port_mapping_protocol(char *refparam, struct dmctx *ctx, void return FAULT_9007; return 0; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "proto", (DM_LSTRCMP(value, "UDP") == 0) ? "udp" : "tcp"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "proto", (DM_LSTRCMP(value, "UDP") == 0) ? "udp" : "tcp"); return 0; } return 0; @@ -650,7 +650,7 @@ static int set_nat_port_mapping_protocol(char *refparam, struct dmctx *ctx, void /*#Device.NAT.PortMapping.{i}.InternalClient!UCI:firewall/redirect,@i-1/dest_ip*/ static int get_nat_port_mapping_internal_client(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "dest_ip", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "dest_ip", value); return 0; } @@ -662,7 +662,7 @@ static int set_nat_port_mapping_internal_client(char *refparam, struct dmctx *ct return FAULT_9007; return 0; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "dest_ip", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "dest_ip", value); return 0; } return 0; @@ -671,7 +671,7 @@ static int set_nat_port_mapping_internal_client(char *refparam, struct dmctx *ct /*#Device.NAT.PortMapping.{i}.Description!UCI:firewall/redirect,@i-1/name*/ static int get_nat_port_mapping_description(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "name", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "name", value); return 0; } @@ -683,7 +683,7 @@ static int set_nat_port_mapping_description(char *refparam, struct dmctx *ctx, v return FAULT_9007; return 0; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "name", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "name", value); return 0; } return 0; diff --git a/libbbfdm/dmtree/tr181/qos.c b/libbbfdm/dmtree/tr181/qos.c index 25203914..0984d770 100644 --- a/libbbfdm/dmtree/tr181/qos.c +++ b/libbbfdm/dmtree/tr181/qos.c @@ -69,16 +69,16 @@ static void qos_update_order(const char *order, bool is_del) *************************************************************/ static int browseQoSClassificationInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - struct dmmap_dup *p = NULL; - char *inst = NULL; + struct dm_data *curr_data = NULL; LIST_HEAD(dup_list); + char *inst = NULL; synchronize_specific_config_sections_with_dmmap("qos", "classify", "dmmap_qos", &dup_list); - list_for_each_entry(p, &dup_list, list) { + list_for_each_entry(curr_data, &dup_list, list) { - inst = handle_instance(dmctx, parent_node, p->dmmap_section, "classify_instance", "classify_alias"); + inst = handle_instance(dmctx, parent_node, curr_data->dmmap_section, "classify_instance", "classify_alias"); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP) + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)curr_data, inst) == DM_STOP) break; } free_dmmap_config_dup_list(&dup_list); @@ -87,16 +87,16 @@ static int browseQoSClassificationInst(struct dmctx *dmctx, DMNODE *parent_node, static int browseQoSPolicerInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - char *inst = NULL; - struct dmmap_dup *p = NULL; + struct dm_data *curr_data = NULL; LIST_HEAD(dup_list); + char *inst = NULL; synchronize_specific_config_sections_with_dmmap("qos", "policer", "dmmap_qos", &dup_list); - list_for_each_entry(p, &dup_list, list) { + list_for_each_entry(curr_data, &dup_list, list) { - inst = handle_instance(dmctx, parent_node, p->dmmap_section, "policer_instance", "policeralias"); + inst = handle_instance(dmctx, parent_node, curr_data->dmmap_section, "policer_instance", "policeralias"); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP) + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)curr_data, inst) == DM_STOP) break; } free_dmmap_config_dup_list(&dup_list); @@ -106,18 +106,18 @@ static int browseQoSPolicerInst(struct dmctx *dmctx, DMNODE *parent_node, void * /*#Device.QoS.Queue.{i}.!UCI:qos/queue/dmmap_qos*/ static int browseQoSQueueInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - char *inst = NULL; - struct dmmap_dup *p = NULL; + struct dm_data *curr_data = NULL; LIST_HEAD(dup_list); + char *inst = NULL; synchronize_specific_config_sections_with_dmmap("qos", "queue", "dmmap_qos", &dup_list); - list_for_each_entry(p, &dup_list, list) { + list_for_each_entry(curr_data, &dup_list, list) { - dmuci_set_value_by_section(p->dmmap_section, "queuealias", section_name(p->config_section)); + dmuci_set_value_by_section(curr_data->dmmap_section, "queuealias", section_name(curr_data->config_section)); - inst = handle_instance(dmctx, parent_node, p->dmmap_section, "queueinstance", "queuealias"); + inst = handle_instance(dmctx, parent_node, curr_data->dmmap_section, "queueinstance", "queuealias"); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP) + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)curr_data, inst) == DM_STOP) break; } free_dmmap_config_dup_list(&dup_list); @@ -141,16 +141,16 @@ static int browseQoSQueueStatsInst(struct dmctx *dmctx, DMNODE *parent_node, voi static int browseQoSShaperInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - char *inst = NULL; - struct dmmap_dup *p = NULL; + struct dm_data *curr_data = NULL; LIST_HEAD(dup_list); + char *inst = NULL; synchronize_specific_config_sections_with_dmmap("qos", "shaper", "dmmap_qos", &dup_list); - list_for_each_entry(p, &dup_list, list) { + list_for_each_entry(curr_data, &dup_list, list) { - inst = handle_instance(dmctx, parent_node, p->dmmap_section, "shaperinstance", "shaperalias"); + inst = handle_instance(dmctx, parent_node, curr_data->dmmap_section, "shaperinstance", "shaperalias"); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP) + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)curr_data, inst) == DM_STOP) break; } free_dmmap_config_dup_list(&dup_list); @@ -189,11 +189,11 @@ static int delObjQoSClassification(char *refparam, struct dmctx *ctx, void *data switch (del_action) { case DEL_INST: - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "order", &curr_order); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "order", &curr_order); qos_update_order(curr_order, true); - dmuci_delete_by_section(((struct dmmap_dup *)data)->config_section, NULL, NULL); - dmuci_delete_by_section(((struct dmmap_dup *)data)->dmmap_section, NULL, NULL); + dmuci_delete_by_section(((struct dm_data *)data)->config_section, NULL, NULL); + dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL); break; case DEL_ALL: uci_foreach_sections_safe("qos", "classify", stmp, s) { @@ -238,7 +238,7 @@ static int delObjQoSPolicer(char *refparam, struct dmctx *ctx, void *data, char case DEL_INST: // store section name to update corresponding classification // section if any - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "name", &p_name); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "name", &p_name); // Set the Classification.Policer to blank if corresponding // Policer instance has been deleted @@ -246,8 +246,8 @@ static int delObjQoSPolicer(char *refparam, struct dmctx *ctx, void *data, char dmuci_set_value_by_section(sec, "policer", ""); } - dmuci_delete_by_section(((struct dmmap_dup *)data)->config_section, NULL, NULL); - dmuci_delete_by_section(((struct dmmap_dup *)data)->dmmap_section, NULL, NULL); + dmuci_delete_by_section(((struct dm_data *)data)->config_section, NULL, NULL); + dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL); break; case DEL_ALL: uci_foreach_sections_safe("qos", "policer", stmp, s) { @@ -293,8 +293,8 @@ static int delObjQoSQueue(char *refparam, struct dmctx *ctx, void *data, char *i switch (del_action) { case DEL_INST: - dmuci_delete_by_section(((struct dmmap_dup *)data)->config_section, NULL, NULL); - dmuci_delete_by_section(((struct dmmap_dup *)data)->dmmap_section, NULL, NULL); + dmuci_delete_by_section(((struct dm_data *)data)->config_section, NULL, NULL); + dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL); break; case DEL_ALL: uci_foreach_sections_safe("qos", "queue", stmp, s) { @@ -357,8 +357,8 @@ static int delObjQoSShaper(char *refparam, struct dmctx *ctx, void *data, char * switch (del_action) { case DEL_INST: - dmuci_delete_by_section(((struct dmmap_dup *)data)->config_section, NULL, NULL); - dmuci_delete_by_section(((struct dmmap_dup *)data)->dmmap_section, NULL, NULL); + dmuci_delete_by_section(((struct dm_data *)data)->config_section, NULL, NULL); + dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL); break; case DEL_ALL: uci_foreach_sections_safe("qos", "shaper", stmp, s) { @@ -381,7 +381,7 @@ static int get_QInterface(char *refparam, struct dmctx *ctx, void *data, char *i { char *linker = NULL; - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "ifname", &linker); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "ifname", &linker); adm_entry_get_reference_param(ctx, "Device.IP.Interface.*.Name", linker, value); @@ -419,7 +419,7 @@ static int set_QInterface(char *refparam, struct dmctx *ctx, void *data, char *i break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "ifname", reference.value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "ifname", reference.value); break; } return 0; @@ -515,7 +515,7 @@ static int get_QAvailableAppList(char *refparam, struct dmctx *ctx, void *data, static int get_QoSClassification_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "enable", "1"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "enable", "1"); return 0; } @@ -530,7 +530,7 @@ static int set_QoSClassification_Enable(char *refparam, struct dmctx *ctx, void break; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "enable", (b) ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "enable", (b) ? "1" : "0"); break; } return 0; @@ -538,7 +538,7 @@ static int set_QoSClassification_Enable(char *refparam, struct dmctx *ctx, void static int get_QoSClassification_Order(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "order", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "order", value); return 0; } @@ -552,11 +552,11 @@ static int set_QoSClassification_Order(char *refparam, struct dmctx *ctx, void * return FAULT_9007; break; case VALUESET: - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "order", &curr_order); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "order", &curr_order); if (qos_is_order_exists(value)) qos_update_order(value, false); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "order", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "order", value); break; } return 0; @@ -567,7 +567,7 @@ static int get_QoSClassification_DestMask(char *refparam, struct dmctx *ctx, voi char *dest_ip = NULL; char *mask = NULL; - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "dest_ip", &dest_ip); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "dest_ip", &dest_ip); // dest_ip can be of type, 'x.x.x.x' or 'x.x.x.x/y' if (DM_STRLEN(dest_ip)) mask = strchr(dest_ip, '/'); @@ -600,13 +600,13 @@ static int set_QoSClassification_DestMask(char *refparam, struct dmctx *ctx, voi } // get destination ip addr from qos classify uci section - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "dest_ip", &ip); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "dest_ip", &ip); ip_addr = strtok(ip, "/"); snprintf(dest_ip, sizeof(dest_ip), "%s/%s", ip_addr ? ip_addr : "0.0.0.0", mask); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "dest_ip", dest_ip); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "dest_ip", dest_ip); break; } return 0; @@ -617,7 +617,7 @@ static int get_QoSClassification_SourceMask(char *refparam, struct dmctx *ctx, v char *src_ip = NULL; char *mask = NULL; - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "src_ip", &src_ip); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "src_ip", &src_ip); // src_ip can be of type, 'x.x.x.x' or 'x.x.x.x/y' if (DM_STRLEN(src_ip)) mask = strchr(src_ip, '/'); @@ -650,13 +650,13 @@ static int set_QoSClassification_SourceMask(char *refparam, struct dmctx *ctx, v } // get source ip addr from qos classify uci section - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "src_ip", &ip); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "src_ip", &ip); ip_addr = strtok(ip, "/"); snprintf(dest_ip, sizeof(dest_ip), "%s/%s", ip_addr ? ip_addr : "0.0.0.0", mask); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "src_ip", dest_ip); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "src_ip", dest_ip); break; } return 0; @@ -664,12 +664,12 @@ static int set_QoSClassification_SourceMask(char *refparam, struct dmctx *ctx, v static int get_QoSClassification_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - return bbf_get_alias(ctx, ((struct dmmap_dup *)data)->dmmap_section, "classify_alias", instance, value); + return bbf_get_alias(ctx, ((struct dm_data *)data)->dmmap_section, "classify_alias", instance, value); } static int set_QoSClassification_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) { - return bbf_set_alias(ctx, ((struct dmmap_dup *)data)->dmmap_section, "classify_alias", instance, value); + return bbf_set_alias(ctx, ((struct dm_data *)data)->dmmap_section, "classify_alias", instance, value); } static int get_QoSClassification_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) @@ -684,7 +684,7 @@ static int set_QoSClassification_Interface(char *refparam, struct dmctx *ctx, vo static int get_QoSClassification_AllInterfaces(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "all_interfaces", "0"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "all_interfaces", "0"); return 0; } @@ -699,7 +699,7 @@ static int set_QoSClassification_AllInterfaces(char *refparam, struct dmctx *ctx break; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "all_interfaces", (b) ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "all_interfaces", (b) ? "1" : "0"); break; } return 0; @@ -709,7 +709,7 @@ static int get_QoSClassification_DestIP(char *refparam, struct dmctx *ctx, void { char *dest_ip = NULL; - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "dest_ip", &dest_ip); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "dest_ip", &dest_ip); if (DM_STRLEN(dest_ip)) { char *mask = strchr(dest_ip, '/'); if (mask) @@ -734,7 +734,7 @@ static int set_QoSClassification_DestIP(char *refparam, struct dmctx *ctx, void * IP addr can be of type, 'x.x.x.x' or 'x.x.x.x/y' * If IP addr is of type 'x.x.x.x/y' then get its mask(y) and use with the new dest IP. */ - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "dest_ip", &ip); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "dest_ip", &ip); if (ip[0] != '\0') { strtok(ip, "/"); @@ -745,9 +745,9 @@ static int set_QoSClassification_DestIP(char *refparam, struct dmctx *ctx, void char dest_ip[64] = {0}; snprintf(dest_ip, sizeof(dest_ip), "%s/%s", value, dest_mask); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "dest_ip", dest_ip); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "dest_ip", dest_ip); } else { - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "dest_ip", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "dest_ip", value); } break; } @@ -758,7 +758,7 @@ static int get_QoSClassification_SourceIP(char *refparam, struct dmctx *ctx, voi { char *src_ip = NULL; - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "src_ip", &src_ip); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "src_ip", &src_ip); if (DM_STRLEN(src_ip)) { char *mask = strchr(src_ip, '/'); if (mask) @@ -783,7 +783,7 @@ static int set_QoSClassification_SourceIP(char *refparam, struct dmctx *ctx, voi * IP addr can be of type, 'x.x.x.x' or 'x.x.x.x/y' * If IP addr is of type 'x.x.x.x/y' then get its mask(y) and use with the new source IP. */ - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "src_ip", &src_mask); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "src_ip", &src_mask); if (src_mask[0] != '\0') { strtok(src_mask, "/"); @@ -794,9 +794,9 @@ static int set_QoSClassification_SourceIP(char *refparam, struct dmctx *ctx, voi char src_ip[64] = {0}; snprintf(src_ip, sizeof(src_ip), "%s/%s", value, mask); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "src_ip", src_ip); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "src_ip", src_ip); } else { - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "src_ip", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "src_ip", value); } break; } @@ -805,7 +805,7 @@ static int set_QoSClassification_SourceIP(char *refparam, struct dmctx *ctx, voi static int get_QoSClassification_Protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "proto", "-1"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "proto", "-1"); return 0; } @@ -817,7 +817,7 @@ static int set_QoSClassification_Protocol(char *refparam, struct dmctx *ctx, voi return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "proto", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "proto", value); break; } return 0; @@ -826,7 +826,7 @@ static int set_QoSClassification_Protocol(char *refparam, struct dmctx *ctx, voi static int get_QoSClassification_DestPort(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "dest_port", "-1"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "dest_port", "-1"); return 0; } @@ -838,7 +838,7 @@ static int set_QoSClassification_DestPort(char *refparam, struct dmctx *ctx, voi return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "dest_port", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "dest_port", value); break; } return 0; @@ -846,7 +846,7 @@ static int set_QoSClassification_DestPort(char *refparam, struct dmctx *ctx, voi static int get_QoSClassification_DestPortRangeMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "dest_port_range", "-1"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "dest_port_range", "-1"); return 0; } @@ -858,7 +858,7 @@ static int set_QoSClassification_DestPortRangeMax(char *refparam, struct dmctx * return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "dest_port_range", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "dest_port_range", value); break; } return 0; @@ -866,7 +866,7 @@ static int set_QoSClassification_DestPortRangeMax(char *refparam, struct dmctx * static int get_QoSClassification_SourcePort(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "src_port", "-1"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "src_port", "-1"); return 0; } @@ -878,7 +878,7 @@ static int set_QoSClassification_SourcePort(char *refparam, struct dmctx *ctx, v return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "src_port", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "src_port", value); break; } return 0; @@ -886,7 +886,7 @@ static int set_QoSClassification_SourcePort(char *refparam, struct dmctx *ctx, v static int get_QoSClassification_SourcePortRangeMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "src_port_range", "-1"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "src_port_range", "-1"); return 0; } @@ -898,7 +898,7 @@ static int set_QoSClassification_SourcePortRangeMax(char *refparam, struct dmctx return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "src_port_range", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "src_port_range", value); break; } return 0; @@ -906,7 +906,7 @@ static int set_QoSClassification_SourcePortRangeMax(char *refparam, struct dmctx static int get_QoSClassification_SourceMACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "src_mac", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "src_mac", value); return 0; } @@ -918,7 +918,7 @@ static int set_QoSClassification_SourceMACAddress(char *refparam, struct dmctx * return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "src_mac", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "src_mac", value); break; } return 0; @@ -926,7 +926,7 @@ static int set_QoSClassification_SourceMACAddress(char *refparam, struct dmctx * static int get_QoSClassification_DestMACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "dst_mac", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "dst_mac", value); return 0; } @@ -938,7 +938,7 @@ static int set_QoSClassification_DestMACAddress(char *refparam, struct dmctx *ct return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "dst_mac", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "dst_mac", value); break; } return 0; @@ -946,7 +946,7 @@ static int set_QoSClassification_DestMACAddress(char *refparam, struct dmctx *ct static int get_QoSClassification_Ethertype(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "ethertype", "-1"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "ethertype", "-1"); return 0; } @@ -958,7 +958,7 @@ static int set_QoSClassification_Ethertype(char *refparam, struct dmctx *ctx, vo return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "ethertype", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "ethertype", value); break; } return 0; @@ -966,7 +966,7 @@ static int set_QoSClassification_Ethertype(char *refparam, struct dmctx *ctx, vo static int get_QoSClassification_SourceVendorClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "src_vendor_class_id", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "src_vendor_class_id", value); return 0; } @@ -978,7 +978,7 @@ static int set_QoSClassification_SourceVendorClassID(char *refparam, struct dmct return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "src_vendor_class_id", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "src_vendor_class_id", value); break; } return 0; @@ -986,7 +986,7 @@ static int set_QoSClassification_SourceVendorClassID(char *refparam, struct dmct static int get_QoSClassification_DestVendorClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "dst_vendor_class_id", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "dst_vendor_class_id", value); return 0; } @@ -998,7 +998,7 @@ static int set_QoSClassification_DestVendorClassID(char *refparam, struct dmctx return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "dst_vendor_class_id", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "dst_vendor_class_id", value); break; } return 0; @@ -1008,7 +1008,7 @@ static int get_QoSClassification_SourceClientID(char *refparam, struct dmctx *ct { char *srcclid = NULL, hex[256] = {0}; - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "src_client_id", &srcclid); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "src_client_id", &srcclid); if (srcclid && *srcclid) convert_string_to_hex(srcclid, hex, sizeof(hex)); @@ -1028,7 +1028,7 @@ static int set_QoSClassification_SourceClientID(char *refparam, struct dmctx *ct break; case VALUESET: convert_hex_to_string(value, res, sizeof(res)); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "src_client_id", res); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "src_client_id", res); break; } return 0; @@ -1038,7 +1038,7 @@ static int get_QoSClassification_DestClientID(char *refparam, struct dmctx *ctx, { char *dstclid = NULL, hex[256] = {0}; - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "dst_client_id", &dstclid); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "dst_client_id", &dstclid); if (dstclid && *dstclid) convert_string_to_hex(dstclid, hex, sizeof(hex)); @@ -1058,7 +1058,7 @@ static int set_QoSClassification_DestClientID(char *refparam, struct dmctx *ctx, break; case VALUESET: convert_hex_to_string(value, res, sizeof(res)); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "dst_client_id", res); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "dst_client_id", res); break; } return 0; @@ -1068,7 +1068,7 @@ static int get_QoSClassification_SourceUserClassID(char *refparam, struct dmctx { char *srcusrclid = NULL, hex[256] = {0}; - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "src_user_class_id", &srcusrclid); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "src_user_class_id", &srcusrclid); if (srcusrclid && *srcusrclid) convert_string_to_hex(srcusrclid, hex, sizeof(hex)); @@ -1088,7 +1088,7 @@ static int set_QoSClassification_SourceUserClassID(char *refparam, struct dmctx break; case VALUESET: convert_hex_to_string(value, res, sizeof(res)); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "src_user_class_id", res); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "src_user_class_id", res); break; } return 0; @@ -1098,7 +1098,7 @@ static int get_QoSClassification_DestUserClassID(char *refparam, struct dmctx *c { char *dstusrclid = NULL, hex[256] = {0}; - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "dst_user_class_id", &dstusrclid); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "dst_user_class_id", &dstusrclid); if (dstusrclid && *dstusrclid) convert_string_to_hex(dstusrclid, hex, sizeof(hex)); @@ -1118,7 +1118,7 @@ static int set_QoSClassification_DestUserClassID(char *refparam, struct dmctx *c break; case VALUESET: convert_hex_to_string(value, res, sizeof(res)); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "dst_user_class_id", res); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "dst_user_class_id", res); break; } return 0; @@ -1126,7 +1126,7 @@ static int set_QoSClassification_DestUserClassID(char *refparam, struct dmctx *c static int get_QoSClassification_IPLengthMin(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "ip_len_min", "0"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "ip_len_min", "0"); return 0; } @@ -1138,7 +1138,7 @@ static int set_QoSClassification_IPLengthMin(char *refparam, struct dmctx *ctx, return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "ip_len_min", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "ip_len_min", value); break; } return 0; @@ -1146,7 +1146,7 @@ static int set_QoSClassification_IPLengthMin(char *refparam, struct dmctx *ctx, static int get_QoSClassification_IPLengthMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "ip_len_max", "0"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "ip_len_max", "0"); return 0; } @@ -1158,7 +1158,7 @@ static int set_QoSClassification_IPLengthMax(char *refparam, struct dmctx *ctx, return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "ip_len_max", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "ip_len_max", value); break; } return 0; @@ -1166,7 +1166,7 @@ static int set_QoSClassification_IPLengthMax(char *refparam, struct dmctx *ctx, static int get_QoSClassification_DSCPCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "dscp_filter", "-1"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "dscp_filter", "-1"); return 0; } @@ -1178,7 +1178,7 @@ static int set_QoSClassification_DSCPCheck(char *refparam, struct dmctx *ctx, vo return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "dscp_filter", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "dscp_filter", value); break; } return 0; @@ -1187,7 +1187,7 @@ static int set_QoSClassification_DSCPCheck(char *refparam, struct dmctx *ctx, vo /*#Device.QoS.Classification.{i}.DSCPMark!UCI:qos/classify,@i-1/dscp*/ static int get_QoSClassification_DSCPMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "dscp_mark", "-1"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "dscp_mark", "-1"); return 0; } @@ -1199,14 +1199,14 @@ static int set_QoSClassification_DSCPMark(char *refparam, struct dmctx *ctx, voi return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "dscp_mark", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "dscp_mark", value); break; } return 0; } static int get_QoSClassification_EthernetPriorityCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "pcp_check", "-1"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "pcp_check", "-1"); return 0; } @@ -1218,7 +1218,7 @@ static int set_QoSClassification_EthernetPriorityCheck(char *refparam, struct dm return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "pcp_check", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "pcp_check", value); break; } return 0; @@ -1226,7 +1226,7 @@ static int set_QoSClassification_EthernetPriorityCheck(char *refparam, struct dm static int get_QoSClassification_VLANIDCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "vid_check", "-1"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "vid_check", "-1"); return 0; } @@ -1238,7 +1238,7 @@ static int set_QoSClassification_VLANIDCheck(char *refparam, struct dmctx *ctx, return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "vid_check", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "vid_check", value); break; } return 0; @@ -1246,7 +1246,7 @@ static int set_QoSClassification_VLANIDCheck(char *refparam, struct dmctx *ctx, static int get_QoSClassification_ForwardingPolicy(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "forwarding_policy", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "forwarding_policy", value); return 0; } @@ -1258,7 +1258,7 @@ static int set_QoSClassification_ForwardingPolicy(char *refparam, struct dmctx * return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "forwarding_policy", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "forwarding_policy", value); break; } return 0; @@ -1266,7 +1266,7 @@ static int set_QoSClassification_ForwardingPolicy(char *refparam, struct dmctx * static int get_QoSClassification_TrafficClass(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "traffic_class", "-1"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "traffic_class", "-1"); return 0; } @@ -1278,7 +1278,7 @@ static int set_QoSClassification_TrafficClass(char *refparam, struct dmctx *ctx, return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "traffic_class", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "traffic_class", value); break; } return 0; @@ -1289,7 +1289,7 @@ static int get_QoSClassification_Policer(char *refparam, struct dmctx *ctx, void struct uci_section *dmmap_s = NULL; char *linker = NULL; - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "policer", &linker); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "policer", &linker); get_dmmap_section_of_config_section_eq("dmmap_qos", "policer", "section_name", linker, &dmmap_s); if (dmmap_s != NULL) { char *p_inst = NULL; @@ -1318,7 +1318,7 @@ static int set_QoSClassification_Policer(char *refparam, struct dmctx *ctx, void get_dmmap_section_of_config_section_eq("dmmap_qos", "policer", "policer_instance", link_inst, &dmmap_s); dmuci_get_value_by_section_string(dmmap_s, "section_name", &linker); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "policer", linker); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "policer", linker); } break; } @@ -1327,7 +1327,7 @@ static int set_QoSClassification_Policer(char *refparam, struct dmctx *ctx, void static int get_QoSPolicer_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "enable", "1"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "enable", "1"); return 0; } @@ -1341,7 +1341,7 @@ static int set_QoSPolicer_Enable(char *refparam, struct dmctx *ctx, void *data, break; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "enable", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "enable", b ? "1" : "0"); break; } return 0; @@ -1349,24 +1349,24 @@ static int set_QoSPolicer_Enable(char *refparam, struct dmctx *ctx, void *data, static int get_QoSPolicer_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "enable", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "enable", value); *value = (*value[0] == '1') ? "Enabled" : "Disabled"; return 0; } static int get_QoSPolicer_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - return bbf_get_alias(ctx, ((struct dmmap_dup *)data)->dmmap_section, "policeralias", instance, value); + return bbf_get_alias(ctx, ((struct dm_data *)data)->dmmap_section, "policeralias", instance, value); } static int set_QoSPolicer_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) { - return bbf_set_alias(ctx, ((struct dmmap_dup *)data)->dmmap_section, "policeralias", instance, value); + return bbf_set_alias(ctx, ((struct dm_data *)data)->dmmap_section, "policeralias", instance, value); } static int get_QoSPolicer_CommittedRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "committed_rate", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "committed_rate", value); return 0; } @@ -1378,7 +1378,7 @@ static int set_QoSPolicer_CommittedRate(char *refparam, struct dmctx *ctx, void return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "committed_rate", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "committed_rate", value); break; } return 0; @@ -1386,7 +1386,7 @@ static int set_QoSPolicer_CommittedRate(char *refparam, struct dmctx *ctx, void static int get_QoSPolicer_CommittedBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "committed_burst_size", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "committed_burst_size", value); return 0; } @@ -1398,7 +1398,7 @@ static int set_QoSPolicer_CommittedBurstSize(char *refparam, struct dmctx *ctx, return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "committed_burst_size", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "committed_burst_size", value); break; } return 0; @@ -1406,7 +1406,7 @@ static int set_QoSPolicer_CommittedBurstSize(char *refparam, struct dmctx *ctx, static int get_QoSPolicer_ExcessBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "excess_burst_size", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "excess_burst_size", value); return 0; } @@ -1418,7 +1418,7 @@ static int set_QoSPolicer_ExcessBurstSize(char *refparam, struct dmctx *ctx, voi return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "excess_burst_size", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "excess_burst_size", value); break; } return 0; @@ -1426,7 +1426,7 @@ static int set_QoSPolicer_ExcessBurstSize(char *refparam, struct dmctx *ctx, voi static int get_QoSPolicer_PeakRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "peak_rate", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "peak_rate", value); return 0; } @@ -1438,7 +1438,7 @@ static int set_QoSPolicer_PeakRate(char *refparam, struct dmctx *ctx, void *data return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "peak_rate", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "peak_rate", value); break; } return 0; @@ -1446,7 +1446,7 @@ static int set_QoSPolicer_PeakRate(char *refparam, struct dmctx *ctx, void *data static int get_QoSPolicer_PeakBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "peak_burst_size", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "peak_burst_size", value); return 0; } @@ -1458,7 +1458,7 @@ static int set_QoSPolicer_PeakBurstSize(char *refparam, struct dmctx *ctx, void return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "peak_burst_size", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "peak_burst_size", value); break; } return 0; @@ -1466,7 +1466,7 @@ static int set_QoSPolicer_PeakBurstSize(char *refparam, struct dmctx *ctx, void static int get_QoSPolicer_MeterType(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "meter_type", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "meter_type", value); if (DM_LSTRNCMP(*value, "1", 1) == 0) *value = "SingleRateThreeColor"; else if (DM_LSTRNCMP(*value, "2", 1) == 0) @@ -1486,11 +1486,11 @@ static int set_QoSPolicer_MeterType(char *refparam, struct dmctx *ctx, void *dat break; case VALUESET: if (DM_LSTRCMP(value, "SimpleTokenBucket") == 0) - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "meter_type", "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "meter_type", "0"); else if (DM_LSTRCMP(value, "SingleRateThreeColor") == 0) - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "meter_type", "1"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "meter_type", "1"); else if (DM_LSTRCMP(value, "TwoRateThreeColor") == 0) - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "meter_type", "2"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "meter_type", "2"); break; } return 0; @@ -1504,7 +1504,7 @@ static int get_QoSPolicer_PossibleMeterTypes(char *refparam, struct dmctx *ctx, static int get_QoSQueue_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "enable", "1"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "enable", "1"); return 0; } @@ -1518,7 +1518,7 @@ static int set_QoSQueue_Enable(char *refparam, struct dmctx *ctx, void *data, ch break; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "enable", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "enable", b ? "1" : "0"); break; } return 0; @@ -1526,14 +1526,14 @@ static int set_QoSQueue_Enable(char *refparam, struct dmctx *ctx, void *data, ch static int get_QoSQueue_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "enable", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "enable", value); *value = (*value[0] == '1') ? "Enabled" : "Disabled"; return 0; } static int get_QoSQueue_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmstrdup(section_name(((struct dmmap_dup *)data)->config_section)); + *value = dmstrdup(section_name(((struct dm_data *)data)->config_section)); return 0; } @@ -1544,7 +1544,7 @@ static int set_QoSQueue_Alias(char *refparam, struct dmctx *ctx, void *data, cha static int get_QoSQueue_TrafficClasses(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "traffic_class", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "traffic_class", value); return 0; } @@ -1554,7 +1554,7 @@ static int set_QoSQueue_TrafficClasses(char *refparam, struct dmctx *ctx, void * case VALUECHECK: break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "traffic_class", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "traffic_class", value); break; } return 0; @@ -1572,7 +1572,7 @@ static int set_QoSQueue_Interface(char *refparam, struct dmctx *ctx, void *data, static int get_QoSQueue_Weight(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "weight", "0"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "weight", "0"); return 0; } @@ -1584,7 +1584,7 @@ static int set_QoSQueue_Weight(char *refparam, struct dmctx *ctx, void *data, ch return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "weight", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "weight", value); break; } return 0; @@ -1593,7 +1593,7 @@ static int set_QoSQueue_Weight(char *refparam, struct dmctx *ctx, void *data, ch /*#Device.QoS.Queue.{i}.Precedence!UCI:qos/queue,@i-1/precedence*/ static int get_QoSQueue_Precedence(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "precedence", "1"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "precedence", "1"); return 0; } @@ -1605,7 +1605,7 @@ static int set_QoSQueue_Precedence(char *refparam, struct dmctx *ctx, void *data return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "precedence", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "precedence", value); break; } return 0; @@ -1613,7 +1613,7 @@ static int set_QoSQueue_Precedence(char *refparam, struct dmctx *ctx, void *data static int get_QoSQueue_SchedulerAlgorithm(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "scheduling", "SP"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "scheduling", "SP"); return 0; } @@ -1627,7 +1627,7 @@ static int set_QoSQueue_SchedulerAlgorithm(char *refparam, struct dmctx *ctx, vo return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "scheduling", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "scheduling", value); break; } return 0; @@ -1636,7 +1636,7 @@ static int set_QoSQueue_SchedulerAlgorithm(char *refparam, struct dmctx *ctx, vo /*#Device.QoS.Queue.{i}.ShapingRate!UCI:qos/class,@i-1/rate*/ static int get_QoSQueue_ShapingRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "rate", "-1"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "rate", "-1"); return 0; } @@ -1649,7 +1649,7 @@ static int set_QoSQueue_ShapingRate(char *refparam, struct dmctx *ctx, void *dat return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "rate", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "rate", value); break; } return 0; @@ -1657,7 +1657,7 @@ static int set_QoSQueue_ShapingRate(char *refparam, struct dmctx *ctx, void *dat static int get_QoSQueue_ShapingBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "burst_size", "0"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "burst_size", "0"); return 0; } @@ -1669,7 +1669,7 @@ static int set_QoSQueue_ShapingBurstSize(char *refparam, struct dmctx *ctx, void return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "burst_size", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "burst_size", value); break; } return 0; @@ -1835,7 +1835,7 @@ static int get_QoSQueueStats_DroppedBytes(char *refparam, struct dmctx *ctx, voi static int get_QoSShaper_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "enable", "1"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "enable", "1"); return 0; } @@ -1849,7 +1849,7 @@ static int set_QoSShaper_Enable(char *refparam, struct dmctx *ctx, void *data, c break; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "enable", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "enable", b ? "1" : "0"); break; } return 0; @@ -1857,19 +1857,19 @@ static int set_QoSShaper_Enable(char *refparam, struct dmctx *ctx, void *data, c static int get_QoSShaper_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "enable", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "enable", value); *value = (*value[0] == '1') ? "Enabled" : "Disabled"; return 0; } static int get_QoSShaper_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - return bbf_get_alias(ctx, ((struct dmmap_dup *)data)->dmmap_section, "shaperalias", instance, value); + return bbf_get_alias(ctx, ((struct dm_data *)data)->dmmap_section, "shaperalias", instance, value); } static int set_QoSShaper_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) { - return bbf_set_alias(ctx, ((struct dmmap_dup *)data)->dmmap_section, "shaperalias", instance, value); + return bbf_set_alias(ctx, ((struct dm_data *)data)->dmmap_section, "shaperalias", instance, value); } static int get_QoSShaper_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) @@ -1884,7 +1884,7 @@ static int set_QoSShaper_Interface(char *refparam, struct dmctx *ctx, void *data static int get_QoSShaper_ShapingRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "rate", "-1"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "rate", "-1"); return 0; } @@ -1896,7 +1896,7 @@ static int set_QoSShaper_ShapingRate(char *refparam, struct dmctx *ctx, void *da return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "rate", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "rate", value); break; } return 0; @@ -1904,7 +1904,7 @@ static int set_QoSShaper_ShapingRate(char *refparam, struct dmctx *ctx, void *da static int get_QoSShaper_ShapingBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "burst_size", "0"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "burst_size", "0"); return 0; } @@ -1916,7 +1916,7 @@ static int set_QoSShaper_ShapingBurstSize(char *refparam, struct dmctx *ctx, voi return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "burst_size", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "burst_size", value); break; } return 0; diff --git a/libbbfdm/dmtree/tr181/routeradvertisement.c b/libbbfdm/dmtree/tr181/routeradvertisement.c index e6f1a1df..b6d0b1af 100644 --- a/libbbfdm/dmtree/tr181/routeradvertisement.c +++ b/libbbfdm/dmtree/tr181/routeradvertisement.c @@ -12,12 +12,6 @@ #include "dns.h" #include "routeradvertisement.h" -struct radv_option_args { - struct uci_section *config_sect; - struct uci_section *dmmap_sect; - char *option_value; -}; - /************************************************************* * COMMON FUNCTIONS **************************************************************/ @@ -52,20 +46,20 @@ static int radv_set_option_value(struct uci_section *s, char *option_list, const static int browseRouterAdvertisementInterfaceSettingInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { char *inst = NULL, *ignore = NULL; - struct dmmap_dup *p = NULL; + struct dm_data *curr_data = NULL; LIST_HEAD(dup_list); synchronize_specific_config_sections_with_dmmap("dhcp", "dhcp", "dmmap_radv", &dup_list); - list_for_each_entry(p, &dup_list, list) { + list_for_each_entry(curr_data, &dup_list, list) { // skip the section if option ignore = '1' - dmuci_get_value_by_section_string(p->config_section, "ignore", &ignore); + dmuci_get_value_by_section_string(curr_data->config_section, "ignore", &ignore); if (ignore && DM_LSTRCMP(ignore, "1") == 0) continue; - inst = handle_instance(dmctx, parent_node, p->dmmap_section, "radv_intf_instance", "radv_intf_alias"); + inst = handle_instance(dmctx, parent_node, curr_data->dmmap_section, "radv_intf_instance", "radv_intf_alias"); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP) + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)curr_data, inst) == DM_STOP) break; } free_dmmap_config_dup_list(&dup_list); @@ -74,9 +68,9 @@ static int browseRouterAdvertisementInterfaceSettingInst(struct dmctx *dmctx, DM static int browseRouterAdvertisementInterfaceSettingOptionInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - struct uci_section *dhcp_s = ((struct dmmap_dup *)prev_data)->config_section; + struct uci_section *dhcp_s = ((struct dm_data *)prev_data)->config_section; struct uci_section *dhcp_dmmap_s = NULL; - struct radv_option_args radv_option_args = {0}; + struct dm_data curr_data = {0}; struct uci_list *dns_list = NULL; char *inst = NULL, *option_value = NULL; @@ -97,13 +91,13 @@ static int browseRouterAdvertisementInterfaceSettingOptionInst(struct dmctx *dmc uci_path_foreach_option_eq(bbfdm, "dmmap_radv", "radv_option", "section_name", section_name(dhcp_s), dhcp_dmmap_s) { dmuci_get_value_by_section_string(dhcp_dmmap_s, "option_value", &option_value); - radv_option_args.config_sect = dhcp_s; - radv_option_args.dmmap_sect = dhcp_dmmap_s; - radv_option_args.option_value = option_value; + curr_data.config_section = dhcp_s; + curr_data.dmmap_section = dhcp_dmmap_s; + curr_data.additional_data = (void *)option_value; inst = handle_instance(dmctx, parent_node, dhcp_dmmap_s, "radv_option_instance", "radv_option_alias"); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&radv_option_args, inst) == DM_STOP) + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP) break; } return 0; @@ -137,8 +131,8 @@ static int delObjRouterAdvertisementInterfaceSetting(char *refparam, struct dmct switch (del_action) { case DEL_INST: - dmuci_delete_by_section(((struct dmmap_dup *)data)->config_section, NULL, NULL); - dmuci_delete_by_section(((struct dmmap_dup *)data)->dmmap_section, NULL, NULL); + dmuci_delete_by_section(((struct dm_data *)data)->config_section, NULL, NULL); + dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL); break; case DEL_ALL: uci_foreach_sections_safe("dhcp", "dhcp", stmp, s) { @@ -159,7 +153,7 @@ static int addObjRouterAdvertisementInterfaceSettingOption(char *refparam, struc struct uci_section *dmmap_sect = NULL; dmuci_add_section_bbfdm("dmmap_radv", "radv_option", &dmmap_sect); - dmuci_set_value_by_section_bbfdm(dmmap_sect, "section_name", section_name(((struct dmmap_dup *)data)->config_section)); + dmuci_set_value_by_section_bbfdm(dmmap_sect, "section_name", section_name(((struct dm_data *)data)->config_section)); dmuci_set_value_by_section_bbfdm(dmmap_sect, "option_tag", "23"); dmuci_set_value_by_section_bbfdm(dmmap_sect, "radv_option_instance", *instance); return 0; @@ -172,14 +166,14 @@ static int delObjRouterAdvertisementInterfaceSettingOption(char *refparam, struc switch (del_action) { case DEL_INST: - dmuci_get_value_by_section_list(((struct radv_option_args *)data)->config_sect, "dns", &dns_list); - if (value_exists_in_uci_list(dns_list, ((struct radv_option_args *)data)->option_value)) - dmuci_del_list_value_by_section(((struct radv_option_args *)data)->config_sect, "dns", ((struct radv_option_args *)data)->option_value); + dmuci_get_value_by_section_list(((struct dm_data *)data)->config_section, "dns", &dns_list); + if (value_exists_in_uci_list(dns_list, ((struct dm_data *)data)->additional_data)) + dmuci_del_list_value_by_section(((struct dm_data *)data)->config_section, "dns", ((struct dm_data *)data)->additional_data); - dmuci_delete_by_section(((struct radv_option_args *)data)->dmmap_sect, NULL, NULL); + dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL); break; case DEL_ALL: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "dns", ""); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "dns", ""); uci_path_foreach_sections_safe(bbfdm, "dmmap_radv", "radv_option", stmp, s) { dmuci_delete_by_section(s, NULL, NULL); } @@ -235,7 +229,7 @@ static int get_RouterAdvertisement_InterfaceSettingNumberOfEntries(char *refpara /*#Device.RouterAdvertisement.InterfaceSetting.{i}.Enable!UCI:dhcp/dhcp,@i-1/ra*/ static int get_RouterAdvertisementInterfaceSetting_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "ra", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "ra", value); *value = (*value && DM_LSTRCMP(*value, "disabled") == 0) ? "0" : "1"; return 0; } @@ -251,7 +245,7 @@ static int set_RouterAdvertisementInterfaceSetting_Enable(char *refparam, struct break; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "ra", b ? "server" : "disabled"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "ra", b ? "server" : "disabled"); break; } return 0; @@ -260,19 +254,19 @@ static int set_RouterAdvertisementInterfaceSetting_Enable(char *refparam, struct /*#Device.RouterAdvertisement.InterfaceSetting.{i}.Status!UCI:dhcp/dhcp,@i-1/ra*/ static int get_RouterAdvertisementInterfaceSetting_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "ra", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "ra", value); *value = (*value && DM_LSTRCMP(*value, "disabled") == 0) ? "Disabled" : "Enabled"; return 0; } static int get_RouterAdvertisementInterfaceSetting_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - return bbf_get_alias(ctx, ((struct dmmap_dup *)data)->dmmap_section, "radv_intf_alias", instance, value); + return bbf_get_alias(ctx, ((struct dm_data *)data)->dmmap_section, "radv_intf_alias", instance, value); } static int set_RouterAdvertisementInterfaceSetting_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) { - return bbf_set_alias(ctx, ((struct dmmap_dup *)data)->dmmap_section, "radv_intf_alias", instance, value); + return bbf_set_alias(ctx, ((struct dm_data *)data)->dmmap_section, "radv_intf_alias", instance, value); } /*#Device.RouterAdvertisement.InterfaceSetting.{i}.Interface!UCI:dhcp/dhcp,@i-1/interface*/ @@ -280,7 +274,7 @@ static int get_RouterAdvertisementInterfaceSetting_Interface(char *refparam, str { char *linker = NULL; - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "interface", &linker); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "interface", &linker); adm_entry_get_reference_param(ctx, "Device.IP.Interface.*.Name", linker, value); return 0; } @@ -302,7 +296,7 @@ static int set_RouterAdvertisementInterfaceSetting_Interface(char *refparam, str break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "interface", reference.value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "interface", reference.value); break; } return 0; @@ -315,8 +309,8 @@ static int get_RouterAdvertisementInterfaceSetting_Prefixes(char *refparam, stru struct uci_section *dmmap_s = NULL; int i = 0, pos = 0; - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "interface", &interface); - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->dmmap_section, "ip_int_instance", &ip_inst); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "interface", &interface); + dmuci_get_value_by_section_string(((struct dm_data *)data)->dmmap_section, "ip_int_instance", &ip_inst); list_val[0] = 0; dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", interface, String}}, 1, &res); @@ -350,7 +344,7 @@ static int get_RouterAdvertisementInterfaceSetting_Prefixes(char *refparam, stru /*#Device.RouterAdvertisement.InterfaceSetting.{i}.MaxRtrAdvInterval!UCI:dhcp/dhcp,@i-1/ra_maxinterval*/ static int get_RouterAdvertisementInterfaceSetting_MaxRtrAdvInterval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "ra_maxinterval", "600"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "ra_maxinterval", "600"); return 0; } @@ -362,7 +356,7 @@ static int set_RouterAdvertisementInterfaceSetting_MaxRtrAdvInterval(char *refpa return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "ra_maxinterval", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "ra_maxinterval", value); break; } return 0; @@ -371,7 +365,7 @@ static int set_RouterAdvertisementInterfaceSetting_MaxRtrAdvInterval(char *refpa /*#Device.RouterAdvertisement.InterfaceSetting.{i}.MinRtrAdvInterval!UCI:dhcp/dhcp,@i-1/ra_mininterval*/ static int get_RouterAdvertisementInterfaceSetting_MinRtrAdvInterval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "ra_mininterval", "200"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "ra_mininterval", "200"); return 0; } @@ -383,7 +377,7 @@ static int set_RouterAdvertisementInterfaceSetting_MinRtrAdvInterval(char *refpa return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "ra_mininterval", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "ra_mininterval", value); break; } return 0; @@ -392,7 +386,7 @@ static int set_RouterAdvertisementInterfaceSetting_MinRtrAdvInterval(char *refpa /*#Device.RouterAdvertisement.InterfaceSetting.{i}.AdvDefaultLifetime!UCI:dhcp/dhcp,@i-1/ra_lifetime*/ static int get_RouterAdvertisementInterfaceSetting_AdvDefaultLifetime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "ra_lifetime", "1800"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "ra_lifetime", "1800"); return 0; } @@ -404,7 +398,7 @@ static int set_RouterAdvertisementInterfaceSetting_AdvDefaultLifetime(char *refp return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "ra_lifetime", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "ra_lifetime", value); break; } return 0; @@ -413,7 +407,7 @@ static int set_RouterAdvertisementInterfaceSetting_AdvDefaultLifetime(char *refp /*#Device.RouterAdvertisement.InterfaceSetting.{i}.AdvManagedFlag!UCI:dhcp/dhcp,@i-1/ra_flags*/ static int get_RouterAdvertisementInterfaceSetting_AdvManagedFlag(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - return radv_get_option_value(((struct dmmap_dup *)data)->config_section, "ra_flags", "managed-config", value); + return radv_get_option_value(((struct dm_data *)data)->config_section, "ra_flags", "managed-config", value); } static int set_RouterAdvertisementInterfaceSetting_AdvManagedFlag(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) @@ -427,7 +421,7 @@ static int set_RouterAdvertisementInterfaceSetting_AdvManagedFlag(char *refparam break; case VALUESET: string_to_bool(value, &b); - return radv_set_option_value(((struct dmmap_dup *)data)->config_section, "ra_flags", "managed-config", b); + return radv_set_option_value(((struct dm_data *)data)->config_section, "ra_flags", "managed-config", b); } return 0; } @@ -435,7 +429,7 @@ static int set_RouterAdvertisementInterfaceSetting_AdvManagedFlag(char *refparam /*#Device.RouterAdvertisement.InterfaceSetting.{i}.AdvOtherConfigFlag!UCI:dhcp/dhcp,@i-1/ra_flags*/ static int get_RouterAdvertisementInterfaceSetting_AdvOtherConfigFlag(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - return radv_get_option_value(((struct dmmap_dup *)data)->config_section, "ra_flags", "other-config", value); + return radv_get_option_value(((struct dm_data *)data)->config_section, "ra_flags", "other-config", value); } static int set_RouterAdvertisementInterfaceSetting_AdvOtherConfigFlag(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) @@ -449,7 +443,7 @@ static int set_RouterAdvertisementInterfaceSetting_AdvOtherConfigFlag(char *refp break; case VALUESET: string_to_bool(value, &b); - return radv_set_option_value(((struct dmmap_dup *)data)->config_section, "ra_flags", "other-config", b); + return radv_set_option_value(((struct dm_data *)data)->config_section, "ra_flags", "other-config", b); } return 0; } @@ -457,7 +451,7 @@ static int set_RouterAdvertisementInterfaceSetting_AdvOtherConfigFlag(char *refp /*#Device.RouterAdvertisement.InterfaceSetting.{i}.AdvMobileAgentFlag!UCI:dhcp/dhcp,@i-1/ra_flags*/ static int get_RouterAdvertisementInterfaceSetting_AdvMobileAgentFlag(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - return radv_get_option_value(((struct dmmap_dup *)data)->config_section, "ra_flags", "home-agent", value); + return radv_get_option_value(((struct dm_data *)data)->config_section, "ra_flags", "home-agent", value); } static int set_RouterAdvertisementInterfaceSetting_AdvMobileAgentFlag(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) @@ -471,7 +465,7 @@ static int set_RouterAdvertisementInterfaceSetting_AdvMobileAgentFlag(char *refp break; case VALUESET: string_to_bool(value, &b); - return radv_set_option_value(((struct dmmap_dup *)data)->config_section, "ra_flags", "home-agent", b); + return radv_set_option_value(((struct dm_data *)data)->config_section, "ra_flags", "home-agent", b); } return 0; } @@ -481,7 +475,7 @@ static int get_RouterAdvertisementInterfaceSetting_AdvPreferredRouterFlag(char * { char *preferenece = NULL; - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "ra_preference", &preferenece); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "ra_preference", &preferenece); *value = (preferenece && *preferenece == 'h') ? "High" : (preferenece && *preferenece == 'l') ? "Low" : "Medium"; return 0; } @@ -496,7 +490,7 @@ static int set_RouterAdvertisementInterfaceSetting_AdvPreferredRouterFlag(char * return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "ra_preference", (*value == 'H') ? "high" : (*value == 'L') ? "low" : "medium"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "ra_preference", (*value == 'H') ? "high" : (*value == 'L') ? "low" : "medium"); break; } return 0; @@ -505,7 +499,7 @@ static int set_RouterAdvertisementInterfaceSetting_AdvPreferredRouterFlag(char * /*#Device.RouterAdvertisement.InterfaceSetting.{i}.AdvLinkMTU!UCI:dhcp/dhcp,@i-1/ra_mtu*/ static int get_RouterAdvertisementInterfaceSetting_AdvLinkMTU(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "ra_mtu", "0"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "ra_mtu", "0"); return 0; } @@ -517,7 +511,7 @@ static int set_RouterAdvertisementInterfaceSetting_AdvLinkMTU(char *refparam, st return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "ra_mtu", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "ra_mtu", value); break; } return 0; @@ -526,7 +520,7 @@ static int set_RouterAdvertisementInterfaceSetting_AdvLinkMTU(char *refparam, st /*#Device.RouterAdvertisement.InterfaceSetting.{i}.AdvReachableTime!UCI:dhcp/dhcp,@i-1/ra_reachabletime*/ static int get_RouterAdvertisementInterfaceSetting_AdvReachableTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "ra_reachabletime", "0"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "ra_reachabletime", "0"); return 0; } @@ -538,7 +532,7 @@ static int set_RouterAdvertisementInterfaceSetting_AdvReachableTime(char *refpar return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "ra_reachabletime", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "ra_reachabletime", value); break; } return 0; @@ -547,7 +541,7 @@ static int set_RouterAdvertisementInterfaceSetting_AdvReachableTime(char *refpar /*#Device.RouterAdvertisement.InterfaceSetting.{i}.AdvRetransTimer!UCI:dhcp/dhcp,@i-1/ra_retranstime*/ static int get_RouterAdvertisementInterfaceSetting_AdvRetransTimer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "ra_retranstime", "0"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "ra_retranstime", "0"); return 0; } @@ -559,7 +553,7 @@ static int set_RouterAdvertisementInterfaceSetting_AdvRetransTimer(char *refpara return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "ra_retranstime", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "ra_retranstime", value); break; } return 0; @@ -568,7 +562,7 @@ static int set_RouterAdvertisementInterfaceSetting_AdvRetransTimer(char *refpara /*#Device.RouterAdvertisement.InterfaceSetting.{i}.AdvCurHopLimit!UCI:dhcp/dhcp,@i-1/ra_hoplimit*/ static int get_RouterAdvertisementInterfaceSetting_AdvCurHopLimit(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "ra_hoplimit", "0"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "ra_hoplimit", "0"); return 0; } @@ -580,7 +574,7 @@ static int set_RouterAdvertisementInterfaceSetting_AdvCurHopLimit(char *refparam return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "ra_hoplimit", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "ra_hoplimit", value); break; } return 0; @@ -595,13 +589,13 @@ static int get_RouterAdvertisementInterfaceSetting_OptionNumberOfEntries(char *r static int get_RouterAdvertisementInterfaceSettingOption_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - struct radv_option_args *radv_option_s = (struct radv_option_args *)data; - return radv_get_option_value(radv_option_s->config_sect, "dns", radv_option_s->option_value, value); + struct dm_data *radv_option_s = (struct dm_data *)data; + return radv_get_option_value(radv_option_s->config_section, "dns", radv_option_s->additional_data, value); } static int set_RouterAdvertisementInterfaceSettingOption_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) { - struct radv_option_args *radv_option_s = (struct radv_option_args *)data; + struct dm_data *radv_option_s = (struct dm_data *)data; bool b; switch (action) { @@ -611,19 +605,19 @@ static int set_RouterAdvertisementInterfaceSettingOption_Enable(char *refparam, break; case VALUESET: string_to_bool(value, &b); - return radv_set_option_value(radv_option_s->config_sect, "dns", radv_option_s->option_value, b); + return radv_set_option_value(radv_option_s->config_section, "dns", radv_option_s->additional_data, b); } return 0; } static int get_RouterAdvertisementInterfaceSettingOption_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - return bbf_get_alias(ctx, ((struct radv_option_args *)data)->dmmap_sect, "radv_option_alias", instance, value); + return bbf_get_alias(ctx, ((struct dm_data *)data)->dmmap_section, "radv_option_alias", instance, value); } static int set_RouterAdvertisementInterfaceSettingOption_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) { - return bbf_set_alias(ctx, ((struct radv_option_args *)data)->dmmap_sect, "radv_option_alias", instance, value); + return bbf_set_alias(ctx, ((struct dm_data *)data)->dmmap_section, "radv_option_alias", instance, value); } static int get_RouterAdvertisementInterfaceSettingOption_Tag(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) @@ -647,7 +641,7 @@ static int set_RouterAdvertisementInterfaceSettingOption_Tag(char *refparam, str static int get_RouterAdvertisementInterfaceSettingOption_Value(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - const char *option_value = ((struct radv_option_args *)data)->option_value; + const char *option_value = ((struct dm_data *)data)->additional_data; char hex[65535] = {0}; if (option_value && *option_value) @@ -659,7 +653,7 @@ static int get_RouterAdvertisementInterfaceSettingOption_Value(char *refparam, s static int set_RouterAdvertisementInterfaceSettingOption_Value(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) { - struct radv_option_args *radv_option_s = (struct radv_option_args *)data; + struct dm_data *radv_option_s = (struct dm_data *)data; struct uci_list *dns_list = NULL; char res[256] = {0}; @@ -671,13 +665,13 @@ static int set_RouterAdvertisementInterfaceSettingOption_Value(char *refparam, s case VALUESET: convert_hex_to_string(value, res, sizeof(res)); - dmuci_get_value_by_section_list(radv_option_s->config_sect, "dns", &dns_list); - if (value_exists_in_uci_list(dns_list, radv_option_s->option_value)) { - dmuci_del_list_value_by_section(radv_option_s->config_sect, "dns", radv_option_s->option_value); - dmuci_add_list_value_by_section(radv_option_s->config_sect, "dns", res); + dmuci_get_value_by_section_list(radv_option_s->config_section, "dns", &dns_list); + if (value_exists_in_uci_list(dns_list, radv_option_s->additional_data)) { + dmuci_del_list_value_by_section(radv_option_s->config_section, "dns", radv_option_s->additional_data); + dmuci_add_list_value_by_section(radv_option_s->config_section, "dns", res); } - dmuci_set_value_by_section_bbfdm(radv_option_s->dmmap_sect, "option_value", res); + dmuci_set_value_by_section_bbfdm(radv_option_s->dmmap_section, "option_value", res); break; } return 0; diff --git a/libbbfdm/dmtree/tr181/routing.c b/libbbfdm/dmtree/tr181/routing.c index 1e795da2..5a75022e 100644 --- a/libbbfdm/dmtree/tr181/routing.c +++ b/libbbfdm/dmtree/tr181/routing.c @@ -392,8 +392,8 @@ static int browseIPv4ForwardingInst(struct dmctx *dmctx, DMNODE *parent_node, vo { struct uci_section *router_s = (struct uci_section *)prev_data; struct routingfwdargs curr_routefwdargs = {0}; + struct dm_data *curr_data = NULL; struct uci_section *s = NULL; - struct dmmap_dup *p = NULL; char *rt_table = NULL; char *inst = NULL; LIST_HEAD(dup_list); @@ -402,16 +402,16 @@ static int browseIPv4ForwardingInst(struct dmctx *dmctx, DMNODE *parent_node, vo // Enable Routes synchronize_specific_config_sections_with_dmmap("network", "route", "dmmap_routing", &dup_list); - list_for_each_entry(p, &dup_list, list) { + list_for_each_entry(curr_data, &dup_list, list) { char *table = NULL; - dmuci_get_value_by_section_string(p->config_section, "table", &table); + dmuci_get_value_by_section_string(curr_data->config_section, "table", &table); if (DM_STRCMP(rt_table, table) != 0 || (DM_STRLEN(table) == 0 && DM_STRCMP(rt_table, "254") != 0)) continue; - init_args_route_forwarding(&curr_routefwdargs, p->config_section, ROUTE_STATIC); + init_args_route_forwarding(&curr_routefwdargs, curr_data->config_section, ROUTE_STATIC); - inst = handle_instance(dmctx, parent_node, p->dmmap_section, "route_instance", "route_alias"); + inst = handle_instance(dmctx, parent_node, curr_data->dmmap_section, "route_instance", "route_alias"); if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_routefwdargs, inst) == DM_STOP) goto end; @@ -439,8 +439,8 @@ static int browseIPv6ForwardingInst(struct dmctx *dmctx, DMNODE *parent_node, vo { struct uci_section *router_s = (struct uci_section *)prev_data; struct routingfwdargs curr_route6fwdargs = {0}; + struct dm_data *curr_data = NULL; struct uci_section *s = NULL; - struct dmmap_dup *p = NULL; char *rt_table = NULL; char *inst = NULL; LIST_HEAD(dup_list); @@ -449,16 +449,16 @@ static int browseIPv6ForwardingInst(struct dmctx *dmctx, DMNODE *parent_node, vo // Enable Routes synchronize_specific_config_sections_with_dmmap("network", "route6", "dmmap_routing", &dup_list); - list_for_each_entry(p, &dup_list, list) { + list_for_each_entry(curr_data, &dup_list, list) { char *table = NULL; - dmuci_get_value_by_section_string(p->config_section, "table", &table); + dmuci_get_value_by_section_string(curr_data->config_section, "table", &table); if (DM_STRCMP(rt_table, table) != 0 || (DM_STRLEN(table) == 0 && DM_STRCMP(rt_table, "254") != 0)) continue; - init_args_route_forwarding(&curr_route6fwdargs, p->config_section, ROUTE_STATIC); + init_args_route_forwarding(&curr_route6fwdargs, curr_data->config_section, ROUTE_STATIC); - inst = handle_instance(dmctx, parent_node, p->dmmap_section, "route6_instance", "route6_alias"); + inst = handle_instance(dmctx, parent_node, curr_data->dmmap_section, "route6_instance", "route6_alias"); if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_route6fwdargs, inst) == DM_STOP) goto end; diff --git a/libbbfdm/dmtree/tr181/ssh.c b/libbbfdm/dmtree/tr181/ssh.c index db005455..a3c0d0b9 100644 --- a/libbbfdm/dmtree/tr181/ssh.c +++ b/libbbfdm/dmtree/tr181/ssh.c @@ -20,14 +20,6 @@ struct ssh_session_args { char pid[15]; }; -struct dmmap_ssh -{ - struct list_head list; - struct uci_section *config_section; - struct uci_section *dmmap_section; - struct list_head *sessions; -}; - static void add_pubkey(const char *cur, const char *new) { if (DM_STRLEN(cur) == 0) { @@ -128,56 +120,6 @@ static bool key_exists(const char *key) return exists; } -static void add_ssh_config_dup_list(struct list_head *dup_list, struct uci_section *config_section, struct uci_section *dmmap_section) -{ - struct dmmap_ssh *dmmap_config; - - dmmap_config = dmcalloc(1, sizeof(struct dmmap_ssh)); - list_add_tail(&dmmap_config->list, dup_list); - dmmap_config->config_section = config_section; - dmmap_config->dmmap_section = dmmap_section; -} - -static void free_ssh_config_dup_list(struct list_head *dup_list) -{ - struct dmmap_ssh *dmmap_config = NULL, *tmp = NULL; - - list_for_each_entry_safe(dmmap_config, tmp, dup_list, list) { - list_del(&dmmap_config->list); - dmfree(dmmap_config); - } -} - -static void synchronize_ssh_config_sections_with_dmmap(char *package, char *section_type, char *dmmap_package, struct list_head *dup_list) -{ - struct uci_section *s, *stmp, *dmmap_sect; - char *v; - - uci_foreach_sections(package, section_type, s) { - /* - * create/update corresponding dmmap section that have same config_section link and using param_value_array - */ - if ((dmmap_sect = get_dup_section_in_dmmap(dmmap_package, section_type, section_name(s))) == NULL) { - dmuci_add_section_bbfdm(dmmap_package, section_type, &dmmap_sect); - dmuci_set_value_by_section_bbfdm(dmmap_sect, "section_name", section_name(s)); - } - - /* - * Add system and dmmap sections to the list - */ - add_ssh_config_dup_list(dup_list, s, dmmap_sect); - } - - /* - * Delete unused dmmap sections - */ - uci_path_foreach_sections_safe(bbfdm, dmmap_package, section_type, stmp, s) { - dmuci_get_value_by_section_string(s, "section_name", &v); - if (get_origin_section_from_config(package, section_type, v) == NULL) - dmuci_delete_by_section(s, NULL, NULL); - } -} - static void ssh_server_session_init(struct list_head *sess_list) { char cmd[512] = {0}; @@ -324,17 +266,19 @@ static int delObjSSHServer(char *refparam, struct dmctx *ctx, void *data, char * switch (del_action) { case DEL_INST: - close_active_sessions(((struct dmmap_ssh *)data)->config_section); - dmuci_delete_by_section(((struct dmmap_ssh *)data)->config_section, NULL, NULL); - dmuci_delete_by_section(((struct dmmap_ssh *)data)->dmmap_section, NULL, NULL); + close_active_sessions(((struct dm_data *)data)->config_section); + dmuci_delete_by_section(((struct dm_data *)data)->config_section, NULL, NULL); + dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL); break; case DEL_ALL: uci_foreach_sections_safe("dropbear", "dropbear", stmp, s) { struct uci_section *dmmap_section = NULL; + get_dmmap_section_of_config_section("dmmap_dropbear", "dropbear", section_name(s), &dmmap_section); + dmuci_delete_by_section(dmmap_section, NULL, NULL); + close_active_sessions(s); dmuci_delete_by_section(s, NULL, NULL); - dmuci_delete_by_section(dmmap_section, NULL, NULL); } break; } @@ -376,34 +320,34 @@ static int delObjSSHKey(char *refparam, struct dmctx *ctx, void *data, char *ins *************************************************************/ static int browseSSHServerInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - struct dmmap_ssh *p = NULL; + struct dm_data *curr_data = NULL; LIST_HEAD(dup_list); LIST_HEAD(session_list); char *inst = NULL; ssh_server_session_init(&session_list); - synchronize_ssh_config_sections_with_dmmap("dropbear", "dropbear", "dmmap_dropbear", &dup_list); - list_for_each_entry(p, &dup_list, list) { + synchronize_specific_config_sections_with_dmmap("dropbear", "dropbear", "dmmap_dropbear", &dup_list); + list_for_each_entry(curr_data, &dup_list, list) { bool b; - char *enable = dmuci_get_value_by_section_fallback_def(p->config_section, "enable", "1"); - char *act_date = dmuci_get_value_by_section_fallback_def(p->dmmap_section, "activationdate", ""); + char *enable = dmuci_get_value_by_section_fallback_def(curr_data->config_section, "enable", "1"); + char *act_date = dmuci_get_value_by_section_fallback_def(curr_data->dmmap_section, "activationdate", ""); string_to_bool(enable, &b); if (b && DM_STRLEN(act_date) == 0) { char *tm = NULL; dm_time_format(time(NULL), &tm); - dmuci_set_value_by_section(p->dmmap_section, "activationdate", tm); + dmuci_set_value_by_section(curr_data->dmmap_section, "activationdate", tm); } - p->sessions = &session_list; + curr_data->additional_data = (void *)&session_list; - inst = handle_instance(dmctx, parent_node, p->dmmap_section, "server_instance", "server_alias"); + inst = handle_instance(dmctx, parent_node, curr_data->dmmap_section, "server_instance", "server_alias"); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP) + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)curr_data, inst) == DM_STOP) break; } free_ssh_session_list(&session_list); - free_ssh_config_dup_list(&dup_list); + free_dmmap_config_dup_list(&dup_list); return 0; } @@ -469,7 +413,7 @@ static int browseSSHServerSessionInst(struct dmctx *dmctx, DMNODE *parent_node, char *inst = NULL; int id = 0; - struct uci_section *s = ((struct dmmap_ssh *)prev_data)->config_section; + struct uci_section *s = ((struct dm_data *)prev_data)->config_section; char *value = dmuci_get_value_by_section_fallback_def(s, "enable", "1"); string_to_bool(value, &b); if (!b) @@ -513,7 +457,7 @@ static int browseSSHServerSessionInst(struct dmctx *dmctx, DMNODE *parent_node, } struct ssh_session_args *session = NULL; - struct list_head *sess_list = ((struct dmmap_ssh *)prev_data)->sessions; + struct list_head *sess_list = (struct list_head *)((struct dm_data *)prev_data)->additional_data; bool found = false; list_for_each_entry(session, sess_list, list) { if (DM_STRCMP(session->pid, line) == 0) { @@ -565,7 +509,7 @@ static int get_ssh_server_session_num(char *refparam, struct dmctx *ctx, void *d static int get_ssh_server_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_ssh *)data)->config_section, "enable", "1"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "enable", "1"); return 0; } @@ -580,7 +524,7 @@ static int set_ssh_server_enable(char *refparam, struct dmctx *ctx, void *data, break; case VALUESET: string_to_bool(value, &b); - char *cur = dmuci_get_value_by_section_fallback_def(((struct dmmap_ssh *)data)->config_section, "enable", "1"); + char *cur = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "enable", "1"); bool cur_val; string_to_bool(cur, &cur_val); @@ -588,14 +532,14 @@ static int set_ssh_server_enable(char *refparam, struct dmctx *ctx, void *data, break; if (b) { - dmuci_set_value_by_section(((struct dmmap_ssh *)data)->config_section, "enable", "1"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "enable", "1"); char *tm = NULL; dm_time_format(time(NULL), &tm); - dmuci_set_value_by_section(((struct dmmap_ssh *)data)->dmmap_section, "activationdate", tm); + dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "activationdate", tm); } else { - close_active_sessions(((struct dmmap_ssh *)data)->config_section); - dmuci_set_value_by_section(((struct dmmap_ssh *)data)->config_section, "enable", "0"); - dmuci_set_value_by_section(((struct dmmap_ssh *)data)->dmmap_section, "activationdate", ""); + close_active_sessions(((struct dm_data *)data)->config_section); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "enable", "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "activationdate", ""); } break; } @@ -604,19 +548,19 @@ static int set_ssh_server_enable(char *refparam, struct dmctx *ctx, void *data, static int get_ssh_server_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - return bbf_get_alias(ctx, ((struct dmmap_ssh *)data)->dmmap_section, "server_alias", instance, value); + return bbf_get_alias(ctx, ((struct dm_data *)data)->dmmap_section, "server_alias", instance, value); } static int set_ssh_server_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) { - return bbf_set_alias(ctx, ((struct dmmap_ssh *)data)->dmmap_section, "server_alias", instance, value); + return bbf_set_alias(ctx, ((struct dm_data *)data)->dmmap_section, "server_alias", instance, value); } static int get_ssh_server_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { char *linker = NULL; - dmuci_get_value_by_section_string(((struct dmmap_ssh *)data)->config_section, "Interface", &linker); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "Interface", &linker); adm_entry_get_reference_param(ctx, "Device.IP.Interface.*.Name", linker, value); return 0; } @@ -638,7 +582,7 @@ static int set_ssh_server_interface(char *refparam, struct dmctx *ctx, void *dat break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_ssh *)data)->config_section, "Interface", reference.value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "Interface", reference.value); break; } return 0; @@ -646,7 +590,7 @@ static int set_ssh_server_interface(char *refparam, struct dmctx *ctx, void *dat static int get_ssh_server_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_ssh *)data)->config_section, "Port", "22"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "Port", "22"); return 0; } @@ -658,7 +602,7 @@ static int set_ssh_server_port(char *refparam, struct dmctx *ctx, void *data, ch return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_ssh *)data)->config_section, "Port", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "Port", value); break; } return 0; @@ -666,7 +610,7 @@ static int set_ssh_server_port(char *refparam, struct dmctx *ctx, void *data, ch static int get_ssh_server_idle(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_ssh *)data)->config_section, "IdleTimeout", "0"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "IdleTimeout", "0"); return 0; } @@ -678,7 +622,7 @@ static int set_ssh_server_idle(char *refparam, struct dmctx *ctx, void *data, ch return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_ssh *)data)->config_section, "IdleTimeout", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "IdleTimeout", value); break; } return 0; @@ -686,7 +630,7 @@ static int set_ssh_server_idle(char *refparam, struct dmctx *ctx, void *data, ch static int get_ssh_server_keepalive(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_ssh *)data)->config_section, "SSHKeepAlive", "300"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "SSHKeepAlive", "300"); return 0; } @@ -698,7 +642,7 @@ static int set_ssh_server_keepalive(char *refparam, struct dmctx *ctx, void *dat return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_ssh *)data)->config_section, "SSHKeepAlive", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "SSHKeepAlive", value); break; } return 0; @@ -706,7 +650,7 @@ static int set_ssh_server_keepalive(char *refparam, struct dmctx *ctx, void *dat static int get_ssh_server_rootlogin(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_ssh *)data)->config_section, "RootLogin", "1"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "RootLogin", "1"); return 0; } @@ -721,7 +665,7 @@ static int set_ssh_server_rootlogin(char *refparam, struct dmctx *ctx, void *dat break; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dmmap_ssh *)data)->config_section, "RootLogin", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "RootLogin", b ? "1" : "0"); break; } return 0; @@ -729,7 +673,7 @@ static int set_ssh_server_rootlogin(char *refparam, struct dmctx *ctx, void *dat static int get_ssh_server_passwordlogin(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_ssh *)data)->config_section, "PasswordAuth", "1"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "PasswordAuth", "1"); return 0; } @@ -744,7 +688,7 @@ static int set_ssh_server_passwordlogin(char *refparam, struct dmctx *ctx, void break; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dmmap_ssh *)data)->config_section, "PasswordAuth", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "PasswordAuth", b ? "1" : "0"); break; } return 0; @@ -752,7 +696,7 @@ static int set_ssh_server_passwordlogin(char *refparam, struct dmctx *ctx, void static int get_ssh_server_rootpasswordlogin(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_ssh *)data)->config_section, "RootPasswordAuth", "1"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "RootPasswordAuth", "1"); return 0; } @@ -767,7 +711,7 @@ static int set_ssh_server_rootpasswordlogin(char *refparam, struct dmctx *ctx, v break; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dmmap_ssh *)data)->config_section, "RootPasswordAuth", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "RootPasswordAuth", b ? "1" : "0"); break; } return 0; @@ -775,7 +719,7 @@ static int set_ssh_server_rootpasswordlogin(char *refparam, struct dmctx *ctx, v static int get_ssh_server_maxauthtries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_ssh *)data)->config_section, "MaxAuthTries", "3"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "MaxAuthTries", "3"); return 0; } @@ -787,7 +731,7 @@ static int set_ssh_server_maxauthtries(char *refparam, struct dmctx *ctx, void * return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_ssh *)data)->config_section, "MaxAuthTries", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "MaxAuthTries", value); break; } return 0; @@ -795,14 +739,14 @@ static int set_ssh_server_maxauthtries(char *refparam, struct dmctx *ctx, void * static int get_ssh_server_activationdate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_ssh *)data)->dmmap_section, "activationdate", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->dmmap_section, "activationdate", value); return 0; } static int get_ssh_server_pid(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { bool b; - struct uci_section *s = ((struct dmmap_ssh *)data)->config_section; + struct uci_section *s = ((struct dm_data *)data)->config_section; char *en = dmuci_get_value_by_section_fallback_def(s, "enable", "1"); *value = "0"; diff --git a/libbbfdm/dmtree/tr181/wifi.c b/libbbfdm/dmtree/tr181/wifi.c index fae8711b..97741043 100644 --- a/libbbfdm/dmtree/tr181/wifi.c +++ b/libbbfdm/dmtree/tr181/wifi.c @@ -38,37 +38,25 @@ struct radio_scan_args struct blob_attr *msg; }; -struct wifi_radio_args +struct radio_power_args { - struct dmmap_dup *sections; int transmit_power[MAX_POWER_INDEX]; int power_count; }; -struct wifi_ssid_args -{ - struct uci_section *config_s; - struct uci_section *dmmap_s; - char *ifname; -}; - -struct wifi_enp_args -{ - struct dmmap_dup *sections; - char *ifname; -}; - /************************************************************************** * INIT ***************************************************************************/ -static inline int init_wifi_radio(struct wifi_radio_args *args, struct dmmap_dup *s) +static inline int init_wifi_radio_power(struct dm_data *curr_data) { - char *device = NULL; json_object *res = NULL, *arrobj = NULL, *power = NULL; int i = 0, j = 0, ind = 0; - args->sections = s; - device = section_name(s->config_section); + struct radio_power_args *curr_radio_power = dmcalloc(1, sizeof(struct radio_power_args)); + + curr_data->additional_data = (void *)curr_radio_power; + + char *device = section_name(curr_data->config_section); if (DM_STRLEN(device) == 0) return 0; @@ -79,19 +67,19 @@ static inline int init_wifi_radio(struct wifi_radio_args *args, struct dmmap_dup continue; int power = (int)strtod(dbm, NULL); if (ind < MAX_POWER_INDEX) { - args->transmit_power[ind] = power; + curr_radio_power->transmit_power[ind] = power; ind++; } } - args->power_count = ind; + curr_radio_power->power_count = ind; /* sort the power list */ for (i = 0; i < ind; i++) { for (j = i + 1; j < ind; j++) { - if (args->transmit_power[i] > args->transmit_power[j]) { - int tmp = args->transmit_power[i]; - args->transmit_power[i] = args->transmit_power[j]; - args->transmit_power[j] = tmp; + if (curr_radio_power->transmit_power[i] > curr_radio_power->transmit_power[j]) { + int tmp = curr_radio_power->transmit_power[i]; + curr_radio_power->transmit_power[i] = curr_radio_power->transmit_power[j]; + curr_radio_power->transmit_power[j] = tmp; } } } @@ -99,21 +87,6 @@ static inline int init_wifi_radio(struct wifi_radio_args *args, struct dmmap_dup return 0; } -static inline int init_wifi_ssid(struct wifi_ssid_args *args, struct uci_section *config_s, struct uci_section *dmmap_s, char *ifname) -{ - args->config_s = config_s; - args->dmmap_s = dmmap_s; - args->ifname = ifname; - return 0; -} - -static inline int init_wifi_enp(struct wifi_enp_args *args, struct dmmap_dup *s, char *wiface) -{ - args->sections = s; - args->ifname = wiface; - return 0; -} - /************************************************************* * COMMON FUNCTIONS **************************************************************/ @@ -347,15 +320,15 @@ static int delete_wifi_ssid(char *refparam, struct dmctx *ctx, void *data, char switch (del_action) { case DEL_INST: - if (((struct wifi_ssid_args *)data)->config_s) { - dmuci_delete_by_section(((struct wifi_ssid_args *)data)->config_s, "device", NULL); - dmuci_delete_by_section(((struct wifi_ssid_args *)data)->config_s, "ssid", NULL); + if (((struct dm_data *)data)->config_section) { + dmuci_delete_by_section(((struct dm_data *)data)->config_section, "device", NULL); + dmuci_delete_by_section(((struct dm_data *)data)->config_section, "ssid", NULL); - dmmap_s = get_dup_section_in_dmmap("dmmap_wireless", "wifi-iface", section_name(((struct wifi_ssid_args *)data)->config_s)); + dmmap_s = get_dup_section_in_dmmap("dmmap_wireless", "wifi-iface", section_name(((struct dm_data *)data)->config_section)); dmuci_set_value_by_section(dmmap_s, "added_by_user", "1"); } - dmuci_delete_by_section(((struct wifi_ssid_args *)data)->dmmap_s, NULL, NULL); + dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL); break; case DEL_ALL: uci_path_foreach_sections_safe(bbfdm, "dmmap_wireless", "ssid", stmp, ssid_s) { @@ -405,11 +378,10 @@ static int delete_wifi_accesspoint(char *refparam, struct dmctx *ctx, void *data switch (del_action) { case DEL_INST: // Remove dmmap section - get_dmmap_section_of_config_section("dmmap_wireless", "wifi-iface", section_name((struct uci_section *)data), &dmmap_s); - dmuci_delete_by_section(dmmap_s, NULL, NULL); + dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL); // Remove config section - dmuci_delete_by_section((struct uci_section *)data, NULL, NULL); + dmuci_delete_by_section(((struct dm_data *)data)->config_section, NULL, NULL); break; case DEL_ALL: uci_foreach_sections_safe("wireless", "wifi-iface", stmp, s) { @@ -448,8 +420,8 @@ static int delObjWiFiEndPoint(char *refparam, struct dmctx *ctx, void *data, cha switch (del_action) { case DEL_INST: - dmuci_set_value_by_section((((struct wifi_enp_args *)data)->sections)->config_section, "endpointinstance", ""); - dmuci_set_value_by_section((((struct wifi_enp_args *)data)->sections)->config_section, "mode", ""); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "endpointinstance", ""); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "mode", ""); break; case DEL_ALL: uci_foreach_sections("wireless", "wifi-iface", s) { @@ -475,20 +447,18 @@ static int delObjWiFiEndPoint(char *refparam, struct dmctx *ctx, void *data, cha /*#Device.WiFi.Radio.{i}.!UCI:wireless/wifi-device/dmmap_wireless*/ static int browseWifiRadioInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - char *inst = NULL; - struct wifi_radio_args curr_wifi_radio_args; - struct dmmap_dup *p = NULL; + struct dm_data *curr_data = NULL; LIST_HEAD(dup_list); - - memset(&curr_wifi_radio_args, 0, sizeof(struct wifi_radio_args)); + char *inst = NULL; synchronize_specific_config_sections_with_dmmap("wireless", "wifi-device", "dmmap_wireless", &dup_list); - list_for_each_entry(p, &dup_list, list) { - init_wifi_radio(&curr_wifi_radio_args, p); + list_for_each_entry(curr_data, &dup_list, list) { - inst = handle_instance(dmctx, parent_node, p->dmmap_section, "radioinstance", "radioalias"); + init_wifi_radio_power(curr_data); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_wifi_radio_args, inst) == DM_STOP) + inst = handle_instance(dmctx, parent_node, curr_data->dmmap_section, "radioinstance", "radioalias"); + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)curr_data, inst) == DM_STOP) break; } free_dmmap_config_dup_list(&dup_list); @@ -558,7 +528,7 @@ static void dmmap_synchronizeWiFiSSID(struct dmctx *dmctx, DMNODE *parent_node, /*#Device.WiFi.SSID.{i}.!UCI:wireless/wifi-iface/dmmap_wireless*/ static int browseWifiSsidInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - struct wifi_ssid_args curr_wifi_ssid_args = {0}; + struct dm_data curr_data = {0}; struct uci_section *dmmap_s = NULL; char *inst = NULL; @@ -574,11 +544,13 @@ static int browseWifiSsidInst(struct dmctx *dmctx, DMNODE *parent_node, void *pr if (config_s) dmuci_get_value_by_section_string(config_s, "ifname", &ifname); } - init_wifi_ssid(&curr_wifi_ssid_args, config_s, dmmap_s, ifname); + curr_data.config_section = config_s; + curr_data.dmmap_section = dmmap_s; + curr_data.additional_data = (void *)ifname; inst = handle_instance(dmctx, parent_node, dmmap_s, "ssid_instance", "ssid_alias"); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_wifi_ssid_args, inst) == DM_STOP) + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP) break; } return 0; @@ -587,21 +559,25 @@ static int browseWifiSsidInst(struct dmctx *dmctx, DMNODE *parent_node, void *pr /*#Device.WiFi.AccessPoint.{i}.!UCI:wireless/wifi-iface/dmmap_wireless*/ static int browseWifiAccessPointInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - struct dmmap_dup *p = NULL; - char *inst = NULL; + struct dm_data *curr_data = NULL; LIST_HEAD(dup_list); + char *inst = NULL; synchronize_specific_config_sections_with_dmmap("wireless", "wifi-iface", "dmmap_wireless", &dup_list); - list_for_each_entry(p, &dup_list, list) { - char *mode = NULL; + list_for_each_entry(curr_data, &dup_list, list) { + char *mode = NULL, *ifname = NULL; - dmuci_get_value_by_section_string(p->config_section, "mode", &mode); + dmuci_get_value_by_section_string(curr_data->config_section, "mode", &mode); if (DM_LSTRCMP(mode, "ap") != 0) continue; - inst = handle_instance(dmctx, parent_node, p->dmmap_section, "ap_instance", "ap_alias"); + dmuci_get_value_by_section_string(curr_data->config_section, "ifname", &ifname); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP) + curr_data->additional_data = (void *)ifname; + + inst = handle_instance(dmctx, parent_node, curr_data->dmmap_section, "ap_instance", "ap_alias"); + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)curr_data, inst) == DM_STOP) break; } free_dmmap_config_dup_list(&dup_list); @@ -611,24 +587,25 @@ static int browseWifiAccessPointInst(struct dmctx *dmctx, DMNODE *parent_node, v /*#Device.WiFi.EndPoint.{i}.!UCI:wireless/wifi-iface/dmmap_wireless*/ static int browseWiFiEndPointInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - char *inst = NULL, *ifname, *mode = NULL; - struct wifi_enp_args curr_wifi_enp_args = {0}; - struct dmmap_dup *p = NULL; + struct dm_data *curr_data = NULL; LIST_HEAD(dup_list); + char *inst = NULL; synchronize_specific_config_sections_with_dmmap("wireless", "wifi-iface", "dmmap_wireless", &dup_list); - list_for_each_entry(p, &dup_list, list) { + list_for_each_entry(curr_data, &dup_list, list) { + char *ifname = NULL, *mode = NULL; - dmuci_get_value_by_section_string(p->config_section, "mode", &mode); + dmuci_get_value_by_section_string(curr_data->config_section, "mode", &mode); if (DM_LSTRCMP(mode, "sta") != 0) continue; - dmuci_get_value_by_section_string(p->config_section, "ifname", &ifname); - init_wifi_enp(&curr_wifi_enp_args, p, ifname); + dmuci_get_value_by_section_string(curr_data->config_section, "ifname", &ifname); - inst = handle_instance(dmctx, parent_node, p->dmmap_section, "endpointinstance", "endpointalias"); + curr_data->additional_data = (void *)ifname; - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_wifi_enp_args, inst) == DM_STOP) + inst = handle_instance(dmctx, parent_node, curr_data->dmmap_section, "endpointinstance", "endpointalias"); + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)curr_data, inst) == DM_STOP) break; } free_dmmap_config_dup_list(&dup_list); @@ -638,27 +615,31 @@ static int browseWiFiEndPointInst(struct dmctx *dmctx, DMNODE *parent_node, void static int browseWiFiEndPointProfileInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { char *ep_instance = NULL; - struct wifi_enp_args *ep_args = (struct wifi_enp_args *)prev_data; - dmuci_get_value_by_section_string(ep_args->sections->dmmap_section, "endpointinstance", &ep_instance); + dmuci_get_value_by_section_string(((struct dm_data *)prev_data)->dmmap_section, "endpointinstance", &ep_instance); + struct uci_section *s = is_dmmap_section_exist_eq("dmmap_wireless", "ep_profile", "ep_key", ep_instance); - if (!s) - dmuci_add_section_bbfdm("dmmap_wireless", "ep_profile", &s); + if (!s) dmuci_add_section_bbfdm("dmmap_wireless", "ep_profile", &s); dmuci_set_value_by_section_bbfdm(s, "ep_key", ep_instance); - DM_LINK_INST_OBJ(dmctx, parent_node, ep_args->sections->config_section, "1"); + DM_LINK_INST_OBJ(dmctx, parent_node, prev_data, "1"); return 0; } /*#Device.WiFi.NeighboringWiFiDiagnostic.Result.{i}.!UBUS:wifi.radio.@Name/scanresults//accesspoints*/ static int browseWifiNeighboringWiFiDiagnosticResultInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { + struct dm_data curr_data = {0}; struct uci_section *s = NULL; char *inst = NULL; uci_path_foreach_sections(bbfdm, "dmmap_wifi_neighboring", "result", s) { + + curr_data.config_section = s; + inst = handle_instance(dmctx, parent_node, s, "wifineighbor_instance", "wifineighbor_alias"); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, inst) == DM_STOP) + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP) break; } return 0; @@ -667,16 +648,20 @@ static int browseWifiNeighboringWiFiDiagnosticResultInst(struct dmctx *dmctx, DM static int browse_wifi_associated_device(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { json_object *res = NULL, *stations = NULL, *arrobj = NULL; - char object[32], *ifname = NULL, *inst = NULL; + char object[32], *inst = NULL; + struct dm_data curr_data = {0}; int id = 0, i = 0; - dmuci_get_value_by_section_string((struct uci_section *)prev_data, "ifname", &ifname); - - snprintf(object, sizeof(object), "wifi.ap.%s", ifname); + snprintf(object, sizeof(object), "wifi.ap.%s", (char *)((struct dm_data *)prev_data)->additional_data); dmubus_call(object, "stations", UBUS_ARGS{0}, 0, &res); + dmjson_foreach_obj_in_array(res, arrobj, stations, i, 1, "stations") { + + curr_data.json_object = stations; + inst = handle_instance_without_section(dmctx, parent_node, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)stations, inst) == DM_STOP) + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP) return 0; } return 0; @@ -719,7 +704,7 @@ static int get_WiFi_EndPointNumberOfEntries(char *refparam, struct dmctx *ctx, v static int get_wifi_ssid_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct wifi_ssid_args *)data)->dmmap_s, "enabled", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->dmmap_section, "enabled", value); return 0; } @@ -729,14 +714,14 @@ static int set_wifi_ssid_enable(char *refparam, struct dmctx *ctx, void *data, c char *multi_ap = NULL; bool b; - map_s = find_mapcontroller_section(((struct wifi_ssid_args *)data)->config_s); + map_s = find_mapcontroller_section(((struct dm_data *)data)->config_section); switch (action) { case VALUECHECK: if (bbfdm_validate_boolean(ctx, value)) return FAULT_9007; - dmuci_get_value_by_section_string(((struct wifi_ssid_args *)data)->config_s, "multi_ap", &multi_ap); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "multi_ap", &multi_ap); if (DM_STRLEN(multi_ap) && !map_s) return FAULT_9007; @@ -745,14 +730,14 @@ static int set_wifi_ssid_enable(char *refparam, struct dmctx *ctx, void *data, c string_to_bool(value, &b); // wireless config: Update disabled option - if (((struct wifi_ssid_args *)data)->config_s) - dmuci_set_value_by_section(((struct wifi_ssid_args *)data)->config_s, "disabled", b ? "0" : "1"); + if (((struct dm_data *)data)->config_section) + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "disabled", b ? "0" : "1"); // mapcontroller config: Update the corresponding ap section if exists if (map_s) dmuci_set_value_by_section(map_s, "enabled", b ? "1" : "0"); - dmuci_set_value_by_section(((struct wifi_ssid_args *)data)->dmmap_s, "enabled", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "enabled", b ? "1" : "0"); return 0; } return 0; @@ -760,13 +745,13 @@ static int set_wifi_ssid_enable(char *refparam, struct dmctx *ctx, void *data, c static int get_wifi_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - return get_net_device_status(((struct wifi_ssid_args *)data)->ifname, value); + return get_net_device_status((char *)((struct dm_data *)data)->additional_data, value); } /*#Device.WiFi.SSID.{i}.SSID!UCI:wireless/wifi-iface,@i-1/ssid*/ static int get_wlan_ssid(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct wifi_ssid_args *)data)->dmmap_s, "ssid", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->dmmap_section, "ssid", value); return 0; } @@ -775,28 +760,28 @@ static int set_wlan_ssid(char *refparam, struct dmctx *ctx, void *data, char *in struct uci_section *map_s = NULL; char *multi_ap = NULL; - map_s = find_mapcontroller_section(((struct wifi_ssid_args *)data)->config_s); + map_s = find_mapcontroller_section(((struct dm_data *)data)->config_section); switch (action) { case VALUECHECK: if (bbfdm_validate_string(ctx, value, -1, 32, NULL, NULL)) return FAULT_9007; - dmuci_get_value_by_section_string(((struct wifi_ssid_args *)data)->config_s, "multi_ap", &multi_ap); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "multi_ap", &multi_ap); if (DM_STRLEN(multi_ap) && !map_s) return FAULT_9007; return 0; case VALUESET: // wireless config: Update ssid option - if (((struct wifi_ssid_args *)data)->config_s) - dmuci_set_value_by_section(((struct wifi_ssid_args *)data)->config_s, "ssid", value); + if (((struct dm_data *)data)->config_section) + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "ssid", value); // mapcontroller config: Update the corresponding ap section if exists if (map_s) dmuci_set_value_by_section(map_s, "ssid", value); - dmuci_set_value_by_section(((struct wifi_ssid_args *)data)->dmmap_s, "ssid", value); + dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "ssid", value); return 0; } return 0; @@ -804,20 +789,20 @@ static int set_wlan_ssid(char *refparam, struct dmctx *ctx, void *data, char *in static int get_wlan_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct wifi_ssid_args *)data)->dmmap_s, "name", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->dmmap_section, "name", value); return 0; } /*#Device.WiFi.SSID.{i}.MACAddress!SYSFS:/sys/class/net/@Name/address*/ static int get_WiFiSSID_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - return get_net_device_sysfs(((struct wifi_ssid_args *)data)->ifname, "address", value); + return get_net_device_sysfs(((struct dm_data *)data)->additional_data, "address", value); } /*#Device.WiFi.Radio.{i}.Enable!UCI:wireless/wifi-device,@i-1/disabled*/ static int get_radio_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((((struct wifi_radio_args *)data)->sections)->config_section, "disabled", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "disabled", value); *value = ((*value)[0] == '1') ? "0" : "1"; return 0; } @@ -833,7 +818,7 @@ static int set_radio_enable(char *refparam, struct dmctx *ctx, void *data, char return 0; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section((((struct wifi_radio_args *)data)->sections)->config_section, "disabled", b ? "0" : "1"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "disabled", b ? "0" : "1"); return 0; } return 0; @@ -846,7 +831,7 @@ static int get_radio_status(char *refparam, struct dmctx *ctx, void *data, char dmubus_call("network.wireless", "status", UBUS_ARGS{0}, 0, &res); DM_ASSERT(res, *value = "Down"); - char *isup = dmjson_get_value(res, 2, section_name((((struct wifi_radio_args *)data)->sections)->config_section), "up"); + char *isup = dmjson_get_value(res, 2, section_name(((struct dm_data *)data)->config_section), "up"); *value = (DM_STRCMP(isup, "false") == 0) ? "Down" : "Up"; return 0; } @@ -872,7 +857,7 @@ static int set_WiFiRadio_LowerLayers(char *refparam, struct dmctx *ctx, void *da static int get_WiFiRadio_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmasprintf(value, "%s", section_name((((struct wifi_radio_args *)data)->sections)->config_section)); + dmasprintf(value, "%s", section_name(((struct dm_data *)data)->config_section)); return 0; } @@ -885,7 +870,7 @@ static int get_WiFiRadio_AutoChannelSupported(char *refparam, struct dmctx *ctx, /*#Device.WiFi.Radio.{i}.AutoChannelRefreshPeriod!UCI:wireless/wifi-device,@i-1/acs_refresh_period*/ static int get_WiFiRadio_AutoChannelRefreshPeriod(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def((((struct wifi_radio_args *)data)->sections)->config_section, "acs_refresh_period", "0"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "acs_refresh_period", "0"); return 0; } @@ -897,7 +882,7 @@ static int set_WiFiRadio_AutoChannelRefreshPeriod(char *refparam, struct dmctx * return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section((((struct wifi_radio_args *)data)->sections)->config_section, "acs_refresh_period", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "acs_refresh_period", value); break; } return 0; @@ -906,14 +891,14 @@ static int set_WiFiRadio_AutoChannelRefreshPeriod(char *refparam, struct dmctx * /*#Device.WiFi.Radio.{i}.MaxSupportedAssociations!UCI:wireless/wifi-device,@i-1/maxassoc*/ static int get_WiFiRadio_MaxSupportedAssociations(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def((((struct wifi_radio_args *)data)->sections)->config_section, "maxassoc", "32"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "maxassoc", "32"); return 0; } /*#Device.WiFi.Radio.{i}.FragmentationThreshold!UCI:wireless/wifi-device,@i-1/frag_threshold*/ static int get_WiFiRadio_FragmentationThreshold(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def((((struct wifi_radio_args *)data)->sections)->config_section, "frag_threshold", "2346"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "frag_threshold", "2346"); return 0; } @@ -925,7 +910,7 @@ static int set_WiFiRadio_FragmentationThreshold(char *refparam, struct dmctx *ct return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section((((struct wifi_radio_args *)data)->sections)->config_section, "frag_threshold", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "frag_threshold", value); break; } return 0; @@ -934,7 +919,7 @@ static int set_WiFiRadio_FragmentationThreshold(char *refparam, struct dmctx *ct /*#Device.WiFi.Radio.{i}.RTSThreshold!UCI:wireless/wifi-device,@i-1/rts_threshold*/ static int get_WiFiRadio_RTSThreshold(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def((((struct wifi_radio_args *)data)->sections)->config_section, "rts_threshold", "2347"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "rts_threshold", "2347"); return 0; } @@ -946,7 +931,7 @@ static int set_WiFiRadio_RTSThreshold(char *refparam, struct dmctx *ctx, void *d return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section((((struct wifi_radio_args *)data)->sections)->config_section, "rts_threshold", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "rts_threshold", value); break; } return 0; @@ -955,7 +940,7 @@ static int set_WiFiRadio_RTSThreshold(char *refparam, struct dmctx *ctx, void *d /*#Device.WiFi.Radio.{i}.BeaconPeriod!UCI:wireless/wifi-device,@i-1/beacon_int*/ static int get_WiFiRadio_BeaconPeriod(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def((((struct wifi_radio_args *)data)->sections)->config_section, "beacon_int", "100"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "beacon_int", "100"); return 0; } @@ -967,7 +952,7 @@ static int set_WiFiRadio_BeaconPeriod(char *refparam, struct dmctx *ctx, void *d return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section((((struct wifi_radio_args *)data)->sections)->config_section, "beacon_int", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "beacon_int", value); break; } return 0; @@ -976,7 +961,7 @@ static int set_WiFiRadio_BeaconPeriod(char *refparam, struct dmctx *ctx, void *d /*#Device.WiFi.Radio.{i}.DTIMPeriod!UCI:wireless/wifi-device,@i-1/dtim_period*/ static int get_WiFiRadio_DTIMPeriod(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def((((struct wifi_radio_args *)data)->sections)->config_section, "dtim_period", "2"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "dtim_period", "2"); return 0; } @@ -993,7 +978,7 @@ static int set_WiFiRadio_DTIMPeriod(char *refparam, struct dmctx *ctx, void *dat //Here need to loop the iface and match the section name then add the dtim_period on each section //as this param is read by mac80211.sh script and is overwriten as 2 if not written in all section //of radio - uci_foreach_option_eq("wireless", "wifi-iface", "device", section_name((((struct wifi_radio_args *)data)->sections)->config_section), s) { + uci_foreach_option_eq("wireless", "wifi-iface", "device", section_name(((struct dm_data *)data)->config_section), s) { char *mode; dmuci_get_value_by_section_string(s, "mode", &mode); @@ -1004,7 +989,7 @@ static int set_WiFiRadio_DTIMPeriod(char *refparam, struct dmctx *ctx, void *dat dmuci_set_value_by_section(s, "dtim_period", value); } - dmuci_set_value_by_section((((struct wifi_radio_args *)data)->sections)->config_section, "dtim_period", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "dtim_period", value); break; } return 0; @@ -1015,7 +1000,7 @@ static int get_WiFiRadio_OperatingChannelBandwidth(char *refparam, struct dmctx { char *htmode = NULL; - dmuci_get_value_by_section_string((((struct wifi_radio_args *)data)->sections)->config_section, "htmode", &htmode); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "htmode", &htmode); if (htmode && *htmode) { int freq; @@ -1035,7 +1020,7 @@ static int get_WiFiRadio_SupportedOperatingChannelBandwidths(char *refparam, str json_object *res = NULL; char object[32]; - snprintf(object, sizeof(object), "wifi.radio.%s", section_name((((struct wifi_radio_args *)data)->sections)->config_section)); + snprintf(object, sizeof(object), "wifi.radio.%s", section_name(((struct dm_data *)data)->config_section)); dmubus_call(object, "status", UBUS_ARGS{0}, 0, &res); DM_ASSERT(res, *value = "Auto"); @@ -1069,7 +1054,7 @@ static int set_WiFiRadio_OperatingChannelBandwidth(char *refparam, struct dmctx case VALUESET: sscanf(value, "%d", &freq); - dmuci_get_value_by_section_string((((struct wifi_radio_args *)data)->sections)->config_section, "htmode", &curr_htmode); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "htmode", &curr_htmode); if (DM_LSTRNCMP(curr_htmode, "EHT", 3) == 0) snprintf(htmode, sizeof(htmode), "EHT%d", freq); @@ -1080,7 +1065,7 @@ static int set_WiFiRadio_OperatingChannelBandwidth(char *refparam, struct dmctx else snprintf(htmode, sizeof(htmode), "HE%d", freq); - dmuci_set_value_by_section((((struct wifi_radio_args *)data)->sections)->config_section, "htmode", htmode); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "htmode", htmode); break; } return 0; @@ -1089,7 +1074,7 @@ static int set_WiFiRadio_OperatingChannelBandwidth(char *refparam, struct dmctx /*#Device.WiFi.Radio.{i}.PreambleType!UCI:wireless/wifi-device,@i-1/short_preamble*/ static int get_WiFiRadio_PreambleType(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((((struct wifi_radio_args *)data)->sections)->config_section, "short_preamble", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "short_preamble", value); *value = ((*value)[0] == '1') ? "short" : "long"; return 0; } @@ -1104,7 +1089,7 @@ static int set_WiFiRadio_PreambleType(char *refparam, struct dmctx *ctx, void *d return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section((((struct wifi_radio_args *)data)->sections)->config_section, "short_preamble", (DM_LSTRCMP(value, "short") == 0) ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "short_preamble", (DM_LSTRCMP(value, "short") == 0) ? "1" : "0"); break; } return 0; @@ -1116,7 +1101,7 @@ static int get_WiFiRadio_IEEE80211hSupported(char *refparam, struct dmctx *ctx, json_object *res = NULL; char object[32]; - snprintf(object, sizeof(object), "wifi.radio.%s", section_name((((struct wifi_radio_args *)data)->sections)->config_section)); + snprintf(object, sizeof(object), "wifi.radio.%s", section_name(((struct dm_data *)data)->config_section)); dmubus_call(object, "status", UBUS_ARGS{0}, 0, &res); DM_ASSERT(res, *value = "0"); *value = dmjson_get_value(res, 1, "dot11h_capable"); @@ -1126,7 +1111,7 @@ static int get_WiFiRadio_IEEE80211hSupported(char *refparam, struct dmctx *ctx, /*#Device.WiFi.Radio.{i}.IEEE80211hEnabled!UCI:wireless/wifi-device,@i-1/doth*/ static int get_WiFiRadio_IEEE80211hEnabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def((((struct wifi_radio_args *)data)->sections)->config_section, "doth", "0"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "doth", "0"); return 0; } @@ -1140,7 +1125,7 @@ static int set_WiFiRadio_IEEE80211hEnabled(char *refparam, struct dmctx *ctx, vo break; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section((((struct wifi_radio_args *)data)->sections)->config_section, "doth", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "doth", b ? "1" : "0"); break; } return 0; @@ -1155,15 +1140,15 @@ static int get_WiFiRadio_TransmitPowerSupported(char *refparam, struct dmctx *ct snprintf(supported_list, sizeof(supported_list), "-1,"); space_left = space_left - 3; - struct wifi_radio_args *args = (struct wifi_radio_args *)data; + struct radio_power_args *curr_radio_power = ((struct dm_data *)data)->additional_data; - if (args->power_count <= 0) + if (curr_radio_power->power_count <= 0) goto end; - int max_power = args->transmit_power[args->power_count - 1]; + int max_power = curr_radio_power->transmit_power[curr_radio_power->power_count - 1]; - for (i = 0; i < args->power_count; i++) { - int percent = ceil((double)(args->transmit_power[i] * 100) / max_power); + for (i = 0; i < curr_radio_power->power_count; i++) { + int percent = ceil((double)(curr_radio_power->transmit_power[i] * 100) / max_power); char strval[4] = {0}; snprintf(strval, sizeof(strval), "%d", percent); @@ -1184,17 +1169,17 @@ end: static int get_WiFiRadio_TransmitPower(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - struct wifi_radio_args *args = (struct wifi_radio_args *)data; - char *config = dmuci_get_value_by_section_fallback_def((args->sections)->config_section, "txpower", "-1"); + struct radio_power_args *curr_radio_power = ((struct dm_data *)data)->additional_data; + char *config = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "txpower", "-1"); if (DM_STRCMP(config, "-1") == 0) { *value = "-1"; return 0; } - if (args->power_count <= 0) + if (curr_radio_power->power_count <= 0) return 0; - int max_power = args->transmit_power[args->power_count - 1]; + int max_power = curr_radio_power->transmit_power[curr_radio_power->power_count - 1]; int dbm = (int)strtod(config, NULL); int percent = ceil((double)(dbm * 100) / max_power); @@ -1205,9 +1190,9 @@ static int get_WiFiRadio_TransmitPower(char *refparam, struct dmctx *ctx, void * static int set_WiFiRadio_TransmitPower(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) { + struct radio_power_args *curr_radio_power = ((struct dm_data *)data)->additional_data; char *supported_list = NULL; bool found = false; - struct wifi_radio_args *args = (struct wifi_radio_args *)data; switch (action) { case VALUECHECK: @@ -1231,20 +1216,20 @@ static int set_WiFiRadio_TransmitPower(char *refparam, struct dmctx *ctx, void * break; case VALUESET: if (DM_STRCMP(value, "-1") == 0) { - dmuci_set_value_by_section((args->sections)->config_section, "txpower", ""); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "txpower", ""); break; } - if (args->power_count <= 0) + if (curr_radio_power->power_count <= 0) break; - int max_power = args->transmit_power[args->power_count - 1]; + int max_power = curr_radio_power->transmit_power[curr_radio_power->power_count - 1]; int req_val = (int)strtod(value, NULL); int percent = (int)round((max_power * req_val) / 100); char str_val[10] = {0}; snprintf(str_val, sizeof(str_val), "%d", percent); - dmuci_set_value_by_section((args->sections)->config_section, "txpower", str_val); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "txpower", str_val); break; } @@ -1256,8 +1241,8 @@ static int get_WiFiRadio_RegulatoryDomain(char *refparam, struct dmctx *ctx, voi { char *conf_country, *dmmap_contry = NULL; - dmuci_get_value_by_section_string((((struct wifi_radio_args *)data)->sections)->config_section, "country", &conf_country); - dmuci_get_value_by_section_string((((struct wifi_radio_args *)data)->sections)->dmmap_section, "country", &dmmap_contry); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "country", &conf_country); + dmuci_get_value_by_section_string(((struct dm_data *)data)->dmmap_section, "country", &dmmap_contry); dmasprintf(value, "%s%c", conf_country, (dmmap_contry && *dmmap_contry) ? dmmap_contry[2] : ' '); return 0; @@ -1273,13 +1258,13 @@ static int set_WiFiRadio_RegulatoryDomain(char *refparam, struct dmctx *ctx, voi return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section((((struct wifi_radio_args *)data)->sections)->dmmap_section, "country", value); + dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "country", value); // uci only support country code, so strip I/O from value before setting if (DM_STRLEN(value) == 3) value[2] = '\0'; - dmuci_set_value_by_section((((struct wifi_radio_args *)data)->sections)->config_section, "country", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "country", value); break; } return 0; @@ -1291,7 +1276,7 @@ static int get_radio_possible_channels(char *refparam, struct dmctx *ctx, void * json_object *res = NULL; char object[UBUS_OBJ_LEN], *bandwidth = NULL; - snprintf(object, sizeof(object), "wifi.radio.%s", section_name((((struct wifi_radio_args *)data)->sections)->config_section)); + snprintf(object, sizeof(object), "wifi.radio.%s", section_name(((struct dm_data *)data)->config_section)); dmubus_call(object, "status", UBUS_ARGS{0}, 0, &res); DM_ASSERT(res, *value = ""); @@ -1305,7 +1290,7 @@ static int get_radio_possible_channels(char *refparam, struct dmctx *ctx, void * static int get_radio_channels_in_use(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = get_radio_option_nocache(section_name((((struct wifi_radio_args *)data)->sections)->config_section), "channel"); + *value = get_radio_option_nocache(section_name(((struct dm_data *)data)->config_section), "channel"); return 0; } @@ -1313,10 +1298,10 @@ static int get_radio_channel(char *refparam, struct dmctx *ctx, void *data, char { char *channel = NULL; - dmuci_get_value_by_section_string((((struct wifi_radio_args *)data)->sections)->config_section, "channel", &channel); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "channel", &channel); if (DM_LSTRCMP(channel, "auto") == 0 || DM_STRLEN(channel) == 0) - channel = get_radio_option_nocache(section_name((((struct wifi_radio_args *)data)->sections)->config_section), "channel"); + channel = get_radio_option_nocache(section_name(((struct dm_data *)data)->config_section), "channel"); *value = channel; return 0; @@ -1340,7 +1325,7 @@ static int set_radio_channel(char *refparam, struct dmctx *ctx, void *data, char return 0; case VALUESET: - dmuci_set_value_by_section((((struct wifi_radio_args *)data)->sections)->config_section, "channel", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "channel", value); return 0; } return 0; @@ -1348,7 +1333,7 @@ static int set_radio_channel(char *refparam, struct dmctx *ctx, void *data, char static int get_radio_auto_channel_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((((struct wifi_radio_args *)data)->sections)->config_section, "channel", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "channel", value); if (DM_LSTRCMP(*value, "auto") == 0 || (*value)[0] == '\0') *value = "1"; else @@ -1370,9 +1355,9 @@ static int set_radio_auto_channel_enable(char *refparam, struct dmctx *ctx, void if (b) value = "auto"; else - value = get_radio_option_nocache(section_name((((struct wifi_radio_args *)data)->sections)->config_section), "channel"); + value = get_radio_option_nocache(section_name(((struct dm_data *)data)->config_section), "channel"); - dmuci_set_value_by_section((((struct wifi_radio_args *)data)->sections)->config_section, "channel", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "channel", value); return 0; } return 0; @@ -1381,7 +1366,7 @@ static int set_radio_auto_channel_enable(char *refparam, struct dmctx *ctx, void /*#Device.WiFi.AccessPoint.{i}.SSIDAdvertisementEnabled!UCI:wireless/wifi-iface,@i-1/hidden*/ static int get_wlan_ap_advertisement_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((struct uci_section *)data, "hidden", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "hidden", value); *value = ((*value)[0] == '1') ? "0" : "1"; return 0; } @@ -1397,7 +1382,7 @@ static int set_wlan_ap_advertisement_enable(char *refparam, struct dmctx *ctx, v return 0; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section((struct uci_section *)data, "hidden", b ? "0" : "1"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "hidden", b ? "0" : "1"); return 0; } @@ -1407,7 +1392,7 @@ static int set_wlan_ap_advertisement_enable(char *refparam, struct dmctx *ctx, v /*#Device.WiFi.AccessPoint.{i}.WMMEnable!UCI:wireless/wifi-device,@i-1/wmm*/ static int get_wmm_enabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "wmm", "1"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "wmm", "1"); return 0; } @@ -1422,7 +1407,7 @@ static int set_wmm_enabled(char *refparam, struct dmctx *ctx, void *data, char * return 0; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section((struct uci_section *)data, "wmm", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "wmm", value); return 0; } return 0; @@ -1433,7 +1418,7 @@ static int get_access_point_control_enable(char *refparam, struct dmctx *ctx, vo { char *macfilter; - dmuci_get_value_by_section_string((struct uci_section *)data, "macfilter", &macfilter); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "macfilter", &macfilter); if (macfilter[0] == 0 || DM_LSTRCMP(macfilter, "deny") == 0 || DM_LSTRCMP(macfilter, "disable") == 0) *value = "false"; else @@ -1450,7 +1435,7 @@ static int get_WiFiAccessPoint_WMMCapability(char *refparam, struct dmctx *ctx, /*#Device.WiFi.AccessPoint.{i}.MaxAllowedAssociations!UCI:wireless/wifi-iface,@i-1/maxassoc*/ static int get_WiFiAccessPoint_MaxAllowedAssociations(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "maxassoc", "32"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "maxassoc", "32"); return 0; } @@ -1462,7 +1447,7 @@ static int set_WiFiAccessPoint_MaxAllowedAssociations(char *refparam, struct dmc return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "maxassoc", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "maxassoc", value); break; } return 0; @@ -1471,7 +1456,7 @@ static int set_WiFiAccessPoint_MaxAllowedAssociations(char *refparam, struct dmc /*#Device.WiFi.AccessPoint.{i}.IsolationEnable!UCI:wireless/wifi-iface,@i-1/isolate*/ static int get_WiFiAccessPoint_IsolationEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "isolate", "0"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "isolate", "0"); return 0; } @@ -1486,7 +1471,7 @@ static int set_WiFiAccessPoint_IsolationEnable(char *refparam, struct dmctx *ctx break; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section((struct uci_section *)data, "isolate", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "isolate", b ? "1" : "0"); break; } return 0; @@ -1496,7 +1481,7 @@ static int set_WiFiAccessPoint_IsolationEnable(char *refparam, struct dmctx *ctx static int get_WiFiAccessPoint_AllowedMACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { struct uci_list *val = NULL; - dmuci_get_value_by_section_list((struct uci_section *)data, "maclist", &val); + dmuci_get_value_by_section_list(((struct dm_data *)data)->config_section, "maclist", &val); *value = dmuci_list_to_string(val, ","); return 0; } @@ -1514,9 +1499,9 @@ static int set_WiFiAccessPoint_AllowedMACAddress(char *refparam, struct dmctx *c break; case VALUESET: arr = strsplit(value, ",", &length); - dmuci_set_value_by_section((struct uci_section *)data, "maclist", ""); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "maclist", ""); for (i = 0; i < length; i++) - dmuci_add_list_value_by_section((struct uci_section *)data, "maclist", arr[i]); + dmuci_add_list_value_by_section(((struct dm_data *)data)->config_section, "maclist", arr[i]); break; } return 0; @@ -1539,7 +1524,7 @@ static int set_access_point_control_enable(char *refparam, struct dmctx *ctx, vo return 0; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section((struct uci_section *)data, "macfilter", b ? "allow" : "disable"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "macfilter", b ? "allow" : "disable"); return 0; } return 0; @@ -1548,7 +1533,7 @@ static int set_access_point_control_enable(char *refparam, struct dmctx *ctx, vo /*#Device.WiFi.AccessPoint.{i}.UAPSDEnable!UCI:wireless/wifi-iface,@i-1/wmm_apsd*/ static int get_WiFiAccessPoint_UAPSDEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "wmm_apsd", "0"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "wmm_apsd", "0"); return 0; } @@ -1563,7 +1548,7 @@ static int set_WiFiAccessPoint_UAPSDEnable(char *refparam, struct dmctx *ctx, vo break; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section((struct uci_section *)data, "wmm_apsd", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "wmm_apsd", b ? "1" : "0"); break; } return 0; @@ -1571,11 +1556,7 @@ static int set_WiFiAccessPoint_UAPSDEnable(char *refparam, struct dmctx *ctx, vo static int get_access_point_security_supported_modes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - char *ifname = NULL; - - dmuci_get_value_by_section_string((struct uci_section *)data, "ifname", &ifname); - - return get_supported_modes("wifi.ap", ifname, value); + return get_supported_modes("wifi.ap", (char *)((struct dm_data *)data)->additional_data, value); } static bool is_different_group(const char *mode1, const char *mode2) @@ -1712,7 +1693,7 @@ static void set_security_mode(struct uci_section *wireless_s, struct uci_section /*#Device.WiFi.AccessPoint.{i}.Security.ModeEnabled!UCI:wireless/wifi-iface,@i-1/encryption&UCI:wireless/wifi-iface,@i-1/encryption*/ static int get_access_point_security_modes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = get_security_mode((struct uci_section *)data); + *value = get_security_mode(((struct dm_data *)data)->config_section); return 0; } @@ -1722,7 +1703,7 @@ static int set_access_point_security_modes(char *refparam, struct dmctx *ctx, vo char *supported_modes = NULL; char *multi_ap = NULL; - map_s = find_mapcontroller_section((struct uci_section *)data); + map_s = find_mapcontroller_section(((struct dm_data *)data)->config_section); switch (action) { case VALUECHECK: @@ -1736,13 +1717,13 @@ static int set_access_point_security_modes(char *refparam, struct dmctx *ctx, vo if (!value_exits_in_str_list(supported_modes, ",", value)) return FAULT_9007; - dmuci_get_value_by_section_string((struct uci_section *)data, "multi_ap", &multi_ap); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "multi_ap", &multi_ap); if (DM_STRLEN(multi_ap) && !map_s) return FAULT_9007; return 0; case VALUESET: - set_security_mode((struct uci_section *)data, map_s, value); + set_security_mode(((struct dm_data *)data)->config_section, map_s, value); return 0; } return 0; @@ -1752,10 +1733,10 @@ static int get_access_point_security_wepkey(char *refparam, struct dmctx *ctx, v { char *key_index = NULL, buf[16]; - dmuci_get_value_by_section_string((struct uci_section *)data, "key", &key_index); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "key", &key_index); snprintf(buf, sizeof(buf),"key%s", DM_STRLEN(key_index) ? key_index : "1"); - dmuci_get_value_by_section_string((struct uci_section *)data, buf, value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, buf, value); return 0; } @@ -1765,28 +1746,28 @@ static int set_access_point_security_wepkey(char *refparam, struct dmctx *ctx, v char *encryption; char *multi_ap = NULL; - map_s = find_mapcontroller_section((struct uci_section *)data); + map_s = find_mapcontroller_section(((struct dm_data *)data)->config_section); switch (action) { case VALUECHECK: if (bbfdm_validate_hexBinary(ctx, value, RANGE_ARGS{{"5","5"},{"13","13"}}, 2)) return FAULT_9007; - dmuci_get_value_by_section_string((struct uci_section *)data, "multi_ap", &multi_ap); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "multi_ap", &multi_ap); if (DM_STRLEN(multi_ap) && !map_s) return FAULT_9007; return 0; case VALUESET: - dmuci_get_value_by_section_string((struct uci_section *)data, "encryption", &encryption); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "encryption", &encryption); if (DM_LSTRSTR(encryption, "wep")) { char *key_index = NULL, buf[16]; - dmuci_get_value_by_section_string((struct uci_section *)data, "key", &key_index); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "key", &key_index); snprintf(buf, sizeof(buf),"key%s", DM_STRLEN(key_index) ? key_index : "1"); // wireless config: Update key option - dmuci_set_value_by_section((struct uci_section *)data, buf, value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, buf, value); // mapcontroller config: Update the corresponding ap section if exists if (map_s) @@ -1799,7 +1780,7 @@ static int set_access_point_security_wepkey(char *refparam, struct dmctx *ctx, v static int get_access_point_security_shared_key(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((struct uci_section *)data, "key", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "key", value); return 0; } @@ -1809,24 +1790,24 @@ static int set_access_point_security_shared_key(char *refparam, struct dmctx *ct char *encryption = NULL; char *multi_ap = NULL; - map_s = find_mapcontroller_section((struct uci_section *)data); + map_s = find_mapcontroller_section(((struct dm_data *)data)->config_section); switch (action) { case VALUECHECK: if (bbfdm_validate_hexBinary(ctx, value, RANGE_ARGS{{NULL,"32"}}, 1)) return FAULT_9007; - dmuci_get_value_by_section_string((struct uci_section *)data, "multi_ap", &multi_ap); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "multi_ap", &multi_ap); if (DM_STRLEN(multi_ap) && !map_s) return FAULT_9007; return 0; case VALUESET: - dmuci_get_value_by_section_string((struct uci_section *)data, "encryption", &encryption); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "encryption", &encryption); if (DM_LSTRSTR(encryption, "psk")) { // wireless config: Update key option - dmuci_set_value_by_section((struct uci_section *)data, "key", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "key", value); // mapcontroller config: Update the corresponding ap section if exists if (map_s) @@ -1840,7 +1821,7 @@ static int set_access_point_security_shared_key(char *refparam, struct dmctx *ct static int get_access_point_security_passphrase(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((struct uci_section *)data, "key", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "key", value); return 0; } @@ -1854,7 +1835,7 @@ static int set_access_point_security_passphrase(char *refparam, struct dmctx *ct return FAULT_9007; return 0; case VALUESET: - dmuci_get_value_by_section_string((struct uci_section *)data, "encryption", &encryption); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "encryption", &encryption); if (DM_LSTRSTR(encryption, "psk")) set_access_point_security_shared_key(refparam, ctx, data, instance, value, action); return 0; @@ -1865,7 +1846,7 @@ static int set_access_point_security_passphrase(char *refparam, struct dmctx *ct /*#Device.WiFi.AccessPoint.{i}.Security.RekeyingInterval!UCI:wireless/wifi-iface,@i-1/wpa_group_rekey*/ static int get_access_point_security_rekey_interval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "wpa_group_rekey", "0"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "wpa_group_rekey", "0"); return 0; } @@ -1879,9 +1860,9 @@ static int set_access_point_security_rekey_interval(char *refparam, struct dmctx return FAULT_9007; return 0; case VALUESET: - dmuci_get_value_by_section_string((struct uci_section *)data, "encryption", &encryption); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "encryption", &encryption); if (!DM_LSTRSTR(encryption, "wep") && DM_LSTRCMP(encryption, "none") != 0) - dmuci_set_value_by_section((struct uci_section *)data, "wpa_group_rekey", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "wpa_group_rekey", value); return 0; } return 0; @@ -1890,7 +1871,7 @@ static int set_access_point_security_rekey_interval(char *refparam, struct dmctx /*#Device.WiFi.AccessPoint.{i}.Security.SAEPassphrase!UCI:wireless/wifi-iface,@i-1/key*/ static int get_WiFiAccessPointSecurity_SAEPassphrase(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((struct uci_section *)data, "key", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "key", value); return 0; } @@ -1900,24 +1881,24 @@ static int set_WiFiAccessPointSecurity_SAEPassphrase(char *refparam, struct dmct char *encryption = NULL; char *multi_ap = NULL; - map_s = find_mapcontroller_section((struct uci_section *)data); + map_s = find_mapcontroller_section(((struct dm_data *)data)->config_section); switch (action) { case VALUECHECK: if (bbfdm_validate_string(ctx, value, -1, -1, NULL, NULL)) return FAULT_9007; - dmuci_get_value_by_section_string((struct uci_section *)data, "multi_ap", &multi_ap); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "multi_ap", &multi_ap); if (DM_STRLEN(multi_ap) && !map_s) return FAULT_9007; break; case VALUESET: - dmuci_get_value_by_section_string((struct uci_section *)data, "encryption", &encryption); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "encryption", &encryption); if (DM_LSTRSTR(encryption, "sae")) { // wireless config: Update key option - dmuci_set_value_by_section((struct uci_section *)data, "key", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "key", value); // mapcontroller config: Update the corresponding ap section if exists if (map_s) @@ -1931,7 +1912,7 @@ static int set_WiFiAccessPointSecurity_SAEPassphrase(char *refparam, struct dmct /*#Device.WiFi.AccessPoint.{i}.Security.RadiusServerIPAddr!UCI:wireless/wifi-iface,@i-1/auth_server*/ static int get_access_point_security_radius_ip_address(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((struct uci_section *)data, "auth_server", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "auth_server", value); return 0; } @@ -1945,9 +1926,9 @@ static int set_access_point_security_radius_ip_address(char *refparam, struct dm return FAULT_9007; return 0; case VALUESET: - dmuci_get_value_by_section_string((struct uci_section *)data, "encryption", &encryption); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "encryption", &encryption); if (DM_LSTRSTR(encryption, "wpa")) - dmuci_set_value_by_section((struct uci_section *)data, "auth_server", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "auth_server", value); return 0; } return 0; @@ -1956,7 +1937,7 @@ static int set_access_point_security_radius_ip_address(char *refparam, struct dm /*#Device.WiFi.AccessPoint.{i}.Security.RadiusServerPort!UCI:wireless/wifi-iface,@i-1/auth_port*/ static int get_access_point_security_radius_server_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "auth_port", "1812"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "auth_port", "1812"); return 0; } @@ -1970,9 +1951,9 @@ static int set_access_point_security_radius_server_port(char *refparam, struct d return FAULT_9007; return 0; case VALUESET: - dmuci_get_value_by_section_string((struct uci_section *)data, "encryption", &encryption); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "encryption", &encryption); if (DM_LSTRSTR(encryption, "wpa")) - dmuci_set_value_by_section((struct uci_section *)data, "auth_port", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "auth_port", value); return 0; } return 0; @@ -1980,7 +1961,7 @@ static int set_access_point_security_radius_server_port(char *refparam, struct d static int get_access_point_security_radius_secret(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((struct uci_section *)data, "auth_secret", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "auth_secret", value); return 0; } @@ -1994,9 +1975,9 @@ static int set_access_point_security_radius_secret(char *refparam, struct dmctx return FAULT_9007; return 0; case VALUESET: - dmuci_get_value_by_section_string((struct uci_section *)data, "encryption", &encryption); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "encryption", &encryption); if (DM_LSTRSTR(encryption, "wpa")) - dmuci_set_value_by_section((struct uci_section *)data, "auth_secret", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "auth_secret", value); return 0; } return 0; @@ -2005,7 +1986,7 @@ static int set_access_point_security_radius_secret(char *refparam, struct dmctx /*#Device.WiFi.AccessPoint.{i}.Security.MFPConfig!UCI:wireless/wifi-iface,@i-1/ieee80211w*/ static int get_WiFiAccessPointSecurity_MFPConfig(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((struct uci_section *)data, "ieee80211w", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "ieee80211w", value); if (*value[0] == '1') *value = "Optional"; @@ -2087,7 +2068,7 @@ static int set_WiFiAccessPointSecurity_MFPConfig(char *refparam, struct dmctx *c return FAULT_9007; /*Here we also need to validate the encyption algo whether the MFP can be set*/ - if (validate_mfp_config((struct uci_section *)data, value)) + if (validate_mfp_config(((struct dm_data *)data)->config_section, value)) return FAULT_9007; break; @@ -2099,7 +2080,7 @@ static int set_WiFiAccessPointSecurity_MFPConfig(char *refparam, struct dmctx *c else if (DM_LSTRCMP(value, "Required") == 0) buf[0] = '2'; buf[1] = 0; - dmuci_set_value_by_section((struct uci_section *)data, "ieee80211w", buf); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "ieee80211w", buf); break; } return 0; @@ -2108,7 +2089,7 @@ static int set_WiFiAccessPointSecurity_MFPConfig(char *refparam, struct dmctx *c /*#Device.WiFi.AccessPoint.{i}.WPS.Enable!UCI:wireless/wifi-iface,@i-1/wps_pushbutton*/ static int get_WiFiAccessPointWPS_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "wps_pushbutton", "0"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "wps_pushbutton", "0"); return 0; } @@ -2123,7 +2104,7 @@ static int set_WiFiAccessPointWPS_Enable(char *refparam, struct dmctx *ctx, void break; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section((struct uci_section *)data, "wps_pushbutton", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "wps_pushbutton", b ? "1" : "0"); break; } return 0; @@ -2163,7 +2144,7 @@ static int set_WiFiAccessPointWPS_ConfigMethodsEnabled(char *refparam, struct dm static int get_WiFiAccessPointWPS_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { char *wps_status; - dmuci_get_value_by_section_string((struct uci_section *)data, "wps_pushbutton", &wps_status); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "wps_pushbutton", &wps_status); *value = (wps_status[0] == '1') ? "Configured" : "Disabled"; return 0; } @@ -2183,13 +2164,11 @@ static int get_operate_args_WiFiAccessPointWPS_InitiateWPSPBC(char *refparam, st static int operate_WiFiAccessPointWPS_InitiateWPSPBC(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) { + char *ifname = (char *)((struct dm_data *)data)->additional_data; char *status = "Success"; char object[256]; - char *ifname = NULL; int ubus_ret = 0; - dmuci_get_value_by_section_string((struct uci_section *)data, "ifname", &ifname); - if (DM_STRLEN(ifname) == 0) return USP_FAULT_COMMAND_FAILURE; @@ -2205,7 +2184,7 @@ static int operate_WiFiAccessPointWPS_InitiateWPSPBC(char *refparam, struct dmct /*#Device.WiFi.AccessPoint.{i}.Accounting.ServerIPAddr!UCI:wireless/wifi-iface,@i-1/acct_server*/ static int get_WiFiAccessPointAccounting_ServerIPAddr(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((struct uci_section *)data, "acct_server", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "acct_server", value); return 0; } @@ -2217,7 +2196,7 @@ static int set_WiFiAccessPointAccounting_ServerIPAddr(char *refparam, struct dmc return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "acct_server", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "acct_server", value); break; } return 0; @@ -2226,7 +2205,7 @@ static int set_WiFiAccessPointAccounting_ServerIPAddr(char *refparam, struct dmc /*#Device.WiFi.AccessPoint.{i}.Accounting.ServerPort!UCI:wireless/wifi-iface,@i-1/acct_port*/ static int get_WiFiAccessPointAccounting_ServerPort(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "acct_port", "1813"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "acct_port", "1813"); return 0; } @@ -2238,7 +2217,7 @@ static int set_WiFiAccessPointAccounting_ServerPort(char *refparam, struct dmctx return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "acct_port", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "acct_port", value); break; } return 0; @@ -2247,7 +2226,7 @@ static int set_WiFiAccessPointAccounting_ServerPort(char *refparam, struct dmctx /*#Device.WiFi.AccessPoint.{i}.Accounting.Secret!UCI:wireless/wifi-iface,@i-1/acct_secret*/ static int get_WiFiAccessPointAccounting_Secret(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((struct uci_section *)data, "acct_secret", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "acct_secret", value); return 0; } @@ -2259,7 +2238,7 @@ static int set_WiFiAccessPointAccounting_Secret(char *refparam, struct dmctx *ct return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "acct_secret", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "acct_secret", value); break; } return 0; @@ -2268,7 +2247,7 @@ static int set_WiFiAccessPointAccounting_Secret(char *refparam, struct dmctx *ct /*#Device.WiFi.EndPoint.{i}.Enable!UCI:wireless/wifi-iface,@i-1/disabled*/ static int get_WiFiEndPoint_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((((struct wifi_enp_args *)data)->sections)->config_section, "disabled", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "disabled", value); *value = ((*value)[0] == '1') ? "0" : "1"; return 0; } @@ -2283,7 +2262,7 @@ static int set_WiFiEndPoint_Enable(char *refparam, struct dmctx *ctx, void *data break; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section((((struct wifi_enp_args *)data)->sections)->config_section, "disabled", b ? "0" : "1"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "disabled", b ? "0" : "1"); break; } return 0; @@ -2291,26 +2270,23 @@ static int set_WiFiEndPoint_Enable(char *refparam, struct dmctx *ctx, void *data static int get_WiFiEndPoint_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - char *ifname = NULL; - - dmuci_get_value_by_section_string((((struct wifi_enp_args *)data)->sections)->config_section, "ifname", &ifname); - return get_net_device_status(ifname, value); + return get_net_device_status((char *)((struct dm_data *)data)->additional_data, value); } /*#Device.WiFi.EndPoint.{i}.Alias!UCI:dmmap_wireless/wifi-iface,@i-1/endpointalias*/ static int get_WiFiEndPoint_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - return bbf_get_alias(ctx, (((struct wifi_enp_args *)data)->sections)->dmmap_section, "endpointalias", instance, value); + return bbf_get_alias(ctx, ((struct dm_data *)data)->dmmap_section, "endpointalias", instance, value); } static int set_WiFiEndPoint_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) { - return bbf_set_alias(ctx, (((struct wifi_enp_args *)data)->sections)->dmmap_section, "endpointalias", instance, value); + return bbf_set_alias(ctx, ((struct dm_data *)data)->dmmap_section, "endpointalias", instance, value); } static int get_WiFiEndPoint_SSIDReference(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - struct uci_section *iface_s = get_dup_section_in_config_opt("wireless", "wifi-iface", "ifname", ((struct wifi_enp_args *)data)->ifname); + struct uci_section *iface_s = get_dup_section_in_config_opt("wireless", "wifi-iface", "ifname", (char *)((struct dm_data *)data)->additional_data); adm_entry_get_reference_param(ctx, "Device.WiFi.SSID.*.Name", section_name(iface_s), value); return 0; @@ -2321,7 +2297,7 @@ static int get_WiFiEndPointStats_LastDataDownlinkRate(char *refparam, struct dmc json_object *res = NULL; char object[32]; - snprintf(object, sizeof(object), "wifi.backhaul.%s", ((struct wifi_enp_args *)data)->ifname); + snprintf(object, sizeof(object), "wifi.backhaul.%s", (char *)((struct dm_data *)data)->additional_data); dmubus_call(object, "status", UBUS_ARGS{0}, 0, &res); DM_ASSERT(res, *value = "0"); *value = dmjson_get_value(res, 3, "stats", "rx_rate_latest", "rate"); @@ -2333,7 +2309,7 @@ static int get_WiFiEndPointStats_LastDataUplinkRate(char *refparam, struct dmctx json_object *res = NULL; char object[32]; - snprintf(object, sizeof(object), "wifi.backhaul.%s", ((struct wifi_enp_args *)data)->ifname); + snprintf(object, sizeof(object), "wifi.backhaul.%s", (char *)((struct dm_data *)data)->additional_data); dmubus_call(object, "status", UBUS_ARGS{0}, 0, &res); DM_ASSERT(res, *value = "0"); *value = dmjson_get_value(res, 3, "stats", "tx_rate_latest", "rate"); @@ -2345,7 +2321,7 @@ static int get_WiFiEndPointStats_SignalStrength(char *refparam, struct dmctx *ct json_object *res = NULL; char object[32]; - snprintf(object, sizeof(object), "wifi.backhaul.%s", ((struct wifi_enp_args *)data)->ifname); + snprintf(object, sizeof(object), "wifi.backhaul.%s", (char *)((struct dm_data *)data)->additional_data); dmubus_call(object, "status", UBUS_ARGS{0}, 0, &res); DM_ASSERT(res, *value = "0"); *value = dmjson_get_value(res, 1, "rssi"); @@ -2357,7 +2333,7 @@ static int get_WiFiEndPointStats_Retransmissions(char *refparam, struct dmctx *c json_object *res = NULL; char object[32]; - snprintf(object, sizeof(object), "wifi.backhaul.%s", ((struct wifi_enp_args *)data)->ifname); + snprintf(object, sizeof(object), "wifi.backhaul.%s", (char *)((struct dm_data *)data)->additional_data); dmubus_call(object, "status", UBUS_ARGS{0}, 0, &res); DM_ASSERT(res, *value = "0"); *value = dmjson_get_value(res, 2, "stats", "tx_pkts_retries"); @@ -2366,7 +2342,7 @@ static int get_WiFiEndPointStats_Retransmissions(char *refparam, struct dmctx *c static int get_WiFiEndPointSecurity_ModesSupported(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - return get_supported_modes("wifi.backhaul", ((struct wifi_enp_args *)data)->ifname, value); + return get_supported_modes("wifi.backhaul", (char *)((struct dm_data *)data)->additional_data, value); } static int get_WiFiEndPointProfile_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) @@ -2399,7 +2375,7 @@ static int get_dmmap_wireless_section(char *refparam, struct dmctx *ctx, void *d struct uci_section *dmmap_section = NULL, *dm = NULL; char *epinst = NULL; - get_dmmap_section_of_config_section("dmmap_wireless", "wifi-iface", section_name((struct uci_section*)data), &dmmap_section); + get_dmmap_section_of_config_section("dmmap_wireless", "wifi-iface", section_name(((struct dm_data *)data)->config_section), &dmmap_section); dmuci_get_value_by_section_string(dmmap_section, "endpointinstance", &epinst); get_dmmap_section_of_config_section_eq("dmmap_wireless", "ep_profile", "ep_key", epinst, &dm); dmuci_get_value_by_section_string(dm, section_name, value); @@ -2417,7 +2393,7 @@ static int set_dmmap_wireless_section(char *refparam, struct dmctx *ctx, void *d return FAULT_9007; break; case VALUESET: - get_dmmap_section_of_config_section("dmmap_wireless", "wifi-iface", section_name((struct uci_section*)data), &dmmap_section); + get_dmmap_section_of_config_section("dmmap_wireless", "wifi-iface", section_name(((struct dm_data *)data)->config_section), &dmmap_section); dmuci_get_value_by_section_string(dmmap_section, "endpointinstance", &epinst); get_dmmap_section_of_config_section_eq("dmmap_wireless", "ep_profile", "ep_key", epinst, &dm); dmuci_set_value_by_section_bbfdm(dm, section_name, value); @@ -2452,7 +2428,7 @@ static int set_WiFiEndPointProfile_Alias(char *refparam, struct dmctx *ctx, void /*#Device.WiFi.EndPoint.{i}.Profile.{i}.SSID!UCI:wireless/wifi-iface,@i-1/ssid*/ static int get_WiFiEndPointProfile_SSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((struct uci_section*)data, "ssid", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "ssid", value); return 0; } @@ -2464,7 +2440,7 @@ static int set_WiFiEndPointProfile_SSID(char *refparam, struct dmctx *ctx, void return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section((struct uci_section*)data, "ssid", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "ssid", value); break; } return 0; @@ -2473,7 +2449,7 @@ static int set_WiFiEndPointProfile_SSID(char *refparam, struct dmctx *ctx, void /*#Device.WiFi.EndPoint.{i}.Profile.{i}.Security.ModeEnabled!UCI:wireless/wifi-iface,@i-1/encryption*/ static int get_WiFiEndPointProfileSecurity_ModeEnabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = get_security_mode((struct uci_section *)data); + *value = get_security_mode(((struct dm_data *)data)->config_section); return 0; } @@ -2483,7 +2459,7 @@ static int set_WiFiEndPointProfileSecurity_ModeEnabled(char *refparam, struct dm char *supported_modes = NULL; char *multi_ap = NULL; - map_s = find_mapcontroller_section((struct uci_section *)data); + map_s = find_mapcontroller_section(((struct dm_data *)data)->config_section); switch (action) { case VALUECHECK: @@ -2497,13 +2473,13 @@ static int set_WiFiEndPointProfileSecurity_ModeEnabled(char *refparam, struct dm if (!value_exits_in_str_list(supported_modes, ",", value)) return FAULT_9007; - dmuci_get_value_by_section_string((struct uci_section *)data, "multi_ap", &multi_ap); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "multi_ap", &multi_ap); if (DM_STRLEN(multi_ap) && !map_s) return FAULT_9007; return 0; case VALUESET: - set_security_mode((struct uci_section *)data, map_s, value); + set_security_mode(((struct dm_data *)data)->config_section, map_s, value); return 0; } return 0; @@ -2513,10 +2489,10 @@ static int get_WiFiEndPointProfileSecurity_WEPKey(char *refparam, struct dmctx * { char *key_index = NULL, buf[16]; - dmuci_get_value_by_section_string((struct uci_section*)data, "key", &key_index); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "key", &key_index); snprintf(buf, sizeof(buf),"key%s", DM_STRLEN(key_index) ? key_index : "1"); - dmuci_get_value_by_section_string((struct uci_section*)data, buf, value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, buf, value); return 0; } @@ -2530,13 +2506,13 @@ static int set_WiFiEndPointProfileSecurity_WEPKey(char *refparam, struct dmctx * return FAULT_9007; return 0; case VALUESET: - dmuci_get_value_by_section_string((struct uci_section*)data, "encryption", &encryption); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "encryption", &encryption); if (DM_LSTRSTR(encryption, "wep")) { char *key_index = NULL, buf[16]; - dmuci_get_value_by_section_string((struct uci_section*)data, "key", &key_index); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "key", &key_index); snprintf(buf, sizeof(buf),"key%s", DM_STRLEN(key_index) ? key_index : "1"); - dmuci_set_value_by_section((struct uci_section*)data, buf, value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, buf, value); } return 0; } @@ -2545,7 +2521,7 @@ static int set_WiFiEndPointProfileSecurity_WEPKey(char *refparam, struct dmctx * static int get_WiFiEndPointProfileSecurity_PreSharedKey(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((struct uci_section*)data, "key", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "key", value); return 0; } @@ -2559,9 +2535,9 @@ static int set_WiFiEndPointProfileSecurity_PreSharedKey(char *refparam, struct d return FAULT_9007; return 0; case VALUESET: - dmuci_get_value_by_section_string((struct uci_section*)data, "encryption", &encryption); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "encryption", &encryption); if (DM_LSTRSTR(encryption, "psk")) - dmuci_set_value_by_section((struct uci_section*)data, "key", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "key", value); return 0; } return 0; @@ -2569,7 +2545,7 @@ static int set_WiFiEndPointProfileSecurity_PreSharedKey(char *refparam, struct d static int get_WiFiEndPointProfileSecurity_KeyPassphrase(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((struct uci_section*)data, "key", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "key", value); return 0; } @@ -2583,7 +2559,7 @@ static int set_WiFiEndPointProfileSecurity_KeyPassphrase(char *refparam, struct return FAULT_9007; return 0; case VALUESET: - dmuci_get_value_by_section_string((struct uci_section*)data, "encryption", &encryption); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "encryption", &encryption); if (DM_LSTRSTR(encryption, "psk")) set_WiFiEndPointProfileSecurity_PreSharedKey(refparam, ctx, data, instance, value, action); return 0; @@ -2594,7 +2570,7 @@ static int set_WiFiEndPointProfileSecurity_KeyPassphrase(char *refparam, struct /*#Device.WiFi.EndPoint.{i}.Profile.{i}.Security.SAEPassphrase!UCI:wireless/wifi-iface,@i-1/key*/ static int get_WiFiEndPointProfileSecurity_SAEPassphrase(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((struct uci_section*)data, "key", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "key", value); return 0; } @@ -2608,9 +2584,9 @@ static int set_WiFiEndPointProfileSecurity_SAEPassphrase(char *refparam, struct return FAULT_9007; break; case VALUESET: - dmuci_get_value_by_section_string((struct uci_section*)data, "encryption", &encryption); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "encryption", &encryption); if (DM_LSTRSTR(encryption, "sae")) - dmuci_set_value_by_section((struct uci_section*)data, "key", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "key", value); break; } return 0; @@ -2619,7 +2595,7 @@ static int set_WiFiEndPointProfileSecurity_SAEPassphrase(char *refparam, struct /*#Device.WiFi.EndPoint.{i}.Profile.{i}.Security.MFPConfig!UCI:wireless/wifi-iface,@i-1/ieee80211w*/ static int get_WiFiEndPointProfileSecurity_MFPConfig(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((struct uci_section*)data, "ieee80211w", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "ieee80211w", value); if(*value[0] == 0 || *value[0] == '0') *value = "Disabled"; else if (DM_LSTRCMP(*value, "1") == 0) @@ -2638,11 +2614,11 @@ static int set_WiFiEndPointProfileSecurity_MFPConfig(char *refparam, struct dmct break; case VALUESET: if (DM_LSTRCMP(value, "Disabled") == 0) - dmuci_set_value_by_section((struct uci_section*)data, "ieee80211w", "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "ieee80211w", "0"); else if (DM_LSTRCMP(value, "Optional") == 0) - dmuci_set_value_by_section((struct uci_section*)data, "ieee80211w", "1"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "ieee80211w", "1"); else if (DM_LSTRCMP(value, "Required") == 0) - dmuci_set_value_by_section((struct uci_section*)data, "ieee80211w", "2"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "ieee80211w", "2"); break; } return 0; @@ -2651,7 +2627,7 @@ static int set_WiFiEndPointProfileSecurity_MFPConfig(char *refparam, struct dmct /*#Device.WiFi.EndPoint.{i}.WPS.Enable!UCI:wireless/wifi-iface,@i-1/wps_pushbutton*/ static int get_WiFiEndPointWPS_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def((((struct wifi_enp_args *)data)->sections)->config_section, "wps_pushbutton", "0"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "wps_pushbutton", "0"); return 0; } @@ -2666,7 +2642,7 @@ static int set_WiFiEndPointWPS_Enable(char *refparam, struct dmctx *ctx, void *d break; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section((((struct wifi_enp_args *)data)->sections)->config_section, "wps_pushbutton", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "wps_pushbutton", b ? "1" : "0"); break; } return 0; @@ -2706,7 +2682,7 @@ static int set_WiFiEndPointWPS_ConfigMethodsEnabled(char *refparam, struct dmctx static int get_WiFiEndPointWPS_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { char *wps_status; - dmuci_get_value_by_section_string((((struct wifi_enp_args *)data)->sections)->config_section, "wps_pushbutton", &wps_status); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "wps_pushbutton", &wps_status); *value = (wps_status[0] == '1') ? "Configured" : "Disabled"; return 0; } @@ -2717,56 +2693,48 @@ static int get_WiFiEndPointWPS_Status(char *refparam, struct dmctx *ctx, void *d /*#Device.WiFi.Radio.{i}.Alias!UCI:dmmap_wireless/wifi-device,@i-1/radioalias*/ static int get_radio_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - return bbf_get_alias(ctx, (((struct wifi_radio_args *)data)->sections)->dmmap_section, "radioalias", instance, value); + return bbf_get_alias(ctx, ((struct dm_data *)data)->dmmap_section, "radioalias", instance, value); } static int set_radio_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) { - return bbf_set_alias(ctx, (((struct wifi_radio_args *)data)->sections)->dmmap_section, "radioalias", instance, value); + return bbf_set_alias(ctx, ((struct dm_data *)data)->dmmap_section, "radioalias", instance, value); } /*#Device.WiFi.SSID.{i}.Alias!UCI:dmmap_wireless/wifi-iface,@i-1/ssidalias*/ static int get_ssid_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - return bbf_get_alias(ctx, ((struct wifi_ssid_args *)data)->dmmap_s, "ssid_alias", instance, value); + return bbf_get_alias(ctx, ((struct dm_data *)data)->dmmap_section, "ssid_alias", instance, value); } static int set_ssid_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) { - return bbf_set_alias(ctx, ((struct wifi_ssid_args *)data)->dmmap_s, "ssid_alias", instance, value); + return bbf_set_alias(ctx, ((struct dm_data *)data)->dmmap_section, "ssid_alias", instance, value); } /*#Device.WiFi.AccessPoint.{i}.Alias!UCI:dmmap_wireless/wifi-iface,@i-1/ap_alias*/ static int get_access_point_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - struct uci_section *dmmap_s = NULL; - - get_dmmap_section_of_config_section("dmmap_wireless", "wifi-iface", section_name((struct uci_section *)data), &dmmap_s); - - return bbf_get_alias(ctx, dmmap_s, "ap_alias", instance, value); + return bbf_get_alias(ctx, ((struct dm_data *)data)->dmmap_section, "ap_alias", instance, value); } static int set_access_point_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) { - struct uci_section *dmmap_s = NULL; - - get_dmmap_section_of_config_section("dmmap_wireless", "wifi-iface", section_name((struct uci_section *)data), &dmmap_s); - - return bbf_set_alias(ctx, dmmap_s, "ap_alias", instance, value); + return bbf_set_alias(ctx, ((struct dm_data *)data)->dmmap_section, "ssid_alias", instance, value); } static int get_ssid_lower_layer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct wifi_ssid_args *)data)->dmmap_s, "LowerLayers", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->dmmap_section, "LowerLayers", value); if ((*value)[0] == '\0') { char *device = NULL; - dmuci_get_value_by_section_string(((struct wifi_ssid_args *)data)->dmmap_s, "device", &device); + dmuci_get_value_by_section_string(((struct dm_data *)data)->dmmap_section, "device", &device); adm_entry_get_reference_param(ctx, "Device.WiFi.Radio.*.Name", device, value); // Store LowerLayers value - dmuci_set_value_by_section(((struct wifi_ssid_args *)data)->dmmap_s, "LowerLayers", *value); + dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "LowerLayers", *value); } else { if (!adm_entry_object_exists(ctx, *value)) *value = ""; @@ -2793,12 +2761,12 @@ static int set_ssid_lower_layer(char *refparam, struct dmctx *ctx, void *data, c return 0; case VALUESET: // Store LowerLayers value under dmmap section - dmuci_set_value_by_section(((struct wifi_ssid_args *)data)->dmmap_s, "LowerLayers", reference.path); + dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "LowerLayers", reference.path); - dmuci_set_value_by_section(((struct wifi_ssid_args *)data)->dmmap_s, "device", reference.value); + dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "device", reference.value); - if (((struct wifi_ssid_args *)data)->config_s) - dmuci_set_value_by_section(((struct wifi_ssid_args *)data)->config_s, "device", reference.value); + if (((struct dm_data *)data)->config_section) + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "device", reference.value); return 0; } @@ -2807,17 +2775,13 @@ static int set_ssid_lower_layer(char *refparam, struct dmctx *ctx, void *data, c static int get_ap_ssid_ref(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - struct uci_section *dmmap_s = NULL; - - get_dmmap_section_of_config_section("dmmap_wireless", "wifi-iface", section_name((struct uci_section *)data), &dmmap_s); - - dmuci_get_value_by_section_string(dmmap_s, "LowerLayers", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->dmmap_section, "LowerLayers", value); if ((*value)[0] == '\0') { - adm_entry_get_reference_param(ctx, "Device.WiFi.SSID.*.Name", section_name((struct uci_section *)data), value); + adm_entry_get_reference_param(ctx, "Device.WiFi.SSID.*.Name", section_name(((struct dm_data *)data)->config_section), value); // Store LowerLayers value - dmuci_set_value_by_section(dmmap_s, "LowerLayers", *value); + dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "LowerLayers", *value); } else { if (!adm_entry_object_exists(ctx, *value)) *value = ""; @@ -2829,7 +2793,7 @@ static int get_ap_ssid_ref(char *refparam, struct dmctx *ctx, void *data, char * static int set_ap_ssid_ref(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) { char *allowed_objects[] = {"Device.WiFi.SSID.", NULL}; - struct uci_section *ss = NULL, *dmmap_s = NULL; + struct uci_section *ss = NULL; struct dm_reference reference = {0}; bbf_get_reference_args(value, &reference); @@ -2844,20 +2808,18 @@ static int set_ap_ssid_ref(char *refparam, struct dmctx *ctx, void *data, char * break; case VALUESET: - get_dmmap_section_of_config_section("dmmap_wireless", "wifi-iface", section_name((struct uci_section *)data), &dmmap_s); - // Store LowerLayers value under dmmap_wireless section - dmuci_set_value_by_section(dmmap_s, "LowerLayers", reference.path); + dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "LowerLayers", reference.path); if (DM_STRLEN(reference.value)) { char *device = NULL, *ssid = NULL, *enabled = NULL; - ss = get_dup_section_in_dmmap_opt("dmmap_wireless", "ssid", "ap_section_name", section_name((struct uci_section *)data)); + ss = get_dup_section_in_dmmap_opt("dmmap_wireless", "ssid", "ap_section_name", section_name(((struct dm_data *)data)->config_section)); if (ss == NULL) { ss = get_dup_section_in_dmmap_opt("dmmap_wireless", "ssid", "name", reference.value); } - dmuci_set_value_by_section(ss, "ap_section_name", section_name((struct uci_section *)data)); + dmuci_set_value_by_section(ss, "ap_section_name", section_name(((struct dm_data *)data)->config_section)); dmuci_get_value_by_section_string(ss, "device", &device); dmuci_get_value_by_section_string(ss, "ssid", &ssid); @@ -2865,15 +2827,15 @@ static int set_ap_ssid_ref(char *refparam, struct dmctx *ctx, void *data, char * bool b = dmuci_string_to_boolean(enabled); - dmuci_set_value_by_section((struct uci_section *)data, "ssid", ssid); - dmuci_set_value_by_section((struct uci_section *)data, "device", device); - dmuci_set_value_by_section((struct uci_section *)data, "disabled", b ? "0" : "1"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "ssid", ssid); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "device", device); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "disabled", b ? "0" : "1"); } else { - ss = get_dup_section_in_dmmap_opt("dmmap_wireless", "ssid", "ap_section_name", section_name((struct uci_section *)data)); + ss = get_dup_section_in_dmmap_opt("dmmap_wireless", "ssid", "ap_section_name", section_name(((struct dm_data *)data)->config_section)); dmuci_set_value_by_section(ss, "ap_section_name", ""); - dmuci_set_value_by_section((struct uci_section *)data, "ssid", ""); - dmuci_set_value_by_section((struct uci_section *)data, "device", ""); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "ssid", ""); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "device", ""); } break; } @@ -2906,31 +2868,31 @@ static int get_wlan_bssid(char *refparam, struct dmctx *ctx, void *data, char *i json_object *res = NULL; char object[32]; - snprintf(object, sizeof(object), "wifi.ap.%s", ((struct wifi_ssid_args *)data)->ifname); + snprintf(object, sizeof(object), "wifi.ap.%s", (char *)((struct dm_data *)data)->additional_data); dmubus_call(object, "status", UBUS_ARGS{0}, 0, &res); DM_ASSERT(res, *value = ""); *value = dmjson_get_value(res, 1, "bssid"); return 0; } -static int ssid_read_ubus(const struct wifi_ssid_args *args, const char *name, char **value) +static int ssid_read_ubus(const struct dm_data *args, const char *name, char **value) { json_object *res = NULL; char object[32]; - snprintf(object, sizeof(object), "wifi.ap.%s", args->ifname); + snprintf(object, sizeof(object), "wifi.ap.%s", (char *)args->additional_data); dmubus_call(object, "stats", UBUS_ARGS{0}, 0, &res); DM_ASSERT(res, *value = "0"); *value = dmjson_get_value(res, 1, name); return 0; } -static int radio_read_ubus(const struct wifi_radio_args *args, const char *name, char **value) +static int radio_read_ubus(const struct dm_data *args, const char *name, char **value) { json_object *res = NULL; char object[UBUS_OBJ_LEN]; - snprintf(object, sizeof(object), "wifi.radio.%s", section_name(args->sections->config_section)); + snprintf(object, sizeof(object), "wifi.radio.%s", section_name(args->config_section)); dmubus_call(object, "stats", UBUS_ARGS{0}, 0, &res); DM_ASSERT(res, *value = "0"); *value = dmjson_get_value(res, 1, name); @@ -2943,7 +2905,7 @@ static int get_WiFiRadioStats_Noise(char *refparam, struct dmctx *ctx, void *dat json_object *res = NULL; char object[UBUS_OBJ_LEN]; - snprintf(object, sizeof(object), "wifi.radio.%s", section_name((((struct wifi_radio_args *)data)->sections)->config_section)); + snprintf(object, sizeof(object), "wifi.radio.%s", section_name(((struct dm_data *)data)->config_section)); dmubus_call(object, "status", UBUS_ARGS{0}, 0, &res); DM_ASSERT(res, *value = "255"); *value = dmjson_get_value(res, 1, "noise"); @@ -3139,21 +3101,21 @@ static int get_WiFiAccessPointAssociatedDevice_Active(char *refparam, struct dmc /*#Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}.Noise!UBUS:wifi.ap.@Name/stations//stations[i-1].noise*/ static int get_WiFiAccessPointAssociatedDevice_Noise(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "noise"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "noise"); return 0; } /*#Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}.MACAddress!UBUS:wifi.ap.@Name/stations//stations[i-1].macaddr*/ static int get_WiFiAccessPointAssociatedDevice_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "macaddr"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "macaddr"); return 0; } /*#Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}.LastDataDownlinkRate!UBUS:wifi.ap.@Name/stations//stations[i-1].stats.rx_rate_latest.rate*/ static int get_WiFiAccessPointAssociatedDevice_LastDataDownlinkRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - char *rate_mbps = dmjson_get_value((json_object *)data, 3, "stats", "rx_rate_latest", "rate"); + char *rate_mbps = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "stats", "rx_rate_latest", "rate"); float rate_kbps = (rate_mbps && *rate_mbps != '\0') ? atof(rate_mbps) * 1000 : 1000; dmasprintf(value, "%u", (unsigned int)rate_kbps); @@ -3163,7 +3125,7 @@ static int get_WiFiAccessPointAssociatedDevice_LastDataDownlinkRate(char *refpar /*#Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}.LastDataUplinkRate!UBUS:wifi.ap.@Name/stations//stations[i-1].stats.tx_rate_latest.rate*/ static int get_WiFiAccessPointAssociatedDevice_LastDataUplinkRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - char *rate_mbps = dmjson_get_value((json_object *)data, 3, "stats", "tx_rate_latest", "rate"); + char *rate_mbps = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "stats", "tx_rate_latest", "rate"); float rate_kbps = (rate_mbps && *rate_mbps != '\0') ? atof(rate_mbps) * 1000 : 1000; dmasprintf(value, "%u", (unsigned int)rate_kbps); @@ -3173,7 +3135,7 @@ static int get_WiFiAccessPointAssociatedDevice_LastDataUplinkRate(char *refparam /*#Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}.SignalStrength!UBUS:wifi.ap.@Name/stations//stations[i-1].rssi*/ static int get_WiFiAccessPointAssociatedDevice_SignalStrength(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "rssi"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "rssi"); return 0; } @@ -3182,7 +3144,7 @@ static int get_WiFiAccessPointAssociatedDevice_AssociationTime(char *refparam, s { *value = "0001-01-01T00:00:00Z"; - char *in_network = dmjson_get_value((json_object *)data, 1, "in_network"); + char *in_network = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "in_network"); if (in_network && *in_network != '\0' && DM_STRTOL(in_network) > 0) { time_t t_time = time(NULL) - DM_STRTOL(in_network); if (gmtime(&t_time) == NULL) @@ -3201,49 +3163,49 @@ static int get_WiFiAccessPointAssociatedDevice_AssociationTime(char *refparam, s /*#Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}.Stats.BytesSent!UBUS:wifi.ap.@Name/stations//stations[i-1].stats.tx_total_bytes*/ static int get_access_point_associative_device_statistics_tx_bytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 2, "stats", "tx_total_bytes"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 2, "stats", "tx_total_bytes"); return 0; } /*#Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}.Stats.BytesReceived!UBUS:wifi.ap.@Name/stations//stations[i-1].stats.rx_data_bytes*/ static int get_access_point_associative_device_statistics_rx_bytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 2, "stats", "rx_data_bytes"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 2, "stats", "rx_data_bytes"); return 0; } /*#Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}.Stats.PacketsSent!UBUS:wifi.ap.@Name/stations//stations[i-1].stats.tx_total_pkts*/ static int get_access_point_associative_device_statistics_tx_packets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 2, "stats", "tx_total_pkts"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 2, "stats", "tx_total_pkts"); return 0; } /*#Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}.Stats.PacketsReceived!UBUS:wifi.ap.@Name/stations//stations[i-1].stats.rx_data_pkts*/ static int get_access_point_associative_device_statistics_rx_packets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 2, "stats", "rx_data_pkts"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 2, "stats", "rx_data_pkts"); return 0; } /*#Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}.Stats.ErrorsSent!UBUS:wifi.ap.@Name/stations//stations[i-1].stats.tx_failures*/ static int get_access_point_associative_device_statistics_tx_errors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 2, "stats", "tx_failures"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 2, "stats", "tx_failures"); return 0; } /*#Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}.Stats.RetransCount!UBUS:wifi.ap.@Name/stations//stations[i-1].stats.tx_pkts_retries*/ static int get_access_point_associative_device_statistics_retrans_count(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 2, "stats", "tx_pkts_retries"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 2, "stats", "tx_pkts_retries"); return 0; } /*#Device.WiFi.AccessPoint.{i}.Enable!UCI:wireless/wifi-iface,@i-1/disabled*/ static int get_access_point_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((struct uci_section *)data, "disabled", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "disabled", value); *value = ((*value)[0] == '1') ? "0" : "1"; return 0; } @@ -3254,14 +3216,14 @@ static int set_access_point_enable(char *refparam, struct dmctx *ctx, void *data char *multi_ap = NULL; bool b; - map_s = find_mapcontroller_section((struct uci_section *)data); + map_s = find_mapcontroller_section(((struct dm_data *)data)->config_section); switch (action) { case VALUECHECK: if (bbfdm_validate_boolean(ctx, value)) return FAULT_9007; - dmuci_get_value_by_section_string((struct uci_section *)data, "multi_ap", &multi_ap); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "multi_ap", &multi_ap); if (DM_STRLEN(multi_ap) && !map_s) return FAULT_9007; @@ -3270,7 +3232,7 @@ static int set_access_point_enable(char *refparam, struct dmctx *ctx, void *data string_to_bool(value, &b); // wireless config: Update disabled option - dmuci_set_value_by_section((struct uci_section *)data, "disabled", b ? "0" : "1"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "disabled", b ? "0" : "1"); // mapcontroller config: Update the corresponding ap section if exists if (map_s) @@ -3285,11 +3247,9 @@ static int set_access_point_enable(char *refparam, struct dmctx *ctx, void *data static int get_wifi_access_point_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { json_object *res = NULL; - char object[32], *ifname = NULL, *status = NULL; + char object[32], *status = NULL; - dmuci_get_value_by_section_string((struct uci_section *)data, "ifname", &ifname); - - snprintf(object, sizeof(object), "wifi.ap.%s", ifname); + snprintf(object, sizeof(object), "wifi.ap.%s", (char *)((struct dm_data *)data)->additional_data); dmubus_call(object, "status", UBUS_ARGS{0}, 0, &res); DM_ASSERT(res, *value = "Disabled"); status = dmjson_get_value(res, 1, "status"); @@ -3307,7 +3267,7 @@ static int get_radio_max_bit_rate (char *refparam, struct dmctx *ctx, void *data json_object *res = NULL; char object[UBUS_OBJ_LEN]; - snprintf(object, sizeof(object), "wifi.radio.%s", section_name((((struct wifi_radio_args *)data)->sections)->config_section)); + snprintf(object, sizeof(object), "wifi.radio.%s", section_name(((struct dm_data *)data)->config_section)); dmubus_call(object, "status", UBUS_ARGS{0}, 0, &res); DM_ASSERT(res, *value = "0"); *value = dmjson_get_value(res, 1, "maxrate"); @@ -3320,7 +3280,7 @@ static int get_radio_supported_frequency_bands(char *refparam, struct dmctx *ctx json_object *res = NULL; char object[UBUS_OBJ_LEN]; - snprintf(object, sizeof(object), "wifi.radio.%s", section_name((((struct wifi_radio_args *)data)->sections)->config_section)); + snprintf(object, sizeof(object), "wifi.radio.%s", section_name(((struct dm_data *)data)->config_section)); dmubus_call(object, "status", UBUS_ARGS{0}, 0, &res); DM_ASSERT(res, *value = ""); *value = dmjson_get_value_array_all(res, ",", 1, "supp_bands"); @@ -3333,7 +3293,7 @@ static int get_radio_frequency(char *refparam, struct dmctx *ctx, void *data, ch json_object *res = NULL; char object[UBUS_OBJ_LEN]; - snprintf(object, sizeof(object), "wifi.radio.%s", section_name((((struct wifi_radio_args *)data)->sections)->config_section)); + snprintf(object, sizeof(object), "wifi.radio.%s", section_name(((struct dm_data *)data)->config_section)); dmubus_call(object, "status", UBUS_ARGS{0}, 0, &res); DM_ASSERT(res, *value = ""); *value = dmjson_get_value(res, 1, "band"); @@ -3361,7 +3321,7 @@ static int set_radio_frequency(char *refparam, struct dmctx *ctx, void *data, ch break; case VALUESET: - dmuci_set_value_by_section((((struct wifi_radio_args *)data)->sections)->config_section, "band", (value[0] == '6') ? "6g" : (value[0] == '5') ? "5g" : "2g"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "band", (value[0] == '6') ? "6g" : (value[0] == '5') ? "5g" : "2g"); break; } return 0; @@ -3385,72 +3345,72 @@ static int get_neighboring_wifi_diagnostics_result_number_entries(char *refparam /*#Device.WiFi.NeighboringWiFiDiagnostic.Result.{i}.SSID!UBUS:wifi.radio.@Name/scanresults//accesspoints[@i-1].ssid*/ static int get_neighboring_wifi_diagnostics_result_ssid(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((struct uci_section *)data, "ssid", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "ssid", value); return 0; } /*#Device.WiFi.NeighboringWiFiDiagnostic.Result.{i}.BSSID!UBUS:wifi.radio.@Name/scanresults//accesspoints[@i-1].bssid*/ static int get_neighboring_wifi_diagnostics_result_bssid(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((struct uci_section *)data, "bssid", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "bssid", value); return 0; } /*#Device.WiFi.NeighboringWiFiDiagnostic.Result.{i}.Channel!UBUS:wifi.radio.@Name/scanresults//accesspoints[@i-1].channel*/ static int get_neighboring_wifi_diagnostics_result_channel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((struct uci_section *)data, "channel", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "channel", value); return 0; } /*#Device.WiFi.NeighboringWiFiDiagnostic.Result.{i}.SignalStrength!UBUS:wifi.radio.@Name/scanresults//accesspoints[@i-1].rssi*/ static int get_neighboring_wifi_diagnostics_result_signal_strength(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((struct uci_section *)data, "rssi", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "rssi", value); return 0; } /*#Device.WiFi.NeighboringWiFiDiagnostic.Result.{i}.OperatingFrequencyBand!UBUS:wifi.radio.@Name/scanresults//accesspoints[@i-1].band*/ static int get_neighboring_wifi_diagnostics_result_operating_frequency_band(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((struct uci_section *)data, "band", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "band", value); return 0; } /*#Device.WiFi.NeighboringWiFiDiagnostic.Result.{i}.Noise!UBUS:wifi.radio.@Name/scanresults//accesspoints[@i-1].noise*/ static int get_neighboring_wifi_diagnostics_result_noise(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((struct uci_section *)data, "noise", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "noise", value); return 0; } static int get_neighboring_wifi_diagnostics_result_radio(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((struct uci_section *)data, "radio", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "radio", value); return 0; } static int get_neighboring_wifi_diagnostics_result_operating_ch_band(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((struct uci_section *)data, "bandwidth", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "bandwidth", value); return 0; } static int get_neighboring_wifi_diagnostics_result_op_std(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((struct uci_section *)data, "standard", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "standard", value); return 0; } static int get_neighboring_wifi_diagnostics_result_sec_mode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((struct uci_section *)data, "encryption", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "encryption", value); return 0; } static int get_neighboring_wifi_diagnostics_result_enc_mode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((struct uci_section *)data, "ciphers", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "ciphers", value); return 0; } @@ -3460,7 +3420,7 @@ static int get_WiFiRadio_CurrentOperatingChannelBandwidth(char *refparam, struct json_object *res = NULL; char object[32]; - snprintf(object, sizeof(object), "wifi.radio.%s", section_name((((struct wifi_radio_args *)data)->sections)->config_section)); + snprintf(object, sizeof(object), "wifi.radio.%s", section_name(((struct dm_data *)data)->config_section)); dmubus_call(object, "status", UBUS_ARGS{0}, 0, &res); DM_ASSERT(res, *value = "20MHz"); *value = get_data_model_band(dmjson_get_value(res, 1, "bandwidth")); @@ -3475,7 +3435,7 @@ static int get_radio_supported_standard(char *refparam, struct dmctx *ctx, void char *supp_std = NULL; unsigned pos = 0, idx = 0; - snprintf(object, sizeof(object), "wifi.radio.%s", section_name((((struct wifi_radio_args *)data)->sections)->config_section)); + snprintf(object, sizeof(object), "wifi.radio.%s", section_name(((struct dm_data *)data)->config_section)); dmubus_call(object, "status", UBUS_ARGS{0}, 0, &res); DM_ASSERT(res, *value = "n,ax"); @@ -3497,7 +3457,7 @@ static int get_radio_operating_standard(char *refparam, struct dmctx *ctx, void json_object *res = NULL; char object[UBUS_OBJ_LEN] = {0}; - snprintf(object, sizeof(object), "wifi.radio.%s", section_name((((struct wifi_radio_args *)data)->sections)->config_section)); + snprintf(object, sizeof(object), "wifi.radio.%s", section_name(((struct dm_data *)data)->config_section)); dmubus_call(object, "status", UBUS_ARGS{0}, 0, &res); DM_ASSERT(res, *value = "n,ax"); *value = get_data_model_standard(dmjson_get_value(res, 1, "standard")); @@ -3531,7 +3491,7 @@ static int set_radio_operating_standard(char *refparam, struct dmctx *ctx, void break; case VALUESET: - bandwidth = get_radio_option_nocache(section_name((((struct wifi_radio_args *)data)->sections)->config_section), "bandwidth"); + bandwidth = get_radio_option_nocache(section_name(((struct dm_data *)data)->config_section), "bandwidth"); if (DM_STRLEN(bandwidth) == 0) bandwidth = "20"; @@ -3546,7 +3506,7 @@ static int set_radio_operating_standard(char *refparam, struct dmctx *ctx, void else snprintf(htmode, sizeof(htmode), "NOHT"); - dmuci_set_value_by_section((((struct wifi_radio_args *)data)->sections)->config_section, "htmode", htmode); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "htmode", htmode); break; } return 0; @@ -3914,9 +3874,9 @@ end: static int operate_WiFiAccessPointSecurity_Reset(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) { - dmuci_set_value_by_section((struct uci_section *)data, "encryption", "psk"); - dmuci_set_value_by_section((struct uci_section *)data, "key", get_default_wpa_key()); - dmuci_set_value_by_section((struct uci_section *)data, "wps_pushbutton", "1"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "encryption", "psk"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "key", get_default_wpa_key()); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "wps_pushbutton", "1"); return 0; } diff --git a/libbbfdm/dmtree/tr181/wifi.dataelements.c b/libbbfdm/dmtree/tr181/wifi.dataelements.c index 21e3fbad..1419a113 100644 --- a/libbbfdm/dmtree/tr181/wifi.dataelements.c +++ b/libbbfdm/dmtree/tr181/wifi.dataelements.c @@ -11,36 +11,17 @@ #include "wifi.dataelements.h" -struct wifi_data_element_args -{ - struct json_object *dump_obj; - struct uci_section *uci_s; -}; - -struct wifi_event_args -{ - struct json_object *event_obj; - char *event_time; -}; - -struct wifi_ap_fronthaul_args -{ - char *ssid; - char *band_list; -}; - /************************************************************* * COMMON FUNCTIONS **************************************************************/ -static bool is_ssid_exists(const char *sec_name, const char *ssid, char **band_list) +static bool is_ssid_exists(struct dm_data *data, const char *ssid) { struct uci_section *s = NULL; + const char *sec_name = section_name(data->config_section); char *curr_ssid = NULL; char buf[256] = {0}; unsigned pos = 0; - *band_list = NULL; - if (DM_STRLEN(sec_name) == 0 || DM_STRLEN(ssid) == 0) return false; @@ -80,7 +61,7 @@ static bool is_ssid_exists(const char *sec_name, const char *ssid, char **band_l if (pos) buf[pos - 1] = 0; - *band_list = dmstrdup(buf); + data->additional_data = (void *)dmstrdup(buf); return false; } @@ -111,44 +92,39 @@ static int delObjWiFiDataElementsNetworkDeviceRadioDisAllowedOpClassChannels(cha **************************************************************/ static int browseWiFiDataElementsNetworkSSIDInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - struct wifi_ap_fronthaul_args curr_wifi_ap_fronthaul_args = {0}; - struct dmmap_dup *p = NULL; + struct dm_data *curr_data = NULL; char *inst = NULL; - char *band_list = NULL; LIST_HEAD(dup_list); synchronize_specific_config_sections_with_dmmap("mapcontroller", "ap", "dmmap_mapcontroller", &dup_list); - list_for_each_entry(p, &dup_list, list) { + list_for_each_entry(curr_data, &dup_list, list) { char *type = NULL; char *enabled = NULL; char *ssid = NULL; bool b = false; - dmuci_get_value_by_section_string(p->config_section, "type", &type); + dmuci_get_value_by_section_string(curr_data->config_section, "type", &type); if (DM_LSTRCMP(type, "fronthaul") != 0) continue; // skip the disabled fronthaul interfaces - dmuci_get_value_by_section_string(p->config_section, "enabled", &enabled); + dmuci_get_value_by_section_string(curr_data->config_section, "enabled", &enabled); if (DM_STRLEN(enabled)) { string_to_bool(enabled, &b); if (b == false) continue; } - dmuci_get_value_by_section_string(p->config_section, "ssid", &ssid); + dmuci_get_value_by_section_string(curr_data->config_section, "ssid", &ssid); if (DM_STRLEN(ssid) == 0) continue; - if (is_ssid_exists(section_name(p->config_section), ssid, &band_list)) + if (is_ssid_exists(curr_data, ssid)) continue; - curr_wifi_ap_fronthaul_args.ssid = ssid; - curr_wifi_ap_fronthaul_args.band_list = band_list; + inst = handle_instance(dmctx, parent_node, curr_data->dmmap_section, "wifi_da_ssid_instance", "wifi_da_ssid_alias"); - inst = handle_instance(dmctx, parent_node, p->dmmap_section, "wifi_da_ssid_instance", "wifi_da_ssid_alias"); - - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_wifi_ap_fronthaul_args, inst) == DM_STOP) + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)curr_data, inst) == DM_STOP) break; } free_dmmap_config_dup_list(&dup_list); @@ -191,17 +167,14 @@ static struct uci_section *find_radio_uci_section(char *agent_id, char *unique_k static int browseWiFiDataElementsNetworkDeviceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - struct wifi_data_element_args wifi_da_device_args = {0}; - json_object *data_arr = NULL; - json_object *data_obj = NULL; - json_object *res = NULL; + json_object *data_arr = NULL, *data_obj = NULL, *res = NULL; + struct dm_data curr_data = {0}; char *inst = NULL; int i = 0, id = 0; dmubus_call("wifi.dataelements.collector", "dump2", UBUS_ARGS{0}, 0, &res); dmjson_foreach_obj_in_array(res, data_arr, data_obj, i, 1, "data") { - json_object *dev_arr = NULL; - json_object *dev_obj = NULL; + json_object *dev_arr = NULL, *dev_obj = NULL; int j = 0; dmjson_foreach_obj_in_array(data_obj, dev_arr, dev_obj, j, 2, "wfa-dataelements:Network", "DeviceList") { @@ -210,12 +183,12 @@ static int browseWiFiDataElementsNetworkDeviceInst(struct dmctx *dmctx, DMNODE * if (!key || *key == '\0') continue; - wifi_da_device_args.dump_obj = dev_obj; - wifi_da_device_args.uci_s = find_device_uci_section(key); + curr_data.json_object = dev_obj; + curr_data.config_section = find_device_uci_section(key); inst = handle_instance_without_section(dmctx, parent_node, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&wifi_da_device_args, inst) == DM_STOP) + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP) return 0; } } @@ -231,14 +204,18 @@ static int browseWiFiDataElementsNetworkDeviceDefault8021QInst(struct dmctx *dmc static int browseWiFiDataElementsNetworkDeviceSSIDtoVIDMappingInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - json_object *wifi_da_device_dump2 = ((struct wifi_data_element_args *)prev_data)->dump_obj; json_object *ssid_to_vid_arr = NULL, *ssid_to_vid_obj = NULL; + struct dm_data curr_data = {0}; char *inst = NULL; int id = 0, i = 0; - dmjson_foreach_obj_in_array(wifi_da_device_dump2, ssid_to_vid_arr, ssid_to_vid_obj, i, 1, "SSIDtoVIDMapping") { + dmjson_foreach_obj_in_array(((struct dm_data *)prev_data)->json_object, ssid_to_vid_arr, ssid_to_vid_obj, i, 1, "SSIDtoVIDMapping") { + + curr_data.json_object = ssid_to_vid_obj; + inst = handle_instance_without_section(dmctx, parent_node, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)ssid_to_vid_obj, inst) == DM_STOP) + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP) break; } return 0; @@ -246,14 +223,18 @@ static int browseWiFiDataElementsNetworkDeviceSSIDtoVIDMappingInst(struct dmctx static int browseWiFiDataElementsNetworkDeviceCACStatusInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - json_object *wifi_da_device_dump2 = ((struct wifi_data_element_args *)prev_data)->dump_obj; json_object *cac_status_arr = NULL, *cac_status_obj = NULL; + struct dm_data curr_data = {0}; char *inst = NULL; int id = 0, i = 0; - dmjson_foreach_obj_in_array(wifi_da_device_dump2, cac_status_arr, cac_status_obj, i, 1, "CACStatus") { + dmjson_foreach_obj_in_array(((struct dm_data *)prev_data)->json_object, cac_status_arr, cac_status_obj, i, 1, "CACStatus") { + + curr_data.json_object = cac_status_obj; + inst = handle_instance_without_section(dmctx, parent_node, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)cac_status_obj, inst) == DM_STOP) + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP) break; } return 0; @@ -261,14 +242,18 @@ static int browseWiFiDataElementsNetworkDeviceCACStatusInst(struct dmctx *dmctx, static int browseWiFiDataElementsNetworkDeviceIEEE1905SecurityInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - json_object *wifi_da_device_dump2 = ((struct wifi_data_element_args *)prev_data)->dump_obj; json_object *ieee1905_security_arr = NULL, *ieee1905_security_obj = NULL; + struct dm_data curr_data = {0}; char *inst = NULL; int id = 0, i = 0; - dmjson_foreach_obj_in_array(wifi_da_device_dump2, ieee1905_security_arr, ieee1905_security_obj, i, 1, "IEEE1905Security") { + dmjson_foreach_obj_in_array(((struct dm_data *)prev_data)->json_object, ieee1905_security_arr, ieee1905_security_obj, i, 1, "IEEE1905Security") { + + curr_data.json_object = ieee1905_security_obj; + inst = handle_instance_without_section(dmctx, parent_node, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)ieee1905_security_obj, inst) == DM_STOP) + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP) break; } return 0; @@ -277,15 +262,14 @@ static int browseWiFiDataElementsNetworkDeviceIEEE1905SecurityInst(struct dmctx static int browseWiFiDataElementsNetworkDeviceRadioInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - struct wifi_data_element_args *wifi_da_device = (struct wifi_data_element_args *)prev_data; - struct wifi_data_element_args wifi_da_radio_args = {0}; struct json_object *radio_arr = NULL, *radio_obj = NULL; + struct dm_data curr_data = {0}; char *inst = NULL; int i = 0, id = 0; - char *agent_id = dmjson_get_value(wifi_da_device->dump_obj, 1, "ID"); + char *agent_id = dmjson_get_value(((struct dm_data *)prev_data)->json_object, 1, "ID"); - dmjson_foreach_obj_in_array(wifi_da_device->dump_obj, radio_arr, radio_obj, i, 1, "RadioList") { + dmjson_foreach_obj_in_array(((struct dm_data *)prev_data)->json_object, radio_arr, radio_obj, i, 1, "RadioList") { char mac[32] = {0}; char *radio_id = dmjson_get_value(radio_obj, 1, "ID"); @@ -299,12 +283,12 @@ static int browseWiFiDataElementsNetworkDeviceRadioInst(struct dmctx *dmctx, DMN if (DM_STRLEN(mac) == 0) continue; - wifi_da_radio_args.dump_obj = radio_obj; - wifi_da_radio_args.uci_s = find_radio_uci_section(agent_id, mac); + curr_data.json_object = radio_obj; + curr_data.config_section = find_radio_uci_section(agent_id, mac); inst = handle_instance_without_section(dmctx, parent_node, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&wifi_da_radio_args, inst) == DM_STOP) + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP) return 0; } @@ -314,12 +298,17 @@ static int browseWiFiDataElementsNetworkDeviceRadioInst(struct dmctx *dmctx, DMN static int browseWiFiDataElementsNetworkDeviceCACStatusCACAvailableChannelInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { json_object *cac_available_channel_arr = NULL, *cac_available_channel_obj = NULL; + struct dm_data curr_data = {0}; char *inst = NULL; int id = 0, i = 0; - dmjson_foreach_obj_in_array((json_object *)prev_data, cac_available_channel_arr, cac_available_channel_obj, i, 1, "CACAvailableChannel") { + dmjson_foreach_obj_in_array(((struct dm_data *)prev_data)->json_object, cac_available_channel_arr, cac_available_channel_obj, i, 1, "CACAvailableChannel") { + + curr_data.json_object = cac_available_channel_obj; + inst = handle_instance_without_section(dmctx, parent_node, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)cac_available_channel_obj, inst) == DM_STOP) + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP) break; } return 0; @@ -328,12 +317,17 @@ static int browseWiFiDataElementsNetworkDeviceCACStatusCACAvailableChannelInst(s static int browseWiFiDataElementsNetworkDeviceCACStatusCACNonOccupancyChannelInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { json_object *cac_non_occupancy_channel_arr = NULL, *cac_non_occupancy_channel_obj = NULL; + struct dm_data curr_data = {0}; char *inst = NULL; int id = 0, i = 0; - dmjson_foreach_obj_in_array((json_object *)prev_data, cac_non_occupancy_channel_arr, cac_non_occupancy_channel_obj, i, 1, "CACNonOccupancyChannel") { + dmjson_foreach_obj_in_array(((struct dm_data *)prev_data)->json_object, cac_non_occupancy_channel_arr, cac_non_occupancy_channel_obj, i, 1, "CACNonOccupancyChannel") { + + curr_data.json_object = cac_non_occupancy_channel_obj; + inst = handle_instance_without_section(dmctx, parent_node, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)cac_non_occupancy_channel_obj, inst) == DM_STOP) + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP) break; } return 0; @@ -342,12 +336,17 @@ static int browseWiFiDataElementsNetworkDeviceCACStatusCACNonOccupancyChannelIns static int browseWiFiDataElementsNetworkDeviceCACStatusCACActiveChannelInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { json_object *cac_active_channel_arr = NULL, *cac_active_channel_obj = NULL; + struct dm_data curr_data = {0}; char *inst = NULL; int id = 0, i = 0; - dmjson_foreach_obj_in_array((json_object *)prev_data, cac_active_channel_arr, cac_active_channel_obj, i, 1, "CACActiveChannel") { + dmjson_foreach_obj_in_array(((struct dm_data *)prev_data)->json_object, cac_active_channel_arr, cac_active_channel_obj, i, 1, "CACActiveChannel") { + + curr_data.json_object = cac_active_channel_obj; + inst = handle_instance_without_section(dmctx, parent_node, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)cac_active_channel_obj, inst) == DM_STOP) + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP) break; } return 0; @@ -355,14 +354,18 @@ static int browseWiFiDataElementsNetworkDeviceCACStatusCACActiveChannelInst(stru static int browseWiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfileInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - json_object *wifi_da_radio = ((struct wifi_data_element_args *)prev_data)->dump_obj; json_object *opclass_arr = NULL, *opclass_obj = NULL; + struct dm_data curr_data = {0}; char *inst = NULL; int id = 0, i = 0; - dmjson_foreach_obj_in_array(wifi_da_radio, opclass_arr, opclass_obj, i, 1, "CurrentOperatingClassProfile") { + dmjson_foreach_obj_in_array(((struct dm_data *)prev_data)->json_object, opclass_arr, opclass_obj, i, 1, "CurrentOperatingClassProfile") { + + curr_data.json_object = opclass_obj; + inst = handle_instance_without_section(dmctx, parent_node, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)opclass_obj, inst) == DM_STOP) + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP) break; } return 0; @@ -370,14 +373,18 @@ static int browseWiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfileI static int browseWiFiDataElementsNetworkDeviceRadioBSSInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - json_object *wifi_da_radio = ((struct wifi_data_element_args *)prev_data)->dump_obj; json_object *bss_arr = NULL, *bss_obj = NULL; + struct dm_data curr_data = {0}; char *inst = NULL; int id = 0, i = 0; - dmjson_foreach_obj_in_array(wifi_da_radio, bss_arr, bss_obj, i, 1, "BSSList") { + dmjson_foreach_obj_in_array(((struct dm_data *)prev_data)->json_object, bss_arr, bss_obj, i, 1, "BSSList") { + + curr_data.json_object = bss_obj; + inst = handle_instance_without_section(dmctx, parent_node, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)bss_obj, inst) == DM_STOP) + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP) break; } return 0; @@ -385,14 +392,18 @@ static int browseWiFiDataElementsNetworkDeviceRadioBSSInst(struct dmctx *dmctx, static int browseWiFiDataElementsNetworkDeviceRadioScanResultInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - json_object *wifi_da_radio = ((struct wifi_data_element_args *)prev_data)->dump_obj; json_object *scanres_arr = NULL, *scanres_obj = NULL; + struct dm_data curr_data = {0}; char *inst = NULL; int id = 0, i = 0; - dmjson_foreach_obj_in_array(wifi_da_radio, scanres_arr, scanres_obj, i, 1, "ScanResult") { + dmjson_foreach_obj_in_array(((struct dm_data *)prev_data)->json_object, scanres_arr, scanres_obj, i, 1, "ScanResult") { + + curr_data.json_object = scanres_obj; + inst = handle_instance_without_section(dmctx, parent_node, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)scanres_obj, inst) == DM_STOP) + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP) break; } return 0; @@ -407,14 +418,18 @@ static int browseWiFiDataElementsNetworkDeviceRadioScanResultInst(struct dmctx * static int browseWiFiDataElementsNetworkDeviceRadioUnassociatedSTAInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - json_object *wifi_da_radio = ((struct wifi_data_element_args *)prev_data)->dump_obj; json_object *unassoc_arr = NULL, *unassoc_obj = NULL; + struct dm_data curr_data = {0}; char *inst = NULL; int id = 0, i = 0; - dmjson_foreach_obj_in_array(wifi_da_radio, unassoc_arr, unassoc_obj, i, 1, "UnassociatedSTA") { + dmjson_foreach_obj_in_array(((struct dm_data *)prev_data)->json_object, unassoc_arr, unassoc_obj, i, 1, "UnassociatedSTA") { + + curr_data.json_object = unassoc_obj; + inst = handle_instance_without_section(dmctx, parent_node, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)unassoc_obj, inst) == DM_STOP) + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP) break; } return 0; @@ -422,14 +437,18 @@ static int browseWiFiDataElementsNetworkDeviceRadioUnassociatedSTAInst(struct dm static int browseWiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfileInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - json_object *wifi_da_radio = ((struct wifi_data_element_args *)prev_data)->dump_obj; json_object *opclass_arr = NULL, *opclass_obj = NULL; + struct dm_data curr_data = {0}; char *inst = NULL; int id = 0, i = 0; - dmjson_foreach_obj_in_array(wifi_da_radio, opclass_arr, opclass_obj, i, 2, "Capabilities", "CapableOperatingClassProfile") { + dmjson_foreach_obj_in_array(((struct dm_data *)prev_data)->json_object, opclass_arr, opclass_obj, i, 2, "Capabilities", "CapableOperatingClassProfile") { + + curr_data.json_object = opclass_obj; + inst = handle_instance_without_section(dmctx, parent_node, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)opclass_obj, inst) == DM_STOP) + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP) break; } return 0; @@ -437,11 +456,12 @@ static int browseWiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingC static int browseWiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringHistoryInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - char *sta = NULL, *inst = NULL; json_object *res = NULL, *sta_obj = NULL, *sta_arr = NULL, *inst_arr = NULL, *inst_obj = NULL; + struct dm_data curr_data = {0}; + char *sta = NULL, *inst = NULL; int sta_id = 0, inst_id = 0, ob = 0; - sta = dmjson_get_value((json_object *)prev_data, 1, "MACAddress"); + sta = dmjson_get_value(((struct dm_data *)prev_data)->json_object, 1, "MACAddress"); if (!DM_STRLEN(sta)) return 0; @@ -454,8 +474,12 @@ static int browseWiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringHisto continue; dmjson_foreach_obj_in_array(sta_obj, inst_arr, inst_obj, inst_id, 1, "history") { + + curr_data.json_object = inst_obj; + inst = handle_instance_without_section(dmctx, parent_node, ++ob); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)inst_obj, inst) == DM_STOP) + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP) break; } break; @@ -468,12 +492,17 @@ static int browseWiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringHisto static int browseWiFiDataElementsNetworkDeviceRadioBSSQMDescriptorInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { json_object *qmdescriptor_arr = NULL, *qmdescriptor_obj = NULL; + struct dm_data curr_data = {0}; char *inst = NULL; int id = 0, i = 0; - dmjson_foreach_obj_in_array((json_object *)prev_data, qmdescriptor_arr, qmdescriptor_obj, i, 1, "QMDescriptor") { + dmjson_foreach_obj_in_array(((struct dm_data *)prev_data)->json_object, qmdescriptor_arr, qmdescriptor_obj, i, 1, "QMDescriptor") { + + curr_data.json_object = qmdescriptor_obj; + inst = handle_instance_without_section(dmctx, parent_node, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)qmdescriptor_obj, inst) == DM_STOP) + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP) break; } return 0; @@ -483,12 +512,17 @@ static int browseWiFiDataElementsNetworkDeviceRadioBSSQMDescriptorInst(struct dm static int browseWiFiDataElementsNetworkDeviceRadioBSSSTAInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { json_object *sta_arr = NULL, *sta_obj = NULL; + struct dm_data curr_data = {0}; char *inst = NULL; int id = 0, i = 0; - dmjson_foreach_obj_in_array((json_object *)prev_data, sta_arr, sta_obj, i, 1, "STAList") { + dmjson_foreach_obj_in_array(((struct dm_data *)prev_data)->json_object, sta_arr, sta_obj, i, 1, "STAList") { + + curr_data.json_object = sta_obj; + inst = handle_instance_without_section(dmctx, parent_node, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)sta_obj, inst) == DM_STOP) + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP) break; } return 0; @@ -497,12 +531,17 @@ static int browseWiFiDataElementsNetworkDeviceRadioBSSSTAInst(struct dmctx *dmct static int browseWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { json_object *opclass_scan_arr = NULL, *opclass_scan_obj = NULL; + struct dm_data curr_data = {0}; char *inst = NULL; int id = 0, i = 0; - dmjson_foreach_obj_in_array((json_object *)prev_data, opclass_scan_arr, opclass_scan_obj, i, 1, "OpClassScan") { + dmjson_foreach_obj_in_array(((struct dm_data *)prev_data)->json_object, opclass_scan_arr, opclass_scan_obj, i, 1, "OpClassScan") { + + curr_data.json_object = opclass_scan_obj; + inst = handle_instance_without_section(dmctx, parent_node, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)opclass_scan_obj, inst) == DM_STOP) + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP) break; } return 0; @@ -511,12 +550,17 @@ static int browseWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanInst(str static int browseWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { json_object *chscan_arr = NULL, *chscan_obj = NULL; + struct dm_data curr_data = {0}; char *inst = NULL; int id = 0, i = 0; - dmjson_foreach_obj_in_array((json_object *)prev_data, chscan_arr, chscan_obj, i, 1, "ChannelScan") { + dmjson_foreach_obj_in_array(((struct dm_data *)prev_data)->json_object, chscan_arr, chscan_obj, i, 1, "ChannelScan") { + + curr_data.json_object = chscan_obj; + inst = handle_instance_without_section(dmctx, parent_node, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)chscan_obj, inst) == DM_STOP) + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP) break; } return 0; @@ -525,12 +569,17 @@ static int browseWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelS static int browseWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSSInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { json_object *neigh_arr = NULL, *neigh_obj = NULL; + struct dm_data curr_data = {0}; char *inst = NULL; int id = 0, i = 0; - dmjson_foreach_obj_in_array((json_object *)prev_data, neigh_arr, neigh_obj, i, 1, "NeighborBSS") { + dmjson_foreach_obj_in_array(((struct dm_data *)prev_data)->json_object, neigh_arr, neigh_obj, i, 1, "NeighborBSS") { + + curr_data.json_object = neigh_obj; + inst = handle_instance_without_section(dmctx, parent_node, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)neigh_obj, inst) == DM_STOP) + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP) break; } return 0; @@ -538,14 +587,18 @@ static int browseWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelS static int browseWiFiDataElementsNetworkDeviceRadioScanCapabilityOpClassChannelsInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - json_object *wifi_da_radio = ((struct wifi_data_element_args *)prev_data)->dump_obj; json_object *opclass_arr = NULL, *opclass_obj = NULL; + struct dm_data curr_data = {0}; char *inst = NULL; int id = 0, i = 0; - dmjson_foreach_obj_in_array(wifi_da_radio, opclass_arr, opclass_obj, i, 2, "ScanCapability", "OpClassChannels") { + dmjson_foreach_obj_in_array(((struct dm_data *)prev_data)->json_object, opclass_arr, opclass_obj, i, 2, "ScanCapability", "OpClassChannels") { + + curr_data.json_object = opclass_obj; + inst = handle_instance_without_section(dmctx, parent_node, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)opclass_obj, inst) == DM_STOP) + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP) break; } return 0; @@ -553,14 +606,18 @@ static int browseWiFiDataElementsNetworkDeviceRadioScanCapabilityOpClassChannels static int browseWiFiDataElementsNetworkDeviceRadioCACCapabilityCACMethodInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - json_object *wifi_da_radio = ((struct wifi_data_element_args *)prev_data)->dump_obj; json_object *cacmethod_arr = NULL, *cacmethod_obj = NULL; + struct dm_data curr_data = {0}; char *inst = NULL; int id = 0, i = 0; - dmjson_foreach_obj_in_array(wifi_da_radio, cacmethod_arr, cacmethod_obj, i, 2, "CACCapability", "CACMethod") { + dmjson_foreach_obj_in_array(((struct dm_data *)prev_data)->json_object, cacmethod_arr, cacmethod_obj, i, 2, "CACCapability", "CACMethod") { + + curr_data.json_object = cacmethod_obj; + inst = handle_instance_without_section(dmctx, parent_node, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)cacmethod_obj, inst) == DM_STOP) + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP) break; } return 0; @@ -568,14 +625,18 @@ static int browseWiFiDataElementsNetworkDeviceRadioCACCapabilityCACMethodInst(st static int browseWiFiDataElementsNetworkDeviceRadioCACCapabilityCACMethodOpClassChannelsInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - json_object *cacmethod_obj = (json_object *)prev_data; json_object *op_class_arr = NULL, *op_class_obj = NULL; + struct dm_data curr_data = {0}; char *inst = NULL; int id = 0, i = 0; - dmjson_foreach_obj_in_array(cacmethod_obj, op_class_arr, op_class_obj, i, 1, "OpClassChannels") { + dmjson_foreach_obj_in_array(((struct dm_data *)prev_data)->json_object, op_class_arr, op_class_obj, i, 1, "OpClassChannels") { + + curr_data.json_object = op_class_obj; + inst = handle_instance_without_section(dmctx, parent_node, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)op_class_obj, inst) == DM_STOP) + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP) break; } return 0; @@ -584,14 +645,18 @@ static int browseWiFiDataElementsNetworkDeviceRadioCACCapabilityCACMethodOpClass /* static int browseWiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulCurrentOperatingClassProfileInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - json_object *wifi_da_device = ((struct wifi_data_element_args *)prev_data)->dump_obj; json_object *curropclass_arr = NULL, *curropclass_obj = NULL; + struct dm_data curr_data = {0}; char *inst = NULL; int id = 0, i = 0; - dmjson_foreach_obj_in_array(wifi_da_device, curropclass_arr, curropclass_obj, i, 2, "MultiAPDevice", "Backhaul_CurrentOperatingClassProfile") { + dmjson_foreach_obj_in_array(((struct dm_data *)prev_data)->json_object, curropclass_arr, curropclass_obj, i, 2, "MultiAPDevice", "Backhaul_CurrentOperatingClassProfile") { + + curr_data.json_object = curropclass_obj; + inst = handle_instance_without_section(dmctx, parent_node, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)curropclass_obj, inst) == DM_STOP) + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP) break; } return 0; @@ -661,17 +726,13 @@ static int get_WiFiDataElementsNetwork_SSIDNumberOfEntries(char *refparam, struc static int get_WiFiDataElementsNetworkSSID_SSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - struct wifi_ap_fronthaul_args *data_args = (struct wifi_ap_fronthaul_args *)data; - - *value = (data_args && data_args->ssid) ? data_args->ssid : ""; + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "ssid", value); return 0; } static int get_WiFiDataElementsNetworkSSID_Band(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - struct wifi_ap_fronthaul_args *data_args = (struct wifi_ap_fronthaul_args *)data; - - *value = (data_args && data_args->band_list) ? data_args->band_list : ""; + *value = (char *)((struct dm_data *)data)->additional_data; return 0; } @@ -731,28 +792,28 @@ static int get_WiFiDataElementsNetworkMultiAPSteeringSummaryStats_BTMQueryRespon /*#Device.WiFi.DataElements.Network.Device.{i}.ID!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].ID*/ static int get_WiFiDataElementsNetworkDevice_ID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "ID"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "ID"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.CollectionInterval!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].MultiAPCapabilities*/ static int get_WiFiDataElementsNetworkDevice_MultiAPCapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "MultiAPCapabilities"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "MultiAPCapabilities"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.CollectionInterval!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].CollectionInterval*/ static int get_WiFiDataElementsNetworkDevice_CollectionInterval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "CollectionInterval"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "CollectionInterval"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.ReportUnsuccessfulAssociations!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].ReportUnsuccessfulAssociations*/ static int get_WiFiDataElementsNetworkDevice_ReportUnsuccessfulAssociations(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "ReportUnsuccessfulAssociations"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "ReportUnsuccessfulAssociations"); return 0; } @@ -767,7 +828,7 @@ static int set_WiFiDataElementsNetworkDevice_ReportUnsuccessfulAssociations(char return 0; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section(((struct wifi_data_element_args *)data)->uci_s, "report_sta_assocfails", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "report_sta_assocfails", b ? "1" : "0"); return 0; } return 0; @@ -775,13 +836,13 @@ static int set_WiFiDataElementsNetworkDevice_ReportUnsuccessfulAssociations(char static int get_WiFiDataElementsNetworkDevice_MaxReportingRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "MaxReportingRate"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "MaxReportingRate"); return 0; } static int get_WiFiDataElementsNetworkDevice_APMetricsReportingInterval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct wifi_data_element_args *)data)->uci_s, "report_metric_periodic", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "report_metric_periodic", value); return 0; } @@ -793,7 +854,7 @@ static int set_WiFiDataElementsNetworkDevice_APMetricsReportingInterval(char *re return FAULT_9007; return 0; case VALUESET: - dmuci_set_value_by_section(((struct wifi_data_element_args *)data)->uci_s, "report_metric_periodic", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "report_metric_periodic", value); return 0; } return 0; @@ -802,21 +863,21 @@ static int set_WiFiDataElementsNetworkDevice_APMetricsReportingInterval(char *re /*#Device.WiFi.DataElements.Network.Device.{i}.Manufacturer!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].Manufacturer*/ static int get_WiFiDataElementsNetworkDevice_Manufacturer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "Manufacturer"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "Manufacturer"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.SerialNumber!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].SerialNumber*/ static int get_WiFiDataElementsNetworkDevice_SerialNumber(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "SerialNumber"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "SerialNumber"); return 0; } /* static int get_WiFiDataElementsNetworkDevice_ManufacturerModel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "ManufacturerModel"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "ManufacturerModel"); return 0; } */ @@ -824,21 +885,21 @@ static int get_WiFiDataElementsNetworkDevice_ManufacturerModel(char *refparam, s /*#Device.WiFi.DataElements.Network.Device.{i}.SoftwareVersion!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].SoftwareVersion*/ static int get_WiFiDataElementsNetworkDevice_SoftwareVersion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "SoftwareVersion"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "SoftwareVersion"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.ExecutionEnv!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].ExecutionEnv*/ static int get_WiFiDataElementsNetworkDevice_ExecutionEnv(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "ExecutionEnv"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "ExecutionEnv"); return 0; } /* static int get_WiFiDataElementsNetworkDevice_DSCPMap(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "DSCPMap"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "DSCPMap"); return 0; } */ @@ -846,28 +907,28 @@ static int get_WiFiDataElementsNetworkDevice_DSCPMap(char *refparam, struct dmct /*#Device.WiFi.DataElements.Network.Device.{i}.MaxPrioritizationRules!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].MaxPrioritizationRules*/ static int get_WiFiDataElementsNetworkDevice_MaxPrioritizationRules(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "MaxPrioritizationRules"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "MaxPrioritizationRules"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.PrioritizationSupport!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].PrioritizationSupport*/ static int get_WiFiDataElementsNetworkDevice_PrioritizationSupport(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "PrioritizationSupport"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "PrioritizationSupport"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.MaxVIDs!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].MaxVIDs*/ static int get_WiFiDataElementsNetworkDevice_MaxVIDs(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "MaxVIDs"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "MaxVIDs"); return 0; } /* static int get_WiFiDataElementsNetworkDevice_APMetricsWiFi6(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "APMetricsWiFi6"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "APMetricsWiFi6"); return 0; } */ @@ -875,14 +936,14 @@ static int get_WiFiDataElementsNetworkDevice_APMetricsWiFi6(char *refparam, stru /*#Device.WiFi.DataElements.Network.Device.{i}.CountryCode!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].CountryCode*/ static int get_WiFiDataElementsNetworkDevice_CountryCode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "CountryCode"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "CountryCode"); return 0; } static int get_WiFiDataElementsNetworkDevice_LocalSteeringDisallowedSTAList(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { struct uci_list *uci_list = NULL; - dmuci_get_value_by_section_list(((struct wifi_data_element_args *)data)->uci_s, "steer_exclude", &uci_list); + dmuci_get_value_by_section_list(((struct dm_data *)data)->config_section, "steer_exclude", &uci_list); *value = dmuci_list_to_string(uci_list, ","); return 0; } @@ -899,9 +960,9 @@ static int set_WiFiDataElementsNetworkDevice_LocalSteeringDisallowedSTAList(char return 0; case VALUESET: arr = strsplit(value, ",", &length); - dmuci_set_value_by_section(((struct wifi_data_element_args *)data)->uci_s, "steer_exclude", ""); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "steer_exclude", ""); for (int i = 0; i < length; i++) - dmuci_add_list_value_by_section(((struct wifi_data_element_args *)data)->uci_s, "steer_exclude", arr[i]); + dmuci_add_list_value_by_section(((struct dm_data *)data)->config_section, "steer_exclude", arr[i]); return 0; } return 0; @@ -910,7 +971,7 @@ static int set_WiFiDataElementsNetworkDevice_LocalSteeringDisallowedSTAList(char static int get_WiFiDataElementsNetworkDevice_BTMSteeringDisallowedSTAList(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { struct uci_list *uci_list = NULL; - dmuci_get_value_by_section_list(((struct wifi_data_element_args *)data)->uci_s, "steer_exclude_btm", &uci_list); + dmuci_get_value_by_section_list(((struct dm_data *)data)->config_section, "steer_exclude_btm", &uci_list); *value = dmuci_list_to_string(uci_list, ","); return 0; } @@ -927,9 +988,9 @@ static int set_WiFiDataElementsNetworkDevice_BTMSteeringDisallowedSTAList(char * return 0; case VALUESET: arr = strsplit(value, ",", &length); - dmuci_set_value_by_section(((struct wifi_data_element_args *)data)->uci_s, "steer_exclude_btm", ""); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "steer_exclude_btm", ""); for (int i = 0; i < length; i++) - dmuci_add_list_value_by_section(((struct wifi_data_element_args *)data)->uci_s, "steer_exclude_btm", arr[i]); + dmuci_add_list_value_by_section(((struct dm_data *)data)->config_section, "steer_exclude_btm", arr[i]); return 0; } return 0; @@ -938,14 +999,14 @@ static int set_WiFiDataElementsNetworkDevice_BTMSteeringDisallowedSTAList(char * /*#Device.WiFi.DataElements.Network.Device.{i}.DFSEnable!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].DFSEnable*/ static int get_WiFiDataElementsNetworkDevice_DFSEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "DFSEnable"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "DFSEnable"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.ReportIndependentScans!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].ReportIndependentScans*/ static int get_WiFiDataElementsNetworkDevice_ReportIndependentScans(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "ReportIndependentScans"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "ReportIndependentScans"); return 0; } @@ -960,7 +1021,7 @@ static int set_WiFiDataElementsNetworkDevice_ReportIndependentScans(char *refpar return 0; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section(((struct wifi_data_element_args *)data)->uci_s, "report_scan", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "report_scan", b ? "1" : "0"); return 0; } return 0; @@ -969,7 +1030,7 @@ static int set_WiFiDataElementsNetworkDevice_ReportIndependentScans(char *refpar /* static int get_WiFiDataElementsNetworkDevice_AssociatedSTAinAPMetricsWiFi6(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "AssociatedSTAinAPMetricsWiFi6"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "AssociatedSTAinAPMetricsWiFi6"); return 0; } @@ -989,7 +1050,7 @@ static int set_WiFiDataElementsNetworkDevice_AssociatedSTAinAPMetricsWiFi6(char static int get_WiFiDataElementsNetworkDevice_MaxUnsuccessfulAssociationReportingRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "MaxUnsuccessfulAssociationReportingRate"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "MaxUnsuccessfulAssociationReportingRate"); return 0; } @@ -1001,7 +1062,7 @@ static int set_WiFiDataElementsNetworkDevice_MaxUnsuccessfulAssociationReporting return FAULT_9007; return 0; case VALUESET: - dmuci_set_value_by_section((((struct wifi_data_element_args *)data)->uci_s)->config_section, "report_sta_assocfails_rate", value); + dmuci_set_value_by_section((((struct dm_data *)data)->config_section)->config_section, "report_sta_assocfails_rate", value); return 0; } return 0; @@ -1011,14 +1072,14 @@ static int set_WiFiDataElementsNetworkDevice_MaxUnsuccessfulAssociationReporting /*#Device.WiFi.DataElements.Network.Device.{i}.STASteeringState!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].STASteeringState*/ static int get_WiFiDataElementsNetworkDevice_STASteeringState(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "STASteeringState"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "STASteeringState"); return 0; } /* static int get_WiFiDataElementsNetworkDevice_CoordinatedCACAllowed(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "CoordinatedCACAllowed"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "CoordinatedCACAllowed"); return 0; } @@ -1033,7 +1094,7 @@ static int set_WiFiDataElementsNetworkDevice_CoordinatedCACAllowed(char *refpara return 0; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section((((struct wifi_data_element_args *)data)->uci_s)->config_section, "coordinated_cac", b ? "1" : "0"); + dmuci_set_value_by_section((((struct dm_data *)data)->config_section)->config_section, "coordinated_cac", b ? "1" : "0"); return 0; } return 0; @@ -1047,7 +1108,7 @@ static int get_WiFiDataElementsNetworkDevice_TrafficSeparationAllowed(char *refp /*static int get_WiFiDataElementsNetworkDevice_ServicePrioritizationAllowed(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "ServicePrioritizationAllowed"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "ServicePrioritizationAllowed"); return 0; } */ @@ -1055,119 +1116,119 @@ static int get_WiFiDataElementsNetworkDevice_TrafficSeparationAllowed(char *refp /*#Device.WiFi.DataElements.Network.Device.{i}.RadioNumberOfEntries!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].NumberOfRadios*/ static int get_WiFiDataElementsNetworkDevice_RadioNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "RadioNumberOfEntries"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "RadioNumberOfEntries"); return 0; } static int get_WiFiDataElementsNetworkDevice_Default8021QNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "Default8021QNumberOfEntries"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "Default8021QNumberOfEntries"); return 0; } static int get_WiFiDataElementsNetworkDevice_SSIDtoVIDMappingNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "SSIDtoVIDMappingNumberOfEntries"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "SSIDtoVIDMappingNumberOfEntries"); return 0; } static int get_WiFiDataElementsNetworkDevice_CACStatusNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "CACStatusNumberOfEntries"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "CACStatusNumberOfEntries"); return 0; } static int get_WiFiDataElementsNetworkDevice_IEEE1905SecurityNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "IEEE1905SecurityNumberOfEntries"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "IEEE1905SecurityNumberOfEntries"); return 0; } static int get_WiFiDataElementsNetworkDevice_SPRuleNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "SPRuleNumberOfEntries"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "SPRuleNumberOfEntries"); return 0; } static int get_WiFiDataElementsNetworkDevice_AnticipatedChannelsNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "AnticipatedChannelsNumberOfEntries"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "AnticipatedChannelsNumberOfEntries"); return 0; } static int get_WiFiDataElementsNetworkDevice_AnticipatedChannelUsageNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "AnticipatedChannelUsageNumberOfEntries"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "AnticipatedChannelUsageNumberOfEntries"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ID!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].ID*/ static int get_WiFiDataElementsNetworkDeviceRadio_ID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "ID"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "ID"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.Enabled!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].Enabled*/ static int get_WiFiDataElementsNetworkDeviceRadio_Enabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "Enabled"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "Enabled"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.Noise!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].Noise*/ static int get_WiFiDataElementsNetworkDeviceRadio_Noise(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "Noise"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "Noise"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.Utilization!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].Utilization*/ static int get_WiFiDataElementsNetworkDeviceRadio_Utilization(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "Utilization"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "Utilization"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.Transmit!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].Transmit*/ static int get_WiFiDataElementsNetworkDeviceRadio_Transmit(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "Transmit"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "Transmit"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ReceiveSelf!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].ReceiveSelf*/ static int get_WiFiDataElementsNetworkDeviceRadio_ReceiveSelf(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "ReceiveSelf"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "ReceiveSelf"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ReceiveOther!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].RecieveOther*/ static int get_WiFiDataElementsNetworkDeviceRadio_ReceiveOther(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "ReceiveOther"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "ReceiveOther"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.TrafficSeparationCombinedFronthaul!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].TrafficSeparationCombinedFronthaul*/ static int get_WiFiDataElementsNetworkDeviceRadio_TrafficSeparationCombinedFronthaul(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "TrafficSeparationCombinedFronthaul"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "TrafficSeparationCombinedFronthaul"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.TrafficSeparationCombinedBackhaul!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].TrafficSeparationCombinedBackhaul*/ static int get_WiFiDataElementsNetworkDeviceRadio_TrafficSeparationCombinedBackhaul(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "TrafficSeparationCombinedBackhaul"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "TrafficSeparationCombinedBackhaul"); return 0; } /* static int get_WiFiDataElementsNetworkDeviceRadio_SteeringPolicy(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((((struct wifi_data_element_args *)data)->uci_s)->config_section, "steer_policy", value); + dmuci_get_value_by_section_string((((struct dm_data *)data)->config_section)->config_section, "steer_policy", value); return 0; } @@ -1179,7 +1240,7 @@ static int set_WiFiDataElementsNetworkDeviceRadio_SteeringPolicy(char *refparam, return FAULT_9007; return 0; case VALUESET: - dmuci_set_value_by_section((((struct wifi_data_element_args *)data)->uci_s)->config_section, "steer_policy", value); + dmuci_set_value_by_section((((struct dm_data *)data)->config_section)->config_section, "steer_policy", value); return 0; } return 0; @@ -1188,7 +1249,7 @@ static int set_WiFiDataElementsNetworkDeviceRadio_SteeringPolicy(char *refparam, static int get_WiFiDataElementsNetworkDeviceRadio_ChannelUtilizationThreshold(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct wifi_data_element_args *)data)->uci_s, "util_threshold", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "util_threshold", value); return 0; } @@ -1200,7 +1261,7 @@ static int set_WiFiDataElementsNetworkDeviceRadio_ChannelUtilizationThreshold(ch return FAULT_9007; return 0; case VALUESET: - dmuci_set_value_by_section(((struct wifi_data_element_args *)data)->uci_s, "util_threshold", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "util_threshold", value); return 0; } return 0; @@ -1208,7 +1269,7 @@ static int set_WiFiDataElementsNetworkDeviceRadio_ChannelUtilizationThreshold(ch static int get_WiFiDataElementsNetworkDeviceRadio_RCPISteeringThreshold(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct wifi_data_element_args *)data)->uci_s, "rcpi_threshold", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "rcpi_threshold", value); return 0; } @@ -1220,7 +1281,7 @@ static int set_WiFiDataElementsNetworkDeviceRadio_RCPISteeringThreshold(char *re return FAULT_9007; return 0; case VALUESET: - dmuci_set_value_by_section(((struct wifi_data_element_args *)data)->uci_s, "rcpi_threshold", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "rcpi_threshold", value); return 0; } return 0; @@ -1228,7 +1289,7 @@ static int set_WiFiDataElementsNetworkDeviceRadio_RCPISteeringThreshold(char *re static int get_WiFiDataElementsNetworkDeviceRadio_STAReportingRCPIThreshold(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct wifi_data_element_args *)data)->uci_s, "report_rcpi_threshold", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "report_rcpi_threshold", value); return 0; } @@ -1240,7 +1301,7 @@ static int set_WiFiDataElementsNetworkDeviceRadio_STAReportingRCPIThreshold(char return FAULT_9007; return 0; case VALUESET: - dmuci_set_value_by_section(((struct wifi_data_element_args *)data)->uci_s, "report_rcpi_threshold", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "report_rcpi_threshold", value); return 0; } return 0; @@ -1248,7 +1309,7 @@ static int set_WiFiDataElementsNetworkDeviceRadio_STAReportingRCPIThreshold(char static int get_WiFiDataElementsNetworkDeviceRadio_STAReportingRCPIHysteresisMarginOverride(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct wifi_data_element_args *)data)->uci_s, "report_rcpi_hysteresis_margin", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "report_rcpi_hysteresis_margin", value); return 0; } @@ -1260,7 +1321,7 @@ static int set_WiFiDataElementsNetworkDeviceRadio_STAReportingRCPIHysteresisMarg return FAULT_9007; return 0; case VALUESET: - dmuci_set_value_by_section(((struct wifi_data_element_args *)data)->uci_s, "report_rcpi_hysteresis_margin", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "report_rcpi_hysteresis_margin", value); return 0; } return 0; @@ -1268,7 +1329,7 @@ static int set_WiFiDataElementsNetworkDeviceRadio_STAReportingRCPIHysteresisMarg static int get_WiFiDataElementsNetworkDeviceRadio_ChannelUtilizationReportingThreshold(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct wifi_data_element_args *)data)->uci_s, "report_util_threshold", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "report_util_threshold", value); return 0; } @@ -1280,7 +1341,7 @@ static int set_WiFiDataElementsNetworkDeviceRadio_ChannelUtilizationReportingThr return FAULT_9007; return 0; case VALUESET: - dmuci_set_value_by_section(((struct wifi_data_element_args *)data)->uci_s, "report_util_threshold", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "report_util_threshold", value); return 0; } return 0; @@ -1288,7 +1349,7 @@ static int set_WiFiDataElementsNetworkDeviceRadio_ChannelUtilizationReportingThr static int get_WiFiDataElementsNetworkDeviceRadio_AssociatedSTATrafficStatsInclusionPolicy(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct wifi_data_element_args *)data)->uci_s, "include_sta_stats", "1"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "include_sta_stats", "1"); return 0; } @@ -1303,7 +1364,7 @@ static int set_WiFiDataElementsNetworkDeviceRadio_AssociatedSTATrafficStatsInclu return 0; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section(((struct wifi_data_element_args *)data)->uci_s, "include_sta_stats", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "include_sta_stats", b ? "1" : "0"); return 0; } return 0; @@ -1311,7 +1372,7 @@ static int set_WiFiDataElementsNetworkDeviceRadio_AssociatedSTATrafficStatsInclu static int get_WiFiDataElementsNetworkDeviceRadio_AssociatedSTALinkMetricsInclusionPolicy(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct wifi_data_element_args *)data)->uci_s, "include_sta_metric", "1"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "include_sta_metric", "1"); return 0; } @@ -1326,7 +1387,7 @@ static int set_WiFiDataElementsNetworkDeviceRadio_AssociatedSTALinkMetricsInclus return 0; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section(((struct wifi_data_element_args *)data)->uci_s, "include_sta_metric", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "include_sta_metric", b ? "1" : "0"); return 0; } return 0; @@ -1335,14 +1396,14 @@ static int set_WiFiDataElementsNetworkDeviceRadio_AssociatedSTALinkMetricsInclus /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ChipsetVendor!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].ChipsetVendor*/ static int get_WiFiDataElementsNetworkDeviceRadio_ChipsetVendor(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "ChipsetVendor"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "ChipsetVendor"); return 0; } /* static int get_WiFiDataElementsNetworkDeviceRadio_APMetricsWiFi6(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "APMetricsWiFi6"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "APMetricsWiFi6"); return 0; } */ @@ -1350,55 +1411,55 @@ static int get_WiFiDataElementsNetworkDeviceRadio_APMetricsWiFi6(char *refparam, /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.CurrentOperatingClassProfileNumberOfEntries!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].NumberOfCurrOpClass*/ static int get_WiFiDataElementsNetworkDeviceRadio_CurrentOperatingClassProfileNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "CurrentOperatingClassProfileNumberOfEntries"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "CurrentOperatingClassProfileNumberOfEntries"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.UnassociatedSTANumberOfEntries!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].UnassociatedSTANumberOfEntries*/ static int get_WiFiDataElementsNetworkDeviceRadio_UnassociatedSTANumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "UnassociatedSTANumberOfEntries"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "UnassociatedSTANumberOfEntries"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSSNumberOfEntries!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].NumberOfBSS*/ static int get_WiFiDataElementsNetworkDeviceRadio_BSSNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "BSSNumberOfEntries"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "BSSNumberOfEntries"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResultNumberOfEntries!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].NumberOfScanRes*/ static int get_WiFiDataElementsNetworkDeviceRadio_ScanResultNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "ScanResultNumberOfEntries"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "ScanResultNumberOfEntries"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadio_DisAllowedOpClassChannelsNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "DisAllowedOpClassChannelsNumberOfEntries"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "DisAllowedOpClassChannelsNumberOfEntries"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BackhaulSta.MACAddress!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BackhaulSta.MACAddress*/ static int get_WiFiDataElementsNetworkDeviceRadioBackhaulSta_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 2, "BackhaulSta", "MACAddress"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 2, "BackhaulSta", "MACAddress"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.Capabilities.HTCapabilities!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].Capabilites.HTCapabilities*/ static int get_WiFiDataElementsNetworkDeviceRadioCapabilities_HTCapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 2, "Capabilities", "HTCapabilities"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 2, "Capabilities", "HTCapabilities"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.Capabilities.VHTCapabilities!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].Capabilites.VHTCapabilities*/ static int get_WiFiDataElementsNetworkDeviceRadioCapabilities_VHTCapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - char *cap = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 2, "Capabilities", "VHTCapabilities"); + char *cap = dmjson_get_value(((struct dm_data *)data)->json_object, 2, "Capabilities", "VHTCapabilities"); *value = (DM_STRLEN(cap)) ? cap : "AAA="; return 0; } @@ -1406,417 +1467,417 @@ static int get_WiFiDataElementsNetworkDeviceRadioCapabilities_VHTCapabilities(ch /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.Capabilities.CapableOperatingClassProfileNumberOfEntries!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].Capabilites.NumberOfOpClass*/ static int get_WiFiDataElementsNetworkDeviceRadioCapabilities_CapableOperatingClassProfileNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 2, "Capabilities", "CapableOperatingClassProfileNumberOfEntries"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 2, "Capabilities", "CapableOperatingClassProfileNumberOfEntries"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_HE160(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6APRole", "HE160"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6APRole", "HE160"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_HE8080(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6APRole", "HE8080"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6APRole", "HE8080"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_MCSNSS(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6APRole", "MCSNSS"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6APRole", "MCSNSS"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_SUBeamformer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6APRole", "SUBeamformer"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6APRole", "SUBeamformer"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_SUBeamformee(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6APRole", "SUBeamformee"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6APRole", "SUBeamformee"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_MUBeamformer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6APRole", "MUBeamformer"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6APRole", "MUBeamformer"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_Beamformee80orLess(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6APRole", "Beamformee80orLess"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6APRole", "Beamformee80orLess"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_BeamformeeAbove80(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6APRole", "BeamformeeAbove80"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6APRole", "BeamformeeAbove80"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_ULMUMIMO(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6APRole", "ULMUMIMO"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6APRole", "ULMUMIMO"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_ULOFDMA(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6APRole", "ULOFDMA"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6APRole", "ULOFDMA"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_MaxDLMUMIMO(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6APRole", "MaxDLMUMIMO"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6APRole", "MaxDLMUMIMO"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_MaxULMUMIMO(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6APRole", "MaxULMUMIMO"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6APRole", "MaxULMUMIMO"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_MaxDLOFDMA(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6APRole", "MaxDLOFDMA"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6APRole", "MaxDLOFDMA"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_MaxULOFDMA(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6APRole", "MaxULOFDMA"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6APRole", "MaxULOFDMA"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_RTS(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6APRole", "RTS"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6APRole", "RTS"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_MURTS(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6APRole", "MURTS"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6APRole", "MURTS"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_MultiBSSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6APRole", "MultiBSSID"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6APRole", "MultiBSSID"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_MUEDCA(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6APRole", "MUEDCA"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6APRole", "MUEDCA"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_TWTRequestor(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6APRole", "TWTRequestor"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6APRole", "TWTRequestor"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_TWTResponder(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6APRole", "TWTResponder"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6APRole", "TWTResponder"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_SpatialReuse(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6APRole", "SpatialReuse"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6APRole", "SpatialReuse"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_AnticipatedChannelUsage(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6APRole", "AnticipatedChannelUsage"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6APRole", "AnticipatedChannelUsage"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_HE160(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6bSTARole", "HE160"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6bSTARole", "HE160"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_HE8080(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6bSTARole", "HE8080"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6bSTARole", "HE8080"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_MCSNSS(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6bSTARole", "MCSNSS"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6bSTARole", "MCSNSS"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_SUBeamformer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6bSTARole", "SUBeamformer"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6bSTARole", "SUBeamformer"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_SUBeamformee(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6bSTARole", "SUBeamformee"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6bSTARole", "SUBeamformee"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_MUBeamformer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6bSTARole", "MUBeamformer"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6bSTARole", "MUBeamformer"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_Beamformee80orLess(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6bSTARole", "Beamformee80orLess"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6bSTARole", "Beamformee80orLess"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_BeamformeeAbove80(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6bSTARole", "BeamformeeAbove80"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6bSTARole", "BeamformeeAbove80"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_ULMUMIMO(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6bSTARole", "ULMUMIMO"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6bSTARole", "ULMUMIMO"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_ULOFDMA(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6bSTARole", "ULOFDMA"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6bSTARole", "ULOFDMA"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_MaxDLMUMIMO(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6bSTARole", "MaxDLMUMIMO"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6bSTARole", "MaxDLMUMIMO"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_MaxULMUMIMO(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6bSTARole", "MaxULMUMIMO"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6bSTARole", "MaxULMUMIMO"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_MaxDLOFDMA(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6bSTARole", "MaxDLOFDMA"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6bSTARole", "MaxDLOFDMA"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_MaxULOFDMA(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6bSTARole", "MaxULOFDMA"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6bSTARole", "MaxULOFDMA"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_RTS(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6bSTARole", "RTS"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6bSTARole", "RTS"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_MURTS(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6bSTARole", "MURTS"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6bSTARole", "MURTS"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_MultiBSSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6bSTARole", "MultiBSSID"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6bSTARole", "MultiBSSID"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_MUEDCA(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6bSTARole", "MUEDCA"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6bSTARole", "MUEDCA"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_TWTRequestor(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6bSTARole", "TWTRequestor"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6bSTARole", "TWTRequestor"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_TWTResponder(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6bSTARole", "TWTResponder"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6bSTARole", "TWTResponder"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_SpatialReuse(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6bSTARole", "SpatialReuse"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6bSTARole", "SpatialReuse"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_AnticipatedChannelUsage(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "Capabilities", "WiFi6bSTARole", "AnticipatedChannelUsage"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "Capabilities", "WiFi6bSTARole", "AnticipatedChannelUsage"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.Capabilities.CapableOperatingClassProfile.{i}.Class!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].Capabilites.OperatingClasses[@i-1].Class*/ static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfile_Class(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "Class"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "Class"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.Capabilities.CapableOperatingClassProfile.{i}.MaxTxPower!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].Capabilites.OperatingClasses[@i-1].MaxTxPower*/ static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfile_MaxTxPower(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "MaxTxPower"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "MaxTxPower"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.Capabilities.CapableOperatingClassProfile.{i}.NonOperable!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].Capabilites.OperatingClasses[@i-1].NonOperable*/ static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfile_NonOperable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value_array_all((json_object *)data, ",", 1, "NonOperable"); + *value = dmjson_get_value_array_all(((struct dm_data *)data)->json_object, ",", 1, "NonOperable"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.Capabilities.CapableOperatingClassProfile.{i}.NumberOfNonOperChan!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].Capabilites.OperatingClasses[@i-1].NumberOfNonOperChan*/ static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfile_NumberOfNonOperChan(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "NumberOfNonOperChan"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "NumberOfNonOperChan"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.CurrentOperatingClassProfile.{i}.Class!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].CurrentOperatingClasses[@i-1].Class*/ static int get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_Class(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "Class"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "Class"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.CurrentOperatingClassProfile.{i}.Channel!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].CurrentOperatingClasses[@i-1].Channel*/ static int get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_Channel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "Channel"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "Channel"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.CurrentOperatingClassProfile.{i}.TxPower!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].CurrentOperatingClasses[@i-1].TxPower*/ static int get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_TxPower(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "TxPower"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "TxPower"); return 0; } /* static int get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_TransmitPowerLimit(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "TransmitPowerLimit"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "TransmitPowerLimit"); return 0; } */ /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.CurrentOperatingClassProfile.{i}.TimeStamp!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].CurrentOperatingClasses[@i-1].TimeStamp*/ static int get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "TimeStamp"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "TimeStamp"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.BSSID!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].BSSID*/ static int get_WiFiDataElementsNetworkDeviceRadioBSS_BSSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "BSSID"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "BSSID"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.SSID!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].SSID*/ static int get_WiFiDataElementsNetworkDeviceRadioBSS_SSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "SSID"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "SSID"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.Enabled!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].Enabled*/ static int get_WiFiDataElementsNetworkDeviceRadioBSS_Enabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "Enabled"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "Enabled"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.LastChange!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].LastChange*/ static int get_WiFiDataElementsNetworkDeviceRadioBSS_LastChange(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "LastChange"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "LastChange"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.TimeStamp!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].TimeStamp*/ static int get_WiFiDataElementsNetworkDeviceRadioBSS_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "TimeStamp"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "TimeStamp"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.UnicastBytesSent!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].UnicastBytesSent*/ static int get_WiFiDataElementsNetworkDeviceRadioBSS_UnicastBytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "UnicastBytesSent"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "UnicastBytesSent"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.UnicastBytesReceived!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].UnicastBytesReceived*/ static int get_WiFiDataElementsNetworkDeviceRadioBSS_UnicastBytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "UnicastBytesReceived"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "UnicastBytesReceived"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.MulticastBytesSent!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].MulticastBytesSent*/ static int get_WiFiDataElementsNetworkDeviceRadioBSS_MulticastBytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "MulticastBytesSent"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "MulticastBytesSent"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.MulticastBytesReceived!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].MulticastBytesReceived*/ static int get_WiFiDataElementsNetworkDeviceRadioBSS_MulticastBytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "MulticastBytesReceived"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "MulticastBytesReceived"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.BroadcastBytesSent!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].BroadcastBytesSent*/ static int get_WiFiDataElementsNetworkDeviceRadioBSS_BroadcastBytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "BroadcastBytesSent"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "BroadcastBytesSent"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.BroadcastBytesReceived!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].BroadcastBytesReceived*/ static int get_WiFiDataElementsNetworkDeviceRadioBSS_BroadcastBytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "BroadcastBytesReceived"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "BroadcastBytesReceived"); return 0; } /* static int get_WiFiDataElementsNetworkDeviceRadioBSS_ByteCounterUnits(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "ByteCounterUnits"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "ByteCounterUnits"); return 0; } */ @@ -1824,21 +1885,21 @@ static int get_WiFiDataElementsNetworkDeviceRadioBSS_ByteCounterUnits(char *refp /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.Profile1bSTAsDisallowed!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].Profile1bSTAsDisallowed*/ static int get_WiFiDataElementsNetworkDeviceRadioBSS_Profile1bSTAsDisallowed(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "Profile1bSTAsDisallowed"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "Profile1bSTAsDisallowed"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.Profile2bSTAsDisallowed!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].Profile2bSTAsDisallowed*/ static int get_WiFiDataElementsNetworkDeviceRadioBSS_Profile2bSTAsDisallowed(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "Profile2bSTAsDisallowed"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "Profile2bSTAsDisallowed"); return 0; } /* static int get_WiFiDataElementsNetworkDeviceRadioBSS_AssociationAllowanceStatus(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "AssociationAllowanceStatus"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "AssociationAllowanceStatus"); return 0; } */ @@ -1847,25 +1908,25 @@ static int get_WiFiDataElementsNetworkDeviceRadioBSS_AssociationAllowanceStatus( /* static int get_WiFiDataElementsNetworkDeviceRadioBSS_EstServiceParametersBE(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "EstServiceParametersBE"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "EstServiceParametersBE"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioBSS_EstServiceParametersBK(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "EstServiceParametersBK"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "EstServiceParametersBK"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioBSS_EstServiceParametersVI(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "EstServiceParametersVI"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "EstServiceParametersVI"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioBSS_EstServiceParametersVO(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "EstServiceParametersVO"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "EstServiceParametersVO"); return 0; } */ @@ -1873,49 +1934,49 @@ static int get_WiFiDataElementsNetworkDeviceRadioBSS_EstServiceParametersVO(char /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.Profile2bSTAsDisallowed!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].Profile2bSTAsDisallowed*/ static int get_WiFiDataElementsNetworkDeviceRadioBSS_BackhaulUse(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "BackhaulUse"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "BackhaulUse"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.FronthaulUse!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].Profile2bSTAsDisallowed*/ static int get_WiFiDataElementsNetworkDeviceRadioBSS_FronthaulUse(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "FronthaulUse"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "FronthaulUse"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.R1disallowed!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].FronthaulUse*/ static int get_WiFiDataElementsNetworkDeviceRadioBSS_R1disallowed(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "R1disallowed"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "R1disallowed"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.R2disallowed!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].R2disallowed*/ static int get_WiFiDataElementsNetworkDeviceRadioBSS_R2disallowed(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "R2disallowed"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "R2disallowed"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.MultiBSSID!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].MultiBSSID*/ static int get_WiFiDataElementsNetworkDeviceRadioBSS_MultiBSSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "MultiBSSID"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "MultiBSSID"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.TransmittedBSSID!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].TransmittedBSSID*/ static int get_WiFiDataElementsNetworkDeviceRadioBSS_TransmittedBSSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "TransmittedBSSID"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "TransmittedBSSID"); return 0; } /* static int get_WiFiDataElementsNetworkDeviceRadioBSS_FronthaulAKMsAllowed(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value_array_all((json_object *)data, ",", 1, "FronthaulAKMsAllowed"); + *value = dmjson_get_value_array_all(((struct dm_data *)data)->json_object, ",", 1, "FronthaulAKMsAllowed"); return 0; } @@ -1935,7 +1996,7 @@ static int set_WiFiDataElementsNetworkDeviceRadioBSS_FronthaulAKMsAllowed(char * static int get_WiFiDataElementsNetworkDeviceRadioBSS_BackhaulAKMsAllowed(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value_array_all((json_object *)data, ",", 1, "BackhaulAKMsAllowed"); + *value = dmjson_get_value_array_all(((struct dm_data *)data)->json_object, ",", 1, "BackhaulAKMsAllowed"); return 0; } @@ -1956,7 +2017,7 @@ static int set_WiFiDataElementsNetworkDeviceRadioBSS_BackhaulAKMsAllowed(char *r /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STANumberOfEntries!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].NumberofSTA*/ static int get_WiFiDataElementsNetworkDeviceRadioBSS_STANumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "STANumberOfEntries"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "STANumberOfEntries"); return 0; } @@ -1970,216 +2031,216 @@ static int get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTA_SteeringHistor /* static int get_WiFiDataElementsNetworkDeviceRadioBSS_QMDescriptorNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "QMDescriptorNumberOfEntries"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "QMDescriptorNumberOfEntries"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioBSSQMDescriptor_ClientMAC(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "ClientMAC"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "ClientMAC"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioBSSQMDescriptor_DescriptorElement(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "DescriptorElement"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "DescriptorElement"); return 0; } */ static int get_WiFiDataElementsNetworkDeviceRadioBSSMultiAPSteering_BlacklistAttempts(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 2, "MultiAPSteering", "BlacklistAttempts"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 2, "MultiAPSteering", "BlacklistAttempts"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioBSSMultiAPSteering_BTMAttempts(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 2, "MultiAPSteering", "BTMAttempts"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 2, "MultiAPSteering", "BTMAttempts"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioBSSMultiAPSteering_BTMQueryResponses(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 2, "MultiAPSteering", "BTMQueryResponses"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 2, "MultiAPSteering", "BTMQueryResponses"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.MACAddress!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].MACAddress*/ static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "MACAddress"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "MACAddress"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.TimeStamp!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].TimeStamp*/ static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "TimeStamp"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "TimeStamp"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.HTCapabilities!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].HTCapabilities*/ static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_HTCapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "HTCapabilities"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "HTCapabilities"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.VHTCapabilities!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].VHTCapabilities*/ static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_VHTCapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "VHTCapabilities"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "VHTCapabilities"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.HECapabilities!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].HECapabilities*/ static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_HECapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "HECapabilities"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "HECapabilities"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.LastDataDownlinkRate!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].LastDataDownlinkRate*/ static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_LastDataDownlinkRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "LastDataDownlinkRate"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "LastDataDownlinkRate"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.LastDataUplinkRate!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].LastDataUplinkRate*/ static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_LastDataUplinkRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "LastDataUplinkRate"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "LastDataUplinkRate"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.UtilizationReceive!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].UtilizationReceive*/ static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_UtilizationReceive(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "UtilizationReceive"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "UtilizationReceive"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.UtilizationTransmit!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].UtilizationTransmit*/ static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_UtilizationTransmit(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "UtilizationTransmit"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "UtilizationTransmit"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.EstMACDataRateDownlink!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].EstMACDataRateDownlink*/ static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_EstMACDataRateDownlink(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "EstMACDataRateDownlink"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "EstMACDataRateDownlink"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.EstMACDataRateUplink!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].EstMACDataRateUplink*/ static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_EstMACDataRateUplink(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "EstMACDataRateUplink"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "EstMACDataRateUplink"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.SignalStrength!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].SignalStrength*/ static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_SignalStrength(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "SignalStrength"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "SignalStrength"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.LastConnectTime!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].LastConnectTime*/ static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_LastConnectTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "LastConnectTime"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "LastConnectTime"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.BytesSent!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].BytesSent*/ static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "BytesSent"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "BytesSent"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.BytesReceived!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].BytesReceived*/ static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "BytesReceived"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "BytesReceived"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.PacketsSent!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].PacketsSent*/ static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "PacketsSent"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "PacketsSent"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.PacketsReceived!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].PacketsReceived*/ static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "PacketsReceived"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "PacketsReceived"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.ErrorsSent!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].ErrorsSent*/ static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_ErrorsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "ErrorsSent"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "ErrorsSent"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.ErrorsReceived!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].ErrorsReceived*/ static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_ErrorsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "ErrorsReceived"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "ErrorsReceived"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_RetransCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "RetransCount"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "RetransCount"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.MeasurementReport!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].Measurementreport*/ static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_MeasurementReport(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value_array_all((json_object *)data, ",", 1, "Measurementreport"); + *value = dmjson_get_value_array_all(((struct dm_data *)data)->json_object, ",", 1, "Measurementreport"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.NumberOfMeasureReports!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].NumberOfMeasureReports*/ static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_NumberOfMeasureReports(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "NumberOfMeasureReports"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "NumberOfMeasureReports"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_IPV4Address(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "IPV4Address"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "IPV4Address"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_IPV6Address(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "IPV6Address"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "IPV6Address"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.Hostname!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].Hostname*/ static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_Hostname(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "Hostname"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "Hostname"); return 0; } /* static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_CellularDataPreference(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "CellularDataPreference"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "CellularDataPreference"); return 0; } @@ -2199,7 +2260,7 @@ static int set_WiFiDataElementsNetworkDeviceRadioBSSSTA_CellularDataPreference(c static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_ReAssociationDelay(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "ReAssociationDelay"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "ReAssociationDelay"); return 0; } @@ -2220,73 +2281,73 @@ static int set_WiFiDataElementsNetworkDeviceRadioBSSSTA_ReAssociationDelay(char static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_TIDQueueSizesNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "TIDQueueSizesNumberOfEntries"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "TIDQueueSizesNumberOfEntries"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringSummaryStats_NoCandidateAPFailures(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 3, "MultiAPSTA", "SteeringSummaryStats", "NoCandidateAPFailures"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "MultiAPSTA", "SteeringSummaryStats", "NoCandidateAPFailures"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringSummaryStats_BlacklistAttempts(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 3, "MultiAPSTA", "SteeringSummaryStats", "BlacklistAttempts"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "MultiAPSTA", "SteeringSummaryStats", "BlacklistAttempts"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringSummaryStats_BlacklistSuccesses(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 3, "MultiAPSTA", "SteeringSummaryStats", "BlacklistSuccesses"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "MultiAPSTA", "SteeringSummaryStats", "BlacklistSuccesses"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringSummaryStats_BlacklistFailures(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 3, "MultiAPSTA", "SteeringSummaryStats", "BlacklistFailures"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "MultiAPSTA", "SteeringSummaryStats", "BlacklistFailures"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringSummaryStats_BTMAttempts(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 3, "MultiAPSTA", "SteeringSummaryStats", "BTMAttempts"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "MultiAPSTA", "SteeringSummaryStats", "BTMAttempts"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringSummaryStats_BTMSuccesses(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 3, "MultiAPSTA", "SteeringSummaryStats", "BTMSuccesses"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "MultiAPSTA", "SteeringSummaryStats", "BTMSuccesses"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringSummaryStats_BTMFailures(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 3, "MultiAPSTA", "SteeringSummaryStats", "BTMFailures"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "MultiAPSTA", "SteeringSummaryStats", "BTMFailures"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringSummaryStats_BTMQueryResponses(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 3, "MultiAPSTA", "SteeringSummaryStats", "BTMQueryResponses"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "MultiAPSTA", "SteeringSummaryStats", "BTMQueryResponses"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringSummaryStats_LastSteerTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 3, "MultiAPSTA", "SteeringSummaryStats", "LastSteerTime"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "MultiAPSTA", "SteeringSummaryStats", "LastSteerTime"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringHistory_Time(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "time"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "time"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringHistory_APOrigin(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "ap"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "ap"); return 0; } @@ -2294,7 +2355,7 @@ static int get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringHistory { char *trigger = NULL; - trigger = dmjson_get_value((json_object *)data, 1, "trigger"); + trigger = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "trigger"); if (DM_STRCMP(trigger, "link_quality") == 0) { dmasprintf(value, "%s", "Wi-Fi Link Quality"); @@ -2313,7 +2374,7 @@ static int get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringHistory { char *method = NULL; - method = dmjson_get_value((json_object *)data, 1, "method"); + method = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "method"); if (DM_STRCMP(method, "btm") == 0) { dmasprintf(value, "%s", "BTM Request"); @@ -2330,356 +2391,356 @@ static int get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringHistory static int get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringHistory_APDestination(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "target_ap"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "target_ap"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringHistory_SteeringDuration(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "duration"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "duration"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.TimeStamp!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].ScanResultList[@i-1].TimeStamp*/ static int get_WiFiDataElementsNetworkDeviceRadioScanResult_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "TimeStamp"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "TimeStamp"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.OpClassScanNumberOfEntries!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].ScanResultList[@i-1].NumberOfOpClassScans*/ static int get_WiFiDataElementsNetworkDeviceRadioScanResult_OpClassScanNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "OpClassScanNumberOfEntries"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "OpClassScanNumberOfEntries"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.OpClassScan.{i}.OperatingClass!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].ScanResultList[@i-1].OpClassScanList[@i-1].OperatingClass*/ static int get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScan_OperatingClass(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "OperatingClass"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "OperatingClass"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.OpClassScan.{i}.ChannelScanNumberOfEntries!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].ScanResultList[@i-1].OpClassScanList[@i-1].NumberOfChannelScans*/ static int get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScan_ChannelScanNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "ChannelScanNumberOfEntries"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "ChannelScanNumberOfEntries"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.OpClassScan.{i}.ChannelScan.{i}.Channel!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].ScanResultList[@i-1].OpClassScanList[@i-1].ChannelScanList[@i-1].Channel*/ static int get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_Channel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "Channel"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "Channel"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.OpClassScan.{i}.ChannelScan.{i}.TimeStamp!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].ScanResultList[@i-1].OpClassScanList[@i-1].ChannelScanList[@i-1].TimeStamp*/ static int get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "TimeStamp"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "TimeStamp"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.OpClassScan.{i}.ChannelScan.{i}.Utilization!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].ScanResultList[@i-1].OpClassScanList[@i-1].ChannelScanList[@i-1].Utilization*/ static int get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_Utilization(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "Utilization"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "Utilization"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.OpClassScan.{i}.ChannelScan.{i}.Noise!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].ScanResultList[@i-1].OpClassScanList[@i-1].ChannelScanList[@i-1].Noise*/ static int get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_Noise(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "Noise"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "Noise"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.OpClassScan.{i}.ChannelScan.{i}.NeighborBSSNumberOfEntries!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].ScanResultList[@i-1].OpClassScanList[@i-1].ChannelScanList[@i-1].NumberofNeighbors*/ static int get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_NeighborBSSNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "NeighborBSSNumberOfEntries"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "NeighborBSSNumberOfEntries"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.OpClassScan.{i}.ChannelScan.{i}.NeighborBSS.{i}.BSSID!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].ScanResultList[@i-1].OpClassScanList[@i-1].ChannelScanList[@i-1].NeighborList[@i-1].BSSID*/ static int get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_BSSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "BSSID"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "BSSID"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.OpClassScan.{i}.ChannelScan.{i}.NeighborBSS.{i}.SSID!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].ScanResultList[@i-1].OpClassScanList[@i-1].ChannelScanList[@i-1].NeighborList[@i-1].SSID*/ static int get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_SSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "SSID"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "SSID"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.OpClassScan.{i}.ChannelScan.{i}.NeighborBSS.{i}.SignalStrength!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].ScanResultList[@i-1].OpClassScanList[@i-1].ChannelScanList[@i-1].NeighborList[@i-1].SignalStrengh*/ static int get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_SignalStrength(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "SignalStrength"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "SignalStrength"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.OpClassScan.{i}.ChannelScan.{i}.NeighborBSS.{i}.ChannelBandwidth!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].ScanResultList[@i-1].OpClassScanList[@i-1].ChannelScanList[@i-1].NeighborList[@i-1].ChannelBandwidth*/ static int get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_ChannelBandwidth(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "ChannelBandwidth"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "ChannelBandwidth"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.OpClassScan.{i}.ChannelScan.{i}.NeighborBSS.{i}.ChannelUtilization!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].ScanResultList[@i-1].OpClassScanList[@i-1].ChannelScanList[@i-1].NeighborList[@i-1].ChannelUtilization*/ static int get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_ChannelUtilization(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "ChannelUtilization"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "ChannelUtilization"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.OpClassScan.{i}.ChannelScan.{i}.NeighborBSS.{i}.StationCount!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].ScanResultList[@i-1].OpClassScanList[@i-1].ChannelScanList[@i-1].NeighborList[@i-1].StationCount*/ static int get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_StationCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "StationCount"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "StationCount"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioScanCapability_OnBootOnly(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 2, "ScanCapability", "OnBootOnly"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 2, "ScanCapability", "OnBootOnly"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioScanCapability_Impact(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 2, "ScanCapability", "Impact"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 2, "ScanCapability", "Impact"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioScanCapability_MinimumInterval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 2, "ScanCapability", "MinimumInterval"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 2, "ScanCapability", "MinimumInterval"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioScanCapability_OpClassChannelsNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 2, "ScanCapability", "OpClassChannelsNumberOfEntries"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 2, "ScanCapability", "OpClassChannelsNumberOfEntries"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioScanCapabilityOpClassChannels_OpClass(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "OpClass"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "OpClass"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioScanCapabilityOpClassChannels_ChannelList(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value_array_all((json_object *)data, ",", 1, "ChannelList"); + *value = dmjson_get_value_array_all(((struct dm_data *)data)->json_object, ",", 1, "ChannelList"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCACCapability_CACMethodNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 2, "CACCapability", "CACMethodNumberOfEntries"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 2, "CACCapability", "CACMethodNumberOfEntries"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCACCapabilityCACMethod_Method(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "Method"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "Method"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCACCapabilityCACMethod_NumberOfSeconds(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "NumberOfSeconds"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "NumberOfSeconds"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCACCapabilityCACMethod_OpClassChannelsNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "OpClassChannelsNumberOfEntries"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "OpClassChannelsNumberOfEntries"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCACCapabilityCACMethodOpClassChannels_OpClass(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "OpClass"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "OpClass"); return 0; } static int get_WiFiDataElementsNetworkDeviceRadioCACCapabilityCACMethodOpClassChannels_ChannelList(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value_array_all((json_object *)data, ",", 1, "ChannelList"); + *value = dmjson_get_value_array_all(((struct dm_data *)data)->json_object, ",", 1, "ChannelList"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.UnassociatedSTA.{i}.MACAddress!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].UnassociatedStaList[@i-1].MACAddress*/ static int get_WiFiDataElementsNetworkDeviceRadioUnassociatedSTA_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "MACAddress"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "MACAddress"); return 0; } /*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.UnassociatedSTA.{i}.SignalStrength!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].UnassociatedStaList[@i-1].SignalStrength*/ static int get_WiFiDataElementsNetworkDeviceRadioUnassociatedSTA_SignalStrength(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "SignalStrength"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "SignalStrength"); return 0; } static int get_WiFiDataElementsNetworkDeviceMultiAPDevice_ManufacturerOUI(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 2, "MultiAPDevice", "ManufacturerOUI"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 2, "MultiAPDevice", "ManufacturerOUI"); return 0; } static int get_WiFiDataElementsNetworkDeviceMultiAPDevice_LastContactTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 2, "MultiAPDevice", "LastContactTime"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 2, "MultiAPDevice", "LastContactTime"); return 0; } static int get_WiFiDataElementsNetworkDeviceMultiAPDevice_AssocIEEE1905DeviceRef(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - char *device_id = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 1, "ID"); + char *device_id = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "ID"); adm_entry_get_reference_param(ctx, "Device.IEEE1905.AL.NetworkTopology.IEEE1905Device.*.IEEE1905Id", device_id, value); return 0; } static int get_WiFiDataElementsNetworkDeviceMultiAPDevice_EasyMeshControllerOperationMode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 2, "MultiAPDevice", "EasyMeshControllerOperationMode"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 2, "MultiAPDevice", "EasyMeshControllerOperationMode"); return 0; } static int get_WiFiDataElementsNetworkDeviceMultiAPDevice_EasyMeshAgentOperationMode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 2, "MultiAPDevice", "EasyMeshAgentOperationMode"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 2, "MultiAPDevice", "EasyMeshAgentOperationMode"); return 0; } static int get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaul_LinkType(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "MultiAPDevice", "Backhaul", "LinkType"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "MultiAPDevice", "Backhaul", "LinkType"); return 0; } static int get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaul_BackhaulMACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "MultiAPDevice", "Backhaul", "BackhaulMACAddress"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "MultiAPDevice", "Backhaul", "BackhaulMACAddress"); return 0; } static int get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaul_BackhaulDeviceID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "MultiAPDevice", "Backhaul", "BackhaulDeviceID"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "MultiAPDevice", "Backhaul", "BackhaulDeviceID"); return 0; } static int get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaul_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "MultiAPDevice", "Backhaul", "MACAddress"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "MultiAPDevice", "Backhaul", "MACAddress"); return 0; } /* static int get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaul_CurrentOperatingClassProfileNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 3, "MultiAPDevice", "Backhaul", "CurrentOperatingClassProfileNumberOfEntries"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 3, "MultiAPDevice", "Backhaul", "CurrentOperatingClassProfileNumberOfEntries"); return 0; } static int get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulCurrentOperatingClassProfile_Class(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "Class"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "Class"); return 0; } static int get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulCurrentOperatingClassProfile_Channel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "Channel"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "Channel"); return 0; } static int get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulCurrentOperatingClassProfile_TxPower(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "TxPower"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "TxPower"); return 0; } static int get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulCurrentOperatingClassProfile_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "TimeStamp"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "TimeStamp"); return 0; } static int get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulStats_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 4, "MultiAPDevice", "Backhaul", "Stats", "BytesSent"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 4, "MultiAPDevice", "Backhaul", "Stats", "BytesSent"); return 0; } static int get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulStats_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 4, "MultiAPDevice", "Backhaul", "Stats", "BytesReceived"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 4, "MultiAPDevice", "Backhaul", "Stats", "BytesReceived"); return 0; } static int get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulStats_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 4, "MultiAPDevice", "Backhaul", "Stats", "PacketsSent"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 4, "MultiAPDevice", "Backhaul", "Stats", "PacketsSent"); return 0; } static int get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulStats_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 4, "MultiAPDevice", "Backhaul", "Stats", "PacketsReceived"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 4, "MultiAPDevice", "Backhaul", "Stats", "PacketsReceived"); return 0; } static int get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulStats_ErrorsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 4, "MultiAPDevice", "Backhaul", "Stats", "ErrorsSent"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 4, "MultiAPDevice", "Backhaul", "Stats", "ErrorsSent"); return 0; } static int get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulStats_ErrorsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 4, "MultiAPDevice", "Backhaul", "Stats", "ErrorsReceived"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 4, "MultiAPDevice", "Backhaul", "Stats", "ErrorsReceived"); return 0; } static int get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulStats_LinkUtilization(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 4, "MultiAPDevice", "Backhaul", "Stats", "LinkUtilization"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 4, "MultiAPDevice", "Backhaul", "Stats", "LinkUtilization"); return 0; } static int get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulStats_SignalStrength(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 4, "MultiAPDevice", "Backhaul", "Stats", "SignalStrength"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 4, "MultiAPDevice", "Backhaul", "Stats", "SignalStrength"); return 0; } static int get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulStats_LastDataDownlinkRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 4, "MultiAPDevice", "Backhaul", "Stats", "LastDataDownlinkRate"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 4, "MultiAPDevice", "Backhaul", "Stats", "LastDataDownlinkRate"); return 0; } static int get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulStats_LastDataUplinkRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 4, "MultiAPDevice", "Backhaul", "Stats", "LastDataUplinkRate"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 4, "MultiAPDevice", "Backhaul", "Stats", "LastDataUplinkRate"); return 0; } static int get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulStats_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value(((struct wifi_data_element_args *)data)->dump_obj, 4, "MultiAPDevice", "Backhaul", "Stats", "TimeStamp"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 4, "MultiAPDevice", "Backhaul", "Stats", "TimeStamp"); return 0; } */ @@ -2749,109 +2810,109 @@ static int set_WiFiDataElementsNetworkDeviceDefault8021Q_DefaultPCP(char *refpar static int get_WiFiDataElementsNetworkDeviceSSIDtoVIDMapping_SSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "SSID"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "SSID"); return 0; } static int get_WiFiDataElementsNetworkDeviceSSIDtoVIDMapping_VID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "VID"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "VID"); return 0; } static int get_WiFiDataElementsNetworkDeviceCACStatus_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "TimeStamp"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "TimeStamp"); return 0; } static int get_WiFiDataElementsNetworkDeviceCACStatus_CACAvailableChannelNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "CACAvailableChannelNumberOfEntries"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "CACAvailableChannelNumberOfEntries"); return 0; } static int get_WiFiDataElementsNetworkDeviceCACStatus_CACNonOccupancyChannelNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "CACNonOccupancyChannelNumberOfEntries"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "CACNonOccupancyChannelNumberOfEntries"); return 0; } static int get_WiFiDataElementsNetworkDeviceCACStatus_CACActiveChannelNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "CACActiveChannelNumberOfEntries"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "CACActiveChannelNumberOfEntries"); return 0; } static int get_WiFiDataElementsNetworkDeviceCACStatusCACAvailableChannel_OpClass(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "OpClass"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "OpClass"); return 0; } static int get_WiFiDataElementsNetworkDeviceCACStatusCACAvailableChannel_Channel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "Channel"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "Channel"); return 0; } static int get_WiFiDataElementsNetworkDeviceCACStatusCACAvailableChannel_Minutes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "Minutes"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "Minutes"); return 0; } static int get_WiFiDataElementsNetworkDeviceCACStatusCACNonOccupancyChannel_OpClass(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "OpClass"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "OpClass"); return 0; } static int get_WiFiDataElementsNetworkDeviceCACStatusCACNonOccupancyChannel_Channel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "Channel"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "Channel"); return 0; } static int get_WiFiDataElementsNetworkDeviceCACStatusCACNonOccupancyChannel_Seconds(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "Seconds"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "Seconds"); return 0; } static int get_WiFiDataElementsNetworkDeviceCACStatusCACActiveChannel_OpClass(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "OpClass"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "OpClass"); return 0; } static int get_WiFiDataElementsNetworkDeviceCACStatusCACActiveChannel_Channel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "Channel"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "Channel"); return 0; } static int get_WiFiDataElementsNetworkDeviceCACStatusCACActiveChannel_Countdown(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "Countdown"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "Countdown"); return 0; } static int get_WiFiDataElementsNetworkDeviceIEEE1905Security_OnboardingProtocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "OnboardingProtocol"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "OnboardingProtocol"); return 0; } static int get_WiFiDataElementsNetworkDeviceIEEE1905Security_IntegrityAlgorithm(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "IntegrityAlgorithm"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "IntegrityAlgorithm"); return 0; } static int get_WiFiDataElementsNetworkDeviceIEEE1905Security_EncryptionAlgorithm(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmjson_get_value((json_object *)data, 1, "EncryptionAlgorithm"); + *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "EncryptionAlgorithm"); return 0; } @@ -3168,7 +3229,7 @@ static int operate_WiFiDataElementsNetworkDevice_SetSTASteeringState(char *refpa } string_to_bool(disallowed, &b); - dmuci_set_value_by_section((((struct wifi_data_element_args *)data)->uci_s)->config_section, "steer_disallow", b ? "1" : "0"); + dmuci_set_value_by_section((((struct dm_data *)data)->config_section)->config_section, "steer_disallow", b ? "1" : "0"); dmuci_save_package("mapcontroller"); dmubus_call_set("uci", "commit", UBUS_ARGS{{"config", "mapcontroller", String}}, 1); @@ -3226,8 +3287,8 @@ static int operate_WiFiDataElementsNetworkDeviceRadio_ChannelScanRequest(char *r char *pch = NULL; char *spch = NULL; - dmuci_get_value_by_section_string(((struct wifi_data_element_args *)data)->uci_s, "agent_id", &agent_id); - dmuci_get_value_by_section_string(((struct wifi_data_element_args *)data)->uci_s, "macaddr", &macaddr); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "agent_id", &agent_id); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "macaddr", &macaddr); if ((bbfdm_validate_string(ctx, agent_id, -1, 17, NULL, MACAddress)) || (bbfdm_validate_string(ctx, macaddr, -1, 17, NULL, MACAddress))) { diff --git a/libbbfdm/dmtree/vendor/iopsys/wifi.c b/libbbfdm/dmtree/vendor/iopsys/wifi.c index b11266fb..5e089bb4 100644 --- a/libbbfdm/dmtree/vendor/iopsys/wifi.c +++ b/libbbfdm/dmtree/vendor/iopsys/wifi.c @@ -15,7 +15,7 @@ static int get_multi_ap_mode(char *refparam, struct dmctx *ctx, void *data, char { char *multi_ap = NULL; - dmuci_get_value_by_section_string((struct uci_section *)data, "multi_ap", &multi_ap); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "multi_ap", &multi_ap); if (DM_STRCMP(multi_ap, "1") == 0) *value = "Backhaul"; diff --git a/test/cmocka/functional_api_test_bbfd.c b/test/cmocka/functional_api_test_bbfd.c index db82fade..4c8551cf 100644 --- a/test/cmocka/functional_api_test_bbfd.c +++ b/test/cmocka/functional_api_test_bbfd.c @@ -477,7 +477,7 @@ static void test_bbf_api_json(void **state) char *json_value = NULL; int idx = 0; - dmubus_call("wifi.ap.test2", "status", UBUS_ARGS{0}, 0, &wifi_status); + dmubus_call("wifi.ap.test2_0", "status", UBUS_ARGS{0}, 0, &wifi_status); assert_non_null(wifi_status); /* diff --git a/test/files/etc/bbfdm/plugins/X_IOPSYS_EU_Dropbear.json b/test/files/etc/bbfdm/plugins/X_IOPSYS_EU_Dropbear.json index 045cd251..3dc0f797 100644 --- a/test/files/etc/bbfdm/plugins/X_IOPSYS_EU_Dropbear.json +++ b/test/files/etc/bbfdm/plugins/X_IOPSYS_EU_Dropbear.json @@ -1,5 +1,6 @@ { - "Device.X_IOPSYS_EU_Dropbear.{i}.": { + "json_plugin_version": 2, + "Device.{BBF_VENDOR_PREFIX}Dropbear.{i}.": { "type": "object", "protocols": [ "cwmp", @@ -7,16 +8,18 @@ ], "access": true, "array": true, - "mapping": { - "type": "uci", - "uci": { - "file": "dropbear", - "section": { - "type": "dropbear" - }, - "dmmapfile": "dmmap_dropbear" + "mapping": [ + { + "type": "uci", + "uci": { + "file": "dropbear", + "section": { + "type": "dropbear" + }, + "dmmapfile": "dmmap_dropbear" + } } - }, + ], "Alias": { "type": "string", "protocols": [ @@ -27,18 +30,9 @@ "write": true, "mapping": [ { - "type": "uci", - "uci": { - "file": "dmmap_dropbear", - "section": { - "type": "dropbear", - "index": "@i-1" - }, - "option": { - "name": "dropbearalias" - }, - "path":"/etc/bbfdm" - } + "data": "@Parent", + "type": "uci_sec", + "key": "alias" } ] }, @@ -52,17 +46,9 @@ "write": true, "mapping": [ { - "type": "uci", - "uci": { - "file": "dropbear", - "section": { - "type": "dropbear", - "index": "@i-1" - }, - "option": { - "name": "PasswordAuth" - } - } + "data": "@Parent", + "type": "uci_sec", + "key": "PasswordAuth" } ] }, @@ -76,17 +62,9 @@ "write": true, "mapping": [ { - "type": "uci", - "uci": { - "file": "dropbear", - "section": { - "type": "dropbear", - "index": "@i-1" - }, - "option": { - "name": "RootPasswordAuth" - } - } + "data": "@Parent", + "type": "uci_sec", + "key": "RootPasswordAuth" } ] }, @@ -100,17 +78,9 @@ "write": true, "mapping": [ { - "type": "uci", - "uci": { - "file": "dropbear", - "section": { - "type": "dropbear", - "index": "@i-1" - }, - "option": { - "name": "Port" - } - } + "data": "@Parent", + "type": "uci_sec", + "key": "Port" } ] }, @@ -124,17 +94,9 @@ "write": true, "mapping": [ { - "type": "uci", - "uci": { - "file": "dropbear", - "section": { - "type": "dropbear", - "index": "@i-1" - }, - "option": { - "name": "RootLogin" - } - } + "data": "@Parent", + "type": "uci_sec", + "key": "RootLogin" } ] }, @@ -148,17 +110,9 @@ "write": true, "mapping": [ { - "type": "uci", - "uci": { - "file": "dropbear", - "section": { - "type": "dropbear", - "index": "@i-1" - }, - "option": { - "name": "GatewayPorts" - } - } + "data": "@Parent", + "type": "uci_sec", + "key": "GatewayPorts" } ] }, @@ -172,17 +126,9 @@ "write": true, "mapping": [ { - "type": "uci", - "uci": { - "file": "dropbear", - "section": { - "type": "dropbear", - "index": "@i-1" - }, - "option": { - "name": "Interface" - } - } + "data": "@Parent", + "type": "uci_sec", + "key": "Interface" } ] }, @@ -196,17 +142,9 @@ "write": true, "mapping": [ { - "type": "uci", - "uci": { - "file": "dropbear", - "section": { - "type": "dropbear", - "index": "@i-1" - }, - "option": { - "name": "rsakeyfile" - } - } + "data": "@Parent", + "type": "uci_sec", + "key": "rsakeyfile" } ] }, @@ -220,17 +158,9 @@ "write": true, "mapping": [ { - "type": "uci", - "uci": { - "file": "dropbear", - "section": { - "type": "dropbear", - "index": "@i-1" - }, - "option": { - "name": "dsskeyfile" - } - } + "data": "@Parent", + "type": "uci_sec", + "key": "dsskeyfile" } ] }, @@ -244,17 +174,9 @@ "write": true, "mapping": [ { - "type": "uci", - "uci": { - "file": "dropbear", - "section": { - "type": "dropbear", - "index": "@i-1" - }, - "option": { - "name": "SSHKeepAlive" - } - } + "data": "@Parent", + "type": "uci_sec", + "key": "SSHKeepAlive" } ] }, @@ -268,17 +190,9 @@ "write": true, "mapping": [ { - "type": "uci", - "uci": { - "file": "dropbear", - "section": { - "type": "dropbear", - "index": "@i-1" - }, - "option": { - "name": "IdleTimeout" - } - } + "data": "@Parent", + "type": "uci_sec", + "key": "IdleTimeout" } ] }, @@ -292,17 +206,9 @@ "write": true, "mapping": [ { - "type": "uci", - "uci": { - "file": "dropbear", - "section": { - "type": "dropbear", - "index": "@i-1" - }, - "option": { - "name": "verbose" - } - } + "data": "@Parent", + "type": "uci_sec", + "key": "verbose" } ] }, @@ -316,19 +222,11 @@ "write": true, "mapping": [ { - "type": "uci", - "uci": { - "file": "dropbear", - "section": { - "type": "dropbear", - "index": "@i-1" - }, - "option": { - "name": "BannerFile" - } - } + "data": "@Parent", + "type": "uci_sec", + "key": "BannerFile" } ] } } -} +} \ No newline at end of file diff --git a/test/files/etc/bbfdm/plugins/X_IOPSYS_EU_TEST.json b/test/files/etc/bbfdm/plugins/X_IOPSYS_EU_TEST.json index 1aa378f0..f1fd35e6 100644 --- a/test/files/etc/bbfdm/plugins/X_IOPSYS_EU_TEST.json +++ b/test/files/etc/bbfdm/plugins/X_IOPSYS_EU_TEST.json @@ -1,5 +1,6 @@ { - "Device.X_IOPSYS_EU_TEST.": { + "json_plugin_version": 2, + "Device.{BBF_VENDOR_PREFIX}TEST.{i}.": { "type": "object", "protocols": [ "cwmp", @@ -7,16 +8,18 @@ ], "access": true, "array": true, - "mapping": { - "type": "uci", - "uci": { - "file": "cwmp", - "section": { - "type": "test" - }, - "dmmapfile": "dmmap_cwmp" + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp", + "section": { + "type": "test" + }, + "dmmapfile": "dmmap_cwmp" + } } - }, + ], "Enable": { "type": "boolean", "read": true, diff --git a/test/files/etc/bbfdm/plugins/X_IOPSYS_EU_WiFi.json b/test/files/etc/bbfdm/plugins/X_IOPSYS_EU_WiFi.json index 8985b23c..093c552b 100644 --- a/test/files/etc/bbfdm/plugins/X_IOPSYS_EU_WiFi.json +++ b/test/files/etc/bbfdm/plugins/X_IOPSYS_EU_WiFi.json @@ -1,109 +1,125 @@ { - "Device.WiFi.X_IOPSYS_EU_Radio.{i}.": { - "type": "object", - "protocols": [ - "cwmp", - "usp" - ], - "access": false, - "array": true, - "mapping": { - "type": "ubus", - "ubus": { - "object": "wifi", - "method": "status", - "args": {}, - "key": "radios" - } - }, - "Noise": { - "type": "int", - "read": true, - "write": true, - "protocols": [ - "cwmp", - "usp" - ], - "mapping": [ - { - "type" : "ubus", - "ubus" : { - "object" : "wifi", - "method" : "status", - "args" : {}, - "key" : "radios[@i-1].noise" - } - } - ] - }, - "Band": { - "type": "string", - "read": true, - "write": true, - "protocols": [ - "cwmp", - "usp" - ], - "mapping": [ - { - "type" : "ubus", - "ubus" : { - "object" : "wifi", - "method" : "status", - "args" : {}, - "key" : "radios[@i-1].band" - } - } - ] - }, - "Device.WiFi.X_IOPSYS_EU_Radio.{i}.Stats.": { - "type": "object", - "protocols": [ - "cwmp", - "usp" - ], - "access": false, - "array": false, - "BytesSent": { - "type": "unsignedInt", - "read": true, - "write": true, - "protocols": [ - "cwmp", - "usp" - ], - "mapping": [ - { - "type" : "ubus", - "ubus" : { - "object" : "wifi", - "method" : "status", - "args" : {}, - "key" : "radios[@i-1].stats.tx_bytes" - } - } - ] - }, - "PacketsReceived": { - "type": "unsignedInt", - "read": true, - "write": true, - "protocols": [ - "cwmp", - "usp" - ], - "mapping": [ - { - "type" : "ubus", - "ubus" : { - "object" : "wifi", - "method" : "status", - "args" : {}, - "key" : "radios[@i-1].stats.rx_packets" - } - } - ] - } - } - } + "json_plugin_version": 2, + "Device.WiFi.": { + "type": "object", + "protocols": [ + "cwmp", + "usp" + ], + "access": false, + "array": false, + "{BBF_VENDOR_PREFIX}RadioNumberOfEntries": { + "type": "unsignedInt", + "protocols": [ + "cwmp", + "usp" + ], + "read": true, + "write": false, + "mapping": [ + { + "type": "ubus", + "ubus": { + "object": "wifi", + "method": "status", + "args": {}, + "key": "radios.@Count" + } + } + ] + }, + "Device.WiFi.{BBF_VENDOR_PREFIX}Radio.{i}.": { + "type": "object", + "protocols": [ + "cwmp", + "usp" + ], + "access": false, + "array": true, + "mapping": [ + { + "type": "ubus", + "ubus": { + "object": "wifi", + "method": "status", + "args": {}, + "key": "radios" + } + } + ], + "Noise": { + "type": "int", + "read": true, + "write": true, + "protocols": [ + "cwmp", + "usp" + ], + "mapping": [ + { + "data": "@Parent", + "type": "json", + "key": "noise" + } + ] + }, + "Band": { + "type": "string", + "read": true, + "write": true, + "protocols": [ + "cwmp", + "usp" + ], + "mapping": [ + { + "data": "@Parent", + "type": "json", + "key": "band" + } + ] + }, + "Device.WiFi.{BBF_VENDOR_PREFIX}Radio.{i}.Stats.": { + "type": "object", + "protocols": [ + "cwmp", + "usp" + ], + "access": false, + "array": false, + "BytesSent": { + "type": "unsignedInt", + "read": true, + "write": true, + "protocols": [ + "cwmp", + "usp" + ], + "mapping": [ + { + "data": "@Parent", + "type": "json", + "key": "stats.tx_bytes" + } + ] + }, + "PacketsReceived": { + "type": "unsignedInt", + "read": true, + "write": true, + "protocols": [ + "cwmp", + "usp" + ], + "mapping": [ + { + "data": "@Parent", + "type": "json", + "key": "stats.rx_packets" + } + ] + } + } + } + } } \ No newline at end of file diff --git a/test/files/etc/config/mapcontroller b/test/files/etc/config/mapcontroller index 5f899cc7..a1b8ba97 100644 --- a/test/files/etc/config/mapcontroller +++ b/test/files/etc/config/mapcontroller @@ -1,6 +1,6 @@ config controller 'controller' option enabled '1' - option registrar '5 2' + option registrar '2 5' option debug '0' option enable_sta_steer '0' option enable_bsta_steer '0' @@ -9,16 +9,29 @@ config controller 'controller' option primary_vid '1' option primary_pcp '0' -config interface 'lan' - config ap option band '2' option ssid 'iopsysWrt-44D43771B810' - option encryption 'MPUEO3L7WHJ45P' + option encryption 'sae-mixed' option key 'PCTQ44TNVKK5NU' option vid '1' option type 'fronthaul' - option network 'lan' + +config ap + option band '5' + option ssid 'iopsysWrt-44D43771B810' + option encryption 'sae-mixed' + option key 'PCTQ44TNVKK5NU' + option vid '1' + option type 'fronthaul' + +config ap + option band '2' + option ssid 'MAP-44D43771B810-BH-5GHz' + option encryption 'sae' + option type 'backhaul' + option vid '1' + option key '029be741b7ff7b4caf9b1b3c48c56030fed877c22f5031bc9cf0132d1672c2c' config ap option band '5' @@ -26,7 +39,6 @@ config ap option encryption 'sae' option type 'backhaul' option vid '1' - option network 'lan' option key '029be741b7ff7b4caf9b1b3c48c56030fed877c22f5031bc9cf0132d1672c2c' config node diff --git a/test/files/usr/libexec/rpcd/wifi.ap.test1 b/test/files/usr/libexec/rpcd/wifi.ap.test1_0 similarity index 100% rename from test/files/usr/libexec/rpcd/wifi.ap.test1 rename to test/files/usr/libexec/rpcd/wifi.ap.test1_0 diff --git a/test/files/usr/libexec/rpcd/wifi.ap.test2 b/test/files/usr/libexec/rpcd/wifi.ap.test2_0 similarity index 100% rename from test/files/usr/libexec/rpcd/wifi.ap.test2 rename to test/files/usr/libexec/rpcd/wifi.ap.test2_0 diff --git a/test/vendor_test/x_test_com_dropbear.c b/test/vendor_test/x_test_com_dropbear.c index d7c9a176..9a1f6446 100644 --- a/test/vendor_test/x_test_com_dropbear.c +++ b/test/vendor_test/x_test_com_dropbear.c @@ -16,16 +16,16 @@ **************************************************************/ int browse_dropbear_instance(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - char *inst = NULL; - struct dmmap_dup *p = NULL; + struct dm_data *curr_data = NULL; LIST_HEAD(dup_list); + char *inst = NULL; synchronize_specific_config_sections_with_dmmap("dropbear", "dropbear", "dmmap_dropbear", &dup_list); - list_for_each_entry(p, &dup_list, list) { + list_for_each_entry(curr_data, &dup_list, list) { - inst = handle_instance(dmctx, parent_node, p->dmmap_section, "dropbearinstance", "dropbearalias"); + inst = handle_instance(dmctx, parent_node, curr_data->dmmap_section, "dropbearinstance", "dropbearalias"); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP) + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)curr_data, inst) == DM_STOP) break; } return 0; @@ -58,8 +58,8 @@ int delete_dropbear_instance(char *refparam, struct dmctx *ctx, void *data, char switch (del_action) { case DEL_INST: - dmuci_delete_by_section(((struct dmmap_dup *)data)->config_section, NULL, NULL); - dmuci_delete_by_section(((struct dmmap_dup *)data)->dmmap_section, NULL, NULL); + dmuci_delete_by_section(((struct dm_data *)data)->config_section, NULL, NULL); + dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL); break; case DEL_ALL: uci_foreach_sections_safe("dropbear", "dropbear", stmp, s) { @@ -80,7 +80,7 @@ int delete_dropbear_instance(char *refparam, struct dmctx *ctx, void *data, char **************************************************************/ static int get_x_test_com_dropbear_password_auth(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - char *res = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "PasswordAuth", "1"); + char *res = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "PasswordAuth", "1"); *value = ((DM_STRCMP(res, "on") == 0) || *res == '1') ? "1" : "0"; return 0; } @@ -96,7 +96,7 @@ static int set_x_test_com_dropbear_password_auth(char *refparam, struct dmctx *c return 0; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "PasswordAuth", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "PasswordAuth", b ? "1" : "0"); return 0; } return 0; @@ -104,7 +104,7 @@ static int set_x_test_com_dropbear_password_auth(char *refparam, struct dmctx *c static int get_x_test_com_dropbear_root_password_auth(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - char *res = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "RootPasswordAuth", "1"); + char *res = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "RootPasswordAuth", "1"); *value = ((DM_STRCMP(res, "on") == 0) || *res == '1') ? "1" : "0"; return 0; } @@ -120,7 +120,7 @@ static int set_x_test_com_dropbear_root_password_auth(char *refparam, struct dmc return 0; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "RootPasswordAuth", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "RootPasswordAuth", b ? "1" : "0"); return 0; } return 0; @@ -128,7 +128,7 @@ static int set_x_test_com_dropbear_root_password_auth(char *refparam, struct dmc static int get_x_test_com_dropbear_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "Port", "22"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "Port", "22"); return 0; } @@ -139,7 +139,7 @@ static int set_x_test_com_dropbear_port(char *refparam, struct dmctx *ctx, void case VALUECHECK: return 0; case VALUESET: - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "Port", value); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "Port", value); return 0; } return 0; @@ -147,7 +147,7 @@ static int set_x_test_com_dropbear_port(char *refparam, struct dmctx *ctx, void static int get_x_test_com_dropbear_root_login(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "RootLogin", value); + dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "RootLogin", value); if ((*value)[0] == '\0' || ((*value)[0] == 'o' && (*value)[1] == 'n') || (*value)[0] == '1' ) *value = "1"; else @@ -166,7 +166,7 @@ static int set_x_test_com_dropbear_root_login(char *refparam, struct dmctx *ctx, return 0; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "RootLogin", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "RootLogin", b ? "1" : "0"); return 0; } return 0; @@ -174,7 +174,7 @@ static int set_x_test_com_dropbear_root_login(char *refparam, struct dmctx *ctx, static int get_x_test_com_dropbear_gateway_ports(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "GatewayPorts", "0"); + *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "GatewayPorts", "0"); return 0; } @@ -189,7 +189,7 @@ static int set_x_test_com_dropbear_gateway_ports(char *refparam, struct dmctx *c return 0; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "GatewayPorts", b ? "1" : ""); + dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "GatewayPorts", b ? "1" : ""); return 0; } return 0;