From 6df8fecbcc72e55f2ba06ae933dcddb6f725b204 Mon Sep 17 00:00:00 2001 From: Amin Ben Romdhane Date: Thu, 30 May 2024 07:51:00 +0000 Subject: [PATCH] Move Device.WiFi. to wifidmd --- README.md | 1 + docs/guide/libbbfdm-api_json_plugin_v1.md | 4 +- libbbfdm-api/plugin/dotso_plugin.c | 4 +- libbbfdm-api/plugin/json_plugin.c | 2 +- libbbfdm/CMakeLists.txt | 4 - libbbfdm/dmtree/tr181/device.c | 2 - libbbfdm/dmtree/tr181/wifi.c | 4395 --------------- libbbfdm/dmtree/tr181/wifi.dataelements.c | 4821 ----------------- libbbfdm/dmtree/tr181/wifi.dataelements.h | 89 - libbbfdm/dmtree/tr181/wifi.h | 46 - test/cmocka/functional_test_bbfd.c | 20 +- .../share/bbfdm/plugins/X_IOPSYS_EU_WiFi.json | 6 +- test/wifi_dataelements/Makefile | 16 - test/wifi_dataelements/wifi_dataelements.c | 25 - test/wifi_dataelements/wifi_dataelements.json | 14 - tools/bbf_common.py | 3 +- tools/tools_input.json | 37 +- 17 files changed, 53 insertions(+), 9436 deletions(-) delete mode 100644 libbbfdm/dmtree/tr181/wifi.c delete mode 100644 libbbfdm/dmtree/tr181/wifi.dataelements.c delete mode 100644 libbbfdm/dmtree/tr181/wifi.dataelements.h delete mode 100644 libbbfdm/dmtree/tr181/wifi.h delete mode 100644 test/wifi_dataelements/Makefile delete mode 100644 test/wifi_dataelements/wifi_dataelements.c delete mode 100755 test/wifi_dataelements/wifi_dataelements.json diff --git a/README.md b/README.md index 6a0b1acd..999f4e73 100644 --- a/README.md +++ b/README.md @@ -111,6 +111,7 @@ All supported tools are presented in this file[BBFDM Tools](./tools/README.md) | Device.Ethernet. | ethmngr | https://dev.iopsys.eu/hal/ethmngr.git | | Device.QoS. | qosmngr | https://dev.iopsys.eu/hal/qosmngr.git | | Device.SSH. | sshmngr | https://dev.iopsys.eu/network/sshmngr.git | +| Device.WiFi. | wifidmd | https://dev.iopsys.eu/bbf/wifidmd.git | | Device.USB. | usbmngr | https://dev.iopsys.eu/system/usbmngr.git | | Device.Bridging. | bridgemngr | https://dev.iopsys.eu/network/bridgemngr.git | | Device.IP.Diagnostics. | tr143 | https://dev.iopsys.eu/bbf/tr143d.git | diff --git a/docs/guide/libbbfdm-api_json_plugin_v1.md b/docs/guide/libbbfdm-api_json_plugin_v1.md index 0476887b..e46ef90f 100644 --- a/docs/guide/libbbfdm-api_json_plugin_v1.md +++ b/docs/guide/libbbfdm-api_json_plugin_v1.md @@ -244,7 +244,7 @@ These are special parameters all with a suffix "NumberOfEntries", which has coun For multi-instance on ubus mapping, it has to point to an array of objects, so for NumberOfEntries, we need to get the size of that array, which is refered here as `@Count` ```bash { - "Device.WiFi.X_IOPSYS_EU_RadioNumberOfEntries": { + "Device.X_IOPSYS_EU_WiFi.RadioNumberOfEntries": { "type": "unsignedInt", "protocols": [ "cwmp", @@ -384,7 +384,7 @@ Multi-instance mapping either maps to array of json objects or uci section, so f Ubus example for the same ```json { - "Device.WiFi.X_IOPSYS_EU_Radio.{i}.": { + "Device.X_IOPSYS_EU_WiFi.Radio.{i}.": { "type": "object", "protocols": [ "cwmp", diff --git a/libbbfdm-api/plugin/dotso_plugin.c b/libbbfdm-api/plugin/dotso_plugin.c index 5a30fa3c..6772246d 100644 --- a/libbbfdm-api/plugin/dotso_plugin.c +++ b/libbbfdm-api/plugin/dotso_plugin.c @@ -62,7 +62,7 @@ int load_dotso_plugins(DMOBJ *entryobj, const char *plugin_path) void *handle = dlopen(plugin_path, RTLD_LAZY); #endif if (!handle) { - BBF_DEBUG("Plugin failed [%s]\n", dlerror()); + BBF_ERR("Plugin failed [%s]\n", dlerror()); return 0; } @@ -72,7 +72,7 @@ int load_dotso_plugins(DMOBJ *entryobj, const char *plugin_path) if (dynamic_obj == NULL) { dlclose(handle); - BBF_DEBUG("Plugin %s missing init symbol ...", plugin_path); + BBF_ERR("Plugin %s missing init symbol ...", plugin_path); return 0; } diff --git a/libbbfdm-api/plugin/json_plugin.c b/libbbfdm-api/plugin/json_plugin.c index 0bffa98a..e58e9523 100644 --- a/libbbfdm-api/plugin/json_plugin.c +++ b/libbbfdm-api/plugin/json_plugin.c @@ -2055,7 +2055,7 @@ int load_json_plugins(DMOBJ *entryobj, const char *plugin_path) json_object *json = json_object_from_file(plugin_path); if (!json) { - BBF_DEBUG("Plugin failed [%s]\n", plugin_path); + BBF_ERR("Plugin failed [%s]\n", plugin_path); return 0; } diff --git a/libbbfdm/CMakeLists.txt b/libbbfdm/CMakeLists.txt index 8fb95927..8da7597e 100644 --- a/libbbfdm/CMakeLists.txt +++ b/libbbfdm/CMakeLists.txt @@ -8,7 +8,6 @@ ADD_DEFINITIONS(-DBBF_VENDOR_PREFIX="${BBF_VENDOR_PREFIX}") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${CMAKE_SOURCE_DIR} -I${CMAKE_CURRENT_SOURCE_DIR} -I${CMAKE_CURRENT_SOURCE_DIR}/dmtree") OPTION(BBF_TR181 "build with tr181 datamodel" ON) -OPTION(BBF_WIFI_DATAELEMENTS "build with wifi dataelements datamodel" ON) SET(BBF_DM_SOURCES dmlayer.c) @@ -16,9 +15,6 @@ IF(BBF_TR181) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}/dmtree/tr181") FILE(GLOB BBF_TR181_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/dmtree/tr181/*.c) add_compile_definitions(BBF_TR181) - IF(BBF_WIFI_DATAELEMENTS) - add_compile_definitions(BBF_WIFI_DATAELEMENTS) - ENDIF(BBF_WIFI_DATAELEMENTS) ENDIF(BBF_TR181) ADD_LIBRARY(bbfdm SHARED ${BBF_DM_SOURCES} ${BBF_TR181_SOURCES}) diff --git a/libbbfdm/dmtree/tr181/device.c b/libbbfdm/dmtree/tr181/device.c index 61a8cb87..b4382efb 100644 --- a/libbbfdm/dmtree/tr181/device.c +++ b/libbbfdm/dmtree/tr181/device.c @@ -13,7 +13,6 @@ #include "device.h" #include "deviceinfo.h" #include "ip.h" -#include "wifi.h" #include "ppp.h" #include "routing.h" #include "interfacestack.h" @@ -70,7 +69,6 @@ DM_MAP_OBJ tDynamicObj[] = { DMOBJ tDeviceObj[] = { /* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/ {"DeviceInfo", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDeviceInfoObj, tDeviceInfoParams, NULL, BBFDM_BOTH, NULL}, -{"WiFi", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiObj, tWiFiParams, NULL, BBFDM_BOTH, NULL}, {"IP", &DMREAD, NULL, NULL, "file:/etc/config/network", NULL, NULL, NULL, tIPObj, tIPParams, NULL, BBFDM_BOTH, NULL}, {"PPP", &DMREAD, NULL, NULL, "file:/lib/netifd/proto/ppp.sh,/etc/config/network", NULL, NULL, NULL, tPPPObj, tPPPParams, NULL, BBFDM_BOTH, NULL}, {"Routing", &DMREAD, NULL, NULL, "file:/etc/config/network", NULL, NULL, NULL, tRoutingObj, tRoutingParams, NULL, BBFDM_BOTH, NULL}, diff --git a/libbbfdm/dmtree/tr181/wifi.c b/libbbfdm/dmtree/tr181/wifi.c deleted file mode 100644 index 9875bc28..00000000 --- a/libbbfdm/dmtree/tr181/wifi.c +++ /dev/null @@ -1,4395 +0,0 @@ -/* - * Copyright (C) 2023 IOPSYS Software Solutions AB - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 2.1 - * as published by the Free Software Foundation - * - * Author: Omar Kallel - * Author: Anis Ellouze - * Author: Amin Ben Romdhane - * Author: Saurabh Verma - * - */ - -#include - -#include "wifi.h" - -#ifdef BBF_WIFI_DATAELEMENTS -#include "wifi.dataelements.h" -#endif - -#define MAX_POWER_INDEX 64 -#define UBUS_OBJ_LEN 32 - -static char *MFP_Config[] = {"Disabled", "Optional", "Required", NULL}; - -struct radio_obj -{ - char obj_name[15]; - bool scan_done; -}; - -struct radio_scan_args -{ - struct radio_obj *radio; - uint32_t obj_count; - struct blob_attr *msg; -}; - -struct radio_power_args -{ - int transmit_power[MAX_POWER_INDEX]; - int power_count; -}; - -/************************************************************************** -* INIT -***************************************************************************/ -static inline int init_wifi_radio_power(struct dm_data *curr_data) -{ - json_object *res = NULL, *arrobj = NULL, *power = NULL; - int i = 0, j = 0, ind = 0; - - 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; - - dmubus_call("iwinfo", "txpowerlist", UBUS_ARGS{{"device", device, String}}, 1, &res); - dmjson_foreach_obj_in_array(res, arrobj, power, i, 1, "results") { - char *dbm = dmjson_get_value(power, 1, "dbm"); - if (!dbm) - continue; - int power_dbm = (int)strtod(dbm, NULL); - if (ind < MAX_POWER_INDEX) { - curr_radio_power->transmit_power[ind] = power_dbm; - 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 (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; - } - } - } - - return 0; -} - -/************************************************************* -* COMMON FUNCTIONS -**************************************************************/ -static char *get_radio_option_nocache(const char *device_name, char *option) -{ - json_object *res = NULL; - char object[UBUS_OBJ_LEN]; - - snprintf(object, sizeof(object), "wifi.radio.%s", device_name); - dmubus_call(object, "status", UBUS_ARGS{0}, 0, &res); - - return (res) ? dmjson_get_value(res, 1, option) : ""; -} - -static char *get_data_model_mode(const char *ubus_mode) -{ - if (DM_LSTRCMP(ubus_mode, "WEP64") == 0) - return "WEP-64"; - else if (DM_LSTRCMP(ubus_mode, "WEP128") == 0) - return "WEP-128"; - else if (DM_LSTRCMP(ubus_mode, "WPAPSK") == 0) - return "WPA-Personal"; - else if (DM_LSTRCMP(ubus_mode, "WPA2PSK") == 0) - return "WPA2-Personal"; - else if (DM_LSTRCMP(ubus_mode, "WPA3PSK") == 0) - return "WPA3-Personal"; - else if (DM_LSTRCMP(ubus_mode, "WPAPSK+WPA2PSK") == 0) - return "WPA-WPA2-Personal"; - else if (DM_LSTRCMP(ubus_mode, "WPA2PSK+WPA3PSK") == 0) - return "WPA3-Personal-Transition"; - else if (DM_LSTRCMP(ubus_mode, "WPA") == 0) - return "WPA-Enterprise"; - else if (DM_LSTRCMP(ubus_mode, "WPA2") == 0) - return "WPA2-Enterprise"; - else if (DM_LSTRCMP(ubus_mode, "WPA3") == 0) - return "WPA3-Enterprise"; - else if (DM_LSTRCMP(ubus_mode, "WPA+WPA2") == 0) - return "WPA-WPA2-Enterprise"; - else - return "None"; -} - -static char *get_data_model_standard(char *standard) -{ - char *p = DM_LSTRSTR(standard, "802.11"); - if (p) { - char *res = dmstrdup(p + strlen("802.11")); - replace_char(res, '/', ','); - return res; - } - - return standard; -} - -static int get_sub_band(const char *cc) -{ - int sub_band = 0; - - if (cc == NULL) - return 0; - - switch (DM_STRTOL(cc)) { - case 31: - case 95: - case 159: - sub_band = 1; - break; - case 63: - case 127: - case 191: - sub_band = 2; - break; - default: - break; - } - - return sub_band; -} - -// Use 20MHz as default value, in case of null or 0 -static char *get_data_model_band(const char *bandwidth, const char *ccfs0, const char *ccfs1) -{ - char *band = NULL; - int sub_band = 0; - const char *tmp = "20"; - - if (DM_STRLEN(bandwidth) == 0) { - tmp = "20"; - } else { - if (DM_LSTRCMP(bandwidth, "320") != 0) { - tmp = bandwidth; - } else { - sub_band = get_sub_band(ccfs0); - if (!sub_band) { - sub_band = get_sub_band(ccfs1); - } - - if (!sub_band) { // failed to get sub-band - tmp = bandwidth; - } - } - } - - if (sub_band) { - dmasprintf(&band, "320MHz-%d", sub_band); - } else { - dmasprintf(&band, "%sMHz", tmp); - } - - return band; -} - -static int get_supported_modes(const char *ubus_method, const char *ifname, char **value) -{ - char *dm_default_modes_supported = "None,WEP-64,WEP-128,WPA-Personal,WPA2-Personal,WPA3-Personal,WPA-WPA2-Personal,WPA3-Personal-Transition,WPA-Enterprise,WPA2-Enterprise,WPA3-Enterprise,WPA-WPA2-Enterprise"; - char *dm_wifi_driver_modes_supported = "NONE,WEP64,WEP128,WPAPSK,WPA2PSK,WPA3PSK,WPAPSK+WPA2PSK,WPA2PSK+WPA3PSK,WPA,WPA2,WPA3,WPA+WPA2"; - json_object *res = NULL, *supported_modes = NULL; - char list_modes[256], object[32], *mode = NULL; - unsigned pos = 0, idx = 0; - - snprintf(object, sizeof(object), "%s.%s", ubus_method, ifname); - dmubus_call(object, "status", UBUS_ARGS{0}, 0, &res); - DM_ASSERT(res, *value = dm_default_modes_supported); - - list_modes[0] = 0; - dmjson_foreach_value_in_array(res, supported_modes, mode, idx, 1, "supp_security") { - if (!DM_STRSTR(dm_wifi_driver_modes_supported, mode)) - continue; - - pos += snprintf(&list_modes[pos], sizeof(list_modes) - pos, "%s,", get_data_model_mode(mode)); - } - - /* cut tailing ',' */ - if (pos) - list_modes[pos - 1] = 0; - - *value = (*list_modes != '\0') ? dmstrdup(list_modes) : dm_default_modes_supported; - - return 0; -} - -static char *get_security_mode(struct uci_section *section) -{ - char *encryption = NULL; - char *ptrch = NULL; - - dmuci_get_value_by_section_string(section, "encryption", &encryption); - if (!encryption || *encryption == '\0') - return "None"; - - /*Here the encryption type and the cipher are seperated*/ - ptrch = DM_STRCHR(encryption, '+'); - if (ptrch) - *ptrch = '\0'; - - if (DM_LSTRSTR(encryption, "wep")) { - char *key_index = NULL, *key = NULL; - - dmuci_get_value_by_section_string(section, "key", &key_index); - if (key_index && (*key_index) > '0' && (*key_index) < '5' && *(key_index+1) == '\0') { - char buf[16]; - - snprintf(buf, sizeof(buf), "key%s", key_index); - dmuci_get_value_by_section_string(section, buf, &key); - } - return (key && DM_STRLEN(key) == 10) ? "WEP-64" : "WEP-128"; - } - else if (DM_LSTRNCMP(encryption, "psk-mixed", 9) == 0) - return "WPA-WPA2-Personal"; - else if (DM_LSTRNCMP(encryption, "psk2", 4) == 0) - return "WPA2-Personal"; - else if (DM_LSTRNCMP(encryption, "psk", 3) == 0) - return "WPA-Personal"; - else if (DM_LSTRCMP(encryption, "sae") == 0) - return "WPA3-Personal"; - else if (DM_LSTRCMP(encryption, "sae-mixed") == 0) - return "WPA3-Personal-Transition"; - else if (DM_LSTRNCMP(encryption, "wpa-mixed", 9) == 0) - return "WPA-WPA2-Enterprise"; - else if (DM_LSTRNCMP(encryption, "wpa2", 4) == 0) - return "WPA2-Enterprise"; - else if (DM_LSTRNCMP(encryption, "wpa3", 4) == 0) - return "WPA3-Enterprise"; - else if (DM_LSTRNCMP(encryption, "wpa", 3) == 0) - return "WPA-Enterprise"; - else - return "None"; -} - -static void reset_wlan(struct uci_section *s) -{ - dmuci_delete_by_section(s, "wpa_group_rekey", NULL); - dmuci_delete_by_section(s, "key", NULL); - dmuci_delete_by_section(s, "key1", NULL); - dmuci_delete_by_section(s, "key2", NULL); - dmuci_delete_by_section(s, "key3", NULL); - dmuci_delete_by_section(s, "key4", NULL); - dmuci_delete_by_section(s, "auth_server", NULL); - dmuci_delete_by_section(s, "auth_port", NULL); - dmuci_delete_by_section(s, "auth_secret", NULL); -} - -static void generate_wep_key(const char *passphrase, char *buf, size_t len) -{ - unsigned pos = 0, i; - - for (i = 0; i < len/2; i++) { - pos += snprintf(buf + pos, len - pos, "%02X", passphrase[i]); - } -} - -static char *get_default_wpa_key() -{ - char *wpakey; - db_get_value_string("hw", "board", "wpa_key", &wpakey); - return wpakey; -} - -static struct uci_section *find_mapcontroller_section(struct uci_section *wireless_s) -{ - struct uci_section *s = NULL; - char *device = NULL; - char *ssid = NULL; - char *band = NULL; - - if (!file_exists("/etc/config/mapcontroller") || !wireless_s) - return NULL; - - dmuci_get_value_by_section_string(wireless_s, "ssid", &ssid); - dmuci_get_value_by_section_string(wireless_s, "device", &device); - band = get_radio_option_nocache(device, "band"); - - uci_foreach_sections("mapcontroller", "ap", s) { - char *curr_ssid = NULL; - char *curr_band = NULL; - - dmuci_get_value_by_section_string(s, "ssid", &curr_ssid); - dmuci_get_value_by_section_string(s, "band", &curr_band); - - if (DM_STRCMP(curr_ssid, ssid) == 0 && - curr_band[0] == band[0]) { - return s; - } - } - - return NULL; -} - -static bool multi_ap_type_backhaul(struct uci_section *config_section) -{ - bool ret = false; - char *multi_ap = NULL; - - /* multi_ap type - * 1 Backhaul - * 2 Fronthaul - * 3 Combined - * Others None - */ - dmuci_get_value_by_section_string(config_section, "multi_ap", &multi_ap); - if (DM_STRCMP(multi_ap, "1") == 0) - ret = true; - - return ret; -} - -/************************************************************* -* ADD DEL OBJ -**************************************************************/ -static int add_wifi_ssid(char *refparam, struct dmctx *ctx, void *data, char **instance) -{ - struct uci_section *dmmap = NULL; - char ssid[32] = {0}; - - snprintf(ssid, sizeof(ssid), "ssid_%s", *instance); - - dmuci_add_section_bbfdm("dmmap_wireless", "ssid", &dmmap); - dmuci_set_value_by_section(dmmap, "enabled", "0"); - dmuci_set_value_by_section(dmmap, "ssid", ssid); - dmuci_set_value_by_section(dmmap, "name", ssid); - dmuci_set_value_by_section(dmmap, "added_by_user", "1"); - dmuci_set_value_by_section(dmmap, "ssid_instance", *instance); - return 0; -} - -static int delete_wifi_ssid(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) -{ - struct uci_section *ssid_s = NULL, *stmp = NULL, *dmmap_s = NULL; - - switch (del_action) { - case DEL_INST: - 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 dm_data *)data)->config_section)); - dmuci_set_value_by_section(dmmap_s, "added_by_user", "1"); - } - - 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) { - char *ap_sec_name = NULL; - - dmuci_get_value_by_section_string(ssid_s, "ap_section_name", &ap_sec_name); - if (DM_STRLEN(ap_sec_name)) { - struct uci_section *s = get_origin_section_from_config("wireless", "wifi-iface", ap_sec_name); - dmuci_delete_by_section(s, "device", NULL); - dmuci_delete_by_section(s, "ssid", NULL); - - dmmap_s = get_dup_section_in_dmmap("dmmap_wireless", "wifi-iface", section_name(s)); - dmuci_set_value_by_section(dmmap_s, "added_by_user", "1"); - } - - dmuci_delete_by_section(ssid_s, NULL, NULL); - } - break; - } - return 0; -} - -static int add_wifi_accesspoint(char *refparam, struct dmctx *ctx, void *data, char **instance) -{ - struct uci_section *s = NULL, *dmmap_wifi = NULL; - char s_name[32] = {0}; - - snprintf(s_name, sizeof(s_name), "wlan_ap_%s", *instance); - - dmuci_add_section("wireless", "wifi-iface", &s); - dmuci_rename_section_by_section(s, s_name); - dmuci_set_value_by_section(s, "disabled", "1"); - dmuci_set_value_by_section(s, "network", "lan"); - dmuci_set_value_by_section(s, "mode", "ap"); - - dmuci_add_section_bbfdm("dmmap_wireless", "wifi-iface", &dmmap_wifi); - dmuci_set_value_by_section(dmmap_wifi, "section_name", s_name); - dmuci_set_value_by_section(dmmap_wifi, "added_by_user", "1"); - dmuci_set_value_by_section(dmmap_wifi, "ap_instance", *instance); - return 0; -} - -static int delete_wifi_accesspoint(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) -{ - struct uci_section *s = NULL, *dmmap_s = NULL, *stmp = NULL; - - switch (del_action) { - case DEL_INST: - // Remove dmmap section - dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL); - - // Remove config section - 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) { - - // Remove dmmap section - get_dmmap_section_of_config_section("dmmap_wireless", "wifi-iface", section_name(s), &dmmap_s); - dmuci_delete_by_section(dmmap_s, NULL, NULL); - - // Remove config section - dmuci_delete_by_section(s, NULL, NULL); - } - return 0; - } - return 0; -} - -static int addObjWiFiEndPoint(char *refparam, struct dmctx *ctx, void *data, char **instance) -{ - struct uci_section *endpoint_sec = NULL, *dmmap_sec = NULL; - - dmuci_add_section("wireless", "wifi-iface", &endpoint_sec); - dmuci_set_value_by_section(endpoint_sec, "disabled", "1"); - dmuci_set_value_by_section(endpoint_sec, "device", "wl2"); // Should be removed after fixing Device.WiFi.EndPoint.{i}. object - dmuci_set_value_by_section(endpoint_sec, "mode", "sta"); - dmuci_set_value_by_section(endpoint_sec, "network", "lan"); - - dmuci_add_section_bbfdm("dmmap_wireless", "wifi-iface", &dmmap_sec); - dmuci_set_value_by_section(dmmap_sec, "section_name", section_name(endpoint_sec)); - dmuci_set_value_by_section(dmmap_sec, "endpointinstance", *instance); - return 0; -} - -static int delObjWiFiEndPoint(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) -{ - struct uci_section *s = NULL; - - switch (del_action) { - case DEL_INST: - 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) { - struct uci_section *dmmap_section = NULL; - char *mode; - - dmuci_get_value_by_section_string(s, "mode", &mode); - if (DM_LSTRCMP(mode, "sta") != 0) - continue; - - dmuci_set_value_by_section(s, "mode", ""); - - get_dmmap_section_of_config_section("dmmap_wireless", "wifi-iface", section_name(s), &dmmap_section); - dmuci_set_value_by_section(dmmap_section, "endpointinstance", ""); - } - } - return 0; -} - -/************************************************************* -* ENTRY METHOD -**************************************************************/ -/*#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) -{ - struct dm_data *curr_data = NULL; - LIST_HEAD(dup_list); - char *inst = NULL; - - synchronize_specific_config_sections_with_dmmap("wireless", "wifi-device", "dmmap_wireless", &dup_list); - list_for_each_entry(curr_data, &dup_list, list) { - - init_wifi_radio_power(curr_data); - - 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); - return 0; -} - -static void dmmap_synchronizeWiFiSSID(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - struct uci_section *s = NULL, *ss = NULL, *stmp = NULL; - char *user_s = NULL, *ap_sec_name = NULL; - - uci_path_foreach_sections_safe(bbfdm, "dmmap_wireless", "ssid", stmp, s) { - - dmuci_get_value_by_section_string(s, "ap_section_name", &ap_sec_name); - if (DM_STRLEN(ap_sec_name)) { - ss = get_origin_section_from_config("wireless", "wifi-iface", ap_sec_name); - } - - // Remove if backhaul - if (ss && multi_ap_type_backhaul(ss)) { - dmuci_delete_by_section(s, NULL, NULL); - continue; - } - - // section added by user ==> skip it - dmuci_get_value_by_section_string(s, "added_by_user", &user_s); - if (DM_LSTRCMP(user_s, "1") == 0) - continue; - - // if not exist in uci then delete from dmmap - if (!ss) { - dmuci_delete_by_section(s, NULL, NULL); - } - } - - uci_foreach_sections("wireless", "wifi-iface", s) { - char *disabled = NULL, *ssid = NULL, *device = NULL; - - /* filter out backhaul types. */ - if (multi_ap_type_backhaul(s)) - continue; - - dmuci_get_value_by_section_string(s, "disabled", &disabled); - dmuci_get_value_by_section_string(s, "ssid", &ssid); - dmuci_get_value_by_section_string(s, "device", &device); - - // if dmmap section exits ==> skip it - ss = get_dup_section_in_dmmap_opt("dmmap_wireless", "ssid", "ap_section_name", section_name(s)); - if (ss) { - char *dm_ssid = NULL; - - dmuci_get_value_by_section_string(ss, "ssid", &dm_ssid); - if (DM_STRCMP(dm_ssid, ssid)) { // if ssid does not match, sync it - dmuci_set_value_by_section(ss, "enabled", DM_STRLEN(disabled) ? ((*disabled == '1') ? "0" : "1") : "1"); - dmuci_set_value_by_section(ss, "ssid", ssid); - dmuci_set_value_by_section(ss, "device", device); - } - continue; - } - - // section added by user ==> skip it - ss = get_dup_section_in_dmmap("dmmap_wireless", "wifi-iface", section_name(s)); - dmuci_get_value_by_section_string(ss, "added_by_user", &user_s); - if (DM_LSTRCMP(user_s, "1") == 0) - continue; - - dmuci_add_section_bbfdm("dmmap_wireless", "ssid", &ss); - dmuci_set_value_by_section(ss, "ap_section_name", section_name(s)); - dmuci_set_value_by_section(ss, "enabled", DM_STRLEN(disabled) ? ((*disabled == '1') ? "0" : "1") : "1"); - dmuci_set_value_by_section(ss, "ssid", ssid); - dmuci_set_value_by_section(ss, "device", device); - dmuci_set_value_by_section(ss, "name", section_name(s)); - } -} - -/*#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 dm_data curr_data = {0}; - struct uci_section *dmmap_s = NULL; - char *inst = NULL; - - dmmap_synchronizeWiFiSSID(dmctx, parent_node, prev_data, prev_instance); - - uci_path_foreach_sections(bbfdm, "dmmap_wireless", "ssid", dmmap_s) { - struct uci_section *config_s = NULL; - char *ap_sec_name = NULL, *ifname = ""; - - dmuci_get_value_by_section_string(dmmap_s, "ap_section_name", &ap_sec_name); - if (DM_STRLEN(ap_sec_name)) { - config_s = get_origin_section_from_config("wireless", "wifi-iface", ap_sec_name); - if (config_s) dmuci_get_value_by_section_string(config_s, "ifname", &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_data, inst) == DM_STOP) - break; - } - return 0; -} - -/*#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 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(curr_data, &dup_list, list) { - char *mode = NULL, *ifname = NULL; - - dmuci_get_value_by_section_string(curr_data->config_section, "mode", &mode); - if (DM_LSTRCMP(mode, "ap") != 0) - continue; - - /* filter out backhaul types. */ - if (multi_ap_type_backhaul(curr_data->config_section)) - continue; - - dmuci_get_value_by_section_string(curr_data->config_section, "ifname", &ifname); - - 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); - return 0; -} - -/*#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) -{ - 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(curr_data, &dup_list, list) { - char *ifname = NULL, *mode = NULL; - - 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(curr_data->config_section, "ifname", &ifname); - - curr_data->additional_data = (void *)ifname; - - 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); - return 0; -} - -static int browseWiFiEndPointProfileInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - char *ep_instance = NULL; - - 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); - dmuci_set_value_by_section_bbfdm(s, "ep_key", ep_instance); - - 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 *)&curr_data, inst) == DM_STOP) - break; - } - return 0; -} - -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], *inst = NULL; - struct dm_data curr_data = {0}; - int id = 0, i = 0; - - 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 *)&curr_data, inst) == DM_STOP) - return 0; - } - return 0; -} - -/************************************************************************** -* SET & GET VALUE -***************************************************************************/ -/*#Device.WiFi.RadioNumberOfEntries!UCI:wireless/wifi-device/*/ -static int get_WiFi_RadioNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - int cnt = get_number_of_entries(ctx, data, instance, browseWifiRadioInst); - dmasprintf(value, "%d", cnt); - return 0; -} - -/*#Device.WiFi.SSIDNumberOfEntries!UCI:wireless/wifi-iface/*/ -static int get_WiFi_SSIDNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - int cnt = get_number_of_entries(ctx, data, instance, browseWifiSsidInst); - dmasprintf(value, "%d", cnt); - return 0; -} - -/*#Device.WiFi.AccessPointNumberOfEntries!UCI:wireless/wifi-iface/*/ -static int get_WiFi_AccessPointNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - int cnt = get_number_of_entries(ctx, data, instance, browseWifiAccessPointInst); - dmasprintf(value, "%d", cnt); - return 0; -} - -/*#Device.WiFi.EndPointNumberOfEntries!UCI:wireless/wifi-iface/*/ -static int get_WiFi_EndPointNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - int cnt = get_number_of_entries(ctx, data, instance, browseWiFiEndPointInst); - dmasprintf(value, "%d", cnt); - return 0; -} - -static int get_wifi_ssid_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string(((struct dm_data *)data)->dmmap_section, "enabled", value); - return 0; -} - -static int set_wifi_ssid_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - struct uci_section *map_s = NULL; - char *multi_ap = NULL; - bool b; - - 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 dm_data *)data)->config_section, "multi_ap", &multi_ap); - if (DM_STRLEN(multi_ap) && !map_s) - return FAULT_9007; - - return 0; - case VALUESET: - string_to_bool(value, &b); - - // wireless config: Update disabled option - 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 dm_data *)data)->dmmap_section, "enabled", b ? "1" : "0"); - return 0; - } - return 0; -} - -static int get_wifi_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **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 dm_data *)data)->dmmap_section, "ssid", value); - return 0; -} - -static int set_wlan_ssid(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - struct uci_section *map_s = NULL; - char *multi_ap = NULL; - - 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 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 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 dm_data *)data)->dmmap_section, "ssid", value); - return 0; - } - return 0; -} - -static int get_wlan_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **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 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 dm_data *)data)->config_section, "disabled", value); - *value = ((*value)[0] == '1') ? "0" : "1"; - return 0; -} - -static int set_radio_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - - switch (action) { - case VALUECHECK: - if (bbfdm_validate_boolean(ctx, value)) - return FAULT_9007; - return 0; - case VALUESET: - string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "disabled", b ? "0" : "1"); - return 0; - } - return 0; -} - -static int get_radio_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *res = NULL; - - 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 dm_data *)data)->config_section), "up"); - *value = (DM_STRCMP(isup, "false") == 0) ? "Down" : "Up"; - return 0; -} - -static int get_WiFiRadio_LowerLayers(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = ""; - return 0; -} - -static int set_WiFiRadio_LowerLayers(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_string_list(ctx, value, -1, -1, 1024, -1, -1, NULL, NULL)) - return FAULT_9007; - break; - case VALUESET: - break; - } - return 0; -} - -static int get_WiFiRadio_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmasprintf(value, "%s", section_name(((struct dm_data *)data)->config_section)); - return 0; -} - -static int get_WiFiRadio_AutoChannelSupported(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = "true"; - return 0; -} - -/*#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 dm_data *)data)->config_section, "acs_refresh_period", "0"); - return 0; -} - -static int set_WiFiRadio_AutoChannelRefreshPeriod(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "acs_refresh_period", value); - break; - } - return 0; -} - -/*#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 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 dm_data *)data)->config_section, "frag_threshold", "2346"); - return 0; -} - -static int set_WiFiRadio_FragmentationThreshold(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "frag_threshold", value); - break; - } - return 0; -} - -/*#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 dm_data *)data)->config_section, "rts_threshold", "2347"); - return 0; -} - -static int set_WiFiRadio_RTSThreshold(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "rts_threshold", value); - break; - } - return 0; -} - -/*#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 dm_data *)data)->config_section, "beacon_int", "100"); - return 0; -} - -static int set_WiFiRadio_BeaconPeriod(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "beacon_int", value); - break; - } - return 0; -} - -/*#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 dm_data *)data)->config_section, "dtim_period", "2"); - return 0; -} - -static int set_WiFiRadio_DTIMPeriod(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - struct uci_section *s = NULL; - - switch (action) { - case VALUECHECK: - if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - //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 dm_data *)data)->config_section), s) { - char *mode; - - dmuci_get_value_by_section_string(s, "mode", &mode); - - if (DM_LSTRCMP(mode, "ap") != 0) - continue; - - dmuci_set_value_by_section(s, "dtim_period", value); - } - - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "dtim_period", value); - break; - } - return 0; -} - -/*#Device.WiFi.Radio.{i}.OperatingChannelBandwidth!UCI:wireless/wifi-device,@i-1/htmode*/ -static int get_WiFiRadio_OperatingChannelBandwidth(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *htmode = NULL; - - dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "htmode", &htmode); - - if (htmode && *htmode) { - int freq; - - sscanf(htmode, "%*[A-Z]%d", &freq); - dmasprintf(value, "%dMHz", !DM_LSTRCMP(htmode, "NOHT") ? 20 : freq); - } else { - *value = "Auto"; - } - - return 0; -} - -/*#Device.WiFi.Radio.{i}.SupportedOperatingChannelBandwidths!UBUS:wifi.radio.@Name/status//supp_channels[0].bandwidth*/ -static int get_WiFiRadio_SupportedOperatingChannelBandwidths(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *res = NULL; - char object[32]; - char result[128] = {0}; - - 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"); - - char *supp_bw = dmjson_get_value_array_all(res, ",", 1, "supp_bw"); - replace_str(supp_bw, "320MHz", "320MHz-1,320MHz-2", result, sizeof(result)); - - *value = dmstrdup(result); - - return 0; -} - -static int set_WiFiRadio_OperatingChannelBandwidth(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - char *Supported_Operating_Channel_Bandwidth[] = {"20MHz", "40MHz", "80MHz", "160MHz", "320MHz", "80+80MHz", "Auto", NULL}; - char *supported_bandwidths = NULL; - char *curr_htmode = NULL; - char htmode[32]; - int freq; - - switch (action) { - case VALUECHECK: - if (bbfdm_validate_string(ctx, value, -1, -1, Supported_Operating_Channel_Bandwidth, NULL)) - return FAULT_9007; - - // Get the list of all supported operating channel bandwidths - get_WiFiRadio_SupportedOperatingChannelBandwidths(refparam, ctx, data, instance, &supported_bandwidths); - - // Check if the input value is a valid channel bandwidth value - if (!value_exits_in_str_list(supported_bandwidths, ",", value)) { - bbfdm_set_fault_message(ctx, "'%s' bandwidth is not supported by this radio. Possible bandwidths are [%s].", value, supported_bandwidths); - return FAULT_9007; - } - - break; - case VALUESET: - sscanf(value, "%d", &freq); - - 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); - else if (DM_LSTRNCMP(curr_htmode, "VHT", 3) == 0) - snprintf(htmode, sizeof(htmode), "VHT%d", freq); - else if (DM_LSTRNCMP(curr_htmode, "HT", 2) == 0) - snprintf(htmode, sizeof(htmode), "HT%d", freq); - else - snprintf(htmode, sizeof(htmode), "HE%d", freq); - - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "htmode", htmode); - break; - } - return 0; -} - -/*#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 dm_data *)data)->config_section, "short_preamble", value); - *value = ((*value)[0] == '1') ? "short" : "long"; - return 0; -} - -static int set_WiFiRadio_PreambleType(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - char *Preamble_Type[] = {"short", "long", "auto", NULL}; - - switch (action) { - case VALUECHECK: - if (bbfdm_validate_string(ctx, value, -1, -1, Preamble_Type, NULL)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "short_preamble", (DM_LSTRCMP(value, "short") == 0) ? "1" : "0"); - break; - } - return 0; -} - -/*#Device.WiFi.Radio.{i}.IEEE80211hSupported!UBUS:wifi.radio.@Name/dot11h_capable*/ -static int get_WiFiRadio_IEEE80211hSupported(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *res = NULL; - char object[32]; - - 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"); - return 0; -} - -/*#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 dm_data *)data)->config_section, "doth", "0"); - return 0; -} - -static int set_WiFiRadio_IEEE80211hEnabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - switch (action) { - case VALUECHECK: - if (bbfdm_validate_boolean(ctx, value)) - return FAULT_9007; - break; - case VALUESET: - string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "doth", b ? "1" : "0"); - break; - } - return 0; -} - -static int get_WiFiRadio_TransmitPowerSupported(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - int i = 0, len = 0; - char supported_list[125] = {0}; - int space_left = sizeof(supported_list); - - snprintf(supported_list, sizeof(supported_list), "-1,"); - space_left = space_left - 3; - - struct radio_power_args *curr_radio_power = ((struct dm_data *)data)->additional_data; - - if (curr_radio_power->power_count <= 0) - goto end; - - int max_power = curr_radio_power->transmit_power[curr_radio_power->power_count - 1]; - - 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); - - if (space_left >= strlen(strval) + 1) { - snprintf(supported_list + strlen(supported_list), space_left, "%s,", strval); - space_left = space_left - (strlen(strval) + 1); - } - } - -end: - len = strlen(supported_list); - if ((len > 0) && (supported_list[len -1] == ',')) - supported_list[len - 1] = '\0'; - - *value = dmstrdup(supported_list); - return 0; -} - -static int get_WiFiRadio_TransmitPower(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - 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 (curr_radio_power->power_count <= 0) - return 0; - - 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); - - dmasprintf(value, "%d", percent); - - return 0; -} - -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; - - switch (action) { - case VALUECHECK: - get_WiFiRadio_TransmitPowerSupported(refparam, ctx, data, instance, &supported_list); - if (!supported_list) - return FAULT_9007; - - /* check if requested value is present in supported list */ - char *token; - char *rest= supported_list; - while ((token = strtok_r(rest, ",", &rest))) { - if (DM_STRCMP(value, token) == 0) { - found = true; - break; - } - } - - if (found == false) - return FAULT_9007; - - break; - case VALUESET: - if (DM_STRCMP(value, "-1") == 0) { - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "txpower", ""); - break; - } - - if (curr_radio_power->power_count <= 0) - break; - - 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(((struct dm_data *)data)->config_section, "txpower", str_val); - break; - } - - return 0; -} - -/*#Device.WiFi.Radio.{i}.RegulatoryDomain!UCI:wireless/wifi-device,@i-1/country*/ -static int get_WiFiRadio_RegulatoryDomain(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *conf_country, *dmmap_contry = NULL; - - 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; -} - -static int set_WiFiRadio_RegulatoryDomain(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - char *Regulatory_Domain[] = {"^[A-Z][A-Z]$", "^[A-Z][A-Z][ OI]$", NULL}; - - switch (action) { - case VALUECHECK: - if (bbfdm_validate_string(ctx, value, 2, 3, NULL, Regulatory_Domain)) - return FAULT_9007; - break; - case VALUESET: - 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 dm_data *)data)->config_section, "country", value); - break; - } - return 0; -} - -static int get_radio_ccfs0(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *res = NULL; - char object[UBUS_OBJ_LEN] = {0}; - - 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, "ccfs0"); - return 0; -} - -static int get_radio_ccfs1(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *res = NULL; - char object[UBUS_OBJ_LEN] = {0}; - - 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, "ccfs1"); - return 0; -} - -/*#Device.WiFi.Radio.{i}.PossibleChannels!UBUS:wifi.radio.@Name/status//supp_channels[0].channels*/ -static int get_radio_possible_channels(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *res = NULL; - char object[UBUS_OBJ_LEN], *bandwidth = NULL; - - 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 = ""); - - bandwidth = dmjson_get_value(res, 1, "bandwidth"); - - if (DM_STRTOL(bandwidth) == 0) { - dmubus_call(object, "channels", UBUS_ARGS{0}, 0, &res); - } else { - dmubus_call(object, "channels", UBUS_ARGS{{"bandwidth", bandwidth, Integer}}, 1, &res); - } - DM_ASSERT(res, *value = ""); - - *value = dmjson_get_value_array_all(res, ",", 1, "channels"); - return 0; -} - -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 dm_data *)data)->config_section), "channel"); - return 0; -} - -static int get_radio_channel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *channel = NULL; - - 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 dm_data *)data)->config_section), "channel"); - - *value = channel; - return 0; -} - -static int set_radio_channel(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - char *supported_channels = NULL; - - switch (action) { - case VALUECHECK: - if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1","255"}}, 1)) - return FAULT_9007; - - // Get the list of all supported channels - get_radio_possible_channels(refparam, ctx, data, instance, &supported_channels); - - // Check if the input value is a valid channel - if (!value_exits_in_str_list(supported_channels, ",", value)) - return FAULT_9007; - - return 0; - case VALUESET: - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "channel", value); - return 0; - } - return 0; -} - -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 dm_data *)data)->config_section, "channel", value); - if (DM_LSTRCMP(*value, "auto") == 0 || (*value)[0] == '\0') - *value = "1"; - else - *value = "0"; - return 0; -} - -static int set_radio_auto_channel_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - - switch (action) { - case VALUECHECK: - if (bbfdm_validate_boolean(ctx, value)) - return FAULT_9007; - return 0; - case VALUESET: - string_to_bool(value, &b); - if (b) - value = "auto"; - else - value = get_radio_option_nocache(section_name(((struct dm_data *)data)->config_section), "channel"); - - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "channel", value); - return 0; - } - return 0; -} - -/*#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 dm_data *)data)->config_section, "hidden", value); - *value = ((*value)[0] == '1') ? "0" : "1"; - return 0; -} - -static int set_wlan_ap_advertisement_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - - switch (action) { - case VALUECHECK: - if (bbfdm_validate_boolean(ctx, value)) - return FAULT_9007; - return 0; - case VALUESET: - string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "hidden", b ? "0" : "1"); - return 0; - - } - return 0; -} - -/*#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 dm_data *)data)->config_section, "wmm", "1"); - return 0; -} - -static int set_wmm_enabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - - switch (action) { - case VALUECHECK: - if (bbfdm_validate_boolean(ctx, value)) - return FAULT_9007; - return 0; - case VALUESET: - string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "wmm", value); - return 0; - } - return 0; -} - -/*#Device.WiFi.AccessPoint.{i}.MACAddressControlEnabled!UCI:wireless/wifi-iface,@i-1/macfilter*/ -static int get_access_point_control_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *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 - *value = "true"; - return 0; -} - -static int get_WiFiAccessPoint_WMMCapability(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = "true"; - return 0; -} - -/*#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 dm_data *)data)->config_section, "maxassoc", "32"); - return 0; -} - -static int set_WiFiAccessPoint_MaxAllowedAssociations(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "maxassoc", value); - break; - } - return 0; -} - -/*#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 dm_data *)data)->config_section, "isolate", "0"); - return 0; -} - -static int set_WiFiAccessPoint_IsolationEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - - switch (action) { - case VALUECHECK: - if (bbfdm_validate_boolean(ctx, value)) - return FAULT_9007; - break; - case VALUESET: - string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "isolate", b ? "1" : "0"); - break; - } - return 0; -} - -/*#Device.WiFi.AccessPoint.{i}.AllowedMACAddress!UCI:wireless/wifi-iface,@i-1/maclist*/ -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 dm_data *)data)->config_section, "maclist", &val); - *value = dmuci_list_to_string(val, ","); - return 0; -} - -static int set_WiFiAccessPoint_AllowedMACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - size_t length; - int i; - char **arr; - - switch (action) { - case VALUECHECK: - if (bbfdm_validate_string_list(ctx, value, -1, -1, -1, -1, 17, NULL, MACAddress)) - return FAULT_9007; - break; - case VALUESET: - arr = strsplit(value, ",", &length); - 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 dm_data *)data)->config_section, "maclist", arr[i]); - break; - } - return 0; -} - -static int get_WiFiAccessPoint_UAPSDCapability(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = "true"; - return 0; -} - -static int set_access_point_control_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - - switch (action) { - case VALUECHECK: - if (bbfdm_validate_boolean(ctx, value)) - return FAULT_9007; - return 0; - case VALUESET: - string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "macfilter", b ? "allow" : "disable"); - return 0; - } - return 0; -} - -/*#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 dm_data *)data)->config_section, "wmm_apsd", "0"); - return 0; -} - -static int set_WiFiAccessPoint_UAPSDEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - - switch (action) { - case VALUECHECK: - if (bbfdm_validate_boolean(ctx, value)) - return FAULT_9007; - break; - case VALUESET: - string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "wmm_apsd", b ? "1" : "0"); - break; - } - return 0; -} - -static int get_access_point_security_supported_modes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **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) -{ - int i, g1 = 0, g2 =0; - char *security_modes[3] = { - "WEP-64, WEP-128", - "WPA-Personal, WPA2-Personal, WPA3-Personal, WPA-WPA2-Personal, WPA3-Personal-Transition", - "WPA-Enterprise, WPA2-Enterprise, WPA3-Enterprise, WPA-WPA2-Enterprise"}; - - for (i = 0; i < 3; i++) { - if (DM_STRSTR(security_modes[i], mode1)) { - g1 = i; - } - - if (DM_STRSTR(security_modes[i], mode2)) { - g2 = i; - } - } - - return (g1 != g2); - -} - -static void set_security_mode(struct uci_section *wireless_s, struct uci_section *map_s, struct uci_section *dmmap, char *value) -{ - char *wpa_key = NULL; - char *dmmap_key = NULL; - char *mode = get_security_mode(wireless_s); - - // Use default key only in case the key is not set - dmuci_get_value_by_section_string(wireless_s, "key", &wpa_key); - if (DM_STRLEN(wpa_key) == 0) - wpa_key = get_default_wpa_key(); - - if (mode && DM_STRCMP(value, mode) != 0) { - // Only reset the wlan key section if its belongs to different group - if (is_different_group(value, mode)) - reset_wlan(wireless_s); - dmuci_set_value_by_section(wireless_s, "ieee80211w", "0"); - - if (DM_LSTRCMP(value, "None") == 0) { - dmuci_set_value_by_section(wireless_s, "encryption", "none"); - - if (map_s) dmuci_set_value_by_section(map_s, "encryption", "none"); - } else if (DM_LSTRCMP(value, "WEP-64") == 0) { - char key[16], buf[11]; - int i; - - generate_wep_key("iopsys", buf, sizeof(buf)); - for (i = 0; i < 4; i++) { - snprintf(key, sizeof(key), "key%d", i + 1); - dmuci_set_value_by_section(wireless_s, key, buf); - } - dmuci_set_value_by_section(wireless_s, "encryption", "wep-open"); - dmuci_set_value_by_section(wireless_s, "key", "1"); - - if (map_s) dmuci_set_value_by_section(map_s, "encryption", "none"); - } else if (DM_LSTRCMP(value, "WEP-128") == 0) { - char key[16], buf[27]; - int i; - - generate_wep_key("iopsys_wep128", buf, sizeof(buf)); - for (i = 0; i < 4; i++) { - snprintf(key, sizeof(key), "key%d", i + 1); - dmuci_set_value_by_section(wireless_s, key, buf); - } - dmuci_set_value_by_section(wireless_s, "encryption", "wep-open"); - dmuci_set_value_by_section(wireless_s, "key", "1"); - - if (map_s) dmuci_set_value_by_section(map_s, "encryption", "none"); - } else if (DM_LSTRCMP(value, "WPA-Personal") == 0) { - // get the key from dmmap if exists - if (dmmap) { - dmuci_get_value_by_section_string(dmmap, "key", &dmmap_key); - if (DM_STRLEN(dmmap_key)) { - wpa_key = dmmap_key; - } - } - dmuci_set_value_by_section(wireless_s, "encryption", "psk"); - dmuci_set_value_by_section(wireless_s, "key", wpa_key); - dmuci_set_value_by_section(wireless_s, "wpa_group_rekey", "3600"); - - if (map_s) dmuci_set_value_by_section(map_s, "encryption", "psk"); - if (map_s) dmuci_set_value_by_section(map_s, "key", wpa_key); - } else if (DM_LSTRCMP(value, "WPA-Enterprise") == 0) { - dmuci_set_value_by_section(wireless_s, "encryption", "wpa"); - dmuci_set_value_by_section(wireless_s, "auth_port", "1812"); - - if (map_s) dmuci_set_value_by_section(map_s, "encryption", "wpa"); - } else if (DM_LSTRCMP(value, "WPA2-Personal") == 0) { - // get the key from dmmap if exists - if (dmmap) { - dmuci_get_value_by_section_string(dmmap, "key", &dmmap_key); - if (DM_STRLEN(dmmap_key)) { - wpa_key = dmmap_key; - } - } - dmuci_set_value_by_section(wireless_s, "encryption", "psk2"); - dmuci_set_value_by_section(wireless_s, "key", wpa_key); - dmuci_set_value_by_section(wireless_s, "wpa_group_rekey", "3600"); - dmuci_set_value_by_section(wireless_s, "wps_pushbutton", "1"); - dmuci_set_value_by_section(wireless_s, "ieee80211w", "1"); - - if (map_s) dmuci_set_value_by_section(map_s, "encryption", "psk2"); - if (map_s) dmuci_set_value_by_section(map_s, "key", wpa_key); - } else if (DM_LSTRCMP(value, "WPA2-Enterprise") == 0) { - dmuci_set_value_by_section(wireless_s, "encryption", "wpa2"); - dmuci_set_value_by_section(wireless_s, "auth_port", "1812"); - dmuci_set_value_by_section(wireless_s, "ieee80211w", "1"); - - if (map_s) dmuci_set_value_by_section(map_s, "encryption", "wpa2"); - } else if (DM_LSTRCMP(value, "WPA-WPA2-Personal") == 0) { - // get the key from dmmap if exists - if (dmmap) { - dmuci_get_value_by_section_string(dmmap, "key", &dmmap_key); - if (DM_STRLEN(dmmap_key)) { - wpa_key = dmmap_key; - } - } - dmuci_set_value_by_section(wireless_s, "encryption", "psk-mixed"); - dmuci_set_value_by_section(wireless_s, "key", wpa_key); - dmuci_set_value_by_section(wireless_s, "wpa_group_rekey", "3600"); - dmuci_set_value_by_section(wireless_s, "wps_pushbutton", "1"); - - if (map_s) dmuci_set_value_by_section(map_s, "encryption", "psk-mixed"); - if (map_s) dmuci_set_value_by_section(map_s, "key", wpa_key); - } else if (DM_LSTRCMP(value, "WPA-WPA2-Enterprise") == 0) { - dmuci_set_value_by_section(wireless_s, "encryption", "wpa-mixed"); - dmuci_set_value_by_section(wireless_s, "auth_port", "1812"); - - if (map_s) dmuci_set_value_by_section(map_s, "encryption", "wpa-mixed"); - } else if (DM_LSTRCMP(value, "WPA3-Personal") == 0) { - // get the key from dmmap if exists - if (dmmap) { - dmuci_get_value_by_section_string(dmmap, "SAEPassphrase", &dmmap_key); - if (DM_STRLEN(dmmap_key)) { - wpa_key = dmmap_key; - } - } - dmuci_set_value_by_section(wireless_s, "encryption", "sae"); - dmuci_set_value_by_section(wireless_s, "key", wpa_key); - dmuci_set_value_by_section(wireless_s, "ieee80211w", "2"); - - if (map_s) dmuci_set_value_by_section(map_s, "encryption", "sae"); - if (map_s) dmuci_set_value_by_section(map_s, "key", wpa_key); - } else if (DM_LSTRCMP(value, "WPA3-Enterprise") == 0) { - dmuci_set_value_by_section(wireless_s, "encryption", "wpa3"); - dmuci_set_value_by_section(wireless_s, "auth_port", "1812"); - - if (map_s) dmuci_set_value_by_section(map_s, "encryption", "wpa"); - } else if (DM_LSTRCMP(value, "WPA3-Personal-Transition") == 0) { - // get the key from dmmap if exists - if (dmmap) { - dmuci_get_value_by_section_string(dmmap, "SAEPassphrase", &dmmap_key); - if (DM_STRLEN(dmmap_key)) { - wpa_key = dmmap_key; - } - } - dmuci_set_value_by_section(wireless_s, "encryption", "sae-mixed"); - dmuci_set_value_by_section(wireless_s, "key", wpa_key); - dmuci_set_value_by_section(wireless_s, "ieee80211w", "1"); - - if (map_s) dmuci_set_value_by_section(map_s, "encryption", "sae-mixed"); - if (map_s) dmuci_set_value_by_section(map_s, "key", wpa_key); - } - } -} - -/*#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 dm_data *)data)->config_section); - return 0; -} - -static int set_access_point_security_modes(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - struct uci_section *map_s = NULL; - char *supported_modes = NULL; - char *multi_ap = NULL; - - 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; - - // Get the list of all supported security modes - get_access_point_security_supported_modes(refparam, ctx, data, instance, &supported_modes); - - // Check if the input value is a valid security mode - if (!value_exits_in_str_list(supported_modes, ",", value)) - return FAULT_9007; - - 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 dm_data *)data)->config_section, map_s, ((struct dm_data *)data)->dmmap_section, value); - return 0; - } - return 0; -} - -static int get_access_point_security_wepkey(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *key_index = NULL, buf[16]; - - 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 dm_data *)data)->config_section, buf, value); - return 0; -} - -static int set_access_point_security_wepkey(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - char *encryption; - char *multi_ap = NULL; - - 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 dm_data *)data)->config_section, "multi_ap", &multi_ap); - if (DM_STRLEN(multi_ap)) { - bbfdm_set_fault_message(ctx, "WEP not supported for multi-ap AccessPoints"); - return FAULT_9007; - } - - return 0; - case VALUESET: - 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 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 dm_data *)data)->config_section, buf, value); - } - return 0; - } - return 0; -} - -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 dm_data *)data)->dmmap_section, "PreSharedKey", value); - if (DM_STRLEN(*value) == 0) { - dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "key", value); - } - return 0; -} - -static int set_access_point_security_shared_key(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - struct uci_section *map_s = NULL; - char *multi_ap = NULL; - - 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 dm_data *)data)->config_section, "multi_ap", &multi_ap); - if (DM_STRLEN(multi_ap) && !map_s) - return FAULT_9007; - - return 0; - case VALUESET: - // Set the key in dmmap as well, for get handler - dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "PreSharedKey", value); - - // Set the key in dmmap as well - dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "key", value); - - // wireless config: Update key option - 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) - dmuci_set_value_by_section(map_s, "key", value); - - return 0; - } - return 0; -} - -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 dm_data *)data)->dmmap_section, "KeyPassphrase", value); - if (DM_STRLEN(*value) == 0) { - dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "key", value); - } - return 0; -} - -static int set_access_point_security_passphrase(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - struct uci_section *map_s = NULL; - - map_s = find_mapcontroller_section(((struct dm_data *)data)->config_section); - switch (action) { - case VALUECHECK: - if (bbfdm_validate_string(ctx, value, 8, 63, NULL, NULL)) - return FAULT_9007; - return 0; - case VALUESET: - // Set the key in dmmap as well - dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "KeyPassphrase", value); - - // Set the key in dmmap as well - dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "key", value); - - // wireless config: Update key option - 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) - dmuci_set_value_by_section(map_s, "key", value); - return 0; - } - return 0; -} - -/*#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 dm_data *)data)->config_section, "wpa_group_rekey", "0"); - return 0; -} - -static int set_access_point_security_rekey_interval(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1)) - return FAULT_9007; - return 0; - case VALUESET: - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "wpa_group_rekey", value); - return 0; - } - return 0; -} - -/*#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 dm_data *)data)->dmmap_section, "SAEPassphrase", value); - if (DM_STRLEN(*value) == 0) { - dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "key", value); - } - return 0; -} - -static int set_WiFiAccessPointSecurity_SAEPassphrase(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - struct uci_section *map_s = NULL; - char *multi_ap = NULL; - - 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 dm_data *)data)->config_section, "multi_ap", &multi_ap); - if (DM_STRLEN(multi_ap) && !map_s) - return FAULT_9007; - - break; - case VALUESET: - // Set the key in dmmap as well - dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "SAEPassphrase", value); - - // wireless config: Update key option - 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) - dmuci_set_value_by_section(map_s, "key", value); - break; - } - return 0; -} - -/*#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 dm_data *)data)->config_section, "auth_server", value); - return 0; -} - -static int set_access_point_security_radius_ip_address(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_string(ctx, value, -1, 45, NULL, IPAddress)) - return FAULT_9007; - return 0; - case VALUESET: - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "auth_server", value); - return 0; - } - return 0; -} - -/*#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 dm_data *)data)->config_section, "auth_port", "1812"); - return 0; -} - -static int set_access_point_security_radius_server_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1)) - return FAULT_9007; - return 0; - case VALUESET: - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "auth_port", value); - return 0; - } - return 0; -} - -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 dm_data *)data)->config_section, "auth_secret", value); - return 0; -} - -static int set_access_point_security_radius_secret(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_string(ctx, value, -1, -1, NULL, NULL)) - return FAULT_9007; - return 0; - case VALUESET: - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "auth_secret", value); - return 0; - } - return 0; -} - -/*#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 dm_data *)data)->config_section, "ieee80211w", value); - - if (*value[0] == '1') - *value = "Optional"; - else if (*value[0] == '2') - *value = "Required"; - else - *value = "Disabled"; - return 0; -} - -static void get_cipher(char *encryption, bool *aes, bool *sae, bool *tkip) -{ - char *token = NULL, *saveptr = NULL; - - for (token = strtok_r(encryption, "+", &saveptr); token; token = strtok_r(NULL, "+", &saveptr)) { - - if (DM_LSTRCMP(token, "aes") == 0) - *aes = true; - - if (DM_LSTRCMP(token, "sae") == 0) - *sae = true; - - if (DM_LSTRCMP(token, "tkip") == 0) - *tkip = true; - } -} - - -static int validate_mfp_config(struct uci_section *section, const char *value) -{ - char *encryption = NULL; - char *mode = NULL; - - bool aes = false, sae = false, tkip = false; - - if (!value || *value == '\0') - return -1; - - mode = get_security_mode(section); - if (!mode || *mode == '\0') - return -1; - - dmuci_get_value_by_section_string(section, "encryption", &encryption); - if (!encryption || *encryption == '\0') - return -1; - - /*Here we get which cipher is true*/ - get_cipher(encryption, &aes, &sae, &tkip); - - if ((DM_LSTRCMP(mode, "WPA3-Personal")) == 0) { - if ((sae == true || aes == true) && (tkip == false) && (DM_LSTRCMP(value, "Required") == 0)) - return 0; - else - return -1; - } else if (DM_LSTRCMP(mode, "WPA2-Personal") == 0) { - if ((aes == true) && (tkip == false) && (DM_LSTRCMP(value, "Optional") == 0)) - return 0; - else - return -1; - - } else if (DM_LSTRCMP(mode, "WPA3-Personal-Transition") == 0) { - if ((sae == true || aes == true) && (tkip == false) && (DM_LSTRCMP(value, "Optional") == 0)) - return 0; - else - return -1; - } else if (DM_LSTRCMP(value, "Disabled") == 0) - return 0; - else - return -1; -} - -static int set_WiFiAccessPointSecurity_MFPConfig(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - char buf[2]; - - switch (action) { - case VALUECHECK: - if (bbfdm_validate_string(ctx, value, -1, -1, MFP_Config, NULL)) - return FAULT_9007; - - /*Here we also need to validate the encyption algo whether the MFP can be set*/ - if (validate_mfp_config(((struct dm_data *)data)->config_section, value)) - return FAULT_9007; - - break; - case VALUESET: - if (DM_LSTRCMP(value, "Disabled") == 0) - buf[0] = '0'; - else if (DM_LSTRCMP(value, "Optional") == 0) - buf[0] = '1'; - else if (DM_LSTRCMP(value, "Required") == 0) - buf[0] = '2'; - buf[1] = 0; - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "ieee80211w", buf); - break; - } - return 0; -} - -/*#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 dm_data *)data)->config_section, "wps_pushbutton", "0"); - return 0; -} - -static int set_WiFiAccessPointWPS_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - - switch (action) { - case VALUECHECK: - if (bbfdm_validate_boolean(ctx, value)) - return FAULT_9007; - break; - case VALUESET: - string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "wps_pushbutton", b ? "1" : "0"); - break; - } - return 0; -} - -static int get_WiFiAccessPointWPS_ConfigMethodsSupported(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = "PushButton"; - return 0; -} - -static int get_WiFiAccessPointWPS_ConfigMethodsEnabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = "PushButton"; - return 0; -} - -static int set_WiFiAccessPointWPS_ConfigMethodsEnabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_string_list(ctx, value, -1, -1, -1, -1, -1, NULL, NULL)) - return FAULT_9007; - - if (DM_STRCMP(value, "PushButton") != 0) - return FAULT_9007; - - break; - case VALUESET: - // Don't do anything since we only support 'PushButton' - break; - } - return 0; -} - -/*#Device.WiFi.AccessPoint.{i}.WPS.Status!UCI:wireless/wifi-iface,@i-1/wps_pushbutton*/ -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 dm_data *)data)->config_section, "wps_pushbutton", &wps_status); - *value = (wps_status[0] == '1') ? "Configured" : "Disabled"; - return 0; -} - -static operation_args WiFiAccessPointWPSInitiateWPSPBC_args = { - .out = (const char *[]) { - "Status", - NULL - } -}; - -static int get_operate_args_WiFiAccessPointWPS_InitiateWPSPBC(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = (char *)&WiFiAccessPointWPSInitiateWPSPBC_args; - return 0; -} - -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]; - int ubus_ret = 0; - - if (DM_STRLEN(ifname) == 0) - return USP_FAULT_COMMAND_FAILURE; - - snprintf(object, sizeof(object), "hostapd.%s", ifname); - ubus_ret = dmubus_call_set(object, "wps_start", UBUS_ARGS{0}, 0); - if (ubus_ret != 0) - status = "Error_Not_Ready"; - - add_list_parameter(ctx, dmstrdup("Status"), dmstrdup(status), DMT_TYPE[DMT_STRING], NULL); - return 0; -} - -/*#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 dm_data *)data)->config_section, "acct_server", value); - return 0; -} - -static int set_WiFiAccessPointAccounting_ServerIPAddr(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_string(ctx, value, -1, 45, NULL, IPAddress)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "acct_server", value); - break; - } - return 0; -} - -/*#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 dm_data *)data)->config_section, "acct_port", "1813"); - return 0; -} - -static int set_WiFiAccessPointAccounting_ServerPort(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "acct_port", value); - break; - } - return 0; -} - -/*#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 dm_data *)data)->config_section, "acct_secret", value); - return 0; -} - -static int set_WiFiAccessPointAccounting_Secret(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_string(ctx, value, -1, -1, NULL, NULL)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "acct_secret", value); - break; - } - return 0; -} - -/*#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 dm_data *)data)->config_section, "disabled", value); - *value = ((*value)[0] == '1') ? "0" : "1"; - return 0; -} - -static int set_WiFiEndPoint_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - switch (action) { - case VALUECHECK: - if (bbfdm_validate_boolean(ctx, value)) - return FAULT_9007; - break; - case VALUESET: - string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "disabled", b ? "0" : "1"); - break; - } - return 0; -} - -static int get_WiFiEndPoint_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **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 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 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", (char *)((struct dm_data *)data)->additional_data); - - _bbfdm_get_references(ctx, "Device.WiFi.SSID.", "Name", section_name(iface_s), value); - return 0; -} - -static int get_WiFiEndPointStats_LastDataDownlinkRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *res = NULL; - char object[32]; - - 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"); - return 0; -} - -static int get_WiFiEndPointStats_LastDataUplinkRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *res = NULL; - char object[32]; - - 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"); - return 0; -} - -static int get_WiFiEndPointStats_SignalStrength(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *res = NULL; - char object[32]; - - 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"); - return 0; -} - -static int get_WiFiEndPointStats_Retransmissions(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *res = NULL; - char object[32]; - - 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"); - return 0; -} - -static int get_WiFiEndPointSecurity_ModesSupported(char *refparam, struct dmctx *ctx, void *data, char *instance, char **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) -{ - *value = "1"; - return 0; -} - -static int set_WiFiEndPointProfile_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_boolean(ctx, value)) - return FAULT_9007; - break; - case VALUESET: - break; - } - return 0; -} - -static int get_WiFiEndPointProfile_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = "Active"; - return 0; -} - -static int get_dmmap_wireless_section(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value, char *section_name) -{ - struct uci_section *dmmap_section = NULL, *dm = NULL; - char *epinst = NULL; - - 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); - return 0; -} - -static int set_dmmap_wireless_section(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action, char *section_name) -{ - struct uci_section *dmmap_section = NULL, *dm = NULL; - char *epinst = NULL; - - switch (action) { - case VALUECHECK: - if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL)) - return FAULT_9007; - break; - case VALUESET: - 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); - break; - } - return 0; -} - -static int get_WiFiEndPointProfile_Location(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return get_dmmap_wireless_section(refparam, ctx, data, instance, value, "ep_location"); -} - -static int set_WiFiEndPointProfile_Location(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - return set_dmmap_wireless_section(refparam, ctx, data, instance, value, action, "ep_location"); -} - -static int get_WiFiEndPointProfile_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - get_dmmap_wireless_section(refparam, ctx, data, instance, value, "ep_profile_alias"); - if ((*value)[0] == '\0') - dmasprintf(value, "cpe-%s", instance); - return 0; -} - -static int set_WiFiEndPointProfile_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - return set_dmmap_wireless_section(refparam, ctx, data, instance, value, action, "ep_profile_alias"); -} - -/*#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 dm_data *)data)->config_section, "ssid", value); - return 0; -} - -static int set_WiFiEndPointProfile_SSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_string(ctx, value, -1, 32, NULL, NULL)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "ssid", value); - break; - } - return 0; -} - -/*#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 dm_data *)data)->config_section); - return 0; -} - -static int set_WiFiEndPointProfileSecurity_ModeEnabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - struct uci_section *map_s = NULL; - char *supported_modes = NULL; - char *multi_ap = NULL; - - 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; - - // Get the list of all supported security modes - get_WiFiEndPointSecurity_ModesSupported(refparam, ctx, data, instance, &supported_modes); - - // Check if the input value is a valid security mode - if (!value_exits_in_str_list(supported_modes, ",", value)) - return FAULT_9007; - - 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 dm_data *)data)->config_section, map_s, ((struct dm_data *)data)->dmmap_section, value); - return 0; - } - return 0; -} - -static int get_WiFiEndPointProfileSecurity_WEPKey(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *key_index = NULL, buf[16]; - - 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 dm_data *)data)->config_section, buf, value); - return 0; -} - -static int set_WiFiEndPointProfileSecurity_WEPKey(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - char *encryption; - - switch (action) { - case VALUECHECK: - if (bbfdm_validate_hexBinary(ctx, value, RANGE_ARGS{{"5","5"},{"13","13"}}, 2)) - return FAULT_9007; - return 0; - case VALUESET: - 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 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 dm_data *)data)->config_section, buf, value); - } - return 0; - } - return 0; -} - -static int get_WiFiEndPointProfileSecurity_PreSharedKey(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string(((struct dm_data *)data)->dmmap_section, "PreSharedKey", value); - if (DM_STRLEN(*value) == 0) { - dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "key", value); - } - return 0; -} - -static int set_WiFiEndPointProfileSecurity_PreSharedKey(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_hexBinary(ctx, value, RANGE_ARGS{{NULL,"32"}}, 1)) - return FAULT_9007; - return 0; - case VALUESET: - // Set in dmmap as well for get handler - dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "PreSharedKey", value); - dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "key", value); - - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "key", value); - return 0; - } - return 0; -} - -static int get_WiFiEndPointProfileSecurity_KeyPassphrase(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string(((struct dm_data *)data)->dmmap_section, "KeyPassphrase", value); - if (DM_STRLEN(*value) == 0) { - dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "key", value); - } - return 0; -} - -static int set_WiFiEndPointProfileSecurity_KeyPassphrase(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_string(ctx, value, 8, 63, NULL, NULL)) - return FAULT_9007; - return 0; - case VALUESET: - // Set in dmmap as well for get handler - dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "KeyPassphrase", value); - dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "key", value); - - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "key", value); - return 0; - } - return 0; -} - -/*#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 dm_data *)data)->dmmap_section, "SAEPassphrase", value); - if (DM_STRLEN(*value) == 0) { - dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "key", value); - } - return 0; -} - -static int set_WiFiEndPointProfileSecurity_SAEPassphrase(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_string(ctx, value, -1, -1, NULL, NULL)) - return FAULT_9007; - break; - case VALUESET: - // Set in dmmap as well for get handler - dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "SAEPassphrase", value); - - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "key", value); - break; - } - return 0; -} - -/*#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 dm_data *)data)->config_section, "ieee80211w", value); - if(*value[0] == 0 || *value[0] == '0') - *value = "Disabled"; - else if (DM_LSTRCMP(*value, "1") == 0) - *value = "Optional"; - else if (DM_LSTRCMP(*value, "2") == 0) - *value = "Required"; - return 0; -} - -static int set_WiFiEndPointProfileSecurity_MFPConfig(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_string(ctx, value, -1, -1, MFP_Config, NULL)) - return FAULT_9007; - break; - case VALUESET: - if (DM_LSTRCMP(value, "Disabled") == 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 dm_data *)data)->config_section, "ieee80211w", "1"); - else if (DM_LSTRCMP(value, "Required") == 0) - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "ieee80211w", "2"); - break; - } - return 0; -} - -/*#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 dm_data *)data)->config_section, "wps_pushbutton", "0"); - return 0; -} - -static int set_WiFiEndPointWPS_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - - switch (action) { - case VALUECHECK: - if (bbfdm_validate_boolean(ctx, value)) - return FAULT_9007; - break; - case VALUESET: - string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "wps_pushbutton", b ? "1" : "0"); - break; - } - return 0; -} - -static int get_WiFiEndPointWPS_ConfigMethodsSupported(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = "PushButton"; - return 0; -} - -static int get_WiFiEndPointWPS_ConfigMethodsEnabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = "PushButton"; - return 0; -} - -static int set_WiFiEndPointWPS_ConfigMethodsEnabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_string_list(ctx, value, -1, -1, -1, -1, -1, NULL, NULL)) - return FAULT_9007; - - if (DM_STRCMP(value, "PushButton") != 0) - return FAULT_9007; - - break; - case VALUESET: - // Don't do anything since we only support 'PushButton' - break; - } - return 0; -} - -/*#Device.WiFi.EndPoint.{i}.WPS.Status!UCI:wireless/wifi-iface,@i-1/wps_pushbutton*/ -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 dm_data *)data)->config_section, "wps_pushbutton", &wps_status); - *value = (wps_status[0] == '1') ? "Configured" : "Disabled"; - return 0; -} - -/************************************************************************** -* SET AND GET ALIAS -***************************************************************************/ -/*#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 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 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 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 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) -{ - 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) -{ - 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 dm_data *)data)->dmmap_section, "LowerLayers", value); - - if ((*value)[0] == '\0') { - char *device = NULL; - - dmuci_get_value_by_section_string(((struct dm_data *)data)->dmmap_section, "device", &device); - - _bbfdm_get_references(ctx, "Device.WiFi.Radio.", "Name", device, value); - - // Store LowerLayers value - dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "LowerLayers", *value); - } else { - if (!adm_entry_object_exists(ctx, *value)) - *value = ""; - } - - return 0; -} - -static int set_ssid_lower_layer(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - char *allowed_objects[] = {"Device.WiFi.Radio.", NULL}; - struct dm_reference reference = {0}; - - bbfdm_get_reference_linker(ctx, value, &reference); - - switch (action) { - case VALUECHECK: - if (bbfdm_validate_string_list(ctx, reference.path, -1, -1, 1024, -1, -1, NULL, NULL)) - return FAULT_9007; - - if (dm_validate_allowed_objects(ctx, &reference, allowed_objects)) - return FAULT_9007; - - return 0; - case VALUESET: - // Store LowerLayers value under dmmap section - dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "LowerLayers", reference.path); - - dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "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; - } - return 0; -} - -static int get_ap_ssid_ref(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string(((struct dm_data *)data)->dmmap_section, "LowerLayers", value); - - if ((*value)[0] == '\0') { - _bbfdm_get_references(ctx, "Device.WiFi.SSID.", "Name", section_name(((struct dm_data *)data)->config_section), value); - - // Store LowerLayers value - dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "LowerLayers", *value); - } else { - if (!adm_entry_object_exists(ctx, *value)) - *value = ""; - } - - return 0; -} - -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; - struct dm_reference reference = {0}; - - bbfdm_get_reference_linker(ctx, value, &reference); - - switch (action) { - case VALUECHECK: - if (bbfdm_validate_string(ctx, reference.path, -1, 256, NULL, NULL)) - return FAULT_9007; - - if (dm_validate_allowed_objects(ctx, &reference, allowed_objects)) - return FAULT_9007; - - break; - case VALUESET: - // Store LowerLayers value under dmmap_wireless section - 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 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 dm_data *)data)->config_section)); - - dmuci_get_value_by_section_string(ss, "device", &device); - dmuci_get_value_by_section_string(ss, "ssid", &ssid); - dmuci_get_value_by_section_string(ss, "enabled", &enabled); - - bool b = dmuci_string_to_boolean(enabled); - - 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 dm_data *)data)->config_section)); - dmuci_set_value_by_section(ss, "ap_section_name", ""); - - 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; - } - return 0; -} - -static int set_neighboring_wifi_diagnostics_diagnostics_state(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - struct uci_section *s; - - switch (action) { - case VALUECHECK: - if (bbfdm_validate_string(ctx, value, -1, -1, DiagnosticsState, NULL)) - return FAULT_9007; - return 0; - case VALUESET: - if (file_exists("/etc/bbfdm/dmmap/dmmap_wifi_neighboring")) - remove("/etc/bbfdm/dmmap/dmmap_wifi_neighboring"); - - dmuci_add_section_bbfdm("dmmap_wifi_neighboring", "diagnostic_status", &s); - dmuci_set_value_by_section(s, "DiagnosticsState", value); - return 0; - } - return 0; -} - -/*#Device.WiFi.SSID.{i}.BSSID!UBUS:wifi.ap.@Name/status//bssid*/ -static int get_wlan_bssid(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *res = NULL; - char object[32]; - - 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 dm_data *args, const char *name, char **value) -{ - json_object *res = NULL; - char object[32]; - - 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 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->config_section)); - dmubus_call(object, "stats", UBUS_ARGS{0}, 0, &res); - DM_ASSERT(res, *value = "0"); - *value = dmjson_get_value(res, 1, name); - return 0; -} - -/*#Device.WiFi.Radio.{i}.Stats.Noise!UBUS:wifi.radio.@Name/status//noise*/ -static int get_WiFiRadioStats_Noise(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *res = NULL; - char object[UBUS_OBJ_LEN]; - - 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"); - return 0; -} - -/*#Device.WiFi.Radio.{i}.Stats.BytesSent!UBUS:wifi.radio.@Name/stats//tx_bytes*/ -static int get_WiFiRadioStats_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return radio_read_ubus(data, "tx_bytes", value); -} - -/*#Device.WiFi.Radio.{i}.Stats.BytesReceived!UBUS:wifi.radio.@Name/stats//rx_bytes*/ -static int get_WiFiRadioStats_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return radio_read_ubus(data, "rx_bytes", value); -} - -/*#Device.WiFi.Radio.{i}.Stats.PacketsSent!UBUS:wifi.radio.@Name/stats//tx_packets*/ -static int get_WiFiRadioStats_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return radio_read_ubus(data, "tx_packets", value); -} - -/*#Device.WiFi.Radio.{i}.Stats.PacketsReceived!UBUS:wifi.radio.@Name/stats//rx_packets*/ -static int get_WiFiRadioStats_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return radio_read_ubus(data, "rx_packets", value); -} - -/*#Device.WiFi.Radio.{i}.Stats.ErrorsSent!UBUS:wifi.radio.@Name/stats//tx_error_packets*/ -static int get_WiFiRadioStats_ErrorsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return radio_read_ubus(data, "tx_error_packets", value); -} - -/*#Device.WiFi.Radio.{i}.Stats.ErrorsReceived!UBUS:wifi.radio.@Name/stats//rx_error_packets*/ -static int get_WiFiRadioStats_ErrorsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return radio_read_ubus(data, "rx_error_packets", value); -} - -/*#Device.WiFi.Radio.{i}.Stats.DiscardPacketsSent!UBUS:wifi.radio.@Name/stats//tx_dropped_packets*/ -static int get_WiFiRadioStats_DiscardPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return radio_read_ubus(data, "tx_dropped_packets", value); -} - -/*#Device.WiFi.Radio.{i}.Stats.DiscardPacketsReceived!UBUS:wifi.radio.@Name/stats//rx_dropped_packets*/ -static int get_WiFiRadioStats_DiscardPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return radio_read_ubus(data, "rx_dropped_packets", value); -} - -/*#Device.WiFi.Radio.{i}.Stats.FCSErrorCount!UBUS:wifi.radio.@Name/stats//rx_fcs_error_packets*/ -static int get_WiFiRadioStats_FCSErrorCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return radio_read_ubus(data, "rx_fcs_error_packets", value); -} - -/*#Device.WiFi.SSID.{i}.Stats.BytesSent!UBUS:wifi.ap.@Name/stats//tx_bytes*/ -static int get_WiFiSSIDStats_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return ssid_read_ubus(data, "tx_bytes", value); -} - -/*#Device.WiFi.SSID.{i}.Stats.BytesReceived!UBUS:wifi.ap.@Name/stats//rx_bytes*/ -static int get_WiFiSSIDStats_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return ssid_read_ubus(data, "rx_bytes", value); -} - -/*#Device.WiFi.SSID.{i}.Stats.PacketsSent!UBUS:wifi.ap.@Name/stats//tx_packets*/ -static int get_WiFiSSIDStats_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return ssid_read_ubus(data, "tx_packets", value); -} - -/*#Device.WiFi.SSID.{i}.Stats.PacketsReceived!UBUS:wifi.ap.@Name/stats//rx_packets*/ -static int get_WiFiSSIDStats_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return ssid_read_ubus(data, "rx_packets", value); -} - -/*#Device.WiFi.SSID.{i}.Stats.ErrorsSent!UBUS:wifi.ap.@Name/stats//tx_error_packets*/ -static int get_WiFiSSIDStats_ErrorsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return ssid_read_ubus(data, "tx_error_packets", value); -} - -/*#Device.WiFi.SSID.{i}.Stats.ErrorsReceived!UBUS:wifi.ap.@Name/stats//rx_error_packets*/ -static int get_WiFiSSIDStats_ErrorsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return ssid_read_ubus(data, "rx_error_packets", value); -} - -/*#Device.WiFi.SSID.{i}.Stats.DiscardPacketsSent!UBUS:wifi.ap.@Name/stats//tx_dropped_packets*/ -static int get_WiFiSSIDStats_DiscardPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return ssid_read_ubus(data, "tx_dropped_packets", value); -} - -/*#Device.WiFi.SSID.{i}.Stats.DiscardPacketsReceived!UBUS:wifi.ap.@Name/stats//rx_dropped_packets*/ -static int get_WiFiSSIDStats_DiscardPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return ssid_read_ubus(data, "rx_dropped_packets", value); -} - -/*#Device.WiFi.SSID.{i}.Stats.UnicastPacketsSent!UBUS:wifi.ap.@Name/stats//tx_unicast_packets*/ -static int get_WiFiSSIDStats_UnicastPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return ssid_read_ubus(data, "tx_unicast_packets", value); -} - -/*#Device.WiFi.SSID.{i}.Stats.UnicastPacketsReceived!UBUS:wifi.ap.@Name/stats//rx_unicast_packets*/ -static int get_WiFiSSIDStats_UnicastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return ssid_read_ubus(data, "rx_unicast_packets", value); -} - -/*#Device.WiFi.SSID.{i}.Stats.MulticastPacketsSent!UBUS:wifi.ap.@Name/stats//tx_multicast_packets*/ -static int get_WiFiSSIDStats_MulticastPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return ssid_read_ubus(data, "tx_multicast_packets", value); -} - -/*#Device.WiFi.SSID.{i}.Stats.MulticastPacketsReceived!UBUS:wifi.ap.@Name/stats//rx_multicast_packets*/ -static int get_WiFiSSIDStats_MulticastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return ssid_read_ubus(data, "rx_multicast_packets", value); -} - -/*#Device.WiFi.SSID.{i}.Stats.BroadcastPacketsSent!UBUS:wifi.ap.@Name/stats//tx_broadcast_packets*/ -static int get_WiFiSSIDStats_BroadcastPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return ssid_read_ubus(data, "tx_broadcast_packets", value); -} - -/*#Device.WiFi.SSID.{i}.Stats.BroadcastPacketsReceived!UBUS:wifi.ap.@Name/stats//rx_broadcast_packets*/ -static int get_WiFiSSIDStats_BroadcastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return ssid_read_ubus(data, "rx_broadcast_packets", value); -} - -/*#Device.WiFi.SSID.{i}.Stats.RetransCount!UBUS:wifi.ap.@Name/stats//tx_retrans_packets*/ -static int get_WiFiSSIDStats_RetransCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return ssid_read_ubus(data, "tx_retrans_packets", value); -} - -/*#Device.WiFi.SSID.{i}.Stats.FailedRetransCount!UBUS:wifi.ap.@Name/stats//tx_retrans_fail_packets*/ -static int get_WiFiSSIDStats_FailedRetransCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return ssid_read_ubus(data, "tx_retrans_fail_packets", value); -} - -/*#Device.WiFi.SSID.{i}.Stats.RetryCount!UBUS:wifi.ap.@Name/stats//tx_retry_packets*/ -static int get_WiFiSSIDStats_RetryCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return ssid_read_ubus(data, "tx_retry_packets", value); -} - -/*#Device.WiFi.SSID.{i}.Stats.MultipleRetryCount!UBUS:wifi.ap.@Name/stats//tx_multi_retry_packets*/ -static int get_WiFiSSIDStats_MultipleRetryCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return ssid_read_ubus(data, "tx_multi_retry_packets", value); -} - -/*#Device.WiFi.SSID.{i}.Stats.ACKFailureCount!UBUS:wifi.ap.@Name/stats//ack_fail_packets*/ -static int get_WiFiSSIDStats_ACKFailureCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return ssid_read_ubus(data, "ack_fail_packets", value); -} - -/*#Device.WiFi.SSID.{i}.Stats.AggregatedPacketCount!UBUS:wifi.ap.@Name/stats//aggregate_packets*/ -static int get_WiFiSSIDStats_AggregatedPacketCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return ssid_read_ubus(data, "aggregate_packets", value); -} - -/*#Device.WiFi.SSID.{i}.Stats.UnknownProtoPacketsReceived!UBUS:wifi.ap.@Name/stats//rx_unknown_packets*/ -static int get_WiFiSSIDStats_UnknownProtoPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return ssid_read_ubus(data, "rx_unknown_packets", value); -} - -static int get_WiFiAccessPointAssociatedDevice_Active(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = "true"; - return 0; -} - -/*#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(((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(((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(((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); - return 0; -} - -/*#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(((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); - return 0; -} - -/*#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(((struct dm_data *)data)->json_object, 1, "rssi"); - return 0; -} - -/*#Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}.AssociationTime!UBUS:wifi.ap.@Name/stations//stations[i-1].in_network*/ -static int get_WiFiAccessPointAssociatedDevice_AssociationTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = "0001-01-01T00:00:00Z"; - - 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) - return -1; - - char utc_time[32] = {0}; - - if (strftime(utc_time, sizeof(utc_time), "%Y-%m-%dT%H:%M:%SZ", gmtime(&t_time)) == 0) - return -1; - - *value = dmstrdup(utc_time); - } - return 0; -} - -/*#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(((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(((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(((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(((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(((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(((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 dm_data *)data)->config_section, "disabled", value); - *value = ((*value)[0] == '1') ? "0" : "1"; - return 0; -} - -static int set_access_point_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - struct uci_section *map_s = NULL; - char *multi_ap = NULL; - bool b; - - 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 dm_data *)data)->config_section, "multi_ap", &multi_ap); - if (DM_STRLEN(multi_ap) && !map_s) - return FAULT_9007; - - return 0; - case VALUESET: - string_to_bool(value, &b); - - // wireless config: Update disabled option - 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"); - - return 0; - } - return 0; -} - -/*#Device.WiFi.AccessPoint.{i}.Status!UBUS:wifi.ap.@Name/status//status*/ -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], *status = NULL; - - 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"); - - if (DM_LSTRCMP(status, "running") == 0 || DM_LSTRCMP(status, "up") == 0) - *value = "Enabled"; - else - *value = "Disabled"; - return 0; -} - -/*#Device.WiFi.Radio.{i}.MaxBitRate!UBUS:wifi.radio.@Name/status//maxrate*/ -static int get_radio_max_bit_rate (char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *res = NULL; - char object[UBUS_OBJ_LEN]; - - 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"); - return 0; -} - -/*#Device.WiFi.Radio.{i}.SupportedFrequencyBands!UBUS:wifi.radio.@Name/status//supp_bands*/ -static int get_radio_supported_frequency_bands(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *res = NULL; - char object[UBUS_OBJ_LEN]; - - 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"); - return 0; -} - -/*#Device.WiFi.Radio.{i}.OperatingFrequencyBand!UBUS:wifi.radio.@Name/status//band*/ -static int get_radio_frequency(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *res = NULL; - char object[UBUS_OBJ_LEN]; - - 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"); - return 0; -} - -static int set_radio_frequency(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - char *Supported_Frequency_Bands[] = {"2.4GHz", "5GHz", "6GHz", NULL}; - char *supported_frequency_bands = NULL; - - switch (action) { - case VALUECHECK: - if (bbfdm_validate_string(ctx, value, -1, -1, Supported_Frequency_Bands, NULL)) - return FAULT_9007; - - // Get the list of all supported frequency bands - get_radio_supported_frequency_bands(refparam, ctx, data, instance, &supported_frequency_bands); - - // Check if the input value is a supported band value - if (!value_exits_in_str_list(supported_frequency_bands, ",", value)) { - bbfdm_set_fault_message(ctx, "'%s' band is not supported by this radio. Possible bands are [%s].", value, supported_frequency_bands); - return FAULT_9007; - } - - break; - case VALUESET: - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "band", (value[0] == '6') ? "6g" : (value[0] == '5') ? "5g" : "2g"); - break; - } - return 0; -} - -static int get_neighboring_wifi_diagnostics_diagnostics_state(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_option_value_string_bbfdm("dmmap_wifi_neighboring", "@diagnostic_status[0]", "DiagnosticsState", value); - if ((*value)[0] == '\0') - *value = "None"; - return 0; -} - -static int get_neighboring_wifi_diagnostics_result_number_entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - int cnt = get_number_of_entries(ctx, data, instance, browseWifiNeighboringWiFiDiagnosticResultInst); - dmasprintf(value, "%d", cnt); - return 0; -} - -/*#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 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 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 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 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 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 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 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 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 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 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 dm_data *)data)->config_section, "ciphers", value); - return 0; -} - -/*#Device.WiFi.Radio.{i}.CurrentOperatingChannelBandwidth!UBUS:wifi.radio.@Name/status//bandwidth*/ -static int get_WiFiRadio_CurrentOperatingChannelBandwidth(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *res = NULL; - char object[32]; - char *ccfs0 = NULL, *ccfs1 = NULL, *band = NULL; - - 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"); - - band = dmjson_get_value(res, 1, "bandwidth"); - ccfs0 = dmjson_get_value(res, 1, "ccfs0"); - ccfs1 = dmjson_get_value(res, 1, "ccfs1"); - - *value = get_data_model_band(band, ccfs0, ccfs1); - return 0; -} - -/*#Device.WiFi.Radio.{i}.SupportedStandards!UBUS:wifi.radio.@Name/status//supp_std*/ -static int get_radio_supported_standard(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *res = NULL, *supp_std_arr = NULL; - char list_supp_std[32], object[UBUS_OBJ_LEN]; - char *supp_std = NULL; - unsigned pos = 0, idx = 0; - - 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"); - - list_supp_std[0] = 0; - dmjson_foreach_value_in_array(res, supp_std_arr, supp_std, idx, 1, "supp_std") { // supp_std has as value 11xx - pos += snprintf(&list_supp_std[pos], sizeof(list_supp_std) - pos, "%s,", supp_std + 2); - } - - if (pos) - list_supp_std[pos - 1] = 0; - - *value = dmstrdup(list_supp_std); - return 0; -} - -/*#Device.WiFi.Radio.{i}.OperatingStandards!UBUS:wifi.radio.@Name/status//standard*/ -static int get_radio_operating_standard(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *res = NULL; - char object[UBUS_OBJ_LEN] = {0}; - - 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")); - return 0; -} - -static int set_radio_operating_standard(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - char *Supported_Standards[] = {"a", "b", "g", "n", "ac", "ax", "be", NULL}; - char *supported_standards = NULL; - char *bandwidth = NULL; - char *pch, *spch; - char buf[16], htmode[8]; - - switch (action) { - case VALUECHECK: - if (bbfdm_validate_string_list(ctx, value, -1, -1, -1, -1, -1, Supported_Standards, NULL)) - return FAULT_9007; - - // Get the list of all supported standards - get_radio_supported_standard(refparam, ctx, data, instance, &supported_standards); - - // Check if the input value is a valid standard value - snprintf(buf, sizeof(buf), "%s", value); - for (pch = strtok_r(buf, ",", &spch); pch != NULL; pch = strtok_r(NULL, ",", &spch)) { - if (!value_exits_in_str_list(supported_standards, ",", pch)) { - bbfdm_set_fault_message(ctx, "'%s' standard is not supported by this radio. Possible standards are [%s].", pch, supported_standards); - return FAULT_9007; - } - } - - break; - case VALUESET: - bandwidth = get_radio_option_nocache(section_name(((struct dm_data *)data)->config_section), "bandwidth"); - if (DM_STRLEN(bandwidth) == 0) - bandwidth = "20"; - - if (DM_LSTRSTR(value, "be")) - snprintf(htmode, sizeof(htmode), "EHT%s", bandwidth); - else if (DM_LSTRSTR(value, "ax")) - snprintf(htmode, sizeof(htmode), "HE%s", bandwidth); - else if (DM_LSTRSTR(value, "ac")) - snprintf(htmode, sizeof(htmode), "VHT%s", bandwidth); - else if (DM_LSTRSTR(value, "n")) - snprintf(htmode, sizeof(htmode), "HT%s", bandwidth); - else - snprintf(htmode, sizeof(htmode), "NOHT"); - - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "htmode", htmode); - break; - } - return 0; -} - -static int get_access_point_total_associations(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - int cnt = get_number_of_entries(ctx, data, instance, browse_wifi_associated_device); - dmasprintf(value, "%d", cnt); - return 0; -} - - -/************************************************************* - * OPERATE COMMANDS - *************************************************************/ -static int operate_WiFi_Reset(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - return !dmcmd_no_wait("/sbin/wifi", 1, "reload") ? 0 : USP_FAULT_COMMAND_FAILURE; -} - -static operation_args neighboring_wifi_diagnostic_args = { - .out = (const char *[]) { - "Status", - "Result.{i}.Radio", - "Result.{i}.SSID", - "Result.{i}.BSSID", - "Result.{i}.Mode", - "Result.{i}.Channel", - "Result.{i}.SignalStrength", - "Result.{i}.SecurityModeEnabled", - "Result.{i}.EncryptionMode", - "Result.{i}.OperatingFrequencyBand", - "Result.{i}.SupportedStandards", - "Result.{i}.OperatingStandards", - "Result.{i}.OperatingChannelBandwidth", - "Result.{i}.BeaconPeriod", - "Result.{i}.Noise", - "Result.{i}.BasicDataTransferRates", - "Result.{i}.SupportedDataTransferRates", - "Result.{i}.DTIMPeriod", - NULL - } -}; - -static int get_operate_args_WiFi_NeighboringWiFiDiagnostic(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = (char *)&neighboring_wifi_diagnostic_args; - return 0; -} - -static void dmubus_receive_wifi_radio(struct ubus_context *ctx, struct ubus_event_handler *ev, - const char *type, struct blob_attr *msg) -{ - struct dmubus_event_data *data; - - if (!msg || !ev) - return; - - data = container_of(ev, struct dmubus_event_data, ev); - if (data == NULL) - return; - - struct radio_scan_args *ev_data = data->ev_data; - if (ev_data == NULL) - return; - - struct blob_attr *res = (struct blob_attr *)ev_data->msg; - if (res == NULL) - return; - - struct blob_attr *event_list = NULL; - struct blob_attr *cur = NULL; - int rem = 0; - - struct blob_attr *tb_event[1] = {0}; - const struct blobmsg_policy p_event_table[1] = { - { "event_data", BLOBMSG_TYPE_ARRAY } - }; - - blobmsg_parse(p_event_table, 1, tb_event, blobmsg_data(res), blobmsg_len(res)); - if (tb_event[0] == NULL) - return; - - event_list = tb_event[0]; - - const struct blobmsg_policy p_event[2] = { - { "ifname", BLOBMSG_TYPE_STRING }, - { "event", BLOBMSG_TYPE_STRING } - }; - - struct blob_attr *tb1[2] = { 0, 0 }; - blobmsg_parse(p_event, 2, tb1, blobmsg_data(msg), blobmsg_len(msg)); - if (!tb1[0] || !tb1[1]) - return; - - char *ifname = blobmsg_get_string(tb1[0]); - char *action = blobmsg_get_string(tb1[1]); - - blobmsg_for_each_attr(cur, event_list, rem) { - struct blob_attr *tb2[2] = { 0, 0 }; - - blobmsg_parse(p_event, 2, tb2, blobmsg_data(cur), blobmsg_len(cur)); - if (!tb2[0] || !tb2[1]) - continue; - - if (DM_STRCMP(ifname, blobmsg_get_string(tb2[0])) != 0 || DM_STRCMP(action, blobmsg_get_string(tb2[1])) != 0) - continue; - - for (uint32_t i = 0; i < ev_data->obj_count; i++) { - if (DM_STRCMP(ifname, ev_data->radio[i].obj_name) == 0) { - ev_data->radio[i].scan_done = true; - break; - } - } - - break; - } - - // If scan finished for all radios then end the uloop - bool scan_finished = true; - for (uint32_t i = 0; i < ev_data->obj_count; i++) { - if (!ev_data->radio[i].scan_done) { - scan_finished = false; - break; - } - } - - if (scan_finished) - uloop_end(); - - return; -} - -static void start_wifi_radio_scan(struct uloop_timeout *timeout) -{ - struct blob_attr *object_list = NULL; - struct blob_attr *cur = NULL; - int rem = 0; - - struct dmubus_ev_subtask *data = container_of(timeout, struct dmubus_ev_subtask, sub_tm); - - if (data == NULL) - return; - - struct blob_attr *task_data = (struct blob_attr *)(data->subtask_data); - - struct blob_attr *tb_data[1] = {0}; - const struct blobmsg_policy p_task_table[1] = { - { "task_data", BLOBMSG_TYPE_ARRAY } - }; - - blobmsg_parse(p_task_table, 1, tb_data, blobmsg_data(task_data), blobmsg_len(task_data)); - if (tb_data[0] == NULL) - return; - - object_list = tb_data[0]; - - const struct blobmsg_policy p_object[1] = { - { "object", BLOBMSG_TYPE_STRING } - }; - - blobmsg_for_each_attr(cur, object_list, rem) { - struct blob_attr *tb[1] = {0}; - - blobmsg_parse(p_object, 1, tb, blobmsg_data(cur), blobmsg_len(cur)); - if (!tb[0]) - continue; - - char *radio_object = blobmsg_get_string(tb[0]); - - if (DM_STRLEN(radio_object) == 0) - continue; - - dmubus_call_set(radio_object, "scan", UBUS_ARGS{0}, 0); - } -} - -static int operate_WiFi_NeighboringWiFiDiagnostic(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - json_object *res = NULL; - - dmubus_call("wifi", "status", UBUS_ARGS{0}, 0, &res); - if (!res) - goto end; - - json_object *radios = NULL, *arrobj = NULL; - int i = 0, j = 0; - uint32_t index = 1; - uint32_t radio_count = 0; - struct blob_buf ev_data; - struct blob_buf task_data; - struct radio_scan_args events; - - json_object *radio_list = dmjson_get_obj(res, 1, "radios"); - if (!radio_list || json_object_get_type(radio_list) != json_type_array) - goto end; - - radio_count = json_object_array_length(radio_list); - if (!radio_count) - goto end; - - events.radio = (struct radio_obj *)malloc(sizeof(struct radio_obj) * radio_count); - if (!events.radio) - goto end; - - memset(&ev_data, 0, sizeof(struct blob_buf)); - memset(&task_data, 0, sizeof(struct blob_buf)); - memset(events.radio, 0, sizeof(struct radio_obj) * radio_count); - - blob_buf_init(&ev_data, 0); - blob_buf_init(&task_data, 0); - - void *ev_arr = blobmsg_open_array(&ev_data, "event_data"); - void *task_arr = blobmsg_open_array(&task_data, "task_data"); - - dmjson_foreach_obj_in_array(res, arrobj, radios, i, 1, "radios") { - char object[UBUS_OBJ_LEN] = {0}; - - char *radio_name = dmjson_get_value(radios, 1, "name"); - if (!DM_STRLEN(radio_name)) - continue; - - char *isup = dmjson_get_value(radios, 1, "isup"); - if (!DM_STRLEN(isup)) - continue; - - bool ifup = false; - string_to_bool(isup, &ifup); - if (!ifup) - continue; - - if (j < radio_count) { - snprintf(object, sizeof(object), "wifi.radio.%s", radio_name); - snprintf(events.radio[j].obj_name, sizeof(events.radio[j].obj_name), "%s", radio_name); - - void *ev_table = blobmsg_open_table(&ev_data, ""); - blobmsg_add_string(&ev_data, "ifname", radio_name); - blobmsg_add_string(&ev_data, "event", "scan_finished"); - blobmsg_close_table(&ev_data, ev_table); - - void *task_table = blobmsg_open_table(&task_data, ""); - blobmsg_add_string(&task_data, "object", object); - blobmsg_close_table(&task_data, task_table); - - j++; - } - } - - blobmsg_close_array(&ev_data, ev_arr); - blobmsg_close_array(&task_data, task_arr); - - if (j) { - events.obj_count = j; - events.msg = ev_data.head; - - struct dmubus_ev_subtask subtask = { - .sub_tm.cb = start_wifi_radio_scan, - .subtask_data = task_data.head, - .timeout = 1 - }; - - dmubus_wait_for_event("wifi.radio", 30, &events, dmubus_receive_wifi_radio, &subtask); - } - - blob_buf_free(&ev_data); - blob_buf_free(&task_data); - - for (i = 0; i < j; i++) { - json_object *scan_res = NULL, *obj = NULL; - char object[UBUS_OBJ_LEN] = {0}; - char *ssid[2] = {0}; - char *bssid[2] = {0}; - char *noise[2] = {0}; - char *channel[2] = {0}; - char *frequency[2] = {0}; - char *signal_strength[2] = {0}; - char *standard[2] = {0}; - char *bandwidth[2] = {0}; - char *radio[2] = {0}; - char *encryption[2] = {0}; - char *ciphers[2] = {0}; - - snprintf(object, sizeof(object), "wifi.radio.%s", events.radio[i].obj_name); - adm_entry_get_reference_param(ctx, "Device.WiFi.Radio.*.Name", events.radio[i].obj_name, &radio[1]); - - dmubus_call(object, "scanresults", UBUS_ARGS{0}, 0, &scan_res); - - if (!scan_res) - continue; - - if (!json_object_object_get_ex(scan_res,"accesspoints", &obj)) - continue; - - uint32_t len = obj ? json_object_array_length(obj) : 0; - - for (uint32_t k = 0; k < len; k++ ) { - if (index == 0) - break; - - json_object *array_obj = json_object_array_get_idx(obj, k); - ssid[1] = dmjson_get_value(array_obj, 1, "ssid"); - bssid[1] = dmjson_get_value(array_obj, 1, "bssid"); - channel[1] = dmjson_get_value(array_obj, 1, "channel"); - frequency[1] = dmjson_get_value(array_obj, 1, "band"); - signal_strength[1] = dmjson_get_value(array_obj, 1, "rssi"); - noise[1] = dmjson_get_value(array_obj, 1, "noise"); - char *band = dmjson_get_value(array_obj, 1, "bandwidth"); - char *ccfs0 = dmjson_get_value(array_obj, 1, "ccfs0"); - char *ccfs1 = dmjson_get_value(array_obj, 1, "ccfs1"); - bandwidth[1] = get_data_model_band(band, ccfs0, ccfs1); - standard[1] = get_data_model_standard(dmjson_get_value(array_obj, 1, "standard")); - encryption[1] = get_data_model_mode(dmjson_get_value(array_obj, 1, "encryption")); - ciphers[1] = dmjson_get_value(array_obj, 1, "ciphers"); - - if (ctx->dm_type != BBFDM_USP) { - struct uci_section *dmmap_s = NULL; - dmuci_add_section_bbfdm("dmmap_wifi_neighboring", "result", &dmmap_s); - dmuci_set_value_by_section(dmmap_s, "radio", radio[1]); - dmuci_set_value_by_section(dmmap_s, "ssid", ssid[1]); - dmuci_set_value_by_section(dmmap_s, "bssid", bssid[1]); - dmuci_set_value_by_section(dmmap_s, "channel", channel[1]); - dmuci_set_value_by_section(dmmap_s, "rssi", signal_strength[1]); - dmuci_set_value_by_section(dmmap_s, "band", frequency[1]); - dmuci_set_value_by_section(dmmap_s, "noise", noise[1]); - dmuci_set_value_by_section(dmmap_s, "bandwidth", bandwidth[1]); - dmuci_set_value_by_section(dmmap_s, "standard", standard[1]); - dmuci_set_value_by_section(dmmap_s, "encryption", encryption[1]); - dmuci_set_value_by_section(dmmap_s, "ciphers", ciphers[1]); - } - - dmasprintf(&radio[0], "Result.%d.Radio", index); - dmasprintf(&ssid[0], "Result.%d.SSID", index); - dmasprintf(&bssid[0], "Result.%d.BSSID", index); - dmasprintf(&channel[0], "Result.%d.Channel", index); - dmasprintf(&frequency[0], "Result.%d.OperatingFrequencyBand", index); - dmasprintf(&signal_strength[0], "Result.%d.SignalStrength", index); - dmasprintf(&noise[0], "Result.%d.Noise", index); - dmasprintf(&bandwidth[0], "Result.%d.OperatingChannelBandwidth", index); - dmasprintf(&standard[0], "Result.%d.OperatingStandards", index); - dmasprintf(&encryption[0], "Result.%d.SecurityModeEnabled", index); - dmasprintf(&ciphers[0], "Result.%d.EncryptionMode", index); - - add_list_parameter(ctx, radio[0], radio[1], DMT_TYPE[DMT_STRING], NULL); - add_list_parameter(ctx, ssid[0], ssid[1], DMT_TYPE[DMT_STRING], NULL); - add_list_parameter(ctx, bssid[0], bssid[1], DMT_TYPE[DMT_STRING], NULL); - add_list_parameter(ctx, channel[0], channel[1], DMT_TYPE[DMT_UNINT], NULL); - add_list_parameter(ctx, frequency[0], frequency[1], DMT_TYPE[DMT_STRING], NULL); - add_list_parameter(ctx, signal_strength[0], signal_strength[1], DMT_TYPE[DMT_INT], NULL); - add_list_parameter(ctx, noise[0], noise[1], DMT_TYPE[DMT_INT], NULL); - add_list_parameter(ctx, bandwidth[0], bandwidth[1], DMT_TYPE[DMT_STRING], NULL); - add_list_parameter(ctx, standard[0], standard[1], DMT_TYPE[DMT_STRING], NULL); - add_list_parameter(ctx, encryption[0], encryption[1], DMT_TYPE[DMT_STRING], NULL); - add_list_parameter(ctx, ciphers[0], ciphers[1], DMT_TYPE[DMT_STRING], NULL); - index++; - } - } - - FREE(events.radio); -end: - if (ctx->dm_type != BBFDM_USP) { - dmuci_set_value_bbfdm("dmmap_wifi_neighboring", "@diagnostic_status[0]", "DiagnosticsState", "Complete"); - dmuci_commit_package_bbfdm("dmmap_wifi_neighboring"); - } - - return 0; -} - -static int operate_WiFiAccessPointSecurity_Reset(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - 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; -} - -/********************************************************************************************************************************** -* OBJ & LEAF DEFINITION -***********************************************************************************************************************************/ -/* *** Device.WiFi. *** */ -DMOBJ tWiFiObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/ -#ifdef BBF_WIFI_DATAELEMENTS -{"DataElements", &DMREAD, NULL, NULL, "file:/etc/init.d/decollector", NULL, NULL, NULL, tWiFiDataElementsObj, NULL, NULL, BBFDM_BOTH, NULL}, -#endif -{"Radio", &DMREAD, NULL, NULL, "file:/etc/config/wireless", browseWifiRadioInst, NULL, NULL, tWiFiRadioObj, tWiFiRadioParams, NULL, BBFDM_BOTH, NULL}, -{"SSID", &DMWRITE, add_wifi_ssid, delete_wifi_ssid, "file:/etc/config/wireless", browseWifiSsidInst, NULL, NULL, tWiFiSSIDObj, tWiFiSSIDParams, NULL, BBFDM_BOTH, NULL}, -{"AccessPoint", &DMWRITE, add_wifi_accesspoint, delete_wifi_accesspoint, "file:/etc/config/wireless", browseWifiAccessPointInst, NULL, NULL, tWiFiAccessPointObj, tWiFiAccessPointParams, NULL, BBFDM_BOTH, NULL}, -{"NeighboringWiFiDiagnostic", &DMREAD, NULL, NULL, "file:/etc/config/wireless", NULL, NULL, NULL, tWiFiNeighboringWiFiDiagnosticObj, tWiFiNeighboringWiFiDiagnosticParams, NULL, BBFDM_BOTH, NULL}, -{"EndPoint", &DMWRITE, addObjWiFiEndPoint, delObjWiFiEndPoint, "file:/etc/config/wireless", browseWiFiEndPointInst, NULL, NULL, tWiFiEndPointObj, tWiFiEndPointParams, NULL, BBFDM_BOTH, NULL}, -{0} -}; - -DMLEAF tWiFiParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"RadioNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFi_RadioNumberOfEntries, NULL, BBFDM_BOTH}, -{"SSIDNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFi_SSIDNumberOfEntries, NULL, BBFDM_BOTH}, -{"AccessPointNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFi_AccessPointNumberOfEntries, NULL, BBFDM_BOTH}, -{"EndPointNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFi_EndPointNumberOfEntries, NULL, BBFDM_BOTH}, -{"Reset()", &DMSYNC, DMT_COMMAND, NULL, operate_WiFi_Reset, BBFDM_USP}, -{"NeighboringWiFiDiagnostic()", &DMASYNC, DMT_COMMAND, get_operate_args_WiFi_NeighboringWiFiDiagnostic, operate_WiFi_NeighboringWiFiDiagnostic, BBFDM_USP}, -{0} -}; - -/* *** Device.WiFi.Radio.{i}. *** */ -DMOBJ tWiFiRadioObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/ -{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiRadioStatsParams, NULL, BBFDM_BOTH, NULL}, -{0} -}; - -DMLEAF tWiFiRadioParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"Alias", &DMWRITE, DMT_STRING, get_radio_alias, set_radio_alias, BBFDM_BOTH, DM_FLAG_UNIQUE}, -{"Enable", &DMWRITE, DMT_BOOL, get_radio_enable, set_radio_enable, BBFDM_BOTH}, -{"Status", &DMREAD, DMT_STRING, get_radio_status, NULL, BBFDM_BOTH}, -{"LowerLayers", &DMWRITE, DMT_STRING, get_WiFiRadio_LowerLayers, set_WiFiRadio_LowerLayers, BBFDM_BOTH}, -{"Name", &DMREAD, DMT_STRING, get_WiFiRadio_Name, NULL, BBFDM_BOTH, DM_FLAG_UNIQUE|DM_FLAG_LINKER}, -{"MaxBitRate", &DMREAD, DMT_UNINT, get_radio_max_bit_rate, NULL, BBFDM_BOTH}, -{"SupportedFrequencyBands", &DMREAD, DMT_STRING, get_radio_supported_frequency_bands, NULL, BBFDM_BOTH}, -{"OperatingFrequencyBand", &DMWRITE, DMT_STRING, get_radio_frequency, set_radio_frequency, BBFDM_BOTH}, -{"SupportedStandards", &DMREAD, DMT_STRING, get_radio_supported_standard, NULL, BBFDM_BOTH}, -{"OperatingStandards", &DMWRITE, DMT_STRING, get_radio_operating_standard, set_radio_operating_standard, BBFDM_BOTH}, -{"ChannelsInUse", &DMREAD, DMT_STRING, get_radio_channels_in_use, NULL, BBFDM_BOTH}, -{"Channel", &DMWRITE, DMT_UNINT, get_radio_channel, set_radio_channel, BBFDM_BOTH}, -{"AutoChannelEnable", &DMWRITE, DMT_BOOL, get_radio_auto_channel_enable, set_radio_auto_channel_enable, BBFDM_BOTH}, -{"PossibleChannels", &DMREAD, DMT_STRING, get_radio_possible_channels, NULL, BBFDM_BOTH}, -{"AutoChannelSupported", &DMREAD, DMT_BOOL, get_WiFiRadio_AutoChannelSupported, NULL, BBFDM_BOTH}, -{"AutoChannelRefreshPeriod", &DMWRITE, DMT_UNINT, get_WiFiRadio_AutoChannelRefreshPeriod, set_WiFiRadio_AutoChannelRefreshPeriod, BBFDM_BOTH}, -{"MaxSupportedAssociations", &DMREAD, DMT_UNINT, get_WiFiRadio_MaxSupportedAssociations, NULL, BBFDM_BOTH}, -{"FragmentationThreshold", &DMWRITE, DMT_UNINT, get_WiFiRadio_FragmentationThreshold, set_WiFiRadio_FragmentationThreshold, BBFDM_BOTH}, -{"RTSThreshold", &DMWRITE, DMT_UNINT, get_WiFiRadio_RTSThreshold, set_WiFiRadio_RTSThreshold, BBFDM_BOTH}, -{"BeaconPeriod", &DMWRITE, DMT_UNINT, get_WiFiRadio_BeaconPeriod, set_WiFiRadio_BeaconPeriod, BBFDM_BOTH}, -{"DTIMPeriod", &DMWRITE, DMT_UNINT, get_WiFiRadio_DTIMPeriod, set_WiFiRadio_DTIMPeriod, BBFDM_BOTH}, -{"SupportedOperatingChannelBandwidths", &DMREAD, DMT_STRING, get_WiFiRadio_SupportedOperatingChannelBandwidths, NULL, BBFDM_BOTH}, -{"OperatingChannelBandwidth", &DMWRITE, DMT_STRING, get_WiFiRadio_OperatingChannelBandwidth, set_WiFiRadio_OperatingChannelBandwidth, BBFDM_BOTH}, -{"CurrentOperatingChannelBandwidth", &DMREAD, DMT_STRING, get_WiFiRadio_CurrentOperatingChannelBandwidth, NULL, BBFDM_BOTH}, -{"PreambleType", &DMWRITE, DMT_STRING, get_WiFiRadio_PreambleType, set_WiFiRadio_PreambleType, BBFDM_BOTH}, -{"IEEE80211hSupported", &DMREAD, DMT_BOOL, get_WiFiRadio_IEEE80211hSupported, NULL, BBFDM_BOTH}, -{"IEEE80211hEnabled", &DMWRITE, DMT_BOOL, get_WiFiRadio_IEEE80211hEnabled, set_WiFiRadio_IEEE80211hEnabled, BBFDM_BOTH}, -{"TransmitPowerSupported", &DMREAD, DMT_STRING, get_WiFiRadio_TransmitPowerSupported, NULL, BBFDM_BOTH}, -{"TransmitPower", &DMWRITE, DMT_INT, get_WiFiRadio_TransmitPower, set_WiFiRadio_TransmitPower, BBFDM_BOTH}, -{"RegulatoryDomain", &DMWRITE, DMT_STRING, get_WiFiRadio_RegulatoryDomain, set_WiFiRadio_RegulatoryDomain, BBFDM_BOTH}, -{"CenterFrequencySegment0", &DMREAD, DMT_UNINT, get_radio_ccfs0, NULL, BBFDM_BOTH}, -{"CenterFrequencySegment1", &DMREAD, DMT_UNINT, get_radio_ccfs1, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.Radio.{i}.Stats. *** */ -DMLEAF tWiFiRadioStatsParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"Noise", &DMREAD, DMT_INT, get_WiFiRadioStats_Noise, NULL, BBFDM_BOTH}, -{"BytesSent", &DMREAD, DMT_UNLONG, get_WiFiRadioStats_BytesSent, NULL, BBFDM_BOTH}, -{"BytesReceived", &DMREAD, DMT_UNLONG, get_WiFiRadioStats_BytesReceived, NULL, BBFDM_BOTH}, -{"PacketsSent", &DMREAD, DMT_UNLONG, get_WiFiRadioStats_PacketsSent, NULL, BBFDM_BOTH}, -{"PacketsReceived", &DMREAD, DMT_UNLONG, get_WiFiRadioStats_PacketsReceived, NULL, BBFDM_BOTH}, -{"ErrorsSent", &DMREAD, DMT_UNINT, get_WiFiRadioStats_ErrorsSent, NULL, BBFDM_BOTH}, -{"ErrorsReceived", &DMREAD, DMT_UNINT, get_WiFiRadioStats_ErrorsReceived, NULL, BBFDM_BOTH}, -{"DiscardPacketsSent", &DMREAD, DMT_UNINT, get_WiFiRadioStats_DiscardPacketsSent, NULL, BBFDM_BOTH}, -{"DiscardPacketsReceived", &DMREAD, DMT_UNINT, get_WiFiRadioStats_DiscardPacketsReceived, NULL, BBFDM_BOTH}, -{"FCSErrorCount", &DMREAD, DMT_UNINT, get_WiFiRadioStats_FCSErrorCount, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.NeighboringWiFiDiagnostic. *** */ -DMOBJ tWiFiNeighboringWiFiDiagnosticObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/ -{"Result", &DMREAD, NULL, NULL, NULL, browseWifiNeighboringWiFiDiagnosticResultInst, NULL, NULL, NULL, tWiFiNeighboringWiFiDiagnosticResultParams, NULL, BBFDM_CWMP, NULL}, -{0} -}; - -DMLEAF tWiFiNeighboringWiFiDiagnosticParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"DiagnosticsState", &DMWRITE, DMT_STRING, get_neighboring_wifi_diagnostics_diagnostics_state, set_neighboring_wifi_diagnostics_diagnostics_state, BBFDM_CWMP}, -{"ResultNumberOfEntries", &DMREAD, DMT_UNINT, get_neighboring_wifi_diagnostics_result_number_entries, NULL, BBFDM_CWMP}, -{0} -}; - -/* *** Device.WiFi.NeighboringWiFiDiagnostic.Result.{i}. *** */ -DMLEAF tWiFiNeighboringWiFiDiagnosticResultParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"Radio", &DMREAD, DMT_STRING, get_neighboring_wifi_diagnostics_result_radio, NULL, BBFDM_CWMP}, -{"SSID", &DMREAD, DMT_STRING, get_neighboring_wifi_diagnostics_result_ssid, NULL, BBFDM_CWMP}, -{"BSSID", &DMREAD, DMT_STRING, get_neighboring_wifi_diagnostics_result_bssid, NULL, BBFDM_CWMP}, -{"Channel", &DMREAD, DMT_UNINT, get_neighboring_wifi_diagnostics_result_channel, NULL, BBFDM_CWMP}, -{"SignalStrength", &DMREAD, DMT_INT, get_neighboring_wifi_diagnostics_result_signal_strength, NULL, BBFDM_CWMP}, -{"OperatingFrequencyBand", &DMREAD, DMT_STRING, get_neighboring_wifi_diagnostics_result_operating_frequency_band, NULL, BBFDM_CWMP}, -{"Noise", &DMREAD, DMT_INT, get_neighboring_wifi_diagnostics_result_noise, NULL, BBFDM_CWMP}, -{"OperatingChannelBandwidth", &DMREAD, DMT_STRING, get_neighboring_wifi_diagnostics_result_operating_ch_band, NULL, BBFDM_CWMP}, -{"OperatingStandards", &DMREAD, DMT_STRING, get_neighboring_wifi_diagnostics_result_op_std, NULL, BBFDM_CWMP}, -{"SecurityModeEnabled", &DMREAD, DMT_STRING, get_neighboring_wifi_diagnostics_result_sec_mode, NULL, BBFDM_CWMP}, -{"EncryptionMode", &DMREAD, DMT_STRING, get_neighboring_wifi_diagnostics_result_enc_mode, NULL, BBFDM_CWMP}, -{0} -}; - -/* *** Device.WiFi.SSID.{i}. *** */ -DMOBJ tWiFiSSIDObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/ -{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiSSIDStatsParams, NULL, BBFDM_BOTH, NULL}, -{0} -}; - -DMLEAF tWiFiSSIDParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"Alias", &DMWRITE, DMT_STRING, get_ssid_alias, set_ssid_alias, BBFDM_BOTH, DM_FLAG_UNIQUE}, -{"Enable", &DMWRITE, DMT_BOOL, get_wifi_ssid_enable, set_wifi_ssid_enable, BBFDM_BOTH}, -{"Status", &DMREAD, DMT_STRING, get_wifi_status, NULL, BBFDM_BOTH}, -{"SSID", &DMWRITE, DMT_STRING, get_wlan_ssid, set_wlan_ssid, BBFDM_BOTH, DM_FLAG_UNIQUE}, -{"Name", &DMREAD, DMT_STRING, get_wlan_name, NULL, BBFDM_BOTH, DM_FLAG_UNIQUE|DM_FLAG_LINKER}, -{"LowerLayers", &DMWRITE, DMT_STRING, get_ssid_lower_layer, set_ssid_lower_layer, BBFDM_BOTH, DM_FLAG_REFERENCE}, -{"BSSID", &DMREAD, DMT_STRING, get_wlan_bssid, NULL, BBFDM_BOTH}, -{"MACAddress", &DMREAD, DMT_STRING, get_WiFiSSID_MACAddress, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.SSID.{i}.Stats. *** */ -DMLEAF tWiFiSSIDStatsParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"BytesSent", &DMREAD, DMT_UNLONG, get_WiFiSSIDStats_BytesSent, NULL, BBFDM_BOTH}, -{"BytesReceived", &DMREAD, DMT_UNLONG, get_WiFiSSIDStats_BytesReceived, NULL, BBFDM_BOTH}, -{"PacketsSent", &DMREAD, DMT_UNLONG, get_WiFiSSIDStats_PacketsSent, NULL, BBFDM_BOTH}, -{"PacketsReceived", &DMREAD, DMT_UNLONG, get_WiFiSSIDStats_PacketsReceived, NULL, BBFDM_BOTH}, -{"ErrorsSent", &DMREAD, DMT_UNINT, get_WiFiSSIDStats_ErrorsSent, NULL, BBFDM_BOTH}, -{"RetransCount", &DMREAD, DMT_UNINT, get_WiFiSSIDStats_RetransCount, NULL, BBFDM_BOTH}, -{"FailedRetransCount", &DMREAD, DMT_UNINT, get_WiFiSSIDStats_FailedRetransCount, NULL, BBFDM_BOTH}, -{"RetryCount", &DMREAD, DMT_UNINT, get_WiFiSSIDStats_RetryCount, NULL, BBFDM_BOTH}, -{"MultipleRetryCount", &DMREAD, DMT_UNINT, get_WiFiSSIDStats_MultipleRetryCount, NULL, BBFDM_BOTH}, -{"ACKFailureCount", &DMREAD, DMT_UNINT, get_WiFiSSIDStats_ACKFailureCount, NULL, BBFDM_BOTH}, -{"AggregatedPacketCount", &DMREAD, DMT_UNINT, get_WiFiSSIDStats_AggregatedPacketCount, NULL, BBFDM_BOTH}, -{"ErrorsReceived", &DMREAD, DMT_UNINT, get_WiFiSSIDStats_ErrorsReceived, NULL, BBFDM_BOTH}, -{"UnicastPacketsSent", &DMREAD, DMT_UNLONG, get_WiFiSSIDStats_UnicastPacketsSent, NULL, BBFDM_BOTH}, -{"UnicastPacketsReceived", &DMREAD, DMT_UNLONG, get_WiFiSSIDStats_UnicastPacketsReceived, NULL, BBFDM_BOTH}, -{"DiscardPacketsSent", &DMREAD, DMT_UNINT, get_WiFiSSIDStats_DiscardPacketsSent, NULL, BBFDM_BOTH}, -{"DiscardPacketsReceived", &DMREAD, DMT_UNINT, get_WiFiSSIDStats_DiscardPacketsReceived, NULL, BBFDM_BOTH}, -{"MulticastPacketsSent", &DMREAD, DMT_UNLONG, get_WiFiSSIDStats_MulticastPacketsSent, NULL, BBFDM_BOTH}, -{"MulticastPacketsReceived", &DMREAD, DMT_UNLONG, get_WiFiSSIDStats_MulticastPacketsReceived, NULL, BBFDM_BOTH}, -{"BroadcastPacketsSent", &DMREAD, DMT_UNLONG, get_WiFiSSIDStats_BroadcastPacketsSent, NULL, BBFDM_BOTH}, -{"BroadcastPacketsReceived", &DMREAD, DMT_UNLONG, get_WiFiSSIDStats_BroadcastPacketsReceived, NULL, BBFDM_BOTH}, -{"UnknownProtoPacketsReceived", &DMREAD, DMT_UNINT, get_WiFiSSIDStats_UnknownProtoPacketsReceived, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.AccessPoint.{i}. *** */ -DMOBJ tWiFiAccessPointObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/ -{"Security", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiAccessPointSecurityParams, NULL, BBFDM_BOTH, NULL}, -{"AssociatedDevice", &DMREAD, NULL, NULL, NULL, browse_wifi_associated_device, NULL, NULL, tWiFiAccessPointAssociatedDeviceObj, tWiFiAccessPointAssociatedDeviceParams, NULL, BBFDM_BOTH, NULL}, -{"WPS", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiAccessPointWPSParams, NULL, BBFDM_BOTH, NULL}, -{"Accounting", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiAccessPointAccountingParams, NULL, BBFDM_BOTH, NULL}, -{0} -}; - -DMLEAF tWiFiAccessPointParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"Alias", &DMWRITE, DMT_STRING, get_access_point_alias, set_access_point_alias, BBFDM_BOTH, DM_FLAG_UNIQUE}, -{"Enable", &DMWRITE, DMT_BOOL, get_access_point_enable, set_access_point_enable, BBFDM_BOTH}, -{"Status", &DMREAD, DMT_STRING, get_wifi_access_point_status, NULL, BBFDM_BOTH}, -{"SSIDReference", &DMWRITE, DMT_STRING, get_ap_ssid_ref, set_ap_ssid_ref, BBFDM_BOTH, DM_FLAG_UNIQUE|DM_FLAG_REFERENCE}, -{"SSIDAdvertisementEnabled", &DMWRITE, DMT_BOOL, get_wlan_ap_advertisement_enable, set_wlan_ap_advertisement_enable, BBFDM_BOTH}, -{"WMMEnable", &DMWRITE, DMT_BOOL, get_wmm_enabled, set_wmm_enabled, BBFDM_BOTH}, -{"UAPSDEnable", &DMWRITE, DMT_BOOL, get_WiFiAccessPoint_UAPSDEnable, set_WiFiAccessPoint_UAPSDEnable, BBFDM_BOTH}, -{"AssociatedDeviceNumberOfEntries", &DMREAD, DMT_UNINT, get_access_point_total_associations, NULL, BBFDM_BOTH}, -{"MACAddressControlEnabled", &DMWRITE, DMT_BOOL, get_access_point_control_enable, set_access_point_control_enable, BBFDM_BOTH}, -{"UAPSDCapability", &DMREAD, DMT_BOOL, get_WiFiAccessPoint_UAPSDCapability, NULL, BBFDM_BOTH}, -{"WMMCapability", &DMREAD, DMT_BOOL, get_WiFiAccessPoint_WMMCapability, NULL, BBFDM_BOTH}, -{"MaxAllowedAssociations", &DMWRITE, DMT_UNINT, get_WiFiAccessPoint_MaxAllowedAssociations, set_WiFiAccessPoint_MaxAllowedAssociations, BBFDM_BOTH}, -{"IsolationEnable", &DMWRITE, DMT_BOOL, get_WiFiAccessPoint_IsolationEnable, set_WiFiAccessPoint_IsolationEnable, BBFDM_BOTH}, -{"AllowedMACAddress", &DMWRITE, DMT_STRING, get_WiFiAccessPoint_AllowedMACAddress, set_WiFiAccessPoint_AllowedMACAddress, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.AccessPoint.{i}.Security. *** */ -DMLEAF tWiFiAccessPointSecurityParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"ModesSupported", &DMREAD, DMT_STRING, get_access_point_security_supported_modes, NULL, BBFDM_BOTH}, -{"ModeEnabled", &DMWRITE, DMT_STRING, get_access_point_security_modes, set_access_point_security_modes, BBFDM_BOTH}, -{"WEPKey", &DMWRITE, DMT_HEXBIN, get_access_point_security_wepkey, set_access_point_security_wepkey, BBFDM_BOTH, DM_FLAG_SECURE}, -{"PreSharedKey", &DMWRITE, DMT_HEXBIN, get_access_point_security_shared_key, set_access_point_security_shared_key, BBFDM_BOTH, DM_FLAG_SECURE}, -{"KeyPassphrase", &DMWRITE, DMT_STRING, get_access_point_security_passphrase, set_access_point_security_passphrase, BBFDM_BOTH, DM_FLAG_SECURE}, -{"RekeyingInterval", &DMWRITE, DMT_UNINT, get_access_point_security_rekey_interval, set_access_point_security_rekey_interval, BBFDM_BOTH}, -{"SAEPassphrase", &DMWRITE, DMT_STRING, get_WiFiAccessPointSecurity_SAEPassphrase, set_WiFiAccessPointSecurity_SAEPassphrase, BBFDM_BOTH, DM_FLAG_SECURE}, -{"RadiusServerIPAddr", &DMWRITE, DMT_STRING, get_access_point_security_radius_ip_address, set_access_point_security_radius_ip_address, BBFDM_BOTH}, -{"RadiusServerPort", &DMWRITE, DMT_UNINT, get_access_point_security_radius_server_port, set_access_point_security_radius_server_port, BBFDM_BOTH}, -{"RadiusSecret", &DMWRITE, DMT_STRING, get_access_point_security_radius_secret, set_access_point_security_radius_secret, BBFDM_BOTH, DM_FLAG_SECURE}, -{"MFPConfig", &DMWRITE, DMT_STRING, get_WiFiAccessPointSecurity_MFPConfig, set_WiFiAccessPointSecurity_MFPConfig, BBFDM_BOTH}, -{"Reset()", &DMSYNC, DMT_COMMAND, NULL, operate_WiFiAccessPointSecurity_Reset, BBFDM_USP}, -{0} -}; - -/* *** Device.WiFi.AccessPoint.{i}.WPS. *** */ -DMLEAF tWiFiAccessPointWPSParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"Enable", &DMWRITE, DMT_BOOL, get_WiFiAccessPointWPS_Enable, set_WiFiAccessPointWPS_Enable, BBFDM_BOTH}, -{"ConfigMethodsSupported", &DMREAD, DMT_STRING, get_WiFiAccessPointWPS_ConfigMethodsSupported, NULL, BBFDM_BOTH}, -{"ConfigMethodsEnabled", &DMWRITE, DMT_STRING, get_WiFiAccessPointWPS_ConfigMethodsEnabled, set_WiFiAccessPointWPS_ConfigMethodsEnabled, BBFDM_BOTH}, -{"Status", &DMREAD, DMT_STRING, get_WiFiAccessPointWPS_Status, NULL, BBFDM_BOTH}, -//{"Version", &DMREAD, DMT_STRING, get_WiFiAccessPointWPS_Version, NULL, BBFDM_BOTH}, -//{"PIN", &DMWRITE, DMT_STRING, get_WiFiAccessPointWPS_PIN, set_WiFiAccessPointWPS_PIN, BBFDM_BOTH, DM_FLAG_SECURE}, -{"InitiateWPSPBC()", &DMASYNC, DMT_COMMAND, get_operate_args_WiFiAccessPointWPS_InitiateWPSPBC, operate_WiFiAccessPointWPS_InitiateWPSPBC, BBFDM_USP}, -{0} -}; - -/* *** Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}. *** */ -DMOBJ tWiFiAccessPointAssociatedDeviceObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/ -{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiAccessPointAssociatedDeviceStatsParams, NULL, BBFDM_BOTH, NULL}, -{0} -}; - -DMLEAF tWiFiAccessPointAssociatedDeviceParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"Active", &DMREAD, DMT_BOOL, get_WiFiAccessPointAssociatedDevice_Active, NULL, BBFDM_BOTH}, -{"Noise", &DMREAD, DMT_INT, get_WiFiAccessPointAssociatedDevice_Noise, NULL, BBFDM_BOTH}, -{"MACAddress", &DMREAD, DMT_STRING, get_WiFiAccessPointAssociatedDevice_MACAddress, NULL, BBFDM_BOTH, DM_FLAG_UNIQUE}, -{"LastDataDownlinkRate", &DMREAD, DMT_UNINT, get_WiFiAccessPointAssociatedDevice_LastDataDownlinkRate, NULL, BBFDM_BOTH}, -{"LastDataUplinkRate", &DMREAD, DMT_UNINT, get_WiFiAccessPointAssociatedDevice_LastDataUplinkRate, NULL, BBFDM_BOTH}, -{"SignalStrength", &DMREAD, DMT_INT, get_WiFiAccessPointAssociatedDevice_SignalStrength, NULL, BBFDM_BOTH}, -//{"Retransmissions", &DMREAD, DMT_UNINT, get_WiFiAccessPointAssociatedDevice_Retransmissions, NULL, BBFDM_BOTH}, -{"AssociationTime", &DMREAD, DMT_TIME, get_WiFiAccessPointAssociatedDevice_AssociationTime, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}.Stats. *** */ -DMLEAF tWiFiAccessPointAssociatedDeviceStatsParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"BytesSent", &DMREAD, DMT_UNLONG, get_access_point_associative_device_statistics_tx_bytes, NULL, BBFDM_BOTH}, -{"BytesReceived", &DMREAD, DMT_UNLONG, get_access_point_associative_device_statistics_rx_bytes, NULL, BBFDM_BOTH}, -{"PacketsSent", &DMREAD, DMT_UNLONG, get_access_point_associative_device_statistics_tx_packets, NULL, BBFDM_BOTH}, -{"PacketsReceived", &DMREAD, DMT_UNLONG, get_access_point_associative_device_statistics_rx_packets, NULL, BBFDM_BOTH}, -{"ErrorsSent", &DMREAD, DMT_UNINT, get_access_point_associative_device_statistics_tx_errors, NULL, BBFDM_BOTH}, -{"RetransCount", &DMREAD, DMT_UNINT, get_access_point_associative_device_statistics_retrans_count, NULL, BBFDM_BOTH}, -//{"FailedRetransCount", &DMREAD, DMT_UNINT, get_access_point_associative_device_statistics_failed_retrans_count, NULL, BBFDM_BOTH}, -//{"RetryCount", &DMREAD, DMT_UNINT, get_access_point_associative_device_statistics_retry_count, NULL, BBFDM_BOTH}, -//{"MultipleRetryCount", &DMREAD, DMT_UNINT, get_access_point_associative_device_statistics_multiple_retry_count, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.AccessPoint.{i}.Accounting. *** */ -DMLEAF tWiFiAccessPointAccountingParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -//{"Enable", &DMWRITE, DMT_BOOL, get_WiFiAccessPointAccounting_Enable, set_WiFiAccessPointAccounting_Enable, BBFDM_BOTH}, -{"ServerIPAddr", &DMWRITE, DMT_STRING, get_WiFiAccessPointAccounting_ServerIPAddr, set_WiFiAccessPointAccounting_ServerIPAddr, BBFDM_BOTH}, -//{"SecondaryServerIPAddr", &DMWRITE, DMT_STRING, get_WiFiAccessPointAccounting_SecondaryServerIPAddr, set_WiFiAccessPointAccounting_SecondaryServerIPAddr, BBFDM_BOTH}, -{"ServerPort", &DMWRITE, DMT_UNINT, get_WiFiAccessPointAccounting_ServerPort, set_WiFiAccessPointAccounting_ServerPort, BBFDM_BOTH}, -//{"SecondaryServerPort", &DMWRITE, DMT_UNINT, get_WiFiAccessPointAccounting_SecondaryServerPort, set_WiFiAccessPointAccounting_SecondaryServerPort, BBFDM_BOTH}, -{"Secret", &DMWRITE, DMT_STRING, get_WiFiAccessPointAccounting_Secret, set_WiFiAccessPointAccounting_Secret, BBFDM_BOTH, DM_FLAG_SECURE}, -//{"SecondarySecret", &DMWRITE, DMT_STRING, get_WiFiAccessPointAccounting_SecondarySecret, set_WiFiAccessPointAccounting_SecondarySecret, BBFDM_BOTH}, -//{"InterimInterval", &DMWRITE, DMT_UNINT, get_WiFiAccessPointAccounting_InterimInterval, set_WiFiAccessPointAccounting_InterimInterval, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.EndPoint.{i}. *** */ -DMOBJ tWiFiEndPointObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/ -{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiEndPointStatsParams, NULL, BBFDM_BOTH, NULL}, -{"Security", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiEndPointSecurityParams, NULL, BBFDM_BOTH, NULL}, -{"Profile", &DMREAD, NULL, NULL, NULL, browseWiFiEndPointProfileInst, NULL, NULL, tWiFiEndPointProfileObj, tWiFiEndPointProfileParams, NULL, BBFDM_BOTH, NULL}, -{"WPS", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiEndPointWPSParams, NULL, BBFDM_BOTH, NULL}, -{0} -}; - -DMLEAF tWiFiEndPointParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"Enable", &DMWRITE, DMT_BOOL, get_WiFiEndPoint_Enable, set_WiFiEndPoint_Enable, BBFDM_BOTH}, -{"Status", &DMREAD, DMT_STRING, get_WiFiEndPoint_Status, NULL, BBFDM_BOTH}, -{"Alias", &DMWRITE, DMT_STRING, get_WiFiEndPoint_Alias, set_WiFiEndPoint_Alias, BBFDM_BOTH, DM_FLAG_UNIQUE}, -//{"ProfileReference", &DMWRITE, DMT_STRING, get_WiFiEndPoint_ProfileReference, set_WiFiEndPoint_ProfileReference, BBFDM_BOTH}, -{"SSIDReference", &DMREAD, DMT_STRING, get_WiFiEndPoint_SSIDReference, NULL, BBFDM_BOTH, DM_FLAG_UNIQUE|DM_FLAG_REFERENCE}, -//{"ProfileNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiEndPoint_ProfileNumberOfEntries, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.EndPoint.{i}.Stats. *** */ -DMLEAF tWiFiEndPointStatsParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"LastDataDownlinkRate", &DMREAD, DMT_UNINT, get_WiFiEndPointStats_LastDataDownlinkRate, NULL, BBFDM_BOTH}, -{"LastDataUplinkRate", &DMREAD, DMT_UNINT, get_WiFiEndPointStats_LastDataUplinkRate, NULL, BBFDM_BOTH}, -{"SignalStrength", &DMREAD, DMT_INT, get_WiFiEndPointStats_SignalStrength, NULL, BBFDM_BOTH}, -{"Retransmissions", &DMREAD, DMT_UNINT, get_WiFiEndPointStats_Retransmissions, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.EndPoint.{i}.Security. *** */ -DMLEAF tWiFiEndPointSecurityParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"ModesSupported", &DMREAD, DMT_STRING, get_WiFiEndPointSecurity_ModesSupported, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.EndPoint.{i}.Profile.{i}. *** */ -DMOBJ tWiFiEndPointProfileObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/ -{"Security", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiEndPointProfileSecurityParams, NULL, BBFDM_BOTH, NULL}, -{0} -}; - -DMLEAF tWiFiEndPointProfileParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"Enable", &DMWRITE, DMT_BOOL, get_WiFiEndPointProfile_Enable, set_WiFiEndPointProfile_Enable, BBFDM_BOTH}, -{"Status", &DMREAD, DMT_STRING, get_WiFiEndPointProfile_Status, NULL, BBFDM_BOTH}, -{"Alias", &DMWRITE, DMT_STRING, get_WiFiEndPointProfile_Alias, set_WiFiEndPointProfile_Alias, BBFDM_BOTH, DM_FLAG_UNIQUE}, -{"SSID", &DMWRITE, DMT_STRING, get_WiFiEndPointProfile_SSID, set_WiFiEndPointProfile_SSID, BBFDM_BOTH, DM_FLAG_UNIQUE}, -{"Location", &DMWRITE, DMT_STRING, get_WiFiEndPointProfile_Location, set_WiFiEndPointProfile_Location, BBFDM_BOTH, DM_FLAG_UNIQUE}, -//{"Priority", &DMWRITE, DMT_UNINT, get_WiFiEndPointProfile_Priority, set_WiFiEndPointProfile_Priority, BBFDM_BOTH, DM_FLAG_UNIQUE}, -{0} -}; - -/* *** Device.WiFi.EndPoint.{i}.Profile.{i}.Security. *** */ -DMLEAF tWiFiEndPointProfileSecurityParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"ModeEnabled", &DMWRITE, DMT_STRING, get_WiFiEndPointProfileSecurity_ModeEnabled, set_WiFiEndPointProfileSecurity_ModeEnabled, BBFDM_BOTH}, -{"WEPKey", &DMWRITE, DMT_HEXBIN, get_WiFiEndPointProfileSecurity_WEPKey, set_WiFiEndPointProfileSecurity_WEPKey, BBFDM_BOTH, DM_FLAG_SECURE}, -{"PreSharedKey", &DMWRITE, DMT_HEXBIN, get_WiFiEndPointProfileSecurity_PreSharedKey, set_WiFiEndPointProfileSecurity_PreSharedKey, BBFDM_BOTH, DM_FLAG_SECURE}, -{"KeyPassphrase", &DMWRITE, DMT_STRING, get_WiFiEndPointProfileSecurity_KeyPassphrase, set_WiFiEndPointProfileSecurity_KeyPassphrase, BBFDM_BOTH, DM_FLAG_SECURE}, -{"SAEPassphrase", &DMWRITE, DMT_STRING, get_WiFiEndPointProfileSecurity_SAEPassphrase, set_WiFiEndPointProfileSecurity_SAEPassphrase, BBFDM_BOTH, DM_FLAG_SECURE}, -{"MFPConfig", &DMWRITE, DMT_STRING, get_WiFiEndPointProfileSecurity_MFPConfig, set_WiFiEndPointProfileSecurity_MFPConfig, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.EndPoint.{i}.WPS. *** */ -DMLEAF tWiFiEndPointWPSParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"Enable", &DMWRITE, DMT_BOOL, get_WiFiEndPointWPS_Enable, set_WiFiEndPointWPS_Enable, BBFDM_BOTH}, -{"ConfigMethodsSupported", &DMREAD, DMT_STRING, get_WiFiEndPointWPS_ConfigMethodsSupported, NULL, BBFDM_BOTH}, -{"ConfigMethodsEnabled", &DMWRITE, DMT_STRING, get_WiFiEndPointWPS_ConfigMethodsEnabled, set_WiFiEndPointWPS_ConfigMethodsEnabled, BBFDM_BOTH}, -{"Status", &DMREAD, DMT_STRING, get_WiFiEndPointWPS_Status, NULL, BBFDM_BOTH}, -//{"Version", &DMREAD, DMT_STRING, get_WiFiEndPointWPS_Version, NULL, BBFDM_BOTH}, -//{"PIN", &DMWRITE, DMT_UNINT, get_WiFiEndPointWPS_PIN, set_WiFiEndPointWPS_PIN, BBFDM_BOTH}, -{0} -}; diff --git a/libbbfdm/dmtree/tr181/wifi.dataelements.c b/libbbfdm/dmtree/tr181/wifi.dataelements.c deleted file mode 100644 index 775f19ab..00000000 --- a/libbbfdm/dmtree/tr181/wifi.dataelements.c +++ /dev/null @@ -1,4821 +0,0 @@ -/* - * Copyright (C) 2023 IOPSYS Software Solutions AB - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 2.1 - * as published by the Free Software Foundation - * - * Author: Amin Ben Romdhane - * - */ - -#include "wifi.dataelements.h" - -enum set_ssid_operations { - SET_SSID_ADD, - SET_SSID_REMOVE, - SET_SSID_CHANGE, - SET_SSID_INVALID -}; - -typedef struct set_ssid_operate_param { - char *ssid; - char *enab; - char *key; - char *band; - char *akm; - char *adv; - char *mfp; - char *haul; -} set_ssid_param; - -/************************************************************* -* COMMON FUNCTIONS -**************************************************************/ -static char *get_AKMs_dm_name(const char *value) -{ - if (DM_LSTRCMP(value, "sae") == 0) { - return "sae"; - } - - if (DM_LSTRCMP(value, "sae-mixed") == 0) { - return "psk+sae"; - } - - if (DM_LSTRCMP(value, "psk2") == 0) { - return "psk"; - } - - if (DM_LSTRCMP(value, "dpp") == 0) { - return "dpp"; - } - - if (DM_LSTRCMP(value, "dpp+sae") == 0) { - return "dpp+sae"; - } - - if (DM_LSTRCMP(value, "dpp+sae-mixed") == 0) { - return "dpp+psk+sae"; - } - - return ""; -} - -static char *get_AKMs_uci_name(const char *value) -{ - if (DM_LSTRCMP(value, "psk") == 0) { - return "psk2"; - } else if(DM_LSTRCMP(value, "dpp") == 0) { - return "dpp"; - } else if(DM_LSTRCMP(value, "sae") == 0) { - return "sae"; - } else if(DM_LSTRCMP(value, "psk+sae") == 0) { - return "sae-mixed"; - } else if(DM_LSTRCMP(value, "dpp+sae") == 0) { - return "dpp+sae"; - } else if(DM_LSTRCMP(value, "dpp+psk+sae") == 0) { - return "dpp+sae-mixed"; - } - - return "sae-mixed"; -} - -static char *get_mfp_dm_value_by_section(struct uci_section *sec) -{ - char *mfp = NULL; - char *encr = NULL; - unsigned int res = 0; - - dmuci_get_value_by_section_string(sec, "mfp", &mfp); - if (DM_STRLEN(mfp) == 0) { - dmuci_get_value_by_section_string(sec, "encryption", &encr); - if (DM_LSTRCMP(encr, "psk2") == 0) { - res = 0; - } else if (DM_LSTRCMP(encr, "sae-mixed") == 0 || DM_LSTRCMP(encr, "sae-mixed+dpp") == 0) { - res = 1; - } else { - res = 2; - } - } else { - res = DM_STRTOUL(mfp); - } - - switch (res) { - case 0: - return "Disabled"; - case 1: - return "Optional"; - case 2: - return "Required"; - } - - return "Disabled"; -} - -static char *get_mfp_uci_value(const char *mfp) -{ - if (DM_LSTRCMP(mfp, "Disabled") == 0) - return "0"; - - if (DM_LSTRCMP(mfp, "Optional") == 0) - return "1"; - - if (DM_LSTRCMP(mfp, "Required") == 0) - return "2"; - - return ""; -} - -static char *get_haultype_dm_value_by_section(struct uci_section *sec) -{ - char *type = NULL; - dmuci_get_value_by_section_string(sec, "type", &type); - - if (DM_LSTRCMP(type, "backhaul") == 0) { - return "Backhaul"; - } - - return "Fronthaul"; -} - -static char *get_haultype_uci_value(const char *value) -{ - if (DM_LSTRCMP(value, "Backhaul") == 0) { - return "backhaul"; - } - - return "fronthaul"; -} - -static char *get_adv_enabled_by_section(struct uci_section *sec) -{ - char *hidden = NULL, *type = NULL; - char *value = "0"; - - dmuci_get_value_by_section_string(sec, "hidden", &hidden); - if (DM_STRLEN(hidden) == 0) { - dmuci_get_value_by_section_string(sec, "type", &type); - if (DM_LSTRCMP(type, "fronthaul") == 0) { - value = "1"; - } else { - value = "0"; - } - } else { - value = (hidden[0] == '0') ? "1" : "0"; - } - - return value; -} - -static int get_requested_operation(const char *req) -{ - if (DM_LSTRCMP(req, "Add") == 0) - return SET_SSID_ADD; - - if (DM_LSTRCMP(req, "Remove") == 0) - return SET_SSID_REMOVE; - - if (DM_LSTRCMP(req, "Change") == 0) - return SET_SSID_CHANGE; - - return SET_SSID_INVALID; -} - -static int validate_band_value(struct dmctx *ctx, char *band) -{ - char *band_list[] = {"2.4", "5", "6", "All", NULL}; - - if (DM_STRLEN(band) == 0) - return 0; - - if (bbfdm_validate_string_list(ctx, band, -1, -1, -1, -1, -1, band_list, NULL)) - return -1; - - /* if "All" is present then no other values are allowed in list */ - if (DM_STRSTR(band, "All") != NULL && DM_STRLEN(band) > 3) - return -1; - - return 0; -} - -static int validate_akms_value(struct dmctx *ctx, char *akms) -{ - char *akms_list[] = {"psk", "dpp", "sae", "psk+sae", "dpp+sae", "dpp+psk+sae", NULL}; - - if (DM_STRLEN(akms) == 0) - return 0; - - if (bbfdm_validate_string_list(ctx, akms, -1, -1, -1, -1, -1, akms_list, NULL)) - return -1; - - return 0; -} - -static int validate_mfp_value(struct dmctx *ctx, char *mfp) -{ - char *mfp_list[] = {"Disabled", "Optional", "Required", NULL}; - - if (DM_STRLEN(mfp) == 0) - return 0; - - if (bbfdm_validate_string(ctx, mfp, -1, -1, mfp_list, NULL)) - return -1; - - return 0; -} - -static int validate_haultype_value(struct dmctx *ctx, char *haul) -{ - char *haul_list[] = {"Fronthaul", "Backhaul", NULL}; - - if (DM_STRLEN(haul) == 0) - return 0; - - if (bbfdm_validate_string_list(ctx, haul, -1, -1, -1, -1, -1, haul_list, NULL)) - return -1; - - return 0; -} - -/************************************************************* -* ADD DEL OBJ -**************************************************************/ -/*static int addObjWiFiDataElementsNetworkDeviceRadioDisAllowedOpClassChannels(char *refparam, struct dmctx *ctx, void *data, char **instance) -{ - //TODO - return 0; -} - -static int delObjWiFiDataElementsNetworkDeviceRadioDisAllowedOpClassChannels(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) -{ - switch (del_action) { - case DEL_INST: - //TODO - break; - case DEL_ALL: - //TODO - break; - } - return 0; -}*/ - -/************************************************************* -* ENTRY METHOD -**************************************************************/ -static int browseWiFiDataElementsNetworkSSIDInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - struct dm_data *curr_data = NULL; - char *inst = NULL, *mld_id = NULL; - LIST_HEAD(dup_list); - - synchronize_specific_config_sections_with_dmmap("mapcontroller", "ap", "dmmap_mapcontroller", &dup_list); - list_for_each_entry(curr_data, &dup_list, list) { - // Show the ap sections which does not have mld_id - dmuci_get_value_by_section_string(curr_data->config_section, "mld_id", &mld_id); - if (DM_STRLEN(mld_id) != 0) - continue; - - inst = handle_instance(dmctx, parent_node, curr_data->dmmap_section, "wifi_da_ssid_instance", "wifi_da_ssid_alias"); - - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)curr_data, inst) == DM_STOP) - break; - } - free_dmmap_config_dup_list(&dup_list); - return 0; -} - -static struct uci_section *find_device_uci_section(char *unique_key) -{ - struct uci_section *s = NULL; - - uci_foreach_sections("mapcontroller", "node", s) { - char *agent_id = NULL; - - dmuci_get_value_by_section_string(s, "agent_id", &agent_id); - - // Device found ==> return the current device uci section - if (DM_STRCMP(agent_id, unique_key) == 0) - return s; - } - - return NULL; -} - -static struct uci_section *find_radio_uci_section(char *agent_id, char *unique_key) -{ - struct uci_section *s = NULL; - - uci_foreach_option_eq("mapcontroller", "radio", "agent_id", agent_id, s) { - char *macaddr = NULL; - - dmuci_get_value_by_section_string(s, "macaddr", &macaddr); - - // Radio found ==> return the current radio uci section - if (DM_STRCMP(macaddr, unique_key) == 0) - return s; - } - - return NULL; -} - -static int browseWiFiDataElementsNetworkDeviceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - 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, *dev_obj = NULL; - int j = 0; - - dmjson_foreach_obj_in_array(data_obj, dev_arr, dev_obj, j, 2, "wfa-dataelements:Network", "DeviceList") { - - char *key = dmjson_get_value(dev_obj, 1, "ID"); - if (!key || *key == '\0') - continue; - - 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 *)&curr_data, inst) == DM_STOP) - return 0; - } - } - - return 0; -} - -static int browseWiFiDataElementsNetworkDeviceDefault8021QInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - DM_LINK_INST_OBJ(dmctx, parent_node, prev_data, "1"); - return 0; -} - -static int browseWiFiDataElementsNetworkDeviceSSIDtoVIDMappingInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - 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(((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 *)&curr_data, inst) == DM_STOP) - break; - } - return 0; -} - -static int browseWiFiDataElementsNetworkDeviceCACStatusInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - 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(((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 *)&curr_data, inst) == DM_STOP) - break; - } - return 0; -} - -static int browseWiFiDataElementsNetworkDeviceIEEE1905SecurityInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - 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(((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 *)&curr_data, inst) == DM_STOP) - break; - } - return 0; -} - - -static int browseWiFiDataElementsNetworkDeviceRadioInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - 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(((struct dm_data *)prev_data)->json_object, 1, "ID"); - - 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"); - char *str = base64_decode(radio_id); - - /* Cant use strlen on byte array that might genuinely include 0x00 */ - /* but to get 6 bytes, need 8 input BASE64 chars - check for that */ - if ((str != NULL) && (DM_STRLEN(radio_id) == 8)) - string_to_mac(str, 6, mac, sizeof(mac)); - - if (DM_STRLEN(mac) == 0) - continue; - - 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 *)&curr_data, inst) == DM_STOP) - return 0; - } - - return 0; -} - -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(((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 *)&curr_data, inst) == DM_STOP) - break; - } - return 0; -} - -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(((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 *)&curr_data, inst) == DM_STOP) - break; - } - return 0; -} - -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(((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 *)&curr_data, inst) == DM_STOP) - break; - } - return 0; -} - -static int browseWiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfileInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - 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(((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 *)&curr_data, inst) == DM_STOP) - break; - } - return 0; -} - -static int browseWiFiDataElementsNetworkDeviceRadioBSSInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - 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(((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 *)&curr_data, inst) == DM_STOP) - break; - } - return 0; -} - -static int browseWiFiDataElementsNetworkDeviceRadioScanResultInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - 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(((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 *)&curr_data, inst) == DM_STOP) - break; - } - return 0; -} - -/*static int browseWiFiDataElementsNetworkDeviceRadioDisAllowedOpClassChannelsInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - //TODO - return 0; -} -*/ - -static int browseWiFiDataElementsNetworkDeviceRadioUnassociatedSTAInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - 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(((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 *)&curr_data, inst) == DM_STOP) - break; - } - return 0; -} - -static int browseWiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfileInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - 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(((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 *)&curr_data, inst) == DM_STOP) - break; - } - return 0; -} - -static int browseWiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringHistoryInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - 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(((struct dm_data *)prev_data)->json_object, 1, "MACAddress"); - if (!DM_STRLEN(sta)) - return 0; - - dmubus_call("map.controller", "dump_steer_history", UBUS_ARGS{0}, 0, &res); - - dmjson_foreach_obj_in_array(res, sta_arr, sta_obj, sta_id, 1, "sta") { - char *mac = dmjson_get_value(sta_obj, 1, "macaddr"); - - if (DM_STRCMP(mac, sta) != 0) - 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 *)&curr_data, inst) == DM_STOP) - break; - } - break; - } - - return 0; -} - -/* -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(((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 *)&curr_data, inst) == DM_STOP) - break; - } - return 0; -} -*/ - -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(((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 *)&curr_data, inst) == DM_STOP) - break; - } - return 0; -} - -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(((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 *)&curr_data, inst) == DM_STOP) - break; - } - return 0; -} - -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(((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 *)&curr_data, inst) == DM_STOP) - break; - } - return 0; -} - -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(((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 *)&curr_data, inst) == DM_STOP) - break; - } - return 0; -} - -static int browseWiFiDataElementsNetworkDeviceRadioScanCapabilityOpClassChannelsInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - 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(((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 *)&curr_data, inst) == DM_STOP) - break; - } - return 0; -} - -static int browseWiFiDataElementsNetworkDeviceRadioCACCapabilityCACMethodInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - 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(((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 *)&curr_data, inst) == DM_STOP) - break; - } - return 0; -} - -static int browseWiFiDataElementsNetworkDeviceRadioCACCapabilityCACMethodOpClassChannelsInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - 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(((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 *)&curr_data, inst) == DM_STOP) - break; - } - return 0; -} - -/* -static int browseWiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulCurrentOperatingClassProfileInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - 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(((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 *)&curr_data, inst) == DM_STOP) - break; - } - return 0; -} -*/ - -/************************************************************************** -* SET AND GET ALIAS -***************************************************************************/ -static int get_WiFiDataElementsNetwork_option(char *method_name, const char *option, bool is_array, char **value) -{ - json_object *res = NULL; - json_object *jobj = NULL; - - dmubus_call("wifi.dataelements.collector", method_name, UBUS_ARGS{0}, 0, &res); - DM_ASSERT(res, *value = ""); - jobj = dmjson_select_obj_in_array_idx(res, 0, 1, "data"); - DM_ASSERT(jobj, *value = ""); - if (is_array) - *value = dmjson_get_value_array_all(jobj, ",", 2, "wfa-dataelements:Network", option); - else - *value = dmjson_get_value(jobj, 2, "wfa-dataelements:Network", option); - return 0; -} - -/*#Device.WiFi.DataElements.Network.ID!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.ID*/ -static int get_WiFiDataElementsNetwork_ID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return get_WiFiDataElementsNetwork_option("dump2", "ID", false, value); -} - -/*#Device.WiFi.DataElements.Network.TimeStamp!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.TimeStamp*/ -static int get_WiFiDataElementsNetwork_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return get_WiFiDataElementsNetwork_option("dump2", "TimeStamp", false, value); -} - -/*#Device.WiFi.DataElements.Network.ControllerID!UBUS:wifi.dataelements.collector/dump2//data[0].wfa-dataelements:Network.ControllerID*/ -static int get_WiFiDataElementsNetwork_ControllerID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return get_WiFiDataElementsNetwork_option("dump2", "ControllerID", false, value); -} - -static int get_WiFiDataElementsNetwork_DeviceNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - int cnt = get_number_of_entries(ctx, data, instance, browseWiFiDataElementsNetworkDeviceInst); - dmasprintf(value, "%d", cnt); - return 0; -} - -static int get_WiFiDataElementsNetwork_MSCSDisallowedStaList(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return get_WiFiDataElementsNetwork_option("dump2", "MSCSDisallowedStaList", true, value); -} - -static int get_WiFiDataElementsNetwork_SCSDisallowedStaList(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return get_WiFiDataElementsNetwork_option("dump2", "SCSDisallowedStaList", true, value); -} - -static int get_WiFiDataElementsNetwork_SSIDNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - int cnt = get_number_of_entries(ctx, data, instance, browseWiFiDataElementsNetworkSSIDInst); - dmasprintf(value, "%d", cnt); - return 0; -} - -static int get_WiFiDataElementsNetworkSSID_SSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - 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) -{ - dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "band", value); - if (DM_STRTOUL(*value) == 2) { - *value = "2.4"; - } - - return 0; -} - -static int get_WiFiDataElementsNetworkSSID_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "enabled", "1"); - return 0; -} - -static int get_WiFiDataElementsNetworkSSID_AKMs(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *res = NULL; - dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "encryption", &res); - - *value = get_AKMs_dm_name(res); - return 0; -} - -static int get_WiFiDataElementsNetworkSSID_AdvEnabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = get_adv_enabled_by_section(((struct dm_data *)data)->config_section); - return 0; -} - -static int get_WiFiDataElementsNetworkSSID_MFP(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = get_mfp_dm_value_by_section(((struct dm_data *)data)->config_section); - return 0; -} - -static int get_WiFiDataElementsNetworkSSID_Haul(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = get_haultype_dm_value_by_section(((struct dm_data *)data)->config_section); - return 0; -} - -static int ubus_get_multiap_steering_summary_stats(const char *option, char **value) -{ - json_object *res = NULL; - json_object *jobj = NULL; - - dmubus_call("wifi.dataelements.collector", "dump2", UBUS_ARGS{0}, 0, &res); - DM_ASSERT(res, *value = "0"); - jobj = dmjson_select_obj_in_array_idx(res, 0, 1, "data"); - DM_ASSERT(jobj, *value = "0"); - *value = dmjson_get_value(jobj, 3, "wfa-dataelements:Network", "MultiAPSteeringSummaryStats", option); - return 0; -} - -static int get_WiFiDataElementsNetworkMultiAPSteeringSummaryStats_NoCandidateAPFailures(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return ubus_get_multiap_steering_summary_stats("NoCandidateAPFailures", value); -} - -static int get_WiFiDataElementsNetworkMultiAPSteeringSummaryStats_BlacklistAttempts(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return ubus_get_multiap_steering_summary_stats("BlacklistAttempts", value); -} - -static int get_WiFiDataElementsNetworkMultiAPSteeringSummaryStats_BlacklistSuccesses(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return ubus_get_multiap_steering_summary_stats("BlacklistSuccesses", value); -} - -static int get_WiFiDataElementsNetworkMultiAPSteeringSummaryStats_BlacklistFailures(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return ubus_get_multiap_steering_summary_stats("BlacklistFailures", value); -} - -static int get_WiFiDataElementsNetworkMultiAPSteeringSummaryStats_BTMAttempts(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return ubus_get_multiap_steering_summary_stats("BTMAttempts", value); -} - -static int get_WiFiDataElementsNetworkMultiAPSteeringSummaryStats_BTMSuccesses(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return ubus_get_multiap_steering_summary_stats("BTMSuccesses", value); -} - -static int get_WiFiDataElementsNetworkMultiAPSteeringSummaryStats_BTMFailures(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return ubus_get_multiap_steering_summary_stats("BTMFailures", value); -} - -static int get_WiFiDataElementsNetworkMultiAPSteeringSummaryStats_BTMQueryResponses(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return ubus_get_multiap_steering_summary_stats("BTMQueryResponses", value); -} - -/*#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 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 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 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 dm_data *)data)->json_object, 1, "ReportUnsuccessfulAssociations"); - return 0; -} - -static int set_WiFiDataElementsNetworkDevice_ReportUnsuccessfulAssociations(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - - switch (action) { - case VALUECHECK: - if (bbfdm_validate_boolean(ctx, value)) - return FAULT_9007; - return 0; - case VALUESET: - string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "report_sta_assocfails", b ? "1" : "0"); - return 0; - } - return 0; -} - -static int get_WiFiDataElementsNetworkDevice_MaxReportingRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *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 dm_data *)data)->config_section, "report_metric_periodic", value); - return 0; -} - -static int set_WiFiDataElementsNetworkDevice_APMetricsReportingInterval(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,"255"}}, 1)) - return FAULT_9007; - return 0; - case VALUESET: - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "report_metric_periodic", value); - return 0; - } - return 0; -} - -/*#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 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 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 dm_data *)data)->json_object, 1, "ManufacturerModel"); - return 0; -} -*/ - -/*#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 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 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 dm_data *)data)->json_object, 1, "DSCPMap"); - return 0; -} -*/ - -/*#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 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 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 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 dm_data *)data)->json_object, 1, "APMetricsWiFi6"); - return 0; -} -*/ - -/*#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 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 dm_data *)data)->config_section, "steer_exclude", &uci_list); - *value = dmuci_list_to_string(uci_list, ","); - return 0; -} - -static int set_WiFiDataElementsNetworkDevice_LocalSteeringDisallowedSTAList(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - size_t length = 0; - char **arr = NULL; - - switch (action) { - case VALUECHECK: - if (bbfdm_validate_string_list(ctx, value, -1, -1, -1, -1, 17, NULL, MACAddress)) - return FAULT_9007; - return 0; - case VALUESET: - arr = strsplit(value, ",", &length); - 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 dm_data *)data)->config_section, "steer_exclude", arr[i]); - return 0; - } - return 0; -} - -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 dm_data *)data)->config_section, "steer_exclude_btm", &uci_list); - *value = dmuci_list_to_string(uci_list, ","); - return 0; -} - -static int set_WiFiDataElementsNetworkDevice_BTMSteeringDisallowedSTAList(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - size_t length = 0; - char **arr = NULL; - - switch (action) { - case VALUECHECK: - if (bbfdm_validate_string_list(ctx, value, -1, -1, -1, -1, 17, NULL, MACAddress)) - return FAULT_9007; - return 0; - case VALUESET: - arr = strsplit(value, ",", &length); - 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 dm_data *)data)->config_section, "steer_exclude_btm", arr[i]); - return 0; - } - return 0; -} - -/*#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 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 dm_data *)data)->json_object, 1, "ReportIndependentScans"); - return 0; -} - -static int set_WiFiDataElementsNetworkDevice_ReportIndependentScans(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - - switch (action) { - case VALUECHECK: - if (bbfdm_validate_boolean(ctx, value)) - return FAULT_9007; - return 0; - case VALUESET: - string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "report_scan", b ? "1" : "0"); - return 0; - } - return 0; -} - -/* -static int get_WiFiDataElementsNetworkDevice_AssociatedSTAinAPMetricsWiFi6(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "AssociatedSTAinAPMetricsWiFi6"); - return 0; -} - -static int set_WiFiDataElementsNetworkDevice_AssociatedSTAinAPMetricsWiFi6(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_boolean(ctx, value)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -static int get_WiFiDataElementsNetworkDevice_MaxUnsuccessfulAssociationReportingRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "MaxUnsuccessfulAssociationReportingRate"); - return 0; -} - -static int set_WiFiDataElementsNetworkDevice_MaxUnsuccessfulAssociationReportingRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1)) - return FAULT_9007; - return 0; - case VALUESET: - dmuci_set_value_by_section((((struct dm_data *)data)->config_section)->config_section, "report_sta_assocfails_rate", value); - return 0; - } - return 0; -} -*/ - -/*#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 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 dm_data *)data)->json_object, 1, "CoordinatedCACAllowed"); - return 0; -} - -static int set_WiFiDataElementsNetworkDevice_CoordinatedCACAllowed(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - - switch (action) { - case VALUECHECK: - if (bbfdm_validate_boolean(ctx, value)) - return FAULT_9007; - return 0; - case VALUESET: - string_to_bool(value, &b); - dmuci_set_value_by_section((((struct dm_data *)data)->config_section)->config_section, "coordinated_cac", b ? "1" : "0"); - return 0; - } - return 0; -}*/ - -static int get_WiFiDataElementsNetworkDevice_TrafficSeparationAllowed(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_option_value_fallback_def("mapcontroller", "controller", "enable_ts", "0"); - return 0; -} - -/*static int get_WiFiDataElementsNetworkDevice_ServicePrioritizationAllowed(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "ServicePrioritizationAllowed"); - return 0; -} -*/ - -/*#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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 dm_data *)data)->config_section)->config_section, "steer_policy", value); - return 0; -} - -static int set_WiFiDataElementsNetworkDeviceRadio_SteeringPolicy(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,"2"}}, 1)) - return FAULT_9007; - return 0; - case VALUESET: - dmuci_set_value_by_section((((struct dm_data *)data)->config_section)->config_section, "steer_policy", value); - return 0; - } - return 0; -} -*/ - -static int get_WiFiDataElementsNetworkDeviceRadio_ChannelUtilizationThreshold(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "util_threshold", value); - return 0; -} - -static int set_WiFiDataElementsNetworkDeviceRadio_ChannelUtilizationThreshold(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,"255"}}, 1)) - return FAULT_9007; - return 0; - case VALUESET: - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "util_threshold", value); - return 0; - } - return 0; -} - -static int get_WiFiDataElementsNetworkDeviceRadio_RCPISteeringThreshold(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "rcpi_threshold", value); - return 0; -} - -static int set_WiFiDataElementsNetworkDeviceRadio_RCPISteeringThreshold(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,"220"}}, 1)) - return FAULT_9007; - return 0; - case VALUESET: - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "rcpi_threshold", value); - return 0; - } - return 0; -} - -static int get_WiFiDataElementsNetworkDeviceRadio_STAReportingRCPIThreshold(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "report_rcpi_threshold", value); - return 0; -} - -static int set_WiFiDataElementsNetworkDeviceRadio_STAReportingRCPIThreshold(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,"220"}}, 1)) - return FAULT_9007; - return 0; - case VALUESET: - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "report_rcpi_threshold", value); - return 0; - } - return 0; -} - -static int get_WiFiDataElementsNetworkDeviceRadio_STAReportingRCPIHysteresisMarginOverride(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "report_rcpi_hysteresis_margin", value); - return 0; -} - -static int set_WiFiDataElementsNetworkDeviceRadio_STAReportingRCPIHysteresisMarginOverride(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1)) - return FAULT_9007; - return 0; - case VALUESET: - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "report_rcpi_hysteresis_margin", value); - return 0; - } - return 0; -} - -static int get_WiFiDataElementsNetworkDeviceRadio_ChannelUtilizationReportingThreshold(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "report_util_threshold", value); - return 0; -} - -static int set_WiFiDataElementsNetworkDeviceRadio_ChannelUtilizationReportingThreshold(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1)) - return FAULT_9007; - return 0; - case VALUESET: - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "report_util_threshold", value); - return 0; - } - return 0; -} - -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 dm_data *)data)->config_section, "include_sta_stats", "1"); - return 0; -} - -static int set_WiFiDataElementsNetworkDeviceRadio_AssociatedSTATrafficStatsInclusionPolicy(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - - switch (action) { - case VALUECHECK: - if (bbfdm_validate_boolean(ctx, value)) - return FAULT_9007; - return 0; - case VALUESET: - string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "include_sta_stats", b ? "1" : "0"); - return 0; - } - return 0; -} - -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 dm_data *)data)->config_section, "include_sta_metric", "1"); - return 0; -} - -static int set_WiFiDataElementsNetworkDeviceRadio_AssociatedSTALinkMetricsInclusionPolicy(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - - switch (action) { - case VALUECHECK: - if (bbfdm_validate_boolean(ctx, value)) - return FAULT_9007; - return 0; - case VALUESET: - string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "include_sta_metric", b ? "1" : "0"); - return 0; - } - return 0; -} - -/*#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 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 dm_data *)data)->json_object, 1, "APMetricsWiFi6"); - return 0; -} -*/ - -/*#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 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 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 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 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 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 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 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 dm_data *)data)->json_object, 2, "Capabilities", "VHTCapabilities"); - *value = (DM_STRLEN(cap)) ? cap : "AAA="; - return 0; -} - -/*#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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((struct dm_data *)data)->json_object, 1, "ByteCounterUnits"); - return 0; -} -*/ - -/*#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(((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(((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(((struct dm_data *)data)->json_object, 1, "AssociationAllowanceStatus"); - return 0; -} -*/ - -/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.EstServiceParametersBE!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].EstServiceParametersBE*/ -/* -static int get_WiFiDataElementsNetworkDeviceRadioBSS_EstServiceParametersBE(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *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(((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(((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(((struct dm_data *)data)->json_object, 1, "EstServiceParametersVO"); - 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_BackhaulUse(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *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(((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(((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(((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(((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(((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(((struct dm_data *)data)->json_object, ",", 1, "FronthaulAKMsAllowed"); - return 0; -} - -static int set_WiFiDataElementsNetworkDeviceRadioBSS_FronthaulAKMsAllowed(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_string_list(ctx, value, -1, -1, -1, -1, -1, AKMsAllowed, NULL)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -static int get_WiFiDataElementsNetworkDeviceRadioBSS_BackhaulAKMsAllowed(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value_array_all(((struct dm_data *)data)->json_object, ",", 1, "BackhaulAKMsAllowed"); - return 0; -} - -static int set_WiFiDataElementsNetworkDeviceRadioBSS_BackhaulAKMsAllowed(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_string_list(ctx, value, -1, -1, -1, -1, -1, AKMsAllowed, NULL)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} -*/ -/*#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(((struct dm_data *)data)->json_object, 1, "STANumberOfEntries"); - return 0; -} - -static int get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTA_SteeringHistoryNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - int cnt = get_number_of_entries(ctx, data, instance, browseWiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringHistoryInst); - dmasprintf(value, "%d", cnt); - return 0; -} - -/* -static int get_WiFiDataElementsNetworkDeviceRadioBSS_QMDescriptorNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((struct dm_data *)data)->json_object, 1, "CellularDataPreference"); - return 0; -} - -static int set_WiFiDataElementsNetworkDeviceRadioBSSSTA_CellularDataPreference(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_string(ctx, value, -1, -1, CellularDataPreference, NULL)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_ReAssociationDelay(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "ReAssociationDelay"); - return 0; -} - -static int set_WiFiDataElementsNetworkDeviceRadioBSSSTA_ReAssociationDelay(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,"65535"}}, 1)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} -*/ - -static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_TIDQueueSizesNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((struct dm_data *)data)->json_object, 1, "ap"); - return 0; -} - -static int get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringHistory_TriggerEvent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *trigger = NULL; - - 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"); - } else if (DM_STRCMP(trigger, "channel_util") == 0) { - dmasprintf(value, "%s", "Wi-Fi Channel Utilization"); - } else if (DM_STRCMP(trigger, "bk_link_util") == 0) { - dmasprintf(value, "%s", "Backhaul Link Utilization"); - } else { - dmasprintf(value, "%s", "Unknown"); - } - - return 0; -} - -static int get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringHistory_SteeringApproach(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *method = NULL; - - method = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "method"); - - if (DM_STRCMP(method, "btm") == 0) { - dmasprintf(value, "%s", "BTM Request"); - } else if (DM_STRCMP(method, "assoc_ctl") == 0) { - dmasprintf(value, "%s", "Blacklist"); - } else if (DM_STRCMP(method, "async_btm") == 0) { - dmasprintf(value, "%s", "Async BTM Query"); - } else { - dmasprintf(value, "%s", method); - } - - return 0; -} - -static int get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringHistory_APDestination(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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 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 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 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 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(((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(((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 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(((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(((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(((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(((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(((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(((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(((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 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 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 dm_data *)data)->json_object, 1, "ID"); - _bbfdm_get_references(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 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 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 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 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 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 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 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(((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(((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(((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(((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 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 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 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 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 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 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 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 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 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 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 dm_data *)data)->json_object, 4, "MultiAPDevice", "Backhaul", "Stats", "TimeStamp"); - return 0; -} -*/ - -static int get_WiFiDataElementsNetworkDeviceDefault8021Q_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = "1"; - return 0; -} - -static int set_WiFiDataElementsNetworkDeviceDefault8021Q_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - - switch (action) { - case VALUECHECK: - if (bbfdm_validate_boolean(ctx, value)) - return FAULT_9007; - return 0; - case VALUESET: - string_to_bool(value, &b); - //TODO - return 0; - } - return 0; -} - -static int get_WiFiDataElementsNetworkDeviceDefault8021Q_PrimaryVID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_option_value_string("mapcontroller", "controller", "primary_vid", value); - return 0; -} - -static int set_WiFiDataElementsNetworkDeviceDefault8021Q_PrimaryVID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,"4095"}}, 1)) - return FAULT_9007; - return 0; - case VALUESET: - dmuci_set_value("mapcontroller", "controller", "primary_vid", value); - return 0; - } - return 0; -} - -static int get_WiFiDataElementsNetworkDeviceDefault8021Q_DefaultPCP(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_option_value_string("mapcontroller", "controller", "primary_pcp", value); - return 0; -} - -static int set_WiFiDataElementsNetworkDeviceDefault8021Q_DefaultPCP(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,"7"}}, 1)) - return FAULT_9007; - return 0; - case VALUESET: - dmuci_set_value("mapcontroller", "controller", "primary_pcp", value); - return 0; - } - return 0; -} - -static int get_WiFiDataElementsNetworkDeviceSSIDtoVIDMapping_SSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((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(((struct dm_data *)data)->json_object, 1, "EncryptionAlgorithm"); - return 0; -} - -/************************************************************* - * OPERATE COMMANDS - *************************************************************/ -static operation_args WiFiDataElementsNetwork_SetTrafficSeparation_args = { - .in = (const char *[]) { - "Enable", - "SSIDtoVIDMapping.{i}.SSID", - "SSIDtoVIDMapping.{i}.VID", - NULL - }, - .out = (const char *[]) { - "Status", - NULL - } -}; - -struct wifi_operate_args -{ - char *arg1; - char *arg2; -}; - -static int get_operate_args_WiFiDataElementsNetwork_SetTrafficSeparation(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = (char *)&WiFiDataElementsNetwork_SetTrafficSeparation_args; - return 0; -} - -static int operate_WiFiDataElementsNetwork_SetTrafficSeparation(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ -#define MAX_ARGS 16 - - struct wifi_operate_args operate_args[MAX_ARGS] = {0}; - char *status = "Success"; - bool b = false; - - char *enable = dmjson_get_value((json_object *)value, 1, "Enable"); - if (!enable || *enable == '\0' || bbfdm_validate_boolean(ctx, enable)) { - status = "Error_Invalid_Input"; - goto end; - } - - for (int i = 0; i < MAX_ARGS; i++) { - - char ssid[32] = {0}; - char vid[32] = {0}; - - snprintf(ssid, sizeof(ssid), "SSIDtoVIDMapping.%d.SSID", i+1); - snprintf(vid, sizeof(vid), "SSIDtoVIDMapping.%d.VID", i+1); - - operate_args[i].arg1 = dmjson_get_value((json_object *)value, 1, ssid); - operate_args[i].arg2 = dmjson_get_value((json_object *)value, 1, vid); - - // Instance number must be assigned sequentially without gaps, if one is empty then break the loop - if (*(operate_args[i].arg1) == '\0') - break; - - struct uci_section *s = NULL; - - uci_foreach_option_eq("mapcontroller", "ap", "ssid", operate_args[i].arg1, s) { - - // If VID is not empty then update it - if (*(operate_args[i].arg2) != '\0') - dmuci_set_value_by_section(s, "vid", operate_args[i].arg2); - } - } - - string_to_bool(enable, &b); - dmuci_set_value("mapcontroller", "controller", "enable_ts", b ? "1" : "0"); - dmuci_save_package("mapcontroller"); - dmubus_call_set("uci", "commit", UBUS_ARGS{{"config", "mapcontroller", String}}, 1); - -end: - add_list_parameter(ctx, dmstrdup("Status"), dmstrdup(status), DMT_TYPE[DMT_STRING], NULL); - return 0; - -#undef MAX_ARGS -} - -static operation_args WiFiDataElementsNetwork_SetPreferredBackhauls_args = { - .in = (const char *[]) { - "PreferredBackhauls.{i}.BackhaulMACAddress", - "PreferredBackhauls.{i}.bSTAMACAddress", - NULL - }, - .out = (const char *[]) { - "Status", - NULL - } -}; - -static int get_operate_args_WiFiDataElementsNetwork_SetPreferredBackhauls(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = (char *)&WiFiDataElementsNetwork_SetPreferredBackhauls_args; - return 0; -} - -static int operate_WiFiDataElementsNetwork_SetPreferredBackhauls(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - struct wifi_operate_args operate_args[16] = {0}; - char *status = "Success"; - - for (int i = 0;; i++) { - - char device_path[64] = {0}; - char backhaul_mac[64] = {0}; - char bsta_mac[64] = {0}; - char *linker = NULL; - - snprintf(device_path, sizeof(device_path), "Device.WiFi.DataElements.Network.Device.%d.", i+1); - snprintf(backhaul_mac, sizeof(backhaul_mac), "PreferredBackHauls.%d.BackhaulMACAddress", i+1); - snprintf(bsta_mac, sizeof(bsta_mac), "PreferredBackHauls.%d.bSTAMACAddress", i+1); - - operate_args[i].arg1 = dmjson_get_value((json_object *)value, 1, backhaul_mac); - operate_args[i].arg2 = dmjson_get_value((json_object *)value, 1, bsta_mac); - - if (*(operate_args[i].arg1) == '\0' && *(operate_args[i].arg2) == '\0') - break; - - if (*(operate_args[i].arg1) && bbfdm_validate_string(ctx, operate_args[i].arg1, -1, 17, NULL, MACAddress)) { - status = "Error_Invalid_Input"; - break; - } - - if (*(operate_args[i].arg2) && bbfdm_validate_string(ctx, operate_args[i].arg2, -1, 17, NULL, MACAddress)) { - status = "Error_Invalid_Input"; - break; - } - - adm_entry_get_reference_value(ctx, device_path, &linker); - if (linker == NULL || *linker == '\0') { - status = "Error_Invalid_Input"; - break; - } - - struct uci_section *s = get_dup_section_in_config_opt("mapcontroller", "node", "agent_id", linker); - if (*(operate_args[i].arg1) != '\0') - dmuci_set_value_by_section(s, "backhaul_ul_macaddr", operate_args[i].arg1); - - if (*(operate_args[i].arg2) != '\0') - dmuci_set_value_by_section(s, "backhaul_dl_macaddr", operate_args[i].arg2); - - } - - dmuci_save_package("mapcontroller"); - dmubus_call_set("uci", "commit", UBUS_ARGS{{"config", "mapcontroller", String}}, 1); - - add_list_parameter(ctx, dmstrdup("Status"), dmstrdup(status), DMT_TYPE[DMT_STRING], NULL); - return 0; -} - -static operation_args WiFiDataElementsNetwork_SetSSID_args = { - .in = (const char *[]) { - "SSID", - "Enable", - "AddRemoveChange", - "PassPhrase", - "Band", - "AKMsAllowed", - "AdvertisementEnabled", - "MFPConfig", - "HaulType", - NULL - }, - .out = (const char *[]) { - "Status", - NULL - } -}; - -static int get_operate_args_WiFiDataElementsNetwork_SetSSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = (char *)&WiFiDataElementsNetwork_SetSSID_args; - return 0; -} - -static char *process_set_ssid_add_req(set_ssid_param *op_param) -{ - struct uci_section *s = NULL; - bool enable = true; - char **band_arr = NULL; - size_t band_arr_length = 0; - char **enc_arr = NULL; - size_t enc_arr_length = 0; - char **type_arr = NULL; - size_t type_arr_length = 0; - char *curr_ssid = NULL; - unsigned idx = 1; - - if (op_param == NULL) { - return "Error_Other"; - } - - if (DM_STRLEN(op_param->enab) != 0) { - string_to_bool(op_param->enab, &enable); - } - - if (DM_STRLEN(op_param->band) == 0 || DM_LSTRCMP(op_param->band, "All") == 0) { - op_param->band = "2.4,5,6"; - } - - band_arr = strsplit(op_param->band, ",", &band_arr_length); - - if (DM_STRLEN(op_param->akm) != 0) { - enc_arr = strsplit(op_param->akm, ",", &enc_arr_length); - } - - if (DM_STRLEN(op_param->haul) != 0) { - type_arr = strsplit(op_param->haul, ",", &type_arr_length); - } - - if (enc_arr_length > band_arr_length || type_arr_length > band_arr_length) { - return "Error_Invalid_Input"; - } - - /* Check if ssid is already added */ - uci_foreach_sections("mapcontroller", "ap", s) { - dmuci_get_value_by_section_string(s, "ssid", &curr_ssid); - - if (DM_STRCMP(curr_ssid, op_param->ssid) == 0) { - return "Error_Invalid_Input"; - } - - idx++; - } - - for (int i = 0; i < band_arr_length; i++) { - char sec_name[32]; - char *encryp = NULL; - char *haul_type = NULL; - bool adv_enable = true; - - snprintf(sec_name, sizeof(sec_name), "ap_%c_%u", band_arr[i][0], idx+i); - encryp = (enc_arr != NULL && i < enc_arr_length) ? get_AKMs_uci_name(enc_arr[i]) : "sae-mixed"; - haul_type = (type_arr != NULL && i < type_arr_length) ? get_haultype_uci_value(type_arr[i]) : "fronthaul"; - - if (DM_STRLEN(op_param->adv) != 0) { - string_to_bool(op_param->adv, &adv_enable); - } else if (DM_LSTRCMP(haul_type, "backhaul") == 0) { - adv_enable = false; - } - - dmuci_add_section("mapcontroller", "ap", &s); - dmuci_rename_section_by_section(s, sec_name); - - dmuci_set_value_by_section(s, "ssid", op_param->ssid); - dmuci_set_value_by_section(s, "key", op_param->key); - dmuci_set_value_by_section(s, "encryption", encryp); - dmuci_set_value_by_section(s, "type", haul_type); - dmuci_set_value_by_section(s, "enabled", (enable == true) ? "1" : "0"); - dmuci_set_value_by_section(s, "hidden", (adv_enable == true) ? "0" : "1"); - - if (DM_LSTRCMP(band_arr[i], "2.4") == 0) { - dmuci_set_value_by_section(s, "band", "2"); - } else { - dmuci_set_value_by_section(s, "band", band_arr[i]); - } - - if (DM_STRLEN(op_param->mfp) == 0) { - if (DM_LSTRCMP(encryp, "psk2") == 0) { - op_param->mfp = "Disabled"; - } else if (DM_LSTRCMP(encryp, "sae-mixed") == 0 || DM_LSTRCMP(encryp, "sae-mixed+dpp") == 0) { - op_param->mfp = "Optional"; - } else { - op_param->mfp = "Required"; - } - } - - dmuci_set_value_by_section(s, "mfp", get_mfp_uci_value(op_param->mfp)); - } - - return "Success"; -} - -static char *process_set_ssid_remove_req(set_ssid_param *op_param) -{ - struct uci_section *s = NULL; - char *curr_ssid = NULL; - bool ap_deleted = false; - - if (op_param == NULL) { - return "Error_Other"; - } - - uci_foreach_sections("mapcontroller", "ap", s) { - dmuci_get_value_by_section_string(s, "ssid", &curr_ssid); - if (DM_STRCMP(op_param->ssid, curr_ssid) != 0) { - continue; - } - - // delete this section - dmuci_delete_by_section(s, NULL, NULL); - ap_deleted = true; - } - - if (ap_deleted == false) { - return "Error_Invalid_Input"; - } - - return "Success"; -} - -static char *process_set_ssid_change_req(set_ssid_param *op_param) -{ - struct uci_section *s = NULL; - char **band_arr = NULL; - size_t band_arr_length = 0; - char **enc_arr = NULL; - size_t enc_arr_length = 0; - char **type_arr = NULL; - size_t type_arr_length = 0; - char *curr_ssid = NULL; - unsigned ap_count = 0; - - if (op_param == NULL) { - return "Error_Other"; - } - - /* Check if ssid is present */ - uci_foreach_sections("mapcontroller", "ap", s) { - dmuci_get_value_by_section_string(s, "ssid", &curr_ssid); - - if (DM_STRCMP(curr_ssid, op_param->ssid) == 0) { - ap_count++; - } - } - - if (ap_count == 0) { - return "Error_Invalid_Input"; - } - - if (DM_STRLEN(op_param->band) != 0) { - if (DM_LSTRCMP(op_param->band, "All") == 0) { - op_param->band = "2.4,5,6"; - } - - band_arr = strsplit(op_param->band, ",", &band_arr_length); - } - - - if (DM_STRLEN(op_param->akm) != 0) { - enc_arr = strsplit(op_param->akm, ",", &enc_arr_length); - } - - if (DM_STRLEN(op_param->haul) != 0) { - type_arr = strsplit(op_param->haul, ",", &type_arr_length); - } - - if (band_arr_length > ap_count || enc_arr_length > ap_count || type_arr_length > ap_count) { - return "Error_Invalid_Input"; - } - - unsigned idx = 0; - uci_foreach_sections("mapcontroller", "ap", s) { - dmuci_get_value_by_section_string(s, "ssid", &curr_ssid); - if (DM_STRCMP(op_param->ssid, curr_ssid) != 0) { - continue; - } - - // modify this section - bool enable = true; - if (DM_STRLEN(op_param->enab) != 0) { - string_to_bool(op_param->enab, &enable); - dmuci_set_value_by_section(s, "enabled", (enable == true) ? "1" : "0"); - } - - if (DM_STRLEN(op_param->key) != 0) { - dmuci_set_value_by_section(s, "key", op_param->key); - } - - if (enc_arr != NULL && idx < enc_arr_length) { - dmuci_set_value_by_section(s, "encryption", get_AKMs_uci_name(enc_arr[idx])); - } - - if (type_arr != NULL && idx < type_arr_length) { - dmuci_set_value_by_section(s, "type", get_haultype_uci_value(type_arr[idx])); - } - - if (DM_STRLEN(op_param->adv) != 0) { - bool adv_enable; - string_to_bool(op_param->adv, &adv_enable); - dmuci_set_value_by_section(s, "hidden", (adv_enable == true) ? "0" : "1"); - } - - if (band_arr != NULL && idx < band_arr_length) { - if (DM_LSTRCMP(band_arr[idx], "2.4") == 0) { - dmuci_set_value_by_section(s, "band", "2"); - } else { - dmuci_set_value_by_section(s, "band", band_arr[idx]); - } - } - - if (DM_STRLEN(op_param->mfp) != 0) { - dmuci_set_value_by_section(s, "mfp", get_mfp_uci_value(op_param->mfp)); - } - - idx++; - } - - return "Success"; -} - -static int operate_WiFiDataElementsNetwork_SetSSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - set_ssid_param op_param; - char *status = NULL; - - char *add_remove_change = dmjson_get_value((json_object *)value, 1, "AddRemoveChange"); - int op = get_requested_operation(add_remove_change); - - if (op == SET_SSID_INVALID) { - status = "Error_Invalid_Input"; - goto end; - } - - memset(&op_param, 0, sizeof(set_ssid_param)); - - op_param.ssid = dmjson_get_value((json_object *)value, 1, "SSID"); - op_param.enab = dmjson_get_value((json_object *)value, 1, "Enable"); - op_param.key = dmjson_get_value((json_object *)value, 1, "PassPhrase"); - op_param.band = dmjson_get_value((json_object *)value, 1, "Band"); - op_param.akm = dmjson_get_value((json_object *)value, 1, "AKMsAllowed"); - op_param.adv = dmjson_get_value((json_object *)value, 1, "AdvertisementEnabled"); - op_param.mfp = dmjson_get_value((json_object *)value, 1, "MFPConfig"); - op_param.haul = dmjson_get_value((json_object *)value, 1, "HaulType"); - - if (DM_STRLEN(op_param.ssid) == 0 || validate_band_value(ctx, op_param.band) != 0 || - validate_akms_value(ctx, op_param.akm) != 0 || validate_mfp_value(ctx, op_param.mfp) != 0 || - validate_haultype_value(ctx, op_param.haul) != 0) { - status = "Error_Invalid_Input"; - goto end; - } - - if (DM_STRLEN(op_param.enab) != 0 && bbfdm_validate_boolean(ctx, op_param.enab) != 0) { - status = "Error_Invalid_Input"; - goto end; - } - - if (DM_STRLEN(op_param.adv) != 0 && bbfdm_validate_boolean(ctx, op_param.adv) != 0) { - status = "Error_Invalid_Input"; - goto end; - } - - switch (op) { - case SET_SSID_ADD: - status = process_set_ssid_add_req(&op_param); - break; - case SET_SSID_REMOVE: - status = process_set_ssid_remove_req(&op_param); - break; - case SET_SSID_CHANGE: - status = process_set_ssid_change_req(&op_param); - break; - } - - if (DM_LSTRCMP(status, "Success") != 0) { - dmuci_revert_package("mapcontroller"); - } else { - // Commit mapcontroller config changes - dmuci_save_package("mapcontroller"); - dmubus_call_set("uci", "commit", UBUS_ARGS{{"config", "mapcontroller", String}}, 1); - } - -end: - add_list_parameter(ctx, dmstrdup("Status"), dmstrdup(status), DMT_TYPE[DMT_STRING], NULL); - return 0; -} - -static operation_args WiFiDataElementsNetworkDevice_SetSTASteeringState_args = { - .in = (const char *[]) { - "Disallowed", - NULL - }, - .out = (const char *[]) { - "Status", - NULL - } -}; - -static int get_operate_args_WiFiDataElementsNetworkDevice_SetSTASteeringState(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = (char *)&WiFiDataElementsNetworkDevice_SetSTASteeringState_args; - return 0; -} - -static int operate_WiFiDataElementsNetworkDevice_SetSTASteeringState(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - char *status = "Success"; - bool b = false; - - char *disallowed = dmjson_get_value((json_object *)value, 1, "Disallowed"); - if (!disallowed || *disallowed == '\0' || bbfdm_validate_boolean(ctx, disallowed)) { - status = "Error_Invalid_Input"; - goto end; - } - - string_to_bool(disallowed, &b); - dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "steer_disallow", b ? "1" : "0"); - - // Commit mapcontroller config changes - dmuci_save_package("mapcontroller"); - dmubus_call_set("uci", "commit", UBUS_ARGS{{"config", "mapcontroller", String}}, 1); - -end: - add_list_parameter(ctx, dmstrdup("Status"), dmstrdup(status), DMT_TYPE[DMT_STRING], NULL); - return 0; -} - -/* -static operation_args WiFiDataElementsNetworkDevice_SetDFSState_args = { - .in = (const char *[]) { - "DFSEnable", - NULL - }, - .out = (const char *[]) { - "Status", - NULL - } -}; - -static int get_operate_args_WiFiDataElementsNetworkDevice_SetDFSState(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = (char *)&WiFiDataElementsNetworkDevice_SetDFSState_args; - return 0; -} - -static int operate_WiFiDataElementsNetworkDevice_SetDFSState(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - //TODO - return 0; -}*/ - -static operation_args wifidataelementsnetworkdeviceradio_channelscanrequest_args = { - .in = (const char *[]) { - "OpClass", - "ChannelList", - NULL - }, - .out = (const char *[]) { - "Status", - NULL - } -}; - -static int get_operate_args_WiFiDataElementsNetworkDeviceRadio_ChannelScanRequest(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = (char *)&wifidataelementsnetworkdeviceradio_channelscanrequest_args; - return 0; -} - -static int operate_WiFiDataElementsNetworkDeviceRadio_ChannelScanRequest(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - char *status = "Success"; - char *agent_id = NULL; - char *macaddr = NULL; - char *pch = NULL; - char *spch = NULL; - - 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))) { - status = "Error_Invalid_Input"; - goto end; - } - - char *channel_list = dmjson_get_value((json_object *)value, 1, "ChannelList"); - - if (bbfdm_validate_unsignedInt_list(ctx, channel_list, -1, -1, -1, RANGE_ARGS{{NULL,"255"}}, 1)) { - status = "Error_Invalid_Input"; - goto end; - } - - struct json_object *in_args = json_object_new_object(); - json_object_object_add(in_args, "agent", json_object_new_string(agent_id)); - - struct json_object *radio_array = json_object_new_array(); - json_object_array_add(radio_array, json_object_new_string(macaddr)); - json_object_object_add(in_args, "radio", radio_array); - - struct json_object *channel_array = json_object_new_array(); - - for (pch = strtok_r(channel_list, ",", &spch); pch != NULL; pch = strtok_r(NULL, ",", &spch)) { - struct json_object *val_array = json_object_new_array(); - json_object_array_add(val_array, json_object_new_int(DM_STRTOL(pch))); - json_object_array_add(channel_array, val_array); - } - - json_object_object_add(in_args, "channel", channel_array); - - int res = dmubus_call_blob_set("map.controller", "scan", in_args); - if (res) - status = "Error_Invalid_Input"; - - json_object_put(in_args); - -end: - add_list_parameter(ctx, dmstrdup("Status"), dmstrdup(status), DMT_TYPE[DMT_STRING], NULL); - return 0; -} - -/*static operation_args wifidataelementsnetworkdeviceradio_wifirestart_args = { - .out = (const char *[]) { - "Status", - NULL - } -}; - -static int get_operate_args_WiFiDataElementsNetworkDeviceRadio_WiFiRestart(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = (char *)&wifidataelementsnetworkdeviceradio_wifirestart_args; - return 0; -} - -static int operate_WiFiDataElementsNetworkDeviceRadio_WiFiRestart(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - //TODO - return 0; -}*/ - -static operation_args wifidataelementsnetworkdevicemultiapdevicebackhaul_steerwifibackhaul_args = { - .in = (const char *[]) { - "TargetBSS", - "Channel", // NOT used by ubus map.controller steer_backhaul - "TimeOut", - NULL - }, - .out = (const char *[]) { - "Status", - NULL - } -}; - -static int get_operate_args_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaul_SteerWiFiBackhaul(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = (char *)&wifidataelementsnetworkdevicemultiapdevicebackhaul_steerwifibackhaul_args; - return 0; -} - -static int operate_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaul_SteerWiFiBackhaul(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - json_object *res = NULL; - char *status = "Success"; - - char *target_bbs = dmjson_get_value((json_object *)value, 1, "TargetBSS"); - char *time_out = dmjson_get_value((json_object *)value, 1, "TimeOut"); - if (DM_STRLEN(target_bbs) == 0 || DM_STRLEN(time_out) == 0) { - status = "Error_Invalid_Input"; - goto end; - } - - char *agent = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "ID"); - if (DM_STRLEN(agent) == 0) { - status = "Error_Invalid_Input"; - goto end; - } - - dmubus_call("map.controller", "steer_backhaul", UBUS_ARGS{{"agent", agent, String}, - {"target_bssid", target_bbs, String}, - {"timeout", time_out, Integer}}, 3, &res); - - if (res == NULL) { - status = "Error_Invalid_Input"; - goto end; - } - - char *res_status = dmjson_get_value((json_object *)res, 1, "status"); - if (DM_STRCMP(res_status, "ok") != 0) - status = "Error_Other"; - -end: - add_list_parameter(ctx, dmstrdup("Status"), dmstrdup(status), DMT_TYPE[DMT_STRING], NULL); - return 0; -} - -static operation_args wifidataelementsnetworkdeviceradiobssstamultiapsta_btmrequest_args = { - .in = (const char *[]) { - "DisassociationImminent", // NOT used by ubus map.controller steer - "DisassociationTimer", - "BSSTerminationDuration", // NOT used by ubus map.controller steer - "ValidityInterval", // NOT used by ubus map.controller steer - "SteeringTimer", // NOT used by ubus map.controller steer - "TargetBSS", - NULL - }, - .out = (const char *[]) { - "Status", - NULL - } -}; - -static int get_operate_args_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTA_BTMRequest(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = (char *)&wifidataelementsnetworkdeviceradiobssstamultiapsta_btmrequest_args; - return 0; -} - -static int operate_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTA_BTMRequest(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - json_object *res = NULL; - char *status = "Success"; - char buf[1024] = {0}; - char *agent = NULL; - - char *target_bbs = dmjson_get_value((json_object *)value, 1, "TargetBSS"); - char *diass_timer = dmjson_get_value((json_object *)value, 1, "DisassociationTimer"); - if (DM_STRLEN(target_bbs) == 0 || DM_STRLEN(diass_timer) == 0) { - status = "Error_Invalid_Input"; - goto end; - } - - DM_STRNCPY(buf, refparam, sizeof(buf)); - char *p = DM_STRSTR(buf, "Radio"); - if (p) *p = 0; - - adm_entry_get_reference_value(ctx, buf, &agent); - if (DM_STRLEN(agent) == 0) { - status = "Error_Invalid_Input"; - goto end; - } - - char *sta = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "MACAddress"); - if (DM_STRLEN(sta) == 0) { - status = "Error_Invalid_Input"; - goto end; - } - - dmubus_call("map.controller", "steer", UBUS_ARGS{{"agent", agent, String}, - {"sta", sta, String}, - {"target_bssid", target_bbs, String}, - {"disassoc_tmo", diass_timer, Integer}}, 4, &res); - - if (res == NULL) { - status = "Error_Invalid_Input"; - goto end; - } - - char *res_status = dmjson_get_value((json_object *)res, 1, "status"); - if (DM_STRCMP(res_status, "ok") != 0) - status = "Error_Other"; - -end: - add_list_parameter(ctx, dmstrdup("Status"), dmstrdup(status), DMT_TYPE[DMT_STRING], NULL); - return 0; -} - -/************************************************************* - * EVENTS - *************************************************************/ -static event_args wifidataelementsassociationevent_associated_args = { - .name = "wifi.dataelements.Associated", - .param = (const char *[]) { - "type", - "version", - "protocols", - "BSSID", - "MACAddress", - "StatusCode", - "HTCapabilities", - "VHTCapabilities", - "HECapabilities", - "TimeStamp", - NULL - } -}; - -static int get_event_args_WiFiDataElementsAssociationEvent_Associated(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = (char *)&wifidataelementsassociationevent_associated_args; - return 0; -} - -static int event_WiFiDataElementsAssociationEvent_Associated(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case EVENT_CHECK: - // Nothing to check - break; - case EVENT_RUN: - { - char *event_time = dmjson_get_value((json_object *)value, 1, "eventTime"); - char *bssid = dmjson_get_value((json_object *)value, 3, "wfa-dataelements:AssociationEvent", "AssocData", "BSSID"); - char *mac_addr = dmjson_get_value((json_object *)value, 3, "wfa-dataelements:AssociationEvent", "AssocData", "MACAddress"); - char *status_code = dmjson_get_value((json_object *)value, 3, "wfa-dataelements:AssociationEvent", "AssocData", "StatusCode"); - char *ht_cap = dmjson_get_value((json_object *)value, 3, "wfa-dataelements:AssociationEvent", "AssocData", "HTCapabilities"); - char *vht_cap = dmjson_get_value((json_object *)value, 3, "wfa-dataelements:AssociationEvent", "AssocData", "VHTCapabilities"); - char *he_cap = dmjson_get_value((json_object *)value, 3, "wfa-dataelements:AssociationEvent", "AssocData", "HECapabilities"); - - add_list_parameter(ctx, dmstrdup("TimeStamp"), dmstrdup(event_time), DMT_TYPE[DMT_STRING], NULL); - add_list_parameter(ctx, dmstrdup("BSSID"), dmstrdup(bssid), DMT_TYPE[DMT_STRING], NULL); - add_list_parameter(ctx, dmstrdup("MACAddress"), dmstrdup(mac_addr), DMT_TYPE[DMT_STRING], NULL); - add_list_parameter(ctx, dmstrdup("StatusCode"), dmstrdup(status_code), DMT_TYPE[DMT_STRING], NULL); - add_list_parameter(ctx, dmstrdup("HTCapabilities"), dmstrdup(ht_cap), DMT_TYPE[DMT_STRING], NULL); - add_list_parameter(ctx, dmstrdup("VHTCapabilities"), dmstrdup(vht_cap), DMT_TYPE[DMT_STRING], NULL); - add_list_parameter(ctx, dmstrdup("HECapabilities"), dmstrdup(he_cap), DMT_TYPE[DMT_STRING], NULL); - break; - } - } - - return 0; -} - -static event_args wifidataelementsdisassociationevent_disassociated_args = { - .name = "wifi.dataelements.Disassociated", - .param = (const char *[]) { - "type", - "version", - "protocols", - "BSSID", - "MACAddress", - "ReasonCode", - "BytesSent", - "BytesReceived", - "PacketsSent", - "PacketsReceived", - "ErrorsSent", - "ErrorsReceived", - "RetransCount", - "TimeStamp", - NULL - } -}; - -static int get_event_args_WiFiDataElementsDisassociationEvent_Disassociated(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = (char *)&wifidataelementsdisassociationevent_disassociated_args; - return 0; -} - -static int event_WiFiDataElementsDisassociationEvent_Disassociated(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case EVENT_CHECK: - // Nothing to check - break; - case EVENT_RUN: - { - char *event_time = dmjson_get_value((json_object *)value, 1, "eventTime"); - char *bssid = dmjson_get_value((json_object *)value, 3, "wfa-dataelements:DisassociationEvent", "DisassocData", "BSSID"); - char *mac_addr = dmjson_get_value((json_object *)value, 3, "wfa-dataelements:DisassociationEvent", "DisassocData", "MACAddress"); - char *reason_code = dmjson_get_value((json_object *)value, 3, "wfa-dataelements:DisassociationEvent", "DisassocData", "ReasonCode"); - char *bytes_sent = dmjson_get_value((json_object *)value, 3, "wfa-dataelements:DisassociationEvent", "DisassocData", "BytesSent"); - char *bytes_received = dmjson_get_value((json_object *)value, 3, "wfa-dataelements:DisassociationEvent", "DisassocData", "BytesReceived"); - char *packet_sent = dmjson_get_value((json_object *)value, 3, "wfa-dataelements:DisassociationEvent", "DisassocData", "PacketsSent"); - char *packet_received = dmjson_get_value((json_object *)value, 3, "wfa-dataelements:DisassociationEvent", "DisassocData", "PacketsReceived"); - char *errors_sent = dmjson_get_value((json_object *)value, 3, "wfa-dataelements:DisassociationEvent", "DisassocData", "ErrorsSent"); - char *errors_received = dmjson_get_value((json_object *)value, 3, "wfa-dataelements:DisassociationEvent", "DisassocData", "ErrorsReceived"); - char *retrans_count = dmjson_get_value((json_object *)value, 3, "wfa-dataelements:DisassociationEvent", "DisassocData", "RetransCount"); - - add_list_parameter(ctx, dmstrdup("TimeStamp"), dmstrdup(event_time), DMT_TYPE[DMT_STRING], NULL); - add_list_parameter(ctx, dmstrdup("BSSID"), dmstrdup(bssid), DMT_TYPE[DMT_STRING], NULL); - add_list_parameter(ctx, dmstrdup("MACAddress"), dmstrdup(mac_addr), DMT_TYPE[DMT_STRING], NULL); - add_list_parameter(ctx, dmstrdup("ReasonCode"), dmstrdup(reason_code), DMT_TYPE[DMT_STRING], NULL); - add_list_parameter(ctx, dmstrdup("BytesSent"), dmstrdup(bytes_sent), DMT_TYPE[DMT_STRING], NULL); - add_list_parameter(ctx, dmstrdup("BytesReceived"), dmstrdup(bytes_received), DMT_TYPE[DMT_STRING], NULL); - add_list_parameter(ctx, dmstrdup("PacketsSent"), dmstrdup(packet_sent), DMT_TYPE[DMT_STRING], NULL); - add_list_parameter(ctx, dmstrdup("PacketsReceived"), dmstrdup(packet_received), DMT_TYPE[DMT_STRING], NULL); - add_list_parameter(ctx, dmstrdup("ErrorsSent"), dmstrdup(errors_sent), DMT_TYPE[DMT_STRING], NULL); - add_list_parameter(ctx, dmstrdup("ErrorsReceived"), dmstrdup(errors_received), DMT_TYPE[DMT_STRING], NULL); - add_list_parameter(ctx, dmstrdup("RetransCount"), dmstrdup(retrans_count), DMT_TYPE[DMT_STRING], NULL); - break; - } - } - - return 0; -} - -/********************************************************************************************************************************** -* OBJ & LEAF DEFINITION -***********************************************************************************************************************************/ -/* *** Device.WiFi.DataElements. *** */ -DMOBJ tWiFiDataElementsObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/ -{"Network", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiDataElementsNetworkObj, tWiFiDataElementsNetworkParams, NULL, BBFDM_BOTH}, -{"AssociationEvent", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiDataElementsAssociationEventParams, NULL, BBFDM_BOTH, NULL}, -{"DisassociationEvent", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiDataElementsDisassociationEventParams, NULL, BBFDM_BOTH, NULL}, -//{"FailedConnectionEvent", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiDataElementsFailedConnectionEventParams, NULL, BBFDM_BOTH, NULL}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network. *** */ -DMOBJ tWiFiDataElementsNetworkObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/ -{"SSID", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkSSIDInst, NULL, NULL, NULL, tWiFiDataElementsNetworkSSIDParams, NULL, BBFDM_BOTH, NULL}, -{"MultiAPSteeringSummaryStats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiDataElementsNetworkMultiAPSteeringSummaryStatsParams, NULL, BBFDM_BOTH, NULL}, -{"Device", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceInst, NULL, NULL, tWiFiDataElementsNetworkDeviceObj, tWiFiDataElementsNetworkDeviceParams, NULL, BBFDM_BOTH, NULL}, -{0} -}; - -DMLEAF tWiFiDataElementsNetworkParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"ID", &DMREAD, DMT_STRING, get_WiFiDataElementsNetwork_ID, NULL, BBFDM_BOTH}, -{"TimeStamp", &DMREAD, DMT_STRING, get_WiFiDataElementsNetwork_TimeStamp, NULL, BBFDM_BOTH}, -{"ControllerID", &DMREAD, DMT_STRING, get_WiFiDataElementsNetwork_ControllerID, NULL, BBFDM_BOTH}, -{"DeviceNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetwork_DeviceNumberOfEntries, NULL, BBFDM_BOTH}, -{"MSCSDisallowedStaList", &DMREAD, DMT_STRING, get_WiFiDataElementsNetwork_MSCSDisallowedStaList, NULL, BBFDM_BOTH}, -{"SCSDisallowedStaList", &DMREAD, DMT_STRING, get_WiFiDataElementsNetwork_SCSDisallowedStaList, NULL, BBFDM_BOTH}, -{"SSIDNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetwork_SSIDNumberOfEntries, NULL, BBFDM_BOTH}, -{"SetTrafficSeparation()", &DMASYNC, DMT_COMMAND, get_operate_args_WiFiDataElementsNetwork_SetTrafficSeparation, operate_WiFiDataElementsNetwork_SetTrafficSeparation, BBFDM_USP}, -//{"SetServicePrioritization()", &DMASYNC, DMT_COMMAND, get_operate_args_WiFiDataElementsNetwork_SetServicePrioritization, operate_WiFiDataElementsNetwork_SetServicePrioritization, BBFDM_USP}, -{"SetPreferredBackhauls()", &DMASYNC, DMT_COMMAND, get_operate_args_WiFiDataElementsNetwork_SetPreferredBackhauls, operate_WiFiDataElementsNetwork_SetPreferredBackhauls, BBFDM_USP}, -{"SetSSID()", &DMASYNC, DMT_COMMAND, get_operate_args_WiFiDataElementsNetwork_SetSSID, operate_WiFiDataElementsNetwork_SetSSID, BBFDM_USP}, -//{"SetMSCSDisallowed()", &DMASYNC, DMT_COMMAND, get_operate_args_WiFiDataElementsNetwork_SetMSCSDisallowed, operate_WiFiDataElementsNetwork_SetMSCSDisallowed, BBFDM_USP}, -//{"SetSCSDisallowed()", &DMASYNC, DMT_COMMAND, get_operate_args_WiFiDataElementsNetwork_SetSCSDisallowed, operate_WiFiDataElementsNetwork_SetSCSDisallowed, BBFDM_USP}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.SSID.{i}. *** */ -DMLEAF tWiFiDataElementsNetworkSSIDParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"SSID", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkSSID_SSID, NULL, BBFDM_BOTH, DM_FLAG_UNIQUE}, -{"Band", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkSSID_Band, NULL, BBFDM_BOTH}, -{"Enable", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkSSID_Enable, NULL, BBFDM_BOTH}, -{"AKMsAllowed", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkSSID_AKMs, NULL, BBFDM_BOTH}, -{"AdvertisementEnabled", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkSSID_AdvEnabled, NULL, BBFDM_BOTH}, -{"MFPConfig", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkSSID_MFP, NULL, BBFDM_BOTH}, -{"HaulType", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkSSID_Haul, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.MultiAPSteeringSummaryStats. *** */ -DMLEAF tWiFiDataElementsNetworkMultiAPSteeringSummaryStatsParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"NoCandidateAPFailures", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkMultiAPSteeringSummaryStats_NoCandidateAPFailures, NULL, BBFDM_BOTH}, -{"BlacklistAttempts", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkMultiAPSteeringSummaryStats_BlacklistAttempts, NULL, BBFDM_BOTH}, -{"BlacklistSuccesses", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkMultiAPSteeringSummaryStats_BlacklistSuccesses, NULL, BBFDM_BOTH}, -{"BlacklistFailures", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkMultiAPSteeringSummaryStats_BlacklistFailures, NULL, BBFDM_BOTH}, -{"BTMAttempts", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkMultiAPSteeringSummaryStats_BTMAttempts, NULL, BBFDM_BOTH}, -{"BTMSuccesses", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkMultiAPSteeringSummaryStats_BTMSuccesses, NULL, BBFDM_BOTH}, -{"BTMFailures", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkMultiAPSteeringSummaryStats_BTMFailures, NULL, BBFDM_BOTH}, -{"BTMQueryResponses", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkMultiAPSteeringSummaryStats_BTMQueryResponses, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}. *** */ -DMOBJ tWiFiDataElementsNetworkDeviceObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/ -{"Default8021Q", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceDefault8021QInst, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceDefault8021QParams, NULL, BBFDM_BOTH, NULL}, -{"SSIDtoVIDMapping", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceSSIDtoVIDMappingInst, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceSSIDtoVIDMappingParams, NULL, BBFDM_BOTH, NULL}, -{"CACStatus", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceCACStatusInst, NULL, NULL, tWiFiDataElementsNetworkDeviceCACStatusObj, tWiFiDataElementsNetworkDeviceCACStatusParams, NULL, BBFDM_BOTH, NULL}, -//{"SPRule", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceSPRuleInst, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceSPRuleParams, NULL, BBFDM_BOTH, NULL}, -{"IEEE1905Security", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceIEEE1905SecurityInst, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceIEEE1905SecurityParams, NULL, BBFDM_BOTH, NULL}, -//{"AnticipatedChannels", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceAnticipatedChannelsInst, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceAnticipatedChannelsParams, NULL, BBFDM_BOTH, NULL}, -//{"AnticipatedChannelUsage", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceAnticipatedChannelUsageInst, NULL, NULL, tWiFiDataElementsNetworkDeviceAnticipatedChannelUsageObj, tWiFiDataElementsNetworkDeviceAnticipatedChannelUsageParams, NULL, BBFDM_BOTH, NULL}, -{"MultiAPDevice", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceMultiAPDeviceObj, tWiFiDataElementsNetworkDeviceMultiAPDeviceParams, NULL, BBFDM_BOTH, NULL}, -{"Radio", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceRadioInst, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioObj, tWiFiDataElementsNetworkDeviceRadioParams, NULL, BBFDM_BOTH, NULL}, -{0} -}; - -DMLEAF tWiFiDataElementsNetworkDeviceParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"ID", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDevice_ID, NULL, BBFDM_BOTH, DM_FLAG_UNIQUE|DM_FLAG_LINKER}, -{"MultiAPCapabilities", &DMREAD, DMT_BASE64, get_WiFiDataElementsNetworkDevice_MultiAPCapabilities, NULL, BBFDM_BOTH}, -{"CollectionInterval", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDevice_CollectionInterval, NULL, BBFDM_BOTH}, -{"ReportUnsuccessfulAssociations", &DMWRITE, DMT_BOOL, get_WiFiDataElementsNetworkDevice_ReportUnsuccessfulAssociations, set_WiFiDataElementsNetworkDevice_ReportUnsuccessfulAssociations, BBFDM_BOTH}, -{"MaxReportingRate", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDevice_MaxReportingRate, NULL, BBFDM_BOTH}, -{"APMetricsReportingInterval", &DMWRITE, DMT_UNINT, get_WiFiDataElementsNetworkDevice_APMetricsReportingInterval, set_WiFiDataElementsNetworkDevice_APMetricsReportingInterval, BBFDM_BOTH}, -{"Manufacturer", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDevice_Manufacturer, NULL, BBFDM_BOTH}, -{"SerialNumber", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDevice_SerialNumber, NULL, BBFDM_BOTH}, -// {"ManufacturerModel", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDevice_ManufacturerModel, NULL, BBFDM_BOTH}, -{"SoftwareVersion", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDevice_SoftwareVersion, NULL, BBFDM_BOTH}, -{"ExecutionEnv", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDevice_ExecutionEnv, NULL, BBFDM_BOTH}, -// {"DSCPMap", &DMREAD, DMT_HEXBIN, get_WiFiDataElementsNetworkDevice_DSCPMap, NULL, BBFDM_BOTH}, -{"MaxPrioritizationRules", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDevice_MaxPrioritizationRules, NULL, BBFDM_BOTH}, -{"PrioritizationSupport", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDevice_PrioritizationSupport, NULL, BBFDM_BOTH}, -{"MaxVIDs", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDevice_MaxVIDs, NULL, BBFDM_BOTH}, -// {"APMetricsWiFi6", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDevice_APMetricsWiFi6, NULL, BBFDM_BOTH}, -{"CountryCode", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDevice_CountryCode, NULL, BBFDM_BOTH}, -{"LocalSteeringDisallowedSTAList", &DMWRITE, DMT_STRING, get_WiFiDataElementsNetworkDevice_LocalSteeringDisallowedSTAList, set_WiFiDataElementsNetworkDevice_LocalSteeringDisallowedSTAList, BBFDM_BOTH}, -{"BTMSteeringDisallowedSTAList", &DMWRITE, DMT_STRING, get_WiFiDataElementsNetworkDevice_BTMSteeringDisallowedSTAList, set_WiFiDataElementsNetworkDevice_BTMSteeringDisallowedSTAList, BBFDM_BOTH}, -{"DFSEnable", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDevice_DFSEnable, NULL, BBFDM_BOTH}, -{"ReportIndependentScans", &DMWRITE, DMT_BOOL, get_WiFiDataElementsNetworkDevice_ReportIndependentScans, set_WiFiDataElementsNetworkDevice_ReportIndependentScans, BBFDM_BOTH}, -// {"AssociatedSTAinAPMetricsWiFi6", &DMWRITE, DMT_BOOL, get_WiFiDataElementsNetworkDevice_AssociatedSTAinAPMetricsWiFi6, set_WiFiDataElementsNetworkDevice_AssociatedSTAinAPMetricsWiFi6, BBFDM_BOTH}, -// {"MaxUnsuccessfulAssociationReportingRate", &DMWRITE, DMT_UNINT, get_WiFiDataElementsNetworkDevice_MaxUnsuccessfulAssociationReportingRate, set_WiFiDataElementsNetworkDevice_MaxUnsuccessfulAssociationReportingRate, BBFDM_BOTH}, -{"STASteeringState", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDevice_STASteeringState, NULL, BBFDM_BOTH}, -// {"CoordinatedCACAllowed", &DMWRITE, DMT_BOOL, get_WiFiDataElementsNetworkDevice_CoordinatedCACAllowed, set_WiFiDataElementsNetworkDevice_CoordinatedCACAllowed, BBFDM_BOTH}, -{"TrafficSeparationAllowed", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDevice_TrafficSeparationAllowed, NULL, BBFDM_BOTH}, -// {"ServicePrioritizationAllowed", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDevice_ServicePrioritizationAllowed, NULL, BBFDM_BOTH}, -{"RadioNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDevice_RadioNumberOfEntries, NULL, BBFDM_BOTH}, -{"Default8021QNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDevice_Default8021QNumberOfEntries, NULL, BBFDM_BOTH}, -{"SSIDtoVIDMappingNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDevice_SSIDtoVIDMappingNumberOfEntries, NULL, BBFDM_BOTH}, -{"CACStatusNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDevice_CACStatusNumberOfEntries, NULL, BBFDM_BOTH}, -{"IEEE1905SecurityNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDevice_IEEE1905SecurityNumberOfEntries, NULL, BBFDM_BOTH}, -{"SPRuleNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDevice_SPRuleNumberOfEntries, NULL, BBFDM_BOTH}, -{"AnticipatedChannelsNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDevice_AnticipatedChannelsNumberOfEntries, NULL, BBFDM_BOTH}, -{"AnticipatedChannelUsageNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDevice_AnticipatedChannelUsageNumberOfEntries, NULL, BBFDM_BOTH}, -{"SetSTASteeringState()", &DMASYNC, DMT_COMMAND, get_operate_args_WiFiDataElementsNetworkDevice_SetSTASteeringState, operate_WiFiDataElementsNetworkDevice_SetSTASteeringState, BBFDM_USP}, -//{"SetDFSState()", &DMASYNC, DMT_COMMAND, get_operate_args_WiFiDataElementsNetworkDevice_SetDFSState, operate_WiFiDataElementsNetworkDevice_SetDFSState, BBFDM_USP}, -//{"SetAnticipatedChannelPreference()", &DMASYNC, DMT_COMMAND, get_operate_args_WiFiDataElementsNetworkDevice_SetAnticipatedChannelPreference, operate_WiFiDataElementsNetworkDevice_SetAnticipatedChannelPreference, BBFDM_USP}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.Default8021Q.{i}. *** */ -DMLEAF tWiFiDataElementsNetworkDeviceDefault8021QParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"Enable", &DMWRITE, DMT_BOOL, get_WiFiDataElementsNetworkDeviceDefault8021Q_Enable, set_WiFiDataElementsNetworkDeviceDefault8021Q_Enable, BBFDM_BOTH}, -{"PrimaryVID", &DMWRITE, DMT_UNINT, get_WiFiDataElementsNetworkDeviceDefault8021Q_PrimaryVID, set_WiFiDataElementsNetworkDeviceDefault8021Q_PrimaryVID, BBFDM_BOTH, DM_FLAG_UNIQUE}, -{"DefaultPCP", &DMWRITE, DMT_UNINT, get_WiFiDataElementsNetworkDeviceDefault8021Q_DefaultPCP, set_WiFiDataElementsNetworkDeviceDefault8021Q_DefaultPCP, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.SSIDtoVIDMapping.{i}. *** */ -DMLEAF tWiFiDataElementsNetworkDeviceSSIDtoVIDMappingParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"SSID", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceSSIDtoVIDMapping_SSID, NULL, BBFDM_BOTH, DM_FLAG_UNIQUE}, -{"VID", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceSSIDtoVIDMapping_VID, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.CACStatus.{i}. *** */ -DMOBJ tWiFiDataElementsNetworkDeviceCACStatusObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/ -{"CACAvailableChannel", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceCACStatusCACAvailableChannelInst, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceCACStatusCACAvailableChannelParams, NULL, BBFDM_BOTH, NULL}, -{"CACNonOccupancyChannel", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceCACStatusCACNonOccupancyChannelInst, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceCACStatusCACNonOccupancyChannelParams, NULL, BBFDM_BOTH, NULL}, -{"CACActiveChannel", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceCACStatusCACActiveChannelInst, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceCACStatusCACActiveChannelParams, NULL, BBFDM_BOTH, NULL}, -{0} -}; - -DMLEAF tWiFiDataElementsNetworkDeviceCACStatusParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"TimeStamp", &DMREAD, DMT_TIME, get_WiFiDataElementsNetworkDeviceCACStatus_TimeStamp, NULL, BBFDM_BOTH, DM_FLAG_UNIQUE}, -{"CACAvailableChannelNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceCACStatus_CACAvailableChannelNumberOfEntries, NULL, BBFDM_BOTH}, -{"CACNonOccupancyChannelNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceCACStatus_CACNonOccupancyChannelNumberOfEntries, NULL, BBFDM_BOTH}, -{"CACActiveChannelNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceCACStatus_CACActiveChannelNumberOfEntries, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.CACStatus.{i}.CACAvailableChannel.{i}. *** */ -DMLEAF tWiFiDataElementsNetworkDeviceCACStatusCACAvailableChannelParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"OpClass", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceCACStatusCACAvailableChannel_OpClass, NULL, BBFDM_BOTH, DM_FLAG_UNIQUE}, -{"Channel", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceCACStatusCACAvailableChannel_Channel, NULL, BBFDM_BOTH}, -{"Minutes", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceCACStatusCACAvailableChannel_Minutes, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.CACStatus.{i}.CACNonOccupancyChannel.{i}. *** */ -DMLEAF tWiFiDataElementsNetworkDeviceCACStatusCACNonOccupancyChannelParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"OpClass", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceCACStatusCACNonOccupancyChannel_OpClass, NULL, BBFDM_BOTH, DM_FLAG_UNIQUE}, -{"Channel", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceCACStatusCACNonOccupancyChannel_Channel, NULL, BBFDM_BOTH}, -{"Seconds", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceCACStatusCACNonOccupancyChannel_Seconds, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.CACStatus.{i}.CACActiveChannel.{i}. *** */ -DMLEAF tWiFiDataElementsNetworkDeviceCACStatusCACActiveChannelParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"OpClass", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceCACStatusCACActiveChannel_OpClass, NULL, BBFDM_BOTH, DM_FLAG_UNIQUE}, -{"Channel", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceCACStatusCACActiveChannel_Channel, NULL, BBFDM_BOTH}, -{"Countdown", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceCACStatusCACActiveChannel_Countdown, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.SPRule.{i}. *** */ -//DMLEAF tWiFiDataElementsNetworkDeviceSPRuleParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -//{"ID", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceSPRule_ID, NULL, BBFDM_BOTH}, -//{"Precedence", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceSPRule_Precedence, NULL, BBFDM_BOTH}, -//{"Output", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceSPRule_Output, NULL, BBFDM_BOTH}, -//{"AlwaysMatch", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceSPRule_AlwaysMatch, NULL, BBFDM_BOTH}, -//{0} -//}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.IEEE1905Security.{i}. *** */ -DMLEAF tWiFiDataElementsNetworkDeviceIEEE1905SecurityParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"OnboardingProtocol", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceIEEE1905Security_OnboardingProtocol, NULL, BBFDM_BOTH, DM_FLAG_UNIQUE}, -{"IntegrityAlgorithm", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceIEEE1905Security_IntegrityAlgorithm, NULL, BBFDM_BOTH}, -{"EncryptionAlgorithm", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceIEEE1905Security_EncryptionAlgorithm, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.AnticipatedChannels.{i}. *** */ -//DMLEAF tWiFiDataElementsNetworkDeviceAnticipatedChannelsParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -//{"OpClass", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceAnticipatedChannels_OpClass, NULL, BBFDM_BOTH}, -//{"ChannelList", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceAnticipatedChannels_ChannelList, NULL, BBFDM_BOTH}, -//{0} -//}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.AnticipatedChannelUsage.{i}. *** */ -//DMOBJ tWiFiDataElementsNetworkDeviceAnticipatedChannelUsageObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/ -//{"Entry", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceAnticipatedChannelUsageEntryInst, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceAnticipatedChannelUsageEntryParams, NULL, BBFDM_BOTH, NULL}, -//{0} -//}; - -//DMLEAF tWiFiDataElementsNetworkDeviceAnticipatedChannelUsageParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -//{"OpClass", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceAnticipatedChannelUsage_OpClass, NULL, BBFDM_BOTH}, -//{"Channel", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceAnticipatedChannelUsage_Channel, NULL, BBFDM_BOTH}, -//{"ReferenceBSSID", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceAnticipatedChannelUsage_ReferenceBSSID, NULL, BBFDM_BOTH}, -//{"EntryNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceAnticipatedChannelUsage_EntryNumberOfEntries, NULL, BBFDM_BOTH}, -//{0} -//}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.AnticipatedChannelUsage.{i}.Entry.{i}. *** */ -//DMLEAF tWiFiDataElementsNetworkDeviceAnticipatedChannelUsageEntryParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -//{"BurstStartTime", &DMREAD, DMT_HEXBIN, get_WiFiDataElementsNetworkDeviceAnticipatedChannelUsageEntry_BurstStartTime, NULL, BBFDM_BOTH}, -//{"BurstLength", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceAnticipatedChannelUsageEntry_BurstLength, NULL, BBFDM_BOTH}, -//{"Repetitions", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceAnticipatedChannelUsageEntry_Repetitions, NULL, BBFDM_BOTH}, -//{"BurstInterval", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceAnticipatedChannelUsageEntry_BurstInterval, NULL, BBFDM_BOTH}, -//{"RUBitmask", &DMREAD, DMT_HEXBIN, get_WiFiDataElementsNetworkDeviceAnticipatedChannelUsageEntry_RUBitmask, NULL, BBFDM_BOTH}, -//{"TransmitterIdentifier", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceAnticipatedChannelUsageEntry_TransmitterIdentifier, NULL, BBFDM_BOTH}, -//{"PowerLevel", &DMREAD, DMT_INT, get_WiFiDataElementsNetworkDeviceAnticipatedChannelUsageEntry_PowerLevel, NULL, BBFDM_BOTH}, -//{"ChannelUsageReason", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceAnticipatedChannelUsageEntry_ChannelUsageReason, NULL, BBFDM_BOTH}, -//{0} -//}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.MultiAPDevice. *** */ -DMOBJ tWiFiDataElementsNetworkDeviceMultiAPDeviceObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/ -{"Backhaul", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulObj, tWiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulParams, NULL, BBFDM_BOTH, NULL}, -{0} -}; - -DMLEAF tWiFiDataElementsNetworkDeviceMultiAPDeviceParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"ManufacturerOUI", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceMultiAPDevice_ManufacturerOUI, NULL, BBFDM_BOTH}, -{"LastContactTime", &DMREAD, DMT_TIME, get_WiFiDataElementsNetworkDeviceMultiAPDevice_LastContactTime, NULL, BBFDM_BOTH}, -{"AssocIEEE1905DeviceRef", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceMultiAPDevice_AssocIEEE1905DeviceRef, NULL, BBFDM_BOTH}, -{"EasyMeshControllerOperationMode", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceMultiAPDevice_EasyMeshControllerOperationMode, NULL, BBFDM_BOTH}, -{"EasyMeshAgentOperationMode", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceMultiAPDevice_EasyMeshAgentOperationMode, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.MultiAPDevice.Backhaul. *** */ -DMOBJ tWiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/ -//{"CurrentOperatingClassProfile", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulCurrentOperatingClassProfileInst, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulCurrentOperatingClassProfileParams, NULL, BBFDM_BOTH, NULL}, -//{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulStatsParams, NULL, BBFDM_BOTH, NULL}, -{0} -}; - -DMLEAF tWiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"LinkType", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaul_LinkType, NULL, BBFDM_BOTH}, -{"BackhaulMACAddress", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaul_BackhaulMACAddress, NULL, BBFDM_BOTH}, -{"BackhaulDeviceID", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaul_BackhaulDeviceID, NULL, BBFDM_BOTH}, -{"MACAddress", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaul_MACAddress, NULL, BBFDM_BOTH}, -//{"CurrentOperatingClassProfileNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaul_CurrentOperatingClassProfileNumberOfEntries, NULL, BBFDM_BOTH}, -{"SteerWiFiBackhaul()", &DMASYNC, DMT_COMMAND, get_operate_args_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaul_SteerWiFiBackhaul, operate_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaul_SteerWiFiBackhaul, BBFDM_USP}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.MultiAPDevice.Backhaul.CurrentOperatingClassProfile.{i}. *** */ -//DMLEAF tWiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulCurrentOperatingClassProfileParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -//{"Class", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulCurrentOperatingClassProfile_Class, NULL, BBFDM_BOTH}, -//{"Channel", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulCurrentOperatingClassProfile_Channel, NULL, BBFDM_BOTH}, -//{"TxPower", &DMREAD, DMT_INT, get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulCurrentOperatingClassProfile_TxPower, NULL, BBFDM_BOTH}, -//{"TimeStamp", &DMREAD, DMT_TIME, get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulCurrentOperatingClassProfile_TimeStamp, NULL, BBFDM_BOTH}, -//{0} -//}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.MultiAPDevice.Backhaul.Stats. *** */ -//DMLEAF tWiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulStatsParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -//{"BytesSent", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulStats_BytesSent, NULL, BBFDM_BOTH}, -//{"BytesReceived", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulStats_BytesReceived, NULL, BBFDM_BOTH}, -//{"PacketsSent", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulStats_PacketsSent, NULL, BBFDM_BOTH}, -//{"PacketsReceived", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulStats_PacketsReceived, NULL, BBFDM_BOTH}, -//{"ErrorsSent", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulStats_ErrorsSent, NULL, BBFDM_BOTH}, -//{"ErrorsReceived", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulStats_ErrorsReceived, NULL, BBFDM_BOTH}, -//{"LinkUtilization", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulStats_LinkUtilization, NULL, BBFDM_BOTH}, -//{"SignalStrength", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulStats_SignalStrength, NULL, BBFDM_BOTH}, -//{"LastDataDownlinkRate", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulStats_LastDataDownlinkRate, NULL, BBFDM_BOTH}, -//{"LastDataUplinkRate", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulStats_LastDataUplinkRate, NULL, BBFDM_BOTH}, -//{"TimeStamp", &DMREAD, DMT_TIME, get_WiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulStats_TimeStamp, NULL, BBFDM_BOTH}, -//{0} -//}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}. *** */ -DMOBJ tWiFiDataElementsNetworkDeviceRadioObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/ -{"ScanResult", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceRadioScanResultInst, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioScanResultObj, tWiFiDataElementsNetworkDeviceRadioScanResultParams, NULL, BBFDM_BOTH, NULL}, -{"BackhaulSta", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioBackhaulStaParams, NULL, BBFDM_BOTH, NULL}, -{"ScanCapability", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioScanCapabilityObj, tWiFiDataElementsNetworkDeviceRadioScanCapabilityParams, NULL, BBFDM_BOTH, NULL}, -{"CACCapability", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioCACCapabilityObj, tWiFiDataElementsNetworkDeviceRadioCACCapabilityParams, NULL, BBFDM_BOTH, NULL}, -{"Capabilities", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioCapabilitiesObj, tWiFiDataElementsNetworkDeviceRadioCapabilitiesParams, NULL, BBFDM_BOTH, NULL}, -{"CurrentOperatingClassProfile", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfileInst, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfileParams, NULL, BBFDM_BOTH, NULL}, -//{"DisAllowedOpClassChannels", &DMWRITE, addObjWiFiDataElementsNetworkDeviceRadioDisAllowedOpClassChannels, delObjWiFiDataElementsNetworkDeviceRadioDisAllowedOpClassChannels, NULL, browseWiFiDataElementsNetworkDeviceRadioDisAllowedOpClassChannelsInst, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioDisAllowedOpClassChannelsParams, NULL, BBFDM_BOTH, NULL}, -//{"SpatialReuse", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioSpatialReuseParams, NULL, BBFDM_BOTH, NULL}, -{"BSS", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceRadioBSSInst, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioBSSObj, tWiFiDataElementsNetworkDeviceRadioBSSParams, NULL, BBFDM_BOTH, NULL}, -{"UnassociatedSTA", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceRadioUnassociatedSTAInst, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioUnassociatedSTAParams, NULL, BBFDM_BOTH, NULL}, -//{"MultiAPRadio", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioMultiAPRadioParams, NULL, BBFDM_BOTH, NULL}, -{0} -}; - -DMLEAF tWiFiDataElementsNetworkDeviceRadioParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"ID", &DMREAD, DMT_BASE64, get_WiFiDataElementsNetworkDeviceRadio_ID, NULL, BBFDM_BOTH, DM_FLAG_UNIQUE}, -{"Enabled", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadio_Enabled, NULL, BBFDM_BOTH}, -{"Noise", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadio_Noise, NULL, BBFDM_BOTH}, -{"Utilization", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadio_Utilization, NULL, BBFDM_BOTH}, -{"Transmit", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadio_Transmit, NULL, BBFDM_BOTH}, -{"ReceiveSelf", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadio_ReceiveSelf, NULL, BBFDM_BOTH}, -{"ReceiveOther", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadio_ReceiveOther, NULL, BBFDM_BOTH}, -{"TrafficSeparationCombinedFronthaul", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadio_TrafficSeparationCombinedFronthaul, NULL, BBFDM_BOTH}, -{"TrafficSeparationCombinedBackhaul", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadio_TrafficSeparationCombinedBackhaul, NULL, BBFDM_BOTH}, -// {"SteeringPolicy", &DMWRITE, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadio_SteeringPolicy, set_WiFiDataElementsNetworkDeviceRadio_SteeringPolicy, BBFDM_BOTH}, -{"ChannelUtilizationThreshold", &DMWRITE, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadio_ChannelUtilizationThreshold, set_WiFiDataElementsNetworkDeviceRadio_ChannelUtilizationThreshold, BBFDM_BOTH}, -{"RCPISteeringThreshold", &DMWRITE, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadio_RCPISteeringThreshold, set_WiFiDataElementsNetworkDeviceRadio_RCPISteeringThreshold, BBFDM_BOTH}, -{"STAReportingRCPIThreshold", &DMWRITE, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadio_STAReportingRCPIThreshold, set_WiFiDataElementsNetworkDeviceRadio_STAReportingRCPIThreshold, BBFDM_BOTH}, -{"STAReportingRCPIHysteresisMarginOverride", &DMWRITE, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadio_STAReportingRCPIHysteresisMarginOverride, set_WiFiDataElementsNetworkDeviceRadio_STAReportingRCPIHysteresisMarginOverride, BBFDM_BOTH}, -{"ChannelUtilizationReportingThreshold", &DMWRITE, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadio_ChannelUtilizationReportingThreshold, set_WiFiDataElementsNetworkDeviceRadio_ChannelUtilizationReportingThreshold, BBFDM_BOTH}, -{"AssociatedSTATrafficStatsInclusionPolicy", &DMWRITE, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadio_AssociatedSTATrafficStatsInclusionPolicy, set_WiFiDataElementsNetworkDeviceRadio_AssociatedSTATrafficStatsInclusionPolicy, BBFDM_BOTH}, -{"AssociatedSTALinkMetricsInclusionPolicy", &DMWRITE, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadio_AssociatedSTALinkMetricsInclusionPolicy, set_WiFiDataElementsNetworkDeviceRadio_AssociatedSTALinkMetricsInclusionPolicy, BBFDM_BOTH}, -{"ChipsetVendor", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadio_ChipsetVendor, NULL, BBFDM_BOTH}, -// {"APMetricsWiFi6", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadio_APMetricsWiFi6, NULL, BBFDM_BOTH}, -{"CurrentOperatingClassProfileNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadio_CurrentOperatingClassProfileNumberOfEntries, NULL, BBFDM_BOTH}, -{"UnassociatedSTANumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadio_UnassociatedSTANumberOfEntries, NULL, BBFDM_BOTH}, -{"BSSNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadio_BSSNumberOfEntries, NULL, BBFDM_BOTH}, -{"ScanResultNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadio_ScanResultNumberOfEntries, NULL, BBFDM_BOTH}, -{"DisAllowedOpClassChannelsNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadio_DisAllowedOpClassChannelsNumberOfEntries, NULL, BBFDM_BOTH}, -{"ChannelScanRequest()", &DMASYNC, DMT_COMMAND, get_operate_args_WiFiDataElementsNetworkDeviceRadio_ChannelScanRequest, operate_WiFiDataElementsNetworkDeviceRadio_ChannelScanRequest, BBFDM_USP}, -//{"RadioEnable()", &DMASYNC, DMT_COMMAND, get_operate_args_WiFiDataElementsNetworkDeviceRadio_RadioEnable, operate_WiFiDataElementsNetworkDeviceRadio_RadioEnable, BBFDM_USP}, -//{"SetTxPowerLimit()", &DMASYNC, DMT_COMMAND, get_operate_args_WiFiDataElementsNetworkDeviceRadio_SetTxPowerLimit, operate_WiFiDataElementsNetworkDeviceRadio_SetTxPowerLimit, BBFDM_USP}, -//{"SetSpatialReuse()", &DMASYNC, DMT_COMMAND, get_operate_args_WiFiDataElementsNetworkDeviceRadio_SetSpatialReuse, operate_WiFiDataElementsNetworkDeviceRadio_SetSpatialReuse, BBFDM_USP}, -//{"WiFiRestart()", &DMASYNC, DMT_COMMAND, get_operate_args_WiFiDataElementsNetworkDeviceRadio_WiFiRestart, operate_WiFiDataElementsNetworkDeviceRadio_WiFiRestart, BBFDM_USP}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}. *** */ -DMOBJ tWiFiDataElementsNetworkDeviceRadioScanResultObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/ -{"OpClassScan", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanInst, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanObj, tWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanParams, NULL, BBFDM_BOTH}, -{0} -}; - -DMLEAF tWiFiDataElementsNetworkDeviceRadioScanResultParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"TimeStamp", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioScanResult_TimeStamp, NULL, BBFDM_BOTH}, -{"OpClassScanNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioScanResult_OpClassScanNumberOfEntries, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.OpClassScan.{i}. *** */ -DMOBJ tWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/ -{"ChannelScan", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanInst, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanObj, tWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanParams, NULL, BBFDM_BOTH, NULL}, -{0} -}; - -DMLEAF tWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"OperatingClass", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScan_OperatingClass, NULL, BBFDM_BOTH, DM_FLAG_UNIQUE}, -{"ChannelScanNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScan_ChannelScanNumberOfEntries, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.OpClassScan.{i}.ChannelScan.{i}. *** */ -DMOBJ tWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/ -{"NeighborBSS", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSSInst, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSSParams, NULL, BBFDM_BOTH}, -{0} -}; - -DMLEAF tWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"Channel", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_Channel, NULL, BBFDM_BOTH, DM_FLAG_UNIQUE}, -{"TimeStamp", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_TimeStamp, NULL, BBFDM_BOTH}, -{"Utilization", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_Utilization, NULL, BBFDM_BOTH}, -{"Noise", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_Noise, NULL, BBFDM_BOTH}, -{"NeighborBSSNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_NeighborBSSNumberOfEntries, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.OpClassScan.{i}.ChannelScan.{i}.NeighborBSS.{i}. *** */ -DMLEAF tWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSSParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"BSSID", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_BSSID, NULL, BBFDM_BOTH, DM_FLAG_UNIQUE}, -{"SSID", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_SSID, NULL, BBFDM_BOTH}, -{"SignalStrength", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_SignalStrength, NULL, BBFDM_BOTH}, -{"ChannelBandwidth", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_ChannelBandwidth, NULL, BBFDM_BOTH}, -{"ChannelUtilization", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_ChannelUtilization, NULL, BBFDM_BOTH}, -{"StationCount", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_StationCount, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BackhaulSta. *** */ -DMLEAF tWiFiDataElementsNetworkDeviceRadioBackhaulStaParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"MACAddress", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioBackhaulSta_MACAddress, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanCapability. *** */ -DMOBJ tWiFiDataElementsNetworkDeviceRadioScanCapabilityObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/ -{"OpClassChannels", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceRadioScanCapabilityOpClassChannelsInst, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioScanCapabilityOpClassChannelsParams, NULL, BBFDM_BOTH, NULL}, -{0} -}; - -DMLEAF tWiFiDataElementsNetworkDeviceRadioScanCapabilityParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"OnBootOnly", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioScanCapability_OnBootOnly, NULL, BBFDM_BOTH}, -{"Impact", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioScanCapability_Impact, NULL, BBFDM_BOTH}, -{"MinimumInterval", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioScanCapability_MinimumInterval, NULL, BBFDM_BOTH}, -{"OpClassChannelsNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioScanCapability_OpClassChannelsNumberOfEntries, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanCapability.OpClassChannels.{i}. *** */ -DMLEAF tWiFiDataElementsNetworkDeviceRadioScanCapabilityOpClassChannelsParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"OpClass", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioScanCapabilityOpClassChannels_OpClass, NULL, BBFDM_BOTH, DM_FLAG_UNIQUE}, -{"ChannelList", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioScanCapabilityOpClassChannels_ChannelList, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.CACCapability. *** */ -DMOBJ tWiFiDataElementsNetworkDeviceRadioCACCapabilityObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/ -{"CACMethod", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceRadioCACCapabilityCACMethodInst, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioCACCapabilityCACMethodObj, tWiFiDataElementsNetworkDeviceRadioCACCapabilityCACMethodParams, NULL, BBFDM_BOTH, NULL}, -{0} -}; - -DMLEAF tWiFiDataElementsNetworkDeviceRadioCACCapabilityParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"CACMethodNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioCACCapability_CACMethodNumberOfEntries, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.CACCapability.CACMethod.{i}. *** */ -DMOBJ tWiFiDataElementsNetworkDeviceRadioCACCapabilityCACMethodObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/ -{"OpClassChannels", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceRadioCACCapabilityCACMethodOpClassChannelsInst, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioCACCapabilityCACMethodOpClassChannelsParams, NULL, BBFDM_BOTH, NULL}, -{0} -}; - -DMLEAF tWiFiDataElementsNetworkDeviceRadioCACCapabilityCACMethodParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"Method", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioCACCapabilityCACMethod_Method, NULL, BBFDM_BOTH, DM_FLAG_UNIQUE}, -{"NumberOfSeconds", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioCACCapabilityCACMethod_NumberOfSeconds, NULL, BBFDM_BOTH}, -{"OpClassChannelsNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioCACCapabilityCACMethod_OpClassChannelsNumberOfEntries, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.CACCapability.CACMethod.{i}.OpClassChannels.{i}. *** */ -DMLEAF tWiFiDataElementsNetworkDeviceRadioCACCapabilityCACMethodOpClassChannelsParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"OpClass", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioCACCapabilityCACMethodOpClassChannels_OpClass, NULL, BBFDM_BOTH, DM_FLAG_UNIQUE}, -{"ChannelList", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioCACCapabilityCACMethodOpClassChannels_ChannelList, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.Capabilities. *** */ -DMOBJ tWiFiDataElementsNetworkDeviceRadioCapabilitiesObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/ -{"WiFi6APRole", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRoleParams, NULL, BBFDM_BOTH, NULL}, -{"WiFi6bSTARole", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARoleParams, NULL, BBFDM_BOTH, NULL}, -//{"AKMFrontHaul", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceRadioCapabilitiesAKMFrontHaulInst, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioCapabilitiesAKMFrontHaulParams, NULL, BBFDM_BOTH, NULL}, -//{"AKMBackhaul", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceRadioCapabilitiesAKMBackhaulInst, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioCapabilitiesAKMBackhaulParams, NULL, BBFDM_BOTH, NULL}, -{"CapableOperatingClassProfile", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfileInst, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfileParams, NULL, BBFDM_BOTH, NULL}, -{0} -}; - -DMLEAF tWiFiDataElementsNetworkDeviceRadioCapabilitiesParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"HTCapabilities", &DMREAD, DMT_BASE64, get_WiFiDataElementsNetworkDeviceRadioCapabilities_HTCapabilities, NULL, BBFDM_BOTH}, -{"VHTCapabilities", &DMREAD, DMT_BASE64, get_WiFiDataElementsNetworkDeviceRadioCapabilities_VHTCapabilities, NULL, BBFDM_BOTH}, -{"CapableOperatingClassProfileNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioCapabilities_CapableOperatingClassProfileNumberOfEntries, NULL, BBFDM_BOTH}, -//{"AKMFrontHaulNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioCapabilities_AKMFrontHaulNumberOfEntries, NULL, BBFDM_BOTH}, -//{"AKMBackhaulNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioCapabilities_AKMBackhaulNumberOfEntries, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.Capabilities.WiFi6APRole. *** */ -DMLEAF tWiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRoleParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"HE160", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_HE160, NULL, BBFDM_BOTH}, -{"HE8080", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_HE8080, NULL, BBFDM_BOTH}, -{"MCSNSS", &DMREAD, DMT_BASE64, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_MCSNSS, NULL, BBFDM_BOTH}, -{"SUBeamformer", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_SUBeamformer, NULL, BBFDM_BOTH}, -{"SUBeamformee", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_SUBeamformee, NULL, BBFDM_BOTH}, -{"MUBeamformer", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_MUBeamformer, NULL, BBFDM_BOTH}, -{"Beamformee80orLess", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_Beamformee80orLess, NULL, BBFDM_BOTH}, -{"BeamformeeAbove80", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_BeamformeeAbove80, NULL, BBFDM_BOTH}, -{"ULMUMIMO", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_ULMUMIMO, NULL, BBFDM_BOTH}, -{"ULOFDMA", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_ULOFDMA, NULL, BBFDM_BOTH}, -{"MaxDLMUMIMO", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_MaxDLMUMIMO, NULL, BBFDM_BOTH}, -{"MaxULMUMIMO", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_MaxULMUMIMO, NULL, BBFDM_BOTH}, -{"MaxDLOFDMA", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_MaxDLOFDMA, NULL, BBFDM_BOTH}, -{"MaxULOFDMA", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_MaxULOFDMA, NULL, BBFDM_BOTH}, -{"RTS", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_RTS, NULL, BBFDM_BOTH}, -{"MURTS", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_MURTS, NULL, BBFDM_BOTH}, -{"MultiBSSID", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_MultiBSSID, NULL, BBFDM_BOTH}, -{"MUEDCA", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_MUEDCA, NULL, BBFDM_BOTH}, -{"TWTRequestor", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_TWTRequestor, NULL, BBFDM_BOTH}, -{"TWTResponder", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_TWTResponder, NULL, BBFDM_BOTH}, -{"SpatialReuse", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_SpatialReuse, NULL, BBFDM_BOTH}, -{"AnticipatedChannelUsage", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRole_AnticipatedChannelUsage, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.Capabilities.WiFi6bSTARole. *** */ -DMLEAF tWiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARoleParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"HE160", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_HE160, NULL, BBFDM_BOTH}, -{"HE8080", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_HE8080, NULL, BBFDM_BOTH}, -{"MCSNSS", &DMREAD, DMT_BASE64, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_MCSNSS, NULL, BBFDM_BOTH}, -{"SUBeamformer", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_SUBeamformer, NULL, BBFDM_BOTH}, -{"SUBeamformee", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_SUBeamformee, NULL, BBFDM_BOTH}, -{"MUBeamformer", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_MUBeamformer, NULL, BBFDM_BOTH}, -{"Beamformee80orLess", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_Beamformee80orLess, NULL, BBFDM_BOTH}, -{"BeamformeeAbove80", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_BeamformeeAbove80, NULL, BBFDM_BOTH}, -{"ULMUMIMO", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_ULMUMIMO, NULL, BBFDM_BOTH}, -{"ULOFDMA", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_ULOFDMA, NULL, BBFDM_BOTH}, -{"MaxDLMUMIMO", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_MaxDLMUMIMO, NULL, BBFDM_BOTH}, -{"MaxULMUMIMO", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_MaxULMUMIMO, NULL, BBFDM_BOTH}, -{"MaxDLOFDMA", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_MaxDLOFDMA, NULL, BBFDM_BOTH}, -{"MaxULOFDMA", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_MaxULOFDMA, NULL, BBFDM_BOTH}, -{"RTS", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_RTS, NULL, BBFDM_BOTH}, -{"MURTS", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_MURTS, NULL, BBFDM_BOTH}, -{"MultiBSSID", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_MultiBSSID, NULL, BBFDM_BOTH}, -{"MUEDCA", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_MUEDCA, NULL, BBFDM_BOTH}, -{"TWTRequestor", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_TWTRequestor, NULL, BBFDM_BOTH}, -{"TWTResponder", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_TWTResponder, NULL, BBFDM_BOTH}, -{"SpatialReuse", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_SpatialReuse, NULL, BBFDM_BOTH}, -{"AnticipatedChannelUsage", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARole_AnticipatedChannelUsage, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.Capabilities.AKMFrontHaul.{i}. *** */ -//DMLEAF tWiFiDataElementsNetworkDeviceRadioCapabilitiesAKMFrontHaulParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -//{"OUI", &DMREAD, DMT_BASE64, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesAKMFrontHaul_OUI, NULL, BBFDM_BOTH}, -//{"Type", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesAKMFrontHaul_Type, NULL, BBFDM_BOTH}, -//{0} -//}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.Capabilities.AKMBackhaul.{i}. *** */ -//DMLEAF tWiFiDataElementsNetworkDeviceRadioCapabilitiesAKMBackhaulParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -//{"OUI", &DMREAD, DMT_BASE64, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesAKMBackhaul_OUI, NULL, BBFDM_BOTH}, -//{"Type", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesAKMBackhaul_Type, NULL, BBFDM_BOTH}, -//{0} -//}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.Capabilities.CapableOperatingClassProfile.{i}. *** */ -DMLEAF tWiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfileParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"Class", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfile_Class, NULL, BBFDM_BOTH, DM_FLAG_UNIQUE}, -{"MaxTxPower", &DMREAD, DMT_INT, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfile_MaxTxPower, NULL, BBFDM_BOTH}, -{"NonOperable", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfile_NonOperable, NULL, BBFDM_BOTH}, -{"NumberOfNonOperChan", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfile_NumberOfNonOperChan, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.CurrentOperatingClassProfile.{i}. *** */ -DMLEAF tWiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfileParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"Class", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_Class, NULL, BBFDM_BOTH, DM_FLAG_UNIQUE}, -{"Channel", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_Channel, NULL, BBFDM_BOTH}, -{"TxPower", &DMREAD, DMT_INT, get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_TxPower, NULL, BBFDM_BOTH}, -// {"TransmitPowerLimit", &DMREAD, DMT_INT, get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_TransmitPowerLimit, NULL, BBFDM_BOTH}, -{"TimeStamp", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_TimeStamp, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.DisAllowedOpClassChannels.{i}. *** */ -//DMLEAF tWiFiDataElementsNetworkDeviceRadioDisAllowedOpClassChannelsParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -//{"Enable", &DMWRITE, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioDisAllowedOpClassChannels_Enable, set_WiFiDataElementsNetworkDeviceRadioDisAllowedOpClassChannels_Enable, BBFDM_BOTH}, -//{"OpClass", &DMWRITE, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioDisAllowedOpClassChannels_OpClass, set_WiFiDataElementsNetworkDeviceRadioDisAllowedOpClassChannels_OpClass, BBFDM_BOTH}, -//{"ChannelList", &DMWRITE, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioDisAllowedOpClassChannels_ChannelList, set_WiFiDataElementsNetworkDeviceRadioDisAllowedOpClassChannels_ChannelList, BBFDM_BOTH}, -//{0} -//}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.SpatialReuse. *** */ -//DMLEAF tWiFiDataElementsNetworkDeviceRadioSpatialReuseParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -//{"PartialBSSColor", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioSpatialReuse_PartialBSSColor, NULL, BBFDM_BOTH}, -//{"BSSColor", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioSpatialReuse_BSSColor, NULL, BBFDM_BOTH}, -//{"HESIGASpatialReuseValue15Allowed", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioSpatialReuse_HESIGASpatialReuseValue15Allowed, NULL, BBFDM_BOTH}, -//{"SRGInformationValid", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioSpatialReuse_SRGInformationValid, NULL, BBFDM_BOTH}, -//{"NonSRGOffsetValid", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioSpatialReuse_NonSRGOffsetValid, NULL, BBFDM_BOTH}, -//{"PSRDisallowed", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioSpatialReuse_PSRDisallowed, NULL, BBFDM_BOTH}, -//{"NonSRGOBSSPDMaxOffset", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioSpatialReuse_NonSRGOBSSPDMaxOffset, NULL, BBFDM_BOTH}, -//{"SRGOBSSPDMinOffset", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioSpatialReuse_SRGOBSSPDMinOffset, NULL, BBFDM_BOTH}, -//{"SRGOBSSPDMaxOffset", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioSpatialReuse_SRGOBSSPDMaxOffset, NULL, BBFDM_BOTH}, -//{"SRGBSSColorBitmap", &DMREAD, DMT_HEXBIN, get_WiFiDataElementsNetworkDeviceRadioSpatialReuse_SRGBSSColorBitmap, NULL, BBFDM_BOTH}, -//{"SRGPartialBSSIDBitmap", &DMREAD, DMT_HEXBIN, get_WiFiDataElementsNetworkDeviceRadioSpatialReuse_SRGPartialBSSIDBitmap, NULL, BBFDM_BOTH}, -//{"NeighborBSSColorInUseBitmap", &DMREAD, DMT_HEXBIN, get_WiFiDataElementsNetworkDeviceRadioSpatialReuse_NeighborBSSColorInUseBitmap, NULL, BBFDM_BOTH}, -//{0} -//}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}. *** */ -DMOBJ tWiFiDataElementsNetworkDeviceRadioBSSObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/ -// {"QMDescriptor", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceRadioBSSQMDescriptorInst, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioBSSQMDescriptorParams, NULL, BBFDM_BOTH, NULL}, -{"MultiAPSteering", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioBSSMultiAPSteeringParams, NULL, BBFDM_BOTH, NULL}, -{"STA", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceRadioBSSSTAInst, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioBSSSTAObj, tWiFiDataElementsNetworkDeviceRadioBSSSTAParams, NULL, BBFDM_BOTH, NULL}, -{0} -}; - -DMLEAF tWiFiDataElementsNetworkDeviceRadioBSSParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"BSSID", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioBSS_BSSID, NULL, BBFDM_BOTH, DM_FLAG_UNIQUE}, -{"SSID", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioBSS_SSID, NULL, BBFDM_BOTH}, -{"Enabled", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioBSS_Enabled, NULL, BBFDM_BOTH}, -{"LastChange", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSS_LastChange, NULL, BBFDM_BOTH}, -{"TimeStamp", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioBSS_TimeStamp, NULL, BBFDM_BOTH}, -{"UnicastBytesSent", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkDeviceRadioBSS_UnicastBytesSent, NULL, BBFDM_BOTH}, -{"UnicastBytesReceived", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkDeviceRadioBSS_UnicastBytesReceived, NULL, BBFDM_BOTH}, -{"MulticastBytesSent", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkDeviceRadioBSS_MulticastBytesSent, NULL, BBFDM_BOTH}, -{"MulticastBytesReceived", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkDeviceRadioBSS_MulticastBytesReceived, NULL, BBFDM_BOTH}, -{"BroadcastBytesSent", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkDeviceRadioBSS_BroadcastBytesSent, NULL, BBFDM_BOTH}, -{"BroadcastBytesReceived", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkDeviceRadioBSS_BroadcastBytesReceived, NULL, BBFDM_BOTH}, -// {"ByteCounterUnits", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSS_ByteCounterUnits, NULL, BBFDM_BOTH}, -{"Profile1bSTAsDisallowed", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioBSS_Profile1bSTAsDisallowed, NULL, BBFDM_BOTH}, -{"Profile2bSTAsDisallowed", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioBSS_Profile2bSTAsDisallowed, NULL, BBFDM_BOTH}, -// {"AssociationAllowanceStatus", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSS_AssociationAllowanceStatus, NULL, BBFDM_BOTH}, -// {"EstServiceParametersBE", &DMREAD, DMT_BASE64, get_WiFiDataElementsNetworkDeviceRadioBSS_EstServiceParametersBE, NULL, BBFDM_BOTH}, -// {"EstServiceParametersBK", &DMREAD, DMT_BASE64, get_WiFiDataElementsNetworkDeviceRadioBSS_EstServiceParametersBK, NULL, BBFDM_BOTH}, -// {"EstServiceParametersVI", &DMREAD, DMT_BASE64, get_WiFiDataElementsNetworkDeviceRadioBSS_EstServiceParametersVI, NULL, BBFDM_BOTH}, -// {"EstServiceParametersVO", &DMREAD, DMT_BASE64, get_WiFiDataElementsNetworkDeviceRadioBSS_EstServiceParametersVO, NULL, BBFDM_BOTH}, -{"BackhaulUse", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioBSS_BackhaulUse, NULL, BBFDM_BOTH}, -{"FronthaulUse", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioBSS_FronthaulUse, NULL, BBFDM_BOTH}, -{"R1disallowed", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioBSS_R1disallowed, NULL, BBFDM_BOTH}, -{"R2disallowed", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioBSS_R2disallowed, NULL, BBFDM_BOTH}, -{"MultiBSSID", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioBSS_MultiBSSID, NULL, BBFDM_BOTH}, -{"TransmittedBSSID", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioBSS_TransmittedBSSID, NULL, BBFDM_BOTH}, -// {"FronthaulAKMsAllowed", &DMWRITE, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioBSS_FronthaulAKMsAllowed, set_WiFiDataElementsNetworkDeviceRadioBSS_FronthaulAKMsAllowed, BBFDM_BOTH}, -// {"BackhaulAKMsAllowed", &DMWRITE, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioBSS_BackhaulAKMsAllowed, set_WiFiDataElementsNetworkDeviceRadioBSS_BackhaulAKMsAllowed, BBFDM_BOTH}, -{"STANumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSS_STANumberOfEntries, NULL, BBFDM_BOTH}, -// {"QMDescriptorNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSS_QMDescriptorNumberOfEntries, NULL, BBFDM_BOTH}, -//{"SetQMDescriptors()", &DMASYNC, DMT_COMMAND, get_operate_args_WiFiDataElementsNetworkDeviceRadioBSS_SetQMDescriptors, operate_WiFiDataElementsNetworkDeviceRadioBSS_SetQMDescriptors, BBFDM_USP}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.QMDescriptor.{i}. *** */ -// DMLEAF tWiFiDataElementsNetworkDeviceRadioBSSQMDescriptorParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -// {"ClientMAC", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioBSSQMDescriptor_ClientMAC, NULL, BBFDM_BOTH}, -// {"DescriptorElement", &DMREAD, DMT_HEXBIN, get_WiFiDataElementsNetworkDeviceRadioBSSQMDescriptor_DescriptorElement, NULL, BBFDM_BOTH}, -// {0} -//}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.MultiAPSteering. *** */ -DMLEAF tWiFiDataElementsNetworkDeviceRadioBSSMultiAPSteeringParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"BlacklistAttempts", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkDeviceRadioBSSMultiAPSteering_BlacklistAttempts, NULL, BBFDM_BOTH}, -{"BTMAttempts", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkDeviceRadioBSSMultiAPSteering_BTMAttempts, NULL, BBFDM_BOTH}, -{"BTMQueryResponses", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkDeviceRadioBSSMultiAPSteering_BTMQueryResponses, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}. *** */ -DMOBJ tWiFiDataElementsNetworkDeviceRadioBSSSTAObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/ -{"MultiAPSTA", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTAObj, tWiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTAParams, NULL, BBFDM_BOTH, NULL}, -//{"WiFi6Capabilities", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioBSSSTAWiFi6CapabilitiesParams, NULL, BBFDM_BOTH, NULL}, -//{"TIDQueueSizes", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceRadioBSSSTATIDQueueSizesInst, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioBSSSTATIDQueueSizesParams, NULL, BBFDM_BOTH, NULL}, -{0} -}; - -DMLEAF tWiFiDataElementsNetworkDeviceRadioBSSSTAParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"MACAddress", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_MACAddress, NULL, BBFDM_BOTH, DM_FLAG_UNIQUE}, -{"TimeStamp", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_TimeStamp, NULL, BBFDM_BOTH}, -{"HTCapabilities", &DMREAD, DMT_BASE64, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_HTCapabilities, NULL, BBFDM_BOTH}, -{"VHTCapabilities", &DMREAD, DMT_BASE64, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_VHTCapabilities, NULL, BBFDM_BOTH}, -{"HECapabilities", &DMREAD, DMT_BASE64, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_HECapabilities, NULL, BBFDM_BOTH}, -//{"ClientCapabilities", &DMREAD, DMT_BASE64, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_ClientCapabilities, NULL, BBFDM_BOTH}, -{"LastDataDownlinkRate", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_LastDataDownlinkRate, NULL, BBFDM_BOTH}, -{"LastDataUplinkRate", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_LastDataUplinkRate, NULL, BBFDM_BOTH}, -{"UtilizationReceive", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_UtilizationReceive, NULL, BBFDM_BOTH}, -{"UtilizationTransmit", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_UtilizationTransmit, NULL, BBFDM_BOTH}, -{"EstMACDataRateDownlink", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_EstMACDataRateDownlink, NULL, BBFDM_BOTH}, -{"EstMACDataRateUplink", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_EstMACDataRateUplink, NULL, BBFDM_BOTH}, -{"SignalStrength", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_SignalStrength, NULL, BBFDM_BOTH}, -{"LastConnectTime", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_LastConnectTime, NULL, BBFDM_BOTH}, -{"BytesSent", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_BytesSent, NULL, BBFDM_BOTH}, -{"BytesReceived", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_BytesReceived, NULL, BBFDM_BOTH}, -{"PacketsSent", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_PacketsSent, NULL, BBFDM_BOTH}, -{"PacketsReceived", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_PacketsReceived, NULL, BBFDM_BOTH}, -{"ErrorsSent", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_ErrorsSent, NULL, BBFDM_BOTH}, -{"ErrorsReceived", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_ErrorsReceived, NULL, BBFDM_BOTH}, -{"RetransCount", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_RetransCount, NULL, BBFDM_BOTH}, -{"MeasurementReport", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_MeasurementReport, NULL, BBFDM_BOTH}, -{"NumberOfMeasureReports", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_NumberOfMeasureReports, NULL, BBFDM_BOTH}, -{"IPV4Address", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_IPV4Address, NULL, BBFDM_BOTH}, -{"IPV6Address", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_IPV6Address, NULL, BBFDM_BOTH}, -{"Hostname", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_Hostname, NULL, BBFDM_BOTH}, -// {"CellularDataPreference", &DMWRITE, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_CellularDataPreference, set_WiFiDataElementsNetworkDeviceRadioBSSSTA_CellularDataPreference, BBFDM_BOTH}, -// {"ReAssociationDelay", &DMWRITE, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_ReAssociationDelay, set_WiFiDataElementsNetworkDeviceRadioBSSSTA_ReAssociationDelay, BBFDM_BOTH}, -{"TIDQueueSizesNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_TIDQueueSizesNumberOfEntries, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.MultiAPSTA. *** */ -DMOBJ tWiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTAObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/ -{"SteeringSummaryStats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringSummaryStatsParams, NULL, BBFDM_BOTH, NULL}, -{"SteeringHistory", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringHistoryInst, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringHistoryParams, NULL, BBFDM_BOTH, NULL}, -{0} -}; - -DMLEAF tWiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTAParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -//{"AssociationTime", &DMREAD, DMT_TIME, get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTA_AssociationTime, NULL, BBFDM_BOTH}, -//{"Noise", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTA_Noise, NULL, BBFDM_BOTH}, -{"SteeringHistoryNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTA_SteeringHistoryNumberOfEntries, NULL, BBFDM_BOTH}, -//{"Disassociate()", &DMASYNC, DMT_COMMAND, get_operate_args_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTA_Disassociate, operate_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTA_Disassociate, BBFDM_USP}, -{"BTMRequest()", &DMASYNC, DMT_COMMAND, get_operate_args_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTA_BTMRequest, operate_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTA_BTMRequest, BBFDM_USP}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.MultiAPSTA.SteeringSummaryStats. *** */ -DMLEAF tWiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringSummaryStatsParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"NoCandidateAPFailures", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringSummaryStats_NoCandidateAPFailures, NULL, BBFDM_BOTH}, -{"BlacklistAttempts", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringSummaryStats_BlacklistAttempts, NULL, BBFDM_BOTH}, -{"BlacklistSuccesses", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringSummaryStats_BlacklistSuccesses, NULL, BBFDM_BOTH}, -{"BlacklistFailures", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringSummaryStats_BlacklistFailures, NULL, BBFDM_BOTH}, -{"BTMAttempts", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringSummaryStats_BTMAttempts, NULL, BBFDM_BOTH}, -{"BTMSuccesses", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringSummaryStats_BTMSuccesses, NULL, BBFDM_BOTH}, -{"BTMFailures", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringSummaryStats_BTMFailures, NULL, BBFDM_BOTH}, -{"BTMQueryResponses", &DMREAD, DMT_UNLONG, get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringSummaryStats_BTMQueryResponses, NULL, BBFDM_BOTH}, -{"LastSteerTime", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringSummaryStats_LastSteerTime, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.MultiAPSTA.SteeringHistory.{i}. *** */ -DMLEAF tWiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringHistoryParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"Time", &DMREAD, DMT_TIME, get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringHistory_Time, NULL, BBFDM_BOTH}, -{"APOrigin", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringHistory_APOrigin, NULL, BBFDM_BOTH}, -{"TriggerEvent", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringHistory_TriggerEvent, NULL, BBFDM_BOTH}, -{"SteeringApproach", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringHistory_SteeringApproach, NULL, BBFDM_BOTH}, -{"APDestination", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringHistory_APDestination, NULL, BBFDM_BOTH}, -{"SteeringDuration", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringHistory_SteeringDuration, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.WiFi6Capabilities. *** */ -//DMLEAF tWiFiDataElementsNetworkDeviceRadioBSSSTAWiFi6CapabilitiesParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -//{"HE160", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioBSSSTAWiFi6Capabilities_HE160, NULL, BBFDM_BOTH}, -//{"HE8080", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioBSSSTAWiFi6Capabilities_HE8080, NULL, BBFDM_BOTH}, -//{"MCSNSS", &DMREAD, DMT_BASE64, get_WiFiDataElementsNetworkDeviceRadioBSSSTAWiFi6Capabilities_MCSNSS, NULL, BBFDM_BOTH}, -//{"SUBeamformer", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioBSSSTAWiFi6Capabilities_SUBeamformer, NULL, BBFDM_BOTH}, -//{"SUBeamformee", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioBSSSTAWiFi6Capabilities_SUBeamformee, NULL, BBFDM_BOTH}, -//{"MUBeamformer", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioBSSSTAWiFi6Capabilities_MUBeamformer, NULL, BBFDM_BOTH}, -//{"Beamformee80orLess", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioBSSSTAWiFi6Capabilities_Beamformee80orLess, NULL, BBFDM_BOTH}, -//{"BeamformeeAbove80", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioBSSSTAWiFi6Capabilities_BeamformeeAbove80, NULL, BBFDM_BOTH}, -//{"ULMUMIMO", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioBSSSTAWiFi6Capabilities_ULMUMIMO, NULL, BBFDM_BOTH}, -//{"ULOFDMA", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioBSSSTAWiFi6Capabilities_ULOFDMA, NULL, BBFDM_BOTH}, -//{"MaxDLMUMIMO", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSSSTAWiFi6Capabilities_MaxDLMUMIMO, NULL, BBFDM_BOTH}, -//{"MaxULMUMIMO", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSSSTAWiFi6Capabilities_MaxULMUMIMO, NULL, BBFDM_BOTH}, -//{"MaxDLOFDMA", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSSSTAWiFi6Capabilities_MaxDLOFDMA, NULL, BBFDM_BOTH}, -//{"MaxULOFDMA", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSSSTAWiFi6Capabilities_MaxULOFDMA, NULL, BBFDM_BOTH}, -//{"RTS", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioBSSSTAWiFi6Capabilities_RTS, NULL, BBFDM_BOTH}, -//{"MURTS", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioBSSSTAWiFi6Capabilities_MURTS, NULL, BBFDM_BOTH}, -//{"MultiBSSID", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioBSSSTAWiFi6Capabilities_MultiBSSID, NULL, BBFDM_BOTH}, -//{"MUEDCA", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioBSSSTAWiFi6Capabilities_MUEDCA, NULL, BBFDM_BOTH}, -//{"TWTRequestor", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioBSSSTAWiFi6Capabilities_TWTRequestor, NULL, BBFDM_BOTH}, -//{"TWTResponder", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioBSSSTAWiFi6Capabilities_TWTResponder, NULL, BBFDM_BOTH}, -//{"SpatialReuse", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioBSSSTAWiFi6Capabilities_SpatialReuse, NULL, BBFDM_BOTH}, -//{"AnticipatedChannelUsage", &DMREAD, DMT_BOOL, get_WiFiDataElementsNetworkDeviceRadioBSSSTAWiFi6Capabilities_AnticipatedChannelUsage, NULL, BBFDM_BOTH}, -//{0} -//}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.TIDQueueSizes.{i}. *** */ -//DMLEAF tWiFiDataElementsNetworkDeviceRadioBSSSTATIDQueueSizesParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -//{"TID", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSSSTATIDQueueSizes_TID, NULL, BBFDM_BOTH}, -//{"Size", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSSSTATIDQueueSizes_Size, NULL, BBFDM_BOTH}, -//{0} -//}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.UnassociatedSTA.{i}. *** */ -DMLEAF tWiFiDataElementsNetworkDeviceRadioUnassociatedSTAParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"MACAddress", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioUnassociatedSTA_MACAddress, NULL, BBFDM_BOTH, DM_FLAG_UNIQUE}, -{"SignalStrength", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioUnassociatedSTA_SignalStrength, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.MultiAPRadio. *** */ -//DMLEAF tWiFiDataElementsNetworkDeviceRadioMultiAPRadioParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -//{"RadarDetections", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioMultiAPRadio_RadarDetections, NULL, BBFDM_BOTH}, -//{"FullScan()", &DMASYNC, DMT_COMMAND, get_operate_args_WiFiDataElementsNetworkDeviceRadioMultiAPRadio_FullScan, operate_WiFiDataElementsNetworkDeviceRadioMultiAPRadio_FullScan, BBFDM_USP}, -//{"ChannelScan()", &DMASYNC, DMT_COMMAND, get_operate_args_WiFiDataElementsNetworkDeviceRadioMultiAPRadio_ChannelScan, operate_WiFiDataElementsNetworkDeviceRadioMultiAPRadio_ChannelScan, BBFDM_USP}, -//{0} -//}; - -/* *** Device.WiFi.DataElements.AssociationEvent. *** */ -DMLEAF tWiFiDataElementsAssociationEventParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"Associated!", &DMREAD, DMT_EVENT, get_event_args_WiFiDataElementsAssociationEvent_Associated, event_WiFiDataElementsAssociationEvent_Associated, BBFDM_USP}, -{0} -}; - -/* *** Device.WiFi.DataElements.DisassociationEvent. *** */ -DMLEAF tWiFiDataElementsDisassociationEventParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -{"Disassociated!", &DMREAD, DMT_EVENT, get_event_args_WiFiDataElementsDisassociationEvent_Disassociated, event_WiFiDataElementsDisassociationEvent_Disassociated, BBFDM_USP}, -{0} -}; - -/* *** Device.WiFi.DataElements.FailedConnectionEvent. *** */ -//DMLEAF tWiFiDataElementsFailedConnectionEventParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/ -//{"FailedConnection!", &DMREAD, DMT_EVENT, get_event_args_WiFiDataElementsFailedConnectionEvent_FailedConnection, NULL, BBFDM_USP}, -//{0} -//}; diff --git a/libbbfdm/dmtree/tr181/wifi.dataelements.h b/libbbfdm/dmtree/tr181/wifi.dataelements.h deleted file mode 100644 index 7d865134..00000000 --- a/libbbfdm/dmtree/tr181/wifi.dataelements.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2023 IOPSYS Software Solutions AB - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 2.1 - * as published by the Free Software Foundation - * - * Author: Amin Ben Romdhane - * - */ - -#ifndef __WIFI_DATAELEMENTS_H -#define __WIFI_DATAELEMENTS_H - -#include "libbbfdm-api/dmcommon.h" - -extern DMOBJ tWiFiDataElementsObj[]; -extern DMOBJ tWiFiDataElementsNetworkObj[]; -extern DMLEAF tWiFiDataElementsNetworkParams[]; -extern DMLEAF tWiFiDataElementsNetworkSSIDParams[]; -extern DMLEAF tWiFiDataElementsNetworkMultiAPSteeringSummaryStatsParams[]; -extern DMOBJ tWiFiDataElementsNetworkDeviceObj[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceParams[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceDefault8021QParams[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceSSIDtoVIDMappingParams[]; -extern DMOBJ tWiFiDataElementsNetworkDeviceCACStatusObj[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceCACStatusParams[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceCACStatusCACAvailableChannelParams[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceCACStatusCACNonOccupancyChannelParams[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceCACStatusCACActiveChannelParams[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceSPRuleParams[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceIEEE1905SecurityParams[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceAnticipatedChannelsParams[]; -extern DMOBJ tWiFiDataElementsNetworkDeviceAnticipatedChannelUsageObj[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceAnticipatedChannelUsageParams[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceAnticipatedChannelUsageEntryParams[]; -extern DMOBJ tWiFiDataElementsNetworkDeviceMultiAPDeviceObj[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceMultiAPDeviceParams[]; -extern DMOBJ tWiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulObj[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulParams[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulCurrentOperatingClassProfileParams[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulStatsParams[]; -extern DMOBJ tWiFiDataElementsNetworkDeviceRadioObj[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceRadioParams[]; -extern DMOBJ tWiFiDataElementsNetworkDeviceRadioScanResultObj[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceRadioScanResultParams[]; -extern DMOBJ tWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanObj[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanParams[]; -extern DMOBJ tWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanObj[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanParams[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSSParams[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceRadioBackhaulStaParams[]; -extern DMOBJ tWiFiDataElementsNetworkDeviceRadioScanCapabilityObj[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceRadioScanCapabilityParams[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceRadioScanCapabilityOpClassChannelsParams[]; -extern DMOBJ tWiFiDataElementsNetworkDeviceRadioCACCapabilityObj[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceRadioCACCapabilityParams[]; -extern DMOBJ tWiFiDataElementsNetworkDeviceRadioCACCapabilityCACMethodObj[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceRadioCACCapabilityCACMethodParams[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceRadioCACCapabilityCACMethodOpClassChannelsParams[]; -extern DMOBJ tWiFiDataElementsNetworkDeviceRadioCapabilitiesObj[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceRadioCapabilitiesParams[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRoleParams[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARoleParams[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceRadioCapabilitiesAKMFrontHaulParams[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceRadioCapabilitiesAKMBackhaulParams[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfileParams[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfileParams[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceRadioDisAllowedOpClassChannelsParams[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceRadioSpatialReuseParams[]; -extern DMOBJ tWiFiDataElementsNetworkDeviceRadioBSSObj[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceRadioBSSParams[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceRadioBSSQMDescriptorParams[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceRadioBSSMultiAPSteeringParams[]; -extern DMOBJ tWiFiDataElementsNetworkDeviceRadioBSSSTAObj[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceRadioBSSSTAParams[]; -extern DMOBJ tWiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTAObj[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTAParams[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringSummaryStatsParams[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringHistoryParams[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceRadioBSSSTAWiFi6CapabilitiesParams[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceRadioBSSSTATIDQueueSizesParams[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceRadioUnassociatedSTAParams[]; -extern DMLEAF tWiFiDataElementsNetworkDeviceRadioMultiAPRadioParams[]; -extern DMLEAF tWiFiDataElementsAssociationEventParams[]; -extern DMLEAF tWiFiDataElementsDisassociationEventParams[]; -extern DMLEAF tWiFiDataElementsFailedConnectionEventParams[]; - -#endif //__WIFI_DATAELEMENTS_H diff --git a/libbbfdm/dmtree/tr181/wifi.h b/libbbfdm/dmtree/tr181/wifi.h deleted file mode 100644 index dec054e9..00000000 --- a/libbbfdm/dmtree/tr181/wifi.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2023 IOPSYS Software Solutions AB - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 2.1 - * as published by the Free Software Foundation - * - * Author: Anis Ellouze - * Author: Amin Ben Ramdhane - * - */ - -#ifndef __WIFI_H -#define __WIFI_H - -#include "libbbfdm-api/dmcommon.h" - -extern DMOBJ tWiFiObj[]; -extern DMLEAF tWiFiParams[]; -extern DMOBJ tWiFiRadioObj[]; -extern DMOBJ tWiFiAccessPointObj[]; -extern DMOBJ tWiFiSSIDObj[]; -extern DMLEAF tWiFiAccessPointParams[]; -extern DMLEAF tWiFiSSIDParams[]; -extern DMLEAF tWiFiRadioParams[]; -extern DMLEAF tWiFiAccessPointSecurityParams[]; -extern DMLEAF tWiFiAccessPointAssociatedDeviceParams[]; -extern DMOBJ tWiFiAccessPointAssociatedDeviceObj[]; -extern DMLEAF tWiFiAccessPointAssociatedDeviceStatsParams[]; -extern DMLEAF tWiFiRadioStatsParams[]; -extern DMLEAF tWiFiSSIDStatsParams[]; -extern DMOBJ tWiFiNeighboringWiFiDiagnosticObj[]; -extern DMLEAF tWiFiNeighboringWiFiDiagnosticParams[]; -extern DMLEAF tWiFiNeighboringWiFiDiagnosticResultParams[]; -extern DMLEAF tWiFiAccessPointWPSParams[]; -extern DMLEAF tWiFiAccessPointAccountingParams[]; -extern DMOBJ tWiFiEndPointObj[]; -extern DMLEAF tWiFiEndPointParams[]; -extern DMLEAF tWiFiEndPointSecurityParams[]; -extern DMLEAF tWiFiEndPointWPSParams[]; -extern DMOBJ tWiFiEndPointProfileObj[]; -extern DMLEAF tWiFiEndPointProfileParams[]; -extern DMLEAF tWiFiEndPointProfileSecurityParams[]; -extern DMLEAF tWiFiEndPointStatsParams[]; - -#endif diff --git a/test/cmocka/functional_test_bbfd.c b/test/cmocka/functional_test_bbfd.c index 6838d410..fba9527d 100644 --- a/test/cmocka/functional_test_bbfd.c +++ b/test/cmocka/functional_test_bbfd.c @@ -112,44 +112,44 @@ static void test_api_bbfdm_get_set_json_parameter(void **state) int fault = 0; // get value ==> expected "0" error - ctx->in_param = "Device.WiFi.X_IOPSYS_EU_Radio.1.Noise"; + ctx->in_param = "Device.X_IOPSYS_EU_WiFi.Radio.1.Noise"; fault = bbf_entry_method(ctx, BBF_GET_VALUE); assert_int_equal(fault, 0); // validate parameter : name, type, value - validate_parameter(ctx, "Device.WiFi.X_IOPSYS_EU_Radio.1.Noise", "-87", "xsd:int"); + validate_parameter(ctx, "Device.X_IOPSYS_EU_WiFi.Radio.1.Noise", "-87", "xsd:int"); // get value ==> expected "0" error - ctx->in_param = "Device.WiFi.X_IOPSYS_EU_Radio.2.Noise"; + ctx->in_param = "Device.X_IOPSYS_EU_WiFi.Radio.2.Noise"; fault = bbf_entry_method(ctx, BBF_GET_VALUE); assert_int_equal(fault, 0); // validate parameter : name, type, value - validate_parameter(ctx, "Device.WiFi.X_IOPSYS_EU_Radio.2.Noise", "-85", "xsd:int"); + validate_parameter(ctx, "Device.X_IOPSYS_EU_WiFi.Radio.2.Noise", "-85", "xsd:int"); // get value ==> expected "0" error - ctx->in_param = "Device.WiFi.X_IOPSYS_EU_Radio.2.Band"; + ctx->in_param = "Device.X_IOPSYS_EU_WiFi.Radio.2.Band"; fault = bbf_entry_method(ctx, BBF_GET_VALUE); assert_int_equal(fault, 0); // validate parameter : name, type, value - validate_parameter(ctx, "Device.WiFi.X_IOPSYS_EU_Radio.2.Band", "2.4GHz", "xsd:string"); + validate_parameter(ctx, "Device.X_IOPSYS_EU_WiFi.Radio.2.Band", "2.4GHz", "xsd:string"); // get value ==> expected "0" error - ctx->in_param = "Device.WiFi.X_IOPSYS_EU_Radio.1.Stats.BytesSent"; + ctx->in_param = "Device.X_IOPSYS_EU_WiFi.Radio.1.Stats.BytesSent"; fault = bbf_entry_method(ctx, BBF_GET_VALUE); assert_int_equal(fault, 0); // validate parameter : name, type, value - validate_parameter(ctx, "Device.WiFi.X_IOPSYS_EU_Radio.1.Stats.BytesSent", "14418177", "xsd:unsignedInt"); + validate_parameter(ctx, "Device.X_IOPSYS_EU_WiFi.Radio.1.Stats.BytesSent", "14418177", "xsd:unsignedInt"); // get value ==> expected "0" error - ctx->in_param = "Device.WiFi.X_IOPSYS_EU_Radio.2.Stats.BytesSent"; + ctx->in_param = "Device.X_IOPSYS_EU_WiFi.Radio.2.Stats.BytesSent"; fault = bbf_entry_method(ctx, BBF_GET_VALUE); assert_int_equal(fault, 0); // validate parameter : name, type, value - validate_parameter(ctx, "Device.WiFi.X_IOPSYS_EU_Radio.2.Stats.BytesSent", "14417451", "xsd:unsignedInt"); + validate_parameter(ctx, "Device.X_IOPSYS_EU_WiFi.Radio.2.Stats.BytesSent", "14417451", "xsd:unsignedInt"); } static void test_api_bbfdm_get_set_json_v1_parameter(void **state) diff --git a/test/files/usr/share/bbfdm/plugins/X_IOPSYS_EU_WiFi.json b/test/files/usr/share/bbfdm/plugins/X_IOPSYS_EU_WiFi.json index 093c552b..40a85d29 100644 --- a/test/files/usr/share/bbfdm/plugins/X_IOPSYS_EU_WiFi.json +++ b/test/files/usr/share/bbfdm/plugins/X_IOPSYS_EU_WiFi.json @@ -1,6 +1,6 @@ { "json_plugin_version": 2, - "Device.WiFi.": { + "Device.{BBF_VENDOR_PREFIX}WiFi.": { "type": "object", "protocols": [ "cwmp", @@ -28,7 +28,7 @@ } ] }, - "Device.WiFi.{BBF_VENDOR_PREFIX}Radio.{i}.": { + "Device.{BBF_VENDOR_PREFIX}WiFi.Radio.{i}.": { "type": "object", "protocols": [ "cwmp", @@ -79,7 +79,7 @@ } ] }, - "Device.WiFi.{BBF_VENDOR_PREFIX}Radio.{i}.Stats.": { + "Device.{BBF_VENDOR_PREFIX}WiFi.Radio.{i}.Stats.": { "type": "object", "protocols": [ "cwmp", diff --git a/test/wifi_dataelements/Makefile b/test/wifi_dataelements/Makefile deleted file mode 100644 index 8f140f8c..00000000 --- a/test/wifi_dataelements/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -LIB_WIFI_DATAELEMENTS = libwifi_dataelements.so - -LIB_WIFI_DATAELEMENTS_OBJS = wifi_dataelements.o ../../libbbfdm/dmtree/tr181/wifi.dataelements.o -LIB_CFLAGS = $(CFLAGS) -Wall -Werror -fPIC -I /usr/local/include/ -LIB_LDFLAGS = $(LDFLAGS) -lbbfdm-api - -%.o: %.c - $(CC) $(LIB_CFLAGS) $(FPIC) -c -o $@ $< - -all: $(LIB_WIFI_DATAELEMENTS) - -$(LIB_WIFI_DATAELEMENTS): $(LIB_WIFI_DATAELEMENTS_OBJS) - $(CC) $(LIB_CFLAGS) $(LIB_LDFLAGS) -shared -o $@ $^ - -clean: - rm -fv *.o $(LIB_WIFI_DATAELEMENTS) diff --git a/test/wifi_dataelements/wifi_dataelements.c b/test/wifi_dataelements/wifi_dataelements.c deleted file mode 100644 index d7a2561c..00000000 --- a/test/wifi_dataelements/wifi_dataelements.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2023 iopsys Software Solutions AB - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 2.1 - * as published by the Free Software Foundation - * - * Author: Amin Ben Romdhane - */ - -#include "../../libbbfdm/dmtree/tr181/wifi.dataelements.h" - -/* *** Device.WiFi. *** */ -DMOBJ tDeviceWiFiObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/ -{"DataElements", &DMREAD, NULL, NULL, "file:/etc/init.d/decollector", NULL, NULL, NULL, tWiFiDataElementsObj, NULL, NULL, BBFDM_BOTH, NULL}, -{0} -}; - -/* ********** DynamicObj ********** */ -DM_MAP_OBJ tDynamicObj[] = { -/* parentobj, nextobject, parameter */ -{"Device.WiFi.", tDeviceWiFiObj, NULL}, -{0} -}; diff --git a/test/wifi_dataelements/wifi_dataelements.json b/test/wifi_dataelements/wifi_dataelements.json deleted file mode 100755 index 47dd88a0..00000000 --- a/test/wifi_dataelements/wifi_dataelements.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "daemon": { - "input": { - "type": "DotSo", - "name": "/tmp/libwifi_dataelements.so" - }, - "output": { - "type": "UBUS", - "parent_dm": "Device.WiFi.", - "object": "DataElements", - "root_obj": "bbfdm" - } - } -} diff --git a/tools/bbf_common.py b/tools/bbf_common.py index 75d9430c..b8b56856 100755 --- a/tools/bbf_common.py +++ b/tools/bbf_common.py @@ -337,6 +337,8 @@ def download_and_build_plugins(plugins, vendor_prefix): print("Generating data models from defined plugins...") + remove_folder(".repo") + for plugin_index, plugin in enumerate(plugins): repo = get_option_value(plugin, "repo") @@ -415,7 +417,6 @@ def generate_supported_dm(vendor_prefix=None, vendor_list=None, plugins=None): build_and_install_bbfdm(vendor_prefix, vendor_list) # Download && Build Plugins Data Models - remove_folder(".repo") download_and_build_plugins(plugins, vendor_prefix) # Fill the list supported data model diff --git a/tools/tools_input.json b/tools/tools_input.json index ea1e7ab3..f8d3fdc1 100644 --- a/tools/tools_input.json +++ b/tools/tools_input.json @@ -130,6 +130,14 @@ "src/times.c" ] }, + { + "repo": "https://dev.iopsys.eu/bbf/timemngr.git", + "proto": "git", + "version": "devel", + "dm_files": [ + "src/vendor.c" + ] + }, { "repo": "https://dev.iopsys.eu/feed/openwrt-packages.git", "proto": "git", @@ -239,13 +247,13 @@ "src/datamodel.c" ] }, - { + { "repo": "https://dev.iopsys.eu/network/bridgemngr.git", "proto": "git", "version": "devel", "dm_files": [ - "src/common.c", - "src/bridging.c" + "src/bridging.c", + "src/common.c" ] }, { @@ -253,8 +261,8 @@ "proto": "git", "version": "devel", "dm_files": [ - "src/common.c", - "src/vendor.c" + "src/vendor.c", + "src/common.c" ] }, { @@ -288,6 +296,25 @@ "dm_files": [ "src/packetcapture.c" ] + }, + { + "repo": "https://dev.iopsys.eu/bbf/wifidmd.git", + "proto": "git", + "version": "devel", + "dm_files": [ + "src/wifi.c" + ], + "extra_dependencies": [ + "-lm" + ] + }, + { + "repo": "https://dev.iopsys.eu/bbf/wifidmd.git", + "proto": "git", + "version": "devel", + "dm_files": [ + "src/dataelements.c" + ] } ], "output": {