From 5e97bdb5e4767854ad5fe14f8e29c73d684c726a Mon Sep 17 00:00:00 2001 From: Amin Ben Ramdhane Date: Thu, 25 Mar 2021 15:43:47 +0100 Subject: [PATCH] bbf: add support for vendor extension --- README | 16 +- README.md | 10 +- bin/Makefile.am | 62 +- configure.ac | 20 +- dmentryjson.c => dmdynamicjson.c | 150 +- dmentryjson.h => dmdynamicjson.h | 0 dmdynamiclibrary.c | 170 + dmentrylibrary.h => dmdynamiclibrary.h | 4 +- dmdynamicvendor.c | 300 ++ dmdynamicvendor.h | 20 + dmentry.c | 42 +- dmentry.h | 8 +- dmentrylibrary.c | 128 - dmoperate.c | 6 +- dmtree/tr104/servicesvoiceservice.c | 22 +- .../tr104/servicesvoiceservicecallcontrol.c | 20 +- .../tr104/servicesvoiceservicecapabilities.c | 10 +- dmtree/tr104/servicesvoiceservicepots.c | 8 +- dmtree/tr104/servicesvoiceservicesip.c | 14 +- .../tr104/servicesvoiceservicevoipprofile.c | 10 +- dmtree/tr143/diagnostics.c | 48 +- dmtree/tr181/atm.c | 8 +- dmtree/tr181/bridging.c | 70 +- dmtree/tr181/bridging.h | 3 + dmtree/tr181/device.c | 84 +- dmtree/tr181/deviceinfo-iopsyswrt.c | 216 -- dmtree/tr181/deviceinfo-openwrt.c | 140 - dmtree/tr181/deviceinfo.c | 230 +- dmtree/tr181/dhcpv4.c | 41 +- dmtree/tr181/dhcpv6.c | 32 +- dmtree/tr181/dns.c | 24 +- dmtree/tr181/dsl.c | 38 +- dmtree/tr181/dynamicdns.c | 10 +- dmtree/tr181/ethernet.c | 149 +- dmtree/tr181/ethernet.h | 3 +- dmtree/tr181/fast.c | 20 +- dmtree/tr181/firewall.c | 165 +- dmtree/tr181/firewall.h | 2 - dmtree/tr181/gre.c | 16 +- dmtree/tr181/hosts-iopsyswrt.c | 250 -- dmtree/tr181/hosts-openwrt.c | 131 - dmtree/tr181/hosts.c | 290 +- dmtree/tr181/ieee1905.c | 107 +- dmtree/tr181/ieee1905.h | 1 - dmtree/tr181/ip.c | 76 +- dmtree/tr181/nat.c | 10 +- dmtree/tr181/os.h | 397 --- dmtree/tr181/ppp.c | 14 +- dmtree/tr181/ptm.c | 8 +- dmtree/tr181/qos-iopsyswrt.c | 1921 ----------- dmtree/tr181/qos-openwrt.c | 1465 -------- dmtree/tr181/qos.c | 2113 +++++++++++- dmtree/tr181/routing.c | 16 +- dmtree/tr181/security.c | 4 +- dmtree/tr181/softwaremodules.c | 12 +- dmtree/tr181/times.c | 39 - dmtree/tr181/upnp.c | 36 +- dmtree/tr181/usb.c | 28 +- dmtree/tr181/users.c | 4 +- dmtree/tr181/wifi-iopsyswrt.c | 1929 ----------- dmtree/tr181/wifi-openwrt.c | 987 ------ dmtree/tr181/wifi.c | 3018 +++++++++++++---- dmtree/tr181/x_iopsys_eu_buttons.c | 167 - dmtree/tr181/x_iopsys_eu_buttons.h | 22 - dmtree/tr181/x_iopsys_eu_owsd.c | 483 --- dmtree/tr181/x_iopsys_eu_owsd.h | 23 - dmtree/tr181/x_iopsys_eu_syslog.c | 76 - dmtree/vendor/iopsys/tr181/bridging.c | 65 + dmtree/vendor/iopsys/tr181/bridging.h | 19 + dmtree/vendor/iopsys/tr181/device.c | 21 + dmtree/vendor/iopsys/tr181/device.h | 19 + dmtree/vendor/iopsys/tr181/deviceinfo.c | 27 + dmtree/vendor/iopsys/tr181/deviceinfo.h | 19 + dmtree/vendor/iopsys/tr181/ethernet.c | 124 + dmtree/vendor/iopsys/tr181/ethernet.h | 19 + dmtree/vendor/iopsys/tr181/ieee1905.c | 75 + dmtree/vendor/iopsys/tr181/ieee1905.h | 21 + dmtree/vendor/iopsys/tr181/times.c | 60 + dmtree/vendor/iopsys/tr181/times.h | 19 + dmtree/vendor/iopsys/tr181/vendor.c | 30 + dmtree/vendor/iopsys/tr181/vendor.h | 19 + .../iopsys}/tr181/x_iopsys_eu_igmp.c | 54 +- .../iopsys}/tr181/x_iopsys_eu_igmp.h | 7 +- .../iopsys}/tr181/x_iopsys_eu_mld.c | 30 +- .../iopsys}/tr181/x_iopsys_eu_mld.h | 7 +- dmtree/vendor/openwrt/tr181/deviceinfo.c | 95 + dmtree/vendor/openwrt/tr181/deviceinfo.h | 8 + dmtree/vendor/openwrt/tr181/qos.c | 564 +++ dmtree/vendor/openwrt/tr181/qos.h | 23 + dmtree/vendor/openwrt/tr181/vendor.c | 91 + dmtree/vendor/openwrt/tr181/vendor.h | 20 + dmtree/vendor/test/tr181/device.c | 19 + .../test/tr181/device.h} | 12 +- dmtree/vendor/test/tr181/deviceinfo.c | 25 + dmtree/vendor/test/tr181/deviceinfo.h | 8 + dmtree/vendor/test/tr181/firewall.c | 197 ++ dmtree/vendor/test/tr181/firewall.h | 22 + dmtree/vendor/test/tr181/vendor.c | 41 + dmtree/vendor/test/tr181/vendor.h | 21 + .../test/tr181/x_test_com_dropbear.c} | 623 ++-- .../test/tr181/x_test_com_dropbear.h} | 12 +- dmtree/vendor/vendor.c | 70 + dmtree/vendor/vendor.h | 21 + dynamic_parameters/json/example.json | 298 -- dynamic_parameters/library/example.json | 54 - dynamic_parameters/library/example/Makefile | 21 - dynamic_parameters/library/example/example.c | 151 - dynamic_parameters/library/example/example.h | 19 - .../library/generate_library.py | 579 ---- json/X_IOPSYS_EU_Buttons.json | 213 -- json/X_IOPSYS_EU_Dropbear.json | 333 -- json/X_IOPSYS_EU_OWSD.json | 417 --- json/X_IOPSYS_EU_Syslog.json | 79 - json/generate_excel.py | 3 +- json/generate_source_code.py | 6 +- json/tr181.json | 165 - libbbf_api/dmbbf.c | 124 +- libbbf_api/dmbbf.h | 41 +- libbbf_api/dmcommon.c | 4 +- libbbf_api/dmcommon.h | 2 + libbbf_api/dmjson.c | 13 - libbbf_api/dmjson.h | 1 - openwrt/bbf/Config_bbfdm.in | 20 +- openwrt/bbf/Makefile | 16 +- scripts/{functions => }/download_launch | 0 scripts/{functions => }/ipping_launch | 0 scripts/{functions => }/nslookup_launch | 0 .../{functions => }/serverselection_launch | 0 scripts/{functions => }/traceroute_launch | 0 scripts/{functions => }/udpecho_launch | 0 scripts/{functions => }/upload_launch | 0 tools/generate_xml.sh | 2 +- tools/generate_xml_bbf.sh | 2 +- 133 files changed, 8216 insertions(+), 12800 deletions(-) rename dmentryjson.c => dmdynamicjson.c (86%) rename dmentryjson.h => dmdynamicjson.h (100%) create mode 100644 dmdynamiclibrary.c rename dmentrylibrary.h => dmdynamiclibrary.h (82%) create mode 100644 dmdynamicvendor.c create mode 100644 dmdynamicvendor.h delete mode 100644 dmentrylibrary.c delete mode 100644 dmtree/tr181/deviceinfo-iopsyswrt.c delete mode 100644 dmtree/tr181/deviceinfo-openwrt.c delete mode 100644 dmtree/tr181/hosts-iopsyswrt.c delete mode 100644 dmtree/tr181/hosts-openwrt.c delete mode 100644 dmtree/tr181/os.h delete mode 100644 dmtree/tr181/qos-iopsyswrt.c delete mode 100644 dmtree/tr181/qos-openwrt.c delete mode 100644 dmtree/tr181/wifi-iopsyswrt.c delete mode 100644 dmtree/tr181/wifi-openwrt.c delete mode 100644 dmtree/tr181/x_iopsys_eu_buttons.c delete mode 100644 dmtree/tr181/x_iopsys_eu_buttons.h delete mode 100644 dmtree/tr181/x_iopsys_eu_owsd.c delete mode 100644 dmtree/tr181/x_iopsys_eu_owsd.h delete mode 100644 dmtree/tr181/x_iopsys_eu_syslog.c create mode 100644 dmtree/vendor/iopsys/tr181/bridging.c create mode 100644 dmtree/vendor/iopsys/tr181/bridging.h create mode 100644 dmtree/vendor/iopsys/tr181/device.c create mode 100644 dmtree/vendor/iopsys/tr181/device.h create mode 100644 dmtree/vendor/iopsys/tr181/deviceinfo.c create mode 100644 dmtree/vendor/iopsys/tr181/deviceinfo.h create mode 100644 dmtree/vendor/iopsys/tr181/ethernet.c create mode 100644 dmtree/vendor/iopsys/tr181/ethernet.h create mode 100644 dmtree/vendor/iopsys/tr181/ieee1905.c create mode 100644 dmtree/vendor/iopsys/tr181/ieee1905.h create mode 100644 dmtree/vendor/iopsys/tr181/times.c create mode 100644 dmtree/vendor/iopsys/tr181/times.h create mode 100644 dmtree/vendor/iopsys/tr181/vendor.c create mode 100644 dmtree/vendor/iopsys/tr181/vendor.h rename dmtree/{ => vendor/iopsys}/tr181/x_iopsys_eu_igmp.c (96%) rename dmtree/{ => vendor/iopsys}/tr181/x_iopsys_eu_igmp.h (97%) rename dmtree/{ => vendor/iopsys}/tr181/x_iopsys_eu_mld.c (94%) rename dmtree/{ => vendor/iopsys}/tr181/x_iopsys_eu_mld.h (93%) create mode 100644 dmtree/vendor/openwrt/tr181/deviceinfo.c create mode 100644 dmtree/vendor/openwrt/tr181/deviceinfo.h create mode 100644 dmtree/vendor/openwrt/tr181/qos.c create mode 100644 dmtree/vendor/openwrt/tr181/qos.h create mode 100644 dmtree/vendor/openwrt/tr181/vendor.c create mode 100644 dmtree/vendor/openwrt/tr181/vendor.h create mode 100644 dmtree/vendor/test/tr181/device.c rename dmtree/{tr181/x_iopsys_eu_syslog.h => vendor/test/tr181/device.h} (52%) create mode 100644 dmtree/vendor/test/tr181/deviceinfo.c create mode 100644 dmtree/vendor/test/tr181/deviceinfo.h create mode 100644 dmtree/vendor/test/tr181/firewall.c create mode 100644 dmtree/vendor/test/tr181/firewall.h create mode 100644 dmtree/vendor/test/tr181/vendor.c create mode 100644 dmtree/vendor/test/tr181/vendor.h rename dmtree/{tr181/x_iopsys_eu_dropbear.c => vendor/test/tr181/x_test_com_dropbear.c} (61%) rename dmtree/{tr181/x_iopsys_eu_dropbear.h => vendor/test/tr181/x_test_com_dropbear.h} (64%) create mode 100644 dmtree/vendor/vendor.c create mode 100644 dmtree/vendor/vendor.h delete mode 100644 dynamic_parameters/json/example.json delete mode 100644 dynamic_parameters/library/example.json delete mode 100644 dynamic_parameters/library/example/Makefile delete mode 100644 dynamic_parameters/library/example/example.c delete mode 100644 dynamic_parameters/library/example/example.h delete mode 100755 dynamic_parameters/library/generate_library.py delete mode 100644 json/X_IOPSYS_EU_Buttons.json delete mode 100644 json/X_IOPSYS_EU_Dropbear.json delete mode 100644 json/X_IOPSYS_EU_OWSD.json delete mode 100644 json/X_IOPSYS_EU_Syslog.json rename scripts/{functions => }/download_launch (100%) rename scripts/{functions => }/ipping_launch (100%) rename scripts/{functions => }/nslookup_launch (100%) rename scripts/{functions => }/serverselection_launch (100%) rename scripts/{functions => }/traceroute_launch (100%) rename scripts/{functions => }/udpecho_launch (100%) rename scripts/{functions => }/upload_launch (100%) diff --git a/README b/README index 03b141d5..08a099ce 100644 --- a/README +++ b/README @@ -2,11 +2,11 @@ BBF Compilation =================== autoreconf -i -./configure CC="gcc-9" --enable-tr181 --enable-tr104 --enable-tr143 --enable-libopenssl CPPFLAGS=-DCUSTOM_PREFIX=\\\"X_IOPSYS_EU_\\\" -make -cp bin/.libs/libbbfdm.so* /usr/lib/ -cp bin/.libs/libbbf_api.so* /usr/lib/ -mkdir /usr/include/libbbfdm -mkdir /usr/include/libbbf_api -cp *.h /usr/include/libbbfdm/ -cp libbbf_api/*.h /usr/include/libbbf_api/ +./configure CC="gcc-9" --enable-tr181 --enable-tr104 --enable-tr143 --enable-libopenssl --enable-vendor-extension BBF_VENDOR_LIST="iopsys" +make CPPFLAGS=-DBBF_VENDOR_LIST=\\\"iopsys\\\" CPPFLAGS+=-DBBF_VENDOR_PREFIX=\\\"X_IOPSYS_EU_\\\" +make install +ldconfig + +mkdir -p /etc/bbfdm/ +mkdir -p /etc/bbfdm/json +mkdir -p /usr/lib/bbfdm diff --git a/README.md b/README.md index 03021537..04c7868a 100644 --- a/README.md +++ b/README.md @@ -491,22 +491,22 @@ The application should bring its plugin(library) file under **'/usr/lib/bbfdm/'* To build a new library, you can use **example source code** under **dynamic_parameters/library** folder to help you build it. -Each library should contains two Root table named **“tRootDynamicObj”** and **“tRootDynamicOperate”** to define the parant path for each new object and operate. +Each library should contains two Root table named **“tDynamicObj”** and **“tDynamicOperate”** to define the parant path for each new object and operate. -#### RootDynamicObject definition #### +#### DynamicObject definition #### ![object](/pictures/rootdynamicobj.png) -Each object in the **LIB_MAP_OBJ** table contains two arguments: +Each object in the **DM_MAP_OBJ** table contains two arguments: | Argument | Description | | ------------------- | --------------------------------------------------------------------------------------------------------------------------- | | `parentobj` | A string of the parent object name. Example “Device.IP.Diagnostics.”, “Device.DeviceInfo”, “Device.WiFi.Radio.” | | `nextobject` | Pointer to a **DMOBJ** array which contains a list of the child objects. | -#### RootDynamicOperate definition #### +#### DynamicOperate definition #### ![object](/pictures/rootdynamincoperate.png) -Each operate in the **LIB_MAP_OPERATE** table contains two arguments: +Each operate in the **DM_MAP_OPERATE** table contains two arguments: | Argument | Description | | ------------------- | --------------------------------------------------------------------------------------------------------------------------- | diff --git a/bin/Makefile.am b/bin/Makefile.am index e859b052..b2779893 100644 --- a/bin/Makefile.am +++ b/bin/Makefile.am @@ -33,8 +33,8 @@ lib_LTLIBRARIES += libbbfdm.la libbbfdm_la_SOURCES = \ ../dmentry.c \ - ../dmentrylibrary.c \ - ../dmentryjson.c \ + ../dmdynamiclibrary.c \ + ../dmdynamicjson.c \ ../dmmemjson.c \ ../dmoperate.c \ ../dmdiagnostics.c \ @@ -47,12 +47,6 @@ libbbfdm_la_SOURCES += \ ../dmtree/tr181/managementserver.c \ ../dmtree/tr181/times.c \ ../dmtree/tr181/upnp.c \ - ../dmtree/tr181/x_iopsys_eu_igmp.c \ - ../dmtree/tr181/x_iopsys_eu_mld.c \ - ../dmtree/tr181/x_iopsys_eu_syslog.c \ - ../dmtree/tr181/x_iopsys_eu_dropbear.c \ - ../dmtree/tr181/x_iopsys_eu_owsd.c \ - ../dmtree/tr181/x_iopsys_eu_buttons.c \ ../dmtree/tr181/wifi.c \ ../dmtree/tr181/ethernet.c \ ../dmtree/tr181/atm.c \ @@ -83,20 +77,6 @@ libbbfdm_la_SOURCES += \ endif -if GENERIC_OPENWRT -libbbfdm_la_SOURCES += \ - ../dmtree/tr181/deviceinfo-openwrt.c \ - ../dmtree/tr181/wifi-openwrt.c \ - ../dmtree/tr181/hosts-openwrt.c \ - ../dmtree/tr181/qos-openwrt.c -else -libbbfdm_la_SOURCES += \ - ../dmtree/tr181/deviceinfo-iopsyswrt.c \ - ../dmtree/tr181/wifi-iopsyswrt.c \ - ../dmtree/tr181/hosts-iopsyswrt.c \ - ../dmtree/tr181/qos-iopsyswrt.c -endif - if BBF_TR104 libbbfdm_la_SOURCES += \ ../dmtree/tr104/common.c \ @@ -116,6 +96,43 @@ libbbfdm_la_SOURCES += \ ../dmtree/tr143/diagnostics.c endif +if BBF_VENDOR_EXTENSION + +libbbfdm_la_SOURCES += \ + ../dmdynamicvendor.c \ + ../dmtree/vendor/vendor.c + +if BBF_VENDOR_IOPSYS +libbbfdm_la_SOURCES += \ + ../dmtree/vendor/iopsys/tr181/vendor.c \ + ../dmtree/vendor/iopsys/tr181/device.c \ + ../dmtree/vendor/iopsys/tr181/deviceinfo.c \ + ../dmtree/vendor/iopsys/tr181/bridging.c \ + ../dmtree/vendor/iopsys/tr181/ethernet.c \ + ../dmtree/vendor/iopsys/tr181/ieee1905.c \ + ../dmtree/vendor/iopsys/tr181/times.c \ + ../dmtree/vendor/iopsys/tr181/x_iopsys_eu_igmp.c \ + ../dmtree/vendor/iopsys/tr181/x_iopsys_eu_mld.c +endif + +if BBF_VENDOR_OPENWRT +libbbfdm_la_SOURCES += \ + ../dmtree/vendor/openwrt/tr181/vendor.c \ + ../dmtree/vendor/openwrt/tr181/deviceinfo.c \ + ../dmtree/vendor/openwrt/tr181/qos.c +endif + +if BBF_VENDOR_TEST +libbbfdm_la_SOURCES += \ + ../dmtree/vendor/test/tr181/vendor.c \ + ../dmtree/vendor/test/tr181/deviceinfo.c \ + ../dmtree/vendor/test/tr181/firewall.c \ + ../dmtree/vendor/test/tr181/device.c \ + ../dmtree/vendor/test/tr181/x_test_com_dropbear.c +endif + +endif + libbbfdm_la_CFLAGS = \ $(AM_CFLAGS) \ $(LIBUCI_CFLAGS) \ @@ -144,6 +161,7 @@ libbbfdm_la_LIBADD = \ -lbbf_api libbbfdm_la_CFLAGS+=-I../ +libbbfdm_la_CFLAGS+=-I../dmtree libbbfdm_la_CFLAGS+=-I../dmtree/tr181 libbbfdm_la_CFLAGS+=-I../dmtree/tr104 libbbfdm_la_CFLAGS+=-I../dmtree/tr143 diff --git a/configure.ac b/configure.ac index c6e70ae2..27867f4f 100644 --- a/configure.ac +++ b/configure.ac @@ -18,8 +18,24 @@ AM_CONDITIONAL([LOPENSSL],[test "x$enable_libopenssl" = "xyes"]) AC_ARG_ENABLE(libmbedtls, [AS_HELP_STRING([--enable-libmbedtls], [enable libmbedtls upnp feature])], AC_DEFINE(LMBEDTLS),) AM_CONDITIONAL([LMBEDTLS],[test "x$enable_libmbedtls" = "xyes"]) -AC_ARG_ENABLE(generic_openwrt, [AS_HELP_STRING([--enable-generic-openwrt], [enable generic openwrt support])], AC_DEFINE(GENERIC_OPENWRT),) -AM_CONDITIONAL([GENERIC_OPENWRT],[test "x$enable_generic_openwrt" = "xyes"]) +AC_ARG_ENABLE(vendor_extension, [AS_HELP_STRING([--enable-vendor-extension], [enable vendor extension])], AC_DEFINE(BBF_VENDOR_EXTENSION),) +AM_CONDITIONAL([BBF_VENDOR_EXTENSION],[test "x$enable_vendor_extension" = "xyes"]) + +case $BBF_VENDOR_LIST in + *openwrt*) vendor_openwrt=yes ;;& + *iopsys*) vendor_iopsys=yes ;;& + *test*) vendor_test=yes ;;& + *) ;; +esac + +AM_CONDITIONAL([BBF_VENDOR_IOPSYS],[test "x$vendor_iopsys" = "xyes"]) +AM_COND_IF([BBF_VENDOR_IOPSYS], [AC_DEFINE(BBF_VENDOR_IOPSYS)],) + +AM_CONDITIONAL([BBF_VENDOR_OPENWRT],[test "x$vendor_openwrt" = "xyes"]) +AM_COND_IF([BBF_VENDOR_OPENWRT], [AC_DEFINE(BBF_VENDOR_OPENWRT)],) + +AM_CONDITIONAL([BBF_VENDOR_TEST],[test "x$vendor_test" = "xyes"]) +AM_COND_IF([BBF_VENDOR_TEST], [AC_DEFINE(BBF_VENDOR_TEST)],) # checks for programs AC_PROG_CC diff --git a/dmentryjson.c b/dmdynamicjson.c similarity index 86% rename from dmentryjson.c rename to dmdynamicjson.c index 432ea408..c9ca034d 100644 --- a/dmentryjson.c +++ b/dmdynamicjson.c @@ -9,7 +9,7 @@ * */ -#include "dmentryjson.h" +#include "dmdynamicjson.h" #include "dmmemjson.h" #include "dmentry.h" @@ -18,10 +18,10 @@ LIST_HEAD(json_list); static void add_json_data_to_list(struct list_head *dup_list, char *name, char *arg1, const char *arg2, const char *arg3, const char *arg4, const char *arg5, const char *arg6, const char *arg7, const char *arg8) { - struct dm_json_parameter *dm_json_parameter; - dm_json_parameter = dmcallocjson(1, sizeof(struct dm_json_parameter)); + struct dm_json_parameter *dm_json_parameter = dmcallocjson(1, sizeof(struct dm_json_parameter)); + list_add_tail(&dm_json_parameter->list, dup_list); - if(name) dm_json_parameter->name = dmstrdupjson(name); + if (name) dm_json_parameter->name = dmstrdupjson(name); if (arg1) dm_json_parameter->arg1 = dmstrdupjson(arg1); if (arg2) dm_json_parameter->arg2 = dmstrdupjson(arg2); if (arg3) dm_json_parameter->arg3 = dmstrdupjson(arg3); @@ -57,15 +57,13 @@ static void free_json_data_from_list(struct list_head *dup_list) } } -static int dm_browse_node_json_object_tree(DMNODE *parent_node, DMOBJ *entryobj) +static void dm_browse_node_json_object_tree(DMNODE *parent_node, DMOBJ *entryobj) { - if (!entryobj) - return 0; + for (; (entryobj && entryobj->obj); entryobj++) { - for (; entryobj->obj; entryobj++) { if (entryobj->nextdynamicobj) { - struct dm_dynamic_obj *next_dyn_array = entryobj->nextdynamicobj + INDX_JSON_OBJ_MOUNT; - if (next_dyn_array->nextobj) FREE(next_dyn_array->nextobj); + struct dm_dynamic_obj *next_dyn_array = entryobj->nextdynamicobj + INDX_JSON_MOUNT; + FREE(next_dyn_array->nextobj); } DMNODE node = {0}; @@ -77,15 +75,14 @@ static int dm_browse_node_json_object_tree(DMNODE *parent_node, DMOBJ *entryobj) if (entryobj->nextobj) dm_browse_node_json_object_tree(&node, entryobj->nextobj); } - return 0; } -static int free_node_object_tree_dynamic_array(DMOBJ *dm_entryobj) +static void free_node_object_tree_dynamic_array(DMOBJ *dm_entryobj) { DMOBJ *root = dm_entryobj; DMNODE node = {.current_object = ""}; + dm_browse_node_json_object_tree(&node, root); - return 0; } int free_json_dynamic_arrays(DMOBJ *dm_entryobj) @@ -146,7 +143,7 @@ static char *generate_obj_without_instance(char *full_obj, bool is_obj) return obj; } -int get_index_of_available_entry(DMOBJ *jentryobj) +static int get_index_of_available_entry(DMOBJ *jentryobj) { int idx = 0; for (; (jentryobj && jentryobj->obj); jentryobj++) { @@ -155,34 +152,7 @@ int get_index_of_available_entry(DMOBJ *jentryobj) return idx; } -static int check_json_root_obj(struct dmctx *ctx, char *in_param_json, DMOBJ **root_entry) -{ - char *prefix_obj = NULL, *obj = NULL, *full_obj; - int prefix_obj_found = 0, obj_found = 0; - DMOBJ *root = ctx->dm_entryobj; - DMNODE node = {.current_object = ""}; - - full_obj = replace_str(in_param_json, ".{i}.", "."); - - if (strcmp(full_obj, "Device.") == 0) - prefix_obj = full_obj; - else - generate_prefixobj_and_obj_full_obj(full_obj, &prefix_obj, &obj); - - dm_check_dynamic_obj(ctx, &node, root, full_obj, prefix_obj, root_entry, &prefix_obj_found); - if(prefix_obj_found && *root_entry) { - dm_check_dynamic_obj(ctx, &node, root, full_obj, full_obj, root_entry, &obj_found); - dmfreejson(full_obj); - if(obj_found) - return 1; - else - return 2; - } - dmfreejson(full_obj); - return 0; -} - -int browse_obj(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) +static int browse_obj(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { struct dm_json_parameter *pleaf = NULL; char *arg1 = NULL, *arg2 = NULL, *arg3 = NULL, *arg4 = NULL, *arg5 = NULL, *arg6 = NULL; @@ -581,7 +551,7 @@ static void parse_param(char *object, char *param, json_object *jobj, DMLEAF *pl { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type(6)*/ struct json_object *type, *protocols, *proto, *write, *mapping_arr, *mapping; - char full_param[256] = ""; + char full_param[256] = {0}; size_t n_proto; if (!pleaf) return; @@ -637,7 +607,6 @@ static void parse_param(char *object, char *param, json_object *jobj, DMLEAF *pl pleaf[i].bbfdm_type = BBFDM_BOTH; snprintf(full_param, sizeof(full_param), "%s%s", object, param); - json_object_object_get_ex(jobj, "mapping", &mapping); json_object_object_get_ex(jobj, "mapping", &mapping_arr); // for now, we have only one case mapping = json_object_array_get_idx(mapping_arr, 0); @@ -652,8 +621,7 @@ static void count_obj_param_under_jsonobj(json_object *jsonobj, int *obj_number, if ((strcmp(key1, "type") == 0) && (strcmp(json_object_get_string(jobj1), "object") == 0)) { (*obj_number)++; break; - } - else if (((strcmp(key1, "type") == 0) && (strcmp(json_object_get_string(jobj1), "object") != 0)) && (strcmp(key, "mapping") != 0)) { + } else if (((strcmp(key1, "type") == 0) && (strcmp(json_object_get_string(jobj1), "object") != 0)) && (strcmp(key, "mapping") != 0)) { (*param_number)++; break; } @@ -664,7 +632,7 @@ static void count_obj_param_under_jsonobj(json_object *jsonobj, int *obj_number, static void parse_obj(char *object, json_object *jobj, DMOBJ *pobj, int index, struct list_head *list) { - /* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys(12)*/ + /* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys(13)*/ char *prfix_obj = NULL, *obj_str = NULL; int obj_number = 0, param_number = 0, i = 0, j = 0; @@ -675,7 +643,9 @@ static void parse_obj(char *object, json_object *jobj, DMOBJ *pobj, int index, s char *full_obj = replace_str(object, ".{i}.", "."); generate_prefixobj_and_obj_full_obj(full_obj, &prfix_obj, &obj_str); - if (!pobj) return; + if (!pobj) + return; + //OBJ pobj[index].obj = obj_str; @@ -754,50 +724,58 @@ static void parse_obj(char *object, json_object *jobj, DMOBJ *pobj, int index, s int load_json_dynamic_arrays(struct dmctx *ctx) { + struct dirent *ent = NULL; + DIR *dir = NULL; + if (folder_exists(JSON_FOLDER_PATH)) { - struct dirent *ent = NULL; - DIR *dir = NULL; - sysfs_foreach_file(JSON_FOLDER_PATH, dir, ent) { - if (strstr(ent->d_name, ".json")) { + + if (!strstr(ent->d_name, ".json")) + continue; + + char buf[512] = {0}; + snprintf(buf, sizeof(buf), "%s/%s", JSON_FOLDER_PATH, ent->d_name); + + json_object *json = json_object_from_file(buf); + if (!json) continue; + + json_object_object_foreach(json, key, jobj) { + if (!key) + break; + + char *obj_prefix = NULL; + char *obj = NULL; + + generate_prefixobj_and_obj_full_obj(key, &obj_prefix, &obj); + DMOBJ *dm_entryobj = NULL; - json_object *json; - char buf[280] = ""; - snprintf(buf, sizeof(buf), "%s/%s", JSON_FOLDER_PATH, ent->d_name); - json = json_object_from_file(buf); - if (!json) continue; + bool obj_exists = find_root_entry(ctx, obj_prefix, &dm_entryobj); + if (obj_exists == 0 || !dm_entryobj) + continue; - json_object_object_foreach(json, key, jobj) { - if (!key) break; - int check_obj = check_json_root_obj(ctx, key, &dm_entryobj); - if (check_obj == 0) - continue; - - if (!dm_entryobj) - continue; - - if (dm_entryobj->nextdynamicobj == NULL) { - dm_entryobj->nextdynamicobj = calloc(__INDX_DYNAMIC_MAX, sizeof(struct dm_dynamic_obj)); - dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].isstatic = 0; - dm_entryobj->nextdynamicobj[INDX_LIBRARY_OBJ_MOUNT].isstatic = 1; - } - - if (dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].nextobj == NULL) { - dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].nextobj = calloc(2, sizeof(struct dm_obj_s *)); - } - - if (dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].nextobj[0] == NULL) { - dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].nextobj[0] = dmcallocjson(2, sizeof(struct dm_obj_s)); - parse_obj(key, jobj, dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].nextobj[0], 0, &json_list); - } else { - int idx = get_index_of_available_entry(dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].nextobj[0]); - dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].nextobj[0] = dmreallocjson(dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].nextobj[0], (idx + 2) * sizeof(struct dm_obj_s)); - memset(dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].nextobj[0] + (idx + 1), 0, sizeof(struct dm_obj_s)); - parse_obj(key, jobj, dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].nextobj[0], idx, &json_list); - } + if (dm_entryobj->nextdynamicobj == NULL) { + dm_entryobj->nextdynamicobj = calloc(__INDX_DYNAMIC_MAX, sizeof(struct dm_dynamic_obj)); + dm_entryobj->nextdynamicobj[INDX_JSON_MOUNT].idx_type = INDX_JSON_MOUNT; + dm_entryobj->nextdynamicobj[INDX_LIBRARY_MOUNT].idx_type = INDX_LIBRARY_MOUNT; + dm_entryobj->nextdynamicobj[INDX_VENDOR_MOUNT].idx_type = INDX_VENDOR_MOUNT; + } + + if (dm_entryobj->nextdynamicobj[INDX_JSON_MOUNT].nextobj == NULL) { + dm_entryobj->nextdynamicobj[INDX_JSON_MOUNT].nextobj = calloc(2, sizeof(struct dm_obj_s *)); + } + + if (dm_entryobj->nextdynamicobj[INDX_JSON_MOUNT].nextobj[0] == NULL) { + dm_entryobj->nextdynamicobj[INDX_JSON_MOUNT].nextobj[0] = dmcallocjson(2, sizeof(struct dm_obj_s)); + parse_obj(key, jobj, dm_entryobj->nextdynamicobj[INDX_JSON_MOUNT].nextobj[0], 0, &json_list); + } else { + int idx = get_index_of_available_entry(dm_entryobj->nextdynamicobj[INDX_JSON_MOUNT].nextobj[0]); + dm_entryobj->nextdynamicobj[INDX_JSON_MOUNT].nextobj[0] = dmreallocjson(dm_entryobj->nextdynamicobj[INDX_JSON_MOUNT].nextobj[0], (idx + 2) * sizeof(struct dm_obj_s)); + memset(dm_entryobj->nextdynamicobj[INDX_JSON_MOUNT].nextobj[0] + (idx + 1), 0, sizeof(struct dm_obj_s)); + parse_obj(key, jobj, dm_entryobj->nextdynamicobj[INDX_JSON_MOUNT].nextobj[0], idx, &json_list); } - if (json) json_object_put(json); } + if (json) json_object_put(json); + } if (dir) closedir(dir); } diff --git a/dmentryjson.h b/dmdynamicjson.h similarity index 100% rename from dmentryjson.h rename to dmdynamicjson.h diff --git a/dmdynamiclibrary.c b/dmdynamiclibrary.c new file mode 100644 index 00000000..aaede7a0 --- /dev/null +++ b/dmdynamiclibrary.c @@ -0,0 +1,170 @@ +/* + * Copyright (C) 2021 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 Ramdhane + * + */ + +#include "dmdynamiclibrary.h" +#include "dmoperate.h" + +LIST_HEAD(loaded_library_list); + +struct loaded_library +{ + struct list_head list; + void *library; +}; + +static void add_list_loaded_libraries(struct list_head *library_list, void *library) +{ + struct loaded_library *lib = calloc(1, sizeof(struct loaded_library)); + list_add_tail(&lib->list, library_list); + lib->library = library; +} + +static void free_all_list_open_library(struct list_head *library_list) +{ + struct loaded_library *lib; + while (library_list->next != library_list) { + lib = list_entry(library_list->next, struct loaded_library, list); + list_del(&lib->list); + if (lib->library) { + dlclose(lib->library); + } + FREE(lib); + } +} + +static void dm_browse_node_dynamic_object_tree(DMNODE *parent_node, DMOBJ *entryobj) +{ + for (; (entryobj && entryobj->obj); entryobj++) { + + if (entryobj->nextdynamicobj) { + struct dm_dynamic_obj *next_dyn_array = entryobj->nextdynamicobj + INDX_LIBRARY_MOUNT; + FREE(next_dyn_array->nextobj); + } + + if (entryobj->dynamicleaf) { + struct dm_dynamic_leaf *next_dyn_array = entryobj->dynamicleaf + INDX_LIBRARY_MOUNT; + FREE(next_dyn_array->nextleaf); + } + + DMNODE node = {0}; + node.obj = entryobj; + node.parent = parent_node; + node.instance_level = parent_node->instance_level; + node.matched = parent_node->matched; + + if (entryobj->nextobj) + dm_browse_node_dynamic_object_tree(&node, entryobj->nextobj); + } +} + +void free_library_dynamic_arrays(DMOBJ *dm_entryobj) +{ + DMOBJ *root = dm_entryobj; + DMNODE node = {.current_object = ""}; + + free_all_list_open_library(&loaded_library_list); + dm_browse_node_dynamic_object_tree(&node, root); + FREE(dynamic_operate); +} + +int load_library_dynamic_arrays(struct dmctx *ctx) +{ + struct dirent *ent = NULL; + DIR *dir = NULL; + + if (folder_exists(LIBRARY_FOLDER_PATH)) { + sysfs_foreach_file(LIBRARY_FOLDER_PATH, dir, ent) { + + if (!strstr(ent->d_name, ".so")) + continue; + + char buf[512] = {0}; + snprintf(buf, sizeof(buf), "%s/%s", LIBRARY_FOLDER_PATH, ent->d_name); + + void *handle = dlopen(buf, RTLD_LAZY); + if (!handle) continue; + + //Dynamic Object + DM_MAP_OBJ *dynamic_obj = NULL; + *(void **) (&dynamic_obj) = dlsym(handle, "tDynamicObj"); + if (dynamic_obj) { + + for (int i = 0; dynamic_obj[i].path; i++) { + + DMOBJ *dm_entryobj = NULL; + bool obj_exists = find_root_entry(ctx, dynamic_obj[i].path, &dm_entryobj); + if (obj_exists == false || !dm_entryobj) + continue; + + if (dynamic_obj[i].root_obj) { + + if (dm_entryobj->nextdynamicobj == NULL) { + dm_entryobj->nextdynamicobj = calloc(__INDX_DYNAMIC_MAX, sizeof(struct dm_dynamic_obj)); + dm_entryobj->nextdynamicobj[INDX_JSON_MOUNT].idx_type = INDX_JSON_MOUNT; + dm_entryobj->nextdynamicobj[INDX_LIBRARY_MOUNT].idx_type = INDX_LIBRARY_MOUNT; + dm_entryobj->nextdynamicobj[INDX_VENDOR_MOUNT].idx_type = INDX_VENDOR_MOUNT; + } + + if (dm_entryobj->nextdynamicobj[INDX_LIBRARY_MOUNT].nextobj == NULL) { + dm_entryobj->nextdynamicobj[INDX_LIBRARY_MOUNT].nextobj = calloc(2, sizeof(DMOBJ *)); + dm_entryobj->nextdynamicobj[INDX_LIBRARY_MOUNT].nextobj[0] = dynamic_obj[i].root_obj; + } else { + int idx = get_obj_idx_dynamic_array(dm_entryobj->nextdynamicobj[INDX_LIBRARY_MOUNT].nextobj); + dm_entryobj->nextdynamicobj[INDX_LIBRARY_MOUNT].nextobj = realloc(dm_entryobj->nextdynamicobj[INDX_LIBRARY_MOUNT].nextobj, (idx + 2) * sizeof(DMOBJ *)); + dm_entryobj->nextdynamicobj[INDX_LIBRARY_MOUNT].nextobj[idx] = dynamic_obj[i].root_obj; + dm_entryobj->nextdynamicobj[INDX_LIBRARY_MOUNT].nextobj[idx+1] = NULL; + } + + } + + if (dynamic_obj[i].root_leaf) { + + if (dm_entryobj->dynamicleaf == NULL) { + dm_entryobj->dynamicleaf = calloc(__INDX_DYNAMIC_MAX, sizeof(struct dm_dynamic_leaf)); + dm_entryobj->dynamicleaf[INDX_JSON_MOUNT].idx_type = INDX_JSON_MOUNT; + dm_entryobj->dynamicleaf[INDX_LIBRARY_MOUNT].idx_type = INDX_LIBRARY_MOUNT; + dm_entryobj->dynamicleaf[INDX_VENDOR_MOUNT].idx_type = INDX_VENDOR_MOUNT; + } + + if (dm_entryobj->dynamicleaf[INDX_LIBRARY_MOUNT].nextleaf == NULL) { + dm_entryobj->dynamicleaf[INDX_LIBRARY_MOUNT].nextleaf = calloc(2, sizeof(DMLEAF *)); + dm_entryobj->dynamicleaf[INDX_LIBRARY_MOUNT].nextleaf[0] = dynamic_obj[i].root_leaf; + } else { + int idx = get_leaf_idx_dynamic_array(dm_entryobj->dynamicleaf[INDX_LIBRARY_MOUNT].nextleaf); + dm_entryobj->dynamicleaf[INDX_LIBRARY_MOUNT].nextleaf = realloc(dm_entryobj->dynamicleaf[INDX_LIBRARY_MOUNT].nextleaf, (idx + 2) * sizeof(DMLEAF *)); + dm_entryobj->dynamicleaf[INDX_LIBRARY_MOUNT].nextleaf[idx] = dynamic_obj[i].root_leaf; + dm_entryobj->dynamicleaf[INDX_LIBRARY_MOUNT].nextleaf[idx+1] = NULL; + } + + } + } + } + + //Dynamic Operate + DM_MAP_OPERATE *dynamic_operate = NULL; + *(void **) (&dynamic_operate) = dlsym(handle, "tDynamicOperate"); + if (dynamic_operate) { + + for (int i = 0; dynamic_operate[i].path; i++) { + if (dynamic_operate[i].operate && dynamic_operate[i].type) + add_dynamic_operate(dynamic_operate[i].path, + dynamic_operate[i].operate, + dynamic_operate[i].type); + } + } + + add_list_loaded_libraries(&loaded_library_list, handle); + + } + if (dir) closedir(dir); + } + return 0; +} diff --git a/dmentrylibrary.h b/dmdynamiclibrary.h similarity index 82% rename from dmentrylibrary.h rename to dmdynamiclibrary.h index 3d01579c..dd978dfc 100644 --- a/dmentrylibrary.h +++ b/dmdynamiclibrary.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 iopsys Software Solutions AB + * Copyright (C) 2021 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 @@ -17,6 +17,6 @@ #define LIBRARY_FOLDER_PATH "/usr/lib/bbfdm" int load_library_dynamic_arrays(struct dmctx *ctx); -int free_library_dynamic_arrays(DMOBJ *dm_entryobj); +void free_library_dynamic_arrays(DMOBJ *dm_entryobj); #endif //__DMENTRYLIBRARY_H__ diff --git a/dmdynamicvendor.c b/dmdynamicvendor.c new file mode 100644 index 00000000..f38f6b83 --- /dev/null +++ b/dmdynamicvendor.c @@ -0,0 +1,300 @@ +/* + * Copyright (C) 2021 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 Ramdhane + * + */ + +#include "dmdynamicvendor.h" +#include "dmtree/vendor/vendor.h" + +static void dm_browse_node_vendor_object_tree(DMNODE *parent_node, DMOBJ *entryobj) +{ + for (; (entryobj && entryobj->obj); entryobj++) { + + if (entryobj->nextdynamicobj) { + struct dm_dynamic_obj *next_dyn_array = entryobj->nextdynamicobj + INDX_VENDOR_MOUNT; + FREE(next_dyn_array->nextobj); + } + + if (entryobj->dynamicleaf) { + struct dm_dynamic_leaf *next_dyn_array = entryobj->dynamicleaf + INDX_VENDOR_MOUNT; + FREE(next_dyn_array->nextleaf); + } + + DMNODE node = {0}; + node.obj = entryobj; + node.parent = parent_node; + node.instance_level = parent_node->instance_level; + node.matched = parent_node->matched; + + if (entryobj->nextobj) + dm_browse_node_vendor_object_tree(&node, entryobj->nextobj); + } +} + +void free_vendor_dynamic_arrays(DMOBJ *dm_entryobj) +{ + DMOBJ *root = dm_entryobj; + DMNODE node = {.current_object = ""}; + + dm_browse_node_vendor_object_tree(&node, root); +} + +static void overwrite_param(DMOBJ *entryobj, DMLEAF *leaf) +{ + if (entryobj->leaf) { + + DMLEAF *entryleaf = entryobj->leaf; + for (; (entryleaf && entryleaf->parameter); entryleaf++) { + + if (strcmp(entryleaf->parameter, leaf->parameter) == 0) { + entryleaf->getvalue = leaf->getvalue; + entryleaf->setvalue = leaf->setvalue; + return; + } + + } + } +} + +static void overwrite_obj(DMOBJ *entryobj, DMOBJ *dmobj) +{ + if (entryobj->nextobj) { + + DMOBJ *entrynextobj = entryobj->nextobj; + for (; (entrynextobj && entrynextobj->obj); entrynextobj++) { + + if (strcmp(entrynextobj->obj, dmobj->obj) == 0) { + + entrynextobj->addobj = dmobj->addobj; + entrynextobj->delobj = dmobj->delobj; + entrynextobj->checkdep = dmobj->checkdep; + entrynextobj->browseinstobj = dmobj->browseinstobj; + entrynextobj->get_linker = dmobj->get_linker; + + + if (dmobj->leaf) { + DMLEAF *leaf = dmobj->leaf; + for (; (leaf && leaf->parameter); leaf++) { + overwrite_param(entrynextobj, leaf); + } + } + + if (dmobj->nextobj) { + DMOBJ *dmnextobj = dmobj->nextobj; + for (; (dmnextobj && dmnextobj->obj); dmnextobj++) { + overwrite_obj(entrynextobj, dmnextobj); + } + } + + return; + } + + } + } +} + +static void load_vendor_extension_arrays(struct dmctx *ctx) +{ + char vendor_list[512] = {0}; + size_t length = 0; + + DM_STRNCPY(vendor_list, BBF_VENDOR_LIST, sizeof(vendor_list)); + char **tokens = strsplit(vendor_list, ",", &length); + + for (int idx = length - 1; idx >= 0; idx--) { + + DM_MAP_VENDOR *vendor_map_obj = tVendorExtension; + + for (int j = 0; vendor_map_obj[j].vendor; j++) { + + if (strcmp(vendor_map_obj[j].vendor, tokens[idx]) != 0) + continue; + + DM_MAP_OBJ *vendor_obj = vendor_map_obj[j].vendor_obj; + + for (int i = 0; vendor_obj[i].path; i++) { + + DMOBJ *dm_entryobj = NULL; + bool obj_exists = find_root_entry(ctx, vendor_obj[i].path, &dm_entryobj); + if (obj_exists == false || !dm_entryobj) + continue; + + if (vendor_obj[i].root_obj) { + if (dm_entryobj->nextdynamicobj == NULL) { + dm_entryobj->nextdynamicobj = calloc(__INDX_DYNAMIC_MAX, sizeof(struct dm_dynamic_obj)); + dm_entryobj->nextdynamicobj[INDX_JSON_MOUNT].idx_type = INDX_JSON_MOUNT; + dm_entryobj->nextdynamicobj[INDX_LIBRARY_MOUNT].idx_type = INDX_LIBRARY_MOUNT; + dm_entryobj->nextdynamicobj[INDX_VENDOR_MOUNT].idx_type = INDX_VENDOR_MOUNT; + } + + if (dm_entryobj->nextdynamicobj[INDX_VENDOR_MOUNT].nextobj == NULL) { + dm_entryobj->nextdynamicobj[INDX_VENDOR_MOUNT].nextobj = calloc(2, sizeof(DMOBJ *)); + dm_entryobj->nextdynamicobj[INDX_VENDOR_MOUNT].nextobj[0] = vendor_obj[i].root_obj; + } else { + int idx = get_obj_idx_dynamic_array(dm_entryobj->nextdynamicobj[INDX_VENDOR_MOUNT].nextobj); + dm_entryobj->nextdynamicobj[INDX_VENDOR_MOUNT].nextobj = realloc(dm_entryobj->nextdynamicobj[INDX_VENDOR_MOUNT].nextobj, (idx + 2) * sizeof(DMOBJ *)); + dm_entryobj->nextdynamicobj[INDX_VENDOR_MOUNT].nextobj[idx] = vendor_obj[i].root_obj; + dm_entryobj->nextdynamicobj[INDX_VENDOR_MOUNT].nextobj[idx+1] = NULL; + } + } + + if (vendor_obj[i].root_leaf) { + if (dm_entryobj->dynamicleaf == NULL) { + dm_entryobj->dynamicleaf = calloc(__INDX_DYNAMIC_MAX, sizeof(struct dm_dynamic_leaf)); + dm_entryobj->dynamicleaf[INDX_JSON_MOUNT].idx_type = INDX_JSON_MOUNT; + dm_entryobj->dynamicleaf[INDX_LIBRARY_MOUNT].idx_type = INDX_LIBRARY_MOUNT; + dm_entryobj->dynamicleaf[INDX_VENDOR_MOUNT].idx_type = INDX_VENDOR_MOUNT; + } + + if (dm_entryobj->dynamicleaf[INDX_VENDOR_MOUNT].nextleaf == NULL) { + dm_entryobj->dynamicleaf[INDX_VENDOR_MOUNT].nextleaf = calloc(2, sizeof(DMLEAF *)); + dm_entryobj->dynamicleaf[INDX_VENDOR_MOUNT].nextleaf[0] = vendor_obj[i].root_leaf; + } else { + int idx = get_leaf_idx_dynamic_array(dm_entryobj->dynamicleaf[INDX_VENDOR_MOUNT].nextleaf); + dm_entryobj->dynamicleaf[INDX_VENDOR_MOUNT].nextleaf = realloc(dm_entryobj->dynamicleaf[INDX_VENDOR_MOUNT].nextleaf, (idx + 2) * sizeof(DMLEAF *)); + dm_entryobj->dynamicleaf[INDX_VENDOR_MOUNT].nextleaf[idx] = vendor_obj[i].root_leaf; + dm_entryobj->dynamicleaf[INDX_VENDOR_MOUNT].nextleaf[idx+1] = NULL; + } + } + + } + + break; + } + + } +} + +static void load_vendor_extension_overwrite_arrays(struct dmctx *ctx) +{ + char vendor_list[512] = {0}; + size_t length = 0; + + DM_STRNCPY(vendor_list, BBF_VENDOR_LIST, sizeof(vendor_list)); + char **tokens = strsplit(vendor_list, ",", &length); + + for (int idx = length - 1; idx >= 0; idx--) { + + DM_MAP_VENDOR *vendor_map_obj = tVendorExtensionOverwrite; + + for (int j = 0; vendor_map_obj[j].vendor; j++) { + + if (strcmp(vendor_map_obj[j].vendor, tokens[idx]) != 0) + continue; + + DM_MAP_OBJ *dynamic_overwrite_obj = vendor_map_obj[j].vendor_obj; + DMOBJ *dm_entryobj = NULL; + + for (int i = 0; dynamic_overwrite_obj[i].path; i++) { + + bool obj_exists = find_root_entry(ctx, dynamic_overwrite_obj[i].path, &dm_entryobj); + if (obj_exists == false || !dm_entryobj) + continue; + + if (dynamic_overwrite_obj[i].root_obj) { + DMOBJ *dmobj = dynamic_overwrite_obj[i].root_obj; + for (; (dmobj && dmobj->obj); dmobj++) { + overwrite_obj(dm_entryobj, dmobj); + } + } + + if (dynamic_overwrite_obj[i].root_leaf) { + DMLEAF *leaf = dynamic_overwrite_obj[i].root_leaf; + for (; (leaf && leaf->parameter); leaf++) { + overwrite_param(dm_entryobj, leaf); + } + } + + } + + break; + } + + } +} + +static void exclude_obj(struct dmctx *ctx, char *in_obj) +{ + DMOBJ *root = ctx->dm_entryobj; + DMNODE node = {.current_object = ""}; + + char *obj_path = replace_str(in_obj, ".{i}.", "."); + dm_exclude_obj(ctx, &node, root, obj_path); + dmfree(obj_path); +} + +static void exclude_param(struct dmctx *ctx, char *in_param) +{ + DMOBJ *entryobj = NULL; + char obj_prefix[256] = {'\0'}; + + char *ret = strrchr(in_param, '.'); + strncpy(obj_prefix, in_param, ret - in_param +1); + + bool obj_exists = find_root_entry(ctx, obj_prefix, &entryobj); + + if (entryobj && obj_exists == true) { + DMLEAF *leaf = entryobj->leaf; + + for (; (leaf && leaf->parameter); leaf++) { + + char *full_param; + + dmastrcat(&full_param, obj_prefix, leaf->parameter); + if (strcmp(full_param, in_param) == 0) { + leaf->bbfdm_type = BBFDM_NONE; + dmfree(full_param); + return; + } + + dmfree(full_param); + } + + } +} + +static void load_vendor_extension_exclude_arrays(struct dmctx *ctx) +{ + char vendor_list[512] = {0}; + size_t length = 0; + + DM_STRNCPY(vendor_list, BBF_VENDOR_LIST, sizeof(vendor_list)); + char **tokens = strsplit(vendor_list, ",", &length); + + for (int idx = length - 1; idx >= 0; idx--) { + + DM_MAP_VENDOR_EXCLUDE *vendor_map_exclude_obj = tVendorExtensionExclude; + + for (int j = 0; vendor_map_exclude_obj[j].vendor; j++) { + + if (strcmp(vendor_map_exclude_obj[j].vendor, tokens[idx]) != 0) + continue; + + char **dynamic_exclude_obj = vendor_map_exclude_obj[j].vendor_obj; + + for (; *dynamic_exclude_obj; dynamic_exclude_obj++) { + + if ((*dynamic_exclude_obj)[strlen(*dynamic_exclude_obj) - 1] == '.') + exclude_obj(ctx, *dynamic_exclude_obj); + else + exclude_param(ctx, *dynamic_exclude_obj); + } + + break; + } + + } +} + +void load_vendor_dynamic_arrays(struct dmctx *ctx) +{ + load_vendor_extension_arrays(ctx); + load_vendor_extension_overwrite_arrays(ctx); + load_vendor_extension_exclude_arrays(ctx); +} diff --git a/dmdynamicvendor.h b/dmdynamicvendor.h new file mode 100644 index 00000000..3e647008 --- /dev/null +++ b/dmdynamicvendor.h @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2021 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 Ramdhane + * + */ + +#ifndef __DMENTRYVENDOR_H__ +#define __DMENTRYVENDOR_H__ + +#include + +void load_vendor_dynamic_arrays(struct dmctx *ctx); +void free_vendor_dynamic_arrays(DMOBJ *dm_entryobj); + +#endif //__DMENTRYVENDOR_H__ diff --git a/dmentry.c b/dmentry.c index 7dd90f43..adecbcf4 100644 --- a/dmentry.c +++ b/dmentry.c @@ -13,8 +13,9 @@ */ #include "dmentry.h" -#include "dmentryjson.h" -#include "dmentrylibrary.h" +#include "dmdynamicjson.h" +#include "dmdynamiclibrary.h" +#include "dmdynamicvendor.h" #include "dmoperate.h" #include "device.h" #include "dmbbfcommon.h" @@ -24,6 +25,10 @@ LIST_HEAD(head_package_change); static char json_hash[64] = {0}; static char library_hash[64] = {0}; +#ifdef BBF_VENDOR_EXTENSION +static bool first_boot = false; +#endif + int usp_fault_map(int fault) { int out_fault; @@ -119,18 +124,7 @@ static int dm_ctx_init_custom(struct dmctx *ctx, unsigned int instance_mode, int ctx->end_session_flag = 0; return 0; } -void dm_ctx_init_list_parameter(struct dmctx *ctx) -{ - INIT_LIST_HEAD(&ctx->list_parameter); - INIT_LIST_HEAD(&ctx->set_list_tmp); - INIT_LIST_HEAD(&ctx->list_fault_param); -} -void dm_ctx_clean_list_parameter(struct dmctx *ctx) -{ - free_all_list_parameter(ctx); - free_all_set_list_tmp(ctx); - free_all_list_fault_param(ctx); -} + static int dm_ctx_clean_custom(struct dmctx *ctx, int custom) { free_all_list_parameter(ctx); @@ -427,7 +421,7 @@ static int check_stats_folder(bool json_path) return 0; } -int load_dynamic_arrays(struct dmctx *ctx) +void load_dynamic_arrays(struct dmctx *ctx) { // Load dynamic objects and parameters exposed via a JSON file if (check_stats_folder(true)) { @@ -441,17 +435,25 @@ int load_dynamic_arrays(struct dmctx *ctx) load_library_dynamic_arrays(ctx); } - return 0; +#ifdef BBF_VENDOR_EXTENSION + // Load objects and parameters exposed via vendor extension + if (first_boot == false) { + free_vendor_dynamic_arrays(tEntry181Obj); + load_vendor_dynamic_arrays(ctx); + first_boot = true; + } +#endif } -int free_dynamic_arrays(void) +void free_dynamic_arrays(void) { DMOBJ *root = tEntry181Obj; DMNODE node = {.current_object = ""}; - free_dm_browse_node_dynamic_object_tree(&node, root); free_json_dynamic_arrays(tEntry181Obj); free_library_dynamic_arrays(tEntry181Obj); - - return 0; +#ifdef BBF_VENDOR_EXTENSION + free_vendor_dynamic_arrays(tEntry181Obj); +#endif + free_dm_browse_node_dynamic_object_tree(&node, root); } diff --git a/dmentry.h b/dmentry.h index 0e0b53ee..9ae6f1ac 100644 --- a/dmentry.h +++ b/dmentry.h @@ -28,16 +28,12 @@ int dm_ctx_init(struct dmctx *ctx, unsigned int instance_mode); int dm_ctx_init_sub(struct dmctx *ctx, unsigned int instance_mode); int dm_entry_param_method(struct dmctx *ctx, int cmd, char *inparam, char *arg1, char *arg2); int dm_entry_apply(struct dmctx *ctx, int cmd, char *arg1, char *arg2); -int adm_entry_get_linker_param(struct dmctx *ctx, char *param, char *linker, char **value); -int adm_entry_get_linker_value(struct dmctx *ctx, char *param, char **value); int dm_entry_restart_services(void); int dm_entry_revert_changes(void); int usp_fault_map(int fault); int dm_ctx_clean(struct dmctx *ctx); int dm_ctx_clean_sub(struct dmctx *ctx); -int load_dynamic_arrays(struct dmctx *ctx); -int free_dynamic_arrays(void); -void dm_ctx_init_list_parameter(struct dmctx *ctx); -void dm_ctx_clean_list_parameter(struct dmctx *ctx); +void load_dynamic_arrays(struct dmctx *ctx); +void free_dynamic_arrays(void); #endif diff --git a/dmentrylibrary.c b/dmentrylibrary.c deleted file mode 100644 index c2edaf35..00000000 --- a/dmentrylibrary.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (C) 2020 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 Ramdhane - * - */ - -#include "dmentrylibrary.h" -#include "dmoperate.h" - -static int dm_browse_node_dynamic_object_tree(DMNODE *parent_node, DMOBJ *entryobj) -{ - if (!entryobj) - return 0; - - for (; entryobj->obj; entryobj++) { - if (entryobj->nextdynamicobj) { - struct dm_dynamic_obj *next_dyn_array = entryobj->nextdynamicobj + INDX_LIBRARY_OBJ_MOUNT; - if (next_dyn_array->nextobj) FREE(next_dyn_array->nextobj); - } - - DMNODE node = {0}; - node.obj = entryobj; - node.parent = parent_node; - node.instance_level = parent_node->instance_level; - node.matched = parent_node->matched; - - if (entryobj->nextobj) - dm_browse_node_dynamic_object_tree(&node, entryobj->nextobj); - } - return 0; -} - -int free_library_dynamic_arrays(DMOBJ *dm_entryobj) -{ - DMOBJ *root = dm_entryobj; - DMNODE node = {.current_object = ""}; - dm_browse_node_dynamic_object_tree(&node, root); - FREE(dynamic_operate); - return 0; -} - -static int check_library_root_obj(struct dmctx *ctx, char *in_param, DMOBJ **root_entry) -{ - int obj_found = 0; - DMOBJ *root = ctx->dm_entryobj; - DMNODE node = {.current_object = ""}; - dm_check_dynamic_obj(ctx, &node, root, in_param, in_param, root_entry, &obj_found); - if(obj_found && *root_entry) return 1; - return 0; -} - -static int get_index_of_available_dynamic_array(struct dm_obj_s **jentryobj) -{ - int i, idx = 0; - for (i = 0; jentryobj[i]; i++) { - idx++; - } - return idx; -} - -int load_library_dynamic_arrays(struct dmctx *ctx) -{ - struct dirent *ent = NULL; - DIR *dir = NULL; - - if (folder_exists(LIBRARY_FOLDER_PATH)) { - sysfs_foreach_file(LIBRARY_FOLDER_PATH, dir, ent) { - if (strstr(ent->d_name, ".so")) { - void *handle; - LIB_MAP_OBJ *root_dynamic_obj = NULL; - LIB_MAP_OPERATE *root_dynamic_operate = NULL; - DMOBJ *dm_entryobj = NULL; - char buf[280] = ""; - int i; - - snprintf(buf, sizeof(buf), "%s/%s", LIBRARY_FOLDER_PATH, ent->d_name); - handle = dlopen(buf, RTLD_LAZY); - if (!handle) continue; - - //Dynamic Object - *(void **) (&root_dynamic_obj) = dlsym(handle, "tRootDynamicObj"); - if(root_dynamic_obj) { - for (i = 0; root_dynamic_obj[i].path; i++) { - if (!root_dynamic_obj[i].root_obj) continue; - int check_obj = check_library_root_obj(ctx, root_dynamic_obj[i].path, &dm_entryobj); - if ((check_obj == 0) || (!dm_entryobj)) continue; - - if (dm_entryobj->nextdynamicobj == NULL) { - dm_entryobj->nextdynamicobj = calloc(__INDX_DYNAMIC_MAX, sizeof(struct dm_dynamic_obj)); - dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].isstatic = 0; - dm_entryobj->nextdynamicobj[INDX_LIBRARY_OBJ_MOUNT].isstatic = 1; - } - - if (dm_entryobj->nextdynamicobj[INDX_LIBRARY_OBJ_MOUNT].nextobj == NULL) { - dm_entryobj->nextdynamicobj[INDX_LIBRARY_OBJ_MOUNT].nextobj = calloc(2, sizeof(struct dm_obj_s *)); - dm_entryobj->nextdynamicobj[INDX_LIBRARY_OBJ_MOUNT].nextobj[0] = root_dynamic_obj[i].root_obj; - } else { - int idx = get_index_of_available_dynamic_array(dm_entryobj->nextdynamicobj[INDX_LIBRARY_OBJ_MOUNT].nextobj); - dm_entryobj->nextdynamicobj[INDX_LIBRARY_OBJ_MOUNT].nextobj = realloc(dm_entryobj->nextdynamicobj[INDX_LIBRARY_OBJ_MOUNT].nextobj, (idx + 2) * sizeof(struct dm_obj_s *)); - dm_entryobj->nextdynamicobj[INDX_LIBRARY_OBJ_MOUNT].nextobj[idx] = root_dynamic_obj[i].root_obj; - dm_entryobj->nextdynamicobj[INDX_LIBRARY_OBJ_MOUNT].nextobj[idx+1] = NULL; - } - } - } - - //Dynamic Operate - *(void **) (&root_dynamic_operate) = dlsym(handle, "tRootDynamicOperate"); - if(root_dynamic_operate) { - for (i = 0; root_dynamic_operate[i].path; i++) { - if (root_dynamic_operate[i].operate && root_dynamic_operate[i].type) - add_dynamic_operate(root_dynamic_operate[i].path, - root_dynamic_operate[i].operate, - root_dynamic_operate[i].type); - } - } - - if (handle) dlclose(handle); - } - } - if (dir) closedir(dir); - } - return 0; -} diff --git a/dmoperate.c b/dmoperate.c index 518df20c..d90b131a 100644 --- a/dmoperate.c +++ b/dmoperate.c @@ -1177,7 +1177,8 @@ void operate_list_cmds(struct dmctx *dmctx) size_t i; struct op_cmd *save_pointer = NULL; - if (dynamic_operate) save_pointer = dynamic_operate; + if (dynamic_operate) + save_pointer = dynamic_operate; for(i = 0; i < n; i++) { param = dmstrdup(operate_helper[i].name); @@ -1193,7 +1194,8 @@ void operate_list_cmds(struct dmctx *dmctx) add_list_parameter(dmctx, param, (char *)args, type, NULL); } - if (save_pointer)dynamic_operate = save_pointer; + if (save_pointer) + dynamic_operate = save_pointer; } static opr_ret_t do_operate(struct dmctx *dmctx, char *path, operation func, const char *input) diff --git a/dmtree/tr104/servicesvoiceservice.c b/dmtree/tr104/servicesvoiceservice.c index d47c8774..a33996b7 100644 --- a/dmtree/tr104/servicesvoiceservice.c +++ b/dmtree/tr104/servicesvoiceservice.c @@ -268,22 +268,22 @@ static int set_service_alias(char *refparam, struct dmctx *ctx, void *data, char ***********************************************************************************************************************************/ /* *** Device.Services. *** */ DMOBJ tServicesObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"VoiceService", &DMREAD, NULL, NULL, "file:/etc/config/asterisk", browseVoiceServiceInst, NULL, tServicesVoiceServiceObj, tServicesVoiceServiceParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"VoiceService", &DMREAD, NULL, NULL, "file:/etc/config/asterisk", browseVoiceServiceInst, NULL, NULL, tServicesVoiceServiceObj, tServicesVoiceServiceParams, NULL, BBFDM_BOTH}, {0} }; /* *** Device.Services.VoiceService.{i}. *** */ DMOBJ tServicesVoiceServiceObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Capabilities", &DMREAD, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCapabilitiesObj, tServicesVoiceServiceCapabilitiesParams, NULL, BBFDM_BOTH}, -{"ReservedPorts", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceReservedPortsParams, NULL, BBFDM_BOTH}, -{"POTS", &DMREAD, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServicePOTSObj, tServicesVoiceServicePOTSParams, NULL, BBFDM_BOTH}, -{"SIP", &DMREAD, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceSIPObj, NULL, NULL, BBFDM_BOTH}, -{"CallControl", &DMREAD, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCallControlObj, NULL, NULL, BBFDM_BOTH}, -{"CallLog", &DMREAD, NULL, NULL, NULL, browseServicesVoiceServiceCallLogInst, NULL, NULL, tServicesVoiceServiceCallLogParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, -{"VoIPProfile", &DMWRITE, addObjServicesVoiceServiceVoIPProfile, delObjServicesVoiceServiceVoIPProfile, NULL, browseServicesVoiceServiceVoIPProfileInst, NULL, tServicesVoiceServiceVoIPProfileObj, tServicesVoiceServiceVoIPProfileParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, -{"CodecProfile", &DMWRITE, addObjServicesVoiceServiceCodecProfile, delObjServicesVoiceServiceCodecProfile, NULL, browseServicesVoiceServiceCodecProfileInst, NULL, NULL, tServicesVoiceServiceCodecProfileParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Capabilities", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCapabilitiesObj, tServicesVoiceServiceCapabilitiesParams, NULL, BBFDM_BOTH}, +{"ReservedPorts", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceReservedPortsParams, NULL, BBFDM_BOTH}, +{"POTS", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServicePOTSObj, tServicesVoiceServicePOTSParams, NULL, BBFDM_BOTH}, +{"SIP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceSIPObj, NULL, NULL, BBFDM_BOTH}, +{"CallControl", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCallControlObj, NULL, NULL, BBFDM_BOTH}, +{"CallLog", &DMREAD, NULL, NULL, NULL, browseServicesVoiceServiceCallLogInst, NULL, NULL, NULL, tServicesVoiceServiceCallLogParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, +{"VoIPProfile", &DMWRITE, addObjServicesVoiceServiceVoIPProfile, delObjServicesVoiceServiceVoIPProfile, NULL, browseServicesVoiceServiceVoIPProfileInst, NULL, NULL, tServicesVoiceServiceVoIPProfileObj, tServicesVoiceServiceVoIPProfileParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, +{"CodecProfile", &DMWRITE, addObjServicesVoiceServiceCodecProfile, delObjServicesVoiceServiceCodecProfile, NULL, browseServicesVoiceServiceCodecProfileInst, NULL, NULL, NULL, tServicesVoiceServiceCodecProfileParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, {0} }; diff --git a/dmtree/tr104/servicesvoiceservicecallcontrol.c b/dmtree/tr104/servicesvoiceservicecallcontrol.c index 0c6f91be..9d977a16 100644 --- a/dmtree/tr104/servicesvoiceservicecallcontrol.c +++ b/dmtree/tr104/servicesvoiceservicecallcontrol.c @@ -524,12 +524,12 @@ static int set_ServicesVoiceServiceCallControlCallingFeaturesSetSCREJ_CallingNum ***********************************************************************************************************************************/ /* *** Device.Services.VoiceService.{i}.CallControl. *** */ DMOBJ tServicesVoiceServiceCallControlObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Line", &DMWRITE, addObjServicesVoiceServiceCallControlLine, delObjServicesVoiceServiceCallControlLine, NULL, browseServicesVoiceServiceCallControlLineInst, NULL, NULL, tServicesVoiceServiceCallControlLineParams, get_voice_service_line_linker, BBFDM_BOTH, LIST_KEY{"DirectoryNumber", "Alias", NULL}}, -{"IncomingMap", &DMWRITE, addObjServicesVoiceServiceCallControlIncomingMap, delObjServicesVoiceServiceCallControlIncomingMap, NULL, browseServicesVoiceServiceCallControlIncomingMapInst, NULL, NULL, tServicesVoiceServiceCallControlIncomingMapParams, NULL, BBFDM_BOTH, LIST_KEY{"Line", "Extension", "Alias", NULL}}, -{"OutgoingMap", &DMWRITE, addObjServicesVoiceServiceCallControlOutgoingMap, delObjServicesVoiceServiceCallControlOutgoingMap, NULL, browseServicesVoiceServiceCallControlOutgoingMapInst, NULL, NULL, tServicesVoiceServiceCallControlOutgoingMapParams, NULL, BBFDM_BOTH, LIST_KEY{"Extension", "Line", "Alias", NULL}}, -{"NumberingPlan", &DMWRITE, addObjServicesVoiceServiceCallControlNumberingPlan, delObjServicesVoiceServiceCallControlNumberingPlan, NULL, browseServicesVoiceServiceCallControlNumberingPlanInst, NULL, NULL, tServicesVoiceServiceCallControlNumberingPlanParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, -{"CallingFeatures", &DMREAD, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCallControlCallingFeaturesObj, NULL, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Line", &DMWRITE, addObjServicesVoiceServiceCallControlLine, delObjServicesVoiceServiceCallControlLine, NULL, browseServicesVoiceServiceCallControlLineInst, NULL, NULL, NULL, tServicesVoiceServiceCallControlLineParams, get_voice_service_line_linker, BBFDM_BOTH, LIST_KEY{"DirectoryNumber", "Alias", NULL}}, +{"IncomingMap", &DMWRITE, addObjServicesVoiceServiceCallControlIncomingMap, delObjServicesVoiceServiceCallControlIncomingMap, NULL, browseServicesVoiceServiceCallControlIncomingMapInst, NULL, NULL, NULL, tServicesVoiceServiceCallControlIncomingMapParams, NULL, BBFDM_BOTH, LIST_KEY{"Line", "Extension", "Alias", NULL}}, +{"OutgoingMap", &DMWRITE, addObjServicesVoiceServiceCallControlOutgoingMap, delObjServicesVoiceServiceCallControlOutgoingMap, NULL, browseServicesVoiceServiceCallControlOutgoingMapInst, NULL, NULL, NULL, tServicesVoiceServiceCallControlOutgoingMapParams, NULL, BBFDM_BOTH, LIST_KEY{"Extension", "Line", "Alias", NULL}}, +{"NumberingPlan", &DMWRITE, addObjServicesVoiceServiceCallControlNumberingPlan, delObjServicesVoiceServiceCallControlNumberingPlan, NULL, browseServicesVoiceServiceCallControlNumberingPlanInst, NULL, NULL, NULL, tServicesVoiceServiceCallControlNumberingPlanParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, +{"CallingFeatures", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCallControlCallingFeaturesObj, NULL, NULL, BBFDM_BOTH}, {0} }; @@ -567,15 +567,15 @@ DMLEAF tServicesVoiceServiceCallControlNumberingPlanParams[] = { /* *** Device.Services.VoiceService.{i}.CallControl.CallingFeatures. *** */ DMOBJ tServicesVoiceServiceCallControlCallingFeaturesObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Set", &DMWRITE, addObjServicesVoiceServiceCallControlCallingFeaturesSet, delObjServicesVoiceServiceCallControlCallingFeaturesSet, NULL, browseServicesVoiceServiceCallControlCallingFeaturesSetInst, NULL, tServicesVoiceServiceCallControlCallingFeaturesSetObj, tServicesVoiceServiceCallControlCallingFeaturesSetParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Set", &DMWRITE, addObjServicesVoiceServiceCallControlCallingFeaturesSet, delObjServicesVoiceServiceCallControlCallingFeaturesSet, NULL, browseServicesVoiceServiceCallControlCallingFeaturesSetInst, NULL, NULL, tServicesVoiceServiceCallControlCallingFeaturesSetObj, tServicesVoiceServiceCallControlCallingFeaturesSetParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, {0} }; /* *** Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}. *** */ DMOBJ tServicesVoiceServiceCallControlCallingFeaturesSetObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"SCREJ", &DMWRITE, addObjServicesVoiceServiceCallControlCallingFeaturesSetSCREJ, delObjServicesVoiceServiceCallControlCallingFeaturesSetSCREJ, NULL, browseServicesVoiceServiceCallControlCallingFeaturesSetSCREJInst, NULL, NULL, tServicesVoiceServiceCallControlCallingFeaturesSetSCREJParams, NULL, BBFDM_BOTH, LIST_KEY{"CallingNumber", "Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"SCREJ", &DMWRITE, addObjServicesVoiceServiceCallControlCallingFeaturesSetSCREJ, delObjServicesVoiceServiceCallControlCallingFeaturesSetSCREJ, NULL, browseServicesVoiceServiceCallControlCallingFeaturesSetSCREJInst, NULL, NULL, NULL, tServicesVoiceServiceCallControlCallingFeaturesSetSCREJParams, NULL, BBFDM_BOTH, LIST_KEY{"CallingNumber", "Alias", NULL}}, {0} }; diff --git a/dmtree/tr104/servicesvoiceservicecapabilities.c b/dmtree/tr104/servicesvoiceservicecapabilities.c index 468d129f..dc50de45 100644 --- a/dmtree/tr104/servicesvoiceservicecapabilities.c +++ b/dmtree/tr104/servicesvoiceservicecapabilities.c @@ -178,9 +178,9 @@ static int get_ServicesVoiceServiceCapabilitiesCodec_PacketizationPeriod(char *r /* *** Device.Services.VoiceService.{i}.Capabilities. *** */ DMOBJ tServicesVoiceServiceCapabilitiesObj[] = { /* OBJ, permission, addobj, delobj, checkdep, browseinstobj nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"SIP", &DMREAD, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCapabilitiesSIPObj, NULL, NULL, BBFDM_BOTH}, -{"POTS", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCapabilitiesPOTSParams, NULL, BBFDM_BOTH}, -{"Codec", &DMREAD, NULL, NULL, NULL, browseServicesVoiceServiceCapabilitiesCodecInst, NULL, NULL, tServicesVoiceServiceCapabilitiesCodecParams, get_voice_service_capabilities_codec_linker, BBFDM_BOTH, LIST_KEY{"Alias", "Codec", "BitRate", NULL}}, +{"SIP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCapabilitiesSIPObj, NULL, NULL, BBFDM_BOTH}, +{"POTS", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCapabilitiesPOTSParams, NULL, BBFDM_BOTH}, +{"Codec", &DMREAD, NULL, NULL, NULL, browseServicesVoiceServiceCapabilitiesCodecInst, NULL, NULL, NULL, tServicesVoiceServiceCapabilitiesCodecParams, get_voice_service_capabilities_codec_linker, BBFDM_BOTH, LIST_KEY{"Alias", "Codec", "BitRate", NULL}}, {0} }; @@ -196,8 +196,8 @@ DMLEAF tServicesVoiceServiceCapabilitiesParams[] = { /* *** Device.Services.VoiceService.{i}.Capabilities.SIP. *** */ DMOBJ tServicesVoiceServiceCapabilitiesSIPObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Client", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCapabilitiesSIPClientParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Client", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCapabilitiesSIPClientParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr104/servicesvoiceservicepots.c b/dmtree/tr104/servicesvoiceservicepots.c index 6e2ab4e2..c9cdb422 100644 --- a/dmtree/tr104/servicesvoiceservicepots.c +++ b/dmtree/tr104/servicesvoiceservicepots.c @@ -193,8 +193,8 @@ static int set_ServicesVoiceServicePOTSFXSVoiceProcessing_EchoCancellationEnable ***********************************************************************************************************************************/ /* *** Device.Services.VoiceService.{i}.POTS. *** */ DMOBJ tServicesVoiceServicePOTSObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"FXS", &DMREAD, NULL, NULL, NULL, browseServicesVoiceServicePOTSFXSInst, NULL, tServicesVoiceServicePOTSFXSObj, tServicesVoiceServicePOTSFXSParams, NULL, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"FXS", &DMREAD, NULL, NULL, NULL, browseServicesVoiceServicePOTSFXSInst, NULL, NULL, tServicesVoiceServicePOTSFXSObj, tServicesVoiceServicePOTSFXSParams, NULL, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, {0} }; @@ -206,8 +206,8 @@ DMLEAF tServicesVoiceServicePOTSParams[] = { /* *** Device.Services.VoiceService.{i}.POTS.FXS.{i}. *** */ DMOBJ tServicesVoiceServicePOTSFXSObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"VoiceProcessing", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServicePOTSFXSVoiceProcessingParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"VoiceProcessing", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServicePOTSFXSVoiceProcessingParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr104/servicesvoiceservicesip.c b/dmtree/tr104/servicesvoiceservicesip.c index 2f830ec9..fc6a6ffc 100644 --- a/dmtree/tr104/servicesvoiceservicesip.c +++ b/dmtree/tr104/servicesvoiceservicesip.c @@ -983,16 +983,16 @@ static int set_ServicesVoiceServiceSIPNetworkFQDNServer_Port(char *refparam, str ***********************************************************************************************************************************/ /* *** Device.Services.VoiceService.{i}.SIP. *** */ DMOBJ tServicesVoiceServiceSIPObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Client", &DMWRITE, addObjServicesVoiceServiceSIPClient, delObjServicesVoiceServiceSIPClient, NULL, browseServicesVoiceServiceSIPClientInst, NULL, tServicesVoiceServiceSIPClientObj, tServicesVoiceServiceSIPClientParams, get_voice_service_sip_client_linker, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, -{"Network", &DMWRITE, addObjServicesVoiceServiceSIPNetwork, delObjServicesVoiceServiceSIPNetwork, NULL, browseServicesVoiceServiceSIPNetworkInst, NULL, tServicesVoiceServiceSIPNetworkObj, tServicesVoiceServiceSIPNetworkParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Client", &DMWRITE, addObjServicesVoiceServiceSIPClient, delObjServicesVoiceServiceSIPClient, NULL, browseServicesVoiceServiceSIPClientInst, NULL, NULL, tServicesVoiceServiceSIPClientObj, tServicesVoiceServiceSIPClientParams, get_voice_service_sip_client_linker, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, +{"Network", &DMWRITE, addObjServicesVoiceServiceSIPNetwork, delObjServicesVoiceServiceSIPNetwork, NULL, browseServicesVoiceServiceSIPNetworkInst, NULL, NULL, tServicesVoiceServiceSIPNetworkObj, tServicesVoiceServiceSIPNetworkParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, {0} }; /* *** Device.Services.VoiceService.{i}.SIP.Client.{i}. *** */ DMOBJ tServicesVoiceServiceSIPClientObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Contact", &DMWRITE, addObjServicesVoiceServiceSIPClientContact, delObjServicesVoiceServiceSIPClientContact, NULL, browseServicesVoiceServiceSIPClientContactInst, NULL, NULL, tServicesVoiceServiceSIPClientContactParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Contact", &DMWRITE, addObjServicesVoiceServiceSIPClientContact, delObjServicesVoiceServiceSIPClientContact, NULL, browseServicesVoiceServiceSIPClientContactInst, NULL, NULL, NULL, tServicesVoiceServiceSIPClientContactParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, {0} }; @@ -1019,8 +1019,8 @@ DMLEAF tServicesVoiceServiceSIPClientContactParams[] = { /* *** Device.Services.VoiceService.{i}.SIP.Network.{i}. *** */ DMOBJ tServicesVoiceServiceSIPNetworkObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"FQDNServer", &DMWRITE, addObjServicesVoiceServiceSIPNetworkFQDNServer, delObjServicesVoiceServiceSIPNetworkFQDNServer, NULL, browseServicesVoiceServiceSIPNetworkFQDNServerInst, NULL, NULL, tServicesVoiceServiceSIPNetworkFQDNServerParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", "Domain", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"FQDNServer", &DMWRITE, addObjServicesVoiceServiceSIPNetworkFQDNServer, delObjServicesVoiceServiceSIPNetworkFQDNServer, NULL, browseServicesVoiceServiceSIPNetworkFQDNServerInst, NULL, NULL, NULL, tServicesVoiceServiceSIPNetworkFQDNServerParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", "Domain", NULL}}, {0} }; diff --git a/dmtree/tr104/servicesvoiceservicevoipprofile.c b/dmtree/tr104/servicesvoiceservicevoipprofile.c index e9f53533..decbac5e 100644 --- a/dmtree/tr104/servicesvoiceservicevoipprofile.c +++ b/dmtree/tr104/servicesvoiceservicevoipprofile.c @@ -282,8 +282,8 @@ static int set_ServicesVoiceServiceVoIPProfileRTPSRTP_EncryptionKeySizes(char *r ***********************************************************************************************************************************/ /* *** Device.Services.VoiceService.{i}.VoIPProfile.{i}. *** */ DMOBJ tServicesVoiceServiceVoIPProfileObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"RTP", &DMREAD, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceVoIPProfileRTPObj, tServicesVoiceServiceVoIPProfileRTPParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"RTP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceVoIPProfileRTPObj, tServicesVoiceServiceVoIPProfileRTPParams, NULL, BBFDM_BOTH}, {0} }; @@ -295,9 +295,9 @@ DMLEAF tServicesVoiceServiceVoIPProfileParams[] = { /* *** Device.Services.VoiceService.{i}.VoIPProfile.{i}.RTP. *** */ DMOBJ tServicesVoiceServiceVoIPProfileRTPObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"RTCP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceVoIPProfileRTPRTCPParams, NULL, BBFDM_BOTH}, -{"SRTP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceVoIPProfileRTPSRTPParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"RTCP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceVoIPProfileRTPRTCPParams, NULL, BBFDM_BOTH}, +{"SRTP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceVoIPProfileRTPSRTPParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr143/diagnostics.c b/dmtree/tr143/diagnostics.c index dda2774b..48b95f45 100644 --- a/dmtree/tr143/diagnostics.c +++ b/dmtree/tr143/diagnostics.c @@ -1479,27 +1479,6 @@ static int set_IPDiagnosticsServerSelectionDiagnostics_Protocol(char *refparam, return 0; } -static int get_IPDiagnosticsServerSelectionDiagnostics_Port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = get_diagnostics_option_fallback_def("serverselection", "port", "1"); - return 0; -} - -static int set_IPDiagnosticsServerSelectionDiagnostics_Port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1","65535"}}, 1)) - return FAULT_9007; - return 0; - case VALUESET: - SERVERSELECTION_STOP; - set_diagnostics_option("serverselection", "port", value); - return 0; - } - return 0; -} - static int get_IPDiagnosticsServerSelectionDiagnostics_HostList(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { *value = get_diagnostics_option("serverselection", "HostList"); @@ -1636,13 +1615,13 @@ static int browseIPDiagnosticsUploadDiagnosticsPerConnectionResultInst(struct dm /* *** Device.IP.Diagnostics. *** */ DMOBJ tIPDiagnosticsObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"IPPing", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tIPDiagnosticsIPPingParams, NULL, BBFDM_CWMP}, -{"TraceRoute", &DMREAD, NULL, NULL, NULL, NULL, NULL, tIPDiagnosticsTraceRouteObj, tIPDiagnosticsTraceRouteParams, NULL, BBFDM_CWMP}, -{"DownloadDiagnostics", &DMREAD, NULL, NULL, NULL, NULL, NULL, tIPDiagnosticsDownloadDiagnosticsObj, tIPDiagnosticsDownloadDiagnosticsParams, NULL, BBFDM_CWMP}, -{"UploadDiagnostics", &DMREAD, NULL, NULL, NULL, NULL, NULL, tIPDiagnosticsUploadDiagnosticsObj, tIPDiagnosticsUploadDiagnosticsParams, NULL, BBFDM_CWMP}, -{"UDPEchoDiagnostics", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tIPDiagnosticsUDPEchoDiagnosticsParams, NULL, BBFDM_CWMP}, -{"ServerSelectionDiagnostics", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tIPDiagnosticsServerSelectionDiagnosticsParams, NULL, BBFDM_CWMP}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"IPPing", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tIPDiagnosticsIPPingParams, NULL, BBFDM_CWMP}, +{"TraceRoute", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tIPDiagnosticsTraceRouteObj, tIPDiagnosticsTraceRouteParams, NULL, BBFDM_CWMP}, +{"DownloadDiagnostics", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tIPDiagnosticsDownloadDiagnosticsObj, tIPDiagnosticsDownloadDiagnosticsParams, NULL, BBFDM_CWMP}, +{"UploadDiagnostics", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tIPDiagnosticsUploadDiagnosticsObj, tIPDiagnosticsUploadDiagnosticsParams, NULL, BBFDM_CWMP}, +{"UDPEchoDiagnostics", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tIPDiagnosticsUDPEchoDiagnosticsParams, NULL, BBFDM_CWMP}, +{"ServerSelectionDiagnostics", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tIPDiagnosticsServerSelectionDiagnosticsParams, NULL, BBFDM_CWMP}, {0} }; @@ -1687,8 +1666,8 @@ DMLEAF tIPDiagnosticsIPPingParams[] = { /* *** Device.IP.Diagnostics.TraceRoute. *** */ DMOBJ tIPDiagnosticsTraceRouteObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"RouteHops", &DMREAD, NULL, NULL, NULL, browseIPDiagnosticsTraceRouteRouteHopsInst, NULL, NULL, tIPDiagnosticsTraceRouteRouteHopsParams, NULL, BBFDM_CWMP}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"RouteHops", &DMREAD, NULL, NULL, NULL, browseIPDiagnosticsTraceRouteRouteHopsInst, NULL, NULL, NULL, tIPDiagnosticsTraceRouteRouteHopsParams, NULL, BBFDM_CWMP}, {0} }; @@ -1720,8 +1699,8 @@ DMLEAF tIPDiagnosticsTraceRouteRouteHopsParams[] = { /* *** Device.IP.Diagnostics.DownloadDiagnostics. *** */ DMOBJ tIPDiagnosticsDownloadDiagnosticsObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"PerConnectionResult", &DMREAD, NULL, NULL, NULL, browseIPDiagnosticsDownloadDiagnosticsPerConnectionResultInst, NULL, NULL, tIPDiagnosticsDownloadDiagnosticsPerConnectionResultParams, NULL, BBFDM_CWMP}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"PerConnectionResult", &DMREAD, NULL, NULL, NULL, browseIPDiagnosticsDownloadDiagnosticsPerConnectionResultInst, NULL, NULL, NULL, tIPDiagnosticsDownloadDiagnosticsPerConnectionResultParams, NULL, BBFDM_CWMP}, {0} }; @@ -1769,8 +1748,8 @@ DMLEAF tIPDiagnosticsDownloadDiagnosticsPerConnectionResultParams[] = { /* *** Device.IP.Diagnostics.UploadDiagnostics. *** */ DMOBJ tIPDiagnosticsUploadDiagnosticsObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"PerConnectionResult", &DMREAD, NULL, NULL, NULL, browseIPDiagnosticsUploadDiagnosticsPerConnectionResultInst, NULL, NULL, tIPDiagnosticsUploadDiagnosticsPerConnectionResultParams, NULL, BBFDM_CWMP}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"PerConnectionResult", &DMREAD, NULL, NULL, NULL, browseIPDiagnosticsUploadDiagnosticsPerConnectionResultInst, NULL, NULL, NULL, tIPDiagnosticsUploadDiagnosticsPerConnectionResultParams, NULL, BBFDM_CWMP}, {0} }; @@ -1844,7 +1823,6 @@ DMLEAF tIPDiagnosticsServerSelectionDiagnosticsParams[] = { {"Interface", &DMWRITE, DMT_STRING, get_IPDiagnosticsServerSelectionDiagnostics_Interface, set_IPDiagnosticsServerSelectionDiagnostics_Interface, BBFDM_CWMP}, {"ProtocolVersion", &DMWRITE, DMT_STRING, get_IPDiagnosticsServerSelectionDiagnostics_ProtocolVersion, set_IPDiagnosticsServerSelectionDiagnostics_ProtocolVersion, BBFDM_CWMP}, {"Protocol", &DMWRITE, DMT_STRING, get_IPDiagnosticsServerSelectionDiagnostics_Protocol, set_IPDiagnosticsServerSelectionDiagnostics_Protocol, BBFDM_CWMP}, -{CUSTOM_PREFIX"Port", &DMWRITE, DMT_UNINT, get_IPDiagnosticsServerSelectionDiagnostics_Port, set_IPDiagnosticsServerSelectionDiagnostics_Port, BBFDM_CWMP}, {"HostList", &DMWRITE, DMT_STRING, get_IPDiagnosticsServerSelectionDiagnostics_HostList, set_IPDiagnosticsServerSelectionDiagnostics_HostList, BBFDM_CWMP}, {"NumberOfRepetitions", &DMWRITE, DMT_UNINT, get_IPDiagnosticsServerSelectionDiagnostics_NumberOfRepetitions, set_IPDiagnosticsServerSelectionDiagnostics_NumberOfRepetitions, BBFDM_CWMP}, {"Timeout", &DMWRITE, DMT_UNINT, get_IPDiagnosticsServerSelectionDiagnostics_Timeout, set_IPDiagnosticsServerSelectionDiagnostics_Timeout, BBFDM_CWMP}, diff --git a/dmtree/tr181/atm.c b/dmtree/tr181/atm.c index 98d75427..8e9788fc 100644 --- a/dmtree/tr181/atm.c +++ b/dmtree/tr181/atm.c @@ -379,15 +379,15 @@ static int browseAtmLinkInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre /*** ATM. ***/ DMOBJ tATMObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Link", &DMWRITE, add_atm_link, delete_atm_link, NULL, browseAtmLinkInst, NULL, tATMLinkObj, tATMLinkParams, get_atm_linker, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Link", &DMWRITE, add_atm_link, delete_atm_link, NULL, browseAtmLinkInst, NULL, NULL, tATMLinkObj, tATMLinkParams, get_atm_linker, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, {0} }; /*** ATM.Link. ***/ DMOBJ tATMLinkObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tATMLinkStatsParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tATMLinkStatsParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/bridging.c b/dmtree/tr181/bridging.c index 11231373..9be12b24 100644 --- a/dmtree/tr181/bridging.c +++ b/dmtree/tr181/bridging.c @@ -2299,7 +2299,7 @@ static int set_BridgingBridgePort_DefaultUserPriority(char *refparam, struct dmc return 0; } -static void get_priority_list(char *uci_opt_name, void *data, char **value) +void bridging_get_priority_list(char *uci_opt_name, void *data, char **value) { struct uci_list *v= NULL; struct uci_element *e = NULL; @@ -2326,7 +2326,7 @@ static void get_priority_list(char *uci_opt_name, void *data, char **value) dmasprintf(value, "%s", uci_value); } -static void set_priority_list(char *uci_opt_name, void *data, char *value) +void bridging_set_priority_list(char *uci_opt_name, void *data, char *value) { char buf[16]; char *pch, *pchr; @@ -2349,7 +2349,7 @@ static void set_priority_list(char *uci_opt_name, void *data, char *value) static int get_BridgingBridgePort_PriorityRegeneration(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - get_priority_list("ingress_qos_mapping", data, value); + bridging_get_priority_list("ingress_qos_mapping", data, value); return 0; } @@ -2362,54 +2362,12 @@ static int set_BridgingBridgePort_PriorityRegeneration(char *refparam, struct dm break; case VALUESET: - set_priority_list("ingress_qos_mapping", data, value); + bridging_set_priority_list("ingress_qos_mapping", data, value); break; } return 0; } -static int get_BridgingBridgePort_Egress_PriorityRegeneration(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - get_priority_list("egress_qos_mapping", data, value); - return 0; -} - -static int set_BridgingBridgePort_Egress_PriorityRegeneration(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_unsignedInt_list(value, 8, 8, -1, RANGE_ARGS{{"0","7"}}, 1)) - return FAULT_9007; - return 0; - - case VALUESET: - set_priority_list("egress_qos_mapping", data, value); - return 0; - } - return 0; -} - -static int get_BridgingBridgePort_DSCP_Eth_Priority_Map(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - get_priority_list("dscp2pbit", data, value); - return 0; -} - -static int set_BridgingBridgePort_DSCP_Eth_Priority_Map(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_unsignedInt_list(value, 1, 64, -1, RANGE_ARGS{{"0","7"}}, 1)) - return FAULT_9007; - return 0; - - case VALUESET: - set_priority_list("dscp2pbit", data, value); - return 0; - } - return 0; -} - static int get_BridgingBridgePort_PVID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { *value = dmuci_get_value_by_section_fallback_def(((struct bridge_port_args *)data)->bridge_port_sec, "vid", "1"); @@ -3385,9 +3343,9 @@ static int browseBridgingBridgeVLANPortInst(struct dmctx *dmctx, DMNODE *parent_ ***********************************************************************************************************************************/ /* *** Device.Bridging. *** */ DMOBJ tBridgingObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Bridge", &DMWRITE, addObjBridgingBridge, delObjBridgingBridge, NULL, browseBridgingBridgeInst, NULL, tBridgingBridgeObj, tBridgingBridgeParams, get_linker_bridge, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, -{"ProviderBridge", &DMWRITE, addObjBridgingProviderBridge , delObjBridgingProviderBridge, NULL, browseBridgingProviderBridgeInst, NULL, NULL, tBridgingProviderBridgeParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Bridge", &DMWRITE, addObjBridgingBridge, delObjBridgingBridge, NULL, browseBridgingBridgeInst, NULL, NULL, tBridgingBridgeObj, tBridgingBridgeParams, get_linker_bridge, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, +{"ProviderBridge", &DMWRITE, addObjBridgingProviderBridge, delObjBridgingProviderBridge, NULL, browseBridgingProviderBridgeInst, NULL, NULL, NULL, tBridgingProviderBridgeParams, NULL, BBFDM_BOTH}, {0} }; @@ -3406,10 +3364,10 @@ DMLEAF tBridgingParams[] = { /*** Bridging.Bridge.{i}. ***/ DMOBJ tBridgingBridgeObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Port", &DMWRITE, addObjBridgingBridgePort, delObjBridgingBridgePort, NULL, browseBridgingBridgePortInst, NULL, tBridgingBridgePortObj, tBridgingBridgePortParams, get_linker_br_port, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, -{"VLAN", &DMWRITE, addObjBridgingBridgeVLAN, delObjBridgingBridgeVLAN, NULL, browseBridgingBridgeVLANInst, NULL, NULL, tBridgingBridgeVLANParams, get_linker_br_vlan, BBFDM_BOTH, LIST_KEY{"VLANID", "Alias", NULL}}, -{"VLANPort", &DMWRITE, addObjBridgingBridgeVLANPort, delObjBridgingBridgeVLANPort, NULL, browseBridgingBridgeVLANPortInst, NULL, NULL, tBridgingBridgeVLANPortParams, NULL, BBFDM_BOTH, LIST_KEY{"VLAN", "Port", "Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Port", &DMWRITE, addObjBridgingBridgePort, delObjBridgingBridgePort, NULL, browseBridgingBridgePortInst, NULL, NULL, tBridgingBridgePortObj, tBridgingBridgePortParams, get_linker_br_port, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, +{"VLAN", &DMWRITE, addObjBridgingBridgeVLAN, delObjBridgingBridgeVLAN, NULL, browseBridgingBridgeVLANInst, NULL, NULL, NULL, tBridgingBridgeVLANParams, get_linker_br_vlan, BBFDM_BOTH, LIST_KEY{"VLANID", "Alias", NULL}}, +{"VLANPort", &DMWRITE, addObjBridgingBridgeVLANPort, delObjBridgingBridgeVLANPort, NULL, browseBridgingBridgeVLANPortInst, NULL, NULL, NULL, tBridgingBridgeVLANPortParams, NULL, BBFDM_BOTH, LIST_KEY{"VLAN", "Port", "Alias", NULL}}, {0} }; @@ -3427,8 +3385,8 @@ DMLEAF tBridgingBridgeParams[] = { /*** Bridging.Bridge.{i}.Port.{i}. ***/ DMOBJ tBridgingBridgePortObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tBridgingBridgePortStatsParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tBridgingBridgePortStatsParams, NULL, BBFDM_BOTH}, {0} }; @@ -3444,8 +3402,6 @@ DMLEAF tBridgingBridgePortParams[] = { //{"Type", &DMWRITE, DMT_STRING, get_BridgingBridgePort_Type, set_BridgingBridgePort_Type, BBFDM_BOTH}, {"DefaultUserPriority", &DMWRITE, DMT_UNINT, get_BridgingBridgePort_DefaultUserPriority, set_BridgingBridgePort_DefaultUserPriority, BBFDM_BOTH}, {"PriorityRegeneration", &DMWRITE, DMT_STRING, get_BridgingBridgePort_PriorityRegeneration, set_BridgingBridgePort_PriorityRegeneration, BBFDM_BOTH}, -{"X_IOPSYS_EU_EgressPriorityRegeneration", &DMWRITE, DMT_STRING, get_BridgingBridgePort_Egress_PriorityRegeneration, set_BridgingBridgePort_Egress_PriorityRegeneration, BBFDM_BOTH}, -{"X_IOPSYS_EU_DSCPEthernetPriorityMapping", &DMWRITE, DMT_STRING, get_BridgingBridgePort_DSCP_Eth_Priority_Map, set_BridgingBridgePort_DSCP_Eth_Priority_Map, BBFDM_BOTH}, //{"PortState", &DMREAD, DMT_STRING, get_BridgingBridgePort_PortState, NULL, BBFDM_BOTH}, {"PVID", &DMWRITE, DMT_INT, get_BridgingBridgePort_PVID, set_BridgingBridgePort_PVID, BBFDM_BOTH}, {"TPID", &DMWRITE, DMT_UNINT, get_BridgingBridgePort_TPID, set_BridgingBridgePort_TPID, BBFDM_BOTH}, diff --git a/dmtree/tr181/bridging.h b/dmtree/tr181/bridging.h index 2da18e4f..7c100950 100644 --- a/dmtree/tr181/bridging.h +++ b/dmtree/tr181/bridging.h @@ -26,4 +26,7 @@ extern DMOBJ tBridgingBridgePortObj[]; extern DMLEAF tBridgingBridgePortStatsParams[]; extern DMLEAF tBridgingProviderBridgeParams[]; +void bridging_get_priority_list(char *uci_opt_name, void *data, char **value); +void bridging_set_priority_list(char *uci_opt_name, void *data, char *value); + #endif diff --git a/dmtree/tr181/device.c b/dmtree/tr181/device.c index 95c1d732..2bffb983 100644 --- a/dmtree/tr181/device.c +++ b/dmtree/tr181/device.c @@ -15,12 +15,6 @@ #include "managementserver.h" #include "times.h" #include "upnp.h" -#include "x_iopsys_eu_igmp.h" -#include "x_iopsys_eu_mld.h" -#include "x_iopsys_eu_syslog.h" -#include "x_iopsys_eu_owsd.h" -#include "x_iopsys_eu_dropbear.h" -#include "x_iopsys_eu_buttons.h" #include "ip.h" #include "ethernet.h" #include "bridging.h" @@ -54,8 +48,8 @@ /* *** BBFDM *** */ DMOBJ tEntry181Obj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Device", &DMREAD, NULL, NULL, NULL, NULL, NULL, tDeviceObj, tDeviceParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Device", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDeviceObj, tDeviceParams, NULL, BBFDM_BOTH}, {0} }; @@ -67,49 +61,39 @@ DMLEAF tDeviceParams[] = { }; DMOBJ tDeviceObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"DeviceInfo", &DMREAD, NULL, NULL, NULL, NULL, NULL, tDeviceInfoObj, tDeviceInfoParams, NULL, BBFDM_BOTH}, -{"ManagementServer", &DMREAD, NULL, NULL, "file:/etc/config/cwmp", NULL, NULL, NULL, tManagementServerParams, NULL, BBFDM_BOTH}, -{"Time", &DMREAD, NULL, NULL, "file:/etc/config/system", NULL, NULL, NULL, tTimeParams, NULL, BBFDM_BOTH}, -{"UPnP", &DMREAD, NULL, NULL, "file:/etc/config/upnpd", NULL, NULL, tUPnPObj, NULL, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"DeviceInfo", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDeviceInfoObj, tDeviceInfoParams, NULL, BBFDM_BOTH}, +{"ManagementServer", &DMREAD, NULL, NULL, "file:/etc/config/cwmp", NULL, NULL, NULL, NULL, tManagementServerParams, NULL, BBFDM_BOTH}, +{"Time", &DMREAD, NULL, NULL, "file:/etc/config/system", NULL, NULL, NULL, NULL, tTimeParams, NULL, BBFDM_BOTH}, +{"UPnP", &DMREAD, NULL, NULL, "file:/etc/config/upnpd", NULL, NULL, NULL, tUPnPObj, NULL, NULL, BBFDM_BOTH}, #ifdef BBF_TR104 -{"Services", &DMREAD, NULL, NULL, NULL, NULL, NULL, tServicesObj, NULL, NULL, BBFDM_BOTH}, +{"Services", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tServicesObj, NULL, NULL, BBFDM_BOTH}, #endif -{CUSTOM_PREFIX"Syslog", &DMREAD, NULL, NULL, "file:/etc/config/system", NULL, NULL, NULL, tSe_SyslogParam, NULL, BBFDM_BOTH}, -{CUSTOM_PREFIX"OWSD", &DMREAD, NULL, NULL, "file:/etc/config/owsd", NULL, NULL, X_IOPSYS_EU_OWSDObj, X_IOPSYS_EU_OWSDParams, NULL, BBFDM_BOTH}, -{CUSTOM_PREFIX"IGMP", &DMREAD, NULL, NULL, "file:/etc/config/mcast", NULL, NULL, X_IOPSYS_EU_IGMPObj, X_IOPSYS_EU_IGMPParams, NULL, BBFDM_BOTH}, -{CUSTOM_PREFIX"MLD", &DMREAD, NULL, NULL, "file:/etc/config/mcast", NULL, NULL, X_IOPSYS_EU_MLDObj, X_IOPSYS_EU_MLDParams, NULL, BBFDM_BOTH}, -{CUSTOM_PREFIX"Dropbear", &DMWRITE, add_dropbear_instance, delete_dropbear_instance, "file:/etc/config/dropbear", browseXIopsysEuDropbear, NULL, NULL, X_IOPSYS_EU_DropbearParams, NULL, BBFDM_BOTH}, -{CUSTOM_PREFIX"Buttons", &DMREAD, NULL, NULL, "file:/etc/config/buttons", browseXIopsysEuButton, NULL, NULL, X_IOPSYS_EU_ButtonParams, NULL, BBFDM_BOTH}, -{"Bridging", &DMREAD, NULL, NULL, "file:/etc/config/network", NULL, NULL, tBridgingObj, tBridgingParams, NULL, BBFDM_BOTH}, -{"WiFi", &DMREAD, NULL, NULL, "file:/etc/config/wireless", NULL, NULL, tWiFiObj, tWiFiParams, NULL, BBFDM_BOTH}, -{"IP", &DMREAD, NULL, NULL, "file:/etc/config/network", NULL, NULL, tIPObj, tIPParams, NULL, BBFDM_BOTH}, -{"Ethernet", &DMREAD, NULL, NULL, "file:/etc/config/network", NULL, NULL, tEthernetObj, tEthernetParams, NULL, BBFDM_BOTH}, -{"DSL", &DMREAD, NULL, NULL, "file:/etc/config/dsl", NULL, NULL, tDSLObj, tDSLParams, NULL, BBFDM_BOTH}, -{"FAST", &DMREAD, NULL, NULL, "ubus:fast", NULL, NULL, tFASTObj, NULL, NULL, BBFDM_BOTH}, -{"ATM", &DMREAD, NULL, NULL, "file:/etc/config/dsl", NULL, NULL, tATMObj, NULL, NULL, BBFDM_BOTH}, -{"PTM", &DMREAD, NULL, NULL, "file:/etc/config/dsl", NULL, NULL, tPTMObj, NULL, NULL, BBFDM_BOTH}, -{"DHCPv4", &DMREAD, NULL, NULL, "file:/lib/netifd/proto/dhcp.sh", NULL, NULL, tDHCPv4Obj, tDHCPv4Params, NULL, BBFDM_BOTH}, -{"DHCPv6", &DMREAD, NULL, NULL, "file:/lib/netifd/proto/dhcpv6.sh", NULL, NULL, tDHCPv6Obj, tDHCPv6Params, NULL, BBFDM_BOTH}, -#ifdef GENERIC_OPENWRT -{"Hosts", &DMREAD, NULL, NULL, NULL, NULL, NULL, tHostsObj, tHostsParams, NULL, BBFDM_BOTH}, -#else -{"Hosts", &DMREAD, NULL, NULL, "ubus:router.network->hosts", NULL, NULL, tHostsObj, tHostsParams, NULL, BBFDM_BOTH}, -#endif -{"NAT", &DMREAD, NULL, NULL, "file:/etc/config/firewall", NULL, NULL, tNATObj, tNATParams, NULL, BBFDM_BOTH}, -{"PPP", &DMREAD, NULL, NULL, "file:/lib/netifd/proto/ppp.sh", NULL, NULL, tPPPObj, tPPPParams, NULL, BBFDM_BOTH}, -{"Routing", &DMREAD, NULL, NULL, "file:/etc/config/network", NULL, NULL, tRoutingObj, tRoutingParams, NULL, BBFDM_BOTH}, -{"Firewall", &DMREAD, NULL, NULL, "file:/etc/config/firewall", NULL, NULL, tFirewallObj, tFirewallParams, NULL, BBFDM_BOTH}, -{"DNS", &DMREAD, NULL, NULL, "file:/etc/config/dhcp", NULL, NULL, tDNSObj, tDNSParams, NULL, BBFDM_BOTH}, -{"Users", &DMREAD, NULL, NULL, "file:/etc/config/users", NULL, NULL, tUsersObj, tUsersParams, NULL, BBFDM_BOTH}, -{"IEEE1905", &DMREAD, NULL, NULL, "file:/etc/config/ieee1905,/etc/config/topology;ubus:ieee1905->info,topology->dump", NULL, NULL, tIEEE1905Obj, tIEEE1905Params, NULL, BBFDM_BOTH}, -{"InterfaceStack", &DMREAD, NULL, NULL, "file:/etc/config/network", browseInterfaceStackInst, NULL, NULL, tInterfaceStackParams, NULL, BBFDM_BOTH}, -{"USB", &DMREAD, NULL, NULL, NULL, NULL, NULL, tUSBObj, tUSBParams, NULL, BBFDM_BOTH}, -{"GRE", &DMREAD, NULL, NULL, "file:/lib/netifd/proto/gre.sh", NULL, NULL, tGREObj, tGREParams, NULL, BBFDM_BOTH}, -{"DynamicDNS", &DMREAD, NULL, NULL, "file:/etc/config/ddns", NULL, NULL, tDynamicDNSObj, tDynamicDNSParams, NULL, BBFDM_BOTH}, -{"QoS", &DMREAD, NULL, NULL, "file:/etc/config/qos", NULL, NULL, tQoSObj, tQoSParams, NULL, BBFDM_BOTH}, -{"LANConfigSecurity", &DMREAD, NULL, NULL, "file:/etc/config/users", NULL, NULL, NULL, tLANConfigSecurityParams, NULL, BBFDM_BOTH}, -{"SoftwareModules", &DMREAD, NULL, NULL, "ubus:swmodules", NULL, NULL, tSoftwareModulesObj, tSoftwareModulesParams, NULL, BBFDM_BOTH}, -{"Security", &DMREAD, NULL, NULL, NULL, NULL, NULL, tSecurityObj, tSecurityParams, NULL, BBFDM_BOTH}, +{"Bridging", &DMREAD, NULL, NULL, "file:/etc/config/network", NULL, NULL, NULL, tBridgingObj, tBridgingParams, NULL, BBFDM_BOTH}, +{"WiFi", &DMREAD, NULL, NULL, "file:/etc/config/wireless", NULL, NULL, NULL, tWiFiObj, tWiFiParams, NULL, BBFDM_BOTH}, +{"IP", &DMREAD, NULL, NULL, "file:/etc/config/network", NULL, NULL, NULL, tIPObj, tIPParams, NULL, BBFDM_BOTH}, +{"Ethernet", &DMREAD, NULL, NULL, "file:/etc/config/network", NULL, NULL, NULL, tEthernetObj, tEthernetParams, NULL, BBFDM_BOTH}, +{"DSL", &DMREAD, NULL, NULL, "file:/etc/config/dsl", NULL, NULL, NULL, tDSLObj, tDSLParams, NULL, BBFDM_BOTH}, +{"FAST", &DMREAD, NULL, NULL, "ubus:fast", NULL, NULL, NULL, tFASTObj, NULL, NULL, BBFDM_BOTH}, +{"ATM", &DMREAD, NULL, NULL, "file:/etc/config/dsl", NULL, NULL, NULL, tATMObj, NULL, NULL, BBFDM_BOTH}, +{"PTM", &DMREAD, NULL, NULL, "file:/etc/config/dsl", NULL, NULL, NULL, tPTMObj, NULL, NULL, BBFDM_BOTH}, +{"DHCPv4", &DMREAD, NULL, NULL, "file:/lib/netifd/proto/dhcp.sh", NULL, NULL, NULL, tDHCPv4Obj, tDHCPv4Params, NULL, BBFDM_BOTH}, +{"DHCPv6", &DMREAD, NULL, NULL, "file:/lib/netifd/proto/dhcpv6.sh", NULL, NULL, NULL, tDHCPv6Obj, tDHCPv6Params, NULL, BBFDM_BOTH}, +{"Hosts", &DMREAD, NULL, NULL, "ubus:router.network->hosts", NULL, NULL, NULL, tHostsObj, tHostsParams, NULL, BBFDM_BOTH}, +{"NAT", &DMREAD, NULL, NULL, "file:/etc/config/firewall", NULL, NULL, NULL, tNATObj, tNATParams, NULL, BBFDM_BOTH}, +{"PPP", &DMREAD, NULL, NULL, "file:/lib/netifd/proto/ppp.sh", NULL, NULL, NULL, tPPPObj, tPPPParams, NULL, BBFDM_BOTH}, +{"Routing", &DMREAD, NULL, NULL, "file:/etc/config/network", NULL, NULL, NULL, tRoutingObj, tRoutingParams, NULL, BBFDM_BOTH}, +{"Firewall", &DMREAD, NULL, NULL, "file:/etc/config/firewall", NULL, NULL, NULL, tFirewallObj, tFirewallParams, NULL, BBFDM_BOTH}, +{"DNS", &DMREAD, NULL, NULL, "file:/etc/config/dhcp", NULL, NULL, NULL, tDNSObj, tDNSParams, NULL, BBFDM_BOTH}, +{"Users", &DMREAD, NULL, NULL, "file:/etc/config/users", NULL, NULL, NULL, tUsersObj, tUsersParams, NULL, BBFDM_BOTH}, +{"IEEE1905", &DMREAD, NULL, NULL, "file:/etc/config/ieee1905,/etc/config/topology;ubus:ieee1905->info,topology->dump", NULL, NULL, NULL, tIEEE1905Obj, tIEEE1905Params, NULL, BBFDM_BOTH}, +{"InterfaceStack", &DMREAD, NULL, NULL, "file:/etc/config/network", browseInterfaceStackInst, NULL, NULL, NULL, tInterfaceStackParams, NULL, BBFDM_BOTH}, +{"USB", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tUSBObj, tUSBParams, NULL, BBFDM_BOTH}, +{"GRE", &DMREAD, NULL, NULL, "file:/lib/netifd/proto/gre.sh", NULL, NULL, NULL, tGREObj, tGREParams, NULL, BBFDM_BOTH}, +{"DynamicDNS", &DMREAD, NULL, NULL, "file:/etc/config/ddns", NULL, NULL, NULL, tDynamicDNSObj, tDynamicDNSParams, NULL, BBFDM_BOTH}, +{"QoS", &DMREAD, NULL, NULL, "file:/etc/config/qos", NULL, NULL, NULL, tQoSObj, tQoSParams, NULL, BBFDM_BOTH}, +{"LANConfigSecurity", &DMREAD, NULL, NULL, "file:/etc/config/users", NULL, NULL, NULL, NULL, tLANConfigSecurityParams, NULL, BBFDM_BOTH}, +{"SoftwareModules", &DMREAD, NULL, NULL, "ubus:swmodules", NULL, NULL, NULL, tSoftwareModulesObj, tSoftwareModulesParams, NULL, BBFDM_BOTH}, +{"Security", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tSecurityObj, tSecurityParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/deviceinfo-iopsyswrt.c b/dmtree/tr181/deviceinfo-iopsyswrt.c deleted file mode 100644 index 73914087..00000000 --- a/dmtree/tr181/deviceinfo-iopsyswrt.c +++ /dev/null @@ -1,216 +0,0 @@ -#include "os.h" - -#include - -/*#Device.DeviceInfo.Manufacturer!UCI:cwmp/cpe,cpe/manufacturer*/ -char * os__get_deviceid_manufacturer() -{ - char *v; - dmuci_get_option_value_string("cwmp","cpe","manufacturer", &v); - if (v[0] == '\0') { - db_get_value_string("device", "deviceinfo", "Manufacturer", &v); - return v; - } - return v; -} - -/*#Device.DeviceInfo.ProductClass!UCI:cwmp/cpe,cpe/product_class*/ -char * os__get_deviceid_productclass() -{ - char *v; - dmuci_get_option_value_string("cwmp", "cpe", "product_class", &v); - if (v[0] == '\0') { - db_get_value_string("device", "deviceinfo", "ProductClass", &v); - return v; - } - return v; -} - -char * os__get_deviceid_serialnumber() -{ - char *v; - db_get_value_string("device", "deviceinfo", "SerialNumber", &v); - return v; -} - -char * os__get_softwareversion() -{ - char *v; - db_get_value_string("device", "deviceinfo", "SoftwareVersion", &v); - return v; -} - -int os__get_device_hardwareversion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - db_get_value_string("device", "deviceinfo", "HardwareVersion", value); - return 0; -} - -int os__get_device_devicecategory(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - db_get_value_string("device", "deviceinfo", "DeviceCategory", value); - return 0; -} - -int os__get_device_additionalhardwareversion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - db_get_value_string("device", "deviceinfo", "AdditionalHardwareVersion", value); - return 0; -} - -int os__get_device_additionalsoftwareversion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - db_get_value_string("device", "deviceinfo", "AdditionalSoftwareVersion", value); - return 0; -} - -/*#Device.DeviceInfo.ModelName!UCI:cwmp/cpe,cpe/model_name*/ -int os__get_device_modelname(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_option_value_string("cwmp", "cpe", "model_name", value); - if (*value[0] == '\0') - db_get_value_string("device", "deviceinfo", "ModelName", value); - return 0; -} - -/*#Device.DeviceInfo.Description!UCI:cwmp/cpe,cpe/description*/ -int os__get_device_description(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_option_value_string("cwmp", "cpe", "description", value); - if (*value[0] == '\0') - db_get_value_string("device", "deviceinfo", "Description", value); - return 0; -} - -/*#Device.DeviceInfo.ManufacturerOUI!UCI:cwmp/cpe,cpe/manufacturer_oui*/ -char * os__get_deviceid_manufactureroui() -{ - char *v; - dmuci_get_option_value_string("cwmp", "cpe", "manufacturer_oui", &v); - if (v[0] == '\0') { - db_get_value_string("device", "deviceinfo", "ManufacturerOUI", &v); - return v; - } - return v; -} - -int os__get_base_mac_addr(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - db_get_value_string("device", "deviceinfo", "BaseMACAddress", value); - return 0; -} - -/*#Device.DeviceInfo.MemoryStatus.Total!UBUS:router.system/memory//total*/ -int os__get_memory_status_total(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *res; - dmubus_call("router.system", "memory", UBUS_ARGS{{}}, 0, &res); - DM_ASSERT(res, *value = "0"); - *value = dmjson_get_value(res, 1, "total"); - return 0; -} - -/*#Device.DeviceInfo.MemoryStatus.Free!UBUS:router.system/memory//free*/ -int os__get_memory_status_free(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *res; - dmubus_call("router.system", "memory", UBUS_ARGS{{}}, 0, &res); - DM_ASSERT(res, *value = "0"); - *value = dmjson_get_value(res, 1, "free"); - return 0; -} - -/*#Device.DeviceInfo.ProcessStatus.CPUUsage!UBUS:router.system/process//cpu_usage*/ -int os__get_process_cpu_usage(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *res; - dmubus_call("router.system", "process", UBUS_ARGS{{}}, 0, &res); - DM_ASSERT(res, *value = "0"); - *value = dmjson_get_value(res, 1, "cpu_usage"); - return 0; -} - -/*#Device.DeviceInfo.ProcessStatus.ProcessNumberOfEntries!UBUS:router.system/processes//processes*/ -int os__get_process_number_of_entries(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *res = NULL, *processes = NULL; - int nbre_process = 0; - - dmubus_call("router.system", "processes", UBUS_ARGS{}, 0, &res); - if (res) { - json_object_object_get_ex(res, "processes", &processes); - if (processes) - nbre_process = json_object_array_length(processes); - } - dmasprintf(value, "%d", nbre_process); - return 0; -} - -/*#Device.DeviceInfo.ProcessStatus.Process.{i}.PID!UBUS:router.system/processes//processes[@i-1].pid*/ -int os__get_process_pid(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "pid"); - return 0; -} - -/*#Device.DeviceInfo.ProcessStatus.Process.{i}.Command!UBUS:router.system/processes//processes[@i-1].command*/ -int os__get_process_command(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "command"); - return 0; -} - -/*#Device.DeviceInfo.ProcessStatus.Process.{i}.Size!UBUS:router.system/processes//processes[@i-1].vsz*/ -int os__get_process_size(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "vsz"); - return 0; -} - -/*#Device.DeviceInfo.ProcessStatus.Process.{i}.Priority!UBUS:router.system/processes//processes[@i-1].priority*/ -int os__get_process_priority(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - int priority = 0; - - *value = dmjson_get_value((json_object *)data, 1, "priority"); - - priority = (*value && **value) ? atoi(*value) : 0; - - /* Convert Linux priority to a value between 0 and 99 */ - priority = round((priority + 100) * 99 / 139); - - dmasprintf(value, "%d", priority); - - return 0; -} - -/*#Device.DeviceInfo.ProcessStatus.Process.{i}.CPUTime!UBUS:router.system/processes//processes[@i-1].cputime*/ -int os__get_process_cpu_time(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "cputime"); - return 0; -} - -/*#Device.DeviceInfo.ProcessStatus.Process.{i}.State!UBUS:router.system/processes//processes[@i-1].state*/ -int os__get_process_state(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *state = dmjson_get_value((json_object *)data, 1, "state"); - *value = (state && strcmp(state, "Unknown") == 0) ? "Idle" : state; - return 0; -} - -/*#Device.DeviceInfo.ProcessStatus.Process.{i}.!UBUS:router.system/processes//processes*/ -int os__browseProcessEntriesInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - json_object *res = NULL, *processes = NULL, *arrobj = NULL; - char *inst = NULL, *max_inst = NULL; - int id = 0, i = 0; - - dmubus_call("router.system", "processes", UBUS_ARGS{}, 0, &res); - dmjson_foreach_obj_in_array(res, arrobj, processes, i, 1, "processes") { - inst = handle_update_instance(1, dmctx, &max_inst, update_instance_without_section, 1, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)processes, inst) == DM_STOP) - break; - } - return 0; -} diff --git a/dmtree/tr181/deviceinfo-openwrt.c b/dmtree/tr181/deviceinfo-openwrt.c deleted file mode 100644 index 6838cebf..00000000 --- a/dmtree/tr181/deviceinfo-openwrt.c +++ /dev/null @@ -1,140 +0,0 @@ -#include "os.h" - -#include - -#define BASE_IFACE "br-lan" - -static char * get_uci_deviceinfo(char *opt) -{ - char *v; - - dmuci_get_option_value_string("cwmp", "@deviceinfo[0]", opt, &v); - return v; -} - -char * os__get_deviceid_manufacturer() -{ - return get_uci_deviceinfo("Manufacturer"); -} - -char * os__get_deviceid_productclass() -{ - return get_uci_deviceinfo("ProductClass"); -} - -char * os__get_deviceid_serialnumber() -{ - return get_uci_deviceinfo("SerialNumber"); -} - -char * os__get_softwareversion() -{ - return get_uci_deviceinfo("SoftwareVersion"); -} - -int os__get_device_hardwareversion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = get_uci_deviceinfo("HardwareVersion"); - return 0; -} - -int os__get_device_devicecategory(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = get_uci_deviceinfo("DeviceCategory"); - return 0; -} - -int os__get_device_additionalhardwareversion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = get_uci_deviceinfo("AdditionalHardwareVersion"); - return 0; -} - -int os__get_device_additionalsoftwareversion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = get_uci_deviceinfo("AdditionalSoftwareVersion"); - return 0; -} - -int os__get_device_modelname(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = get_uci_deviceinfo("ModelName"); - return 0; -} - -int os__get_device_description(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = get_uci_deviceinfo("Description"); - return 0; -} - -char * os__get_deviceid_manufactureroui() -{ - return get_uci_deviceinfo("ManufacturerOUI"); -} - -int os__get_base_mac_addr(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return get_net_device_sysfs(BASE_IFACE, "address", value); -} - -static int not_implemented(char **value) -{ - *value = ""; - return 0; -} - -int os__get_memory_status_total(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_memory_status_free(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_process_cpu_usage(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_process_number_of_entries(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_process_pid(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_process_command(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_process_size(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_process_priority(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_process_cpu_time(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_process_state(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__browseProcessEntriesInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - return 0; -} diff --git a/dmtree/tr181/deviceinfo.c b/dmtree/tr181/deviceinfo.c index 0fa8f6bc..036b39e0 100644 --- a/dmtree/tr181/deviceinfo.c +++ b/dmtree/tr181/deviceinfo.c @@ -10,7 +10,6 @@ */ #include "deviceinfo.h" -#include "os.h" struct Supported_Data_Models { @@ -58,33 +57,45 @@ struct Supported_Data_Models Data_Models[] = { {"http://www.broadband-forum.org/cwmp/tr-157-1-3-0.xml","urn:broadband-forum-org:tr-157-1-3-0", "Bulkdata,SoftwareModules"}, }; +/*#Device.DeviceInfo.Manufacturer!UCI:cwmp/cpe,cpe/manufacturer*/ static int get_device_manufacturer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = os__get_deviceid_manufacturer(); + dmuci_get_option_value_string("cwmp","cpe","manufacturer", value); + if (*value[0] == '\0') + db_get_value_string("device", "deviceinfo", "Manufacturer", value); + return 0; } +/*#Device.DeviceInfo.ManufacturerOUI!UCI:cwmp/cpe,cpe/manufacturer_oui*/ static int get_device_manufactureroui(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = os__get_deviceid_manufactureroui(); + dmuci_get_option_value_string("cwmp", "cpe", "manufacturer_oui", value); + if (*value[0] == '\0') + db_get_value_string("device", "deviceinfo", "ManufacturerOUI", value); + return 0; } +/*#Device.DeviceInfo.ProductClass!UCI:cwmp/cpe,cpe/product_class*/ static int get_device_productclass(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = os__get_deviceid_productclass(); + dmuci_get_option_value_string("cwmp", "cpe", "product_class", value); + if (*value[0] == '\0') + db_get_value_string("device", "deviceinfo", "ProductClass", value); + return 0; } static int get_device_serialnumber(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = os__get_deviceid_serialnumber(); + db_get_value_string("device", "deviceinfo", "SerialNumber", value); return 0; } static int get_device_softwareversion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = os__get_softwareversion(); + db_get_value_string("device", "deviceinfo", "SoftwareVersion", value); return 0; } @@ -94,6 +105,48 @@ static int get_device_active_fwimage(char *refparam, struct dmctx *ctx, void *da return 0; } +static int get_device_hardwareversion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + db_get_value_string("device", "deviceinfo", "HardwareVersion", value); + return 0; +} + +static int get_device_devicecategory(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + db_get_value_string("device", "deviceinfo", "DeviceCategory", value); + return 0; +} + +static int get_device_additionalhardwareversion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + db_get_value_string("device", "deviceinfo", "AdditionalHardwareVersion", value); + return 0; +} + +static int get_device_additionalsoftwareversion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + db_get_value_string("device", "deviceinfo", "AdditionalSoftwareVersion", value); + return 0; +} + +/*#Device.DeviceInfo.ModelName!UCI:cwmp/cpe,cpe/model_name*/ +static int get_device_modelname(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_option_value_string("cwmp", "cpe", "model_name", value); + if (*value[0] == '\0') + db_get_value_string("device", "deviceinfo", "ModelName", value); + return 0; +} + +/*#Device.DeviceInfo.Description!UCI:cwmp/cpe,cpe/description*/ +static int get_device_description(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_option_value_string("cwmp", "cpe", "description", value); + if (*value[0] == '\0') + db_get_value_string("device", "deviceinfo", "Description", value); + return 0; +} + /*#Device.DeviceInfo.UpTime!PROCFS:/proc/uptime*/ static int get_device_info_uptime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { @@ -542,40 +595,151 @@ static int get_FirmwareImage_bootfailurelog(char *refparam, struct dmctx *ctx, v return 0; } +/*#Device.DeviceInfo.MemoryStatus.Total!UBUS:router.system/memory//total*/ +static int get_memory_status_total(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + json_object *res; + dmubus_call("router.system", "memory", UBUS_ARGS{{}}, 0, &res); + DM_ASSERT(res, *value = "0"); + *value = dmjson_get_value(res, 1, "total"); + return 0; +} + +/*#Device.DeviceInfo.MemoryStatus.Free!UBUS:router.system/memory//free*/ +static int get_memory_status_free(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + json_object *res; + dmubus_call("router.system", "memory", UBUS_ARGS{{}}, 0, &res); + DM_ASSERT(res, *value = "0"); + *value = dmjson_get_value(res, 1, "free"); + return 0; +} + +/*#Device.DeviceInfo.ProcessStatus.CPUUsage!UBUS:router.system/process//cpu_usage*/ +static int get_process_cpu_usage(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + json_object *res; + dmubus_call("router.system", "process", UBUS_ARGS{{}}, 0, &res); + DM_ASSERT(res, *value = "0"); + *value = dmjson_get_value(res, 1, "cpu_usage"); + return 0; +} + +/*#Device.DeviceInfo.ProcessStatus.ProcessNumberOfEntries!UBUS:router.system/processes//processes*/ +static int get_process_number_of_entries(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + json_object *res = NULL, *processes = NULL; + int nbre_process = 0; + + dmubus_call("router.system", "processes", UBUS_ARGS{}, 0, &res); + DM_ASSERT(res, *value = "0"); + json_object_object_get_ex(res, "processes", &processes); + nbre_process = (processes) ? json_object_array_length(processes) : 0; + dmasprintf(value, "%d", nbre_process); + return 0; +} + +/*#Device.DeviceInfo.ProcessStatus.Process.{i}.!UBUS:router.system/processes//processes*/ +static int browseProcessEntriesInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) +{ + json_object *res = NULL, *processes = NULL, *arrobj = NULL; + char *inst = NULL, *max_inst = NULL; + int id = 0, i = 0; + + dmubus_call("router.system", "processes", UBUS_ARGS{}, 0, &res); + dmjson_foreach_obj_in_array(res, arrobj, processes, i, 1, "processes") { + inst = handle_update_instance(1, dmctx, &max_inst, update_instance_without_section, 1, ++id); + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)processes, inst) == DM_STOP) + break; + } + return 0; +} + +/*#Device.DeviceInfo.ProcessStatus.Process.{i}.PID!UBUS:router.system/processes//processes[@i-1].pid*/ +static int get_process_pid(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "pid"); + return 0; +} + +/*#Device.DeviceInfo.ProcessStatus.Process.{i}.Command!UBUS:router.system/processes//processes[@i-1].command*/ +static int get_process_command(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "command"); + return 0; +} + +/*#Device.DeviceInfo.ProcessStatus.Process.{i}.Size!UBUS:router.system/processes//processes[@i-1].vsz*/ +static int get_process_size(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "vsz"); + return 0; +} + +/*#Device.DeviceInfo.ProcessStatus.Process.{i}.Priority!UBUS:router.system/processes//processes[@i-1].priority*/ +static int get_process_priority(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + int priority = 0; + + *value = dmjson_get_value((json_object *)data, 1, "priority"); + + priority = (*value && **value) ? atoi(*value) : 0; + + /* Convert Linux priority to a value between 0 and 99 */ + priority = round((priority + 100) * 99 / 139); + + dmasprintf(value, "%d", priority); + + return 0; +} + +/*#Device.DeviceInfo.ProcessStatus.Process.{i}.CPUTime!UBUS:router.system/processes//processes[@i-1].cputime*/ +static int get_process_cpu_time(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "cputime"); + return 0; +} + +/*#Device.DeviceInfo.ProcessStatus.Process.{i}.State!UBUS:router.system/processes//processes[@i-1].state*/ +static int get_process_state(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + char *state = dmjson_get_value((json_object *)data, 1, "state"); + *value = (state && strcmp(state, "Unknown") == 0) ? "Idle" : state; + return 0; +} /* *** Device.DeviceInfo. *** */ DMOBJ tDeviceInfoObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"VendorConfigFile", &DMREAD, NULL, NULL, NULL, browseVcfInst, NULL, NULL, tDeviceInfoVendorConfigFileParams, NULL, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, -{"MemoryStatus", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDeviceInfoMemoryStatusParams, NULL, BBFDM_BOTH}, -{"ProcessStatus", &DMREAD, NULL, NULL, NULL, NULL, NULL, tDeviceInfoProcessStatusObj, tDeviceInfoProcessStatusParams, NULL, BBFDM_BOTH}, -{"Processor", &DMREAD, NULL, NULL, NULL, browseDeviceInfoProcessorInst, NULL, NULL, tDeviceInfoProcessorParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, -{"VendorLogFile", &DMREAD, NULL, NULL, NULL, browseVlfInst, NULL, NULL, tDeviceInfoVendorLogFileParams, NULL, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, -{"SupportedDataModel", &DMREAD, NULL, NULL, NULL, browseDeviceInfoSupportedDataModelInst, NULL, NULL, tDeviceInfoSupportedDataModelParams, NULL, BBFDM_CWMP, LIST_KEY{"URL", "Alias", "UUID", NULL}}, -{"FirmwareImage", &DMREAD, NULL, NULL, NULL, browseDeviceInfoFirmwareImageInst, NULL, NULL, tDeviceInfoFirmwareImageParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"VendorConfigFile", &DMREAD, NULL, NULL, NULL, browseVcfInst, NULL, NULL, NULL, tDeviceInfoVendorConfigFileParams, NULL, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, +{"MemoryStatus", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDeviceInfoMemoryStatusParams, NULL, BBFDM_BOTH}, +{"ProcessStatus", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDeviceInfoProcessStatusObj, tDeviceInfoProcessStatusParams, NULL, BBFDM_BOTH}, +{"Processor", &DMREAD, NULL, NULL, NULL, browseDeviceInfoProcessorInst, NULL, NULL, NULL, tDeviceInfoProcessorParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, +{"VendorLogFile", &DMREAD, NULL, NULL, NULL, browseVlfInst, NULL, NULL, NULL, tDeviceInfoVendorLogFileParams, NULL, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, +{"SupportedDataModel", &DMREAD, NULL, NULL, NULL, browseDeviceInfoSupportedDataModelInst, NULL, NULL, NULL, tDeviceInfoSupportedDataModelParams, NULL, BBFDM_CWMP, LIST_KEY{"URL", "Alias", "UUID", NULL}}, +{"FirmwareImage", &DMREAD, NULL, NULL, NULL, browseDeviceInfoFirmwareImageInst, NULL, NULL, NULL, tDeviceInfoFirmwareImageParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, {0} }; DMLEAF tDeviceInfoParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"DeviceCategory", &DMREAD, DMT_STRING, os__get_device_devicecategory, NULL, BBFDM_BOTH}, +{"DeviceCategory", &DMREAD, DMT_STRING, get_device_devicecategory, NULL, BBFDM_BOTH}, {"Manufacturer", &DMREAD, DMT_STRING, get_device_manufacturer, NULL, BBFDM_BOTH}, {"ManufacturerOUI", &DMREAD, DMT_STRING, get_device_manufactureroui, NULL, BBFDM_BOTH}, -{"ModelName", &DMREAD, DMT_STRING, os__get_device_modelname, NULL, BBFDM_BOTH}, -{"Description", &DMREAD, DMT_STRING, os__get_device_description, NULL, BBFDM_BOTH}, +{"ModelName", &DMREAD, DMT_STRING, get_device_modelname, NULL, BBFDM_BOTH}, +{"Description", &DMREAD, DMT_STRING, get_device_description, NULL, BBFDM_BOTH}, {"ProductClass", &DMREAD, DMT_STRING, get_device_productclass, NULL, BBFDM_BOTH}, {"SerialNumber", &DMREAD, DMT_STRING, get_device_serialnumber, NULL, BBFDM_BOTH}, -{"HardwareVersion", &DMREAD, DMT_STRING, os__get_device_hardwareversion, NULL, BBFDM_BOTH}, +{"HardwareVersion", &DMREAD, DMT_STRING, get_device_hardwareversion, NULL, BBFDM_BOTH}, {"SoftwareVersion", &DMREAD, DMT_STRING, get_device_softwareversion, NULL, BBFDM_BOTH}, {"ActiveFirmwareImage", &DMREAD, DMT_STRING, get_device_active_fwimage, NULL, BBFDM_BOTH}, -{"AdditionalHardwareVersion", &DMREAD, DMT_STRING, os__get_device_additionalhardwareversion, NULL, BBFDM_BOTH}, -{"AdditionalSoftwareVersion", &DMREAD, DMT_STRING, os__get_device_additionalsoftwareversion, NULL, BBFDM_BOTH}, +{"AdditionalHardwareVersion", &DMREAD, DMT_STRING, get_device_additionalhardwareversion, NULL, BBFDM_BOTH}, +{"AdditionalSoftwareVersion", &DMREAD, DMT_STRING, get_device_additionalsoftwareversion, NULL, BBFDM_BOTH}, {"ProvisioningCode", &DMWRITE, DMT_STRING, get_device_provisioningcode, set_device_provisioningcode, BBFDM_BOTH}, {"UpTime", &DMREAD, DMT_UNINT, get_device_info_uptime, NULL, BBFDM_BOTH}, {"ProcessorNumberOfEntries", &DMREAD, DMT_UNINT, get_DeviceInfo_ProcessorNumberOfEntries, NULL, BBFDM_BOTH}, {"SupportedDataModelNumberOfEntries", &DMREAD, DMT_UNINT, get_DeviceInfo_SupportedDataModelNumberOfEntries, NULL, BBFDM_CWMP}, {"FirmwareImageNumberOfEntries", &DMREAD, DMT_UNINT, get_DeviceInfo_FirmwareImageNumberOfEntries, NULL, BBFDM_BOTH}, -{CUSTOM_PREFIX"BaseMACAddress", &DMREAD, DMT_STRING, os__get_base_mac_addr, NULL, BBFDM_BOTH}, {0} }; @@ -594,33 +758,33 @@ DMLEAF tDeviceInfoVendorConfigFileParams[] = { /* *** Device.DeviceInfo.MemoryStatus. *** */ DMLEAF tDeviceInfoMemoryStatusParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"Total", &DMREAD, DMT_UNINT, os__get_memory_status_total, NULL, BBFDM_BOTH}, -{"Free", &DMREAD, DMT_UNINT, os__get_memory_status_free, NULL, BBFDM_BOTH}, +{"Total", &DMREAD, DMT_UNINT, get_memory_status_total, NULL, BBFDM_BOTH}, +{"Free", &DMREAD, DMT_UNINT, get_memory_status_free, NULL, BBFDM_BOTH}, {0} }; /* *** Device.DeviceInfo.ProcessStatus. *** */ DMOBJ tDeviceInfoProcessStatusObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Process", &DMREAD, NULL, NULL, NULL, os__browseProcessEntriesInst, NULL, NULL, tDeviceInfoProcessStatusProcessParams, NULL, BBFDM_BOTH, LIST_KEY{"PID", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Process", &DMREAD, NULL, NULL, NULL, browseProcessEntriesInst, NULL, NULL, NULL, tDeviceInfoProcessStatusProcessParams, NULL, BBFDM_BOTH, LIST_KEY{"PID", NULL}}, {0} }; DMLEAF tDeviceInfoProcessStatusParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"CPUUsage", &DMREAD, DMT_UNINT, os__get_process_cpu_usage, NULL, BBFDM_BOTH}, -{"ProcessNumberOfEntries", &DMREAD, DMT_UNINT, os__get_process_number_of_entries, NULL, BBFDM_BOTH}, +{"CPUUsage", &DMREAD, DMT_UNINT, get_process_cpu_usage, NULL, BBFDM_BOTH}, +{"ProcessNumberOfEntries", &DMREAD, DMT_UNINT, get_process_number_of_entries, NULL, BBFDM_BOTH}, {0} }; /* *** Device.DeviceInfo.ProcessStatus.Process.{i}. *** */ DMLEAF tDeviceInfoProcessStatusProcessParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"PID", &DMREAD, DMT_UNINT, os__get_process_pid, NULL, BBFDM_BOTH}, -{"Command", &DMREAD, DMT_STRING, os__get_process_command, NULL, BBFDM_BOTH}, -{"Size", &DMREAD, DMT_UNINT, os__get_process_size, NULL, BBFDM_BOTH}, -{"Priority", &DMREAD, DMT_UNINT, os__get_process_priority, NULL, BBFDM_BOTH}, -{"CPUTime", &DMREAD, DMT_UNINT, os__get_process_cpu_time, NULL, BBFDM_BOTH}, -{"State", &DMREAD, DMT_STRING, os__get_process_state, NULL, BBFDM_BOTH}, +{"PID", &DMREAD, DMT_UNINT, get_process_pid, NULL, BBFDM_BOTH}, +{"Command", &DMREAD, DMT_STRING, get_process_command, NULL, BBFDM_BOTH}, +{"Size", &DMREAD, DMT_UNINT, get_process_size, NULL, BBFDM_BOTH}, +{"Priority", &DMREAD, DMT_UNINT, get_process_priority, NULL, BBFDM_BOTH}, +{"CPUTime", &DMREAD, DMT_UNINT, get_process_cpu_time, NULL, BBFDM_BOTH}, +{"State", &DMREAD, DMT_STRING, get_process_state, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/dhcpv4.c b/dmtree/tr181/dhcpv4.c index de0ccee4..41a4a76d 100644 --- a/dmtree/tr181/dhcpv4.c +++ b/dmtree/tr181/dhcpv4.c @@ -2934,7 +2934,7 @@ static int browseDHCPv4ClientSentOptionInst(struct dmctx *dmctx, DMNODE *parent_ sentopts = strsplit(options, " ", &length); for (i = 0; i < length; i++) { - if (sentopts[i]) + if (sentopts && sentopts[i]) buf = strsplit(sentopts[i], ":", &length2); if ((dhcp_client_dmmap_s = get_dup_section_in_dmmap_eq("dmmap_dhcp_client", "send_option", section_name(dhcp_client_s), "option_tag", buf[0])) == NULL) { @@ -2983,6 +2983,9 @@ static int browseDHCPv4ClientReqOptionInst(struct dmctx *dmctx, DMNODE *parent_n reqtopts = strsplit(options, " ", &length); for (i = 0; i < length; i++) { + if (reqtopts == NULL) + continue; + if ((dhcp_client_dmmap_s = get_dup_section_in_dmmap_eq("dmmap_dhcp_client", "req_option", section_name(dhcp_client_s), "option_tag", reqtopts[i])) == NULL) { dmuci_add_section_bbfdm("dmmap_dhcp_client", "req_option", &dhcp_client_dmmap_s); dmuci_set_value_by_section_bbfdm(dhcp_client_dmmap_s, "option_tag", reqtopts[i]); @@ -3114,10 +3117,10 @@ static int browseDHCPv4RelayForwardingInst(struct dmctx *dmctx, DMNODE *parent_n ***********************************************************************************************************************************/ /* *** Device.DHCPv4. *** */ DMOBJ tDHCPv4Obj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Client", &DMWRITE, addObjDHCPv4Client, delObjDHCPv4Client, NULL, browseDHCPv4ClientInst, NULL, tDHCPv4ClientObj, tDHCPv4ClientParams, NULL, BBFDM_BOTH, LIST_KEY{"Interface", "Alias", NULL}}, -{"Server", &DMREAD, NULL, NULL, NULL, NULL, NULL, tDHCPv4ServerObj, tDHCPv4ServerParams, NULL, BBFDM_BOTH}, -{"Relay", &DMREAD, NULL, NULL, NULL, NULL, NULL, tDHCPv4RelayObj, tDHCPv4RelayParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Client", &DMWRITE, addObjDHCPv4Client, delObjDHCPv4Client, NULL, browseDHCPv4ClientInst, NULL, NULL, tDHCPv4ClientObj, tDHCPv4ClientParams, NULL, BBFDM_BOTH, LIST_KEY{"Interface", "Alias", NULL}}, +{"Server", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDHCPv4ServerObj, tDHCPv4ServerParams, NULL, BBFDM_BOTH}, +{"Relay", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDHCPv4RelayObj, tDHCPv4RelayParams, NULL, BBFDM_BOTH}, {0} }; @@ -3129,9 +3132,9 @@ DMLEAF tDHCPv4Params[] = { /* *** Device.DHCPv4.Client.{i}. *** */ DMOBJ tDHCPv4ClientObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"SentOption", &DMWRITE, addObjDHCPv4ClientSentOption, delObjDHCPv4ClientSentOption, NULL, browseDHCPv4ClientSentOptionInst, NULL, NULL, tDHCPv4ClientSentOptionParams, NULL, BBFDM_BOTH, LIST_KEY{"Tag", "Alias", NULL}}, -{"ReqOption", &DMWRITE, addObjDHCPv4ClientReqOption, delObjDHCPv4ClientReqOption, NULL, browseDHCPv4ClientReqOptionInst, NULL, NULL, tDHCPv4ClientReqOptionParams, NULL, BBFDM_BOTH, LIST_KEY{"Tag", "Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"SentOption", &DMWRITE, addObjDHCPv4ClientSentOption, delObjDHCPv4ClientSentOption, NULL, browseDHCPv4ClientSentOptionInst, NULL, NULL, NULL, tDHCPv4ClientSentOptionParams, NULL, BBFDM_BOTH, LIST_KEY{"Tag", "Alias", NULL}}, +{"ReqOption", &DMWRITE, addObjDHCPv4ClientReqOption, delObjDHCPv4ClientReqOption, NULL, browseDHCPv4ClientReqOptionInst, NULL, NULL, NULL, tDHCPv4ClientReqOptionParams, NULL, BBFDM_BOTH, LIST_KEY{"Tag", "Alias", NULL}}, {0} }; @@ -3179,8 +3182,8 @@ DMLEAF tDHCPv4ClientReqOptionParams[] = { /* *** Device.DHCPv4.Server. *** */ DMOBJ tDHCPv4ServerObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Pool", &DMWRITE, addObjDHCPv4ServerPool, delObjDHCPv4ServerPool, NULL, browseDHCPv4ServerPoolInst, NULL, tDHCPv4ServerPoolObj, tDHCPv4ServerPoolParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Pool", &DMWRITE, addObjDHCPv4ServerPool, delObjDHCPv4ServerPool, NULL, browseDHCPv4ServerPoolInst, NULL, NULL, tDHCPv4ServerPoolObj, tDHCPv4ServerPoolParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, {0} }; @@ -3193,10 +3196,10 @@ DMLEAF tDHCPv4ServerParams[] = { /* *** Device.DHCPv4.Server.Pool.{i}. *** */ DMOBJ tDHCPv4ServerPoolObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"StaticAddress", &DMWRITE, addObjDHCPv4ServerPoolStaticAddress, delObjDHCPv4ServerPoolStaticAddress, NULL, browseDHCPv4ServerPoolStaticAddressInst, NULL, NULL, tDHCPv4ServerPoolStaticAddressParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", "Chaddr", NULL}}, -{"Option", &DMWRITE, addObjDHCPv4ServerPoolOption, delObjDHCPv4ServerPoolOption, NULL, browseDHCPv4ServerPoolOptionInst, NULL, NULL, tDHCPv4ServerPoolOptionParams, NULL, BBFDM_BOTH, LIST_KEY{"Tag", "Alias", NULL}}, -{"Client", &DMREAD, NULL, NULL, NULL, browseDhcpClientInst, NULL, tDHCPv4ServerPoolClientObj, tDHCPv4ServerPoolClientParams, get_dhcp_client_linker, BBFDM_BOTH, LIST_KEY{"Chaddr", "Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"StaticAddress", &DMWRITE, addObjDHCPv4ServerPoolStaticAddress, delObjDHCPv4ServerPoolStaticAddress, NULL, browseDHCPv4ServerPoolStaticAddressInst, NULL, NULL, NULL, tDHCPv4ServerPoolStaticAddressParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", "Chaddr", NULL}}, +{"Option", &DMWRITE, addObjDHCPv4ServerPoolOption, delObjDHCPv4ServerPoolOption, NULL, browseDHCPv4ServerPoolOptionInst, NULL, NULL, NULL, tDHCPv4ServerPoolOptionParams, NULL, BBFDM_BOTH, LIST_KEY{"Tag", "Alias", NULL}}, +{"Client", &DMREAD, NULL, NULL, NULL, browseDhcpClientInst, NULL, NULL, tDHCPv4ServerPoolClientObj, tDHCPv4ServerPoolClientParams, get_dhcp_client_linker, BBFDM_BOTH, LIST_KEY{"Chaddr", "Alias", NULL}}, {0} }; @@ -3254,9 +3257,9 @@ DMLEAF tDHCPv4ServerPoolOptionParams[] = { /* *** Device.DHCPv4.Server.Pool.{i}.Client.{i}. *** */ DMOBJ tDHCPv4ServerPoolClientObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"IPv4Address", &DMREAD, NULL, NULL, NULL, browseDhcpClientIPv4Inst, NULL, NULL, tDHCPv4ServerPoolClientIPv4AddressParams, NULL, BBFDM_BOTH, LIST_KEY{"IPAddress", NULL}}, -{"Option", &DMREAD, NULL, NULL, NULL, browseDHCPv4ServerPoolClientOptionInst, NULL, NULL, tDHCPv4ServerPoolClientOptionParams, NULL, BBFDM_BOTH, LIST_KEY{"Tag", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"IPv4Address", &DMREAD, NULL, NULL, NULL, browseDhcpClientIPv4Inst, NULL, NULL, NULL, tDHCPv4ServerPoolClientIPv4AddressParams, NULL, BBFDM_BOTH, LIST_KEY{"IPAddress", NULL}}, +{"Option", &DMREAD, NULL, NULL, NULL, browseDHCPv4ServerPoolClientOptionInst, NULL, NULL, NULL, tDHCPv4ServerPoolClientOptionParams, NULL, BBFDM_BOTH, LIST_KEY{"Tag", NULL}}, {0} }; @@ -3288,8 +3291,8 @@ DMLEAF tDHCPv4ServerPoolClientOptionParams[] = { /* *** Device.DHCPv4.Relay. *** */ DMOBJ tDHCPv4RelayObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Forwarding", &DMWRITE, addObjDHCPv4RelayForwarding, delObjDHCPv4RelayForwarding, NULL, browseDHCPv4RelayForwardingInst, NULL, NULL, tDHCPv4RelayForwardingParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Forwarding", &DMWRITE, addObjDHCPv4RelayForwarding, delObjDHCPv4RelayForwarding, NULL, browseDHCPv4RelayForwardingInst, NULL, NULL, NULL, tDHCPv4RelayForwardingParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, {0} }; diff --git a/dmtree/tr181/dhcpv6.c b/dmtree/tr181/dhcpv6.c index 3a32c68f..b8fff2f6 100644 --- a/dmtree/tr181/dhcpv6.c +++ b/dmtree/tr181/dhcpv6.c @@ -1302,9 +1302,9 @@ static int set_DHCPv6ServerPoolOption_Value(char *refparam, struct dmctx *ctx, v /* *** Device.DHCPv6. *** */ DMOBJ tDHCPv6Obj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Client", &DMWRITE, addObjDHCPv6Client, delObjDHCPv6Client, NULL, browseDHCPv6ClientInst, NULL, tDHCPv6ClientObj, tDHCPv6ClientParams, NULL, BBFDM_BOTH, LIST_KEY{"Interface", "Alias", NULL}}, -{"Server", &DMREAD, NULL, NULL, NULL, NULL, NULL, tDHCPv6ServerObj, tDHCPv6ServerParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Client", &DMWRITE, addObjDHCPv6Client, delObjDHCPv6Client, NULL, browseDHCPv6ClientInst, NULL, NULL, tDHCPv6ClientObj, tDHCPv6ClientParams, NULL, BBFDM_BOTH, LIST_KEY{"Interface", "Alias", NULL}}, +{"Server", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDHCPv6ServerObj, tDHCPv6ServerParams, NULL, BBFDM_BOTH}, {0} }; @@ -1316,10 +1316,10 @@ DMLEAF tDHCPv6Params[] = { /* *** Device.DHCPv6.Client.{i}. *** */ DMOBJ tDHCPv6ClientObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -//{"Server", &DMREAD, NULL, NULL, NULL, browseDHCPv6ClientServerInst, NULL, NULL, tDHCPv6ClientServerParams, NULL, BBFDM_BOTH, LIST_KEY{"SourceAddress", NULL}}, -//{"SentOption", &DMWRITE, addObjDHCPv6ClientSentOption, delObjDHCPv6ClientSentOption, NULL, browseDHCPv6ClientSentOptionInst, NULL, NULL, tDHCPv6ClientSentOptionParams, NULL, BBFDM_BOTH, LIST_KEY{"Tag", "Alias", NULL}}, -//{"ReceivedOption", &DMREAD, NULL, NULL, NULL, browseDHCPv6ClientReceivedOptionInst, NULL, NULL, tDHCPv6ClientReceivedOptionParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +//{"Server", &DMREAD, NULL, NULL, NULL, browseDHCPv6ClientServerInst, NULL, NULL, NULL, tDHCPv6ClientServerParams, NULL, BBFDM_BOTH, LIST_KEY{"SourceAddress", NULL}}, +//{"SentOption", &DMWRITE, addObjDHCPv6ClientSentOption, delObjDHCPv6ClientSentOption, NULL, browseDHCPv6ClientSentOptionInst, NULL, NULL, NULL, tDHCPv6ClientSentOptionParams, NULL, BBFDM_BOTH, LIST_KEY{"Tag", "Alias", NULL}}, +//{"ReceivedOption", &DMREAD, NULL, NULL, NULL, browseDHCPv6ClientReceivedOptionInst, NULL, NULL, NULL, tDHCPv6ClientReceivedOptionParams, NULL, BBFDM_BOTH}, {0} }; @@ -1374,8 +1374,8 @@ DMLEAF tDHCPv6ClientReceivedOptionParams[] = { /* *** Device.DHCPv6.Server. *** */ DMOBJ tDHCPv6ServerObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Pool", &DMWRITE, addObjDHCPv6ServerPool, delObjDHCPv6ServerPool, NULL, browseDHCPv6ServerPoolInst, NULL, tDHCPv6ServerPoolObj, tDHCPv6ServerPoolParams, NULL, BBFDM_BOTH, LIST_KEY{"Order", "Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Pool", &DMWRITE, addObjDHCPv6ServerPool, delObjDHCPv6ServerPool, NULL, browseDHCPv6ServerPoolInst, NULL, NULL, tDHCPv6ServerPoolObj, tDHCPv6ServerPoolParams, NULL, BBFDM_BOTH, LIST_KEY{"Order", "Alias", NULL}}, {0} }; @@ -1388,9 +1388,9 @@ DMLEAF tDHCPv6ServerParams[] = { /* *** Device.DHCPv6.Server.Pool.{i}. *** */ DMOBJ tDHCPv6ServerPoolObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Client", &DMREAD, NULL, NULL, NULL, browseDHCPv6ServerPoolClientInst, NULL, tDHCPv6ServerPoolClientObj, tDHCPv6ServerPoolClientParams, NULL, BBFDM_BOTH, LIST_KEY{"SourceAddress", "Alias", NULL}}, -{"Option", &DMWRITE, addObjDHCPv6ServerPoolOption, delObjDHCPv6ServerPoolOption, NULL, browseDHCPv6ServerPoolOptionInst, NULL, NULL, tDHCPv6ServerPoolOptionParams, NULL, BBFDM_BOTH, LIST_KEY{"Tag", "Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Client", &DMREAD, NULL, NULL, NULL, browseDHCPv6ServerPoolClientInst, NULL, NULL, tDHCPv6ServerPoolClientObj, tDHCPv6ServerPoolClientParams, NULL, BBFDM_BOTH, LIST_KEY{"SourceAddress", "Alias", NULL}}, +{"Option", &DMWRITE, addObjDHCPv6ServerPoolOption, delObjDHCPv6ServerPoolOption, NULL, browseDHCPv6ServerPoolOptionInst, NULL, NULL, NULL, tDHCPv6ServerPoolOptionParams, NULL, BBFDM_BOTH, LIST_KEY{"Tag", "Alias", NULL}}, {0} }; @@ -1424,10 +1424,10 @@ DMLEAF tDHCPv6ServerPoolParams[] = { /* *** Device.DHCPv6.Server.Pool.{i}.Client.{i}. *** */ DMOBJ tDHCPv6ServerPoolClientObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"IPv6Address", &DMREAD, NULL, NULL, NULL, browseDHCPv6ServerPoolClientIPv6AddressInst, NULL, NULL, tDHCPv6ServerPoolClientIPv6AddressParams, NULL, BBFDM_BOTH, LIST_KEY{"IPAddress", NULL}}, -{"IPv6Prefix", &DMREAD, NULL, NULL, NULL, browseDHCPv6ServerPoolClientIPv6PrefixInst, NULL, NULL, tDHCPv6ServerPoolClientIPv6PrefixParams, NULL, BBFDM_BOTH, LIST_KEY{"Prefix", NULL}}, -//{"Option", &DMREAD, NULL, NULL, NULL, browseDHCPv6ServerPoolClientOptionInst, NULL, NULL, tDHCPv6ServerPoolClientOptionParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"IPv6Address", &DMREAD, NULL, NULL, NULL, browseDHCPv6ServerPoolClientIPv6AddressInst, NULL, NULL, NULL, tDHCPv6ServerPoolClientIPv6AddressParams, NULL, BBFDM_BOTH, LIST_KEY{"IPAddress", NULL}}, +{"IPv6Prefix", &DMREAD, NULL, NULL, NULL, browseDHCPv6ServerPoolClientIPv6PrefixInst, NULL, NULL, NULL, tDHCPv6ServerPoolClientIPv6PrefixParams, NULL, BBFDM_BOTH, LIST_KEY{"Prefix", NULL}}, +//{"Option", &DMREAD, NULL, NULL, NULL, browseDHCPv6ServerPoolClientOptionInst, NULL, NULL, NULL, tDHCPv6ServerPoolClientOptionParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/dns.c b/dmtree/tr181/dns.c index c8510d9a..a34aeab1 100644 --- a/dmtree/tr181/dns.c +++ b/dmtree/tr181/dns.c @@ -688,10 +688,10 @@ static int set_nslookupdiagnostics_number_of_repetitions(char *refparam, struct /* *** Device.DNS. *** */ DMOBJ tDNSObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Client", &DMREAD, NULL, NULL, NULL, NULL, NULL, tDNSClientObj, tDNSClientParams, NULL, BBFDM_BOTH}, -{"Relay", &DMREAD, NULL, NULL, NULL, NULL, NULL, tDNSRelayObj, tDNSRelayParams, NULL, BBFDM_BOTH}, -{"Diagnostics", &DMREAD, NULL, NULL, NULL, NULL, NULL, tDNSDiagnosticsObj, NULL, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Client", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDNSClientObj, tDNSClientParams, NULL, BBFDM_BOTH}, +{"Relay", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDNSRelayObj, tDNSRelayParams, NULL, BBFDM_BOTH}, +{"Diagnostics", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDNSDiagnosticsObj, NULL, NULL, BBFDM_BOTH}, {0} }; @@ -703,8 +703,8 @@ DMLEAF tDNSParams[] = { /* *** Device.DNS.Client. *** */ DMOBJ tDNSClientObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Server", &DMWRITE, add_dns_server, delete_dns_server, NULL, browseDNSServerInst, NULL, NULL, tDNSClientServerParams, NULL, BBFDM_BOTH, LIST_KEY{"DNSServer", "Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Server", &DMWRITE, add_dns_server, delete_dns_server, NULL, browseDNSServerInst, NULL, NULL, NULL, tDNSClientServerParams, NULL, BBFDM_BOTH, LIST_KEY{"DNSServer", "Alias", NULL}}, {0} }; @@ -730,8 +730,8 @@ DMLEAF tDNSClientServerParams[] = { /* *** Device.DNS.Relay. *** */ DMOBJ tDNSRelayObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Forwarding", &DMWRITE, add_dns_server, delete_dns_server, NULL, browseDNSServerInst, NULL, NULL, tDNSRelayForwardingParams, NULL, BBFDM_BOTH, LIST_KEY{"DNSServer", "Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Forwarding", &DMWRITE, add_dns_server, delete_dns_server, NULL, browseDNSServerInst, NULL, NULL, NULL, tDNSRelayForwardingParams, NULL, BBFDM_BOTH, LIST_KEY{"DNSServer", "Alias", NULL}}, {0} }; @@ -757,15 +757,15 @@ DMLEAF tDNSRelayForwardingParams[] = { /* *** Device.DNS.Diagnostics. *** */ DMOBJ tDNSDiagnosticsObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"NSLookupDiagnostics", &DMREAD, NULL, NULL, NULL, NULL, NULL, tDNSDiagnosticsNSLookupDiagnosticsObj, tDNSDiagnosticsNSLookupDiagnosticsParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"NSLookupDiagnostics", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDNSDiagnosticsNSLookupDiagnosticsObj, tDNSDiagnosticsNSLookupDiagnosticsParams, NULL, BBFDM_BOTH}, {0} }; /* *** Device.DNS.Diagnostics.NSLookupDiagnostics. *** */ DMOBJ tDNSDiagnosticsNSLookupDiagnosticsObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Result", &DMREAD, NULL, NULL, NULL, browseResultInst, NULL, NULL, tDNSDiagnosticsNSLookupDiagnosticsResultParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Result", &DMREAD, NULL, NULL, NULL, browseResultInst, NULL, NULL, NULL, tDNSDiagnosticsNSLookupDiagnosticsResultParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/dsl.c b/dmtree/tr181/dsl.c index 72b1b432..5c2f77ef 100644 --- a/dmtree/tr181/dsl.c +++ b/dmtree/tr181/dsl.c @@ -1460,9 +1460,9 @@ static int get_DSLChannelStatsQuarterHour_XTUCCRCErrors(char *refparam, struct d /* *** Device.DSL. *** */ DMOBJ tDSLObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Line", &DMREAD, NULL, NULL, NULL, browseDSLLineInst, NULL, tDSLLineObj, tDSLLineParams, get_dsl_line_linker, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, -{"Channel", &DMREAD, NULL, NULL, NULL, browseDSLChannelInst, NULL, tDSLChannelObj, tDSLChannelParams, get_dsl_channel_linker, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Line", &DMREAD, NULL, NULL, NULL, browseDSLLineInst, NULL, NULL, tDSLLineObj, tDSLLineParams, get_dsl_line_linker, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, +{"Channel", &DMREAD, NULL, NULL, NULL, browseDSLChannelInst, NULL, NULL, tDSLChannelObj, tDSLChannelParams, get_dsl_channel_linker, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, {0} }; @@ -1475,8 +1475,8 @@ DMLEAF tDSLParams[] = { /* *** Device.DSL.Line.{i}. *** */ DMOBJ tDSLLineObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, tDSLLineStatsObj, tDSLLineStatsParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDSLLineStatsObj, tDSLLineStatsParams, NULL, BBFDM_BOTH}, {0} }; @@ -1535,12 +1535,12 @@ DMLEAF tDSLLineParams[] = { /* *** Device.DSL.Line.{i}.Stats. *** */ DMOBJ tDSLLineStatsObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Total", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDSLLineStatsTotalParams, NULL, BBFDM_BOTH}, -{"Showtime", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDSLLineStatsShowtimeParams, NULL, BBFDM_BOTH}, -{"LastShowtime", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDSLLineStatsLastShowtimeParams, NULL, BBFDM_BOTH}, -{"CurrentDay", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDSLLineStatsCurrentDayParams, NULL, BBFDM_BOTH}, -{"QuarterHour", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDSLLineStatsQuarterHourParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Total", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDSLLineStatsTotalParams, NULL, BBFDM_BOTH}, +{"Showtime", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDSLLineStatsShowtimeParams, NULL, BBFDM_BOTH}, +{"LastShowtime", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDSLLineStatsLastShowtimeParams, NULL, BBFDM_BOTH}, +{"CurrentDay", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDSLLineStatsCurrentDayParams, NULL, BBFDM_BOTH}, +{"QuarterHour", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDSLLineStatsQuarterHourParams, NULL, BBFDM_BOTH}, {0} }; @@ -1604,8 +1604,8 @@ DMLEAF tDSLLineStatsQuarterHourParams[] = { /* *** Device.DSL.Channel.{i}. *** */ DMOBJ tDSLChannelObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, tDSLChannelStatsObj, tDSLChannelStatsParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDSLChannelStatsObj, tDSLChannelStatsParams, NULL, BBFDM_BOTH}, {0} }; @@ -1637,12 +1637,12 @@ DMLEAF tDSLChannelParams[] = { /* *** Device.DSL.Channel.{i}.Stats. *** */ DMOBJ tDSLChannelStatsObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Total", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDSLChannelStatsTotalParams, NULL, BBFDM_BOTH}, -{"Showtime", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDSLChannelStatsShowtimeParams, NULL, BBFDM_BOTH}, -{"LastShowtime", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDSLChannelStatsLastShowtimeParams, NULL, BBFDM_BOTH}, -{"CurrentDay", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDSLChannelStatsCurrentDayParams, NULL, BBFDM_BOTH}, -{"QuarterHour", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDSLChannelStatsQuarterHourParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Total", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDSLChannelStatsTotalParams, NULL, BBFDM_BOTH}, +{"Showtime", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDSLChannelStatsShowtimeParams, NULL, BBFDM_BOTH}, +{"LastShowtime", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDSLChannelStatsLastShowtimeParams, NULL, BBFDM_BOTH}, +{"CurrentDay", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDSLChannelStatsCurrentDayParams, NULL, BBFDM_BOTH}, +{"QuarterHour", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDSLChannelStatsQuarterHourParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/dynamicdns.c b/dmtree/tr181/dynamicdns.c index f6bdcc6d..c876909e 100644 --- a/dmtree/tr181/dynamicdns.c +++ b/dmtree/tr181/dynamicdns.c @@ -1059,9 +1059,9 @@ static int set_DynamicDNSServer_MaxRetries(char *refparam, struct dmctx *ctx, vo /* *** Device.DynamicDNS. *** */ DMOBJ tDynamicDNSObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Client", &DMWRITE, addObjDynamicDNSClient, delObjDynamicDNSClient, NULL, browseDynamicDNSClientInst, NULL, tDynamicDNSClientObj, tDynamicDNSClientParams, NULL, BBFDM_BOTH, LIST_KEY{"Server", "Username", "Alias", NULL}}, -{"Server", &DMWRITE, addObjDynamicDNSServer, delObjDynamicDNSServer, NULL, browseDynamicDNSServerInst, NULL, NULL, tDynamicDNSServerParams, get_linker_dynamicdns_server, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Client", &DMWRITE, addObjDynamicDNSClient, delObjDynamicDNSClient, NULL, browseDynamicDNSClientInst, NULL, NULL, tDynamicDNSClientObj, tDynamicDNSClientParams, NULL, BBFDM_BOTH, LIST_KEY{"Server", "Username", "Alias", NULL}}, +{"Server", &DMWRITE, addObjDynamicDNSServer, delObjDynamicDNSServer, NULL, browseDynamicDNSServerInst, NULL, NULL, NULL, tDynamicDNSServerParams, get_linker_dynamicdns_server, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, {0} }; @@ -1075,8 +1075,8 @@ DMLEAF tDynamicDNSParams[] = { /* *** Device.DynamicDNS.Client.{i}. *** */ DMOBJ tDynamicDNSClientObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Hostname", &DMREAD, NULL, NULL, NULL, browseDynamicDNSClientHostnameInst, NULL, NULL, tDynamicDNSClientHostnameParams, NULL, BBFDM_BOTH, LIST_KEY{"Name", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Hostname", &DMREAD, NULL, NULL, NULL, browseDynamicDNSClientHostnameInst, NULL, NULL, NULL, tDynamicDNSClientHostnameParams, NULL, BBFDM_BOTH, LIST_KEY{"Name", NULL}}, {0} }; diff --git a/dmtree/tr181/ethernet.c b/dmtree/tr181/ethernet.c index b7d984d5..05ddee6f 100644 --- a/dmtree/tr181/ethernet.c +++ b/dmtree/tr181/ethernet.c @@ -72,7 +72,7 @@ int is_vlan_termination_section(const char *name) return 1; } -void get_bridge_port_linker(struct dmctx *ctx, char *intf_name, char **value) +static void get_bridge_port_linker(struct dmctx *ctx, char *intf_name, char **value) { struct uci_section *dmmap_section = NULL, *bridge_port = NULL; @@ -120,7 +120,7 @@ static struct uci_section *is_device_section_exist(char *device) return s; } -static int check_section_in_curr_section(char *curr_section, char *section) +int ethernet_check_section_in_curr_section(char *curr_section, char *section) { char *pch = NULL, *pchr = NULL, section_list[256] = {0}; @@ -143,7 +143,7 @@ static void add_section_in_curr_section(struct uci_section *dmmap_section, char dmuci_set_value_by_section(dmmap_section, "section_name", section_list); } -static int is_name_exist_in_devices(char *name) +int ethernet_name_exists_in_devices(char *name) { struct uci_section *s = NULL; @@ -186,7 +186,7 @@ static void create_link(char *sec_name, char *mac_addr) dmuci_get_value_by_section_string(dmmap_section, "section_name", §ion_name); /* Check section name exist => if yes, return*/ - if (check_section_in_curr_section(section_name, sec_name)) + if (ethernet_check_section_in_curr_section(section_name, sec_name)) return; /* Update only section name */ @@ -869,7 +869,6 @@ static int get_EthernetInterfaceStats_MulticastPacketsReceived(char *refparam, s return eth_port_sysfs(data, "statistics/multicast", value); } -#ifndef GENERIC_OPENWRT static int eth_port_ubus(const struct eth_port_args *args, const char *name, char **value) { json_object *res = NULL; @@ -915,7 +914,6 @@ static int get_EthernetInterfaceStats_UnknownProtoPacketsReceived(char *refparam { return eth_port_ubus(data, "rx_unknown_packets", value); } -#endif static int get_EthernetLink_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { @@ -1132,7 +1130,6 @@ static int get_EthernetLinkStats_MulticastPacketsReceived(char *refparam, struct return eth_iface_sysfs(data, "statistics/multicast", value); } -#ifndef GENERIC_OPENWRT static int eth_iface_ubus(struct uci_section *iface_s, const char *name, char **value) { json_object *res = NULL; @@ -1176,7 +1173,6 @@ static int get_EthernetLinkStats_UnknownProtoPacketsReceived(char *refparam, str { return eth_iface_ubus(data, "rx_unknown_packets", value); } -#endif static int get_EthernetVLANTermination_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { @@ -1310,7 +1306,7 @@ static int set_EthernetVLANTermination_LowerLayers(char *refparam, struct dmctx snprintf(link_inst, sizeof(link_inst), "%c", value[21]); snprintf(new_name, sizeof(new_name), "%s_%s", vlan_linker, link_inst); - if (is_name_exist_in_devices(new_name)) + if (ethernet_name_exists_in_devices(new_name)) return -1; uci_foreach_option_eq("network", "interface", "ifname", vlan_linker, s) { @@ -1335,7 +1331,7 @@ static int set_EthernetVLANTermination_LowerLayers(char *refparam, struct dmctx else snprintf(new_name, sizeof(new_name), "%s", vlan_linker); - if (is_name_exist_in_devices(new_name)) + if (ethernet_name_exists_in_devices(new_name)) return -1; // if device is lowerlayer to an ip interface, then @@ -1362,7 +1358,7 @@ static int set_EthernetVLANTermination_LowerLayers(char *refparam, struct dmctx break; } snprintf(new_name, sizeof(new_name), "%s.%s.%s", dev_name, inner_vid, vid); - if (is_name_exist_in_devices(new_name)) + if (ethernet_name_exists_in_devices(new_name)) return -1; dmuci_set_value_by_section((struct uci_section *)data, "ifname", dev_name); @@ -1410,7 +1406,7 @@ static int set_EthernetVLANTermination_VLANID(char *refparam, struct dmctx *ctx, dmasprintf(&name, "%s.%s", ifname, value); } - if (is_name_exist_in_devices(name)) + if (ethernet_name_exists_in_devices(name)) return -1; // set ifname option of the corresponding interface section @@ -1486,108 +1482,6 @@ static int set_EthernetVLANTermination_TPID(char *refparam, struct dmctx *ctx, v return 0; } -static int get_EthernetVLANTermination_MACVLAN(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "type", value); - *value = (strcmp(*value, "macvlan") == 0) ? "1" : "0"; - return 0; -} - -static int set_EthernetVLANTermination_MACVLAN(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - char *name, *ifname; - bool b; - - switch (action) { - case VALUECHECK: - if (dm_validate_boolean(value)) - return FAULT_9007; - break; - case VALUESET: - string_to_bool(value, &b); - dmuci_get_value_by_section_string((struct uci_section *)data, "ifname", &ifname); - dmuci_get_value_by_section_string((struct uci_section *)data, "name", &name); - struct uci_section *s = NULL, *dmmap_s = NULL; - if (b && *name != '\0') { - char *link_instance = NULL, new_name[16] = {0}; - int name_found = 0; - - uci_foreach_option_eq("network", "interface", "ifname", name, s) { - - get_dmmap_section_of_config_section_eq("dmmap", "link", "device", ifname, &dmmap_s); - if (dmmap_s) { - dmuci_get_value_by_section_string(dmmap_s, "link_instance", &link_instance); - snprintf(new_name, sizeof(new_name), "%s_%s", ifname, link_instance); - - if (is_name_exist_in_devices(new_name)) - return -1; - - dmuci_set_value_by_section(dmmap_s, "device", new_name); - dmuci_set_value_by_section(dmmap_s, "section_name", section_name(s)); - - } - - dmuci_set_value_by_section(s, "ifname", new_name); - - name_found = 1; - break; - } - - if (name_found == 0) { - int ifname_found = 0; - struct uci_section *ss = NULL; - - uci_foreach_option_eq("network", "interface", "ifname", ifname, ss) { - - uci_path_foreach_option_eq(bbfdm, "dmmap", "link", "device", ifname, dmmap_s) { - char *sec_name; - dmuci_get_value_by_section_string(dmmap_s, "section_name", &sec_name); - /* Check section name exist => if yes, continue*/ - if (!check_section_in_curr_section(sec_name, section_name(ss))) - continue; - - dmuci_get_value_by_section_string(dmmap_s, "link_instance", &link_instance); - snprintf(new_name, sizeof(new_name), "%s_%s", ifname, link_instance); - - if (is_name_exist_in_devices(new_name)) - return -1; - - dmuci_set_value_by_section(dmmap_s, "device", new_name); - dmuci_set_value_by_section(dmmap_s, "section_name", section_name(ss)); - } - - dmuci_set_value_by_section(ss, "ifname", new_name); - - ifname_found = 1; - break; - } - - if (ifname_found == 0) { - get_dmmap_section_of_config_section_eq("dmmap", "link", "device", ifname, &dmmap_s); - if (dmmap_s) { - dmuci_get_value_by_section_string(dmmap_s, "link_instance", &link_instance); - snprintf(new_name, sizeof(new_name), "%s_%s", ifname, link_instance); - - if (is_name_exist_in_devices(new_name)) - return -1; - - dmuci_set_value_by_section(dmmap_s, "device", new_name); - dmuci_set_value_by_section(dmmap_s, "section_name", ""); - - } - } - } - - dmuci_set_value_by_section((struct uci_section *)data, "name", new_name); - dmuci_set_value_by_section((struct uci_section *)data, "type", "macvlan"); - } else { - dmuci_set_value_by_section((struct uci_section *)data, "type", b ? "macvlan" : "8021q"); - } - break; - } - return 0; -} - /*#Device.Ethernet.VLANTermination.{i}.Stats.BytesSent!SYSFS:/sys/class/net/@Name/statistics/tx_bytes*/ static int get_EthernetVLANTerminationStats_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { @@ -1867,11 +1761,11 @@ static int get_EthernetRMONStats_Packets1024to1518Bytes(char *refparam, struct d ***********************************************************************************************************************************/ /* *** Device.Ethernet. *** */ DMOBJ tEthernetObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Interface", &DMREAD, NULL, NULL, NULL, browseEthernetInterfaceInst, NULL, tEthernetInterfaceObj, tEthernetInterfaceParams, get_linker_interface, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, -{"Link", &DMWRITE, addObjEthernetLink, delObjEthernetLink, NULL, browseEthernetLinkInst, NULL, tEthernetLinkObj, tEthernetLinkParams, get_linker_link, BBFDM_BOTH, LIST_KEY{"Name", "Alias", "MACAddress", NULL}}, -{"VLANTermination", &DMWRITE, addObjEthernetVLANTermination, delObjEthernetVLANTermination, NULL, browseEthernetVLANTerminationInst, NULL, tEthernetVLANTerminationObj, tEthernetVLANTerminationParams, get_linker_vlan_term, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, -{"RMONStats", &DMREAD, NULL, NULL, "file:/etc/config/ports;ubus:ethernet->rmonstats", browseEthernetRMONStatsInst, NULL, NULL, tEthernetRMONStatsParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", "Interface", "VLANID", "Queue", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Interface", &DMREAD, NULL, NULL, NULL, browseEthernetInterfaceInst, NULL, NULL, tEthernetInterfaceObj, tEthernetInterfaceParams, get_linker_interface, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, +{"Link", &DMWRITE, addObjEthernetLink, delObjEthernetLink, NULL, browseEthernetLinkInst, NULL, NULL, tEthernetLinkObj, tEthernetLinkParams, get_linker_link, BBFDM_BOTH, LIST_KEY{"Name", "Alias", "MACAddress", NULL}}, +{"VLANTermination", &DMWRITE, addObjEthernetVLANTermination, delObjEthernetVLANTermination, NULL, browseEthernetVLANTerminationInst, NULL, NULL, tEthernetVLANTerminationObj, tEthernetVLANTerminationParams, get_linker_vlan_term, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, +{"RMONStats", &DMREAD, NULL, NULL, "file:/etc/config/ports;ubus:ethernet->rmonstats", browseEthernetRMONStatsInst, NULL, NULL, NULL, tEthernetRMONStatsParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", "Interface", "VLANID", "Queue", NULL}}, {0} }; @@ -1886,8 +1780,8 @@ DMLEAF tEthernetParams[] = { /* *** Device.Ethernet.Interface.{i}. *** */ DMOBJ tEthernetInterfaceObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tEthernetInterfaceStatsParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tEthernetInterfaceStatsParams, NULL, BBFDM_BOTH}, {0} }; @@ -1921,21 +1815,19 @@ DMLEAF tEthernetInterfaceStatsParams[] = { {"DiscardPacketsSent", &DMREAD, DMT_UNINT, get_EthernetInterfaceStats_DiscardPacketsSent, NULL, BBFDM_BOTH}, {"DiscardPacketsReceived", &DMREAD, DMT_UNINT, get_EthernetInterfaceStats_DiscardPacketsReceived, NULL, BBFDM_BOTH}, {"MulticastPacketsReceived", &DMREAD, DMT_UNLONG, get_EthernetInterfaceStats_MulticastPacketsReceived, NULL, BBFDM_BOTH}, -#ifndef GENERIC_OPENWRT {"MulticastPacketsSent", &DMREAD, DMT_UNLONG, get_EthernetInterfaceStats_MulticastPacketsSent, NULL, BBFDM_BOTH}, {"UnicastPacketsSent", &DMREAD, DMT_UNLONG, get_EthernetInterfaceStats_UnicastPacketsSent, NULL, BBFDM_BOTH}, {"UnicastPacketsReceived", &DMREAD, DMT_UNLONG, get_EthernetInterfaceStats_UnicastPacketsReceived, NULL, BBFDM_BOTH}, {"BroadcastPacketsSent", &DMREAD, DMT_UNLONG, get_EthernetInterfaceStats_BroadcastPacketsSent, NULL, BBFDM_BOTH}, {"BroadcastPacketsReceived", &DMREAD, DMT_UNLONG, get_EthernetInterfaceStats_BroadcastPacketsReceived, NULL, BBFDM_BOTH}, {"UnknownProtoPacketsReceived", &DMREAD, DMT_UNINT, get_EthernetInterfaceStats_UnknownProtoPacketsReceived, NULL, BBFDM_BOTH}, -#endif {0} }; /* *** Device.Ethernet.Link.{i}. *** */ DMOBJ tEthernetLinkObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tEthernetLinkStatsParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tEthernetLinkStatsParams, NULL, BBFDM_BOTH}, {0} }; @@ -1963,21 +1855,19 @@ DMLEAF tEthernetLinkStatsParams[] = { {"DiscardPacketsSent", &DMREAD, DMT_UNINT, get_EthernetLinkStats_DiscardPacketsSent, NULL, BBFDM_BOTH}, {"DiscardPacketsReceived", &DMREAD, DMT_UNINT, get_EthernetLinkStats_DiscardPacketsReceived, NULL, BBFDM_BOTH}, {"MulticastPacketsReceived", &DMREAD, DMT_UNLONG, get_EthernetLinkStats_MulticastPacketsReceived, NULL, BBFDM_BOTH}, -#ifndef GENERIC_OPENWRT {"MulticastPacketsSent", &DMREAD, DMT_UNLONG, get_EthernetLinkStats_MulticastPacketsSent, NULL, BBFDM_BOTH}, {"UnicastPacketsSent", &DMREAD, DMT_UNLONG, get_EthernetLinkStats_UnicastPacketsSent, NULL, BBFDM_BOTH}, {"UnicastPacketsReceived", &DMREAD, DMT_UNLONG, get_EthernetLinkStats_UnicastPacketsReceived, NULL, BBFDM_BOTH}, {"BroadcastPacketsSent", &DMREAD, DMT_UNLONG, get_EthernetLinkStats_BroadcastPacketsSent, NULL, BBFDM_BOTH}, {"BroadcastPacketsReceived", &DMREAD, DMT_UNLONG, get_EthernetLinkStats_BroadcastPacketsReceived, NULL, BBFDM_BOTH}, {"UnknownProtoPacketsReceived", &DMREAD, DMT_UNINT, get_EthernetLinkStats_UnknownProtoPacketsReceived, NULL, BBFDM_BOTH}, -#endif {0} }; /* *** Device.Ethernet.VLANTermination.{i}. *** */ DMOBJ tEthernetVLANTerminationObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tEthernetVLANTerminationStatsParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tEthernetVLANTerminationStatsParams, NULL, BBFDM_BOTH}, {0} }; @@ -1991,7 +1881,6 @@ DMLEAF tEthernetVLANTerminationParams[] = { {"LowerLayers", &DMWRITE, DMT_STRING, get_EthernetVLANTermination_LowerLayers, set_EthernetVLANTermination_LowerLayers, BBFDM_BOTH}, {"VLANID", &DMWRITE, DMT_UNINT, get_EthernetVLANTermination_VLANID, set_EthernetVLANTermination_VLANID, BBFDM_BOTH}, {"TPID", &DMWRITE, DMT_UNINT, get_EthernetVLANTermination_TPID, set_EthernetVLANTermination_TPID, BBFDM_BOTH}, -{CUSTOM_PREFIX"MACVLAN", &DMWRITE, DMT_BOOL, get_EthernetVLANTermination_MACVLAN, set_EthernetVLANTermination_MACVLAN, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/ethernet.h b/dmtree/tr181/ethernet.h index e7d6f6b3..9c126739 100644 --- a/dmtree/tr181/ethernet.h +++ b/dmtree/tr181/ethernet.h @@ -28,7 +28,8 @@ extern DMLEAF tEthernetVLANTerminationParams[]; extern DMLEAF tEthernetVLANTerminationStatsParams[]; extern DMLEAF tEthernetRMONStatsParams[]; -void get_bridge_port_linker(struct dmctx *ctx, char *intf_name, char **value); int is_vlan_termination_section(const char *name); +int ethernet_check_section_in_curr_section(char *curr_section, char *section); +int ethernet_name_exists_in_devices(char *name); #endif //__ETHERNET_H diff --git a/dmtree/tr181/fast.c b/dmtree/tr181/fast.c index ed1bc563..a9b8ae4e 100644 --- a/dmtree/tr181/fast.c +++ b/dmtree/tr181/fast.c @@ -903,8 +903,8 @@ static int get_FASTLineStatsQuarterHour_SuccessTIGA(char *refparam, struct dmctx /* *** Device.FAST. *** */ DMOBJ tFASTObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Line", &DMREAD, NULL, NULL, NULL, browseFASTLineInst, NULL, tFASTLineObj, tFASTLineParams, get_fast_line_linker, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Line", &DMREAD, NULL, NULL, NULL, browseFASTLineInst, NULL, NULL, tFASTLineObj, tFASTLineParams, get_fast_line_linker, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, {0} }; @@ -916,8 +916,8 @@ DMLEAF tFASTParams[] = { /* *** Device.FAST.Line.{i}. *** */ DMOBJ tFASTLineObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, tFASTLineStatsObj, tFASTLineStatsParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tFASTLineStatsObj, tFASTLineStatsParams, NULL, BBFDM_BOTH}, {0} }; @@ -953,12 +953,12 @@ DMLEAF tFASTLineParams[] = { /* *** Device.FAST.Line.{i}.Stats. *** */ DMOBJ tFASTLineStatsObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Total", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tFASTLineStatsTotalParams, NULL, BBFDM_BOTH}, -{"Showtime", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tFASTLineStatsShowtimeParams, NULL, BBFDM_BOTH}, -{"LastShowtime", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tFASTLineStatsLastShowtimeParams, NULL, BBFDM_BOTH}, -{"CurrentDay", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tFASTLineStatsCurrentDayParams, NULL, BBFDM_BOTH}, -{"QuarterHour", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tFASTLineStatsQuarterHourParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Total", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tFASTLineStatsTotalParams, NULL, BBFDM_BOTH}, +{"Showtime", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tFASTLineStatsShowtimeParams, NULL, BBFDM_BOTH}, +{"LastShowtime", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tFASTLineStatsLastShowtimeParams, NULL, BBFDM_BOTH}, +{"CurrentDay", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tFASTLineStatsCurrentDayParams, NULL, BBFDM_BOTH}, +{"QuarterHour", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tFASTLineStatsQuarterHourParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/firewall.c b/dmtree/tr181/firewall.c index e439e73e..c3c9d2d3 100644 --- a/dmtree/tr181/firewall.c +++ b/dmtree/tr181/firewall.c @@ -335,7 +335,6 @@ static int get_FirewallChainRule_CreationDate(char *refparam, struct dmctx *ctx, return 0; } -#ifndef GENERIC_OPENWRT /*#Device.Firewall.Chain.{i}.Rule.{i}.ExpiryDate!UCI:firewall/rule,@i-1/expiry*/ static int get_FirewallChainRule_ExpiryDate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { @@ -372,7 +371,6 @@ static int set_FirewallChainRule_ExpiryDate(char *refparam, struct dmctx *ctx, v } return 0; } -#endif static int get_rule_source_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { @@ -671,68 +669,6 @@ static int get_rule_source_port_range_max(char *refparam, struct dmctx *ctx, voi return 0; } -static int get_rule_icmp_type(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct uci_list *v= NULL; - struct uci_element *e = NULL; - char *ptr = NULL; - - dmasprintf(value, "%s", ""); - dmuci_get_value_by_section_list((struct uci_section *)data, "icmp_type", &v); - if (v != NULL) { - uci_foreach_element(v, e) { - ptr = dmstrdup(*value); - dmfree(*value); - - if (strlen(ptr) == 0) - dmasprintf(value, "%s", e->name); - else { - dmasprintf(value, "%s %s", ptr, e->name); - dmfree(ptr); - } - } - } - return 0; -} - -static int get_rule_source_mac(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *v = NULL; - dmuci_get_value_by_section_string((struct uci_section *)data, "src_mac", &v); - *value = (v) ? v : ""; - return 0; -} - -static int get_time_span_supported_days(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = "mon,tue,wed,thu,fri,sat,sun"; - return 0; -} - -static int get_time_span_days(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *v; - dmuci_get_value_by_section_string((struct uci_section *)data, "weekdays", &v); - *value = (v) ? v : ""; - return 0; -} - -static int get_time_span_start_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *v; - dmuci_get_value_by_section_string((struct uci_section *)data, "start_time", &v); - *value = (v) ? v : ""; - return 0; -} - -static int get_time_span_stop_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *v; - dmuci_get_value_by_section_string((struct uci_section *)data, "stop_time", &v); - *value = (v) ? v : ""; - return 0; -} - static int set_firewall_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) { bool b; @@ -1384,83 +1320,11 @@ static int set_rule_source_port_range_max(char *refparam, struct dmctx *ctx, voi return 0; } -static int set_rule_icmp_type(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - int i; - size_t length; - char **devices = NULL; - - switch (action) { - case VALUECHECK: - //TODO - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "icmp_type", ""); - devices = strsplit(value, " ", &length); - for (i = 0; i < length; i++) - dmuci_add_list_value_by_section((struct uci_section *)data, "icmp_type", devices[i]); - break; - } - return 0; -} - -static int set_rule_source_mac(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - //TODO - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "src_mac", value); - break; - } - return 0; -} - -static int set_time_span_days(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - //TODO - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "weekdays", value); - break; - } - return 0; -} - -static int set_time_span_start_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - //TODO - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "start_time", value); - break; - } - return 0; -} - -static int set_time_span_stop_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - //TODO - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "stop_time", value); - break; - } - return 0; -} - /* *** Device.Firewall. *** */ DMOBJ tFirewallObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Level", &DMREAD, NULL, NULL, NULL, browseLevelInst, NULL, NULL, tFirewallLevelParams, NULL, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, -{"Chain", &DMREAD, NULL, NULL, NULL, browseChainInst, NULL, tFirewallChainObj, tFirewallChainParams, NULL, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Level", &DMREAD, NULL, NULL, NULL, browseLevelInst, NULL, NULL, NULL, tFirewallLevelParams, NULL, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, +{"Chain", &DMREAD, NULL, NULL, NULL, browseChainInst, NULL, NULL, tFirewallChainObj, tFirewallChainParams, NULL, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, {0} }; @@ -1488,8 +1352,8 @@ DMLEAF tFirewallLevelParams[] = { /* *** Device.Firewall.Chain.{i}. *** */ DMOBJ tFirewallChainObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Rule", &DMWRITE, add_firewall_rule, delete_firewall_rule, NULL, browseRuleInst, NULL, tFirewallChainRuleObj, tFirewallChainRuleParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Rule", &DMWRITE, add_firewall_rule, delete_firewall_rule, NULL, browseRuleInst, NULL, NULL, NULL, tFirewallChainRuleParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, {0} }; @@ -1504,12 +1368,6 @@ DMLEAF tFirewallChainParams[] = { }; /* *** Device.Firewall.Chain.{i}.Rule.{i}. *** */ -DMOBJ tFirewallChainRuleObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{CUSTOM_PREFIX"TimeSpan", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tTimeSpanParams, NULL, BBFDM_BOTH}, -{0} -}; - DMLEAF tFirewallChainRuleParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ {"Enable", &DMWRITE, DMT_BOOL, get_rule_enable, set_rule_enable, BBFDM_BOTH}, @@ -1521,9 +1379,7 @@ DMLEAF tFirewallChainRuleParams[] = { //{"TargetChain", &DMWRITE, DMT_STRING, get_rule_target_chain, set_rule_target_chain, BBFDM_BOTH}, {"Log", &DMWRITE, DMT_BOOL, get_rule_log, set_rule_log, BBFDM_BOTH}, {"CreationDate", &DMREAD, DMT_TIME, get_FirewallChainRule_CreationDate, NULL, BBFDM_BOTH}, -#ifndef GENERIC_OPENWRT {"ExpiryDate", &DMWRITE, DMT_TIME, get_FirewallChainRule_ExpiryDate, set_FirewallChainRule_ExpiryDate, BBFDM_BOTH}, -#endif {"SourceInterface", &DMWRITE, DMT_STRING, get_rule_source_interface, set_rule_source_interface, BBFDM_BOTH}, {"SourceAllInterfaces", &DMWRITE, DMT_BOOL, get_rule_source_all_interfaces, set_rule_source_all_interfaces, BBFDM_BOTH}, {"DestInterface", &DMWRITE, DMT_STRING, get_rule_dest_interface, set_rule_dest_interface, BBFDM_BOTH}, @@ -1538,16 +1394,5 @@ DMLEAF tFirewallChainRuleParams[] = { {"DestPortRangeMax", &DMWRITE, DMT_INT, get_rule_dest_port_range_max, set_rule_dest_port_range_max, BBFDM_BOTH}, {"SourcePort", &DMWRITE, DMT_INT, get_rule_source_port, set_rule_source_port, BBFDM_BOTH}, {"SourcePortRangeMax", &DMWRITE, DMT_INT, get_rule_source_port_range_max, set_rule_source_port_range_max, BBFDM_BOTH}, -{CUSTOM_PREFIX"ICMPType", &DMWRITE, DMT_STRING, get_rule_icmp_type, set_rule_icmp_type, BBFDM_BOTH}, -{CUSTOM_PREFIX"SourceMACAddress", &DMWRITE, DMT_STRING, get_rule_source_mac, set_rule_source_mac, BBFDM_BOTH}, -{0} -}; - -DMLEAF tTimeSpanParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"SupportedDays", &DMREAD, DMT_STRING, get_time_span_supported_days, NULL, BBFDM_BOTH}, -{"Days", &DMWRITE, DMT_STRING, get_time_span_days, set_time_span_days, BBFDM_BOTH}, -{"StartTime", &DMWRITE, DMT_STRING, get_time_span_start_time, set_time_span_start_time, BBFDM_BOTH}, -{"StopTime", &DMWRITE, DMT_STRING, get_time_span_stop_time, set_time_span_stop_time, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/firewall.h b/dmtree/tr181/firewall.h index 385819b2..c82cb539 100644 --- a/dmtree/tr181/firewall.h +++ b/dmtree/tr181/firewall.h @@ -19,7 +19,5 @@ extern DMLEAF tFirewallLevelParams[]; extern DMLEAF tFirewallChainParams[]; extern DMOBJ tFirewallChainObj[]; extern DMLEAF tFirewallChainRuleParams[]; -extern DMOBJ tFirewallChainRuleObj[]; -extern DMLEAF tTimeSpanParams[]; #endif diff --git a/dmtree/tr181/gre.c b/dmtree/tr181/gre.c index 234b78a6..85b84dc3 100644 --- a/dmtree/tr181/gre.c +++ b/dmtree/tr181/gre.c @@ -416,9 +416,9 @@ static int get_GRETunnelInterfaceStats_ErrorsReceived(char *refparam, struct dmc /* *** Device.GRE. *** */ DMOBJ tGREObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Tunnel", &DMWRITE, addObjGRETunnel, delObjGRETunnel, NULL, browseGRETunnelInst, NULL, tGRETunnelObj, tGRETunnelParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, -//{"Filter", &DMWRITE, addObjGREFilter, delObjGREFilter, NULL, browseGREFilterInst, NULL, NULL, tGREFilterParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Tunnel", &DMWRITE, addObjGRETunnel, delObjGRETunnel, NULL, browseGRETunnelInst, NULL, NULL, tGRETunnelObj, tGRETunnelParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, +//{"Filter", &DMWRITE, addObjGREFilter, delObjGREFilter, NULL, browseGREFilterInst, NULL, NULL, NULL, tGREFilterParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, {0} }; @@ -431,9 +431,9 @@ DMLEAF tGREParams[] = { /* *** Device.GRE.Tunnel.{i}. *** */ DMOBJ tGRETunnelObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tGRETunnelStatsParams, NULL, BBFDM_BOTH}, -{"Interface", &DMWRITE, addObjGRETunnelInterface, delObjGRETunnelInterface, NULL, browseGRETunnelInterfaceInst, NULL, tGRETunnelInterfaceObj, tGRETunnelInterfaceParams, NULL, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tGRETunnelStatsParams, NULL, BBFDM_BOTH}, +{"Interface", &DMWRITE, addObjGRETunnelInterface, delObjGRETunnelInterface, NULL, browseGRETunnelInterfaceInst, NULL, NULL, tGRETunnelInterfaceObj, tGRETunnelInterfaceParams, NULL, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, {0} }; @@ -469,8 +469,8 @@ DMLEAF tGRETunnelStatsParams[] = { /* *** Device.GRE.Tunnel.{i}.Interface.{i}. *** */ DMOBJ tGRETunnelInterfaceObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tGRETunnelInterfaceStatsParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tGRETunnelInterfaceStatsParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/hosts-iopsyswrt.c b/dmtree/tr181/hosts-iopsyswrt.c deleted file mode 100644 index 9aa478d0..00000000 --- a/dmtree/tr181/hosts-iopsyswrt.c +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Copyright (C) 2020 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 Ramdhane - */ - -#include "os.h" -#include "dmentry.h" - -/************************************************************* -* ENTRY METHOD -**************************************************************/ -/*#Device.Hosts.Host.{i}.!UBUS:router.network/hosts//hosts*/ -int os__browseHostsHostInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - json_object *res = NULL, *host_obj = NULL, *arrobj = NULL; - char *inst = NULL, *max_inst = NULL; - int id = 0, i = 0; - - dmubus_call("router.network", "hosts", UBUS_ARGS{}, 0, &res); - dmjson_foreach_obj_in_array(res, arrobj, host_obj, i, 1, "hosts") { - inst = handle_update_instance(1, dmctx, &max_inst, update_instance_without_section, 1, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)host_obj, inst) == DM_STOP) - break; - } - return 0; -} - -/*#Device.Hosts.Host.{i}.IPv4Address.{i}.!UBUS:router.network/hosts//hosts[@i-1].ipv4addr*/ -int os__browseHostsHostIPv4AddressInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - json_object *ip_arr = NULL, *host_obj = (json_object *)prev_data; - char *inst = NULL, *max_inst = NULL, *ipv4addr = NULL; - int id = 0, i = 0; - - dmjson_foreach_value_in_array(host_obj, ip_arr, ipv4addr, i, 1, "ipv4addr") { - inst = handle_update_instance(2, dmctx, &max_inst, update_instance_without_section, 1, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)ipv4addr, inst) == DM_STOP) - break; - } - return 0; -} - -/*#Device.Hosts.Host.{i}.IPv6Address.{i}.!UBUS:router.network/hosts//hosts[@i-1].ipv6addr*/ -int os__browseHostsHostIPv6AddressInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - json_object *ip_arr = NULL, *host_obj = (json_object *)prev_data; - char *inst = NULL, *max_inst = NULL, *ipv6addr = NULL; - int id = 0, i = 0; - - dmjson_foreach_value_in_array(host_obj, ip_arr, ipv6addr, i, 1, "ipv6addr") { - inst = handle_update_instance(2, dmctx, &max_inst, update_instance_without_section, 1, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)ipv6addr, inst) == DM_STOP) - break; - } - return 0; -} - -/************************************************************* -* LINKER -**************************************************************/ -int get_linker_host(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker) -{ - *linker = dmjson_get_value((json_object *)data, 1, "ipaddr"); - return 0; -} - -/************************************************************* -* GET & SET PARAM -**************************************************************/ -/*#Device.Hosts.HostNumberOfEntries!UBUS:router.network/hosts//hosts*/ -int os__get_Hosts_HostNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *res = NULL, *hosts = NULL; - size_t nbre_hosts = 0; - - dmubus_call("router.network", "hosts", UBUS_ARGS{}, 0, &res); - DM_ASSERT(res, *value = "0"); - json_object_object_get_ex(res, "hosts", &hosts); - nbre_hosts = (hosts) ? json_object_array_length(hosts) : 0; - dmasprintf(value, "%d", nbre_hosts); - return 0; -} - -/*#Device.Hosts.Host.{i}.PhysAddress!UBUS:router.network/hosts//hosts[@i-1].macaddr*/ -int os__get_HostsHost_PhysAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "macaddr"); - return 0; -} - -/*#Device.Hosts.Host.{i}.IPAddress!UBUS:router.network/hosts//hosts[@i-1].ipaddr*/ -int os__get_HostsHost_IPAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "ipaddr"); - return 0; -} - -int os__get_HostsHost_DHCPClient(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *linker = dmjson_get_value((json_object *)data, 1, "macaddr"); - adm_entry_get_linker_param(ctx, "Device.DHCPv4.Server.Pool.", linker, value); - if (*value == NULL) - *value = ""; - return 0; -} - -int os__get_HostsHost_AssociatedDevice(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *linker = dmjson_get_value((json_object *)data, 1, "macaddr"); - adm_entry_get_linker_param(ctx, "Device.WiFi.AccessPoint.", linker, value); - if (*value == NULL) - *value = ""; - return 0; -} - -int os__get_HostsHost_Layer1Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *linker = dmjson_get_value((json_object *)data, 1, "device"); - char *type = dmjson_get_value((json_object *)data, 1, "type"); - if (strcmp(type, "wifi") == 0) - adm_entry_get_linker_param(ctx, "Device.WiFi.Radio.", linker, value); - else - adm_entry_get_linker_param(ctx, "Device.Ethernet.Interface.", linker, value); - if (*value == NULL) - *value = ""; - return 0; -} - -int os__get_HostsHost_Layer3Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *linker = dmjson_get_value((json_object *)data, 1, "network"); - adm_entry_get_linker_param(ctx, "Device.IP.Interface.", linker, value); - if (*value == NULL) - *value = ""; - return 0; -} - -/*#Device.Hosts.Host.{i}.InterfaceType!UBUS:router.network/hosts//hosts[@i-1].type*/ -int os__get_HostsHost_InterfaceType(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "type"); - *value = (strcmp(*value, "ethernet") == 0) ? "Ethernet" : "Wi-Fi"; - return 0; -} - -/*#Device.Hosts.Host.{i}.HostName!UBUS:router.network/hosts//hosts[@i-1].hostname*/ -int os__get_HostsHost_HostName(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "hostname"); - return 0; -} - -/*#Device.Hosts.Host.{i}.Active!UBUS:router.network/hosts//hosts[@i-1].active*/ -int os__get_HostsHost_Active(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "active"); - return 0; -} - -/*#Device.Hosts.Host.{i}.ActiveLastChange!UBUS:router.network/hosts//hosts[@i-1].activelstch*/ -int os__get_HostsHost_ActiveLastChange(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = "0001-01-01T00:00:00Z"; - - char *lastchange = dmjson_get_value((json_object *)data, 1, "activelstch"); - if (lastchange && *lastchange != '\0' && atoi(lastchange) > 0) { - time_t t_time = atoi(lastchange); - if (localtime(&t_time) == NULL) - return -1; - - char local_time[32] = {0}; - - if (strftime(local_time, sizeof(local_time), "%Y-%m-%dT%H:%M:%SZ", localtime(&t_time)) == 0) - return -1; - - *value = dmstrdup(local_time); - } - return 0; -} - -/*#Device.Hosts.Host.{i}.IPv4AddressNumberOfEntries!UBUS:router.network/hosts//hosts[@i-1].ipv4addr*/ -int os__get_HostsHost_IPv4AddressNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *ipv4addr = NULL; - size_t nbre_addr = 0; - - json_object_object_get_ex((json_object *)data, "ipv4addr", &ipv4addr); - nbre_addr = (ipv4addr) ? json_object_array_length(ipv4addr) : 0; - dmasprintf(value, "%d", nbre_addr); - return 0; -} - -/*#Device.Hosts.Host.{i}.IPv6AddressNumberOfEntries!UBUS:router.network/hosts//hosts[@i-1].ipv6addr*/ -int os__get_HostsHost_IPv6AddressNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *ipv6addr = NULL; - size_t nbre_addr = 0; - - json_object_object_get_ex((json_object *)data, "ipv6addr", &ipv6addr); - nbre_addr = (ipv6addr) ? json_object_array_length(ipv6addr) : 0; - dmasprintf(value, "%d", nbre_addr); - return 0; -} - -/*#Device.Hosts.Host.{i}.IPv4Address.{i}.IPAddress!UBUS:router.network/hosts//hosts[@i-1].ipv4addr[@i-1]*/ -int os__get_HostsHostIPv4Address_IPAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = (char *)data; - return 0; -} - -/*#Device.Hosts.Host.{i}.IPv6Address.{i}.IPAddress!UBUS:router.network/hosts//hosts[@i-1].ipv6addr[@i-1]*/ -int os__get_HostsHostIPv6Address_IPAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = (char *)data; - return 0; -} - -/*#Device.Hosts.Host.{i}.WANStats.BytesSent!UBUS:router.network/hosts//hosts[@i-1].stats.tx_bytes*/ -int os__get_HostsHostWANStats_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 2, "stats", "tx_bytes"); - return 0; -} - -/*#Device.Hosts.Host.{i}.WANStats.BytesReceived!UBUS:router.network/hosts//hosts[@i-1].stats.rx_bytes*/ -int os__get_HostsHostWANStats_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 2, "stats", "rx_bytes"); - return 0; -} - -/*#Device.Hosts.Host.{i}.WANStats.PacketsSent!UBUS:router.network/hosts//hosts[@i-1].stats.tx_packets*/ -int os__get_HostsHostWANStats_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 2, "stats", "tx_packets"); - return 0; -} - -/*#Device.Hosts.Host.{i}.WANStats.PacketsReceived!UBUS:router.network/hosts//hosts[@i-1].stats.rx_packets*/ -int os__get_HostsHostWANStats_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 2, "stats", "rx_packets"); - return 0; -} diff --git a/dmtree/tr181/hosts-openwrt.c b/dmtree/tr181/hosts-openwrt.c deleted file mode 100644 index 6cde14c0..00000000 --- a/dmtree/tr181/hosts-openwrt.c +++ /dev/null @@ -1,131 +0,0 @@ -#include "os.h" - -static int not_implemented(char **value) -{ - *value = ""; - return 0; -} - -/************************************************************* -* ENTRY METHOD -**************************************************************/ -int os__browseHostsHostInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - return 0; -} - -int os__browseHostsHostIPv4AddressInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - return 0; -} - -int os__browseHostsHostIPv6AddressInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - return 0; -} - -/************************************************************* -* LINKER -**************************************************************/ -int get_linker_host(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker) -{ - return 0; -} - -/************************************************************* -* GET & SET PARAM -**************************************************************/ -int os__get_Hosts_HostNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_HostsHost_PhysAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_HostsHost_IPAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_HostsHost_DHCPClient(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_HostsHost_AssociatedDevice(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_HostsHost_Layer1Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_HostsHost_Layer3Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_HostsHost_InterfaceType(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_HostsHost_HostName(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_HostsHost_Active(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_HostsHost_ActiveLastChange(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_HostsHost_IPv4AddressNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_HostsHost_IPv6AddressNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_HostsHostIPv4Address_IPAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_HostsHostIPv6Address_IPAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_HostsHostWANStats_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_HostsHostWANStats_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_HostsHostWANStats_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_HostsHostWANStats_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} diff --git a/dmtree/tr181/hosts.c b/dmtree/tr181/hosts.c index 47c49d3d..304cf627 100644 --- a/dmtree/tr181/hosts.c +++ b/dmtree/tr181/hosts.c @@ -9,67 +9,305 @@ */ #include "hosts.h" -#include "os.h" +#include "dmentry.h" + +/************************************************************* +* ENTRY METHOD +**************************************************************/ +/*#Device.Hosts.Host.{i}.!UBUS:router.network/hosts//hosts*/ +static int browseHostsHostInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) +{ + json_object *res = NULL, *host_obj = NULL, *arrobj = NULL; + char *inst = NULL, *max_inst = NULL; + int id = 0, i = 0; + + dmubus_call("router.network", "hosts", UBUS_ARGS{}, 0, &res); + dmjson_foreach_obj_in_array(res, arrobj, host_obj, i, 1, "hosts") { + inst = handle_update_instance(1, dmctx, &max_inst, update_instance_without_section, 1, ++id); + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)host_obj, inst) == DM_STOP) + break; + } + return 0; +} + +/*#Device.Hosts.Host.{i}.IPv4Address.{i}.!UBUS:router.network/hosts//hosts[@i-1].ipv4addr*/ +static int browseHostsHostIPv4AddressInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) +{ + json_object *ip_arr = NULL, *host_obj = (json_object *)prev_data; + char *inst = NULL, *max_inst = NULL, *ipv4addr = NULL; + int id = 0, i = 0; + + dmjson_foreach_value_in_array(host_obj, ip_arr, ipv4addr, i, 1, "ipv4addr") { + inst = handle_update_instance(2, dmctx, &max_inst, update_instance_without_section, 1, ++id); + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)ipv4addr, inst) == DM_STOP) + break; + } + return 0; +} + +/*#Device.Hosts.Host.{i}.IPv6Address.{i}.!UBUS:router.network/hosts//hosts[@i-1].ipv6addr*/ +static int browseHostsHostIPv6AddressInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) +{ + json_object *ip_arr = NULL, *host_obj = (json_object *)prev_data; + char *inst = NULL, *max_inst = NULL, *ipv6addr = NULL; + int id = 0, i = 0; + + dmjson_foreach_value_in_array(host_obj, ip_arr, ipv6addr, i, 1, "ipv6addr") { + inst = handle_update_instance(2, dmctx, &max_inst, update_instance_without_section, 1, ++id); + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)ipv6addr, inst) == DM_STOP) + break; + } + return 0; +} + +/************************************************************* +* LINKER +**************************************************************/ +static int get_linker_host(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker) +{ + *linker = dmjson_get_value((json_object *)data, 1, "ipaddr"); + return 0; +} + +/************************************************************* +* GET & SET PARAM +**************************************************************/ +/*#Device.Hosts.HostNumberOfEntries!UBUS:router.network/hosts//hosts*/ +static int get_Hosts_HostNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + json_object *res = NULL, *hosts = NULL; + size_t nbre_hosts = 0; + + dmubus_call("router.network", "hosts", UBUS_ARGS{}, 0, &res); + DM_ASSERT(res, *value = "0"); + json_object_object_get_ex(res, "hosts", &hosts); + nbre_hosts = (hosts) ? json_object_array_length(hosts) : 0; + dmasprintf(value, "%d", nbre_hosts); + return 0; +} + +/*#Device.Hosts.Host.{i}.PhysAddress!UBUS:router.network/hosts//hosts[@i-1].macaddr*/ +static int get_HostsHost_PhysAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "macaddr"); + return 0; +} + +/*#Device.Hosts.Host.{i}.IPAddress!UBUS:router.network/hosts//hosts[@i-1].ipaddr*/ +static int get_HostsHost_IPAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "ipaddr"); + return 0; +} + +static int get_HostsHost_DHCPClient(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + char *linker = dmjson_get_value((json_object *)data, 1, "macaddr"); + adm_entry_get_linker_param(ctx, "Device.DHCPv4.Server.Pool.", linker, value); + if (*value == NULL) + *value = ""; + return 0; +} + +static int get_HostsHost_AssociatedDevice(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + char *linker = dmjson_get_value((json_object *)data, 1, "macaddr"); + adm_entry_get_linker_param(ctx, "Device.WiFi.AccessPoint.", linker, value); + if (*value == NULL) + *value = ""; + return 0; +} + +static int get_HostsHost_Layer1Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + char *linker = dmjson_get_value((json_object *)data, 1, "device"); + char *type = dmjson_get_value((json_object *)data, 1, "type"); + if (strcmp(type, "wifi") == 0) + adm_entry_get_linker_param(ctx, "Device.WiFi.Radio.", linker, value); + else + adm_entry_get_linker_param(ctx, "Device.Ethernet.Interface.", linker, value); + if (*value == NULL) + *value = ""; + return 0; +} + +static int get_HostsHost_Layer3Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + char *linker = dmjson_get_value((json_object *)data, 1, "network"); + adm_entry_get_linker_param(ctx, "Device.IP.Interface.", linker, value); + if (*value == NULL) + *value = ""; + return 0; +} + +/*#Device.Hosts.Host.{i}.InterfaceType!UBUS:router.network/hosts//hosts[@i-1].type*/ +static int get_HostsHost_InterfaceType(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "type"); + *value = (strcmp(*value, "ethernet") == 0) ? "Ethernet" : "Wi-Fi"; + return 0; +} + +/*#Device.Hosts.Host.{i}.HostName!UBUS:router.network/hosts//hosts[@i-1].hostname*/ +static int get_HostsHost_HostName(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "hostname"); + return 0; +} + +/*#Device.Hosts.Host.{i}.Active!UBUS:router.network/hosts//hosts[@i-1].active*/ +static int get_HostsHost_Active(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "active"); + return 0; +} + +/*#Device.Hosts.Host.{i}.ActiveLastChange!UBUS:router.network/hosts//hosts[@i-1].activelstch*/ +static int get_HostsHost_ActiveLastChange(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = "0001-01-01T00:00:00Z"; + + char *lastchange = dmjson_get_value((json_object *)data, 1, "activelstch"); + if (lastchange && *lastchange != '\0' && atoi(lastchange) > 0) { + time_t t_time = atoi(lastchange); + if (localtime(&t_time) == NULL) + return -1; + + char local_time[32] = {0}; + + if (strftime(local_time, sizeof(local_time), "%Y-%m-%dT%H:%M:%SZ", localtime(&t_time)) == 0) + return -1; + + *value = dmstrdup(local_time); + } + return 0; +} + +/*#Device.Hosts.Host.{i}.IPv4AddressNumberOfEntries!UBUS:router.network/hosts//hosts[@i-1].ipv4addr*/ +static int get_HostsHost_IPv4AddressNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + json_object *ipv4addr = NULL; + size_t nbre_addr = 0; + + json_object_object_get_ex((json_object *)data, "ipv4addr", &ipv4addr); + nbre_addr = (ipv4addr) ? json_object_array_length(ipv4addr) : 0; + dmasprintf(value, "%d", nbre_addr); + return 0; +} + +/*#Device.Hosts.Host.{i}.IPv6AddressNumberOfEntries!UBUS:router.network/hosts//hosts[@i-1].ipv6addr*/ +static int get_HostsHost_IPv6AddressNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + json_object *ipv6addr = NULL; + size_t nbre_addr = 0; + + json_object_object_get_ex((json_object *)data, "ipv6addr", &ipv6addr); + nbre_addr = (ipv6addr) ? json_object_array_length(ipv6addr) : 0; + dmasprintf(value, "%d", nbre_addr); + return 0; +} + +/*#Device.Hosts.Host.{i}.IPv4Address.{i}.IPAddress!UBUS:router.network/hosts//hosts[@i-1].ipv4addr[@i-1]*/ +static int get_HostsHostIPv4Address_IPAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = (char *)data; + return 0; +} + +/*#Device.Hosts.Host.{i}.IPv6Address.{i}.IPAddress!UBUS:router.network/hosts//hosts[@i-1].ipv6addr[@i-1]*/ +static int get_HostsHostIPv6Address_IPAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = (char *)data; + return 0; +} + +/*#Device.Hosts.Host.{i}.WANStats.BytesSent!UBUS:router.network/hosts//hosts[@i-1].stats.tx_bytes*/ +static int get_HostsHostWANStats_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 2, "stats", "tx_bytes"); + return 0; +} + +/*#Device.Hosts.Host.{i}.WANStats.BytesReceived!UBUS:router.network/hosts//hosts[@i-1].stats.rx_bytes*/ +static int get_HostsHostWANStats_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 2, "stats", "rx_bytes"); + return 0; +} + +/*#Device.Hosts.Host.{i}.WANStats.PacketsSent!UBUS:router.network/hosts//hosts[@i-1].stats.tx_packets*/ +static int get_HostsHostWANStats_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 2, "stats", "tx_packets"); + return 0; +} + +/*#Device.Hosts.Host.{i}.WANStats.PacketsReceived!UBUS:router.network/hosts//hosts[@i-1].stats.rx_packets*/ +static int get_HostsHostWANStats_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 2, "stats", "rx_packets"); + return 0; +} /* *** Device.Hosts. *** */ DMOBJ tHostsObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Host", &DMREAD, NULL, NULL, NULL, os__browseHostsHostInst, NULL, tHostsHostObj, tHostsHostParams, get_linker_host, BBFDM_BOTH, LIST_KEY{"PhysAddress", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Host", &DMREAD, NULL, NULL, NULL, browseHostsHostInst, NULL, NULL, tHostsHostObj, tHostsHostParams, get_linker_host, BBFDM_BOTH, LIST_KEY{"PhysAddress", NULL}}, {0} }; DMLEAF tHostsParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"HostNumberOfEntries", &DMREAD, DMT_UNINT, os__get_Hosts_HostNumberOfEntries, NULL, BBFDM_BOTH}, +{"HostNumberOfEntries", &DMREAD, DMT_UNINT, get_Hosts_HostNumberOfEntries, NULL, BBFDM_BOTH}, {0} }; /* *** Device.Hosts.Host.{i}. *** */ DMOBJ tHostsHostObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"IPv4Address", &DMREAD, NULL, NULL, NULL, os__browseHostsHostIPv4AddressInst, NULL, NULL, tHostsHostIPv4AddressParams, NULL, BBFDM_BOTH, LIST_KEY{"IPAddress", NULL}}, -{"IPv6Address", &DMREAD, NULL, NULL, NULL, os__browseHostsHostIPv6AddressInst, NULL, NULL, tHostsHostIPv6AddressParams, NULL, BBFDM_BOTH, LIST_KEY{"IPAddress", NULL}}, -{"WANStats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tHostsHostWANStatsParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"IPv4Address", &DMREAD, NULL, NULL, NULL, browseHostsHostIPv4AddressInst, NULL, NULL, NULL, tHostsHostIPv4AddressParams, NULL, BBFDM_BOTH, LIST_KEY{"IPAddress", NULL}}, +{"IPv6Address", &DMREAD, NULL, NULL, NULL, browseHostsHostIPv6AddressInst, NULL, NULL, NULL, tHostsHostIPv6AddressParams, NULL, BBFDM_BOTH, LIST_KEY{"IPAddress", NULL}}, +{"WANStats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tHostsHostWANStatsParams, NULL, BBFDM_BOTH}, {0} }; DMLEAF tHostsHostParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"PhysAddress", &DMREAD, DMT_STRING, os__get_HostsHost_PhysAddress, NULL, BBFDM_BOTH}, -{"IPAddress", &DMREAD, DMT_STRING, os__get_HostsHost_IPAddress, NULL, BBFDM_BOTH}, -{"DHCPClient", &DMREAD, DMT_STRING, os__get_HostsHost_DHCPClient, NULL, BBFDM_BOTH}, -{"AssociatedDevice", &DMREAD, DMT_STRING, os__get_HostsHost_AssociatedDevice, NULL, BBFDM_BOTH}, -{"Layer1Interface", &DMREAD, DMT_STRING, os__get_HostsHost_Layer1Interface, NULL, BBFDM_BOTH}, -{"Layer3Interface", &DMREAD, DMT_STRING, os__get_HostsHost_Layer3Interface, NULL, BBFDM_BOTH}, -{"InterfaceType", &DMREAD, DMT_STRING, os__get_HostsHost_InterfaceType, NULL, BBFDM_BOTH}, -{"HostName", &DMREAD, DMT_STRING, os__get_HostsHost_HostName, NULL, BBFDM_BOTH}, -{"Active", &DMREAD, DMT_BOOL, os__get_HostsHost_Active, NULL, BBFDM_BOTH}, -{"ActiveLastChange", &DMREAD, DMT_TIME, os__get_HostsHost_ActiveLastChange, NULL, BBFDM_BOTH}, -{"IPv4AddressNumberOfEntries", &DMREAD, DMT_UNINT, os__get_HostsHost_IPv4AddressNumberOfEntries, NULL, BBFDM_BOTH}, -{"IPv6AddressNumberOfEntries", &DMREAD, DMT_UNINT, os__get_HostsHost_IPv6AddressNumberOfEntries, NULL, BBFDM_BOTH}, +{"PhysAddress", &DMREAD, DMT_STRING, get_HostsHost_PhysAddress, NULL, BBFDM_BOTH}, +{"IPAddress", &DMREAD, DMT_STRING, get_HostsHost_IPAddress, NULL, BBFDM_BOTH}, +{"DHCPClient", &DMREAD, DMT_STRING, get_HostsHost_DHCPClient, NULL, BBFDM_BOTH}, +{"AssociatedDevice", &DMREAD, DMT_STRING, get_HostsHost_AssociatedDevice, NULL, BBFDM_BOTH}, +{"Layer1Interface", &DMREAD, DMT_STRING, get_HostsHost_Layer1Interface, NULL, BBFDM_BOTH}, +{"Layer3Interface", &DMREAD, DMT_STRING, get_HostsHost_Layer3Interface, NULL, BBFDM_BOTH}, +{"InterfaceType", &DMREAD, DMT_STRING, get_HostsHost_InterfaceType, NULL, BBFDM_BOTH}, +{"HostName", &DMREAD, DMT_STRING, get_HostsHost_HostName, NULL, BBFDM_BOTH}, +{"Active", &DMREAD, DMT_BOOL, get_HostsHost_Active, NULL, BBFDM_BOTH}, +{"ActiveLastChange", &DMREAD, DMT_TIME, get_HostsHost_ActiveLastChange, NULL, BBFDM_BOTH}, +{"IPv4AddressNumberOfEntries", &DMREAD, DMT_UNINT, get_HostsHost_IPv4AddressNumberOfEntries, NULL, BBFDM_BOTH}, +{"IPv6AddressNumberOfEntries", &DMREAD, DMT_UNINT, get_HostsHost_IPv6AddressNumberOfEntries, NULL, BBFDM_BOTH}, {0} }; /* *** Device.Hosts.Host.{i}.IPv4Address.{i}. *** */ DMLEAF tHostsHostIPv4AddressParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"IPAddress", &DMREAD, DMT_STRING, os__get_HostsHostIPv4Address_IPAddress, NULL, BBFDM_BOTH}, +{"IPAddress", &DMREAD, DMT_STRING, get_HostsHostIPv4Address_IPAddress, NULL, BBFDM_BOTH}, {0} }; /* *** Device.Hosts.Host.{i}.IPv6Address.{i}. *** */ DMLEAF tHostsHostIPv6AddressParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"IPAddress", &DMREAD, DMT_STRING, os__get_HostsHostIPv6Address_IPAddress, NULL, BBFDM_BOTH}, +{"IPAddress", &DMREAD, DMT_STRING, get_HostsHostIPv6Address_IPAddress, NULL, BBFDM_BOTH}, {0} }; /* *** Device.Hosts.Host.{i}.WANStats. *** */ DMLEAF tHostsHostWANStatsParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"BytesSent", &DMREAD, DMT_UNINT, os__get_HostsHostWANStats_BytesSent, NULL, BBFDM_BOTH}, -{"BytesReceived", &DMREAD, DMT_UNINT, os__get_HostsHostWANStats_BytesReceived, NULL, BBFDM_BOTH}, -{"PacketsSent", &DMREAD, DMT_UNINT, os__get_HostsHostWANStats_PacketsSent, NULL, BBFDM_BOTH}, -{"PacketsReceived", &DMREAD, DMT_UNINT, os__get_HostsHostWANStats_PacketsReceived, NULL, BBFDM_BOTH}, +{"BytesSent", &DMREAD, DMT_UNINT, get_HostsHostWANStats_BytesSent, NULL, BBFDM_BOTH}, +{"BytesReceived", &DMREAD, DMT_UNINT, get_HostsHostWANStats_BytesReceived, NULL, BBFDM_BOTH}, +{"PacketsSent", &DMREAD, DMT_UNINT, get_HostsHostWANStats_PacketsSent, NULL, BBFDM_BOTH}, +{"PacketsReceived", &DMREAD, DMT_UNINT, get_HostsHostWANStats_PacketsReceived, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/ieee1905.c b/dmtree/tr181/ieee1905.c index ed38e085..c24f60f7 100644 --- a/dmtree/tr181/ieee1905.c +++ b/dmtree/tr181/ieee1905.c @@ -109,24 +109,6 @@ static int browseIEEE1905ALNetworkTopologyChangeLogInst(struct dmctx *dmctx, DMN return 0; } -static int browseIEEE1905ALNetworkTopologyNonIEEE1905NeighborInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - json_object *res = NULL, *arrobj = NULL, *res_self = NULL; - char *inst = NULL, *max_inst = NULL, *obj = NULL; - int id = 0, i = 0; - - dmubus_call("topology", "dump", UBUS_ARGS{}, 0, &res_self); - if (res_self) - json_object_object_get_ex(res_self, "self", &res); - dmjson_foreach_value_in_array(res, arrobj, obj, i, 1, "non1905_neighbors") { - - inst = handle_update_instance(1, dmctx, &max_inst, update_instance_without_section, 1, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)obj, inst) == DM_STOP) - break; - } - return 0; -} - static int browseIEEE1905ALNetworkTopologyIEEE1905DeviceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { json_object *res = NULL, *node = NULL, *arrobj = NULL; @@ -1034,22 +1016,6 @@ static int get_IEEE1905ALNetworkTopology_ChangeLogNumberOfEntries(char *refparam return 0; } -static int get_IEEE1905ALNetworkTopology_NonIEEE1905NeighborNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *res = NULL, *obj = NULL, *obj_nbr = NULL; - size_t num_nodes = 0; - - dmubus_call("topology", "dump", UBUS_ARGS{}, 0, &res); - DM_ASSERT(res, *value = "0"); - json_object_object_get_ex(res, "self", &obj); - if (obj) { - json_object_object_get_ex(obj, "non1905_neighbors", &obj_nbr); - num_nodes = (obj_nbr) ? json_object_array_length(obj_nbr) : 0; - } - dmasprintf(value, "%d", num_nodes); - return 0; -} - static int get_IEEE1905ALNetworkTopologyChangeLog_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { *value = dmjson_get_value((json_object *)data, 1, "timestamp"); @@ -1087,12 +1053,6 @@ static int get_IEEE1905ALNetworkTopologyChangeLog_NeighborId(char *refparam, str return 0; } -static int get_IEEE1905ALNetworkTopologyNonIEEE1905Neighbor(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = (char *)data; - return 0; -} - static int get_IEEE1905ALNetworkTopologyIEEE1905Device_IEEE1905Id(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { *value = dmjson_get_value((json_object *)data, 1, "ieee1905_macaddr"); @@ -1539,8 +1499,8 @@ static int get_IEEE1905ALNetworkingRegistrar_Registrar60(char *refparam, struct ***********************************************************************************************************************************/ /* *** Device.IEEE1905. *** */ DMOBJ tIEEE1905Obj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"AL", &DMREAD, NULL, NULL, NULL, NULL, NULL, tIEEE1905ALObj, tIEEE1905ALParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"AL", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tIEEE1905ALObj, tIEEE1905ALParams, NULL, BBFDM_BOTH}, {0} }; @@ -1552,12 +1512,12 @@ DMLEAF tIEEE1905Params[] = { /* *** Device.IEEE1905.AL. *** */ DMOBJ tIEEE1905ALObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Interface", &DMREAD, NULL, NULL, NULL, browseIEEE1905ALInterfaceInst, NULL, tIEEE1905ALInterfaceObj, tIEEE1905ALInterfaceParams, NULL, BBFDM_BOTH, LIST_KEY{"InterfaceId", NULL}}, -{"ForwardingTable", &DMREAD, NULL, NULL, NULL, NULL, NULL, tIEEE1905ALForwardingTableObj, tIEEE1905ALForwardingTableParams, NULL, BBFDM_BOTH}, -{"NetworkTopology", &DMREAD, NULL, NULL, NULL, NULL, NULL, tIEEE1905ALNetworkTopologyObj, tIEEE1905ALNetworkTopologyParams, NULL, BBFDM_BOTH}, -{"Security", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tIEEE1905ALSecurityParams, NULL, BBFDM_BOTH}, -{"NetworkingRegistrar", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tIEEE1905ALNetworkingRegistrarParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Interface", &DMREAD, NULL, NULL, NULL, browseIEEE1905ALInterfaceInst, NULL, NULL, tIEEE1905ALInterfaceObj, tIEEE1905ALInterfaceParams, NULL, BBFDM_BOTH, LIST_KEY{"InterfaceId", NULL}}, +{"ForwardingTable", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tIEEE1905ALForwardingTableObj, tIEEE1905ALForwardingTableParams, NULL, BBFDM_BOTH}, +{"NetworkTopology", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tIEEE1905ALNetworkTopologyObj, tIEEE1905ALNetworkTopologyParams, NULL, BBFDM_BOTH}, +{"Security", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tIEEE1905ALSecurityParams, NULL, BBFDM_BOTH}, +{"NetworkingRegistrar", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tIEEE1905ALNetworkingRegistrarParams, NULL, BBFDM_BOTH}, {0} }; @@ -1574,9 +1534,9 @@ DMLEAF tIEEE1905ALParams[] = { /* *** Device.IEEE1905.AL.Interface.{i}. *** */ DMOBJ tIEEE1905ALInterfaceObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -//{"VendorProperties", &DMREAD, NULL, NULL, NULL, browseIEEE1905ALInterfaceVendorPropertiesInst, NULL, NULL, NULL, tIEEE1905ALInterfaceVendorPropertiesParams, NULL, BBFDM_BOTH}, -{"Link", &DMREAD, NULL, NULL, NULL, browseIEEE1905ALInterfaceLinkInst, NULL, tIEEE1905ALInterfaceLinkObj, tIEEE1905ALInterfaceLinkParams, NULL, BBFDM_BOTH, LIST_KEY{"InterfaceId", "IEEE1905Id", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +//{"VendorProperties", &DMREAD, NULL, NULL, NULL, browseIEEE1905ALInterfaceVendorPropertiesInst, NULL, NULL, NULL, NULL, tIEEE1905ALInterfaceVendorPropertiesParams, NULL, BBFDM_BOTH}, +{"Link", &DMREAD, NULL, NULL, NULL, browseIEEE1905ALInterfaceLinkInst, NULL, NULL, tIEEE1905ALInterfaceLinkObj, tIEEE1905ALInterfaceLinkParams, NULL, BBFDM_BOTH, LIST_KEY{"InterfaceId", "IEEE1905Id", NULL}}, {0} }; @@ -1608,8 +1568,8 @@ DMLEAF tIEEE1905ALInterfaceVendorPropertiesParams[] = { /* *** Device.IEEE1905.AL.Interface.{i}.Link.{i}. *** */ DMOBJ tIEEE1905ALInterfaceLinkObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Metric", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tIEEE1905ALInterfaceLinkMetricParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Metric", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tIEEE1905ALInterfaceLinkMetricParams, NULL, BBFDM_BOTH}, {0} }; @@ -1641,8 +1601,8 @@ DMLEAF tIEEE1905ALInterfaceLinkMetricParams[] = { /* *** Device.IEEE1905.AL.ForwardingTable. *** */ DMOBJ tIEEE1905ALForwardingTableObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"ForwardingRule", &DMWRITE, addObjIEEE1905ALForwardingTableForwardingRule, delObjIEEE1905ALForwardingTableForwardingRule, NULL, browseIEEE1905ALForwardingTableForwardingRuleInst, NULL, NULL, tIEEE1905ALForwardingTableForwardingRuleParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"ForwardingRule", &DMWRITE, addObjIEEE1905ALForwardingTableForwardingRule, delObjIEEE1905ALForwardingTableForwardingRule, NULL, browseIEEE1905ALForwardingTableForwardingRuleInst, NULL, NULL, NULL, tIEEE1905ALForwardingTableForwardingRuleParams, NULL, BBFDM_BOTH}, {0} }; @@ -1672,10 +1632,9 @@ DMLEAF tIEEE1905ALForwardingTableForwardingRuleParams[] = { /* *** Device.IEEE1905.AL.NetworkTopology. *** */ DMOBJ tIEEE1905ALNetworkTopologyObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"ChangeLog", &DMREAD, NULL, NULL, NULL, browseIEEE1905ALNetworkTopologyChangeLogInst, NULL, NULL, tIEEE1905ALNetworkTopologyChangeLogParams, NULL, BBFDM_BOTH}, -{"IEEE1905Device", &DMREAD, NULL, NULL, NULL, browseIEEE1905ALNetworkTopologyIEEE1905DeviceInst, NULL, tIEEE1905ALNetworkTopologyIEEE1905DeviceObj, tIEEE1905ALNetworkTopologyIEEE1905DeviceParams, NULL, BBFDM_BOTH, LIST_KEY{"IEEE1905Id", NULL}}, -{CUSTOM_PREFIX"NonIEEE1905Neighbor", &DMREAD, NULL, NULL, NULL, browseIEEE1905ALNetworkTopologyNonIEEE1905NeighborInst, NULL, NULL, tIEEE1905ALNetworkTopologyNonIEEE1905NeighborParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"ChangeLog", &DMREAD, NULL, NULL, NULL, browseIEEE1905ALNetworkTopologyChangeLogInst, NULL, NULL, NULL, tIEEE1905ALNetworkTopologyChangeLogParams, NULL, BBFDM_BOTH}, +{"IEEE1905Device", &DMREAD, NULL, NULL, NULL, browseIEEE1905ALNetworkTopologyIEEE1905DeviceInst, NULL, NULL, tIEEE1905ALNetworkTopologyIEEE1905DeviceObj, tIEEE1905ALNetworkTopologyIEEE1905DeviceParams, NULL, BBFDM_BOTH, LIST_KEY{"IEEE1905Id", NULL}}, {0} }; @@ -1687,7 +1646,6 @@ DMLEAF tIEEE1905ALNetworkTopologyParams[] = { {"LastChange", &DMREAD, DMT_STRING, get_IEEE1905ALNetworkTopology_LastChange, NULL, BBFDM_BOTH}, {"IEEE1905DeviceNumberOfEntries", &DMREAD, DMT_UNINT, get_IEEE1905ALNetworkTopology_IEEE1905DeviceNumberOfEntries, NULL, BBFDM_BOTH}, {"ChangeLogNumberOfEntries", &DMREAD, DMT_UNINT, get_IEEE1905ALNetworkTopology_ChangeLogNumberOfEntries, NULL, BBFDM_BOTH}, -{CUSTOM_PREFIX"NonIEEE1905NeighborNumberOfEntries", &DMREAD, DMT_UNINT, get_IEEE1905ALNetworkTopology_NonIEEE1905NeighborNumberOfEntries, NULL, BBFDM_BOTH}, {0} }; @@ -1703,24 +1661,17 @@ DMLEAF tIEEE1905ALNetworkTopologyChangeLogParams[] = { {0} }; -/* *** Device.IEEE1905.AL.NetworkTopology.{CUSTOM_PREFIX}NonIEEE1905Neighbor.{i} *** */ -DMLEAF tIEEE1905ALNetworkTopologyNonIEEE1905NeighborParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"NonIEEE1905NeighborId", &DMREAD, DMT_STRING, get_IEEE1905ALNetworkTopologyNonIEEE1905Neighbor, NULL, BBFDM_BOTH}, -{0} -}; - /* *** Device.IEEE1905.AL.NetworkTopology.IEEE1905Device.{i}. *** */ DMOBJ tIEEE1905ALNetworkTopologyIEEE1905DeviceObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"IPv4Address", &DMREAD, NULL, NULL, NULL, browseIEEE1905ALNetworkTopologyIEEE1905DeviceIPv4AddressInst, NULL, NULL, tIEEE1905ALNetworkTopologyIEEE1905DeviceIPv4AddressParams, NULL, BBFDM_BOTH, LIST_KEY{"MACAddress", "IPv4Address", NULL}}, -{"IPv6Address", &DMREAD, NULL, NULL, NULL, browseIEEE1905ALNetworkTopologyIEEE1905DeviceIPv6AddressInst, NULL, NULL, tIEEE1905ALNetworkTopologyIEEE1905DeviceIPv6AddressParams, NULL, BBFDM_BOTH, LIST_KEY{"MACAddress", "IPv6Address", NULL}}, -//{"VendorProperties", &DMREAD, NULL, NULL, NULL, browseIEEE1905ALNetworkTopologyIEEE1905DeviceVendorPropertiesInst, NULL, NULL, tIEEE1905ALNetworkTopologyIEEE1905DeviceVendorPropertiesParams, NULL, BBFDM_BOTH}, -{"Interface", &DMREAD, NULL, NULL, NULL, browseIEEE1905ALNetworkTopologyIEEE1905DeviceInterfaceInst, NULL, NULL, tIEEE1905ALNetworkTopologyIEEE1905DeviceInterfaceParams, get_linker_topology_interface, BBFDM_BOTH, LIST_KEY{"InterfaceId", NULL}}, -{"NonIEEE1905Neighbor", &DMREAD, NULL, NULL, NULL, browseIEEE1905ALNetworkTopologyIEEE1905DeviceNonIEEE1905NeighborInst, NULL, NULL, tIEEE1905ALNetworkTopologyIEEE1905DeviceNonIEEE1905NeighborParams, NULL, BBFDM_BOTH, LIST_KEY{"LocalInterface", "NeighborInterfaceId", NULL}}, -{"L2Neighbor", &DMREAD, NULL, NULL, NULL, browseIEEE1905ALNetworkTopologyIEEE1905DeviceL2NeighborInst, NULL, NULL, tIEEE1905ALNetworkTopologyIEEE1905DeviceL2NeighborParams, NULL, BBFDM_BOTH, (const char*[]){"LocalInterface", "NeighborInterfaceId", NULL}}, -{"IEEE1905Neighbor", &DMREAD, NULL, NULL, NULL, browseIEEE1905ALNetworkTopologyIEEE1905DeviceIEEE1905NeighborInst, NULL, tIEEE1905ALNetworkTopologyIEEE1905DeviceIEEE1905NeighborObj, tIEEE1905ALNetworkTopologyIEEE1905DeviceIEEE1905NeighborParams, NULL, BBFDM_BOTH, LIST_KEY{"LocalInterface", "NeighborDeviceId", NULL}}, -{"BridgingTuple", &DMREAD, NULL, NULL, NULL, browseIEEE1905ALNetworkTopologyIEEE1905DeviceBridgingTupleInst, NULL, NULL, tIEEE1905ALNetworkTopologyIEEE1905DeviceBridgingTupleParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"IPv4Address", &DMREAD, NULL, NULL, NULL, browseIEEE1905ALNetworkTopologyIEEE1905DeviceIPv4AddressInst, NULL, NULL, NULL, tIEEE1905ALNetworkTopologyIEEE1905DeviceIPv4AddressParams, NULL, BBFDM_BOTH, LIST_KEY{"MACAddress", "IPv4Address", NULL}}, +{"IPv6Address", &DMREAD, NULL, NULL, NULL, browseIEEE1905ALNetworkTopologyIEEE1905DeviceIPv6AddressInst, NULL, NULL, NULL, tIEEE1905ALNetworkTopologyIEEE1905DeviceIPv6AddressParams, NULL, BBFDM_BOTH, LIST_KEY{"MACAddress", "IPv6Address", NULL}}, +//{"VendorProperties", &DMREAD, NULL, NULL, NULL, browseIEEE1905ALNetworkTopologyIEEE1905DeviceVendorPropertiesInst, NULL, NULL, NULL, tIEEE1905ALNetworkTopologyIEEE1905DeviceVendorPropertiesParams, NULL, BBFDM_BOTH}, +{"Interface", &DMREAD, NULL, NULL, NULL, browseIEEE1905ALNetworkTopologyIEEE1905DeviceInterfaceInst, NULL, NULL, NULL, tIEEE1905ALNetworkTopologyIEEE1905DeviceInterfaceParams, get_linker_topology_interface, BBFDM_BOTH, LIST_KEY{"InterfaceId", NULL}}, +{"NonIEEE1905Neighbor", &DMREAD, NULL, NULL, NULL, browseIEEE1905ALNetworkTopologyIEEE1905DeviceNonIEEE1905NeighborInst, NULL, NULL, NULL, tIEEE1905ALNetworkTopologyIEEE1905DeviceNonIEEE1905NeighborParams, NULL, BBFDM_BOTH, LIST_KEY{"LocalInterface", "NeighborInterfaceId", NULL}}, +{"L2Neighbor", &DMREAD, NULL, NULL, NULL, browseIEEE1905ALNetworkTopologyIEEE1905DeviceL2NeighborInst, NULL, NULL, NULL, tIEEE1905ALNetworkTopologyIEEE1905DeviceL2NeighborParams, NULL, BBFDM_BOTH, (const char*[]){"LocalInterface", "NeighborInterfaceId", NULL}}, +{"IEEE1905Neighbor", &DMREAD, NULL, NULL, NULL, browseIEEE1905ALNetworkTopologyIEEE1905DeviceIEEE1905NeighborInst, NULL, NULL, tIEEE1905ALNetworkTopologyIEEE1905DeviceIEEE1905NeighborObj, tIEEE1905ALNetworkTopologyIEEE1905DeviceIEEE1905NeighborParams, NULL, BBFDM_BOTH, LIST_KEY{"LocalInterface", "NeighborDeviceId", NULL}}, +{"BridgingTuple", &DMREAD, NULL, NULL, NULL, browseIEEE1905ALNetworkTopologyIEEE1905DeviceBridgingTupleInst, NULL, NULL, NULL, tIEEE1905ALNetworkTopologyIEEE1905DeviceBridgingTupleParams, NULL, BBFDM_BOTH}, {0} }; @@ -1810,8 +1761,8 @@ DMLEAF tIEEE1905ALNetworkTopologyIEEE1905DeviceL2NeighborParams[] = { /* *** Device.IEEE1905.AL.NetworkTopology.IEEE1905Device.{i}.IEEE1905Neighbor.{i}. *** */ DMOBJ tIEEE1905ALNetworkTopologyIEEE1905DeviceIEEE1905NeighborObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Metric", &DMREAD, NULL, NULL, NULL, browseIEEE1905ALNetworkTopologyIEEE1905DeviceIEEE1905NeighborMetricInst, NULL, NULL, tIEEE1905ALNetworkTopologyIEEE1905DeviceIEEE1905NeighborMetricParams, NULL, BBFDM_BOTH, LIST_KEY{"NeighborMACAddress", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Metric", &DMREAD, NULL, NULL, NULL, browseIEEE1905ALNetworkTopologyIEEE1905DeviceIEEE1905NeighborMetricInst, NULL, NULL, NULL, tIEEE1905ALNetworkTopologyIEEE1905DeviceIEEE1905NeighborMetricParams, NULL, BBFDM_BOTH, LIST_KEY{"NeighborMACAddress", NULL}}, {0} }; diff --git a/dmtree/tr181/ieee1905.h b/dmtree/tr181/ieee1905.h index 3038be59..e58a2911 100644 --- a/dmtree/tr181/ieee1905.h +++ b/dmtree/tr181/ieee1905.h @@ -29,7 +29,6 @@ extern DMLEAF tIEEE1905ALForwardingTableForwardingRuleParams[]; extern DMOBJ tIEEE1905ALNetworkTopologyObj[]; extern DMLEAF tIEEE1905ALNetworkTopologyParams[]; extern DMLEAF tIEEE1905ALNetworkTopologyChangeLogParams[]; -extern DMLEAF tIEEE1905ALNetworkTopologyNonIEEE1905NeighborParams[]; extern DMOBJ tIEEE1905ALNetworkTopologyIEEE1905DeviceObj[]; extern DMLEAF tIEEE1905ALNetworkTopologyIEEE1905DeviceParams[]; extern DMLEAF tIEEE1905ALNetworkTopologyIEEE1905DeviceIPv4AddressParams[]; diff --git a/dmtree/tr181/ip.c b/dmtree/tr181/ip.c index 5b969c3c..bca1b04a 100644 --- a/dmtree/tr181/ip.c +++ b/dmtree/tr181/ip.c @@ -66,21 +66,6 @@ static int get_ip_iface_sysfs(const struct uci_section *data, const char *name, return get_net_iface_sysfs(section_name((struct uci_section *)data), name, value); } -static void create_firewall_zone_config(char *iface) -{ - struct uci_section *s; - char name[16]; - - snprintf(name, sizeof(name), "fwl_%s", iface); - - dmuci_add_section("firewall", "zone", &s); - dmuci_set_value_by_section(s, "name", name); - dmuci_set_value_by_section(s, "input", "DROP"); - dmuci_set_value_by_section(s, "forward", "DROP"); - dmuci_set_value_by_section(s, "output", "ACCEPT"); - dmuci_set_value_by_section(s, "network", iface); -} - static int parse_proc_intf6_line(const char *line, const char *device, char *ipstr, size_t str_len) { char ip6buf[INET6_ADDRSTRLEN] = {0}, dev[32] = {0}; @@ -1866,50 +1851,6 @@ static int get_IPInterfaceIPv4Address_AddressingType(char *refparam, struct dmct return 0; } -static int get_IPInterfaceIPv4Address_X_IOPSYS_EU_FirewallEnabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct uci_section *s = NULL; - char *input = NULL, *forward = NULL; - - *value = "0"; - uci_foreach_option_cont("firewall", "zone", "network", section_name(((struct intf_ip_args *)data)->interface_sec), s) { - dmuci_get_value_by_section_string(s, "input", &input); - dmuci_get_value_by_section_string(s, "forward", &forward); - if (input && strcmp(input, "ACCEPT") != 0 && forward && strcmp(forward, "ACCEPT") != 0) { - *value = "1"; - break; - } - } - - return 0; -} - -static int set_IPInterfaceIPv4Address_X_IOPSYS_EU_FirewallEnabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - struct uci_section *s = NULL; - int cnt = 0; - bool b; - - switch (action) { - case VALUECHECK: - if (dm_validate_boolean(value)) - return FAULT_9007; - break; - case VALUESET: - string_to_bool(value, &b); - value = b ? "DROP" : "ACCEPT"; - uci_foreach_option_cont("firewall", "zone", "network", section_name(((struct intf_ip_args *)data)->interface_sec), s) { - dmuci_set_value_by_section(s, "input", value); - dmuci_set_value_by_section(s, "forward", value); - cnt++; - } - if (cnt == 0 && b) - create_firewall_zone_config(section_name(((struct intf_ip_args *)data)->interface_sec)); - break; - } - return 0; -} - /*#Device.IP.Interface.{i}.IPv6Address.{i}.Enable!UCI:network/interface,@i-1/ipv6*/ static int get_IPInterfaceIPv6Address_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { @@ -2409,10 +2350,10 @@ static int get_IPInterfaceStats_MulticastPacketsReceived(char *refparam, struct ***********************************************************************************************************************************/ /* *** Device.IP. *** */ DMOBJ tIPObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Interface", &DMWRITE, addObjIPInterface, delObjIPInterface, NULL, browseIPInterfaceInst, NULL, tIPInterfaceObj, tIPInterfaceParams, get_linker_ip_interface, BBFDM_BOTH, LIST_KEY{"Alias", "Name", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Interface", &DMWRITE, addObjIPInterface, delObjIPInterface, NULL, browseIPInterfaceInst, NULL, NULL, tIPInterfaceObj, tIPInterfaceParams, get_linker_ip_interface, BBFDM_BOTH, LIST_KEY{"Alias", "Name", NULL}}, #ifdef BBF_TR143 -{"Diagnostics", &DMREAD, NULL, NULL, NULL, NULL, NULL, tIPDiagnosticsObj, tIPDiagnosticsParams, NULL, BBFDM_BOTH}, +{"Diagnostics", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tIPDiagnosticsObj, tIPDiagnosticsParams, NULL, BBFDM_BOTH}, #endif {0} }; @@ -2432,11 +2373,11 @@ DMLEAF tIPParams[] = { /* *** Device.IP.Interface.{i}. *** */ DMOBJ tIPInterfaceObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"IPv4Address", &DMWRITE, addObjIPInterfaceIPv4Address, delObjIPInterfaceIPv4Address, NULL, browseIPInterfaceIPv4AddressInst, NULL, NULL, tIPInterfaceIPv4AddressParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", "IPAddress", "SubnetMask", NULL}}, -{"IPv6Address", &DMWRITE, addObjIPInterfaceIPv6Address, delObjIPInterfaceIPv6Address, NULL, browseIPInterfaceIPv6AddressInst, NULL, NULL, tIPInterfaceIPv6AddressParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", "IPAddress", NULL}}, -{"IPv6Prefix", &DMWRITE, addObjIPInterfaceIPv6Prefix, delObjIPInterfaceIPv6Prefix, NULL, browseIPInterfaceIPv6PrefixInst, NULL, NULL, tIPInterfaceIPv6PrefixParams, get_linker_ipv6_prefix, BBFDM_BOTH, LIST_KEY{"Alias", "Prefix", NULL}}, -{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tIPInterfaceStatsParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"IPv4Address", &DMWRITE, addObjIPInterfaceIPv4Address, delObjIPInterfaceIPv4Address, NULL, browseIPInterfaceIPv4AddressInst, NULL, NULL, NULL, tIPInterfaceIPv4AddressParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", "IPAddress", "SubnetMask", NULL}}, +{"IPv6Address", &DMWRITE, addObjIPInterfaceIPv6Address, delObjIPInterfaceIPv6Address, NULL, browseIPInterfaceIPv6AddressInst, NULL, NULL, NULL, tIPInterfaceIPv6AddressParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", "IPAddress", NULL}}, +{"IPv6Prefix", &DMWRITE, addObjIPInterfaceIPv6Prefix, delObjIPInterfaceIPv6Prefix, NULL, browseIPInterfaceIPv6PrefixInst, NULL, NULL, NULL, tIPInterfaceIPv6PrefixParams, get_linker_ipv6_prefix, BBFDM_BOTH, LIST_KEY{"Alias", "Prefix", NULL}}, +{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tIPInterfaceStatsParams, NULL, BBFDM_BOTH}, {0} }; @@ -2473,7 +2414,6 @@ DMLEAF tIPInterfaceIPv4AddressParams[] = { {"IPAddress", &DMWRITE, DMT_STRING, get_IPInterfaceIPv4Address_IPAddress, set_IPInterfaceIPv4Address_IPAddress, BBFDM_BOTH}, {"SubnetMask", &DMWRITE, DMT_STRING, get_IPInterfaceIPv4Address_SubnetMask, set_IPInterfaceIPv4Address_SubnetMask, BBFDM_BOTH}, {"AddressingType", &DMREAD, DMT_STRING, get_IPInterfaceIPv4Address_AddressingType, NULL, BBFDM_BOTH}, -{CUSTOM_PREFIX"FirewallEnabled", &DMWRITE, DMT_BOOL, get_IPInterfaceIPv4Address_X_IOPSYS_EU_FirewallEnabled, set_IPInterfaceIPv4Address_X_IOPSYS_EU_FirewallEnabled, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/nat.c b/dmtree/tr181/nat.c index 0ef187ea..d8717e1a 100644 --- a/dmtree/tr181/nat.c +++ b/dmtree/tr181/nat.c @@ -434,7 +434,6 @@ static int set_nat_port_mapping_all_interface(char *refparam, struct dmctx *ctx, return 0; } -#ifndef GENERIC_OPENWRT /*#Device.NAT.PortMapping.{i}.LeaseDuration!UCI:firewall/redirect,@i-1/expiry*/ static int get_nat_port_mapping_lease_duration(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { @@ -468,7 +467,6 @@ static int set_nat_port_mapping_lease_duration(char *refparam, struct dmctx *ctx } return 0; } -#endif /*#Device.NAT.PortMapping.{i}.RemoteHost!UCI:firewall/redirect,@i-1/src_dip*/ static int get_nat_port_mapping_remote_host(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) @@ -696,9 +694,9 @@ static int browsePortMappingInst(struct dmctx *dmctx, DMNODE *parent_node, void /* *** Device.NAT. *** */ DMOBJ tNATObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"InterfaceSetting", &DMWRITE, add_NAT_InterfaceSetting, delete_NAT_InterfaceSetting, NULL, browseInterfaceSettingInst, NULL, NULL, tNATInterfaceSettingParams, NULL, BBFDM_BOTH, LIST_KEY{"Interface", "Alias", NULL}}, -{"PortMapping", &DMWRITE, add_NAT_PortMapping, delete_NAT_PortMapping, NULL, browsePortMappingInst, NULL, NULL, tNATPortMappingParams, NULL, BBFDM_BOTH, LIST_KEY{"RemoteHost", "ExternalPort", "Protocol", "Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"InterfaceSetting", &DMWRITE, add_NAT_InterfaceSetting, delete_NAT_InterfaceSetting, NULL, browseInterfaceSettingInst, NULL, NULL, NULL, tNATInterfaceSettingParams, NULL, BBFDM_BOTH, LIST_KEY{"Interface", "Alias", NULL}}, +{"PortMapping", &DMWRITE, add_NAT_PortMapping, delete_NAT_PortMapping, NULL, browsePortMappingInst, NULL, NULL, NULL, tNATPortMappingParams, NULL, BBFDM_BOTH, LIST_KEY{"RemoteHost", "ExternalPort", "Protocol", "Alias", NULL}}, {0} }; @@ -727,9 +725,7 @@ DMLEAF tNATPortMappingParams[] = { {"Alias", &DMWRITE, DMT_STRING, get_nat_port_mapping_alias, set_nat_port_mapping_alias, BBFDM_BOTH}, {"Interface", &DMWRITE, DMT_STRING, get_nat_port_mapping_interface, set_nat_port_mapping_interface, BBFDM_BOTH}, {"AllInterfaces", &DMWRITE, DMT_BOOL, get_nat_port_mapping_all_interface, set_nat_port_mapping_all_interface, BBFDM_BOTH}, -#ifndef GENERIC_OPENWRT {"LeaseDuration", &DMWRITE, DMT_UNINT, get_nat_port_mapping_lease_duration, set_nat_port_mapping_lease_duration, BBFDM_BOTH}, -#endif {"RemoteHost", &DMWRITE, DMT_STRING, get_nat_port_mapping_remote_host, set_nat_port_mapping_remote_host, BBFDM_BOTH}, {"ExternalPort", &DMWRITE, DMT_UNINT, get_nat_port_mapping_external_port, set_nat_port_mapping_external_port, BBFDM_BOTH}, {"ExternalPortEndRange", &DMWRITE, DMT_UNINT, get_nat_port_mapping_external_port_end_range, set_nat_port_mapping_external_port_end_range, BBFDM_BOTH}, diff --git a/dmtree/tr181/os.h b/dmtree/tr181/os.h deleted file mode 100644 index ad837017..00000000 --- a/dmtree/tr181/os.h +++ /dev/null @@ -1,397 +0,0 @@ -#ifndef __BBF_TR181_OPERATING_SYTEM_H -#define __BBF_TR181_OPERATING_SYTEM_H - -#include - -/* IOPSYS-WRT and OpenWrt - */ -char * os__get_deviceid_manufacturer(); -char * os__get_deviceid_productclass(); -char * os__get_deviceid_serialnumber(); -char * os__get_softwareversion(); -char * os__get_deviceid_manufactureroui(); - -int os__get_device_hardwareversion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_device_devicecategory(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_device_additionalhardwareversion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_device_additionalsoftwareversion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_device_modelname(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_device_description(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_base_mac_addr(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); - -int os__get_memory_status_total(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_memory_status_free(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value); - -int os__get_process_cpu_usage(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_process_number_of_entries(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_process_pid(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_process_command(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_process_size(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_process_priority(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_process_cpu_time(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_process_state(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__browseProcessEntriesInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance); - -int os__browseHostsHostInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance); -int os__browseHostsHostIPv4AddressInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance); -int os__browseHostsHostIPv6AddressInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance); -int get_linker_host(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker); -int os__get_Hosts_HostNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_HostsHost_PhysAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_HostsHost_IPAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_HostsHost_DHCPClient(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_HostsHost_AssociatedDevice(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_HostsHost_Layer1Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_HostsHost_Layer3Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_HostsHost_InterfaceType(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_HostsHost_HostName(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_HostsHost_Active(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_HostsHost_ActiveLastChange(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_HostsHost_IPv4AddressNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_HostsHost_IPv6AddressNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_HostsHostIPv4Address_IPAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_HostsHostIPv6Address_IPAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_HostsHostWANStats_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_HostsHostWANStats_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_HostsHostWANStats_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_HostsHostWANStats_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); - -#include "wifi.h" - -int os__get_wlan_bssid(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiRadioStats_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiRadioStats_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiRadioStats_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiRadioStats_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiRadioStats_ErrorsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiRadioStats_ErrorsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiRadioStats_DiscardPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiRadioStats_DiscardPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiRadioStats_FCSErrorCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiSSIDStats_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiSSIDStats_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiSSIDStats_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiSSIDStats_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiSSIDStats_ErrorsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiSSIDStats_ErrorsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiSSIDStats_DiscardPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiSSIDStats_DiscardPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiSSIDStats_UnicastPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiSSIDStats_UnicastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiSSIDStats_MulticastPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiSSIDStats_MulticastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiSSIDStats_BroadcastPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiSSIDStats_BroadcastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiSSIDStats_RetransCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiSSIDStats_FailedRetransCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiSSIDStats_RetryCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiSSIDStats_MultipleRetryCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiSSIDStats_ACKFailureCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiSSIDStats_AggregatedPacketCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiSSIDStats_UnknownProtoPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiAccessPointAssociatedDevice_Active(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiAccessPointAssociatedDevice_Noise(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiAccessPointAssociatedDevice_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiAccessPointAssociatedDevice_LastDataDownlinkRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiAccessPointAssociatedDevice_LastDataUplinkRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiAccessPointAssociatedDevice_SignalStrength(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiAccessPointAssociatedDevice_AssociationTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_access_point_associative_device_statistics_tx_bytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_access_point_associative_device_statistics_rx_bytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_access_point_associative_device_statistics_tx_packets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_access_point_associative_device_statistics_rx_packets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_access_point_associative_device_statistics_tx_errors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_access_point_associative_device_statistics_retrans_count(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_radio_max_bit_rate (char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_radio_frequency(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_radio_supported_frequency_bands(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_radio_channel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_neighboring_wifi_diagnostics_diagnostics_state(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_neighboring_wifi_diagnostics_result_ssid(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_neighboring_wifi_diagnostics_result_bssid(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_neighboring_wifi_diagnostics_result_number_entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_neighboring_wifi_diagnostics_result_noise(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_neighboring_wifi_diagnostics_result_operating_frequency_band(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_neighboring_wifi_diagnostics_result_signal_strength(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_neighboring_wifi_diagnostics_result_channel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_radio_possible_channels(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__browseWifiNeighboringWiFiDiagnosticResultInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance); -int os__get_WiFiRadio_CurrentOperatingChannelBandwidth(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiRadio_SupportedOperatingChannelBandwidths(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_radio_supported_standard(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_access_point_total_associations(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__browse_wifi_associated_device(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance); -char * os__get_radio_frequency_nocache(const struct wifi_radio_args *args); -char * os__get_radio_channel_nocache(const struct wifi_radio_args *args); -void os__wifi_start_scan(const char *radio); -int os_get_wifi_access_point_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_get_radio_operating_standard(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_get_supported_modes(const char *ubus_method, const char *ifname, char **value); -char * os__get_default_wpa_key(); -int os__get_WiFiDataElementsNetwork_ID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__set_WiFiDataElementsNetwork_ID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os__get_WiFiDataElementsNetwork_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetwork_ControllerID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__set_WiFiDataElementsNetwork_ControllerID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os__get_WiFiDataElementsNetwork_DeviceNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDevice_ID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDevice_MultiAPCapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDevice_CollectionInterval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDevice_RadioNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadio_ID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadio_Enabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadio_Noise(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadio_Utilization(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadio_Transmit(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadio_ReceiveSelf(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadio_ReceiveOther(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadio_CurrentOperatingClassProfileNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadio_UnassociatedSTANumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadio_BSSNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadio_ScanResultNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBackhaulSta_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioCapabilities_HTCapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioCapabilities_VHTCapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioCapabilities_HECapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioCapabilities_CapableOperatingClassProfileNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfile_Class(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfile_MaxTxPower(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfile_NonOperable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfile_NumberOfNonOperChan(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_Class(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_Channel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_TxPower(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_BSSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_SSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_Enabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_LastChange(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_UnicastBytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_UnicastBytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_MulticastBytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_MulticastBytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_BroadcastBytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_BroadcastBytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_EstServiceParametersBE(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_EstServiceParametersBK(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_EstServiceParametersVI(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_EstServiceParametersVO(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_STANumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_HTCapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_VHTCapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_HECapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_LastDataDownlinkRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_LastDataUplinkRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_UtilizationReceive(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_UtilizationTransmit(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_EstMACDataRateDownlink(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_EstMACDataRateUplink(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_SignalStrength(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_LastConnectTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_ErrorsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_ErrorsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_RetransCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_MeasurementReport(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_NumberOfMeasureReports(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_IPV4Address(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_IPV6Address(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_Hostname(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioScanResult_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioScanResult_OpClassScanNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScan_OperatingClass(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScan_ChannelScanNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_Channel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_Utilization(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_Noise(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_NeighborBSSNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_BSSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_SSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_SignalStrength(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_ChannelBandwidth(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_ChannelUtilization(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_StationCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioUnassociatedSTA_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsNetworkDeviceRadioUnassociatedSTA_SignalStrength(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsAssociationEvent_AssociationEventDataNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsAssociationEventAssociationEventData_BSSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsAssociationEventAssociationEventData_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsAssociationEventAssociationEventData_StatusCode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsAssociationEventAssociationEventData_HTCapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsAssociationEventAssociationEventData_VHTCapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsAssociationEventAssociationEventData_HECapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsAssociationEventAssociationEventData_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsDisassociationEvent_DisassociationEventDataNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_BSSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_ReasonCode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_ErrorsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_ErrorsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_RetransCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os__browseWiFiDataElementsNetworkDeviceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance); -int os__browseWiFiDataElementsNetworkDeviceRadioInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance); -int os__browseWiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfileInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance); -int os__browseWiFiDataElementsNetworkDeviceRadioBSSInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance); -int os__browseWiFiDataElementsNetworkDeviceRadioScanResultInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance); -int os__browseWiFiDataElementsNetworkDeviceRadioUnassociatedSTAInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance); -int os__browseWiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfileInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance); -int os__browseWiFiDataElementsNetworkDeviceRadioBSSSTAInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance); -int os__browseWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance); -int os__browseWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance); -int os__browseWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSSInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance); -int os__browseWiFiDataElementsAssociationEventAssociationEventDataInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance); -int os__browseWiFiDataElementsDisassociationEventDisassociationEventDataInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance); - -int os_browseQoSClassificationInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance); -int os_browseQoSQueueStatsInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance); -int os_addObjQoSClassification(char *refparam, struct dmctx *ctx, void *data, char **instance); -int os_delObjQoSClassification(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action); -int os_addObjQoSQueueStats(char *refparam, struct dmctx *ctx, void *data, char **instance); -int os_delObjQoSQueueStats(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action); -int os_get_QoS_ClassificationNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_get_QoS_QueueStatsNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_get_QoSClassification_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSClassification_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSClassification_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSClassification_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSClassification_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSClassification_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSClassification_DestIP(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSClassification_DestIP(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSClassification_DestMask(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSClassification_DestMask(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSClassification_SourceIP(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSClassification_SourceIP(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSClassification_SourceMask(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSClassification_SourceMask(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSClassification_Protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSClassification_Protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSClassification_DestPort(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSClassification_DestPort(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSClassification_DestPortRangeMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSClassification_DestPortRangeMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSClassification_SourcePort(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSClassification_SourcePort(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSClassification_SourcePortRangeMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSClassification_SourcePortRangeMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSClassification_SourceMACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSClassification_SourceMACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSClassification_DestMACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSClassification_DestMACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSClassification_Ethertype(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSClassification_Ethertype(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSClassification_IPLengthMin(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSClassification_IPLengthMin(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSClassification_IPLengthMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSClassification_IPLengthMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSClassification_DSCPCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSClassification_DSCPCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSClassification_DSCPMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSClassification_DSCPMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSClassification_EthernetPriorityCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSClassification_EthernetPriorityCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSClassification_VLANIDCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSClassification_VLANIDCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSClassification_TrafficClass(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSClassification_TrafficClass(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSClassification_SourceVendorClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSClassification_SourceVendorClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSClassification_DestVendorClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSClassification_DestVendorClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSClassification_SourceClientID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSClassification_SourceClientID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSClassification_DestClientID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSClassification_DestClientID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSClassification_SourceUserClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSClassification_SourceUserClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSClassification_DestUserClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSClassification_DestUserClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSQueueStats_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSQueueStats_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSQueueStats_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_get_QoSQueueStats_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSQueueStats_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSQueueStats_Queue(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSQueueStats_Queue(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSQueueStats_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSQueueStats_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSQueueStats_OutputPackets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_get_QoSQueueStats_OutputBytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_get_QoSQueueStats_DroppedPackets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_get_QoSQueueStats_DroppedBytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_browseQoSQueueInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance); -int os_browseQoSShaperInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance); -int os_addObjQoSQueue(char *refparam, struct dmctx *ctx, void *data, char **instance); -int os_delObjQoSQueue(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action); -int os_addObjQoSShaper(char *refparam, struct dmctx *ctx, void *data, char **instance); -int os_delObjQoSShaper(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action); -int os_get_QoS_PolicerNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_get_QoS_QueueNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_get_QoS_ShaperNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_get_QoSQueue_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSQueue_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSQueue_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_get_QoSQueue_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSQueue_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSQueue_TrafficClasses(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSQueue_TrafficClasses(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSQueue_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSQueue_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSQueue_Weight(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSQueue_Weight(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSQueue_Precedence(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSQueue_Precedence(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSQueue_SchedulerAlgorithm(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSQueue_SchedulerAlgorithm(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSQueue_ShapingRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSQueue_ShapingRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSQueue_ShapingBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSQueue_ShapingBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSShaper_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSShaper_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSShaper_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_get_QoSShaper_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSShaper_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSShaper_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSShaper_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSShaper_ShapingRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSShaper_ShapingRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSShaper_ShapingBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSShaper_ShapingBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_linker_qos_queue(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker); -int os_get_QoSClassification_Policer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSClassification_Policer(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSPolicer_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSPolicer_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSPolicer_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_get_QoSPolicer_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSPolicer_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSPolicer_CommittedRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSPolicer_CommittedRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSPolicer_CommittedBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSPolicer_CommittedBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSPolicer_ExcessBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSPolicer_ExcessBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSPolicer_PeakRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSPolicer_PeakRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSPolicer_PeakBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSPolicer_PeakBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSPolicer_MeterType(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_set_QoSPolicer_MeterType(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); -int os_get_QoSPolicer_PossibleMeterTypes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); -int os_addObjQoSPolicer(char *refparam, struct dmctx *ctx, void *data, char **instance); -int os_delObjQoSPolicer(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action); -int os_browseQoSPolicerInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance); -#endif diff --git a/dmtree/tr181/ppp.c b/dmtree/tr181/ppp.c index 92ada3a6..27cfe619 100644 --- a/dmtree/tr181/ppp.c +++ b/dmtree/tr181/ppp.c @@ -528,8 +528,8 @@ static int browseInterfaceInst(struct dmctx *dmctx, DMNODE *parent_node, void *p /* *** Device.PPP. *** */ DMOBJ tPPPObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Interface", &DMWRITE, add_ppp_interface, delete_ppp_interface, NULL, browseInterfaceInst, NULL, tPPPInterfaceObj, tPPPInterfaceParams, get_linker_ppp_interface, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Interface", &DMWRITE, add_ppp_interface, delete_ppp_interface, NULL, browseInterfaceInst, NULL, NULL, tPPPInterfaceObj, tPPPInterfaceParams, get_linker_ppp_interface, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, {0} }; @@ -541,11 +541,11 @@ DMLEAF tPPPParams[] = { /* *** Device.PPP.Interface.{i}. *** */ DMOBJ tPPPInterfaceObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"PPPoE", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tPPPInterfacePPPoEParams, NULL, BBFDM_BOTH}, -{"IPCP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tPPPInterfaceIPCPParams, NULL, BBFDM_BOTH}, -{"IPv6CP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tPPPInterfaceIPv6CPParams, NULL, BBFDM_BOTH}, -{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tPPPInterfaceStatsParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"PPPoE", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tPPPInterfacePPPoEParams, NULL, BBFDM_BOTH}, +{"IPCP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tPPPInterfaceIPCPParams, NULL, BBFDM_BOTH}, +{"IPv6CP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tPPPInterfaceIPv6CPParams, NULL, BBFDM_BOTH}, +{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tPPPInterfaceStatsParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/ptm.c b/dmtree/tr181/ptm.c index 46edce59..7339c410 100644 --- a/dmtree/tr181/ptm.c +++ b/dmtree/tr181/ptm.c @@ -328,15 +328,15 @@ static int browsePtmLinkInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre /* *** Device.PTM. *** */ DMOBJ tPTMObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Link", &DMWRITE, add_ptm_link, delete_ptm_link, NULL, browsePtmLinkInst, NULL, tPTMLinkObj, tPTMLinkParams, get_ptm_linker, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Link", &DMWRITE, add_ptm_link, delete_ptm_link, NULL, browsePtmLinkInst, NULL, NULL, tPTMLinkObj, tPTMLinkParams, get_ptm_linker, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, {0} }; /* *** Device.PTM.Link.{i}. *** */ DMOBJ tPTMLinkObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tPTMLinkStatsParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tPTMLinkStatsParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/qos-iopsyswrt.c b/dmtree/tr181/qos-iopsyswrt.c deleted file mode 100644 index c3fcf9cc..00000000 --- a/dmtree/tr181/qos-iopsyswrt.c +++ /dev/null @@ -1,1921 +0,0 @@ -/* - * Copyright (C) 2020 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: Rohit Topno - */ - -#include "dmentry.h" -#include "qos.h" - -/************************************************************* - * ENTRY METHOD -*************************************************************/ -int os_get_linker_qos_queue(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker) -{ - *linker = data ? dmstrdup(section_name((struct uci_section *)data)) : ""; - return 0; -} - -int os_browseQoSClassificationInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - char *inst = NULL, *max_inst = NULL, *value = NULL; - char *ret = NULL; - struct dmmap_dup *p = NULL; - LIST_HEAD(dup_list); - - synchronize_specific_config_sections_with_dmmap("qos", "classify", "dmmap_qos", &dup_list); - list_for_each_entry(p, &dup_list, list) { - - inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3, - p->dmmap_section, "classify_instance", "classifyalias"); - - //synchronizing option src_ip of uci classify section to src_mask/src_ip of dmmap's classify section - dmuci_get_value_by_section_string(p->config_section, "src_ip", &value); - //checking if src_ip is an ip-prefix or ip address and synchronizing accordingly - ret = strstr(value, "/"); - if (ret) - dmuci_set_value_by_section_bbfdm(p->dmmap_section, "src_mask", value); - else - dmuci_set_value_by_section_bbfdm(p->dmmap_section, "src_ip", value); - - //synchronizing option dest_ip of uci classify section to dest_mask/dest_ip of dmmap's classify section - dmuci_get_value_by_section_string(p->config_section, "dest_ip", &value); - //checking if src_ip is an ip-prefix or ip address and synchronizing accordingly - ret = strstr(value, "/"); - if (ret) - dmuci_set_value_by_section_bbfdm(p->dmmap_section, "dest_mask", value); - else - dmuci_set_value_by_section_bbfdm(p->dmmap_section, "dest_ip", value); - - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP) - break; - } - free_dmmap_config_dup_list(&dup_list); - return 0; -} - -int os_browseQoSPolicerInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - char *inst = NULL, *max_inst = NULL; - struct dmmap_dup *p = NULL; - LIST_HEAD(dup_list); - - synchronize_specific_config_sections_with_dmmap("qos", "policer", "dmmap_qos", &dup_list); - list_for_each_entry(p, &dup_list, list) { - - inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3, - p->dmmap_section, "policer_instance", "policeralias"); - - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP) - break; - } - free_dmmap_config_dup_list(&dup_list); - return 0; -} - -/*#Device.QoS.Queue.{i}.!UCI:qos/queue/dmmap_qos*/ -int os_browseQoSQueueInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - char *inst = NULL, *max_inst = NULL; - struct dmmap_dup *p = NULL; - LIST_HEAD(dup_list); - - synchronize_specific_config_sections_with_dmmap("qos", "queue", "dmmap_qos", &dup_list); - list_for_each_entry(p, &dup_list, list) { - - inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3, - p->dmmap_section, "queueinstance", "queuealias"); - - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP) - break; - } - free_dmmap_config_dup_list(&dup_list); - return 0; -} - -int os_browseQoSQueueStatsInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - struct uci_section *s = NULL; - char *inst = NULL, *max_inst = NULL; - - uci_path_foreach_sections(bbfdm, "dmmap_qstats", "queue_stats", s) { - - inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3, - s, "q_instance", "q_alias"); - - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, inst) == DM_STOP) - break; - } - return 0; -} - -int os_browseQoSShaperInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - char *inst = NULL, *max_inst = NULL; - struct dmmap_dup *p = NULL; - LIST_HEAD(dup_list); - - synchronize_specific_config_sections_with_dmmap("qos", "shaper", "dmmap_qos", &dup_list); - list_for_each_entry(p, &dup_list, list) { - - inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3, - p->dmmap_section, "shaperinstance", "shaperalias"); - - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP) - break; - } - free_dmmap_config_dup_list(&dup_list); - return 0; -} - -/************************************************************* - * ADD & DEL OBJ -*************************************************************/ -int os_addObjQoSClassification(char *refparam, struct dmctx *ctx, void *data, char **instance) -{ - struct uci_section *dmmap = NULL, *s = NULL; - - char *inst = get_last_instance_bbfdm("dmmap_qos", "classify", "classify_instance"); - - dmuci_add_section("qos", "classify", &s); - dmuci_set_value_by_section(s, "enable", "0"); - - dmuci_add_section_bbfdm("dmmap_qos", "classify", &dmmap); - dmuci_set_value_by_section(dmmap, "section_name", section_name(s)); - *instance = update_instance(inst, 2, dmmap, "classify_instance"); - return 0; -} - -int os_delObjQoSClassification(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) -{ - struct uci_section *s = NULL, *stmp = NULL, *dmmap_section = NULL; - - switch (del_action) { - case DEL_INST: - if (is_section_unnamed(section_name((struct uci_section *)data))){ - LIST_HEAD(dup_list); - delete_sections_save_next_sections("dmmap_qos", "classify", "classify_instance", section_name((struct uci_section *)data), atoi(instance), &dup_list); - update_dmmap_sections(&dup_list, "classify_instance", "dmmap_qos", "classify"); - dmuci_delete_by_section_unnamed((struct uci_section *)data, NULL, NULL); - } else { - get_dmmap_section_of_config_section("dmmap_qos", "classify", section_name((struct uci_section *)data), &dmmap_section); - dmuci_delete_by_section_unnamed_bbfdm(dmmap_section, NULL, NULL); - - dmuci_delete_by_section((struct uci_section *)data, NULL, NULL); - } - break; - case DEL_ALL: - uci_foreach_sections_safe("qos", "classify", stmp, s) { - get_dmmap_section_of_config_section("dmmap_qos", "classify", section_name(s), &dmmap_section); - dmuci_delete_by_section(dmmap_section, NULL, NULL); - - dmuci_delete_by_section(s, NULL, NULL); - } - break; - } - return 0; -} - -int os_addObjQoSPolicer(char *refparam, struct dmctx *ctx, void *data, char **instance) -{ - struct uci_section *dmmap = NULL, *s = NULL; - - char *inst = get_last_instance_bbfdm("dmmap_qos", "policer", "policer_instance"); - - dmuci_add_section("qos", "policer", &s); - dmuci_set_value_by_section(s, "enable", "0"); - dmuci_set_value_by_section(s, "committed_rate", "0"); - dmuci_set_value_by_section(s, "committed_burst_size", "0"); - dmuci_set_value_by_section(s, "excess_burst_size", "0"); - dmuci_set_value_by_section(s, "peak_rate", "0"); - dmuci_set_value_by_section(s, "peak_burst_size", "0"); - dmuci_set_value_by_section(s, "meter_type", "0"); - dmuci_set_value_by_section(s, "name", section_name(s)); - - dmuci_add_section_bbfdm("dmmap_qos", "policer", &dmmap); - dmuci_set_value_by_section(dmmap, "section_name", section_name(s)); - *instance = update_instance(inst, 2, dmmap, "policer_instance"); - return 0; -} - -int os_delObjQoSPolicer(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) -{ - struct uci_section *s = NULL, *ss = NULL, *dmmap_section = NULL, *sec = NULL; - int found = 0; - char *p_name = NULL; - - switch (del_action) { - case DEL_INST: - // store section name to update corresponding classification - // section if any - dmuci_get_value_by_section_string((struct uci_section *)data, "name", &p_name); - - // Now delete the policer instance - if (is_section_unnamed(section_name((struct uci_section *)data))){ - LIST_HEAD(dup_list); - delete_sections_save_next_sections("dmmap_qos", "policer", "policer_instance", section_name((struct uci_section *)data), atoi(instance), &dup_list); - update_dmmap_sections(&dup_list, "policer_instance", "dmmap_qos", "policer"); - dmuci_delete_by_section_unnamed((struct uci_section *)data, NULL, NULL); - } else { - get_dmmap_section_of_config_section("dmmap_qos", "policer", section_name((struct uci_section *)data), &dmmap_section); - if (dmmap_section != NULL) - dmuci_delete_by_section_unnamed_bbfdm(dmmap_section, NULL, NULL); - dmuci_delete_by_section((struct uci_section *)data, NULL, NULL); - } - - // Set the Classification.Policer to blank if corresponding - // Policer instance has been deleted - uci_foreach_option_eq("qos", "classify", "policer", p_name, sec) { - dmuci_set_value_by_section(sec, "policer", ""); - } - break; - case DEL_ALL: - uci_foreach_sections("qos", "policer", s) { - if (found != 0){ - get_dmmap_section_of_config_section("dmmap_qos", "policer", section_name(ss), &dmmap_section); - if (dmmap_section != NULL) - dmuci_delete_by_section(dmmap_section, NULL, NULL); - dmuci_delete_by_section(ss, NULL, NULL); - } - ss = s; - found++; - } - if (ss != NULL) { - get_dmmap_section_of_config_section("dmmap_qos", "policer", section_name(ss), &dmmap_section); - if (dmmap_section != NULL) - dmuci_delete_by_section(dmmap_section, NULL, NULL); - dmuci_delete_by_section(ss, NULL, NULL); - } - - // Since all policer have been deleted, we can safely set the - // value of all Classification.Policer params to empty - uci_foreach_sections("qos", "classify", sec) { - dmuci_set_value_by_section(sec, "policer", ""); - } - break; - } - return 0; -} - -int os_addObjQoSQueue(char *refparam, struct dmctx *ctx, void *data, char **instance) -{ - struct uci_section *dmmap = NULL, *s = NULL; - - char *inst = get_last_instance_bbfdm("dmmap_qos", "queue", "queueinstance"); - - dmuci_add_section("qos", "queue", &s); - dmuci_set_value_by_section(s, "enable", "false"); - dmuci_set_value_by_section(s, "weight", "0"); - dmuci_set_value_by_section(s, "precedence", "1"); - dmuci_set_value_by_section(s, "burst_size", "0"); - dmuci_set_value_by_section(s, "scheduling", "SP"); - dmuci_set_value_by_section(s, "rate", "-1"); - - dmuci_add_section_bbfdm("dmmap_qos", "queue", &dmmap); - dmuci_set_value_by_section(dmmap, "section_name", section_name(s)); - *instance = update_instance(inst, 2, dmmap, "queueinstance"); - return 0; -} - -int os_delObjQoSQueue(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) -{ - struct uci_section *s = NULL, *ss = NULL, *dmmap_section= NULL; - int found = 0; - - switch (del_action) { - case DEL_INST: - if (is_section_unnamed(section_name((struct uci_section *)data))){ - LIST_HEAD(dup_list); - delete_sections_save_next_sections("dmmap_qos", "queue", "queueinstance", section_name((struct uci_section *)data), atoi(instance), &dup_list); - update_dmmap_sections(&dup_list, "queueinstance", "dmmap_qos", "queue"); - dmuci_delete_by_section_unnamed((struct uci_section *)data, NULL, NULL); - } else { - get_dmmap_section_of_config_section("dmmap_qos", "queue", section_name((struct uci_section *)data), &dmmap_section); - if (dmmap_section != NULL) - dmuci_delete_by_section_unnamed_bbfdm(dmmap_section, NULL, NULL); - dmuci_delete_by_section((struct uci_section *)data, NULL, NULL); - } - break; - case DEL_ALL: - uci_foreach_sections("qos", "queue", s) { - if (found != 0){ - get_dmmap_section_of_config_section("dmmap_qos", "queue", section_name(ss), &dmmap_section); - if (dmmap_section != NULL) - dmuci_delete_by_section(dmmap_section, NULL, NULL); - dmuci_delete_by_section(ss, NULL, NULL); - } - ss = s; - found++; - } - if (ss != NULL) { - get_dmmap_section_of_config_section("dmmap_qos", "queue", section_name(ss), &dmmap_section); - if (dmmap_section != NULL) - dmuci_delete_by_section(dmmap_section, NULL, NULL); - dmuci_delete_by_section(ss, NULL, NULL); - } - break; - } - return 0; -} - -int os_addObjQoSQueueStats(char *refparam, struct dmctx *ctx, void *data, char **instance) -{ - struct uci_section *qstats_sec = NULL; - - char *inst = get_last_instance_bbfdm("dmmap_qstats", "queue_stats", "q_instance"); - - dmuci_add_section_bbfdm("dmmap_qstats", "queue_stats", &qstats_sec); - *instance = update_instance(inst, 2, qstats_sec, "q_instance"); - - return 0; -} - -int os_delObjQoSQueueStats(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) -{ - struct uci_section *qstats_sec = NULL, *dmmap_section = NULL; - char *inst = NULL; - int i = 0; - - switch (del_action) { - case DEL_INST: - // Remove device section in dmmap_qstats file - uci_path_foreach_option_eq(bbfdm, "dmmap_qstats", "queue_stats", "q_instance", instance, qstats_sec) { - dmmap_section = qstats_sec; - } - dmuci_delete_by_section(dmmap_section, NULL, NULL); - break; - case DEL_ALL: - inst = get_last_instance_bbfdm("dmmap_qstats", "queue_stats", "q_instance"); - - uci_path_foreach_sections(bbfdm, "dmmap_qstats", "queue_stats", qstats_sec) { - if (atoi(inst) == i) { - break; - } - - if (dmmap_section != NULL) { - dmuci_delete_by_section(dmmap_section, NULL, NULL); - } - - dmmap_section = qstats_sec; - i++; - } - - if (dmmap_section != NULL) { - dmuci_delete_by_section(dmmap_section, NULL, NULL); - } - break; - } - return 0; -} - -int os_addObjQoSShaper(char *refparam, struct dmctx *ctx, void *data, char **instance) -{ - struct uci_section *dmmap = NULL, *s = NULL; - - char *inst = get_last_instance_bbfdm("dmmap_qos", "shaper", "shaperinstance"); - - dmuci_add_section("qos", "shaper", &s); - dmuci_set_value_by_section(s, "enable", "0"); - dmuci_set_value_by_section(s, "burst_size", "0"); - dmuci_set_value_by_section(s, "rate", "0"); - - dmuci_add_section_bbfdm("dmmap_qos", "shaper", &dmmap); - dmuci_set_value_by_section(dmmap, "section_name", section_name(s)); - *instance = update_instance(inst, 2, dmmap, "shaperinstance"); - return 0; -} - -int os_delObjQoSShaper(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) -{ - struct uci_section *s = NULL, *ss = NULL, *dmmap_section= NULL; - int found = 0; - - switch (del_action) { - case DEL_INST: - if (is_section_unnamed(section_name((struct uci_section *)data))){ - LIST_HEAD(dup_list); - delete_sections_save_next_sections("dmmap_qos", "shaper", "shaperinstance", section_name((struct uci_section *)data), atoi(instance), &dup_list); - update_dmmap_sections(&dup_list, "shaperinstance", "dmmap_qos", "shaper"); - dmuci_delete_by_section_unnamed((struct uci_section *)data, NULL, NULL); - } else { - get_dmmap_section_of_config_section("dmmap_qos", "shaper", section_name((struct uci_section *)data), &dmmap_section); - if (dmmap_section != NULL) - dmuci_delete_by_section_unnamed_bbfdm(dmmap_section, NULL, NULL); - dmuci_delete_by_section((struct uci_section *)data, NULL, NULL); - } - break; - case DEL_ALL: - uci_foreach_sections("qos", "shaper", s) { - if (found != 0){ - get_dmmap_section_of_config_section("dmmap_qos", "shaper", section_name(ss), &dmmap_section); - if (dmmap_section != NULL) - dmuci_delete_by_section(dmmap_section, NULL, NULL); - dmuci_delete_by_section(ss, NULL, NULL); - } - ss = s; - found++; - } - if (ss != NULL) { - get_dmmap_section_of_config_section("dmmap_qos", "shaper", section_name(ss), &dmmap_section); - if (dmmap_section != NULL) - dmuci_delete_by_section(dmmap_section, NULL, NULL); - dmuci_delete_by_section(ss, NULL, NULL); - } - break; - } - return 0; -} - -/************************************************************* -* COMMON Functions -**************************************************************/ -static int os_get_QoS_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *ifname = NULL; - dmuci_get_value_by_section_string((struct uci_section *)data, "ifname", &ifname); - - adm_entry_get_linker_param(ctx, "Device.IP.Interface.", ifname, value); - if (*value == NULL) - adm_entry_get_linker_param(ctx, "Device.PPP.Interface.", ifname, value); - if (*value == NULL) - adm_entry_get_linker_param(ctx, "Device.Ethernet.Interface.", ifname, value); - if (*value == NULL) - adm_entry_get_linker_param(ctx, "Device.WiFi.Radio.", ifname, value); - if (*value == NULL) - *value = ""; - - return 0; -} - -static int os_set_QoS_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - char *linker = NULL; - - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, NULL)) - return FAULT_9007; - break; - case VALUESET: - adm_entry_get_linker_value(ctx, value, &linker); - if (linker && *linker) { - dmuci_set_value_by_section((struct uci_section *)data, "ifname", linker); - dmfree(linker); - } - break; - } - return 0; -} - -/************************************************************* - * GET & SET PARAM -*************************************************************/ -/*#Device.QoS.ClassificationNumberOfEntries!UCI:qos/classify/*/ -int os_get_QoS_ClassificationNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct uci_section *s = NULL; - int cnt = 0; - - uci_foreach_sections("qos", "classify", s) { - cnt++; - } - dmasprintf(value, "%d", cnt); - return 0; -} - -int os_get_QoS_PolicerNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct uci_section *s = NULL; - int cnt = 0; - - uci_foreach_sections("qos", "policer", s) { - cnt++; - } - dmasprintf(value, "%d", cnt); - return 0; -} - -/*#Device.QoS.QueueNumberOfEntries!UCI:qos/queue*/ -int os_get_QoS_QueueNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct uci_section *s = NULL; - int cnt = 0; - - uci_foreach_sections("qos", "queue", s) { - cnt++; - } - dmasprintf(value, "%d", cnt); - return 0; -} - -int os_get_QoS_QueueStatsNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = "0"; - int cnt = 0; - struct uci_section *s = NULL; - uci_path_foreach_sections(bbfdm, "dmmap_qstats", "queue_stats", s) { - cnt++; - } - dmasprintf(value, "%d", cnt); - return 0; -} - -int os_get_QoS_ShaperNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct uci_section *s = NULL; - int cnt = 0; - - uci_foreach_sections("qos", "shaper", s) { - cnt++; - } - dmasprintf(value, "%d", cnt); - return 0; -} - -int os_get_QoSClassification_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "enable", "1"); - return 0; -} - -int os_set_QoSClassification_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - switch (action) { - case VALUECHECK: - if (dm_validate_boolean(value)) - return FAULT_9007; - break; - case VALUESET: - string_to_bool(value, &b); - dmuci_set_value_by_section((struct uci_section *)data, "enable", (b) ? "1" : "0"); - break; - } - return 0; -} - -int os_get_QoSClassification_DestMask(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct uci_section *dmmap_section = NULL; - get_dmmap_section_of_config_section("dmmap_qos", "classify", section_name((struct uci_section *)data), &dmmap_section); - dmuci_get_value_by_section_string(dmmap_section, "dest_mask", value); - return 0; -} - -int os_set_QoSClassification_DestMask(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - char *dest_ip = NULL; - struct uci_section *dmmap_section = NULL; - - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 49 , NULL, IPPrefix)) - return FAULT_9007; - break; - case VALUESET: - /* Set received value of dest. mask in /etc/bbfdm/dmmap_qos. - * If received value is an empty string then get the value of dest. ip. from dmmap_qos and set it as dest_ip in qos uci file. - * If both received value of dest. mask and the dest. ip from dmmap_qos is empty then delete the dest_ip option from qos uci file. - * Note: setting an empty string as option value in uci or dmmap will delete that option. - * */ - //get dmmap section - get_dmmap_section_of_config_section("dmmap_qos", "classify", section_name((struct uci_section *)data), &dmmap_section); - dmuci_set_value_by_section_bbfdm(dmmap_section, "dest_mask", value); - if (value[0] == '\0') { - //get source ip value from /etc/bbfdm/dmmap_qos and set as dest_ip - dmuci_get_value_by_section_string(dmmap_section, "dest_ip", &dest_ip); - dmuci_set_value_by_section((struct uci_section *)data, "dest_ip", dest_ip); - } else { - dmuci_set_value_by_section((struct uci_section *)data, "dest_ip", value); - } - break; - } - return 0; -} - -int os_get_QoSClassification_SourceMask(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct uci_section *dmmap_section = NULL; - get_dmmap_section_of_config_section("dmmap_qos", "classify", section_name((struct uci_section *)data), &dmmap_section); - dmuci_get_value_by_section_string(dmmap_section, "src_mask", value); - return 0; -} - -int os_set_QoSClassification_SourceMask(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - char *src_ip = NULL; - struct uci_section *dmmap_section = NULL; - - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 49 , NULL, IPPrefix)) - return FAULT_9007; - break; - case VALUESET: - /* Set received value of src. mask in /etc/bbfdm/dmmap_qos. - * If received value is an empty string then get the value of src. ip. from dmmap_qos and set it as src_ip in qos uci file. - * If both received value of src. mask and the src. ip from dmmap_qos is empty then delete the src_ip option from qos uci file. - * Note: setting an empty string as option value in uci or dmmap will delete that option. - * */ - //get dmmap section - get_dmmap_section_of_config_section("dmmap_qos", "classify", section_name((struct uci_section *)data), &dmmap_section); - dmuci_set_value_by_section_bbfdm(dmmap_section, "src_mask", value); - if (value[0] == '\0') { - //get source ip value from /etc/bbfdm/dmmap_qos and set as src_ip - dmuci_get_value_by_section_string(dmmap_section, "src_ip", &src_ip); - dmuci_set_value_by_section((struct uci_section *)data, "src_ip", src_ip); - } else { - dmuci_set_value_by_section((struct uci_section *)data, "src_ip", value); - } - break; - } - return 0; -} - -int os_get_QoSClassification_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct uci_section *dmmap_section = NULL; - - get_dmmap_section_of_config_section("dmmap_qos", "classify", section_name((struct uci_section *)data), &dmmap_section); - dmuci_get_value_by_section_string(dmmap_section, "classifyalias", value); - if ((*value)[0] == '\0') - dmasprintf(value, "cpe-%s", instance); - return 0; -} - -int os_set_QoSClassification_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - struct uci_section *dmmap_section = NULL; - - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, NULL)) - return FAULT_9007; - break; - case VALUESET: - get_dmmap_section_of_config_section("dmmap_qos", "classify", section_name((struct uci_section *)data), &dmmap_section); - dmuci_set_value_by_section_bbfdm(dmmap_section, "classifyalias", value); - break; - } - return 0; -} - -int os_get_QoSClassification_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return os_get_QoS_Interface(refparam, ctx, data, instance, value); -} - -int os_set_QoSClassification_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - return os_set_QoS_Interface(refparam, ctx, data, instance, value, action); -} - -int os_get_QoSClassification_DestIP(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct uci_section *dmmap_section = NULL; - get_dmmap_section_of_config_section("dmmap_qos", "classify", section_name((struct uci_section *)data), &dmmap_section); - dmuci_get_value_by_section_string(dmmap_section, "dest_ip", value); - return 0; -} - -int os_set_QoSClassification_DestIP(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - char *dest_mask = NULL; - struct uci_section *dmmap_section = NULL; - - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 45 , NULL, IPAddress)) - return FAULT_9007; - break; - case VALUESET: - /* If dest. mask parameter from etc/bbfdm/dmmap_qos is present, set this (dest. mask) value as dest_ip in qos uci file - * Else write received dest. ip to /etc/bbfdm/dmmap_qos and qos uci file. - * Also write the received dest. ip value to /etc/bbfdm/dmmap_qos. - * */ - get_dmmap_section_of_config_section("dmmap_qos", "classify", section_name((struct uci_section *)data), &dmmap_section); - dmuci_get_value_by_section_string(dmmap_section, "dest_mask", &dest_mask); - - if (dest_mask[0] != '\0') { - dmuci_set_value_by_section((struct uci_section *)data, "dest_ip", dest_mask); - } else { - //note: setting an option to an empty string will delete that option - dmuci_set_value_by_section((struct uci_section *)data, "dest_ip", value); - } - dmuci_set_value_by_section_bbfdm(dmmap_section, "dest_ip", value); - break; - } - return 0; -} - -int os_get_QoSClassification_SourceIP(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct uci_section *dmmap_section = NULL; - get_dmmap_section_of_config_section("dmmap_qos", "classify", section_name((struct uci_section *)data), &dmmap_section); - dmuci_get_value_by_section_string(dmmap_section, "src_ip", value); - return 0; -} - -int os_set_QoSClassification_SourceIP(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - char *src_mask = NULL; - struct uci_section *dmmap_section = NULL; - - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 45 , NULL, IPAddress)) - return FAULT_9007; - break; - case VALUESET: - /*if source mask parameter from etc/bbfdm/dmmap_qos is present, set this (source mask) value as src_ip in qos uci file - Else write received source ip to /etc/bbfdm/dmmap_qos and qos uci file. - also write the received source ip value to /etc/bbfdm/dmmap_qos. - */ - get_dmmap_section_of_config_section("dmmap_qos", "classify", section_name((struct uci_section *)data), &dmmap_section); - dmuci_get_value_by_section_string(dmmap_section, "src_mask", &src_mask); - - if (src_mask[0] != '\0') { - dmuci_set_value_by_section((struct uci_section *)data, "src_ip", src_mask); - } else { - //note: setting an option to an empty string will delete that option - dmuci_set_value_by_section((struct uci_section *)data, "src_ip", value); - } - dmuci_set_value_by_section_bbfdm(dmmap_section, "src_ip", value); - break; - } - return 0; -} - -int os_get_QoSClassification_Protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "proto", "-1"); - return 0; -} - -int os_set_QoSClassification_Protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_int(value, RANGE_ARGS{{"-1","255"}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "proto", value); - break; - } - return 0; -} - - -int os_get_QoSClassification_DestPort(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "dest_port", "-1"); - return 0; -} - -int os_set_QoSClassification_DestPort(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_int(value, RANGE_ARGS{{"-1","65535"}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "dest_port", value); - break; - } - return 0; -} - -int os_get_QoSClassification_DestPortRangeMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "dest_port_range", "-1"); - return 0; -} - -int os_set_QoSClassification_DestPortRangeMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_int(value, RANGE_ARGS{{"-1","65535"}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "dest_port_range", value); - break; - } - return 0; -} - -int os_get_QoSClassification_SourcePort(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "src_port", "-1"); - return 0; -} - -int os_set_QoSClassification_SourcePort(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_int(value, RANGE_ARGS{{"-1","65535"}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "src_port", value); - break; - } - return 0; -} - -int os_get_QoSClassification_SourcePortRangeMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "src_port_range", "-1"); - return 0; -} - -int os_set_QoSClassification_SourcePortRangeMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_int(value, RANGE_ARGS{{"-1","65535"}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "src_port_range", value); - break; - } - return 0; -} - -int os_get_QoSClassification_SourceMACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "src_mac", value); - return 0; -} - -int os_set_QoSClassification_SourceMACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 17, NULL, MACAddress)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "src_mac", value); - break; - } - return 0; -} - -int os_get_QoSClassification_DestMACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "dst_mac", value); - return 0; -} - -int os_set_QoSClassification_DestMACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 17, NULL, MACAddress)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "dst_mac", value); - break; - } - return 0; -} - -int os_get_QoSClassification_Ethertype(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "ethertype", "-1"); - return 0; -} - -int os_set_QoSClassification_Ethertype(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_int(value, RANGE_ARGS{{"-1",NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "ethertype", value); - break; - } - return 0; -} - -int os_get_QoSClassification_SourceVendorClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "src_vendor_class_id", value); - return 0; -} - -int os_set_QoSClassification_SourceVendorClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 255, NULL, NULL)) - return FAULT_9007; - break; - case VALUESET: - // Set received value of source Vendor ClassID in /etc/config/qos. - dmuci_set_value_by_section((struct uci_section *)data, "src_vendor_class_id", value); - break; - } - return 0; -} - -int os_get_QoSClassification_DestVendorClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "dst_vendor_class_id", value); - return 0; -} - -int os_set_QoSClassification_DestVendorClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 255, NULL, NULL)) - return FAULT_9007; - break; - case VALUESET: - // Set received value of Destination Vendor ClassID in /etc/config/qos. - dmuci_set_value_by_section((struct uci_section *)data, "dst_vendor_class_id", value); - break; - } - return 0; -} - -int os_get_QoSClassification_SourceClientID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *srcclid = NULL, hex[256] = {0}; - - dmuci_get_value_by_section_string((struct uci_section *)data, "src_client_id", &srcclid); - - if (srcclid && *srcclid) - convert_string_to_hex(srcclid, hex); - - *value = (*hex) ? dmstrdup(hex) : ""; - return 0; -} - -int os_set_QoSClassification_SourceClientID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - char res[256] = {0}; - - switch (action) { - case VALUECHECK: - if (dm_validate_hexBinary(value, RANGE_ARGS{{NULL,"65535"}}, 1)) - return FAULT_9007; - break; - case VALUESET: - convert_hex_to_string(value, res); - dmuci_set_value_by_section((struct uci_section *)data, "src_client_id", res); - break; - } - return 0; -} - -int os_get_QoSClassification_DestClientID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *dstclid = NULL, hex[256] = {0}; - - dmuci_get_value_by_section_string((struct uci_section *)data, "dst_client_id", &dstclid); - - if (dstclid && *dstclid) - convert_string_to_hex(dstclid, hex); - - *value = (*hex) ? dmstrdup(hex) : ""; - return 0; -} - -int os_set_QoSClassification_DestClientID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - char res[256] = {0}; - - switch (action) { - case VALUECHECK: - if (dm_validate_hexBinary(value, RANGE_ARGS{{NULL,"65535"}}, 1)) - return FAULT_9007; - break; - case VALUESET: - convert_hex_to_string(value, res); - dmuci_set_value_by_section((struct uci_section *)data, "dst_client_id", res); - break; - } - return 0; -} - -int os_get_QoSClassification_SourceUserClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *srcusrclid = NULL, hex[256] = {0}; - - dmuci_get_value_by_section_string((struct uci_section *)data, "src_user_class_id", &srcusrclid); - - if (srcusrclid && *srcusrclid) - convert_string_to_hex(srcusrclid, hex); - - *value = (*hex) ? dmstrdup(hex) : ""; - return 0; -} - -int os_set_QoSClassification_SourceUserClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - char res[256] = {0}; - - switch (action) { - case VALUECHECK: - if (dm_validate_hexBinary(value, RANGE_ARGS{{NULL,"65535"}}, 1)) - return FAULT_9007; - break; - case VALUESET: - convert_hex_to_string(value, res); - dmuci_set_value_by_section((struct uci_section *)data, "src_user_class_id", res); - break; - } - return 0; -} - -int os_get_QoSClassification_DestUserClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *dstusrclid = NULL, hex[256] = {0}; - - dmuci_get_value_by_section_string((struct uci_section *)data, "dst_user_class_id", &dstusrclid); - - if (dstusrclid && *dstusrclid) - convert_string_to_hex(dstusrclid, hex); - - *value = (*hex) ? dmstrdup(hex) : ""; - return 0; -} - -int os_set_QoSClassification_DestUserClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - char res[256] = {0}; - - switch (action) { - case VALUECHECK: - if (dm_validate_hexBinary(value, RANGE_ARGS{{NULL,"65535"}}, 1)) - return FAULT_9007; - break; - case VALUESET: - convert_hex_to_string(value, res); - dmuci_set_value_by_section((struct uci_section *)data, "dst_user_class_id", res); - break; - } - return 0; -} - -int os_get_QoSClassification_IPLengthMin(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "ip_len_min", "0"); - return 0; -} - -int os_set_QoSClassification_IPLengthMin(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_int(value, RANGE_ARGS{{"0",NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "ip_len_min", value); - break; - } - return 0; -} - -int os_get_QoSClassification_IPLengthMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "ip_len_max", "0"); - return 0; -} - -int os_set_QoSClassification_IPLengthMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_int(value, RANGE_ARGS{{"0",NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "ip_len_max", value); - break; - } - return 0; -} - -int os_get_QoSClassification_DSCPCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "dscp_filter", "-1"); - return 0; -} - -int os_set_QoSClassification_DSCPCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_int(value, RANGE_ARGS{{"-1","63"}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "dscp_filter", value); - break; - } - return 0; -} - -/*#Device.QoS.Classification.{i}.DSCPMark!UCI:qos/classify,@i-1/dscp*/ -int os_get_QoSClassification_DSCPMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "dscp_mark", "-1"); - return 0; -} - -int os_set_QoSClassification_DSCPMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_int(value, RANGE_ARGS{{"-2",NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "dscp_mark", value); - break; - } - return 0; -} -int os_get_QoSClassification_EthernetPriorityCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "pcp_check", "-1"); - return 0; -} - -int os_set_QoSClassification_EthernetPriorityCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_int(value, RANGE_ARGS{{"-1",NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "pcp_check", value); - break; - } - return 0; -} - -int os_get_QoSClassification_VLANIDCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "vid_check", "-1"); - return 0; -} - -int os_set_QoSClassification_VLANIDCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_int(value, RANGE_ARGS{{"-1",NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "vid_check", value); - break; - } - return 0; -} - -int os_get_QoSClassification_TrafficClass(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "traffic_class", "-1"); - return 0; -} - -int os_set_QoSClassification_TrafficClass(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_int(value, RANGE_ARGS{{"-1",NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "traffic_class", value); - break; - } - return 0; -} - -int os_get_QoSClassification_Policer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *linker = NULL; - char *p_inst = NULL; - struct uci_section *dmmap_s = NULL; - - dmuci_get_value_by_section_string((struct uci_section *)data, "policer", &linker); - get_dmmap_section_of_config_section_eq("dmmap_qos", "policer", "section_name", linker, &dmmap_s); - if (dmmap_s != NULL) { - dmuci_get_value_by_section_string(dmmap_s, "policer_instance", &p_inst); - dmasprintf(value, "Device.QoS.Policer.%s", p_inst); - } - - if (*value == NULL) - *value = ""; - return 0; -} - -int os_set_QoSClassification_Policer(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - struct uci_section *dmmap_s = NULL; - char *linker = NULL, link_inst[8] = {0}; - - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, NULL)) - return FAULT_9007; - break; - case VALUESET: - if (strncmp(value, "Device.QoS.Policer.", 19) != 0) - return 0; - - snprintf(link_inst, sizeof(link_inst), "%c", value[19]); - get_dmmap_section_of_config_section_eq("dmmap_qos", "policer", "policer_instance", link_inst, &dmmap_s); - dmuci_get_value_by_section_string(dmmap_s, "section_name", &linker); - dmuci_set_value_by_section((struct uci_section *)data, "policer", linker); - break; - } - return 0; -} - -int os_get_QoSPolicer_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "enable", "1"); - return 0; -} - -int os_set_QoSPolicer_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - switch (action) { - case VALUECHECK: - if (dm_validate_boolean(value)) - return FAULT_9007; - break; - case VALUESET: - string_to_bool(value, &b); - dmuci_set_value_by_section((struct uci_section *)data, "enable", b ? "1" : "0"); - break; - } - return 0; -} - -int os_get_QoSPolicer_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "enable", value); - *value = (*value[0] == '1') ? "Enabled" : "Disabled"; - return 0; -} - -int os_get_QoSPolicer_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct uci_section *dmmap_section = NULL; - - get_dmmap_section_of_config_section("dmmap_qos", "policer", section_name((struct uci_section *)data), &dmmap_section); - dmuci_get_value_by_section_string(dmmap_section, "policeralias", value); - if ((*value)[0] == '\0') - dmasprintf(value, "cpe-%s", instance); - return 0; -} - -int os_set_QoSPolicer_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - struct uci_section *dmmap_section = NULL; - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, NULL)) - return FAULT_9007; - break; - case VALUESET: - get_dmmap_section_of_config_section("dmmap_qos", "policer", section_name((struct uci_section *)data), &dmmap_section); - dmuci_set_value_by_section_bbfdm(dmmap_section, "policeralias", value); - break; - } - return 0; -} - -int os_get_QoSPolicer_CommittedRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "committed_rate", value); - return 0; -} - -int os_set_QoSPolicer_CommittedRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "committed_rate", value); - break; - } - return 0; -} - -int os_get_QoSPolicer_CommittedBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "committed_burst_size", value); - return 0; -} - -int os_set_QoSPolicer_CommittedBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "committed_burst_size", value); - break; - } - return 0; -} - -int os_get_QoSPolicer_ExcessBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "excess_burst_size", value); - return 0; -} - -int os_set_QoSPolicer_ExcessBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "excess_burst_size", value); - break; - } - return 0; -} - -int os_get_QoSPolicer_PeakRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "peak_rate", value); - return 0; -} - -int os_set_QoSPolicer_PeakRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "peak_rate", value); - break; - } - return 0; -} - -int os_get_QoSPolicer_PeakBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "peak_burst_size", value); - return 0; -} - -int os_set_QoSPolicer_PeakBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "peak_burst_size", value); - break; - } - return 0; -} - -int os_get_QoSPolicer_MeterType(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "meter_type", value); - if (strncmp(*value, "1", 1) == 0) - *value = "SingleRateThreeColor"; - else if (strncmp(*value, "2", 1) == 0) - *value = "TwoRateThreeColor"; - else - *value = "SimpleTokenBucket"; - - return 0; -} - -int os_set_QoSPolicer_MeterType(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if ((strcmp("SimpleTokenBucket", value) != 0) && (strcmp("SingleRateThreeColor", value) != 0) && (strcmp("TwoRateThreeColor", value) != 0)) - return FAULT_9007; - break; - case VALUESET: - if (strcmp("SimpleTokenBucket", value) == 0) - dmuci_set_value_by_section((struct uci_section *)data, "meter_type", "0"); - else if (strcmp("SingleRateThreeColor", value) == 0) - dmuci_set_value_by_section((struct uci_section *)data, "meter_type", "1"); - else if (strcmp("TwoRateThreeColor", value) == 0) - dmuci_set_value_by_section((struct uci_section *)data, "meter_type", "2"); - break; - } - return 0; -} - -int os_get_QoSPolicer_PossibleMeterTypes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = "SimpleTokenBucket,SingleRateThreeColor,TwoRateThreeColor"; - return 0; -} - -int os_get_QoSQueue_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "enable", "1"); - return 0; -} - -int os_set_QoSQueue_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - switch (action) { - case VALUECHECK: - if (dm_validate_boolean(value)) - return FAULT_9007; - break; - case VALUESET: - string_to_bool(value, &b); - dmuci_set_value_by_section((struct uci_section *)data, "enable", b ? "1" : "0"); - break; - } - return 0; -} - -int os_get_QoSQueue_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "enable", value); - *value = (*value[0] == '1') ? "Enabled" : "Disabled"; - return 0; -} - -int os_get_QoSQueue_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct uci_section *dmmap_section = NULL; - - get_dmmap_section_of_config_section("dmmap_qos", "queue", section_name((struct uci_section *)data), &dmmap_section); - dmuci_get_value_by_section_string(dmmap_section, "queuealias", value); - if ((*value)[0] == '\0') - dmasprintf(value, "cpe-%s", instance); - return 0; -} - -int os_set_QoSQueue_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - struct uci_section *dmmap_section = NULL; - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, NULL)) - return FAULT_9007; - break; - case VALUESET: - get_dmmap_section_of_config_section("dmmap_qos", "queue", section_name((struct uci_section *)data), &dmmap_section); - dmuci_set_value_by_section_bbfdm(dmmap_section, "queuealias", value); - break; - } - return 0; -} - -int os_get_QoSQueue_TrafficClasses(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "traffic_class", value); - return 0; -} - -int os_set_QoSQueue_TrafficClasses(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "traffic_class", value); - break; - } - return 0; -} - -int os_get_QoSQueue_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return os_get_QoS_Interface(refparam, ctx, data, instance, value); -} - -int os_set_QoSQueue_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - return os_set_QoS_Interface(refparam, ctx, data, instance, value, action); -} - -int os_get_QoSQueue_Weight(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "weight", "0"); - return 0; -} - -int os_set_QoSQueue_Weight(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "weight", value); - break; - } - return 0; -} - -/*#Device.QoS.Queue.{i}.Precedence!UCI:qos/queue,@i-1/precedence*/ -int os_get_QoSQueue_Precedence(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "precedence", "1"); - return 0; -} - -int os_set_QoSQueue_Precedence(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1",NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "precedence", value); - break; - } - return 0; -} - -int os_get_QoSQueue_SchedulerAlgorithm(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "scheduling", "SP"); - return 0; -} - -int os_set_QoSQueue_SchedulerAlgorithm(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, -1, SchedulerAlgorithm, NULL)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "scheduling", value); - break; - } - return 0; -} - -/*#Device.QoS.Queue.{i}.ShapingRate!UCI:qos/class,@i-1/rate*/ -int os_get_QoSQueue_ShapingRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "rate", "-1"); - return 0; -} - - -int os_set_QoSQueue_ShapingRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_int(value, RANGE_ARGS{{"-1",NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "rate", value); - break; - } - return 0; -} - -int os_get_QoSQueue_ShapingBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "burst_size", "0"); - return 0; -} - -int os_set_QoSQueue_ShapingBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "burst_size", value); - break; - } - return 0; -} - -int os_get_QoSQueueStats_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "enabled", "0"); - return 0; -} - -int os_set_QoSQueueStats_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - - switch (action) { - case VALUECHECK: - if (dm_validate_boolean(value)) - return FAULT_9007; - break; - case VALUESET: - string_to_bool(value, &b); - dmuci_set_value_by_section((struct uci_section *)data, "enabled", b ? "1" : "0"); - break; - } - return 0; -} - -int os_get_QoSQueueStats_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - os_get_QoSQueueStats_Enable(refparam, ctx, data, instance, value); - *value = (strcmp(*value, "1") == 0) ? "Enabled" : "Disabled"; - return 0; - -} - -int os_get_QoSQueueStats_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "alias", value); - if ((*value)[0] == '\0') - dmasprintf(value, "cpe-%s", instance); - return 0; -} - -int os_set_QoSQueueStats_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, NULL)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "alias", value); - break; - } - return 0; -} - -int os_get_QoSQueueStats_Queue(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *queue_link; - dmuci_get_value_by_section_string((struct uci_section *)data, "queue", &queue_link); - adm_entry_get_linker_param(ctx, "Device.QoS.Queue.", queue_link, value); - if (*value == NULL) - *value = ""; - return 0; -} - -int os_set_QoSQueueStats_Queue(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - char *queue_link = NULL; - - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, NULL)) - return FAULT_9007; - - if (value == NULL || *value == '\0') - break; - - if (strncmp(value, "Device.QoS.Queue.", 17) != 0) - return FAULT_9007; - - adm_entry_get_linker_value(ctx, value, &queue_link); - if (queue_link == NULL || *queue_link == '\0') - return FAULT_9007; - - break; - case VALUESET: - if (value == NULL || *value == '\0') - break; - - adm_entry_get_linker_value(ctx, value, &queue_link); - dmuci_set_value_by_section((struct uci_section *)data, "queue", queue_link); - break; - } - return 0; -} - -int os_get_QoSQueueStats_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *intf_link; - dmuci_get_value_by_section_string((struct uci_section *)data, "interface", &intf_link); - adm_entry_get_linker_param(ctx, "Device.Ethernet.Interface.", intf_link, value); - if (*value == NULL) - adm_entry_get_linker_param(ctx, "Device.IP.Interface.", intf_link, value); - if (*value == NULL) - adm_entry_get_linker_param(ctx, "Device.PPP.Interface.", intf_link, value); - if (*value == NULL) - *value = ""; - return 0; -} - -int os_set_QoSQueueStats_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - char *intf_link = NULL; - - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, NULL)) - return FAULT_9007; - - if (value == NULL || *value == '\0') - break; - - adm_entry_get_linker_value(ctx, value, &intf_link); - if (intf_link == NULL || *intf_link == '\0') - return FAULT_9007; - - break; - case VALUESET: - if (value == NULL || *value == '\0') - break; - - adm_entry_get_linker_value(ctx, value, &intf_link); - dmuci_set_value_by_section((struct uci_section *)data, "interface", intf_link); - break; - } - return 0; -} - -static int get_QoSQueueStats_value(void *data, char *option, char **value) -{ - char *queue_link = NULL, *intf_link = NULL; - - *value = "0"; - dmuci_get_value_by_section_string((struct uci_section *)data, "queue", &queue_link); - dmuci_get_value_by_section_string((struct uci_section *)data, "interface", &intf_link); - - if (queue_link && *queue_link && intf_link && *intf_link) { - json_object *res = NULL; - char queue_id[8] = {0}; - - snprintf(queue_id, sizeof(queue_id), "%c", queue_link[2]); - dmubus_call("qos", "queue_stats", UBUS_ARGS{{"ifname", intf_link, String}, {"qid", queue_id, Integer}}, 2, &res); - DM_ASSERT(res, *value = "0"); - json_object *queue_obj = dmjson_select_obj_in_array_idx(res, 0, 1, "queues"); - *value = dmjson_get_value(queue_obj, 1, option); - } - return 0; -} - -int os_get_QoSQueueStats_OutputPackets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return get_QoSQueueStats_value(data, "tx_packets", value); -} - -int os_get_QoSQueueStats_OutputBytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return get_QoSQueueStats_value(data, "tx_bytes", value); -} - -int os_get_QoSQueueStats_DroppedPackets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return get_QoSQueueStats_value(data, "tx_dropped_packets", value); -} - -int os_get_QoSQueueStats_DroppedBytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return get_QoSQueueStats_value(data, "tx_dropped_bytes", value); -} - -int os_get_QoSShaper_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "enable", "1"); - return 0; -} - -int os_set_QoSShaper_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - switch (action) { - case VALUECHECK: - if (dm_validate_boolean(value)) - return FAULT_9007; - break; - case VALUESET: - string_to_bool(value, &b); - dmuci_set_value_by_section((struct uci_section *)data, "enable", b ? "1" : "0"); - break; - } - return 0; -} - -int os_get_QoSShaper_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "enable", value); - *value = (*value[0] == '1') ? "Enabled" : "Disabled"; - return 0; -} - -int os_get_QoSShaper_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct uci_section *dmmap_section = NULL; - - get_dmmap_section_of_config_section("dmmap_qos", "shaper", section_name((struct uci_section *)data), &dmmap_section); - dmuci_get_value_by_section_string(dmmap_section, "shaperalias", value); - if ((*value)[0] == '\0') - dmasprintf(value, "cpe-%s", instance); - return 0; -} - -int os_set_QoSShaper_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - struct uci_section *dmmap_section = NULL; - - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, NULL)) - return FAULT_9007; - break; - case VALUESET: - get_dmmap_section_of_config_section("dmmap_qos", "shaper", section_name((struct uci_section *)data), &dmmap_section); - dmuci_set_value_by_section_bbfdm(dmmap_section, "shaperalias", value); - break; - } - return 0; -} - -int os_get_QoSShaper_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return os_get_QoS_Interface(refparam, ctx, data, instance, value); -} - -int os_set_QoSShaper_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - return os_set_QoS_Interface(refparam, ctx, data, instance, value, action); -} - -int os_get_QoSShaper_ShapingRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "rate", "-1"); - return 0; -} - -int os_set_QoSShaper_ShapingRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_int(value, RANGE_ARGS{{"-1",NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "rate", value); - break; - } - return 0; -} - -int os_get_QoSShaper_ShapingBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "burst_size", "0"); - return 0; -} - -int os_set_QoSShaper_ShapingBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "burst_size", value); - break; - } - return 0; -} diff --git a/dmtree/tr181/qos-openwrt.c b/dmtree/tr181/qos-openwrt.c deleted file mode 100644 index 996eb056..00000000 --- a/dmtree/tr181/qos-openwrt.c +++ /dev/null @@ -1,1465 +0,0 @@ -/* - * Copyright (C) 2020 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 - */ - -#include "qos.h" -#include "os.h" - -struct queuestats -{ - struct uci_section *dmsect; - char dev[50]; - char user[50]; - char priomap[50]; - int noqueue; - int pfifo_fast; - int refcnt; - int bands; - int bytes_sent; - int pkt_sent; - int pkt_dropped; - int pkt_overlimits; - int pkt_requeues; - int backlog_b; - int backlog_p; - int backlog_requeues; -}; - -int not_implemented(char **value) -{ - *value = ""; - return 0; -} - -/************************************************************************** -* LINKER -***************************************************************************/ -int os_get_linker_qos_queue(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker) -{ - return not_implemented(linker); -} - -/************************************************************************** -* Browse functions -***************************************************************************/ -/*#Device.QoS.Classification.{i}.!UCI:qos/classify/dmmap_qos*/ -int os_browseQoSClassificationInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - char *inst = NULL, *max_inst = NULL; - struct dmmap_dup *p = NULL; - LIST_HEAD(dup_list); - - synchronize_specific_config_sections_with_dmmap("qos", "classify", "dmmap_qos", &dup_list); - list_for_each_entry(p, &dup_list, list) { - - inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3, - p->dmmap_section, "classifinstance", "classifalias"); - - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP) - break; - } - free_dmmap_config_dup_list(&dup_list); - return 0; -} - -int os_browseQoSPolicerInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - return 0; -} - -int os_browseQoSQueueInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - return 0; -} - -struct uci_section *get_dup_qos_stats_section_in_dmmap(char *dmmap_package, char *section_type, char *dev) -{ - struct uci_section *s = NULL; - - uci_path_foreach_option_eq(bbfdm, dmmap_package, section_type, "dev_link", dev, s) { - return s; - } - - return NULL; -} - -int os_browseQoSQueueStatsInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - struct uci_section *dmmap_sect; - char *questatsout[256], *inst = NULL, *max_inst = NULL, *lastinstancestore = NULL, dev[50] = "", user[50] = ""; - int length = 0, i, ret = 0; - struct queuestats queuests = {0}, emptyquestats = {0}; - regex_t regex1 = {}, regex2 = {}; - - regcomp(®ex1, "^qdisc noqueue [0-9]*: dev [[:alnum:]]* [[:alnum:]]* refcnt [0-9]*", 0); - regcomp(®ex2, "^qdisc pfifo_fast [0-9]*: dev [[:alnum:]]* [[:alnum:]]* refcnt [0-9]*", 0); - - command_exec_output_to_array("tc -s qdisc", questatsout, &length); - - for (i = 0; i < length; i++) { - switch (i%3) { - case 0: ret = regexec(®ex1, questatsout[i], 0, NULL, 0); - if (ret == 0) - sscanf(questatsout[i], "qdisc noqueue %d: dev %49s %49s refcnt %d\n", &queuests.noqueue, dev, user, &queuests.refcnt); - else { - ret= regexec(®ex2, questatsout[i], 0, NULL, 0); - if (ret == 0) - sscanf(questatsout[i], "qdisc pfifo_fast %d: dev %49s %49s refcnt %d\n", &queuests.pfifo_fast, dev, user, &queuests.refcnt); - } - DM_STRNCPY(queuests.dev, dev, sizeof(queuests.dev)); - break; - case 1: sscanf(questatsout[i], " Sent %d bytes %d pkt (dropped %d, overlimits %d requeues %d)\n", &queuests.bytes_sent, &queuests.pkt_sent, &queuests.pkt_dropped, &queuests.pkt_overlimits, &queuests.pkt_requeues); - break; - case 2: sscanf(questatsout[i], " backlog %db %dp requeues %d\n", &queuests.backlog_b, &queuests.backlog_p, &queuests.backlog_requeues); - if ((dmmap_sect = get_dup_qos_stats_section_in_dmmap("dmmap_qos", "qos_queue_stats", queuests.dev)) == NULL) { - dmuci_add_section_bbfdm("dmmap_qos", "qos_queue_stats", &dmmap_sect); - dmuci_set_value_by_section_bbfdm(dmmap_sect, "dev_link", queuests.dev); - } - - queuests.dmsect= dmmap_sect; - - if (lastinstancestore != NULL && max_inst != NULL) - max_inst = dmstrdup(lastinstancestore); - - inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3, - dmmap_sect, "queuestatsinstance", "queuestatsalias"); - - lastinstancestore = dmstrdup(max_inst); - - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&queuests, inst) == DM_STOP) - goto end; - - queuests = emptyquestats; - break; - } - } - - regfree(®ex1); - regfree(®ex2); -end: - return 0; -} - -int os_browseQoSShaperInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - return 0; -} - -int os_addObjQoSClassification(char *refparam, struct dmctx *ctx, void *data, char **instance) -{ - struct uci_section *s, *dmmap_qos_classify; - char qos_comment[32]; - - char *last_inst = get_last_instance_bbfdm("dmmap_qos", "classify", "classifinstance"); - snprintf(qos_comment, sizeof(qos_comment), "QoS classify %s", (last_inst) ? last_inst : "1"); - - dmuci_add_section("qos", "classify", &s); - dmuci_set_value_by_section(s, "comment", qos_comment); - - dmuci_add_section_bbfdm("dmmap_qos", "classify", &dmmap_qos_classify); - dmuci_set_value_by_section(dmmap_qos_classify, "section_name", section_name(s)); - *instance = update_instance(last_inst, 2, dmmap_qos_classify, "classifinstance"); - return 0; -} - -int os_delObjQoSClassification(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) -{ - struct dmmap_dup *p = (struct dmmap_dup*)data; - struct uci_section *s = NULL, *stmp = NULL, *dmmap_section = NULL; - - switch (del_action) { - case DEL_INST: - if(is_section_unnamed(section_name(p->config_section))){ - LIST_HEAD(dup_list); - delete_sections_save_next_sections("dmmap_qos", "classify", "classifinstance", section_name(p->config_section), atoi(instance), &dup_list); - update_dmmap_sections(&dup_list, "classifinstance", "dmmap_qos", "classify"); - dmuci_delete_by_section_unnamed(p->config_section, NULL, NULL); - } else { - get_dmmap_section_of_config_section("dmmap_qos", "classify", section_name(p->config_section), &dmmap_section); - dmuci_delete_by_section_unnamed_bbfdm(dmmap_section, NULL, NULL); - - dmuci_delete_by_section(p->config_section, NULL, NULL); - } - break; - case DEL_ALL: - uci_foreach_sections_safe("qos", "classify", stmp, s) { - get_dmmap_section_of_config_section("dmmap_qos", "classify", section_name(s), &dmmap_section); - dmuci_delete_by_section(dmmap_section, NULL, NULL); - - dmuci_delete_by_section(s, NULL, NULL); - } - break; - } - return 0; -} - -int os_addObjQoSPolicer(char *refparam, struct dmctx *ctx, void *data, char **instance) -{ - //TODO - return 0; -} - -int os_delObjQoSPolicer(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; -} - -int os_addObjQoSQueue(char *refparam, struct dmctx *ctx, void *data, char **instance) -{ - return 0; -} - -int os_delObjQoSQueue(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) -{ - return 0; -} - - -int os_addObjQoSQueueStats(char *refparam, struct dmctx *ctx, void *data, char **instance) -{ - //TODO - return 0; -} - -int os_delObjQoSQueueStats(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) -{ - //TODO - return 0; -} - -int os_addObjQoSShaper(char *refparam, struct dmctx *ctx, void *data, char **instance) -{ - return 0; -} - -int os_delObjQoSShaper(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) -{ - return 0; -} - -/*#Device.QoS.ClassificationNumberOfEntries!UCI:qos/classify/*/ -int os_get_QoS_ClassificationNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct uci_section *s = NULL; - int nbre= 0; - - uci_foreach_sections("qos", "classify", s) { - nbre++; - } - - dmasprintf(value, "%d", nbre); - return 0; -} - -int os_get_QoS_PolicerNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -/*#Device.QoS.QueueNumberOfEntries!UCI:qos/class/*/ -int os_get_QoS_QueueNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_get_QoS_QueueStatsNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *questatsout[256]; - int length = 0; - - command_exec_output_to_array("tc -s qdisc", questatsout, &length); - dmasprintf(value, "%d", length/3); - return 0; -} - -int os_get_QoS_ShaperNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_get_QoSClassification_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_set_QoSClassification_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_boolean(value)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -int os_get_QoSClassification_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct dmmap_dup *p= (struct dmmap_dup*)data; - dmuci_get_value_by_section_string(p->dmmap_section, "classifalias", value); - if ((*value)[0] == '\0') - dmasprintf(value, "cpe-%s", instance); - return 0; -} - -int os_set_QoSClassification_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - struct dmmap_dup *p= (struct dmmap_dup*)data; - - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, NULL)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section(p->dmmap_section, "classifalias", value); - break; - } - return 0; -} - -int os_get_QoSClassification_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct dmmap_dup *p = (struct dmmap_dup *)data; - struct uci_section *s = NULL; - char *classes = NULL, **classesarr = NULL, *classgroup = NULL, *ifaceclassgrp = NULL, *targetclass = NULL; - size_t length; - - dmuci_get_value_by_section_string(p->config_section, "target", &targetclass); - uci_foreach_sections("qos", "classgroup", s) { - dmuci_get_value_by_section_string(s, "classes", &classes); - classesarr = strsplit(classes, " ", &length); - if (classes != NULL && elt_exists_in_array(classesarr, targetclass, length)) { - dmasprintf(&classgroup, "%s", section_name(s)); - break; - } - } - if (classgroup == NULL) - return 0; - uci_foreach_sections("qos", "interface", s) { - dmuci_get_value_by_section_string(s, "classgroup", &ifaceclassgrp); - if (ifaceclassgrp != NULL && strcmp(ifaceclassgrp, classgroup) == 0) { - adm_entry_get_linker_param(ctx, "Device.IP.Interface.", section_name(s), value); - if (*value == NULL) - adm_entry_get_linker_param(ctx, "Device.PPP.Interface.", section_name(s), value); - if (*value == NULL) - adm_entry_get_linker_param(ctx, "Device.Ethernet.Interface.", section_name(s), value); - if (*value == NULL) - *value = ""; - } - } - return 0; -} - -int os_set_QoSClassification_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, NULL)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -int os_get_QoSClassification_DestMask(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - //TODO - *value = ""; - return 0; -} - -int os_set_QoSClassification_DestMask(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 49, NULL, IPPrefix)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -int os_get_QoSClassification_SourceMask(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - //TODO - *value = ""; - return 0; -} - -int os_set_QoSClassification_SourceMask(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 49, NULL, IPPrefix)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -/*#Device.QoS.Classification.{i}.DestIP!UCI:qos/classify,@i-1/dsthost*/ -int os_get_QoSClassification_DestIP(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct dmmap_dup *p= (struct dmmap_dup*)data; - dmuci_get_value_by_section_string(p->config_section, "dsthost", value); - return 0; -} - -int os_set_QoSClassification_DestIP(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - struct dmmap_dup *p= (struct dmmap_dup*)data; - - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 45, NULL, IPAddress)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section(p->config_section, "dsthost", value); - break; - } - return 0; -} - - - -/*#Device.QoS.Classification.{i}.SourceIP!UCI:qos/classify,@i-1/srchost*/ -int os_get_QoSClassification_SourceIP(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct dmmap_dup *p= (struct dmmap_dup*)data; - dmuci_get_value_by_section_string(p->config_section, "srchost", value); - return 0; -} - -int os_set_QoSClassification_SourceIP(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - struct dmmap_dup *p= (struct dmmap_dup*)data; - - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 45, NULL, IPAddress)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section(p->config_section, "srchost", value); - break; - } - return 0; -} - -/*#Device.QoS.Classification.{i}.Protocol!UCI:qos/classify,@i-1/proto*/ -int os_get_QoSClassification_Protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct dmmap_dup *p= (struct dmmap_dup*)data; - dmuci_get_value_by_section_string(p->config_section, "proto", value); - return 0; -} - -int os_set_QoSClassification_Protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - struct dmmap_dup *p= (struct dmmap_dup*)data; - switch (action) { - case VALUECHECK: - if (dm_validate_int(value, RANGE_ARGS{{"-1","255"}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section(p->config_section, "proto", value); - break; - } - return 0; -} - -/*#Device.QoS.Classification.{i}.DestPort!UCI:qos/classify,@i-1/dstports*/ -int os_get_QoSClassification_DestPort(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct dmmap_dup *p= (struct dmmap_dup*)data; - dmuci_get_value_by_section_string(p->config_section, "dstports", value); - return 0; -} - -int os_set_QoSClassification_DestPort(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - struct dmmap_dup *p= (struct dmmap_dup*)data; - - switch (action) { - case VALUECHECK: - if (dm_validate_int(value, RANGE_ARGS{{"-1","65535"}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section(p->config_section, "dstports", value); - break; - } - return 0; -} - -/*#Device.QoS.Classification.{i}.DestPortRangeMax!UCI:qos/classify,@i-1/portrange*/ -int os_get_QoSClassification_DestPortRangeMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct dmmap_dup *p= (struct dmmap_dup*)data; - dmuci_get_value_by_section_string(p->config_section, "portrange", value); - return 0; -} - -int os_set_QoSClassification_DestPortRangeMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - struct dmmap_dup *p= (struct dmmap_dup*)data; - - switch (action) { - case VALUECHECK: - if (dm_validate_int(value, RANGE_ARGS{{"-1","65535"}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section(p->config_section, "portrange", value); - break; - } - return 0; -} - -/*#Device.QoS.Classification.{i}.SourcePort!UCI:qos/classify,@i-1/srcports*/ -int os_get_QoSClassification_SourcePort(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct dmmap_dup *p= (struct dmmap_dup*)data; - dmuci_get_value_by_section_string(p->config_section, "srcports", value); - return 0; -} - -int os_set_QoSClassification_SourcePort(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - struct dmmap_dup *p= (struct dmmap_dup*)data; - - switch (action) { - case VALUECHECK: - if (dm_validate_int(value, RANGE_ARGS{{"-1","65535"}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section(p->config_section, "srcports", value); - break; - } - return 0; -} - -int os_get_QoSClassification_SourcePortRangeMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - //TODO - *value = ""; - return 0; -} - -int os_set_QoSClassification_SourcePortRangeMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_int(value, RANGE_ARGS{{"-1","65535"}}, 1)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -int os_get_QoSClassification_SourceMACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - //TODO - *value = ""; - return 0; -} - -int os_set_QoSClassification_SourceMACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 17, NULL, MACAddress)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -int os_get_QoSClassification_DestMACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - //TODO - *value = ""; - return 0; -} - -int os_set_QoSClassification_DestMACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 17, NULL, MACAddress)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -int os_get_QoSClassification_Ethertype(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - //TODO - *value = ""; - return 0; -} - -int os_set_QoSClassification_Ethertype(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_int(value, RANGE_ARGS{{"-1",NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -int os_get_QoSClassification_SourceVendorClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - //TODO - return 0; -} - -int os_set_QoSClassification_SourceVendorClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 255, NULL, NULL)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -int os_get_QoSClassification_SourceClientID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - //TODO - return 0; -} - -int os_set_QoSClassification_SourceClientID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_hexBinary(value, RANGE_ARGS{{NULL,"65535"}}, 1)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -int os_get_QoSClassification_DestClientID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - //TODO - return 0; -} - -int os_set_QoSClassification_DestClientID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_hexBinary(value, RANGE_ARGS{{NULL,"65535"}}, 1)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -int os_get_QoSClassification_SourceUserClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - //TODO - return 0; -} - -int os_set_QoSClassification_SourceUserClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_hexBinary(value, RANGE_ARGS{{NULL,"65535"}}, 1)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -int os_get_QoSClassification_DestUserClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - //TODO - return 0; -} - -int os_set_QoSClassification_DestUserClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_hexBinary(value, RANGE_ARGS{{NULL,"65535"}}, 1)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -int os_get_QoSClassification_IPLengthMin(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - //TODO - *value = ""; - return 0; -} - -int os_set_QoSClassification_IPLengthMin(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -int os_get_QoSClassification_IPLengthMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - //TODO - *value = ""; - return 0; -} - -int os_set_QoSClassification_IPLengthMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -int os_get_QoSClassification_DSCPCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - //TODO - *value = ""; - return 0; -} - -int os_set_QoSClassification_DSCPCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_int(value, RANGE_ARGS{{"-1","63"}}, 1)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -/*#Device.QoS.Classification.{i}.DSCPMark!UCI:qos/classify,@i-1/dscp*/ -int os_get_QoSClassification_DSCPMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct dmmap_dup *p= (struct dmmap_dup *)data; - dmuci_get_value_by_section_string(p->config_section, "dscp", value); - return 0; -} - -int os_set_QoSClassification_DSCPMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - struct dmmap_dup *p= (struct dmmap_dup *)data; - - switch (action) { - case VALUECHECK: - if (dm_validate_int(value, RANGE_ARGS{{"-2",NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section(p->config_section, "dscp", value); - break; - } - return 0; -} - -int os_get_QoSClassification_EthernetPriorityCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - //TODO - *value = ""; - return 0; -} - -int os_set_QoSClassification_EthernetPriorityCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_int(value, RANGE_ARGS{{"-1",NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -int os_get_QoSClassification_VLANIDCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - //TODO - *value = ""; - return 0; -} - -int os_set_QoSClassification_VLANIDCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_int(value, RANGE_ARGS{{"-1",NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -int os_get_QoSClassification_TrafficClass(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - //TODO - *value = ""; - return 0; -} - -int os_set_QoSClassification_TrafficClass(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_int(value, RANGE_ARGS{{"-1",NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -int os_get_QoSClassification_Policer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - //TODO - return 0; -} - -int os_set_QoSClassification_Policer(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, NULL)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -int os_get_QoSPolicer_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_set_QoSPolicer_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_boolean(value)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -int os_get_QoSPolicer_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_get_QoSPolicer_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_set_QoSPolicer_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, NULL)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -int os_get_QoSPolicer_CommittedRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_set_QoSPolicer_CommittedRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -int os_get_QoSPolicer_CommittedBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_set_QoSPolicer_CommittedBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -int os_get_QoSPolicer_ExcessBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_set_QoSPolicer_ExcessBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -int os_get_QoSPolicer_PeakRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_set_QoSPolicer_PeakRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -int os_get_QoSPolicer_PeakBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_set_QoSPolicer_PeakBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -int os_get_QoSPolicer_MeterType(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_set_QoSPolicer_MeterType(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, -1, NULL, NULL)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -int os_get_QoSPolicer_PossibleMeterTypes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_get_QoSQueue_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_set_QoSQueue_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - break; - case VALUESET: - break; - } - return 0; -} - -int os_get_QoSQueue_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_get_QoSQueue_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_set_QoSQueue_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - break; - case VALUESET: - break; - } - return 0; -} - -int os_get_QoSQueue_TrafficClasses(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_set_QoSQueue_TrafficClasses(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - break; - case VALUESET: - break; - } - return 0; -} - -int os_get_QoSQueue_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_set_QoSQueue_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - break; - case VALUESET: - break; - } - return 0; -} - -int os_get_QoSQueue_Weight(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_set_QoSQueue_Weight(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - break; - case VALUESET: - break; - } - return 0; -} - -int os_get_QoSQueue_Precedence(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_set_QoSQueue_Precedence(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - break; - case VALUESET: - break; - } - return 0; -} - -int os_get_QoSQueue_SchedulerAlgorithm(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_set_QoSQueue_SchedulerAlgorithm(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - break; - case VALUESET: - break; - } - return 0; -} - -int os_get_QoSQueue_ShapingRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_set_QoSQueue_ShapingRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - break; - case VALUESET: - break; - } - return 0; -} - -int os_get_QoSQueue_ShapingBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_set_QoSQueue_ShapingBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - break; - case VALUESET: - break; - } - return 0; -} - -int os_get_QoSShaper_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_set_QoSShaper_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - break; - case VALUESET: - break; - } - return 0; -} - -int os_get_QoSShaper_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_get_QoSShaper_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_set_QoSShaper_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - break; - case VALUESET: - break; - } - return 0; -} - -int os_get_QoSShaper_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_set_QoSShaper_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - break; - case VALUESET: - break; - } - return 0; -} - -int os_get_QoSShaper_ShapingRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_set_QoSShaper_ShapingRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - break; - case VALUESET: - break; - } - return 0; -} - -int os_get_QoSShaper_ShapingBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_set_QoSShaper_ShapingBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) - { - case VALUECHECK: - break; - case VALUESET: - break; - } - return 0; -} - -int os_get_QoSQueueStats_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_set_QoSQueueStats_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_boolean(value)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -int os_get_QoSQueueStats_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); - -} - -int os_get_QoSQueueStats_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct queuestats *qts= (struct queuestats*)data; - dmuci_get_value_by_section_string(qts->dmsect, "queuestatsalias", value); - if ((*value)[0] == '\0') - dmasprintf(value, "cpe-%s", instance); - return 0; -} - -int os_set_QoSQueueStats_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - struct queuestats *qts= (struct queuestats*)data; - - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, NULL)) - return FAULT_9007; - break; - case VALUESET: - dmuci_set_value_by_section(qts->dmsect, "queuestatsalias", value); - break; - } - return 0; -} - -int os_get_QoSQueueStats_Queue(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_set_QoSQueueStats_Queue(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, NULL)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -int os_get_QoSQueueStats_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct queuestats *qts= (struct queuestats*)data; - - adm_entry_get_linker_param(ctx, "Device.IP.Interface.", qts->dev, value); - if (*value == NULL) - adm_entry_get_linker_param(ctx, "Device.PPP.Interface.", qts->dev, value); - if (*value == NULL) - adm_entry_get_linker_param(ctx, "Device.Ethernet.Interface.", qts->dev, value); - if (*value == NULL) - adm_entry_get_linker_param(ctx, "Device.WiFi.Radio.", qts->dev, value); - if (*value == NULL) - *value = ""; - return 0; -} - -int os_set_QoSQueueStats_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, NULL)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -int os_get_QoSQueueStats_OutputPackets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct queuestats *queuests= (struct queuestats*)data; - dmasprintf(value, "%d", queuests->pkt_sent); - return 0; -} - -int os_get_QoSQueueStats_OutputBytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct queuestats *queuests= (struct queuestats*)data; - dmasprintf(value, "%d", queuests->bytes_sent); - return 0; -} - -int os_get_QoSQueueStats_DroppedPackets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct queuestats *queuests= (struct queuestats*)data; - dmasprintf(value, "%d", queuests->pkt_dropped); - return 0; -} - -int os_get_QoSQueueStats_DroppedBytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_set_QoSClassification_DestVendorClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 255, NULL, NULL)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -int os_get_QoSClassification_DestVendorClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} diff --git a/dmtree/tr181/qos.c b/dmtree/tr181/qos.c index 83565ca5..b500ade3 100644 --- a/dmtree/tr181/qos.c +++ b/dmtree/tr181/qos.c @@ -1,86 +1,1995 @@ /* - * Copyright (C) 2019 iopsys Software Solutions AB + * Copyright (C) 2021 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: Rohit Topno */ +#include "dmentry.h" #include "qos.h" -#include "os.h" + +/************************************************************* + * ENTRY METHOD +*************************************************************/ +static int get_linker_qqueue(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker) +{ + *linker = data ? dmstrdup(section_name((struct uci_section *)data)) : ""; + return 0; +} + +static int browseQoSClassificationInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) +{ + char *inst = NULL, *max_inst = NULL, *value = NULL; + char *ret = NULL; + struct dmmap_dup *p = NULL; + LIST_HEAD(dup_list); + + synchronize_specific_config_sections_with_dmmap("qos", "classify", "dmmap_qos", &dup_list); + list_for_each_entry(p, &dup_list, list) { + + inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3, + p->dmmap_section, "classify_instance", "classifyalias"); + + //synchronizing option src_ip of uci classify section to src_mask/src_ip of dmmap's classify section + dmuci_get_value_by_section_string(p->config_section, "src_ip", &value); + //checking if src_ip is an ip-prefix or ip address and synchronizing accordingly + ret = strstr(value, "/"); + if (ret) + dmuci_set_value_by_section_bbfdm(p->dmmap_section, "src_mask", value); + else + dmuci_set_value_by_section_bbfdm(p->dmmap_section, "src_ip", value); + + //synchronizing option dest_ip of uci classify section to dest_mask/dest_ip of dmmap's classify section + dmuci_get_value_by_section_string(p->config_section, "dest_ip", &value); + //checking if src_ip is an ip-prefix or ip address and synchronizing accordingly + ret = strstr(value, "/"); + if (ret) + dmuci_set_value_by_section_bbfdm(p->dmmap_section, "dest_mask", value); + else + dmuci_set_value_by_section_bbfdm(p->dmmap_section, "dest_ip", value); + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP) + break; + } + free_dmmap_config_dup_list(&dup_list); + return 0; +} + +static int browseQoSPolicerInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) +{ + char *inst = NULL, *max_inst = NULL; + struct dmmap_dup *p = NULL; + LIST_HEAD(dup_list); + + synchronize_specific_config_sections_with_dmmap("qos", "policer", "dmmap_qos", &dup_list); + list_for_each_entry(p, &dup_list, list) { + + inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3, + p->dmmap_section, "policer_instance", "policeralias"); + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP) + break; + } + free_dmmap_config_dup_list(&dup_list); + return 0; +} + +/*#Device.QoS.Queue.{i}.!UCI:qos/queue/dmmap_qos*/ +static int browseQoSQueueInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) +{ + char *inst = NULL, *max_inst = NULL; + struct dmmap_dup *p = NULL; + LIST_HEAD(dup_list); + + synchronize_specific_config_sections_with_dmmap("qos", "queue", "dmmap_qos", &dup_list); + list_for_each_entry(p, &dup_list, list) { + + inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3, + p->dmmap_section, "queueinstance", "queuealias"); + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP) + break; + } + free_dmmap_config_dup_list(&dup_list); + return 0; +} + +static int browseQoSQueueStatsInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) +{ + struct uci_section *s = NULL; + char *inst = NULL, *max_inst = NULL; + + uci_path_foreach_sections(bbfdm, "dmmap_qstats", "queue_stats", s) { + + inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3, + s, "q_instance", "q_alias"); + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, inst) == DM_STOP) + break; + } + return 0; +} + +static int browseQoSShaperInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) +{ + char *inst = NULL, *max_inst = NULL; + struct dmmap_dup *p = NULL; + LIST_HEAD(dup_list); + + synchronize_specific_config_sections_with_dmmap("qos", "shaper", "dmmap_qos", &dup_list); + list_for_each_entry(p, &dup_list, list) { + + inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3, + p->dmmap_section, "shaperinstance", "shaperalias"); + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP) + break; + } + free_dmmap_config_dup_list(&dup_list); + return 0; +} + +/************************************************************* + * ADD & DEL OBJ +*************************************************************/ +static int addObjQoSClassification(char *refparam, struct dmctx *ctx, void *data, char **instance) +{ + struct uci_section *dmmap = NULL, *s = NULL; + + char *inst = get_last_instance_bbfdm("dmmap_qos", "classify", "classify_instance"); + + dmuci_add_section("qos", "classify", &s); + dmuci_set_value_by_section(s, "enable", "0"); + + dmuci_add_section_bbfdm("dmmap_qos", "classify", &dmmap); + dmuci_set_value_by_section(dmmap, "section_name", section_name(s)); + *instance = update_instance(inst, 2, dmmap, "classify_instance"); + return 0; +} + +static int delObjQoSClassification(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) +{ + struct uci_section *s = NULL, *stmp = NULL, *dmmap_section = NULL; + + switch (del_action) { + case DEL_INST: + if (is_section_unnamed(section_name((struct uci_section *)data))){ + LIST_HEAD(dup_list); + delete_sections_save_next_sections("dmmap_qos", "classify", "classify_instance", section_name((struct uci_section *)data), atoi(instance), &dup_list); + update_dmmap_sections(&dup_list, "classify_instance", "dmmap_qos", "classify"); + dmuci_delete_by_section_unnamed((struct uci_section *)data, NULL, NULL); + } else { + get_dmmap_section_of_config_section("dmmap_qos", "classify", section_name((struct uci_section *)data), &dmmap_section); + dmuci_delete_by_section_unnamed_bbfdm(dmmap_section, NULL, NULL); + + dmuci_delete_by_section((struct uci_section *)data, NULL, NULL); + } + break; + case DEL_ALL: + uci_foreach_sections_safe("qos", "classify", stmp, s) { + get_dmmap_section_of_config_section("dmmap_qos", "classify", section_name(s), &dmmap_section); + dmuci_delete_by_section(dmmap_section, NULL, NULL); + + dmuci_delete_by_section(s, NULL, NULL); + } + break; + } + return 0; +} + +static int addObjQoSPolicer(char *refparam, struct dmctx *ctx, void *data, char **instance) +{ + struct uci_section *dmmap = NULL, *s = NULL; + + char *inst = get_last_instance_bbfdm("dmmap_qos", "policer", "policer_instance"); + + dmuci_add_section("qos", "policer", &s); + dmuci_set_value_by_section(s, "enable", "0"); + dmuci_set_value_by_section(s, "committed_rate", "0"); + dmuci_set_value_by_section(s, "committed_burst_size", "0"); + dmuci_set_value_by_section(s, "excess_burst_size", "0"); + dmuci_set_value_by_section(s, "peak_rate", "0"); + dmuci_set_value_by_section(s, "peak_burst_size", "0"); + dmuci_set_value_by_section(s, "meter_type", "0"); + dmuci_set_value_by_section(s, "name", section_name(s)); + + dmuci_add_section_bbfdm("dmmap_qos", "policer", &dmmap); + dmuci_set_value_by_section(dmmap, "section_name", section_name(s)); + *instance = update_instance(inst, 2, dmmap, "policer_instance"); + return 0; +} + +static int delObjQoSPolicer(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) +{ + struct uci_section *s = NULL, *ss = NULL, *dmmap_section = NULL, *sec = NULL; + int found = 0; + char *p_name = NULL; + + switch (del_action) { + case DEL_INST: + // store section name to update corresponding classification + // section if any + dmuci_get_value_by_section_string((struct uci_section *)data, "name", &p_name); + + // Now delete the policer instance + if (is_section_unnamed(section_name((struct uci_section *)data))){ + LIST_HEAD(dup_list); + delete_sections_save_next_sections("dmmap_qos", "policer", "policer_instance", section_name((struct uci_section *)data), atoi(instance), &dup_list); + update_dmmap_sections(&dup_list, "policer_instance", "dmmap_qos", "policer"); + dmuci_delete_by_section_unnamed((struct uci_section *)data, NULL, NULL); + } else { + get_dmmap_section_of_config_section("dmmap_qos", "policer", section_name((struct uci_section *)data), &dmmap_section); + if (dmmap_section != NULL) + dmuci_delete_by_section_unnamed_bbfdm(dmmap_section, NULL, NULL); + dmuci_delete_by_section((struct uci_section *)data, NULL, NULL); + } + + // Set the Classification.Policer to blank if corresponding + // Policer instance has been deleted + uci_foreach_option_eq("qos", "classify", "policer", p_name, sec) { + dmuci_set_value_by_section(sec, "policer", ""); + } + break; + case DEL_ALL: + uci_foreach_sections("qos", "policer", s) { + if (found != 0){ + get_dmmap_section_of_config_section("dmmap_qos", "policer", section_name(ss), &dmmap_section); + if (dmmap_section != NULL) + dmuci_delete_by_section(dmmap_section, NULL, NULL); + dmuci_delete_by_section(ss, NULL, NULL); + } + ss = s; + found++; + } + if (ss != NULL) { + get_dmmap_section_of_config_section("dmmap_qos", "policer", section_name(ss), &dmmap_section); + if (dmmap_section != NULL) + dmuci_delete_by_section(dmmap_section, NULL, NULL); + dmuci_delete_by_section(ss, NULL, NULL); + } + + // Since all policer have been deleted, we can safely set the + // value of all Classification.Policer params to empty + uci_foreach_sections("qos", "classify", sec) { + dmuci_set_value_by_section(sec, "policer", ""); + } + break; + } + return 0; +} + +static int addObjQoSQueue(char *refparam, struct dmctx *ctx, void *data, char **instance) +{ + struct uci_section *dmmap = NULL, *s = NULL; + + char *inst = get_last_instance_bbfdm("dmmap_qos", "queue", "queueinstance"); + + dmuci_add_section("qos", "queue", &s); + dmuci_set_value_by_section(s, "enable", "false"); + dmuci_set_value_by_section(s, "weight", "0"); + dmuci_set_value_by_section(s, "precedence", "1"); + dmuci_set_value_by_section(s, "burst_size", "0"); + dmuci_set_value_by_section(s, "scheduling", "SP"); + dmuci_set_value_by_section(s, "rate", "-1"); + + dmuci_add_section_bbfdm("dmmap_qos", "queue", &dmmap); + dmuci_set_value_by_section(dmmap, "section_name", section_name(s)); + *instance = update_instance(inst, 2, dmmap, "queueinstance"); + return 0; +} + +static int delObjQoSQueue(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) +{ + struct uci_section *s = NULL, *ss = NULL, *dmmap_section= NULL; + int found = 0; + + switch (del_action) { + case DEL_INST: + if (is_section_unnamed(section_name((struct uci_section *)data))){ + LIST_HEAD(dup_list); + delete_sections_save_next_sections("dmmap_qos", "queue", "queueinstance", section_name((struct uci_section *)data), atoi(instance), &dup_list); + update_dmmap_sections(&dup_list, "queueinstance", "dmmap_qos", "queue"); + dmuci_delete_by_section_unnamed((struct uci_section *)data, NULL, NULL); + } else { + get_dmmap_section_of_config_section("dmmap_qos", "queue", section_name((struct uci_section *)data), &dmmap_section); + if (dmmap_section != NULL) + dmuci_delete_by_section_unnamed_bbfdm(dmmap_section, NULL, NULL); + dmuci_delete_by_section((struct uci_section *)data, NULL, NULL); + } + break; + case DEL_ALL: + uci_foreach_sections("qos", "queue", s) { + if (found != 0){ + get_dmmap_section_of_config_section("dmmap_qos", "queue", section_name(ss), &dmmap_section); + if (dmmap_section != NULL) + dmuci_delete_by_section(dmmap_section, NULL, NULL); + dmuci_delete_by_section(ss, NULL, NULL); + } + ss = s; + found++; + } + if (ss != NULL) { + get_dmmap_section_of_config_section("dmmap_qos", "queue", section_name(ss), &dmmap_section); + if (dmmap_section != NULL) + dmuci_delete_by_section(dmmap_section, NULL, NULL); + dmuci_delete_by_section(ss, NULL, NULL); + } + break; + } + return 0; +} + +static int addObjQoSQueueStats(char *refparam, struct dmctx *ctx, void *data, char **instance) +{ + struct uci_section *qstats_sec = NULL; + + char *inst = get_last_instance_bbfdm("dmmap_qstats", "queue_stats", "q_instance"); + + dmuci_add_section_bbfdm("dmmap_qstats", "queue_stats", &qstats_sec); + *instance = update_instance(inst, 2, qstats_sec, "q_instance"); + + return 0; +} + +static int delObjQoSQueueStats(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) +{ + struct uci_section *qstats_sec = NULL, *dmmap_section = NULL; + char *inst = NULL; + int i = 0; + + switch (del_action) { + case DEL_INST: + // Remove device section in dmmap_qstats file + uci_path_foreach_option_eq(bbfdm, "dmmap_qstats", "queue_stats", "q_instance", instance, qstats_sec) { + dmmap_section = qstats_sec; + } + dmuci_delete_by_section(dmmap_section, NULL, NULL); + break; + case DEL_ALL: + inst = get_last_instance_bbfdm("dmmap_qstats", "queue_stats", "q_instance"); + + uci_path_foreach_sections(bbfdm, "dmmap_qstats", "queue_stats", qstats_sec) { + if (atoi(inst) == i) { + break; + } + + if (dmmap_section != NULL) { + dmuci_delete_by_section(dmmap_section, NULL, NULL); + } + + dmmap_section = qstats_sec; + i++; + } + + if (dmmap_section != NULL) { + dmuci_delete_by_section(dmmap_section, NULL, NULL); + } + break; + } + return 0; +} + +static int addObjQoSShaper(char *refparam, struct dmctx *ctx, void *data, char **instance) +{ + struct uci_section *dmmap = NULL, *s = NULL; + + char *inst = get_last_instance_bbfdm("dmmap_qos", "shaper", "shaperinstance"); + + dmuci_add_section("qos", "shaper", &s); + dmuci_set_value_by_section(s, "enable", "0"); + dmuci_set_value_by_section(s, "burst_size", "0"); + dmuci_set_value_by_section(s, "rate", "0"); + + dmuci_add_section_bbfdm("dmmap_qos", "shaper", &dmmap); + dmuci_set_value_by_section(dmmap, "section_name", section_name(s)); + *instance = update_instance(inst, 2, dmmap, "shaperinstance"); + return 0; +} + +static int delObjQoSShaper(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) +{ + struct uci_section *s = NULL, *ss = NULL, *dmmap_section= NULL; + int found = 0; + + switch (del_action) { + case DEL_INST: + if (is_section_unnamed(section_name((struct uci_section *)data))){ + LIST_HEAD(dup_list); + delete_sections_save_next_sections("dmmap_qos", "shaper", "shaperinstance", section_name((struct uci_section *)data), atoi(instance), &dup_list); + update_dmmap_sections(&dup_list, "shaperinstance", "dmmap_qos", "shaper"); + dmuci_delete_by_section_unnamed((struct uci_section *)data, NULL, NULL); + } else { + get_dmmap_section_of_config_section("dmmap_qos", "shaper", section_name((struct uci_section *)data), &dmmap_section); + if (dmmap_section != NULL) + dmuci_delete_by_section_unnamed_bbfdm(dmmap_section, NULL, NULL); + dmuci_delete_by_section((struct uci_section *)data, NULL, NULL); + } + break; + case DEL_ALL: + uci_foreach_sections("qos", "shaper", s) { + if (found != 0){ + get_dmmap_section_of_config_section("dmmap_qos", "shaper", section_name(ss), &dmmap_section); + if (dmmap_section != NULL) + dmuci_delete_by_section(dmmap_section, NULL, NULL); + dmuci_delete_by_section(ss, NULL, NULL); + } + ss = s; + found++; + } + if (ss != NULL) { + get_dmmap_section_of_config_section("dmmap_qos", "shaper", section_name(ss), &dmmap_section); + if (dmmap_section != NULL) + dmuci_delete_by_section(dmmap_section, NULL, NULL); + dmuci_delete_by_section(ss, NULL, NULL); + } + break; + } + return 0; +} + +/************************************************************* +* COMMON Functions +**************************************************************/ +static int get_QInterface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + char *ifname = NULL; + dmuci_get_value_by_section_string((struct uci_section *)data, "ifname", &ifname); + + adm_entry_get_linker_param(ctx, "Device.IP.Interface.", ifname, value); + if (*value == NULL) + adm_entry_get_linker_param(ctx, "Device.PPP.Interface.", ifname, value); + if (*value == NULL) + adm_entry_get_linker_param(ctx, "Device.Ethernet.Interface.", ifname, value); + if (*value == NULL) + adm_entry_get_linker_param(ctx, "Device.WiFi.Radio.", ifname, value); + if (*value == NULL) + *value = ""; + + return 0; +} + +static int set_QInterface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + char *linker = NULL; + + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 256, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + adm_entry_get_linker_value(ctx, value, &linker); + if (linker && *linker) { + dmuci_set_value_by_section((struct uci_section *)data, "ifname", linker); + dmfree(linker); + } + break; + } + return 0; +} + +/************************************************************* + * GET & SET PARAM +*************************************************************/ +/*#Device.QoS.ClassificationNumberOfEntries!UCI:qos/classify/*/ +static int get_QClassificationNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct uci_section *s = NULL; + int cnt = 0; + + uci_foreach_sections("qos", "classify", s) { + cnt++; + } + dmasprintf(value, "%d", cnt); + return 0; +} + +static int get_QPolicerNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct uci_section *s = NULL; + int cnt = 0; + + uci_foreach_sections("qos", "policer", s) { + cnt++; + } + dmasprintf(value, "%d", cnt); + return 0; +} + +/*#Device.QoS.QueueNumberOfEntries!UCI:qos/queue*/ +static int get_QQueueNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct uci_section *s = NULL; + int cnt = 0; + + uci_foreach_sections("qos", "queue", s) { + cnt++; + } + dmasprintf(value, "%d", cnt); + return 0; +} + +static int get_QQueueStatsNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = "0"; + int cnt = 0; + struct uci_section *s = NULL; + uci_path_foreach_sections(bbfdm, "dmmap_qstats", "queue_stats", s) { + cnt++; + } + dmasprintf(value, "%d", cnt); + return 0; +} + +static int get_QShaperNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct uci_section *s = NULL; + int cnt = 0; + + uci_foreach_sections("qos", "shaper", s) { + cnt++; + } + dmasprintf(value, "%d", cnt); + return 0; +} + +static int get_QoSClassification_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "enable", "1"); + return 0; +} + +static int set_QoSClassification_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + bool b; + switch (action) { + case VALUECHECK: + if (dm_validate_boolean(value)) + return FAULT_9007; + break; + case VALUESET: + string_to_bool(value, &b); + dmuci_set_value_by_section((struct uci_section *)data, "enable", (b) ? "1" : "0"); + break; + } + return 0; +} + +static int get_QoSClassification_DestMask(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct uci_section *dmmap_section = NULL; + get_dmmap_section_of_config_section("dmmap_qos", "classify", section_name((struct uci_section *)data), &dmmap_section); + dmuci_get_value_by_section_string(dmmap_section, "dest_mask", value); + return 0; +} + +static int set_QoSClassification_DestMask(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + char *dest_ip = NULL; + struct uci_section *dmmap_section = NULL; + + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 49 , NULL, IPPrefix)) + return FAULT_9007; + break; + case VALUESET: + /* Set received value of dest. mask in /etc/bbfdm/dmmap_qos. + * If received value is an empty string then get the value of dest. ip. from dmmap_qos and set it as dest_ip in qos uci file. + * If both received value of dest. mask and the dest. ip from dmmap_qos is empty then delete the dest_ip option from qos uci file. + * Note: setting an empty string as option value in uci or dmmap will delete that option. + * */ + //get dmmap section + get_dmmap_section_of_config_section("dmmap_qos", "classify", section_name((struct uci_section *)data), &dmmap_section); + dmuci_set_value_by_section_bbfdm(dmmap_section, "dest_mask", value); + if (value[0] == '\0') { + //get source ip value from /etc/bbfdm/dmmap_qos and set as dest_ip + dmuci_get_value_by_section_string(dmmap_section, "dest_ip", &dest_ip); + dmuci_set_value_by_section((struct uci_section *)data, "dest_ip", dest_ip); + } else { + dmuci_set_value_by_section((struct uci_section *)data, "dest_ip", value); + } + break; + } + return 0; +} + +static int get_QoSClassification_SourceMask(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct uci_section *dmmap_section = NULL; + get_dmmap_section_of_config_section("dmmap_qos", "classify", section_name((struct uci_section *)data), &dmmap_section); + dmuci_get_value_by_section_string(dmmap_section, "src_mask", value); + return 0; +} + +static int set_QoSClassification_SourceMask(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + char *src_ip = NULL; + struct uci_section *dmmap_section = NULL; + + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 49 , NULL, IPPrefix)) + return FAULT_9007; + break; + case VALUESET: + /* Set received value of src. mask in /etc/bbfdm/dmmap_qos. + * If received value is an empty string then get the value of src. ip. from dmmap_qos and set it as src_ip in qos uci file. + * If both received value of src. mask and the src. ip from dmmap_qos is empty then delete the src_ip option from qos uci file. + * Note: setting an empty string as option value in uci or dmmap will delete that option. + * */ + //get dmmap section + get_dmmap_section_of_config_section("dmmap_qos", "classify", section_name((struct uci_section *)data), &dmmap_section); + dmuci_set_value_by_section_bbfdm(dmmap_section, "src_mask", value); + if (value[0] == '\0') { + //get source ip value from /etc/bbfdm/dmmap_qos and set as src_ip + dmuci_get_value_by_section_string(dmmap_section, "src_ip", &src_ip); + dmuci_set_value_by_section((struct uci_section *)data, "src_ip", src_ip); + } else { + dmuci_set_value_by_section((struct uci_section *)data, "src_ip", value); + } + break; + } + return 0; +} + +static int get_QoSClassification_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct uci_section *dmmap_section = NULL; + + get_dmmap_section_of_config_section("dmmap_qos", "classify", section_name((struct uci_section *)data), &dmmap_section); + dmuci_get_value_by_section_string(dmmap_section, "classifyalias", value); + if ((*value)[0] == '\0') + dmasprintf(value, "cpe-%s", instance); + return 0; +} + +static int set_QoSClassification_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + struct uci_section *dmmap_section = NULL; + + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 64, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + get_dmmap_section_of_config_section("dmmap_qos", "classify", section_name((struct uci_section *)data), &dmmap_section); + dmuci_set_value_by_section_bbfdm(dmmap_section, "classifyalias", value); + break; + } + return 0; +} + +static int get_QoSClassification_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + return get_QInterface(refparam, ctx, data, instance, value); +} + +static int set_QoSClassification_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + return set_QInterface(refparam, ctx, data, instance, value, action); +} + +static int get_QoSClassification_DestIP(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct uci_section *dmmap_section = NULL; + get_dmmap_section_of_config_section("dmmap_qos", "classify", section_name((struct uci_section *)data), &dmmap_section); + dmuci_get_value_by_section_string(dmmap_section, "dest_ip", value); + return 0; +} + +static int set_QoSClassification_DestIP(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + char *dest_mask = NULL; + struct uci_section *dmmap_section = NULL; + + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 45 , NULL, IPAddress)) + return FAULT_9007; + break; + case VALUESET: + /* If dest. mask parameter from etc/bbfdm/dmmap_qos is present, set this (dest. mask) value as dest_ip in qos uci file + * Else write received dest. ip to /etc/bbfdm/dmmap_qos and qos uci file. + * Also write the received dest. ip value to /etc/bbfdm/dmmap_qos. + * */ + get_dmmap_section_of_config_section("dmmap_qos", "classify", section_name((struct uci_section *)data), &dmmap_section); + dmuci_get_value_by_section_string(dmmap_section, "dest_mask", &dest_mask); + + if (dest_mask[0] != '\0') { + dmuci_set_value_by_section((struct uci_section *)data, "dest_ip", dest_mask); + } else { + //note: setting an option to an empty string will delete that option + dmuci_set_value_by_section((struct uci_section *)data, "dest_ip", value); + } + dmuci_set_value_by_section_bbfdm(dmmap_section, "dest_ip", value); + break; + } + return 0; +} + +static int get_QoSClassification_SourceIP(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct uci_section *dmmap_section = NULL; + get_dmmap_section_of_config_section("dmmap_qos", "classify", section_name((struct uci_section *)data), &dmmap_section); + dmuci_get_value_by_section_string(dmmap_section, "src_ip", value); + return 0; +} + +static int set_QoSClassification_SourceIP(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + char *src_mask = NULL; + struct uci_section *dmmap_section = NULL; + + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 45 , NULL, IPAddress)) + return FAULT_9007; + break; + case VALUESET: + /*if source mask parameter from etc/bbfdm/dmmap_qos is present, set this (source mask) value as src_ip in qos uci file + Else write received source ip to /etc/bbfdm/dmmap_qos and qos uci file. + also write the received source ip value to /etc/bbfdm/dmmap_qos. + */ + get_dmmap_section_of_config_section("dmmap_qos", "classify", section_name((struct uci_section *)data), &dmmap_section); + dmuci_get_value_by_section_string(dmmap_section, "src_mask", &src_mask); + + if (src_mask[0] != '\0') { + dmuci_set_value_by_section((struct uci_section *)data, "src_ip", src_mask); + } else { + //note: setting an option to an empty string will delete that option + dmuci_set_value_by_section((struct uci_section *)data, "src_ip", value); + } + dmuci_set_value_by_section_bbfdm(dmmap_section, "src_ip", value); + break; + } + return 0; +} + +static int get_QoSClassification_Protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "proto", "-1"); + return 0; +} + +static int set_QoSClassification_Protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_int(value, RANGE_ARGS{{"-1","255"}}, 1)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "proto", value); + break; + } + return 0; +} + + +static int get_QoSClassification_DestPort(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "dest_port", "-1"); + return 0; +} + +static int set_QoSClassification_DestPort(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_int(value, RANGE_ARGS{{"-1","65535"}}, 1)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "dest_port", value); + break; + } + return 0; +} + +static int get_QoSClassification_DestPortRangeMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "dest_port_range", "-1"); + return 0; +} + +static int set_QoSClassification_DestPortRangeMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_int(value, RANGE_ARGS{{"-1","65535"}}, 1)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "dest_port_range", value); + break; + } + return 0; +} + +static int get_QoSClassification_SourcePort(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "src_port", "-1"); + return 0; +} + +static int set_QoSClassification_SourcePort(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_int(value, RANGE_ARGS{{"-1","65535"}}, 1)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "src_port", value); + break; + } + return 0; +} + +static int get_QoSClassification_SourcePortRangeMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "src_port_range", "-1"); + return 0; +} + +static int set_QoSClassification_SourcePortRangeMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_int(value, RANGE_ARGS{{"-1","65535"}}, 1)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "src_port_range", value); + break; + } + return 0; +} + +static int get_QoSClassification_SourceMACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "src_mac", value); + return 0; +} + +static int set_QoSClassification_SourceMACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 17, NULL, MACAddress)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "src_mac", value); + break; + } + return 0; +} + +static int get_QoSClassification_DestMACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "dst_mac", value); + return 0; +} + +static int set_QoSClassification_DestMACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 17, NULL, MACAddress)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "dst_mac", value); + break; + } + return 0; +} + +static int get_QoSClassification_Ethertype(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "ethertype", "-1"); + return 0; +} + +static int set_QoSClassification_Ethertype(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_int(value, RANGE_ARGS{{"-1",NULL}}, 1)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "ethertype", value); + break; + } + return 0; +} + +static int get_QoSClassification_SourceVendorClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "src_vendor_class_id", value); + return 0; +} + +static int set_QoSClassification_SourceVendorClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 255, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + // Set received value of source Vendor ClassID in /etc/config/qos. + dmuci_set_value_by_section((struct uci_section *)data, "src_vendor_class_id", value); + break; + } + return 0; +} + +static int get_QoSClassification_DestVendorClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "dst_vendor_class_id", value); + return 0; +} + +static int set_QoSClassification_DestVendorClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 255, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + // Set received value of Destination Vendor ClassID in /etc/config/qos. + dmuci_set_value_by_section((struct uci_section *)data, "dst_vendor_class_id", value); + break; + } + return 0; +} + +static int get_QoSClassification_SourceClientID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + char *srcclid = NULL, hex[256] = {0}; + + dmuci_get_value_by_section_string((struct uci_section *)data, "src_client_id", &srcclid); + + if (srcclid && *srcclid) + convert_string_to_hex(srcclid, hex); + + *value = (*hex) ? dmstrdup(hex) : ""; + return 0; +} + +static int set_QoSClassification_SourceClientID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + char res[256] = {0}; + + switch (action) { + case VALUECHECK: + if (dm_validate_hexBinary(value, RANGE_ARGS{{NULL,"65535"}}, 1)) + return FAULT_9007; + break; + case VALUESET: + convert_hex_to_string(value, res); + dmuci_set_value_by_section((struct uci_section *)data, "src_client_id", res); + break; + } + return 0; +} + +static int get_QoSClassification_DestClientID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + char *dstclid = NULL, hex[256] = {0}; + + dmuci_get_value_by_section_string((struct uci_section *)data, "dst_client_id", &dstclid); + + if (dstclid && *dstclid) + convert_string_to_hex(dstclid, hex); + + *value = (*hex) ? dmstrdup(hex) : ""; + return 0; +} + +static int set_QoSClassification_DestClientID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + char res[256] = {0}; + + switch (action) { + case VALUECHECK: + if (dm_validate_hexBinary(value, RANGE_ARGS{{NULL,"65535"}}, 1)) + return FAULT_9007; + break; + case VALUESET: + convert_hex_to_string(value, res); + dmuci_set_value_by_section((struct uci_section *)data, "dst_client_id", res); + break; + } + return 0; +} + +static int get_QoSClassification_SourceUserClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + char *srcusrclid = NULL, hex[256] = {0}; + + dmuci_get_value_by_section_string((struct uci_section *)data, "src_user_class_id", &srcusrclid); + + if (srcusrclid && *srcusrclid) + convert_string_to_hex(srcusrclid, hex); + + *value = (*hex) ? dmstrdup(hex) : ""; + return 0; +} + +static int set_QoSClassification_SourceUserClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + char res[256] = {0}; + + switch (action) { + case VALUECHECK: + if (dm_validate_hexBinary(value, RANGE_ARGS{{NULL,"65535"}}, 1)) + return FAULT_9007; + break; + case VALUESET: + convert_hex_to_string(value, res); + dmuci_set_value_by_section((struct uci_section *)data, "src_user_class_id", res); + break; + } + return 0; +} + +static int get_QoSClassification_DestUserClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + char *dstusrclid = NULL, hex[256] = {0}; + + dmuci_get_value_by_section_string((struct uci_section *)data, "dst_user_class_id", &dstusrclid); + + if (dstusrclid && *dstusrclid) + convert_string_to_hex(dstusrclid, hex); + + *value = (*hex) ? dmstrdup(hex) : ""; + return 0; +} + +static int set_QoSClassification_DestUserClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + char res[256] = {0}; + + switch (action) { + case VALUECHECK: + if (dm_validate_hexBinary(value, RANGE_ARGS{{NULL,"65535"}}, 1)) + return FAULT_9007; + break; + case VALUESET: + convert_hex_to_string(value, res); + dmuci_set_value_by_section((struct uci_section *)data, "dst_user_class_id", res); + break; + } + return 0; +} + +static int get_QoSClassification_IPLengthMin(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "ip_len_min", "0"); + return 0; +} + +static int set_QoSClassification_IPLengthMin(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_int(value, RANGE_ARGS{{"0",NULL}}, 1)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "ip_len_min", value); + break; + } + return 0; +} + +static int get_QoSClassification_IPLengthMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "ip_len_max", "0"); + return 0; +} + +static int set_QoSClassification_IPLengthMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_int(value, RANGE_ARGS{{"0",NULL}}, 1)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "ip_len_max", value); + break; + } + return 0; +} + +static int get_QoSClassification_DSCPCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "dscp_filter", "-1"); + return 0; +} + +static int set_QoSClassification_DSCPCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_int(value, RANGE_ARGS{{"-1","63"}}, 1)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "dscp_filter", value); + break; + } + return 0; +} + +/*#Device.QoS.Classification.{i}.DSCPMark!UCI:qos/classify,@i-1/dscp*/ +static int get_QoSClassification_DSCPMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "dscp_mark", "-1"); + return 0; +} + +static int set_QoSClassification_DSCPMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_int(value, RANGE_ARGS{{"-2",NULL}}, 1)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "dscp_mark", value); + break; + } + return 0; +} +static int get_QoSClassification_EthernetPriorityCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "pcp_check", "-1"); + return 0; +} + +static int set_QoSClassification_EthernetPriorityCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_int(value, RANGE_ARGS{{"-1",NULL}}, 1)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "pcp_check", value); + break; + } + return 0; +} + +static int get_QoSClassification_VLANIDCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "vid_check", "-1"); + return 0; +} + +static int set_QoSClassification_VLANIDCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_int(value, RANGE_ARGS{{"-1",NULL}}, 1)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "vid_check", value); + break; + } + return 0; +} + +static int get_QoSClassification_TrafficClass(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "traffic_class", "-1"); + return 0; +} + +static int set_QoSClassification_TrafficClass(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_int(value, RANGE_ARGS{{"-1",NULL}}, 1)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "traffic_class", value); + break; + } + return 0; +} + +static int get_QoSClassification_Policer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + char *linker = NULL; + char *p_inst = NULL; + struct uci_section *dmmap_s = NULL; + + dmuci_get_value_by_section_string((struct uci_section *)data, "policer", &linker); + get_dmmap_section_of_config_section_eq("dmmap_qos", "policer", "section_name", linker, &dmmap_s); + if (dmmap_s != NULL) { + dmuci_get_value_by_section_string(dmmap_s, "policer_instance", &p_inst); + dmasprintf(value, "Device.QoS.Policer.%s", p_inst); + } + + if (*value == NULL) + *value = ""; + return 0; +} + +static int set_QoSClassification_Policer(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + struct uci_section *dmmap_s = NULL; + char *linker = NULL, link_inst[8] = {0}; + + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 64, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + if (strncmp(value, "Device.QoS.Policer.", 19) != 0) + return 0; + + snprintf(link_inst, sizeof(link_inst), "%c", value[19]); + get_dmmap_section_of_config_section_eq("dmmap_qos", "policer", "policer_instance", link_inst, &dmmap_s); + dmuci_get_value_by_section_string(dmmap_s, "section_name", &linker); + dmuci_set_value_by_section((struct uci_section *)data, "policer", linker); + break; + } + return 0; +} + +static int get_QoSPolicer_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "enable", "1"); + return 0; +} + +static int set_QoSPolicer_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + bool b; + switch (action) { + case VALUECHECK: + if (dm_validate_boolean(value)) + return FAULT_9007; + break; + case VALUESET: + string_to_bool(value, &b); + dmuci_set_value_by_section((struct uci_section *)data, "enable", b ? "1" : "0"); + break; + } + return 0; +} + +static int get_QoSPolicer_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "enable", value); + *value = (*value[0] == '1') ? "Enabled" : "Disabled"; + return 0; +} + +static int get_QoSPolicer_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct uci_section *dmmap_section = NULL; + + get_dmmap_section_of_config_section("dmmap_qos", "policer", section_name((struct uci_section *)data), &dmmap_section); + dmuci_get_value_by_section_string(dmmap_section, "policeralias", value); + if ((*value)[0] == '\0') + dmasprintf(value, "cpe-%s", instance); + return 0; +} + +static int set_QoSPolicer_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + struct uci_section *dmmap_section = NULL; + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 64, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + get_dmmap_section_of_config_section("dmmap_qos", "policer", section_name((struct uci_section *)data), &dmmap_section); + dmuci_set_value_by_section_bbfdm(dmmap_section, "policeralias", value); + break; + } + return 0; +} + +static int get_QoSPolicer_CommittedRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "committed_rate", value); + return 0; +} + +static int set_QoSPolicer_CommittedRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "committed_rate", value); + break; + } + return 0; +} + +static int get_QoSPolicer_CommittedBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "committed_burst_size", value); + return 0; +} + +static int set_QoSPolicer_CommittedBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "committed_burst_size", value); + break; + } + return 0; +} + +static int get_QoSPolicer_ExcessBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "excess_burst_size", value); + return 0; +} + +static int set_QoSPolicer_ExcessBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "excess_burst_size", value); + break; + } + return 0; +} + +static int get_QoSPolicer_PeakRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "peak_rate", value); + return 0; +} + +static int set_QoSPolicer_PeakRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "peak_rate", value); + break; + } + return 0; +} + +static int get_QoSPolicer_PeakBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "peak_burst_size", value); + return 0; +} + +static int set_QoSPolicer_PeakBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "peak_burst_size", value); + break; + } + return 0; +} + +static int get_QoSPolicer_MeterType(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "meter_type", value); + if (strncmp(*value, "1", 1) == 0) + *value = "SingleRateThreeColor"; + else if (strncmp(*value, "2", 1) == 0) + *value = "TwoRateThreeColor"; + else + *value = "SimpleTokenBucket"; + + return 0; +} + +static int set_QoSPolicer_MeterType(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if ((strcmp("SimpleTokenBucket", value) != 0) && (strcmp("SingleRateThreeColor", value) != 0) && (strcmp("TwoRateThreeColor", value) != 0)) + return FAULT_9007; + break; + case VALUESET: + if (strcmp("SimpleTokenBucket", value) == 0) + dmuci_set_value_by_section((struct uci_section *)data, "meter_type", "0"); + else if (strcmp("SingleRateThreeColor", value) == 0) + dmuci_set_value_by_section((struct uci_section *)data, "meter_type", "1"); + else if (strcmp("TwoRateThreeColor", value) == 0) + dmuci_set_value_by_section((struct uci_section *)data, "meter_type", "2"); + break; + } + return 0; +} + +static int get_QoSPolicer_PossibleMeterTypes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = "SimpleTokenBucket,SingleRateThreeColor,TwoRateThreeColor"; + return 0; +} + +static int get_QoSQueue_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "enable", "1"); + return 0; +} + +static int set_QoSQueue_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + bool b; + switch (action) { + case VALUECHECK: + if (dm_validate_boolean(value)) + return FAULT_9007; + break; + case VALUESET: + string_to_bool(value, &b); + dmuci_set_value_by_section((struct uci_section *)data, "enable", b ? "1" : "0"); + break; + } + return 0; +} + +static int get_QoSQueue_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "enable", value); + *value = (*value[0] == '1') ? "Enabled" : "Disabled"; + return 0; +} + +static int get_QoSQueue_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct uci_section *dmmap_section = NULL; + + get_dmmap_section_of_config_section("dmmap_qos", "queue", section_name((struct uci_section *)data), &dmmap_section); + dmuci_get_value_by_section_string(dmmap_section, "queuealias", value); + if ((*value)[0] == '\0') + dmasprintf(value, "cpe-%s", instance); + return 0; +} + +static int set_QoSQueue_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + struct uci_section *dmmap_section = NULL; + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 64, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + get_dmmap_section_of_config_section("dmmap_qos", "queue", section_name((struct uci_section *)data), &dmmap_section); + dmuci_set_value_by_section_bbfdm(dmmap_section, "queuealias", value); + break; + } + return 0; +} + +static int get_QoSQueue_TrafficClasses(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "traffic_class", value); + return 0; +} + +static int set_QoSQueue_TrafficClasses(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "traffic_class", value); + break; + } + return 0; +} + +static int get_QoSQueue_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + return get_QInterface(refparam, ctx, data, instance, value); +} + +static int set_QoSQueue_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + return set_QInterface(refparam, ctx, data, instance, value, action); +} + +static int get_QoSQueue_Weight(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "weight", "0"); + return 0; +} + +static int set_QoSQueue_Weight(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "weight", value); + break; + } + return 0; +} + +/*#Device.QoS.Queue.{i}.Precedence!UCI:qos/queue,@i-1/precedence*/ +static int get_QoSQueue_Precedence(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "precedence", "1"); + return 0; +} + +static int set_QoSQueue_Precedence(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1",NULL}}, 1)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "precedence", value); + break; + } + return 0; +} + +static int get_QoSQueue_SchedulerAlgorithm(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "scheduling", "SP"); + return 0; +} + +static int set_QoSQueue_SchedulerAlgorithm(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, -1, SchedulerAlgorithm, NULL)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "scheduling", value); + break; + } + return 0; +} + +/*#Device.QoS.Queue.{i}.ShapingRate!UCI:qos/class,@i-1/rate*/ +static int get_QoSQueue_ShapingRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "rate", "-1"); + return 0; +} + + +static int set_QoSQueue_ShapingRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_int(value, RANGE_ARGS{{"-1",NULL}}, 1)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "rate", value); + break; + } + return 0; +} + +static int get_QoSQueue_ShapingBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "burst_size", "0"); + return 0; +} + +static int set_QoSQueue_ShapingBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "burst_size", value); + break; + } + return 0; +} + +static int get_QoSQueueStats_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "enabled", "0"); + return 0; +} + +static int set_QoSQueueStats_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + bool b; + + switch (action) { + case VALUECHECK: + if (dm_validate_boolean(value)) + return FAULT_9007; + break; + case VALUESET: + string_to_bool(value, &b); + dmuci_set_value_by_section((struct uci_section *)data, "enabled", b ? "1" : "0"); + break; + } + return 0; +} + +static int get_QoSQueueStats_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + get_QoSQueueStats_Enable(refparam, ctx, data, instance, value); + *value = (strcmp(*value, "1") == 0) ? "Enabled" : "Disabled"; + return 0; + +} + +static int get_QoSQueueStats_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "alias", value); + if ((*value)[0] == '\0') + dmasprintf(value, "cpe-%s", instance); + return 0; +} + +static int set_QoSQueueStats_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 64, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "alias", value); + break; + } + return 0; +} + +static int get_QoSQueueStats_Queue(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + char *queue_link; + dmuci_get_value_by_section_string((struct uci_section *)data, "queue", &queue_link); + adm_entry_get_linker_param(ctx, "Device.QoS.Queue.", queue_link, value); + if (*value == NULL) + *value = ""; + return 0; +} + +static int set_QoSQueueStats_Queue(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + char *queue_link = NULL; + + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 256, NULL, NULL)) + return FAULT_9007; + + if (value == NULL || *value == '\0') + break; + + if (strncmp(value, "Device.QoS.Queue.", 17) != 0) + return FAULT_9007; + + adm_entry_get_linker_value(ctx, value, &queue_link); + if (queue_link == NULL || *queue_link == '\0') + return FAULT_9007; + + break; + case VALUESET: + if (value == NULL || *value == '\0') + break; + + adm_entry_get_linker_value(ctx, value, &queue_link); + dmuci_set_value_by_section((struct uci_section *)data, "queue", queue_link); + break; + } + return 0; +} + +static int get_QoSQueueStats_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + char *intf_link; + dmuci_get_value_by_section_string((struct uci_section *)data, "interface", &intf_link); + adm_entry_get_linker_param(ctx, "Device.Ethernet.Interface.", intf_link, value); + if (*value == NULL) + adm_entry_get_linker_param(ctx, "Device.IP.Interface.", intf_link, value); + if (*value == NULL) + adm_entry_get_linker_param(ctx, "Device.PPP.Interface.", intf_link, value); + if (*value == NULL) + *value = ""; + return 0; +} + +static int set_QoSQueueStats_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + char *intf_link = NULL; + + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 256, NULL, NULL)) + return FAULT_9007; + + if (value == NULL || *value == '\0') + break; + + adm_entry_get_linker_value(ctx, value, &intf_link); + if (intf_link == NULL || *intf_link == '\0') + return FAULT_9007; + + break; + case VALUESET: + if (value == NULL || *value == '\0') + break; + + adm_entry_get_linker_value(ctx, value, &intf_link); + dmuci_set_value_by_section((struct uci_section *)data, "interface", intf_link); + break; + } + return 0; +} + +static int get_QoSQueueStats_value(void *data, char *option, char **value) +{ + char *queue_link = NULL, *intf_link = NULL; + + *value = "0"; + dmuci_get_value_by_section_string((struct uci_section *)data, "queue", &queue_link); + dmuci_get_value_by_section_string((struct uci_section *)data, "interface", &intf_link); + + if (queue_link && *queue_link && intf_link && *intf_link) { + json_object *res = NULL; + char queue_id[8] = {0}; + + snprintf(queue_id, sizeof(queue_id), "%c", queue_link[2]); + dmubus_call("qos", "queue_stats", UBUS_ARGS{{"ifname", intf_link, String}, {"qid", queue_id, Integer}}, 2, &res); + DM_ASSERT(res, *value = "0"); + json_object *queue_obj = dmjson_select_obj_in_array_idx(res, 0, 1, "queues"); + *value = dmjson_get_value(queue_obj, 1, option); + } + return 0; +} + +static int get_QoSQueueStats_OutputPackets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + return get_QoSQueueStats_value(data, "tx_packets", value); +} + +static int get_QoSQueueStats_OutputBytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + return get_QoSQueueStats_value(data, "tx_bytes", value); +} + +static int get_QoSQueueStats_DroppedPackets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + return get_QoSQueueStats_value(data, "tx_dropped_packets", value); +} + +static int get_QoSQueueStats_DroppedBytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + return get_QoSQueueStats_value(data, "tx_dropped_bytes", value); +} + +static int get_QoSShaper_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "enable", "1"); + return 0; +} + +static int set_QoSShaper_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + bool b; + switch (action) { + case VALUECHECK: + if (dm_validate_boolean(value)) + return FAULT_9007; + break; + case VALUESET: + string_to_bool(value, &b); + dmuci_set_value_by_section((struct uci_section *)data, "enable", b ? "1" : "0"); + break; + } + return 0; +} + +static int get_QoSShaper_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "enable", value); + *value = (*value[0] == '1') ? "Enabled" : "Disabled"; + return 0; +} + +static int get_QoSShaper_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct uci_section *dmmap_section = NULL; + + get_dmmap_section_of_config_section("dmmap_qos", "shaper", section_name((struct uci_section *)data), &dmmap_section); + dmuci_get_value_by_section_string(dmmap_section, "shaperalias", value); + if ((*value)[0] == '\0') + dmasprintf(value, "cpe-%s", instance); + return 0; +} + +static int set_QoSShaper_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + struct uci_section *dmmap_section = NULL; + + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 64, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + get_dmmap_section_of_config_section("dmmap_qos", "shaper", section_name((struct uci_section *)data), &dmmap_section); + dmuci_set_value_by_section_bbfdm(dmmap_section, "shaperalias", value); + break; + } + return 0; +} + +static int get_QoSShaper_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + return get_QInterface(refparam, ctx, data, instance, value); +} + +static int set_QoSShaper_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + return set_QInterface(refparam, ctx, data, instance, value, action); +} + +static int get_QoSShaper_ShapingRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "rate", "-1"); + return 0; +} + +static int set_QoSShaper_ShapingRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_int(value, RANGE_ARGS{{"-1",NULL}}, 1)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "rate", value); + break; + } + return 0; +} + +static int get_QoSShaper_ShapingBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "burst_size", "0"); + return 0; +} + +static int set_QoSShaper_ShapingBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "burst_size", value); + break; + } + return 0; +} /* *** Device.QoS. *** */ DMOBJ tQoSObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Classification", &DMWRITE, os_addObjQoSClassification, os_delObjQoSClassification, NULL, os_browseQoSClassificationInst, NULL, NULL, tQoSClassificationParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, -{"QueueStats", &DMWRITE, os_addObjQoSQueueStats, os_delObjQoSQueueStats, NULL, os_browseQoSQueueStatsInst, NULL, NULL, tQoSQueueStatsParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", "Queue", "Interface", NULL}}, -//{"App", &DMWRITE, addObjQoSApp, delObjQoSApp, NULL, browseQoSAppInst, NULL, NULL, tQoSAppParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, -//{"Flow", &DMWRITE, addObjQoSFlow, delObjQoSFlow, NULL, browseQoSFlowInst, NULL, NULL, tQoSFlowParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, -{"Policer", &DMWRITE, os_addObjQoSPolicer, os_delObjQoSPolicer, NULL, os_browseQoSPolicerInst, NULL, NULL, tQoSPolicerParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, -{"Queue", &DMWRITE, os_addObjQoSQueue, os_delObjQoSQueue, NULL, os_browseQoSQueueInst, NULL, NULL, tQoSQueueParams, os_get_linker_qos_queue, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, -{"Shaper", &DMWRITE, os_addObjQoSShaper, os_delObjQoSShaper, NULL, os_browseQoSShaperInst, NULL, NULL, tQoSShaperParams, NULL, BBFDM_BOTH, LIST_KEY{"Interface", "Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Classification", &DMWRITE, addObjQoSClassification, delObjQoSClassification, NULL, browseQoSClassificationInst, NULL, NULL, NULL, tQoSClassificationParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, +{"QueueStats", &DMWRITE, addObjQoSQueueStats, delObjQoSQueueStats, NULL, browseQoSQueueStatsInst, NULL, NULL, NULL, tQoSQueueStatsParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", "Queue", "Interface", NULL}}, +//{"App", &DMWRITE, addObjQoSApp, delObjQoSApp, NULL, browseQoSAppInst, NULL, NULL, NULL, tQoSAppParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, +//{"Flow", &DMWRITE, addObjQoSFlow, delObjQoSFlow, NULL, browseQoSFlowInst, NULL, NULL, NULL, tQoSFlowParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, +{"Policer", &DMWRITE, addObjQoSPolicer, delObjQoSPolicer, NULL, browseQoSPolicerInst, NULL, NULL, NULL, tQoSPolicerParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, +{"Queue", &DMWRITE, addObjQoSQueue, delObjQoSQueue, NULL, browseQoSQueueInst, NULL, NULL, NULL, tQoSQueueParams, get_linker_qqueue, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, +{"Shaper", &DMWRITE, addObjQoSShaper, delObjQoSShaper, NULL, browseQoSShaperInst, NULL, NULL, NULL, tQoSShaperParams, NULL, BBFDM_BOTH, LIST_KEY{"Interface", "Alias", NULL}}, {0} }; DMLEAF tQoSParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"ClassificationNumberOfEntries", &DMREAD, DMT_UNINT, os_get_QoS_ClassificationNumberOfEntries, NULL, BBFDM_BOTH}, -{"QueueStatsNumberOfEntries", &DMREAD, DMT_UNINT, os_get_QoS_QueueStatsNumberOfEntries, NULL, BBFDM_BOTH}, -{"ShaperNumberOfEntries", &DMREAD, DMT_UNINT, os_get_QoS_ShaperNumberOfEntries, NULL, BBFDM_BOTH}, -{"QueueNumberOfEntries", &DMREAD, DMT_UNINT, os_get_QoS_QueueNumberOfEntries, NULL, BBFDM_BOTH}, -//{"MaxClassificationEntries", &DMREAD, DMT_UNINT, get_QoS_MaxClassificationEntries, NULL, BBFDM_BOTH}, -//{"MaxAppEntries", &DMREAD, DMT_UNINT, get_QoS_MaxAppEntries, NULL, BBFDM_BOTH}, -//{"AppNumberOfEntries", &DMREAD, DMT_UNINT, get_QoS_AppNumberOfEntries, NULL, BBFDM_BOTH}, -//{"MaxFlowEntries", &DMREAD, DMT_UNINT, get_QoS_MaxFlowEntries, NULL, BBFDM_BOTH}, -//{"FlowNumberOfEntries", &DMREAD, DMT_UNINT, get_QoS_FlowNumberOfEntries, NULL, BBFDM_BOTH}, -//{"MaxPolicerEntries", &DMREAD, DMT_UNINT, get_QoS_MaxPolicerEntries, NULL, BBFDM_BOTH}, -{"PolicerNumberOfEntries", &DMREAD, DMT_UNINT, os_get_QoS_PolicerNumberOfEntries, NULL, BBFDM_BOTH}, -//{"MaxQueueEntries", &DMREAD, DMT_UNINT, get_QoS_MaxQueueEntries, NULL, BBFDM_BOTH}, -//{"MaxShaperEntries", &DMREAD, DMT_UNINT, get_QoS_MaxShaperEntries, NULL, BBFDM_BOTH}, -//{"DefaultForwardingPolicy", &DMWRITE, DMT_UNINT, get_QoS_DefaultForwardingPolicy, set_QoS_DefaultForwardingPolicy, BBFDM_BOTH}, -//{"DefaultTrafficClass", &DMWRITE, DMT_UNINT, get_QoS_DefaultTrafficClass, set_QoS_DefaultTrafficClass, BBFDM_BOTH}, -//{"DefaultPolicer", &DMWRITE, DMT_STRING, get_QoS_DefaultPolicer, set_QoS_DefaultPolicer, BBFDM_BOTH}, -//{"DefaultQueue", &DMWRITE, DMT_STRING, get_QoS_DefaultQueue, set_QoS_DefaultQueue, BBFDM_BOTH}, -//{"DefaultDSCPMark", &DMWRITE, DMT_INT, get_QoS_DefaultDSCPMark, set_QoS_DefaultDSCPMark, BBFDM_BOTH}, -//{"DefaultEthernetPriorityMark", &DMWRITE, DMT_INT, get_QoS_DefaultEthernetPriorityMark, set_QoS_DefaultEthernetPriorityMark, BBFDM_BOTH}, -//{"DefaultInnerEthernetPriorityMark", &DMWRITE, DMT_INT, get_QoS_DefaultInnerEthernetPriorityMark, set_QoS_DefaultInnerEthernetPriorityMark, BBFDM_BOTH}, -//{"AvailableAppList", &DMREAD, DMT_STRING, get_QoS_AvailableAppList, NULL, BBFDM_BOTH}, +{"ClassificationNumberOfEntries", &DMREAD, DMT_UNINT, get_QClassificationNumberOfEntries, NULL, BBFDM_BOTH}, +{"QueueStatsNumberOfEntries", &DMREAD, DMT_UNINT, get_QQueueStatsNumberOfEntries, NULL, BBFDM_BOTH}, +{"ShaperNumberOfEntries", &DMREAD, DMT_UNINT, get_QShaperNumberOfEntries, NULL, BBFDM_BOTH}, +{"QueueNumberOfEntries", &DMREAD, DMT_UNINT, get_QQueueNumberOfEntries, NULL, BBFDM_BOTH}, +//{"MaxClassificationEntries", &DMREAD, DMT_UNINT, get_QMaxClassificationEntries, NULL, BBFDM_BOTH}, +//{"MaxAppEntries", &DMREAD, DMT_UNINT, get_QMaxAppEntries, NULL, BBFDM_BOTH}, +//{"AppNumberOfEntries", &DMREAD, DMT_UNINT, get_QAppNumberOfEntries, NULL, BBFDM_BOTH}, +//{"MaxFlowEntries", &DMREAD, DMT_UNINT, get_QMaxFlowEntries, NULL, BBFDM_BOTH}, +//{"FlowNumberOfEntries", &DMREAD, DMT_UNINT, get_QFlowNumberOfEntries, NULL, BBFDM_BOTH}, +//{"MaxPolicerEntries", &DMREAD, DMT_UNINT, get_QMaxPolicerEntries, NULL, BBFDM_BOTH}, +{"PolicerNumberOfEntries", &DMREAD, DMT_UNINT, get_QPolicerNumberOfEntries, NULL, BBFDM_BOTH}, +//{"MaxQueueEntries", &DMREAD, DMT_UNINT, get_QMaxQueueEntries, NULL, BBFDM_BOTH}, +//{"MaxShaperEntries", &DMREAD, DMT_UNINT, get_QMaxShaperEntries, NULL, BBFDM_BOTH}, +//{"DefaultForwardingPolicy", &DMWRITE, DMT_UNINT, get_QDefaultForwardingPolicy, set_QDefaultForwardingPolicy, BBFDM_BOTH}, +//{"DefaultTrafficClass", &DMWRITE, DMT_UNINT, get_QDefaultTrafficClass, set_QDefaultTrafficClass, BBFDM_BOTH}, +//{"DefaultPolicer", &DMWRITE, DMT_STRING, get_QDefaultPolicer, set_QDefaultPolicer, BBFDM_BOTH}, +//{"DefaultQueue", &DMWRITE, DMT_STRING, get_QDefaultQueue, set_QDefaultQueue, BBFDM_BOTH}, +//{"DefaultDSCPMark", &DMWRITE, DMT_INT, get_QDefaultDSCPMark, set_QDefaultDSCPMark, BBFDM_BOTH}, +//{"DefaultEthernetPriorityMark", &DMWRITE, DMT_INT, get_QDefaultEthernetPriorityMark, set_QDefaultEthernetPriorityMark, BBFDM_BOTH}, +//{"DefaultInnerEthernetPriorityMark", &DMWRITE, DMT_INT, get_QDefaultInnerEthernetPriorityMark, set_QDefaultInnerEthernetPriorityMark, BBFDM_BOTH}, +//{"AvailableAppList", &DMREAD, DMT_STRING, get_QAvailableAppList, NULL, BBFDM_BOTH}, {0} }; /* *** Device.QoS.Classification.{i}. *** */ DMLEAF tQoSClassificationParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"Enable", &DMWRITE, DMT_BOOL, os_get_QoSClassification_Enable, os_set_QoSClassification_Enable, BBFDM_BOTH}, +{"Enable", &DMWRITE, DMT_BOOL, get_QoSClassification_Enable, set_QoSClassification_Enable, BBFDM_BOTH}, //{"Status", &DMREAD, DMT_STRING, get_QoSClassification_Status, NULL, BBFDM_BOTH}, //{"Order", &DMWRITE, DMT_UNINT, get_QoSClassification_Order, set_QoSClassification_Order, BBFDM_BOTH}, -{"Alias", &DMWRITE, DMT_STRING, os_get_QoSClassification_Alias, os_set_QoSClassification_Alias, BBFDM_BOTH}, +{"Alias", &DMWRITE, DMT_STRING, get_QoSClassification_Alias, set_QoSClassification_Alias, BBFDM_BOTH}, //{"DHCPType", &DMWRITE, DMT_STRING, get_QoSClassification_DHCPType, set_QoSClassification_DHCPType, BBFDM_BOTH}, -{"Interface", &DMWRITE, DMT_STRING, os_get_QoSClassification_Interface, os_set_QoSClassification_Interface, BBFDM_BOTH}, +{"Interface", &DMWRITE, DMT_STRING, get_QoSClassification_Interface, set_QoSClassification_Interface, BBFDM_BOTH}, //{"AllInterfaces", &DMWRITE, DMT_BOOL, get_QoSClassification_AllInterfaces, set_QoSClassification_AllInterfaces, BBFDM_BOTH}, -{"DestIP", &DMWRITE, DMT_STRING, os_get_QoSClassification_DestIP, os_set_QoSClassification_DestIP, BBFDM_BOTH}, -{"DestMask", &DMWRITE, DMT_STRING, os_get_QoSClassification_DestMask, os_set_QoSClassification_DestMask, BBFDM_BOTH}, +{"DestIP", &DMWRITE, DMT_STRING, get_QoSClassification_DestIP, set_QoSClassification_DestIP, BBFDM_BOTH}, +{"DestMask", &DMWRITE, DMT_STRING, get_QoSClassification_DestMask, set_QoSClassification_DestMask, BBFDM_BOTH}, //{"DestIPExclude", &DMWRITE, DMT_BOOL, get_QoSClassification_DestIPExclude, set_QoSClassification_DestIPExclude, BBFDM_BOTH}, -{"SourceIP", &DMWRITE, DMT_STRING, os_get_QoSClassification_SourceIP, os_set_QoSClassification_SourceIP, BBFDM_BOTH}, -{"SourceMask", &DMWRITE, DMT_STRING, os_get_QoSClassification_SourceMask, os_set_QoSClassification_SourceMask, BBFDM_BOTH}, +{"SourceIP", &DMWRITE, DMT_STRING, get_QoSClassification_SourceIP, set_QoSClassification_SourceIP, BBFDM_BOTH}, +{"SourceMask", &DMWRITE, DMT_STRING, get_QoSClassification_SourceMask, set_QoSClassification_SourceMask, BBFDM_BOTH}, //{"SourceIPExclude", &DMWRITE, DMT_BOOL, get_QoSClassification_SourceIPExclude, set_QoSClassification_SourceIPExclude, BBFDM_BOTH}, -{"Protocol", &DMWRITE, DMT_INT, os_get_QoSClassification_Protocol, os_set_QoSClassification_Protocol, BBFDM_BOTH}, +{"Protocol", &DMWRITE, DMT_INT, get_QoSClassification_Protocol, set_QoSClassification_Protocol, BBFDM_BOTH}, //{"ProtocolExclude", &DMWRITE, DMT_BOOL, get_QoSClassification_ProtocolExclude, set_QoSClassification_ProtocolExclude, BBFDM_BOTH}, -{"DestPort", &DMWRITE, DMT_INT, os_get_QoSClassification_DestPort, os_set_QoSClassification_DestPort, BBFDM_BOTH}, -{"DestPortRangeMax", &DMWRITE, DMT_INT, os_get_QoSClassification_DestPortRangeMax, os_set_QoSClassification_DestPortRangeMax, BBFDM_BOTH}, +{"DestPort", &DMWRITE, DMT_INT, get_QoSClassification_DestPort, set_QoSClassification_DestPort, BBFDM_BOTH}, +{"DestPortRangeMax", &DMWRITE, DMT_INT, get_QoSClassification_DestPortRangeMax, set_QoSClassification_DestPortRangeMax, BBFDM_BOTH}, //{"DestPortExclude", &DMWRITE, DMT_BOOL, get_QoSClassification_DestPortExclude, set_QoSClassification_DestPortExclude, BBFDM_BOTH}, -{"SourcePort", &DMWRITE, DMT_INT, os_get_QoSClassification_SourcePort, os_set_QoSClassification_SourcePort, BBFDM_BOTH}, -{"SourcePortRangeMax", &DMWRITE, DMT_INT, os_get_QoSClassification_SourcePortRangeMax, os_set_QoSClassification_SourcePortRangeMax, BBFDM_BOTH}, +{"SourcePort", &DMWRITE, DMT_INT, get_QoSClassification_SourcePort, set_QoSClassification_SourcePort, BBFDM_BOTH}, +{"SourcePortRangeMax", &DMWRITE, DMT_INT, get_QoSClassification_SourcePortRangeMax, set_QoSClassification_SourcePortRangeMax, BBFDM_BOTH}, //{"SourcePortExclude", &DMWRITE, DMT_BOOL, get_QoSClassification_SourcePortExclude, set_QoSClassification_SourcePortExclude, BBFDM_BOTH}, -{"SourceMACAddress", &DMWRITE, DMT_STRING, os_get_QoSClassification_SourceMACAddress, os_set_QoSClassification_SourceMACAddress, BBFDM_BOTH}, +{"SourceMACAddress", &DMWRITE, DMT_STRING, get_QoSClassification_SourceMACAddress, set_QoSClassification_SourceMACAddress, BBFDM_BOTH}, //{"SourceMACMask", &DMWRITE, DMT_STRING, get_QoSClassification_SourceMACMask, set_QoSClassification_SourceMACMask, BBFDM_BOTH}, //{"SourceMACExclude", &DMWRITE, DMT_BOOL, get_QoSClassification_SourceMACExclude, set_QoSClassification_SourceMACExclude, BBFDM_BOTH}, -{"DestMACAddress", &DMWRITE, DMT_STRING, os_get_QoSClassification_DestMACAddress, os_set_QoSClassification_DestMACAddress, BBFDM_BOTH}, +{"DestMACAddress", &DMWRITE, DMT_STRING, get_QoSClassification_DestMACAddress, set_QoSClassification_DestMACAddress, BBFDM_BOTH}, //{"DestMACMask", &DMWRITE, DMT_STRING, get_QoSClassification_DestMACMask, set_QoSClassification_DestMACMask, BBFDM_BOTH}, //{"DestMACExclude", &DMWRITE, DMT_BOOL, get_QoSClassification_DestMACExclude, set_QoSClassification_DestMACExclude, BBFDM_BOTH}, -{"Ethertype", &DMWRITE, DMT_INT, os_get_QoSClassification_Ethertype, os_set_QoSClassification_Ethertype, BBFDM_BOTH}, +{"Ethertype", &DMWRITE, DMT_INT, get_QoSClassification_Ethertype, set_QoSClassification_Ethertype, BBFDM_BOTH}, //{"EthertypeExclude", &DMWRITE, DMT_BOOL, get_QoSClassification_EthertypeExclude, set_QoSClassification_EthertypeExclude, BBFDM_BOTH}, //{"SSAP", &DMWRITE, DMT_INT, get_QoSClassification_SSAP, set_QoSClassification_SSAP, BBFDM_BOTH}, //{"SSAPExclude", &DMWRITE, DMT_BOOL, get_QoSClassification_SSAPExclude, set_QoSClassification_SSAPExclude, BBFDM_BOTH}, @@ -90,21 +1999,21 @@ DMLEAF tQoSClassificationParams[] = { //{"LLCControlExclude", &DMWRITE, DMT_BOOL, get_QoSClassification_LLCControlExclude, set_QoSClassification_LLCControlExclude, BBFDM_BOTH}, //{"SNAPOUI", &DMWRITE, DMT_INT, get_QoSClassification_SNAPOUI, set_QoSClassification_SNAPOUI, BBFDM_BOTH}, //{"SNAPOUIExclude", &DMWRITE, DMT_BOOL, get_QoSClassification_SNAPOUIExclude, set_QoSClassification_SNAPOUIExclude, BBFDM_BOTH}, -{"SourceVendorClassID", &DMWRITE, DMT_STRING, os_get_QoSClassification_SourceVendorClassID, os_set_QoSClassification_SourceVendorClassID, BBFDM_BOTH}, +{"SourceVendorClassID", &DMWRITE, DMT_STRING, get_QoSClassification_SourceVendorClassID, set_QoSClassification_SourceVendorClassID, BBFDM_BOTH}, //{"SourceVendorClassIDv6", &DMWRITE, DMT_HEXBIN, get_QoSClassification_SourceVendorClassIDv6, set_QoSClassification_SourceVendorClassIDv6, BBFDM_BOTH}, //{"SourceVendorClassIDExclude", &DMWRITE, DMT_BOOL, get_QoSClassification_SourceVendorClassIDExclude, set_QoSClassification_SourceVendorClassIDExclude, BBFDM_BOTH}, //{"SourceVendorClassIDMode", &DMWRITE, DMT_STRING, get_QoSClassification_SourceVendorClassIDMode, set_QoSClassification_SourceVendorClassIDMode, BBFDM_BOTH}, -{"DestVendorClassID", &DMWRITE, DMT_STRING, os_get_QoSClassification_DestVendorClassID, os_set_QoSClassification_DestVendorClassID, BBFDM_BOTH}, +{"DestVendorClassID", &DMWRITE, DMT_STRING, get_QoSClassification_DestVendorClassID, set_QoSClassification_DestVendorClassID, BBFDM_BOTH}, //{"DestVendorClassIDv6", &DMWRITE, DMT_HEXBIN, get_QoSClassification_DestVendorClassIDv6, set_QoSClassification_DestVendorClassIDv6, BBFDM_BOTH}, //{"DestVendorClassIDExclude", &DMWRITE, DMT_BOOL, get_QoSClassification_DestVendorClassIDExclude, set_QoSClassification_DestVendorClassIDExclude, BBFDM_BOTH}, //{"DestVendorClassIDMode", &DMWRITE, DMT_STRING, get_QoSClassification_DestVendorClassIDMode, set_QoSClassification_DestVendorClassIDMode, BBFDM_BOTH}, -{"SourceClientID", &DMWRITE, DMT_HEXBIN, os_get_QoSClassification_SourceClientID, os_set_QoSClassification_SourceClientID, BBFDM_BOTH}, +{"SourceClientID", &DMWRITE, DMT_HEXBIN, get_QoSClassification_SourceClientID, set_QoSClassification_SourceClientID, BBFDM_BOTH}, //{"SourceClientIDExclude", &DMWRITE, DMT_BOOL, get_QoSClassification_SourceClientIDExclude, set_QoSClassification_SourceClientIDExclude, BBFDM_BOTH}, -{"DestClientID", &DMWRITE, DMT_HEXBIN, os_get_QoSClassification_DestClientID, os_set_QoSClassification_DestClientID, BBFDM_BOTH}, +{"DestClientID", &DMWRITE, DMT_HEXBIN, get_QoSClassification_DestClientID, set_QoSClassification_DestClientID, BBFDM_BOTH}, //{"DestClientIDExclude", &DMWRITE, DMT_BOOL, get_QoSClassification_DestClientIDExclude, set_QoSClassification_DestClientIDExclude, BBFDM_BOTH}, -{"SourceUserClassID", &DMWRITE, DMT_HEXBIN, os_get_QoSClassification_SourceUserClassID, os_set_QoSClassification_SourceUserClassID, BBFDM_BOTH}, +{"SourceUserClassID", &DMWRITE, DMT_HEXBIN, get_QoSClassification_SourceUserClassID, set_QoSClassification_SourceUserClassID, BBFDM_BOTH}, //{"SourceUserClassIDExclude", &DMWRITE, DMT_BOOL, get_QoSClassification_SourceUserClassIDExclude, set_QoSClassification_SourceUserClassIDExclude, BBFDM_BOTH}, -{"DestUserClassID", &DMWRITE, DMT_HEXBIN, os_get_QoSClassification_DestUserClassID, os_set_QoSClassification_DestUserClassID, BBFDM_BOTH}, +{"DestUserClassID", &DMWRITE, DMT_HEXBIN, get_QoSClassification_DestUserClassID, set_QoSClassification_DestUserClassID, BBFDM_BOTH}, //{"DestUserClassIDExclude", &DMWRITE, DMT_BOOL, get_QoSClassification_DestUserClassIDExclude, set_QoSClassification_DestUserClassIDExclude, BBFDM_BOTH}, //{"SourceVendorSpecificInfo", &DMWRITE, DMT_HEXBIN, get_QoSClassification_SourceVendorSpecificInfo, set_QoSClassification_SourceVendorSpecificInfo, BBFDM_BOTH}, //{"SourceVendorSpecificInfoExclude", &DMWRITE, DMT_BOOL, get_QoSClassification_SourceVendorSpecificInfoExclude, set_QoSClassification_SourceVendorSpecificInfoExclude, BBFDM_BOTH}, @@ -116,13 +2025,13 @@ DMLEAF tQoSClassificationParams[] = { //{"DestVendorSpecificInfoSubOption", &DMWRITE, DMT_INT, get_QoSClassification_DestVendorSpecificInfoSubOption, set_QoSClassification_DestVendorSpecificInfoSubOption, BBFDM_BOTH}, //{"TCPACK", &DMWRITE, DMT_BOOL, get_QoSClassification_TCPACK, set_QoSClassification_TCPACK, BBFDM_BOTH}, //{"TCPACKExclude", &DMWRITE, DMT_BOOL, get_QoSClassification_TCPACKExclude, set_QoSClassification_TCPACKExclude, BBFDM_BOTH}, -{"IPLengthMin", &DMWRITE, DMT_UNINT, os_get_QoSClassification_IPLengthMin, os_set_QoSClassification_IPLengthMin, BBFDM_BOTH}, -{"IPLengthMax", &DMWRITE, DMT_UNINT, os_get_QoSClassification_IPLengthMax, os_set_QoSClassification_IPLengthMax, BBFDM_BOTH}, +{"IPLengthMin", &DMWRITE, DMT_UNINT, get_QoSClassification_IPLengthMin, set_QoSClassification_IPLengthMin, BBFDM_BOTH}, +{"IPLengthMax", &DMWRITE, DMT_UNINT, get_QoSClassification_IPLengthMax, set_QoSClassification_IPLengthMax, BBFDM_BOTH}, //{"IPLengthExclude", &DMWRITE, DMT_BOOL, get_QoSClassification_IPLengthExclude, set_QoSClassification_IPLengthExclude, BBFDM_BOTH}, -{"DSCPCheck", &DMWRITE, DMT_INT, os_get_QoSClassification_DSCPCheck, os_set_QoSClassification_DSCPCheck, BBFDM_BOTH}, +{"DSCPCheck", &DMWRITE, DMT_INT, get_QoSClassification_DSCPCheck, set_QoSClassification_DSCPCheck, BBFDM_BOTH}, //{"DSCPExclude", &DMWRITE, DMT_BOOL, get_QoSClassification_DSCPExclude, set_QoSClassification_DSCPExclude, BBFDM_BOTH}, -{"DSCPMark", &DMWRITE, DMT_INT, os_get_QoSClassification_DSCPMark, os_set_QoSClassification_DSCPMark, BBFDM_BOTH}, -{"EthernetPriorityCheck", &DMWRITE, DMT_INT, os_get_QoSClassification_EthernetPriorityCheck, os_set_QoSClassification_EthernetPriorityCheck, BBFDM_BOTH}, +{"DSCPMark", &DMWRITE, DMT_INT, get_QoSClassification_DSCPMark, set_QoSClassification_DSCPMark, BBFDM_BOTH}, +{"EthernetPriorityCheck", &DMWRITE, DMT_INT, get_QoSClassification_EthernetPriorityCheck, set_QoSClassification_EthernetPriorityCheck, BBFDM_BOTH}, //{"EthernetPriorityExclude", &DMWRITE, DMT_BOOL, get_QoSClassification_EthernetPriorityExclude, set_QoSClassification_EthernetPriorityExclude, BBFDM_BOTH}, //{"EthernetPriorityMark", &DMWRITE, DMT_INT, get_QoSClassification_EthernetPriorityMark, set_QoSClassification_EthernetPriorityMark, BBFDM_BOTH}, //{"InnerEthernetPriorityCheck", &DMWRITE, DMT_INT, get_QoSClassification_InnerEthernetPriorityCheck, set_QoSClassification_InnerEthernetPriorityCheck, BBFDM_BOTH}, @@ -130,12 +2039,12 @@ DMLEAF tQoSClassificationParams[] = { //{"InnerEthernetPriorityMark", &DMWRITE, DMT_INT, get_QoSClassification_InnerEthernetPriorityMark, set_QoSClassification_InnerEthernetPriorityMark, BBFDM_BOTH}, //{"EthernetDEICheck", &DMWRITE, DMT_INT, get_QoSClassification_EthernetDEICheck, set_QoSClassification_EthernetDEICheck, BBFDM_BOTH}, //{"EthernetDEIExclude", &DMWRITE, DMT_BOOL, get_QoSClassification_EthernetDEIExclude, set_QoSClassification_EthernetDEIExclude, BBFDM_BOTH}, -{"VLANIDCheck", &DMWRITE, DMT_INT, os_get_QoSClassification_VLANIDCheck, os_set_QoSClassification_VLANIDCheck, BBFDM_BOTH}, +{"VLANIDCheck", &DMWRITE, DMT_INT, get_QoSClassification_VLANIDCheck, set_QoSClassification_VLANIDCheck, BBFDM_BOTH}, //{"VLANIDExclude", &DMWRITE, DMT_BOOL, get_QoSClassification_VLANIDExclude, set_QoSClassification_VLANIDExclude, BBFDM_BOTH}, //{"OutOfBandInfo", &DMWRITE, DMT_INT, get_QoSClassification_OutOfBandInfo, set_QoSClassification_OutOfBandInfo, BBFDM_BOTH}, //{"ForwardingPolicy", &DMWRITE, DMT_UNINT, get_QoSClassification_ForwardingPolicy, set_QoSClassification_ForwardingPolicy, BBFDM_BOTH}, -{"TrafficClass", &DMWRITE, DMT_INT, os_get_QoSClassification_TrafficClass, os_set_QoSClassification_TrafficClass, BBFDM_BOTH}, -{"Policer", &DMWRITE, DMT_STRING, os_get_QoSClassification_Policer, os_set_QoSClassification_Policer, BBFDM_BOTH}, +{"TrafficClass", &DMWRITE, DMT_INT, get_QoSClassification_TrafficClass, set_QoSClassification_TrafficClass, BBFDM_BOTH}, +{"Policer", &DMWRITE, DMT_STRING, get_QoSClassification_Policer, set_QoSClassification_Policer, BBFDM_BOTH}, //{"App", &DMWRITE, DMT_STRING, get_QoSClassification_App, set_QoSClassification_App, BBFDM_BOTH}, {0} }; @@ -179,16 +2088,16 @@ DMLEAF tQoSFlowParams[] = { /* *** Device.QoS.Policer.{i}. *** */ DMLEAF tQoSPolicerParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"Enable", &DMWRITE, DMT_BOOL, os_get_QoSPolicer_Enable, os_set_QoSPolicer_Enable, BBFDM_BOTH}, -{"Status", &DMREAD, DMT_STRING, os_get_QoSPolicer_Status, NULL, BBFDM_BOTH}, -{"Alias", &DMWRITE, DMT_STRING, os_get_QoSPolicer_Alias, os_set_QoSPolicer_Alias, BBFDM_BOTH}, -{"CommittedRate", &DMWRITE, DMT_UNINT, os_get_QoSPolicer_CommittedRate, os_set_QoSPolicer_CommittedRate, BBFDM_BOTH}, -{"CommittedBurstSize", &DMWRITE, DMT_UNINT, os_get_QoSPolicer_CommittedBurstSize, os_set_QoSPolicer_CommittedBurstSize, BBFDM_BOTH}, -{"ExcessBurstSize", &DMWRITE, DMT_UNINT, os_get_QoSPolicer_ExcessBurstSize, os_set_QoSPolicer_ExcessBurstSize, BBFDM_BOTH}, -{"PeakRate", &DMWRITE, DMT_UNINT, os_get_QoSPolicer_PeakRate, os_set_QoSPolicer_PeakRate, BBFDM_BOTH}, -{"PeakBurstSize", &DMWRITE, DMT_UNINT, os_get_QoSPolicer_PeakBurstSize, os_set_QoSPolicer_PeakBurstSize, BBFDM_BOTH}, -{"MeterType", &DMWRITE, DMT_STRING, os_get_QoSPolicer_MeterType, os_set_QoSPolicer_MeterType, BBFDM_BOTH}, -{"PossibleMeterTypes", &DMREAD, DMT_STRING, os_get_QoSPolicer_PossibleMeterTypes, NULL, BBFDM_BOTH}, +{"Enable", &DMWRITE, DMT_BOOL, get_QoSPolicer_Enable, set_QoSPolicer_Enable, BBFDM_BOTH}, +{"Status", &DMREAD, DMT_STRING, get_QoSPolicer_Status, NULL, BBFDM_BOTH}, +{"Alias", &DMWRITE, DMT_STRING, get_QoSPolicer_Alias, set_QoSPolicer_Alias, BBFDM_BOTH}, +{"CommittedRate", &DMWRITE, DMT_UNINT, get_QoSPolicer_CommittedRate, set_QoSPolicer_CommittedRate, BBFDM_BOTH}, +{"CommittedBurstSize", &DMWRITE, DMT_UNINT, get_QoSPolicer_CommittedBurstSize, set_QoSPolicer_CommittedBurstSize, BBFDM_BOTH}, +{"ExcessBurstSize", &DMWRITE, DMT_UNINT, get_QoSPolicer_ExcessBurstSize, set_QoSPolicer_ExcessBurstSize, BBFDM_BOTH}, +{"PeakRate", &DMWRITE, DMT_UNINT, get_QoSPolicer_PeakRate, set_QoSPolicer_PeakRate, BBFDM_BOTH}, +{"PeakBurstSize", &DMWRITE, DMT_UNINT, get_QoSPolicer_PeakBurstSize, set_QoSPolicer_PeakBurstSize, BBFDM_BOTH}, +{"MeterType", &DMWRITE, DMT_STRING, get_QoSPolicer_MeterType, set_QoSPolicer_MeterType, BBFDM_BOTH}, +{"PossibleMeterTypes", &DMREAD, DMT_STRING, get_QoSPolicer_PossibleMeterTypes, NULL, BBFDM_BOTH}, //{"ConformingAction", &DMWRITE, DMT_STRING, get_QoSPolicer_ConformingAction, set_QoSPolicer_ConformingAction, BBFDM_BOTH}, //{"PartialConformingAction", &DMWRITE, DMT_STRING, get_QoSPolicer_PartialConformingAction, set_QoSPolicer_PartialConformingAction, BBFDM_BOTH}, //{"NonConformingAction", &DMWRITE, DMT_STRING, get_QoSPolicer_NonConformingAction, set_QoSPolicer_NonConformingAction, BBFDM_BOTH}, @@ -206,38 +2115,38 @@ DMLEAF tQoSPolicerParams[] = { /* *** Device.QoS.Queue.{i}. *** */ DMLEAF tQoSQueueParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"Enable", &DMWRITE, DMT_BOOL, os_get_QoSQueue_Enable, os_set_QoSQueue_Enable, BBFDM_BOTH}, -{"Status", &DMREAD, DMT_STRING, os_get_QoSQueue_Status, NULL, BBFDM_BOTH}, -{"Alias", &DMWRITE, DMT_STRING, os_get_QoSQueue_Alias, os_set_QoSQueue_Alias, BBFDM_BOTH}, -{"TrafficClasses", &DMWRITE, DMT_STRING, os_get_QoSQueue_TrafficClasses, os_set_QoSQueue_TrafficClasses, BBFDM_BOTH}, -{"Interface", &DMWRITE, DMT_STRING, os_get_QoSQueue_Interface, os_set_QoSQueue_Interface, BBFDM_BOTH}, -//{"AllInterfaces", &DMWRITE, DMT_BOOL, os_get_QoSQueue_AllInterfaces, os_set_QoSQueue_AllInterfaces, BBFDM_BOTH}, -//{"HardwareAssisted", &DMREAD, DMT_BOOL, os_get_QoSQueue_HardwareAssisted, NULL, BBFDM_BOTH}, -//{"BufferLength", &DMREAD, DMT_UNINT, os_get_QoSQueue_BufferLength, NULL, BBFDM_BOTH}, -{"Weight", &DMWRITE, DMT_UNINT, os_get_QoSQueue_Weight, os_set_QoSQueue_Weight, BBFDM_BOTH}, -{"Precedence", &DMWRITE, DMT_UNINT, os_get_QoSQueue_Precedence, os_set_QoSQueue_Precedence, BBFDM_BOTH}, -//{"REDThreshold", &DMWRITE, DMT_UNINT, os_get_QoSQueue_REDThreshold, os_set_QoSQueue_REDThreshold, BBFDM_BOTH}, -//{"REDPercentage", &DMWRITE, DMT_UNINT, os_get_QoSQueue_REDPercentage, os_set_QoSQueue_REDPercentage, BBFDM_BOTH}, -//{"DropAlgorithm", &DMWRITE, DMT_STRING, os_get_QoSQueue_DropAlgorithm, os_set_QoSQueue_DropAlgorithm, BBFDM_BOTH}, -{"SchedulerAlgorithm", &DMWRITE, DMT_STRING, os_get_QoSQueue_SchedulerAlgorithm, os_set_QoSQueue_SchedulerAlgorithm, BBFDM_BOTH}, -{"ShapingRate", &DMWRITE, DMT_INT, os_get_QoSQueue_ShapingRate, os_set_QoSQueue_ShapingRate, BBFDM_BOTH}, -{"ShapingBurstSize", &DMWRITE, DMT_UNINT, os_get_QoSQueue_ShapingBurstSize, os_set_QoSQueue_ShapingBurstSize, BBFDM_BOTH}, +{"Enable", &DMWRITE, DMT_BOOL, get_QoSQueue_Enable, set_QoSQueue_Enable, BBFDM_BOTH}, +{"Status", &DMREAD, DMT_STRING, get_QoSQueue_Status, NULL, BBFDM_BOTH}, +{"Alias", &DMWRITE, DMT_STRING, get_QoSQueue_Alias, set_QoSQueue_Alias, BBFDM_BOTH}, +{"TrafficClasses", &DMWRITE, DMT_STRING, get_QoSQueue_TrafficClasses, set_QoSQueue_TrafficClasses, BBFDM_BOTH}, +{"Interface", &DMWRITE, DMT_STRING, get_QoSQueue_Interface, set_QoSQueue_Interface, BBFDM_BOTH}, +//{"AllInterfaces", &DMWRITE, DMT_BOOL, get_QoSQueue_AllInterfaces, set_QoSQueue_AllInterfaces, BBFDM_BOTH}, +//{"HardwareAssisted", &DMREAD, DMT_BOOL, get_QoSQueue_HardwareAssisted, NULL, BBFDM_BOTH}, +//{"BufferLength", &DMREAD, DMT_UNINT, get_QoSQueue_BufferLength, NULL, BBFDM_BOTH}, +{"Weight", &DMWRITE, DMT_UNINT, get_QoSQueue_Weight, set_QoSQueue_Weight, BBFDM_BOTH}, +{"Precedence", &DMWRITE, DMT_UNINT, get_QoSQueue_Precedence, set_QoSQueue_Precedence, BBFDM_BOTH}, +//{"REDThreshold", &DMWRITE, DMT_UNINT, get_QoSQueue_REDThreshold, set_QoSQueue_REDThreshold, BBFDM_BOTH}, +//{"REDPercentage", &DMWRITE, DMT_UNINT, get_QoSQueue_REDPercentage, set_QoSQueue_REDPercentage, BBFDM_BOTH}, +//{"DropAlgorithm", &DMWRITE, DMT_STRING, get_QoSQueue_DropAlgorithm, set_QoSQueue_DropAlgorithm, BBFDM_BOTH}, +{"SchedulerAlgorithm", &DMWRITE, DMT_STRING, get_QoSQueue_SchedulerAlgorithm, set_QoSQueue_SchedulerAlgorithm, BBFDM_BOTH}, +{"ShapingRate", &DMWRITE, DMT_INT, get_QoSQueue_ShapingRate, set_QoSQueue_ShapingRate, BBFDM_BOTH}, +{"ShapingBurstSize", &DMWRITE, DMT_UNINT, get_QoSQueue_ShapingBurstSize, set_QoSQueue_ShapingBurstSize, BBFDM_BOTH}, {0} }; /* *** Device.QoS.QueueStats.{i}. *** */ DMLEAF tQoSQueueStatsParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"Enable", &DMWRITE, DMT_BOOL, os_get_QoSQueueStats_Enable, os_set_QoSQueueStats_Enable, BBFDM_BOTH}, -{"Status", &DMREAD, DMT_STRING, os_get_QoSQueueStats_Status, NULL, BBFDM_BOTH}, -{"Alias", &DMWRITE, DMT_STRING, os_get_QoSQueueStats_Alias, os_set_QoSQueueStats_Alias, BBFDM_BOTH}, -{"Queue", &DMWRITE, DMT_STRING, os_get_QoSQueueStats_Queue, os_set_QoSQueueStats_Queue, BBFDM_BOTH}, -{"Interface", &DMWRITE, DMT_STRING, os_get_QoSQueueStats_Interface, os_set_QoSQueueStats_Interface, BBFDM_BOTH}, -{"OutputPackets", &DMREAD, DMT_UNINT, os_get_QoSQueueStats_OutputPackets, NULL, BBFDM_BOTH}, -{"OutputBytes", &DMREAD, DMT_UNINT, os_get_QoSQueueStats_OutputBytes, NULL, BBFDM_BOTH}, -{"DroppedPackets", &DMREAD, DMT_UNINT, os_get_QoSQueueStats_DroppedPackets, NULL, BBFDM_BOTH}, -{"DroppedBytes", &DMREAD, DMT_UNINT, os_get_QoSQueueStats_DroppedBytes, NULL, BBFDM_BOTH}, -//{"QueueOccupancyPackets", &DMREAD, DMT_UNINT, os_get_QoSQueueStats_QueueOccupancyPackets, NULL, BBFDM_BOTH}, +{"Enable", &DMWRITE, DMT_BOOL, get_QoSQueueStats_Enable, set_QoSQueueStats_Enable, BBFDM_BOTH}, +{"Status", &DMREAD, DMT_STRING, get_QoSQueueStats_Status, NULL, BBFDM_BOTH}, +{"Alias", &DMWRITE, DMT_STRING, get_QoSQueueStats_Alias, set_QoSQueueStats_Alias, BBFDM_BOTH}, +{"Queue", &DMWRITE, DMT_STRING, get_QoSQueueStats_Queue, set_QoSQueueStats_Queue, BBFDM_BOTH}, +{"Interface", &DMWRITE, DMT_STRING, get_QoSQueueStats_Interface, set_QoSQueueStats_Interface, BBFDM_BOTH}, +{"OutputPackets", &DMREAD, DMT_UNINT, get_QoSQueueStats_OutputPackets, NULL, BBFDM_BOTH}, +{"OutputBytes", &DMREAD, DMT_UNINT, get_QoSQueueStats_OutputBytes, NULL, BBFDM_BOTH}, +{"DroppedPackets", &DMREAD, DMT_UNINT, get_QoSQueueStats_DroppedPackets, NULL, BBFDM_BOTH}, +{"DroppedBytes", &DMREAD, DMT_UNINT, get_QoSQueueStats_DroppedBytes, NULL, BBFDM_BOTH}, +//{"QueueOccupancyPackets", &DMREAD, DMT_UNINT, get_QoSQueueStats_QueueOccupancyPackets, NULL, BBFDM_BOTH}, //{"QueueOccupancyPercentage", &DMREAD, DMT_UNINT, get_QoSQueueStats_QueueOccupancyPercentage, NULL, BBFDM_BOTH}, {0} }; @@ -245,11 +2154,11 @@ DMLEAF tQoSQueueStatsParams[] = { /* *** Device.QoS.Shaper.{i}. *** */ DMLEAF tQoSShaperParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"Enable", &DMWRITE, DMT_BOOL, os_get_QoSShaper_Enable, os_set_QoSShaper_Enable, BBFDM_BOTH}, -{"Status", &DMREAD, DMT_STRING, os_get_QoSShaper_Status, NULL, BBFDM_BOTH}, -{"Alias", &DMWRITE, DMT_STRING, os_get_QoSShaper_Alias, os_set_QoSShaper_Alias, BBFDM_BOTH}, -{"Interface", &DMWRITE, DMT_STRING, os_get_QoSShaper_Interface, os_set_QoSShaper_Interface, BBFDM_BOTH}, -{"ShapingRate", &DMWRITE, DMT_INT, os_get_QoSShaper_ShapingRate, os_set_QoSShaper_ShapingRate, BBFDM_BOTH}, -{"ShapingBurstSize", &DMWRITE, DMT_UNINT, os_get_QoSShaper_ShapingBurstSize, os_set_QoSShaper_ShapingBurstSize, BBFDM_BOTH}, +{"Enable", &DMWRITE, DMT_BOOL, get_QoSShaper_Enable, set_QoSShaper_Enable, BBFDM_BOTH}, +{"Status", &DMREAD, DMT_STRING, get_QoSShaper_Status, NULL, BBFDM_BOTH}, +{"Alias", &DMWRITE, DMT_STRING, get_QoSShaper_Alias, set_QoSShaper_Alias, BBFDM_BOTH}, +{"Interface", &DMWRITE, DMT_STRING, get_QoSShaper_Interface, set_QoSShaper_Interface, BBFDM_BOTH}, +{"ShapingRate", &DMWRITE, DMT_INT, get_QoSShaper_ShapingRate, set_QoSShaper_ShapingRate, BBFDM_BOTH}, +{"ShapingBurstSize", &DMWRITE, DMT_UNINT, get_QoSShaper_ShapingBurstSize, set_QoSShaper_ShapingBurstSize, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/routing.c b/dmtree/tr181/routing.c index bbc0b331..18ebf6be 100644 --- a/dmtree/tr181/routing.c +++ b/dmtree/tr181/routing.c @@ -1346,9 +1346,9 @@ static int browseRoutingRouteInformationInterfaceSettingInst(struct dmctx *dmctx /* *** Device.Routing. *** */ DMOBJ tRoutingObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Router", &DMREAD, NULL, NULL, NULL, browseRouterInst, NULL, tRoutingRouterObj, tRoutingRouterParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, -{"RouteInformation", &DMREAD, NULL, NULL, NULL, NULL, NULL, tRoutingRouteInformationObj, tRoutingRouteInformationParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Router", &DMREAD, NULL, NULL, NULL, browseRouterInst, NULL, NULL, tRoutingRouterObj, tRoutingRouterParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, +{"RouteInformation", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tRoutingRouteInformationObj, tRoutingRouteInformationParams, NULL, BBFDM_BOTH}, {0} }; @@ -1360,9 +1360,9 @@ DMLEAF tRoutingParams[] = { /* *** Device.Routing.Router.{i}. *** */ DMOBJ tRoutingRouterObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"IPv4Forwarding", &DMWRITE, add_ipv4forwarding, delete_ipv4forwarding, NULL, browseIPv4ForwardingInst, NULL, NULL, tRoutingRouterIPv4ForwardingParams, NULL, BBFDM_BOTH, LIST_KEY{"DestIPAddress", "DestSubnetMask", "ForwardingPolicy", "GatewayIPAddress", "Interface", "ForwardingMetric", "Alias", NULL}}, -{"IPv6Forwarding", &DMWRITE, add_ipv6Forwarding, delete_ipv6Forwarding, NULL, browseIPv6ForwardingInst, NULL, NULL, tRoutingRouterIPv6ForwardingParams, NULL, BBFDM_BOTH, LIST_KEY{"DestIPPrefix", "ForwardingPolicy", "NextHop", "Interface", "ForwardingMetric", "Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"IPv4Forwarding", &DMWRITE, add_ipv4forwarding, delete_ipv4forwarding, NULL, browseIPv4ForwardingInst, NULL, NULL, NULL, tRoutingRouterIPv4ForwardingParams, NULL, BBFDM_BOTH, LIST_KEY{"DestIPAddress", "DestSubnetMask", "ForwardingPolicy", "GatewayIPAddress", "Interface", "ForwardingMetric", "Alias", NULL}}, +{"IPv6Forwarding", &DMWRITE, add_ipv6Forwarding, delete_ipv6Forwarding, NULL, browseIPv6ForwardingInst, NULL, NULL, NULL, tRoutingRouterIPv6ForwardingParams, NULL, BBFDM_BOTH, LIST_KEY{"DestIPPrefix", "ForwardingPolicy", "NextHop", "Interface", "ForwardingMetric", "Alias", NULL}}, {0} }; @@ -1411,8 +1411,8 @@ DMLEAF tRoutingRouterIPv6ForwardingParams[] = { /* *** Device.Routing.RouteInformation. *** */ DMOBJ tRoutingRouteInformationObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"InterfaceSetting", &DMREAD, NULL, NULL, NULL, browseRoutingRouteInformationInterfaceSettingInst, NULL, NULL, tRoutingRouteInformationInterfaceSettingParams, NULL, BBFDM_BOTH, LIST_KEY{"Interface", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"InterfaceSetting", &DMREAD, NULL, NULL, NULL, browseRoutingRouteInformationInterfaceSettingInst, NULL, NULL, NULL, tRoutingRouteInformationInterfaceSettingParams, NULL, BBFDM_BOTH, LIST_KEY{"Interface", NULL}}, {0} }; diff --git a/dmtree/tr181/security.c b/dmtree/tr181/security.c index fccd9345..e8a48c88 100644 --- a/dmtree/tr181/security.c +++ b/dmtree/tr181/security.c @@ -429,8 +429,8 @@ static int get_SecurityCertificate_SignatureAlgorithm(char *refparam, struct dmc /* *** Device.Security. *** */ DMOBJ tSecurityObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Certificate", &DMREAD, NULL, NULL, NULL, browseSecurityCertificateInst, NULL, NULL, tSecurityCertificateParams, NULL, BBFDM_BOTH, LIST_KEY{"SerialNumber", "Issuer", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Certificate", &DMREAD, NULL, NULL, NULL, browseSecurityCertificateInst, NULL, NULL, NULL, tSecurityCertificateParams, NULL, BBFDM_BOTH, LIST_KEY{"SerialNumber", "Issuer", NULL}}, {0} }; diff --git a/dmtree/tr181/softwaremodules.c b/dmtree/tr181/softwaremodules.c index f7b28e51..3cf91858 100644 --- a/dmtree/tr181/softwaremodules.c +++ b/dmtree/tr181/softwaremodules.c @@ -670,10 +670,10 @@ static int get_SoftwareModulesExecutionUnit_ExecutionEnvRef(char *refparam, stru /* *** Device.SoftwareModules. *** */ DMOBJ tSoftwareModulesObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"ExecEnv", &DMREAD, NULL, NULL, NULL, browseSoftwareModulesExecEnvInst, NULL, NULL, tSoftwareModulesExecEnvParams, get_exe_cenv_linker, BBFDM_BOTH, LIST_KEY{"Alias", "Name", NULL}}, -{"DeploymentUnit", &DMREAD, NULL, NULL, NULL, browseSoftwareModulesDeploymentUnitInst, NULL, NULL, tSoftwareModulesDeploymentUnitParams, get_du_linker, BBFDM_BOTH, LIST_KEY{"UUID", "Version", "ExecutionEnvRef", "Alias", NULL}}, -{"ExecutionUnit", &DMREAD, NULL, NULL, NULL, browseSoftwareModulesExecutionUnitInst, NULL, tSoftwareModulesExecutionUnitObj, tSoftwareModulesExecutionUnitParams, NULL, BBFDM_BOTH, LIST_KEY{"EUID", "Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"ExecEnv", &DMREAD, NULL, NULL, NULL, browseSoftwareModulesExecEnvInst, NULL, NULL, NULL, tSoftwareModulesExecEnvParams, get_exe_cenv_linker, BBFDM_BOTH, LIST_KEY{"Alias", "Name", NULL}}, +{"DeploymentUnit", &DMREAD, NULL, NULL, NULL, browseSoftwareModulesDeploymentUnitInst, NULL, NULL, NULL, tSoftwareModulesDeploymentUnitParams, get_du_linker, BBFDM_BOTH, LIST_KEY{"UUID", "Version", "ExecutionEnvRef", "Alias", NULL}}, +{"ExecutionUnit", &DMREAD, NULL, NULL, NULL, browseSoftwareModulesExecutionUnitInst, NULL, NULL, tSoftwareModulesExecutionUnitObj, tSoftwareModulesExecutionUnitParams, NULL, BBFDM_BOTH, LIST_KEY{"EUID", "Alias", NULL}}, {0} }; @@ -732,8 +732,8 @@ DMLEAF tSoftwareModulesDeploymentUnitParams[] = { /* *** Device.SoftwareModules.ExecutionUnit.{i}. *** */ DMOBJ tSoftwareModulesExecutionUnitObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -//{"Extensions", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +//{"Extensions", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/times.c b/dmtree/tr181/times.c index 4a719621..1d5065ce 100644 --- a/dmtree/tr181/times.c +++ b/dmtree/tr181/times.c @@ -85,12 +85,6 @@ static int set_time_LocalTimeZone(char *refparam, struct dmctx *ctx, void *data, return 0; } -static int get_local_time_zone_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_option_value_string("system", "@system[0]", "zonename", value); - return 0; -} - static int get_time_ntpserver(char *refparam, struct dmctx *ctx, char **value, int index) { bool found = 0; @@ -120,19 +114,6 @@ static int get_time_ntpserver(char *refparam, struct dmctx *ctx, char **value, i return 0; } -static int get_time_source_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *iface = NULL; - - dmuci_get_option_value_string("system", "ntp", "interface", &iface); - if (*iface == '\0' || strlen(iface) == 0) - return 0; - adm_entry_get_linker_param(ctx, "Device.IP.Interface.", iface, value); - if (*value == NULL) - *value = ""; - return 0; -} - static int get_time_ntpserver1(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { return get_time_ntpserver(refparam, ctx, value, 1); @@ -158,24 +139,6 @@ static int get_time_ntpserver5(char *refparam, struct dmctx *ctx, void *data, ch return get_time_ntpserver(refparam, ctx, value, 5); } -static int set_time_source_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - char *iface = NULL; - - switch (action) { - case VALUECHECK: - adm_entry_get_linker_value(ctx, value, &iface); - if (iface == NULL || iface[0] == '\0') - return FAULT_9007; - break; - case VALUESET: - adm_entry_get_linker_value(ctx, value, &iface); - dmuci_set_value("system", "ntp", "interface", iface); - return 0; - } - return 0; -} - static int set_time_ntpserver(char *refparam, struct dmctx *ctx, int action, char *value, int index) { struct uci_list *v; @@ -256,7 +219,5 @@ DMLEAF tTimeParams[] = { {"NTPServer5", &DMWRITE, DMT_STRING, get_time_ntpserver5, set_time_ntpserver5, BBFDM_BOTH}, {"CurrentLocalTime", &DMREAD, DMT_TIME, get_time_CurrentLocalTime, NULL, BBFDM_BOTH}, {"LocalTimeZone", &DMWRITE, DMT_STRING, get_time_LocalTimeZone, set_time_LocalTimeZone, BBFDM_BOTH}, -{CUSTOM_PREFIX"LocalTimeZoneName", &DMREAD, DMT_STRING, get_local_time_zone_name, NULL, BBFDM_BOTH}, -{CUSTOM_PREFIX"SourceInterface", &DMWRITE, DMT_STRING, get_time_source_interface, set_time_source_interface, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/upnp.c b/dmtree/tr181/upnp.c index 35225b88..6c4eb82c 100644 --- a/dmtree/tr181/upnp.c +++ b/dmtree/tr181/upnp.c @@ -382,13 +382,6 @@ static int set_UPnPDevice_Enable(char *refparam, struct dmctx *ctx, void *data, return 0; } -static int get_upnp_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - pid_t pid = get_pid("miniupnpd"); - *value = (pid < 0) ? "Down" : "Up"; - return 0; -} - static int get_UPnPDevice_UPnPMediaServer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { char *path = "/etc/rc.d/*minidlna"; @@ -798,24 +791,23 @@ static int get_UPnPDescriptionServiceInstance_EventSubURL(char *refparam, struct /* *** Device.UPnP. *** */ DMOBJ tUPnPObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Device", &DMREAD, NULL, NULL, NULL, NULL, NULL, tUPnPDeviceObj, tUPnPDeviceParams, NULL, BBFDM_BOTH}, -{"Discovery", &DMREAD, NULL, NULL, NULL, NULL, NULL, tUPnPDiscoveryObj, tUPnPDiscoveryParams, NULL, BBFDM_BOTH}, -{"Description", &DMREAD, NULL, NULL, NULL, NULL, NULL, tUPnPDescriptionObj, tUPnPDescriptionParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Device", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tUPnPDeviceObj, tUPnPDeviceParams, NULL, BBFDM_BOTH}, +{"Discovery", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tUPnPDiscoveryObj, tUPnPDiscoveryParams, NULL, BBFDM_BOTH}, +{"Description", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tUPnPDescriptionObj, tUPnPDescriptionParams, NULL, BBFDM_BOTH}, {0} }; /* *** Device.UPnP.Device. *** */ DMOBJ tUPnPDeviceObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Capabilities", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tUPnPDeviceCapabilitiesParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Capabilities", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tUPnPDeviceCapabilitiesParams, NULL, BBFDM_BOTH}, {0} }; DMLEAF tUPnPDeviceParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ {"Enable", &DMWRITE, DMT_BOOL, get_UPnPDevice_Enable, set_UPnPDevice_Enable, BBFDM_BOTH}, -{CUSTOM_PREFIX"Status", &DMREAD, DMT_STRING, get_upnp_status, NULL, BBFDM_BOTH}, {"UPnPMediaServer", &DMWRITE, DMT_BOOL, get_UPnPDevice_UPnPMediaServer, set_UPnPDevice_UPnPMediaServer, BBFDM_BOTH}, //{"UPnPMediaRenderer", &DMWRITE, DMT_BOOL, get_UPnPDevice_UPnPMediaRenderer, set_UPnPDevice_UPnPMediaRenderer, BBFDM_BOTH}, //{"UPnPWLANAccessPoint", &DMWRITE, DMT_BOOL, get_UPnPDevice_UPnPWLANAccessPoint, set_UPnPDevice_UPnPWLANAccessPoint, BBFDM_BOTH}, @@ -848,10 +840,10 @@ DMLEAF tUPnPDeviceCapabilitiesParams[] = { /* *** Device.UPnP.Discovery. *** */ DMOBJ tUPnPDiscoveryObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"RootDevice", &DMREAD, NULL, NULL, NULL, browseUPnPDiscoveryRootDeviceInst, NULL, NULL, tUPnPDiscoveryRootDeviceParams, get_root_device_linker, BBFDM_BOTH, LIST_KEY{"UUID", NULL}}, -{"Device", &DMREAD, NULL, NULL, NULL, browseUPnPDiscoveryDeviceInst, NULL, NULL, tUPnPDiscoveryDeviceParams, get_device_linker, BBFDM_BOTH, LIST_KEY{"UUID", NULL}}, -{"Service", &DMREAD, NULL, NULL, NULL, browseUPnPDiscoveryServiceInst, NULL, NULL, tUPnPDiscoveryServiceParams, get_service_linker, BBFDM_BOTH, LIST_KEY{"USN", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"RootDevice", &DMREAD, NULL, NULL, NULL, browseUPnPDiscoveryRootDeviceInst, NULL, NULL, NULL, tUPnPDiscoveryRootDeviceParams, get_root_device_linker, BBFDM_BOTH, LIST_KEY{"UUID", NULL}}, +{"Device", &DMREAD, NULL, NULL, NULL, browseUPnPDiscoveryDeviceInst, NULL, NULL, NULL, tUPnPDiscoveryDeviceParams, get_device_linker, BBFDM_BOTH, LIST_KEY{"UUID", NULL}}, +{"Service", &DMREAD, NULL, NULL, NULL, browseUPnPDiscoveryServiceInst, NULL, NULL, NULL, tUPnPDiscoveryServiceParams, get_service_linker, BBFDM_BOTH, LIST_KEY{"USN", NULL}}, {0} }; @@ -907,10 +899,10 @@ DMLEAF tUPnPDiscoveryServiceParams[] = { /* *** Device.UPnP.Description. *** */ DMOBJ tUPnPDescriptionObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"DeviceDescription", &DMREAD, NULL, NULL, NULL, browseUPnPDescriptionDeviceDescriptionInst, NULL, NULL, tUPnPDescriptionDeviceDescriptionParams, NULL, BBFDM_BOTH, LIST_KEY{"URLBase", NULL}}, -{"DeviceInstance", &DMREAD, NULL, NULL, NULL, browseUPnPDescriptionDeviceInstanceInst, NULL, NULL, tUPnPDescriptionDeviceInstanceParams, get_device_instance_linker, BBFDM_BOTH, LIST_KEY{"UDN", NULL}}, -{"ServiceInstance", &DMREAD, NULL, NULL, NULL, browseUPnPDescriptionServiceInstanceInst, NULL, NULL, tUPnPDescriptionServiceInstanceParams, NULL, BBFDM_BOTH, LIST_KEY{"ParentDevice", "ServiceId", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"DeviceDescription", &DMREAD, NULL, NULL, NULL, browseUPnPDescriptionDeviceDescriptionInst, NULL, NULL, NULL, tUPnPDescriptionDeviceDescriptionParams, NULL, BBFDM_BOTH, LIST_KEY{"URLBase", NULL}}, +{"DeviceInstance", &DMREAD, NULL, NULL, NULL, browseUPnPDescriptionDeviceInstanceInst, NULL, NULL, NULL, tUPnPDescriptionDeviceInstanceParams, get_device_instance_linker, BBFDM_BOTH, LIST_KEY{"UDN", NULL}}, +{"ServiceInstance", &DMREAD, NULL, NULL, NULL, browseUPnPDescriptionServiceInstanceInst, NULL, NULL, NULL, tUPnPDescriptionServiceInstanceParams, NULL, BBFDM_BOTH, LIST_KEY{"ParentDevice", "ServiceId", NULL}}, {0} }; diff --git a/dmtree/tr181/usb.c b/dmtree/tr181/usb.c index 9fe51624..90a48fde 100644 --- a/dmtree/tr181/usb.c +++ b/dmtree/tr181/usb.c @@ -1089,10 +1089,10 @@ static int get_linker_usb_host_device(char *refparam, struct dmctx *dmctx, void /* *** Device.USB. *** */ DMOBJ tUSBObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Interface", &DMREAD, NULL, NULL, NULL, browseUSBInterfaceInst, NULL, tUSBInterfaceObj, tUSBInterfaceParams, NULL, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, -{"Port", &DMREAD, NULL, NULL, NULL, browseUSBPortInst, NULL, NULL, tUSBPortParams, get_linker_usb_port, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, -{"USBHosts", &DMREAD, NULL, NULL, NULL, NULL, NULL, tUSBUSBHostsObj, tUSBUSBHostsParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Interface", &DMREAD, NULL, NULL, NULL, browseUSBInterfaceInst, NULL, NULL, tUSBInterfaceObj, tUSBInterfaceParams, NULL, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, +{"Port", &DMREAD, NULL, NULL, NULL, browseUSBPortInst, NULL, NULL, NULL, tUSBPortParams, get_linker_usb_port, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, +{"USBHosts", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tUSBUSBHostsObj, tUSBUSBHostsParams, NULL, BBFDM_BOTH}, {0} }; @@ -1105,8 +1105,8 @@ DMLEAF tUSBParams[] = { /* *** Device.USB.Interface.{i}. *** */ DMOBJ tUSBInterfaceObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tUSBInterfaceStatsParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tUSBInterfaceStatsParams, NULL, BBFDM_BOTH}, {0} }; @@ -1161,8 +1161,8 @@ DMLEAF tUSBPortParams[] = { /* *** Device.USB.USBHosts. *** */ DMOBJ tUSBUSBHostsObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Host", &DMREAD, NULL, NULL, NULL, browseUSBUSBHostsHostInst, NULL, tUSBUSBHostsHostObj, tUSBUSBHostsHostParams, NULL, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Host", &DMREAD, NULL, NULL, NULL, browseUSBUSBHostsHostInst, NULL, NULL, tUSBUSBHostsHostObj, tUSBUSBHostsHostParams, NULL, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, {0} }; @@ -1174,8 +1174,8 @@ DMLEAF tUSBUSBHostsParams[] = { /* *** Device.USB.USBHosts.Host.{i}. *** */ DMOBJ tUSBUSBHostsHostObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Device", &DMREAD, NULL, NULL, NULL, browseUSBUSBHostsHostDeviceInst, NULL, tUSBUSBHostsHostDeviceObj, tUSBUSBHostsHostDeviceParams, get_linker_usb_host_device, BBFDM_BOTH, LIST_KEY{"DeviceNumber", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Device", &DMREAD, NULL, NULL, NULL, browseUSBUSBHostsHostDeviceInst, NULL, NULL, tUSBUSBHostsHostDeviceObj, tUSBUSBHostsHostDeviceParams, get_linker_usb_host_device, BBFDM_BOTH, LIST_KEY{"DeviceNumber", NULL}}, {0} }; @@ -1194,8 +1194,8 @@ DMLEAF tUSBUSBHostsHostParams[] = { /* *** Device.USB.USBHosts.Host.{i}.Device.{i}. *** */ DMOBJ tUSBUSBHostsHostDeviceObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Configuration", &DMREAD, NULL, NULL, NULL, browseUSBUSBHostsHostDeviceConfigurationInst, NULL, tUSBUSBHostsHostDeviceConfigurationObj, tUSBUSBHostsHostDeviceConfigurationParams, NULL, BBFDM_BOTH, LIST_KEY{"ConfigurationNumber", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Configuration", &DMREAD, NULL, NULL, NULL, browseUSBUSBHostsHostDeviceConfigurationInst, NULL, NULL, tUSBUSBHostsHostDeviceConfigurationObj, tUSBUSBHostsHostDeviceConfigurationParams, NULL, BBFDM_BOTH, LIST_KEY{"ConfigurationNumber", NULL}}, {0} }; @@ -1225,8 +1225,8 @@ DMLEAF tUSBUSBHostsHostDeviceParams[] = { /* *** Device.USB.USBHosts.Host.{i}.Device.{i}.Configuration.{i}. *** */ DMOBJ tUSBUSBHostsHostDeviceConfigurationObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Interface", &DMREAD, NULL, NULL, NULL, browseUSBUSBHostsHostDeviceConfigurationInterfaceInst, NULL, NULL, tUSBUSBHostsHostDeviceConfigurationInterfaceParams, NULL, BBFDM_BOTH, LIST_KEY{"InterfaceNumber", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Interface", &DMREAD, NULL, NULL, NULL, browseUSBUSBHostsHostDeviceConfigurationInterfaceInst, NULL, NULL, NULL, tUSBUSBHostsHostDeviceConfigurationInterfaceParams, NULL, BBFDM_BOTH, LIST_KEY{"InterfaceNumber", NULL}}, {0} }; diff --git a/dmtree/tr181/users.c b/dmtree/tr181/users.c index 5f04b070..3732f972 100644 --- a/dmtree/tr181/users.c +++ b/dmtree/tr181/users.c @@ -256,8 +256,8 @@ static int set_user_language(char *refparam, struct dmctx *ctx, void *data, char /* *** Device.Users. *** */ DMOBJ tUsersObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"User", &DMWRITE, add_users_user, delete_users_user, NULL, browseUserInst, NULL, NULL, tUsersUserParams, NULL, BBFDM_BOTH, LIST_KEY{"Username", "Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"User", &DMWRITE, add_users_user, delete_users_user, NULL, browseUserInst, NULL, NULL, NULL, tUsersUserParams, NULL, BBFDM_BOTH, LIST_KEY{"Username", "Alias", NULL}}, {0} }; diff --git a/dmtree/tr181/wifi-iopsyswrt.c b/dmtree/tr181/wifi-iopsyswrt.c deleted file mode 100644 index 593b8823..00000000 --- a/dmtree/tr181/wifi-iopsyswrt.c +++ /dev/null @@ -1,1929 +0,0 @@ -/* - * Copyright (C) 2020 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 Ramdhane - * Author: Saurabh Verma - * - */ - -#include "os.h" - -/*#Device.WiFi.SSID.{i}.BSSID!UBUS:wifi.ap.@Name/status//bssid*/ -int os__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", ((struct wifi_ssid_args *)data)->ifname); - dmubus_call(object, "status", UBUS_ARGS{}, 0, &res); - DM_ASSERT(res, *value = ""); - *value = dmjson_get_value(res, 1, "bssid"); - return 0; -} - -static int ssid_read_ubus(const struct wifi_ssid_args *args, const char *name, char **value) -{ - json_object *res = NULL; - char object[32]; - - snprintf(object, sizeof(object), "wifi.ap.%s", args->ifname); - dmubus_call(object, "stats", UBUS_ARGS{}, 0, &res); - DM_ASSERT(res, *value = "0"); - *value = dmjson_get_value(res, 1, name); - return 0; -} - -static int radio_read_ubus(const struct wifi_radio_args *args, const char *name, char **value) -{ - json_object *res = NULL; - char object[32]; - - snprintf(object, sizeof(object), "wifi.radio.%s", section_name(args->wifi_radio_sec)); - dmubus_call(object, "stats", UBUS_ARGS{}, 0, &res); - DM_ASSERT(res, *value = "0"); - *value = dmjson_get_value(res, 1, name); - return 0; -} - -/*#Device.WiFi.Radio.{i}.Stats.BytesSent!UBUS:wifi.radio.@Name/stats//tx_bytes*/ -int os__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*/ -int os__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*/ -int os__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*/ -int os__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*/ -int os__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*/ -int os__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*/ -int os__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*/ -int os__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*/ -int os__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*/ -int os__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*/ -int os__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*/ -int os__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*/ -int os__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*/ -int os__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*/ -int os__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*/ -int os__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*/ -int os__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*/ -int os__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*/ -int os__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*/ -int os__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*/ -int os__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*/ -int os__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*/ -int os__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*/ -int os__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*/ -int os__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*/ -int os__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*/ -int os__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*/ -int os__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*/ -int os__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*/ -int os__get_WiFiSSIDStats_UnknownProtoPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return ssid_read_ubus(data, "rx_unknown_packets", value); -} - -int os__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*/ -int os__get_WiFiAccessPointAssociatedDevice_Noise(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "noise"); - return 0; -} - -/*#Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}.MACAddress!UBUS:wifi.ap.@Name/stations//stations[i-1].macaddr*/ -int os__get_WiFiAccessPointAssociatedDevice_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "macaddr"); - return 0; -} - -/*#Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}.LastDataDownlinkRate!UBUS:wifi.ap.@Name/stations//stations[i-1].stats.rx_rate_latest.rate*/ -int os__get_WiFiAccessPointAssociatedDevice_LastDataDownlinkRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *rate_mbps = dmjson_get_value((json_object *)data, 3, "stats", "rx_rate_latest", "rate"); - unsigned int rate_kbps = (rate_mbps && *rate_mbps != '\0') ? atoi(rate_mbps) * 1000 : 1000; - - dmasprintf(value, "%u", rate_kbps); - return 0; -} - -/*#Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}.LastDataUplinkRate!UBUS:wifi.ap.@Name/stations//stations[i-1].stats.tx_rate_latest.rate*/ -int os__get_WiFiAccessPointAssociatedDevice_LastDataUplinkRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *rate_mbps = dmjson_get_value((json_object *)data, 3, "stats", "tx_rate_latest", "rate"); - unsigned int rate_kbps = (rate_mbps && *rate_mbps != '\0') ? atoi(rate_mbps) * 1000 : 1000; - - dmasprintf(value, "%u", rate_kbps); - return 0; -} - -/*#Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}.SignalStrength!UBUS:wifi.ap.@Name/stations//stations[i-1].rssi*/ -int os__get_WiFiAccessPointAssociatedDevice_SignalStrength(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "rssi"); - return 0; -} - -/*#Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}.AssociationTime!UBUS:wifi.ap.@Name/stations//stations[i-1].in_network*/ -int os__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((json_object *)data, 1, "in_network"); - if (in_network && *in_network != '\0' && atoi(in_network) > 0) { - time_t t_time = time(NULL) - atoi(in_network); - if (localtime(&t_time) == NULL) - return -1; - - char local_time[32] = {0}; - - if (strftime(local_time, sizeof(local_time), "%Y-%m-%dT%H:%M:%SZ", localtime(&t_time)) == 0) - return -1; - - *value = dmstrdup(local_time); - } - return 0; -} - -/*#Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}.Stats.BytesSent!UBUS:wifi.ap.@Name/stations//stations[i-1].stats.tx_total_bytes*/ -int os__get_access_point_associative_device_statistics_tx_bytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 2, "stats", "tx_total_bytes"); - return 0; -} - -/*#Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}.Stats.BytesReceived!UBUS:wifi.ap.@Name/stations//stations[i-1].stats.rx_data_bytes*/ -int os__get_access_point_associative_device_statistics_rx_bytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 2, "stats", "rx_data_bytes"); - return 0; -} - -/*#Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}.Stats.PacketsSent!UBUS:wifi.ap.@Name/stations//stations[i-1].stats.tx_total_pkts*/ -int os__get_access_point_associative_device_statistics_tx_packets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 2, "stats", "tx_total_pkts"); - return 0; -} - -/*#Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}.Stats.PacketsReceived!UBUS:wifi.ap.@Name/stations//stations[i-1].stats.rx_data_pkts*/ -int os__get_access_point_associative_device_statistics_rx_packets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 2, "stats", "rx_data_pkts"); - return 0; -} - -/*#Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}.Stats.ErrorsSent!UBUS:wifi.ap.@Name/stations//stations[i-1].stats.tx_failures*/ -int os__get_access_point_associative_device_statistics_tx_errors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 2, "stats", "tx_failures"); - return 0; -} - -/*#Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}.Stats.RetransCount!UBUS:wifi.ap.@Name/stations//stations[i-1].stats.tx_pkts_retries*/ -int os__get_access_point_associative_device_statistics_retrans_count(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 2, "stats", "tx_pkts_retries"); - return 0; -} - - -/*#Device.WiFi.AccessPoint.{i}.Status!UBUS:wifi.ap.@Name/status//status*/ -int os_get_wifi_access_point_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *res; - char object[32], *status = NULL, *iface; - - dmuci_get_value_by_section_string(((struct wifi_ssid_args *)data)->wifi_ssid_sec, "device", &iface); - snprintf(object, sizeof(object), "wifi.ap.%s", iface); - dmubus_call(object, "status", UBUS_ARGS{}, 0, &res); - DM_ASSERT(res, status = "Error_Misconfigured"); - status = dmjson_get_value(res, 1, "status"); - - if (strcmp(status, "running") == 0 || strcmp(status, "up") == 0) - *value = "Enabled"; - else - *value = "Disabled"; - return 0; -} - -/*#Device.WiFi.Radio.{i}.MaxBitRate!UBUS:wifi.radio.@Name/status//maxrate*/ -int os__get_radio_max_bit_rate (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 wifi_radio_args *)data)->wifi_radio_sec)); - dmubus_call(object, "status", UBUS_ARGS{}, 0, &res); - DM_ASSERT(res, *value = "0"); - *value = dmjson_get_value(res, 1, "maxrate"); - return 0; -} - -/*#Device.WiFi.Radio.{i}.OperatingFrequencyBand!UBUS:wifi.radio.@Name/status//band*/ -int os__get_radio_frequency(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 wifi_radio_args *)data)->wifi_radio_sec)); - dmubus_call(object, "status", UBUS_ARGS{}, 0, &res); - DM_ASSERT(res, *value = ""); - *value = dmjson_get_value(res, 1, "band"); - return 0; -} - -/*#Device.WiFi.Radio.{i}.SupportedFrequencyBands!UBUS:wifi.radio.@Name/status//supp_bands*/ -int os__get_radio_supported_frequency_bands(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 wifi_radio_args *)data)->wifi_radio_sec)); - dmubus_call(object, "status", UBUS_ARGS{}, 0, &res); - DM_ASSERT(res, *value = "2.4GHz,5GHz"); - *value = dmjson_get_value_array_all(res, ",", 1, "supp_bands"); - return 0; -} - -/*#Device.WiFi.Radio.{i}.ChannelsInUse!UCI:wireless/wifi-device,@i-1/channel*/ -int os__get_radio_channel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *res = NULL; - - dmuci_get_value_by_section_string(((struct wifi_radio_args *)data)->wifi_radio_sec, "channel", value); - if (strcmp(*value, "auto") == 0 || (*value)[0] == '\0') { - char object[32]; - snprintf(object, sizeof(object), "wifi.radio.%s", section_name(((struct wifi_radio_args *)data)->wifi_radio_sec)); - dmubus_call(object, "status", UBUS_ARGS{}, 0, &res); - DM_ASSERT(res, *value = "1"); - *value = dmjson_get_value(res, 1, "channel"); - } - return 0; -} - -char * os__get_radio_channel_nocache(const struct wifi_radio_args *args) -{ - char object[32]; - char *value = ""; - json_object *res; - - snprintf(object, sizeof(object), "wifi.radio.%s", section_name(args->wifi_radio_sec)); - dmubus_call(object, "status", UBUS_ARGS{}, 0, &res); - if (res) - value = dmjson_get_value(res, 1, "channel"); - - return value; -} - -char * os__get_radio_frequency_nocache(const struct wifi_radio_args *args) -{ - char object[32]; - json_object *res; - char *freq = ""; - - snprintf(object, sizeof(object), "wifi.radio.%s", section_name(args->wifi_radio_sec)); - dmubus_call(object, "status", UBUS_ARGS{}, 0, &res); - if (res) - freq = dmjson_get_value(res, 1, "band"); - - return freq; -} - -int os__get_neighboring_wifi_diagnostics_diagnostics_state(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct uci_section *ss = NULL; - json_object *res = NULL, *neighboring_wifi_obj = NULL; - char object[32]; - - *value = "None"; - uci_foreach_sections("wireless", "wifi-device", ss) { - snprintf(object, sizeof(object), "wifi.radio.%s", section_name(ss)); - dmubus_call(object, "scanresults", UBUS_ARGS{}, 0, &res); - DM_ASSERT(res, *value = "None"); - neighboring_wifi_obj = dmjson_select_obj_in_array_idx(res, 0, 1, "accesspoints"); - if (neighboring_wifi_obj) { - *value = "Complete"; - break; - } else - *value = "None"; - } - return 0; -} - -int os__get_neighboring_wifi_diagnostics_result_number_entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct uci_section *ss = NULL; - json_object *res = NULL, *accesspoints = NULL; - size_t entries = 0, result = 0; - char object[32]; - *value = "0"; - - uci_foreach_sections("wireless", "wifi-device", ss) { - snprintf(object, sizeof(object), "wifi.radio.%s", section_name(ss)); - dmubus_call(object, "scanresults", UBUS_ARGS{}, 0, &res); - if (res) { - json_object_object_get_ex(res, "accesspoints", &accesspoints); - entries = (accesspoints) ? json_object_array_length(accesspoints) : 0; - } - result = result + entries; - entries = 0; - } - dmasprintf(value, "%d", result); // MEM WILL BE FREED IN DMMEMCLEAN - return 0; -} - -void os__wifi_start_scan(const char *radio) -{ - char object[32]; - - snprintf(object, sizeof(object), "wifi.radio.%s", radio); - dmubus_call_set(object, "scan", UBUS_ARGS{}, 0); -} - -/*#Device.WiFi.NeighboringWiFiDiagnostic.Result.{i}.SSID!UBUS:wifi.radio.@Name/scanresults//accesspoints[@i-1].ssid*/ -int os__get_neighboring_wifi_diagnostics_result_ssid(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "ssid"); - return 0; -} - -/*#Device.WiFi.NeighboringWiFiDiagnostic.Result.{i}.BSSID!UBUS:wifi.radio.@Name/scanresults//accesspoints[@i-1].bssid*/ -int os__get_neighboring_wifi_diagnostics_result_bssid(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "bssid"); - return 0; -} - -/*#Device.WiFi.NeighboringWiFiDiagnostic.Result.{i}.Channel!UBUS:wifi.radio.@Name/scanresults//accesspoints[@i-1].channel*/ -int os__get_neighboring_wifi_diagnostics_result_channel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "channel"); - return 0; -} - -/*#Device.WiFi.NeighboringWiFiDiagnostic.Result.{i}.SignalStrength!UBUS:wifi.radio.@Name/scanresults//accesspoints[@i-1].rssi*/ -int os__get_neighboring_wifi_diagnostics_result_signal_strength(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "rssi"); - return 0; -} - -/*#Device.WiFi.NeighboringWiFiDiagnostic.Result.{i}.OperatingFrequencyBand!UBUS:wifi.radio.@Name/scanresults//accesspoints[@i-1].band*/ -int os__get_neighboring_wifi_diagnostics_result_operating_frequency_band(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "band"); - return 0; -} - -/*#Device.WiFi.NeighboringWiFiDiagnostic.Result.{i}.Noise!UBUS:wifi.radio.@Name/scanresults//accesspoints[@i-1].noise*/ -int os__get_neighboring_wifi_diagnostics_result_noise(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "noise"); - return 0; -} - -/*#Device.WiFi.Radio.{i}.PossibleChannels!UBUS:wifi.radio.@Name/status//supp_channels[0].channels*/ -int os__get_radio_possible_channels(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *res = NULL, *supp_channels = NULL, *arrobj = NULL; - char object[32], *cur_opclass = NULL; - int i = 0; - - snprintf(object, sizeof(object), "wifi.radio.%s", section_name(((struct wifi_radio_args *)data)->wifi_radio_sec)); - dmubus_call(object, "status", UBUS_ARGS{}, 0, &res); - DM_ASSERT(res, *value = ""); - cur_opclass = dmjson_get_value(res, 1, "opclass"); - dmjson_foreach_obj_in_array(res, arrobj, supp_channels, i, 1, "supp_channels") { - char *opclass = dmjson_get_value(supp_channels, 1, "opclass"); - if (opclass && strcmp(opclass, cur_opclass) != 0) - continue; - - *value = dmjson_get_value_array_all(supp_channels, ",", 1, "channels"); - break; - } - return 0; -} - -/*#Device.WiFi.Radio.{i}.SupportedOperatingChannelBandwidths!UBUS:wifi.radio.@Name/status//supp_channels[0].bandwidth*/ -int os__get_WiFiRadio_SupportedOperatingChannelBandwidths(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *res = NULL, *supp_channels = NULL, *arrobj = NULL; - char object[32], *bandwidth = NULL, *bandwidth_list = ""; - int i = 0; - - snprintf(object, sizeof(object), "wifi.radio.%s", section_name(((struct wifi_radio_args *)data)->wifi_radio_sec)); - dmubus_call(object, "status", UBUS_ARGS{}, 0, &res); - DM_ASSERT(res, *value = "Auto"); - dmjson_foreach_obj_in_array(res, arrobj, supp_channels, i, 1, "supp_channels") { - bandwidth = dmjson_get_value(supp_channels, 1, "bandwidth"); - if (bandwidth && !strstr(bandwidth_list, !strcmp(bandwidth, "8080") ? "80+80" : !strcmp(bandwidth, "80") ? ",80MHz" : bandwidth)) { - if (*bandwidth_list == '\0') - dmasprintf(&bandwidth_list, "%sMHz", !strcmp(bandwidth, "8080") ? "80+80" : bandwidth); - else { - char *tmp = dmstrdup(bandwidth_list); - dmfree(bandwidth_list); - dmasprintf(&bandwidth_list, "%s,%sMHz", tmp, !strcmp(bandwidth, "8080") ? "80+80" : bandwidth); - dmfree(tmp); - } - } - } - *value = bandwidth_list; - return 0; -} - -/*#Device.WiFi.Radio.{i}.CurrentOperatingChannelBandwidth!UBUS:wifi.radio.@Name/status//bandwidth*/ -int os__get_WiFiRadio_CurrentOperatingChannelBandwidth(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *res; - char object[32], *bandwidth = NULL; - - snprintf(object, sizeof(object), "wifi.radio.%s", section_name(((struct wifi_radio_args *)data)->wifi_radio_sec)); - dmubus_call(object, "status", UBUS_ARGS{}, 0, &res); - DM_ASSERT(res, *value = "20MHz"); - bandwidth = dmjson_get_value(res, 1, "bandwidth"); - if (bandwidth) - dmasprintf(value, "%sMHz", bandwidth); - return 0; -} - -/*#Device.WiFi.NeighboringWiFiDiagnostic.Result.{i}.!UBUS:wifi.radio.@Name/scanresults//accesspoints*/ -int os__browseWifiNeighboringWiFiDiagnosticResultInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - struct uci_section *ss = NULL; - json_object *res = NULL, *accesspoints = NULL, *arrobj = NULL; - char object[32], *inst = NULL, *max_inst = NULL; - int id = 0, i = 0; - - uci_foreach_sections("wireless", "wifi-device", ss) { - snprintf(object, sizeof(object), "wifi.radio.%s", section_name(ss)); - dmubus_call(object, "scanresults", UBUS_ARGS{}, 0, &res); - if (res) { - dmjson_foreach_obj_in_array(res, arrobj, accesspoints, i, 1, "accesspoints") { - inst = handle_update_instance(1, dmctx, &max_inst, update_instance_without_section, 1, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)accesspoints, inst) == DM_STOP) - return 0; - } - } - } - return 0; -} - -static int get_radio_standards(struct uci_section *section, char **value) -{ - json_object *res; - char object[32], *standard = NULL; - char **standards = NULL, *str_append = NULL; - int i; - size_t length; - - snprintf(object, sizeof(object), "wifi.radio.%s", section_name(section)); - dmubus_call(object, "status", UBUS_ARGS{}, 0, &res); - DM_ASSERT(res, *value = "n,ax"); - - standard = dmjson_get_value(res, 1, "standard"); - standards = strsplit(standard, "/", &length); - - for (i = 0; i < length; i++) { - if (strstr(standards[i], "802.11") == standards[i]) - str_append = dmstrdup(strstr(standards[i], "802.11") + strlen("802.11")); - else - str_append = dmstrdup(standards[i]); - if (strlen(*value) == 0){ - dmasprintf(value, "%s", str_append); - continue; - } - dmasprintf(value, "%s,%s", *value, str_append); - FREE(str_append); - } - - return 0; -} - -/*#Device.WiFi.Radio.{i}.SupportedStandards!UBUS:wifi.radio.@Name/status//standard*/ -int os__get_radio_supported_standard(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return get_radio_standards(((struct wifi_radio_args *)data)->wifi_radio_sec, value); -} - -/*#Device.WiFi.Radio.{i}.OperatingStandards!UBUS:wifi.radio.@Name/status//standard*/ -int os_get_radio_operating_standard(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return get_radio_standards(((struct wifi_radio_args *)data)->wifi_radio_sec, value); -} - -static char *get_data_model_mode(const char *ubus_mode) -{ - if (strcmp(ubus_mode, "WEP64") == 0) - return "WEP-64"; - else if (strcmp(ubus_mode, "WEP128") == 0) - return "WEP-128"; - else if (strcmp(ubus_mode, "WPAPSK") == 0) - return "WPA-Personal"; - else if (strcmp(ubus_mode, "WPA2PSK") == 0) - return "WPA2-Personal"; - else if (strcmp(ubus_mode, "WPA3PSK") == 0) - return "WPA3-Personal"; - else if (strcmp(ubus_mode, "WPAPSK+WPA2PSK") == 0) - return "WPA-WPA2-Personal"; - else if (strcmp(ubus_mode, "WPA2PSK+WPA3PSK") == 0) - return "WPA3-Personal-Transition"; - else if (strcmp(ubus_mode, "WPA") == 0) - return "WPA-Enterprise"; - else if (strcmp(ubus_mode, "WPA2") == 0) - return "WPA2-Enterprise"; - else if (strcmp(ubus_mode, "WPA3") == 0) - return "WPA3-Enterprise"; - else if (strcmp(ubus_mode, "WPA+WPA2") == 0) - return "WPA-WPA2-Enterprise"; - else - return "None"; -} - -int os_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, &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 (!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; -} - -int os__get_access_point_total_associations(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *res = NULL, *assoclist = NULL, *arrobj = NULL; - char object[32]; - int i = 0, entries = 0; - - snprintf(object, sizeof(object), "wifi.ap.%s", ((struct wifi_acp_args *)data)->ifname); - dmubus_call(object, "assoclist", UBUS_ARGS{}, 0, &res); - dmjson_foreach_obj_in_array(res, arrobj, assoclist, i, 1, "assoclist") { - entries++; - } - dmasprintf(value, "%d", entries); - return 0; -} - -int os__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, *max_inst = NULL; - int id = 0, i = 0; - - snprintf(object, sizeof(object), "wifi.ap.%s", ((struct wifi_acp_args *)prev_data)->ifname); - dmubus_call(object, "stations", UBUS_ARGS{}, 0, &res); - dmjson_foreach_obj_in_array(res, arrobj, stations, i, 1, "stations") { - inst = handle_update_instance(2, dmctx, &max_inst, update_instance_without_section, 1, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)stations, inst) == DM_STOP) - return 0; - } - return 0; -} - -char * os__get_default_wpa_key() -{ - char *wpakey; - db_get_value_string("hw", "board", "wpa_key", &wpakey); - return wpakey; -} - -/************************************************************************** - * *** Device.WiFi.DataElements. *** * - ***************************************************************************/ -static int os__get_WiFiDataElementsNetwork_option(const char *option, char **value) -{ - int i = 0; - json_object *res, *data_arr = NULL, *data_obj = NULL, *net_obj = NULL; - - dmubus_call("wifi.dataelements.collector", "dump", UBUS_ARGS{}, 0, &res); - DM_ASSERT(res, *value = ""); - dmjson_foreach_obj_in_array(res, data_arr, data_obj, i, 1, "data") { - json_object_object_get_ex(data_obj, "wfa-dataelements:Network", &net_obj); - *value = dmjson_get_value(net_obj, 1, option); - } - return 0; -} - -/*#Device.WiFi.DataElements.Network.ID!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.ID*/ -int os__get_WiFiDataElementsNetwork_ID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return os__get_WiFiDataElementsNetwork_option("ID", value); -} - -int os__set_WiFiDataElementsNetwork_ID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, -1, NULL, NULL)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -/*#Device.WiFi.DataElements.Network.TimeStamp!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.TimeStamp*/ -int os__get_WiFiDataElementsNetwork_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return os__get_WiFiDataElementsNetwork_option("TimeStamp", value); -} - -/*#Device.WiFi.DataElements.Network.ControllerID!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.ControllerID*/ -int os__get_WiFiDataElementsNetwork_ControllerID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return os__get_WiFiDataElementsNetwork_option("ControllerID", value); -} - -int os__set_WiFiDataElementsNetwork_ControllerID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, -1, NULL, NULL)) - return FAULT_9007; - break; - case VALUESET: - //TODO - break; - } - return 0; -} - -/*#Device.WiFi.DataElements.Network.DeviceNumberOfEntries!UBUS:wifi.dataelements.collector/dump//data[@i-1].wfa-dataelements:Network.NumberOfDevices*/ -int os__get_WiFiDataElementsNetwork_DeviceNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - int i = 0; - json_object *res, *data_arr = NULL, *data_obj = NULL, *net_obj = NULL; - - dmubus_call("wifi.dataelements.collector", "dump", UBUS_ARGS{}, 0, &res); - DM_ASSERT(res, *value = "0"); - dmjson_foreach_obj_in_array(res, data_arr, data_obj, i, 1, "data") { - json_object_object_get_ex(data_obj, "wfa-dataelements:Network", &net_obj); - *value = dmjson_get_value(net_obj, 1, "NumberOfDevices"); - } - return 0; -} - -/*#Device.WiFi.DataElements.Network.Device.{i}.ID!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].ID*/ -int os__get_WiFiDataElementsNetworkDevice_ID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "ID"); - return 0; -} - -#if 0 -int os__get_WiFiDataElementsNetworkDevice_MultiAPCapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - //TODO - return 0; -} -#endif - -/*#Device.WiFi.DataElements.Network.Device.{i}.CollectionInterval!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].CollectionInterval*/ -int os__get_WiFiDataElementsNetworkDevice_CollectionInterval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "CollectionInterval"); - return 0; -} - -/*#Device.WiFi.DataElements.Network.Device.{i}.RadioNumberOfEntries!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].NumberOfRadios*/ -int os__get_WiFiDataElementsNetworkDevice_RadioNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "NumberOfRadios"); - 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadio_ID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadio_Enabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadio_Noise(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadio_Utilization(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadio_Transmit(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadio_ReceiveSelf(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadio_ReceiveOther(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "RecieveOther"); - 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadio_CurrentOperatingClassProfileNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "NumberOfCurrOpClass"); - return 0; -} - -/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.UnassociatedSTANumberOfEntries!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].NumberOfUnassocSta*/ -int os__get_WiFiDataElementsNetworkDeviceRadio_UnassociatedSTANumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "NumberOfUnassocSta"); - 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadio_BSSNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "NumberOfBSS"); - 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadio_ScanResultNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - int num_scanres = 0; - json_object *scanres_arr = NULL; - - json_object_object_get_ex((json_object *)data, "ScanResultList", &scanres_arr); - num_scanres = (scanres_arr) ? json_object_array_length(scanres_arr) : 0; - - dmasprintf(value, "%d", num_scanres); - 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBackhaulSta_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *backsta_obj = NULL; - - if (data) { - json_object_object_get_ex((json_object *)data, "BackhaulSta", &backsta_obj); - *value = (backsta_obj) ? dmjson_get_value(backsta_obj, 1, "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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioCapabilities_HTCapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *caps_obj = NULL; - - json_object_object_get_ex((json_object *)data, "Capabilites", &caps_obj); - *value = (caps_obj) ? dmjson_get_value(caps_obj, 1, "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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioCapabilities_VHTCapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *caps_obj = NULL; - - json_object_object_get_ex((json_object *)data, "Capabilites", &caps_obj); - *value = (caps_obj) ? dmjson_get_value(caps_obj, 1, "VHTCapabilities") : ""; - - return 0; -} - -/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.Capabilities.HECapabilities!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].Capabilites.HECapabilities*/ -int os__get_WiFiDataElementsNetworkDeviceRadioCapabilities_HECapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *caps_obj = NULL; - - json_object_object_get_ex((json_object *)data, "Capabilites", &caps_obj); - *value = (caps_obj) ? dmjson_get_value(caps_obj, 1, "HECapabilities") : ""; - - 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioCapabilities_CapableOperatingClassProfileNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *caps_obj = NULL; - - json_object_object_get_ex((json_object *)data, "Capabilites", &caps_obj); - *value = (caps_obj) ? dmjson_get_value(caps_obj, 1, "NumberOfOpClass") : "0"; - - 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfile_Class(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfile_MaxTxPower(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfile_NonOperable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfile_NumberOfNonOperChan(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_Class(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_Channel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_TxPower(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "TxPower"); - 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "TimeStamp"); - return 0; -} - -/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.BSSID!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].BSSID*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_BSSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "BSSID"); - return 0; -} - -/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.SSID!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].SSID*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_SSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "SSID"); - return 0; -} - -/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.Enabled!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].Enabled*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_Enabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "Enabled"); - return 0; -} - -/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.LastChange!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].LastChange*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_LastChange(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "LastChange"); - return 0; -} - -/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.TimeStamp!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].TimeStamp*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "TimeStamp"); - return 0; -} - -/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.UnicastBytesSent!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].UnicastBytesSent*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_UnicastBytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "UnicastBytesSent"); - return 0; -} - -/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.UnicastBytesReceived!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].UnicastBytesReceived*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_UnicastBytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "UnicastBytesReceived"); - return 0; -} - -/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.MulticastBytesSent!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].MulticastBytesSent*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_MulticastBytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "MulticastBytesSent"); - return 0; -} - -/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.MulticastBytesReceived!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].MulticastBytesReceived*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_MulticastBytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "MulticastBytesReceived"); - return 0; -} - -/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.BroadcastBytesSent!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].BroadcastBytesSent*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_BroadcastBytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "BroadcastBytesSent"); - return 0; -} - -/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.BroadcastBytesReceived!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].BroadcastBytesReceived*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_BroadcastBytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "BroadcastBytesReceived"); - 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_EstServiceParametersBE(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "EstServiceParametersBE"); - return 0; -} - -/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.EstServiceParametersBK!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].EstServiceParametersBK*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_EstServiceParametersBK(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "EstServiceParametersBK"); - return 0; -} - -/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.EstServiceParametersVI!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].EstServiceParametersVI*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_EstServiceParametersVI(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "EstServiceParametersVI"); - return 0; -} - -/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.EstServiceParametersVO!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].EstServiceParametersVO*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_EstServiceParametersVO(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "EstServiceParametersVO"); - return 0; -} - -/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STANumberOfEntries!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].NumberofSTA*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_STANumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "NumberofSTA"); - 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_HTCapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_VHTCapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_HECapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_LastDataDownlinkRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_LastDataUplinkRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_UtilizationReceive(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_UtilizationTransmit(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_EstMACDataRateDownlink(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_EstMACDataRateUplink(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_SignalStrength(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_LastConnectTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_ErrorsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_ErrorsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "ErrorsReceived"); - return 0; -} - -#if 0 -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_RetransCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - //TODO - return 0; -} -#endif - -/*#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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_MeasurementReport(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_NumberOfMeasureReports(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "NumberOfMeasureReports"); - return 0; -} - -#if 0 -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_IPV4Address(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - //TODO - return 0; -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_IPV6Address(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - //TODO - return 0; -} -#endif - -/*#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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_Hostname(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "Hostname"); - 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioScanResult_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioScanResult_OpClassScanNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "NumberOfOpClassScans"); - 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScan_OperatingClass(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScan_ChannelScanNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "NumberOfChannelScans"); - 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_Channel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_Utilization(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_Noise(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_NeighborBSSNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "NumberofNeighbors"); - 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_BSSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_SSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_SignalStrength(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "SignalStrengh"); - 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_ChannelBandwidth(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_ChannelUtilization(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_StationCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "StationCount"); - 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioUnassociatedSTA_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 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*/ -int os__get_WiFiDataElementsNetworkDeviceRadioUnassociatedSTA_SignalStrength(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmjson_get_value((json_object *)data, 1, "SignalStrength"); - return 0; -} - -int os__get_WiFiDataElementsAssociationEvent_AssociationEventDataNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *res = NULL, *notify_arr = NULL, *notify_obj = NULL, *assoc_ev = NULL; - int num_assoc_ev = 0, i = 0; - - dmubus_call("wifi.dataelements.collector", "event", UBUS_ARGS{}, 0, &res); - dmjson_foreach_obj_in_array(res, notify_arr, notify_obj, i, 1, "notification") { - if (json_object_object_get_ex(notify_obj, "wfa-dataelements:AssociationEvent", &assoc_ev)) { - num_assoc_ev++; - } - } - - dmasprintf(value, "%d", num_assoc_ev); - return 0; -} - -int os__get_WiFiDataElementsAssociationEventAssociationEventData_BSSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *assoc_ev = NULL, *assoc_data = NULL; - - if (data) { - if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:AssociationEvent", &assoc_ev)) { - if (json_object_object_get_ex(assoc_ev, "AssocData", &assoc_data)) - *value = dmjson_get_value(assoc_data, 1, "BSSID"); - } - } - return 0; -} - -int os__get_WiFiDataElementsAssociationEventAssociationEventData_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *assoc_ev = NULL, *assoc_data = NULL; - - if (data) { - if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:AssociationEvent", &assoc_ev)) { - if (json_object_object_get_ex(assoc_ev, "AssocData", &assoc_data)) - *value = dmjson_get_value(assoc_data, 1, "MACAddress"); - } - } - return 0; -} - -int os__get_WiFiDataElementsAssociationEventAssociationEventData_StatusCode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *assoc_ev = NULL, *assoc_data = NULL; - - if (data) { - if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:AssociationEvent", &assoc_ev)) { - if (json_object_object_get_ex(assoc_ev, "AssocData", &assoc_data)) - *value = dmjson_get_value(assoc_data, 1, "StatusCode"); - } - } - return 0; -} - -int os__get_WiFiDataElementsAssociationEventAssociationEventData_HTCapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *assoc_ev = NULL, *assoc_data = NULL; - - if (data) { - if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:AssociationEvent", &assoc_ev)) { - if (json_object_object_get_ex(assoc_ev, "AssocData", &assoc_data)) - *value = dmjson_get_value(assoc_data, 1, "HTCapabilities"); - } - } - return 0; -} - -int os__get_WiFiDataElementsAssociationEventAssociationEventData_VHTCapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *assoc_ev = NULL, *assoc_data = NULL; - - if (data) { - if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:AssociationEvent", &assoc_ev)) { - if (json_object_object_get_ex(assoc_ev, "AssocData", &assoc_data)) - *value = dmjson_get_value(assoc_data, 1, "VHTCapabilities"); - } - } - return 0; -} - -int os__get_WiFiDataElementsAssociationEventAssociationEventData_HECapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *assoc_ev = NULL, *assoc_data = NULL; - - if (data) { - if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:AssociationEvent", &assoc_ev)) { - if (json_object_object_get_ex(assoc_ev, "AssocData", &assoc_data)) - *value = dmjson_get_value(assoc_data, 1, "HECapabilities"); - } - } - return 0; -} - -int os__get_WiFiDataElementsAssociationEventAssociationEventData_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *assoc_ev = NULL; - - if (data) { - if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:AssociationEvent", &assoc_ev)) { - *value = dmjson_get_value((json_object *)data, 1, "eventTime"); - } - } - return 0; -} - -int os__get_WiFiDataElementsDisassociationEvent_DisassociationEventDataNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *res = NULL, *notify_arr = NULL, *notify_obj = NULL, *disassoc_ev = NULL; - int num_disassoc_ev = 0, i = 0; - - dmubus_call("wifi.dataelements.collector", "event", UBUS_ARGS{}, 0, &res); - dmjson_foreach_obj_in_array(res, notify_arr, notify_obj, i, 1, "notification") { - if (json_object_object_get_ex(notify_obj, "wfa-dataelements:DisassociationEvent", &disassoc_ev)) { - num_disassoc_ev++; - } - } - dmasprintf(value, "%d", num_disassoc_ev); - return 0; -} - -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_BSSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *disassoc_ev = NULL, *disassoc_data = NULL; - - if (data) { - if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:DisassociationEvent", &disassoc_ev)) { - if (json_object_object_get_ex(disassoc_ev, "DisassocData", &disassoc_data)) - *value = dmjson_get_value(disassoc_data, 1, "BSSID"); - } - } - return 0; -} - -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *disassoc_ev = NULL, *disassoc_data = NULL; - - if (data) { - if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:DisassociationEvent", &disassoc_ev)) { - if (json_object_object_get_ex(disassoc_ev, "DisassocData", &disassoc_data)) - *value = dmjson_get_value(disassoc_data, 1, "MACAddress"); - } - } - return 0; -} - -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_ReasonCode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *disassoc_ev = NULL, *disassoc_data = NULL; - - if (data) { - if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:DisassociationEvent", &disassoc_ev)) { - if (json_object_object_get_ex(disassoc_ev, "DisassocData", &disassoc_data)) - *value = dmjson_get_value(disassoc_data, 1, "ReasonCode"); - } - } - return 0; -} - -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *disassoc_ev = NULL, *disassoc_data = NULL; - - if (data) { - if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:DisassociationEvent", &disassoc_ev)) { - if (json_object_object_get_ex(disassoc_ev, "DisassocData", &disassoc_data)) - *value = dmjson_get_value(disassoc_data, 1, "BytesSent"); - } - } - return 0; -} - -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *disassoc_ev = NULL, *disassoc_data = NULL; - - if (data) { - if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:DisassociationEvent", &disassoc_ev)) { - if (json_object_object_get_ex(disassoc_ev, "DisassocData", &disassoc_data)) - *value = dmjson_get_value(disassoc_data, 1, "BytesReceived"); - } - } - return 0; -} - -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *disassoc_ev = NULL, *disassoc_data = NULL; - - if (data) { - if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:DisassociationEvent", &disassoc_ev)) { - if (json_object_object_get_ex(disassoc_ev, "DisassocData", &disassoc_data)) - *value = dmjson_get_value(disassoc_data, 1, "PacketsSent"); - } - } - return 0; -} - -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *disassoc_ev = NULL, *disassoc_data = NULL; - - if (data) { - if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:DisassociationEvent", &disassoc_ev)) { - if (json_object_object_get_ex(disassoc_ev, "DisassocData", &disassoc_data)) - *value = dmjson_get_value(disassoc_data, 1, "PacketsReceived"); - } - } - return 0; -} - -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_ErrorsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *disassoc_ev = NULL, *disassoc_data = NULL; - - if (data) { - if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:DisassociationEvent", &disassoc_ev)) { - if (json_object_object_get_ex(disassoc_ev, "DisassocData", &disassoc_data)) - *value = dmjson_get_value(disassoc_data, 1, "ErrorsSent"); - } - } - return 0; -} - -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_ErrorsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *disassoc_ev = NULL, *disassoc_data = NULL; - - if (data) { - if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:DisassociationEvent", &disassoc_ev)) { - if (json_object_object_get_ex(disassoc_ev, "DisassocData", &disassoc_data)) - *value = dmjson_get_value(disassoc_data, 1, "ErrorsReceived"); - } - } - return 0; -} - -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_RetransCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *disassoc_ev = NULL, *disassoc_data = NULL; - - if (data) { - if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:DisassociationEvent", &disassoc_ev)) { - if (json_object_object_get_ex(disassoc_ev, "DisassocData", &disassoc_data)) - *value = dmjson_get_value(disassoc_data, 1, "RetransCount"); - } - } - return 0; -} - -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - json_object *disassoc_ev = NULL; - - if (data) { - if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:DisassociationEvent", &disassoc_ev)) { - *value = dmjson_get_value((json_object *)data, 1, "eventTime"); - } - } - return 0; -} - -/************************************************************* - * ENTRY METHOD - **************************************************************/ -int os__browseWiFiDataElementsNetworkDeviceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - int i = 0, j = 0, id = 0; - char *inst = NULL, *max_inst = NULL; - json_object *res = NULL, *data_arr = NULL, *data_obj = NULL, *net_obj = NULL; - json_object *dev_arr = NULL, *dev_obj = NULL; - - dmubus_call("wifi.dataelements.collector", "dump", UBUS_ARGS{}, 0, &res); - dmjson_foreach_obj_in_array(res, data_arr, data_obj, i, 1, "data") { - json_object_object_get_ex(data_obj, "wfa-dataelements:Network", &net_obj); - dmjson_foreach_obj_in_array(net_obj, dev_arr, dev_obj, j, 1, "DeviceList") { - inst = handle_update_instance(1, dmctx, &max_inst, update_instance_without_section, 1, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)dev_obj, inst) == DM_STOP) - break; - } - } - return 0; -} - -int os__browseWiFiDataElementsNetworkDeviceRadioInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - json_object *radio_arr = NULL, *radio_obj = NULL; - char *inst = NULL, *max_inst = NULL; - int id = 0, i = 0; - - dmjson_foreach_obj_in_array((json_object *)prev_data, radio_arr, radio_obj, i, 1, "RadioList") { - inst = handle_update_instance(2, dmctx, &max_inst, update_instance_without_section, 1, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)radio_obj, inst) == DM_STOP) - break; - } - return 0; -} - -int os__browseWiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfileInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - json_object *opclass_arr = NULL, *opclass_obj = NULL; - char *inst = NULL, *max_inst = NULL; - int id = 0, i = 0; - - dmjson_foreach_obj_in_array((json_object *)prev_data, opclass_arr, opclass_obj, i, 1, "CurrentOperatingClasses") { - inst = handle_update_instance(3, dmctx, &max_inst, update_instance_without_section, 1, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)opclass_obj, inst) == DM_STOP) - break; - } - return 0; -} - -int os__browseWiFiDataElementsNetworkDeviceRadioBSSInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - json_object *bss_arr = NULL, *bss_obj = NULL; - char *inst = NULL, *max_inst = NULL; - int id = 0, i = 0; - - dmjson_foreach_obj_in_array((json_object *)prev_data, bss_arr, bss_obj, i, 1, "BSSList") { - inst = handle_update_instance(3, dmctx, &max_inst, update_instance_without_section, 1, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)bss_obj, inst) == DM_STOP) - break; - } - return 0; -} - -int os__browseWiFiDataElementsNetworkDeviceRadioScanResultInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - json_object *scanres_arr = NULL, *scanres_obj = NULL; - char *inst = NULL, *max_inst = NULL; - int id = 0, i = 0; - - dmjson_foreach_obj_in_array((json_object *)prev_data, scanres_arr, scanres_obj, i, 1, "ScanResultList") { - inst = handle_update_instance(3, dmctx, &max_inst, update_instance_without_section, 1, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)scanres_obj, inst) == DM_STOP) - break; - } - return 0; -} - -int os__browseWiFiDataElementsNetworkDeviceRadioUnassociatedSTAInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - json_object *unassoc_arr = NULL, *unassoc_obj = NULL; - char *inst = NULL, *max_inst = NULL; - int id = 0, i = 0; - - dmjson_foreach_obj_in_array((json_object *)prev_data, unassoc_arr, unassoc_obj, i, 1, "UnassociatedStaList") { - inst = handle_update_instance(3, dmctx, &max_inst, update_instance_without_section, 1, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)unassoc_obj, inst) == DM_STOP) - break; - } - return 0; -} - -int os__browseWiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfileInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - json_object *caps_obj = NULL, *opclass_arr = NULL, *opclass_obj = NULL; - char *inst = NULL, *max_inst = NULL; - int id = 0, i = 0; - - json_object_object_get_ex((json_object *)prev_data, "Capabilites", &caps_obj); - dmjson_foreach_obj_in_array(caps_obj, opclass_arr, opclass_obj, i, 1, "OperatingClasses") { - inst = handle_update_instance(3, dmctx, &max_inst, update_instance_without_section, 1, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)opclass_obj, inst) == DM_STOP) - break; - } - return 0; -} - -int os__browseWiFiDataElementsNetworkDeviceRadioBSSSTAInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - json_object *sta_arr = NULL, *sta_obj = NULL; - char *inst = NULL, *max_inst = NULL; - int id = 0, i = 0; - - dmjson_foreach_obj_in_array((json_object *)prev_data, sta_arr, sta_obj, i, 1, "STAList") { - inst = handle_update_instance(4, dmctx, &max_inst, update_instance_without_section, 1, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)sta_obj, inst) == DM_STOP) - break; - } - return 0; -} - -int os__browseWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - json_object *opclass_scan_arr = NULL, *opclass_scan_obj = NULL; - char *inst = NULL, *max_inst = NULL; - int id = 0, i = 0; - - dmjson_foreach_obj_in_array((json_object *)prev_data, opclass_scan_arr, opclass_scan_obj, i, 1, "OpClassScanList") { - inst = handle_update_instance(4, dmctx, &max_inst, update_instance_without_section, 1, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)opclass_scan_obj, inst) == DM_STOP) - break; - } - return 0; -} - -int os__browseWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - json_object *chscan_arr = NULL, *chscan_obj = NULL; - char *inst = NULL, *max_inst = NULL; - int id = 0, i = 0; - - dmjson_foreach_obj_in_array((json_object *)prev_data, chscan_arr, chscan_obj, i, 1, "ChannelScanList") { - inst = handle_update_instance(5, dmctx, &max_inst, update_instance_without_section, 1, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)chscan_obj, inst) == DM_STOP) - break; - } - return 0; -} - -int os__browseWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSSInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - json_object *neigh_arr = NULL, *neigh_obj = NULL; - char *inst = NULL, *max_inst = NULL; - int id = 0, i = 0; - - dmjson_foreach_obj_in_array((json_object *)prev_data, neigh_arr, neigh_obj, i, 1, "NeighborList") { - inst = handle_update_instance(6, dmctx, &max_inst, update_instance_without_section, 1, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)neigh_obj, inst) == DM_STOP) - break; - } - return 0; -} - -int os__browseWiFiDataElementsAssociationEventAssociationEventDataInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - json_object *res = NULL, *notify_arr = NULL, *notify_obj = NULL, *assoc_ev = NULL; - char *inst = NULL, *max_inst = NULL; - int id = 0, i = 0; - - dmubus_call("wifi.dataelements.collector", "event", UBUS_ARGS{}, 0, &res); - dmjson_foreach_obj_in_array(res, notify_arr, notify_obj, i, 1, "notification") { - if (json_object_object_get_ex(notify_obj, "wfa-dataelements:AssociationEvent", &assoc_ev)) { - inst = handle_update_instance(1, dmctx, &max_inst, update_instance_without_section, 1, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)notify_obj, inst) == DM_STOP) - break; - } - } - return 0; -} - -int os__browseWiFiDataElementsDisassociationEventDisassociationEventDataInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - json_object *res = NULL, *notify_arr = NULL, *notify_obj = NULL, *disassoc_ev = NULL; - char *inst = NULL, *max_inst = NULL; - int id = 0, i = 0; - - dmubus_call("wifi.dataelements.collector", "event", UBUS_ARGS{}, 0, &res); - dmjson_foreach_obj_in_array(res, notify_arr, notify_obj, i, 1, "notification") { - if (json_object_object_get_ex(notify_obj, "wfa-dataelements:DisassociationEvent", &disassoc_ev)) { - inst = handle_update_instance(1, dmctx, &max_inst, update_instance_without_section, 1, ++id); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)notify_obj, inst) == DM_STOP) - break; - } - } - return 0; -} diff --git a/dmtree/tr181/wifi-openwrt.c b/dmtree/tr181/wifi-openwrt.c deleted file mode 100644 index 6bb7a584..00000000 --- a/dmtree/tr181/wifi-openwrt.c +++ /dev/null @@ -1,987 +0,0 @@ -#include "os.h" - -static int not_implemented(char **value) -{ - *value = ""; - return 0; -} - -int os__get_wlan_bssid(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiRadioStats_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiRadioStats_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiRadioStats_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiRadioStats_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiRadioStats_ErrorsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiRadioStats_ErrorsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiRadioStats_DiscardPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiRadioStats_DiscardPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiRadioStats_FCSErrorCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiSSIDStats_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiSSIDStats_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiSSIDStats_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiSSIDStats_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiSSIDStats_ErrorsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiSSIDStats_ErrorsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiSSIDStats_DiscardPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiSSIDStats_DiscardPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiSSIDStats_UnicastPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiSSIDStats_UnicastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiSSIDStats_MulticastPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiSSIDStats_MulticastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiSSIDStats_BroadcastPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiSSIDStats_BroadcastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiSSIDStats_RetransCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiSSIDStats_FailedRetransCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiSSIDStats_RetryCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiSSIDStats_MultipleRetryCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiSSIDStats_ACKFailureCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiSSIDStats_AggregatedPacketCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiSSIDStats_UnknownProtoPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiAccessPointAssociatedDevice_Active(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiAccessPointAssociatedDevice_Noise(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiAccessPointAssociatedDevice_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiAccessPointAssociatedDevice_LastDataDownlinkRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiAccessPointAssociatedDevice_LastDataUplinkRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiAccessPointAssociatedDevice_SignalStrength(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiAccessPointAssociatedDevice_AssociationTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_access_point_associative_device_statistics_tx_bytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_access_point_associative_device_statistics_rx_bytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_access_point_associative_device_statistics_tx_packets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_access_point_associative_device_statistics_rx_packets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_access_point_associative_device_statistics_tx_errors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_access_point_associative_device_statistics_retrans_count(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os_get_wifi_access_point_status (char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_radio_max_bit_rate (char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_radio_frequency(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_radio_supported_frequency_bands(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_radio_channel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -char * os__get_radio_channel_nocache(const struct wifi_radio_args *args) -{ - return ""; -} - -char * os__get_radio_frequency_nocache(const struct wifi_radio_args *args) -{ - return ""; -} - -int os__get_neighboring_wifi_diagnostics_diagnostics_state(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_neighboring_wifi_diagnostics_result_number_entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_neighboring_wifi_diagnostics_result_ssid(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_neighboring_wifi_diagnostics_result_bssid(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_neighboring_wifi_diagnostics_result_channel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_neighboring_wifi_diagnostics_result_signal_strength(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_neighboring_wifi_diagnostics_result_operating_frequency_band(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_neighboring_wifi_diagnostics_result_noise(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_radio_possible_channels(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiRadio_SupportedOperatingChannelBandwidths(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiRadio_CurrentOperatingChannelBandwidth(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -void os__wifi_start_scan(const char *radio) -{ -} - -int os__browseWifiNeighboringWiFiDiagnosticResultInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - return 0; -} - -int os_get_radio_operating_standard(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_radio_supported_standard(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_access_point_total_associations(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__browse_wifi_associated_device(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - return 0; -} - -char * os__get_default_wpa_key() -{ - return "OpenWrt"; -} - -int os__get_WiFiDataElementsNetwork_ID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__set_WiFiDataElementsNetwork_ID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - return 0; -} - -int os__get_WiFiDataElementsNetwork_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetwork_ControllerID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__set_WiFiDataElementsNetwork_ControllerID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - return 0; -} - -int os__get_WiFiDataElementsNetwork_DeviceNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDevice_ID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -#if 0 -int os__get_WiFiDataElementsNetworkDevice_MultiAPCapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} -#endif - -int os__get_WiFiDataElementsNetworkDevice_CollectionInterval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDevice_RadioNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadio_ID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadio_Enabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadio_Noise(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadio_Utilization(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadio_Transmit(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadio_ReceiveSelf(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadio_ReceiveOther(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadio_CurrentOperatingClassProfileNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadio_UnassociatedSTANumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadio_BSSNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadio_ScanResultNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBackhaulSta_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioCapabilities_HTCapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioCapabilities_VHTCapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioCapabilities_HECapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioCapabilities_CapableOperatingClassProfileNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfile_Class(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfile_MaxTxPower(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfile_NonOperable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfile_NumberOfNonOperChan(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_Class(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_Channel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_TxPower(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_BSSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_SSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_Enabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_LastChange(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_UnicastBytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_UnicastBytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_MulticastBytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_MulticastBytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_BroadcastBytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_BroadcastBytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_EstServiceParametersBE(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_EstServiceParametersBK(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_EstServiceParametersVI(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_EstServiceParametersVO(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSS_STANumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_HTCapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_VHTCapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_HECapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_LastDataDownlinkRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_LastDataUplinkRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_UtilizationReceive(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_UtilizationTransmit(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_EstMACDataRateDownlink(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_EstMACDataRateUplink(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_SignalStrength(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_LastConnectTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_ErrorsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_ErrorsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -#if 0 -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_RetransCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} -#endif - -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_MeasurementReport(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_NumberOfMeasureReports(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -#if 0 -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_IPV4Address(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_IPV6Address(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} -#endif - -int os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_Hostname(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioScanResult_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioScanResult_OpClassScanNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScan_OperatingClass(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScan_ChannelScanNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_Channel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_Utilization(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_Noise(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_NeighborBSSNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_BSSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_SSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_SignalStrength(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_ChannelBandwidth(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_ChannelUtilization(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_StationCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioUnassociatedSTA_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsNetworkDeviceRadioUnassociatedSTA_SignalStrength(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsAssociationEvent_AssociationEventDataNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsAssociationEventAssociationEventData_BSSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsAssociationEventAssociationEventData_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsAssociationEventAssociationEventData_StatusCode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsAssociationEventAssociationEventData_HTCapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsAssociationEventAssociationEventData_VHTCapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsAssociationEventAssociationEventData_HECapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsAssociationEventAssociationEventData_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsDisassociationEvent_DisassociationEventDataNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_BSSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_ReasonCode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_ErrorsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_ErrorsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_RetransCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__get_WiFiDataElementsDisassociationEventDisassociationEventData_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - return not_implemented(value); -} - -int os__browseWiFiDataElementsNetworkDeviceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - return 0; -} - -int os__browseWiFiDataElementsNetworkDeviceRadioInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - return 0; -} - -int os__browseWiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfileInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - return 0; -} - -int os__browseWiFiDataElementsNetworkDeviceRadioBSSInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - return 0; -} - -int os__browseWiFiDataElementsNetworkDeviceRadioScanResultInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - return 0; -} - -int os__browseWiFiDataElementsNetworkDeviceRadioUnassociatedSTAInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - return 0; -} - -int os__browseWiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfileInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - return 0; -} - -int os__browseWiFiDataElementsNetworkDeviceRadioBSSSTAInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - return 0; -} - -int os__browseWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - return 0; -} - -int os__browseWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - return 0; -} - -int os__browseWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSSInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - return 0; -} - -int os__browseWiFiDataElementsAssociationEventAssociationEventDataInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - return 0; -} - -int os__browseWiFiDataElementsDisassociationEventDisassociationEventDataInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - return 0; -} - -int os_get_supported_modes(const char *ubus_method, const char *ifname, char **value) -{ - return not_implemented(value); -} diff --git a/dmtree/tr181/wifi.c b/dmtree/tr181/wifi.c index 90c3abfd..be7dc2c8 100644 --- a/dmtree/tr181/wifi.c +++ b/dmtree/tr181/wifi.c @@ -14,35 +14,25 @@ #include "dmentry.h" #include "wifi.h" -#include "os.h" /************************************************************************** * LINKER ***************************************************************************/ static int get_linker_Wifi_Radio(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker) { - if (data && ((struct wifi_radio_args *)data)->wifi_radio_sec) - *linker = section_name(((struct wifi_radio_args *)data)->wifi_radio_sec); - else - *linker = ""; + *linker = (data && ((struct wifi_radio_args *)data)->wifi_radio_sec) ? section_name(((struct wifi_radio_args *)data)->wifi_radio_sec) : ""; return 0; } static int get_linker_Wifi_Ssid(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker) { - if (data && ((struct wifi_ssid_args *)data)->ifname) - *linker = ((struct wifi_ssid_args *)data)->ifname; - else - *linker = ""; + *linker = (data && ((struct wifi_ssid_args *)data)->ifname) ? ((struct wifi_ssid_args *)data)->ifname : ""; return 0; } static int get_linker_associated_device(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker) { - if (data) - *linker = dmjson_get_value((json_object *)data, 1, "macaddr"); - else - *linker = ""; + *linker = data ? dmjson_get_value((json_object *)data, 1, "macaddr") : ""; return 0; } @@ -76,6 +66,395 @@ static inline int init_wifi_enp(struct wifi_enp_args *args, struct uci_section * args->ifname = wiface; return 0; } + +/************************************************************* +* COMMON FUNCTIONS +**************************************************************/ +static char *get_radio_option_nocache(const struct wifi_radio_args *args, char *option) +{ + json_object *res = NULL; + char object[32]; + + snprintf(object, sizeof(object), "wifi.radio.%s", section_name(args->wifi_radio_sec)); + dmubus_call(object, "status", UBUS_ARGS{}, 0, &res); + + return (res) ? dmjson_get_value(res, 1, option) : ""; +} + +static char *get_data_model_mode(const char *ubus_mode) +{ + if (strcmp(ubus_mode, "WEP64") == 0) + return "WEP-64"; + else if (strcmp(ubus_mode, "WEP128") == 0) + return "WEP-128"; + else if (strcmp(ubus_mode, "WPAPSK") == 0) + return "WPA-Personal"; + else if (strcmp(ubus_mode, "WPA2PSK") == 0) + return "WPA2-Personal"; + else if (strcmp(ubus_mode, "WPA3PSK") == 0) + return "WPA3-Personal"; + else if (strcmp(ubus_mode, "WPAPSK+WPA2PSK") == 0) + return "WPA-WPA2-Personal"; + else if (strcmp(ubus_mode, "WPA2PSK+WPA3PSK") == 0) + return "WPA3-Personal-Transition"; + else if (strcmp(ubus_mode, "WPA") == 0) + return "WPA-Enterprise"; + else if (strcmp(ubus_mode, "WPA2") == 0) + return "WPA2-Enterprise"; + else if (strcmp(ubus_mode, "WPA3") == 0) + return "WPA3-Enterprise"; + else if (strcmp(ubus_mode, "WPA+WPA2") == 0) + return "WPA-WPA2-Enterprise"; + else + return "None"; +} + +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, &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 (!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; + + dmuci_get_value_by_section_string(section, "encryption", &encryption); + if (!encryption || *encryption == '\0') + return "None"; + + if (strstr(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 && strlen(key) == 10) ? "WEP-64" : "WEP-128"; + } else if (strcmp(encryption, "psk") == 0) + return "WPA-Personal"; + else if (strcmp(encryption, "psk2") == 0) + return "WPA2-Personal"; + else if (strcmp(encryption, "sae") == 0) + return "WPA3-Personal"; + else if (strcmp(encryption, "psk-mixed") == 0) + return "WPA-WPA2-Personal"; + else if (strcmp(encryption, "sae-mixed") == 0) + return "WPA3-Personal-Transition"; + else if (strcmp(encryption, "wpa") == 0) + return "WPA-Enterprise"; + else if (strcmp(encryption, "wpa2") == 0) + return "WPA2-Enterprise"; + else if (strcmp(encryption, "wpa3") == 0) + return "WPA3-Enterprise"; + else if (strcmp(encryption, "wpa-mixed") == 0) + return "WPA-WPA2-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, "wps", 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 void wifi_start_scan(const char *radio) +{ + char object[32]; + + snprintf(object, sizeof(object), "wifi.radio.%s", radio); + dmubus_call_set(object, "scan", UBUS_ARGS{}, 0); +} + +/************************************************************* +* ADD DEL OBJ +**************************************************************/ +static int add_wifi_iface(char *inst_name, char **instance) +{ + struct uci_section *s = NULL, *dmmap_wifi = NULL; + char ssid[32] = {0}, s_name[32] = {0}; + + char *inst = get_last_instance_bbfdm("dmmap_wireless", "wifi-iface", inst_name); + snprintf(ssid, sizeof(ssid), "iopsys_%d", inst ? (atoi(inst)+1) : 1); + snprintf(s_name, sizeof(s_name), "wlan_%d", inst ? (atoi(inst)+1) : 1); + + 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, "ssid", ssid); + 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); + *instance = update_instance(inst, 2, dmmap_wifi, inst_name); + return 0; +} + +static int add_wifi_ssid(char *refparam, struct dmctx *ctx, void *data, char **instance) +{ + return add_wifi_iface("ssidinstance", instance); +} + +static int add_wifi_accesspoint(char *refparam, struct dmctx *ctx, void *data, char **instance) +{ + return add_wifi_iface("ap_instance", instance); +} + +static int delete_wifi_iface(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) +{ + int found = 0; + struct uci_section *s = NULL, *ss = NULL, *dmmap_section = NULL; + + switch (del_action) { + case DEL_INST: + get_dmmap_section_of_config_section("dmmap_wireless", "wifi-iface", section_name(((struct wifi_ssid_args *)data)->wifi_ssid_sec), &dmmap_section); + dmuci_delete_by_section(dmmap_section, NULL, NULL); + dmuci_delete_by_section(((struct wifi_ssid_args *)data)->wifi_ssid_sec, NULL, NULL); + break; + case DEL_ALL: + uci_foreach_sections("wireless", "wifi-iface", s) { + if (found != 0) { + get_dmmap_section_of_config_section("dmmap_wireless", "wifi-iface", section_name(ss), &dmmap_section); + dmuci_delete_by_section(dmmap_section, NULL, NULL); + dmuci_delete_by_section(ss, NULL, NULL); + } + ss = s; + found++; + } + if (ss != NULL) { + get_dmmap_section_of_config_section("dmmap_wireless", "wifi-iface", section_name(ss), &dmmap_section); + dmuci_delete_by_section(dmmap_section, NULL, NULL); + dmuci_delete_by_section(ss, 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; + + char *instancepara = get_last_instance_lev2_bbfdm("wireless", "wifi-iface", "dmmap_wireless", "endpointinstance", "mode", "sta"); + if (!instancepara) + instancepara = "0"; + + 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)); + *instance = update_instance(instancepara, 2, dmmap_sec, "endpointinstance"); + return 0; +} + +static int delObjWiFiEndPoint(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) +{ + struct uci_section *s = NULL, *dmmap_section = NULL; + + switch (del_action) { + case DEL_INST: + get_dmmap_section_of_config_section("dmmap_wireless", "wifi-iface", section_name(((struct wifi_ssid_args *)data)->wifi_ssid_sec), &dmmap_section); + dmuci_set_value_by_section(((struct wifi_enp_args *)data)->wifi_enp_sec, "endpointinstance", ""); + dmuci_set_value_by_section(((struct wifi_enp_args *)data)->wifi_enp_sec, "mode", ""); + break; + case DEL_ALL: + uci_foreach_sections("wireless", "wifi-iface", s) { + + char *mode; + dmuci_get_value_by_section_string(s, "mode", &mode); + if (strcmp(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) +{ + char *inst = NULL, *max_inst = NULL; + struct wifi_radio_args curr_wifi_radio_args = {0}; + struct dmmap_dup *p = NULL; + LIST_HEAD(dup_list); + + synchronize_specific_config_sections_with_dmmap("wireless", "wifi-device", "dmmap_wireless", &dup_list); + list_for_each_entry(p, &dup_list, list) { + init_wifi_radio(&curr_wifi_radio_args, p->config_section); + + inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3, + p->dmmap_section, "radioinstance", "radioalias"); + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_wifi_radio_args, inst) == DM_STOP) + break; + } + free_dmmap_config_dup_list(&dup_list); + return 0; +} + +/*#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) +{ + char *inst = NULL, *max_inst = NULL, *ifname = NULL, *linker; + struct wifi_ssid_args curr_wifi_ssid_args = {0}; + struct dmmap_dup *p = NULL; + LIST_HEAD(dup_list); + + synchronize_specific_config_sections_with_dmmap("wireless", "wifi-iface", "dmmap_wireless", &dup_list); + list_for_each_entry(p, &dup_list, list) { + + dmuci_get_value_by_section_string(p->config_section, "device", &linker); + ifname = get_device_from_wifi_iface(linker, section_name(p->config_section)); + + init_wifi_ssid(&curr_wifi_ssid_args, p->config_section, ifname, linker); + + inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3, + p->dmmap_section, "ssidinstance", "ssidalias"); + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_wifi_ssid_args, inst) == DM_STOP) + break; + } + free_dmmap_config_dup_list(&dup_list); + 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) +{ + char *inst = NULL, *ifname, *max_inst = NULL, *mode = NULL; + struct wifi_acp_args curr_wifi_acp_args = {0}; + struct dmmap_dup *p = NULL; + LIST_HEAD(dup_list); + + synchronize_specific_config_sections_with_dmmap("wireless", "wifi-iface", "dmmap_wireless", &dup_list); + list_for_each_entry(p, &dup_list, list) { + dmuci_get_value_by_section_string(p->config_section, "mode", &mode); + if ((strlen(mode)>0 || mode[0] != '\0') && strcmp(mode, "ap") != 0) + continue; + dmuci_get_value_by_section_string(p->config_section, "ifname", &ifname); + init_wifi_acp(&curr_wifi_acp_args, p->config_section, ifname); + + inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3, + p->dmmap_section, "ap_instance", "ap_alias"); + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_wifi_acp_args, 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) +{ + char *inst = NULL, *ifname, *max_inst = NULL, *mode = NULL; + struct wifi_enp_args curr_wifi_enp_args = {0}; + struct dmmap_dup *p = NULL; + LIST_HEAD(dup_list); + + synchronize_specific_config_sections_with_dmmap("wireless", "wifi-iface", "dmmap_wireless", &dup_list); + list_for_each_entry(p, &dup_list, list) { + + dmuci_get_value_by_section_string(p->config_section, "mode", &mode); + if (strcmp(mode, "sta") != 0) + continue; + + dmuci_get_value_by_section_string(p->config_section, "ifname", &ifname); + init_wifi_enp(&curr_wifi_enp_args, p->config_section, ifname); + + inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3, + p->dmmap_section, "endpointinstance", "endpointalias"); + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_wifi_enp_args, 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 *max_inst = NULL, *ep_instance = NULL; + struct wifi_enp_args *ep_args = (struct wifi_enp_args *)prev_data; + struct uci_section *dmmap_section = NULL; + + get_dmmap_section_of_config_section("dmmap_wireless", "wifi-iface", section_name(ep_args->wifi_enp_sec), &dmmap_section); + dmuci_get_value_by_section_string(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); + + handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 3, + s, "ep_profile_instance", "ep_profile_alias"); + + DM_LINK_INST_OBJ(dmctx, parent_node, ep_args->wifi_enp_sec, "1"); + return 0; +} + /************************************************************************** * SET & GET VALUE ***************************************************************************/ @@ -274,7 +653,7 @@ static int set_radio_operating_standard(char *refparam, struct dmctx *ctx, void return FAULT_9007; return 0; case VALUESET: - freq = os__get_radio_frequency_nocache(data); + freq = get_radio_option_nocache(data, "band"); if (strcmp(freq, "5GHz") == 0) { if (strcmp(value, "n") == 0) value = "11n"; @@ -610,7 +989,7 @@ static int set_radio_auto_channel_enable(char *refparam, struct dmctx *ctx, void if (b) value = "auto"; else - value = os__get_radio_channel_nocache(data); + value = get_radio_option_nocache(data, "channel"); dmuci_set_value_by_section(((struct wifi_radio_args *)data)->wifi_radio_sec, "channel", value); return 0; @@ -618,9 +997,6 @@ static int set_radio_auto_channel_enable(char *refparam, struct dmctx *ctx, void return 0; } -/************************************************************************** -* SET & GET VALUE -***************************************************************************/ /*#Device.WiFi.SSID.{i}.SSIDAdvertisementEnabled!UCI:wireless/wifi-iface,@i-1/hidden*/ static int get_wlan_ssid_advertisement_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { @@ -814,71 +1190,7 @@ static int set_WiFiAccessPoint_UAPSDEnable(char *refparam, struct dmctx *ctx, vo static int get_access_point_security_supported_modes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - return os_get_supported_modes("wifi.ap", ((struct wifi_acp_args *)data)->ifname, value); -} - -static char *get_security_mode(struct uci_section *section) -{ - char *encryption = NULL; - - dmuci_get_value_by_section_string(section, "encryption", &encryption); - if (!encryption || *encryption == '\0') - return "None"; - - if (strstr(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 && strlen(key) == 10) ? "WEP-64" : "WEP-128"; - } else if (strcmp(encryption, "psk") == 0) - return "WPA-Personal"; - else if (strcmp(encryption, "psk2") == 0) - return "WPA2-Personal"; - else if (strcmp(encryption, "sae") == 0) - return "WPA3-Personal"; - else if (strcmp(encryption, "psk-mixed") == 0) - return "WPA-WPA2-Personal"; - else if (strcmp(encryption, "sae-mixed") == 0) - return "WPA3-Personal-Transition"; - else if (strcmp(encryption, "wpa") == 0) - return "WPA-Enterprise"; - else if (strcmp(encryption, "wpa2") == 0) - return "WPA2-Enterprise"; - else if (strcmp(encryption, "wpa3") == 0) - return "WPA3-Enterprise"; - else if (strcmp(encryption, "wpa-mixed") == 0) - return "WPA-WPA2-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, "wps", 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]); - } + return get_supported_modes("wifi.ap", ((struct wifi_acp_args *)data)->ifname, value); } static void set_security_mode(struct uci_section *section, char *value) @@ -913,7 +1225,7 @@ static void set_security_mode(struct uci_section *section, char *value) dmuci_set_value_by_section(section, "encryption", "wep-open"); dmuci_set_value_by_section(section, "key", "1"); } else if (strcmp(value, "WPA-Personal") == 0) { - char *wpa_key = os__get_default_wpa_key(); + char *wpa_key = get_default_wpa_key(); dmuci_set_value_by_section(section, "encryption", "psk"); dmuci_set_value_by_section(section, "key", wpa_key); dmuci_set_value_by_section(section, "wpa_group_rekey", "3600"); @@ -921,7 +1233,7 @@ static void set_security_mode(struct uci_section *section, char *value) dmuci_set_value_by_section(section, "encryption", "wpa"); dmuci_set_value_by_section(section, "auth_port", "1812"); } else if (strcmp(value, "WPA2-Personal") == 0) { - char *wpa_key = os__get_default_wpa_key(); + char *wpa_key = get_default_wpa_key(); dmuci_set_value_by_section(section, "encryption", "psk2"); dmuci_set_value_by_section(section, "key", wpa_key); dmuci_set_value_by_section(section, "wpa_group_rekey", "3600"); @@ -930,7 +1242,7 @@ static void set_security_mode(struct uci_section *section, char *value) dmuci_set_value_by_section(section, "encryption", "wpa2"); dmuci_set_value_by_section(section, "auth_port", "1812"); } else if (strcmp(value, "WPA-WPA2-Personal") == 0) { - char *wpa_key = os__get_default_wpa_key(); + char *wpa_key = get_default_wpa_key(); dmuci_set_value_by_section(section, "encryption", "psk-mixed"); dmuci_set_value_by_section(section, "key", wpa_key); dmuci_set_value_by_section(section, "wpa_group_rekey", "3600"); @@ -939,14 +1251,14 @@ static void set_security_mode(struct uci_section *section, char *value) dmuci_set_value_by_section(section, "encryption", "wpa-mixed"); dmuci_set_value_by_section(section, "auth_port", "1812"); } else if (strcmp(value, "WPA3-Personal") == 0) { - char *wpa_key = os__get_default_wpa_key(); + char *wpa_key = get_default_wpa_key(); dmuci_set_value_by_section(section, "encryption", "sae"); dmuci_set_value_by_section(section, "key", wpa_key); } else if (strcmp(value, "WPA3-Enterprise") == 0) { dmuci_set_value_by_section(section, "encryption", "wpa3"); dmuci_set_value_by_section(section, "auth_port", "1812"); } else if (strcmp(value, "WPA3-Personal-Transition") == 0) { - char *wpa_key = os__get_default_wpa_key(); + char *wpa_key = get_default_wpa_key(); dmuci_set_value_by_section(section, "encryption", "sae-mixed"); dmuci_set_value_by_section(section, "key", wpa_key); } @@ -1473,7 +1785,7 @@ static int get_WiFiEndPoint_SSIDReference(char *refparam, struct dmctx *ctx, voi static int get_WiFiEndPointSecurity_ModesSupported(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - return os_get_supported_modes("wifi.backhaul", ((struct wifi_enp_args *)data)->ifname, value); + return get_supported_modes("wifi.backhaul", ((struct wifi_enp_args *)data)->ifname, value); } static int get_WiFiEndPointProfile_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) @@ -1865,9 +2177,7 @@ static int set_access_point_alias(char *refparam, struct dmctx *ctx, void *data, } return 0; } -/************************************************************* -* GET & SET LOWER LAYER -**************************************************************/ + static int get_ssid_lower_layer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { if (data && ((struct wifi_ssid_args *)data)->linker[0] != '\0') { @@ -1906,246 +2216,7 @@ static int get_ap_ssid_ref(char *refparam, struct dmctx *ctx, void *data, char * return 0; } -/************************************************************* -* ADD DEL OBJ -**************************************************************/ -static int add_wifi_iface(char *inst_name, char **instance) -{ - struct uci_section *s = NULL, *dmmap_wifi = NULL; - char ssid[32] = {0}, s_name[32] = {0}; - - char *inst = get_last_instance_bbfdm("dmmap_wireless", "wifi-iface", inst_name); - snprintf(ssid, sizeof(ssid), "iopsys_%d", inst ? (atoi(inst)+1) : 1); - snprintf(s_name, sizeof(s_name), "wlan_%d", inst ? (atoi(inst)+1) : 1); - - 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, "ssid", ssid); - 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); - *instance = update_instance(inst, 2, dmmap_wifi, inst_name); - return 0; -} - -static int add_wifi_ssid(char *refparam, struct dmctx *ctx, void *data, char **instance) -{ - return add_wifi_iface("ssidinstance", instance); -} - -static int add_wifi_accesspoint(char *refparam, struct dmctx *ctx, void *data, char **instance) -{ - return add_wifi_iface("ap_instance", instance); -} - -static int delete_wifi_iface(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) -{ - int found = 0; - struct uci_section *s = NULL, *ss = NULL, *dmmap_section = NULL; - - switch (del_action) { - case DEL_INST: - get_dmmap_section_of_config_section("dmmap_wireless", "wifi-iface", section_name(((struct wifi_ssid_args *)data)->wifi_ssid_sec), &dmmap_section); - dmuci_delete_by_section(dmmap_section, NULL, NULL); - dmuci_delete_by_section(((struct wifi_ssid_args *)data)->wifi_ssid_sec, NULL, NULL); - break; - case DEL_ALL: - uci_foreach_sections("wireless", "wifi-iface", s) { - if (found != 0) { - get_dmmap_section_of_config_section("dmmap_wireless", "wifi-iface", section_name(ss), &dmmap_section); - dmuci_delete_by_section(dmmap_section, NULL, NULL); - dmuci_delete_by_section(ss, NULL, NULL); - } - ss = s; - found++; - } - if (ss != NULL) { - get_dmmap_section_of_config_section("dmmap_wireless", "wifi-iface", section_name(ss), &dmmap_section); - dmuci_delete_by_section(dmmap_section, NULL, NULL); - dmuci_delete_by_section(ss, 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; - - char *instancepara = get_last_instance_lev2_bbfdm("wireless", "wifi-iface", "dmmap_wireless", "endpointinstance", "mode", "sta"); - if (!instancepara) - instancepara = "0"; - - 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"); // Sould 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)); - *instance = update_instance(instancepara, 2, dmmap_sec, "endpointinstance"); - return 0; -} - -static int delObjWiFiEndPoint(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) -{ - struct uci_section *s = NULL, *dmmap_section = NULL; - - switch (del_action) { - case DEL_INST: - get_dmmap_section_of_config_section("dmmap_wireless", "wifi-iface", section_name(((struct wifi_ssid_args *)data)->wifi_ssid_sec), &dmmap_section); - dmuci_set_value_by_section(((struct wifi_enp_args *)data)->wifi_enp_sec, "endpointinstance", ""); - dmuci_set_value_by_section(((struct wifi_enp_args *)data)->wifi_enp_sec, "mode", ""); - break; - case DEL_ALL: - uci_foreach_sections("wireless", "wifi-iface", s) { - - char *mode; - dmuci_get_value_by_section_string(s, "mode", &mode); - if (strcmp(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) -{ - char *inst = NULL, *max_inst = NULL; - struct wifi_radio_args curr_wifi_radio_args = {0}; - struct dmmap_dup *p = NULL; - LIST_HEAD(dup_list); - - synchronize_specific_config_sections_with_dmmap("wireless", "wifi-device", "dmmap_wireless", &dup_list); - list_for_each_entry(p, &dup_list, list) { - init_wifi_radio(&curr_wifi_radio_args, p->config_section); - - inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3, - p->dmmap_section, "radioinstance", "radioalias"); - - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_wifi_radio_args, inst) == DM_STOP) - break; - } - free_dmmap_config_dup_list(&dup_list); - return 0; -} - -/*#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) -{ - char *inst = NULL, *max_inst = NULL, *ifname = NULL, *linker; - struct wifi_ssid_args curr_wifi_ssid_args = {0}; - struct dmmap_dup *p = NULL; - LIST_HEAD(dup_list); - - synchronize_specific_config_sections_with_dmmap("wireless", "wifi-iface", "dmmap_wireless", &dup_list); - list_for_each_entry(p, &dup_list, list) { - dmuci_get_value_by_section_string(p->config_section, "device", &linker); -#ifdef GENERIC_OPENWRT - ifname = get_device_from_wifi_iface(linker, section_name(p->config_section)); -#else - dmuci_get_value_by_section_string(p->config_section, "ifname", &ifname); -#endif - init_wifi_ssid(&curr_wifi_ssid_args, p->config_section, ifname, linker); - - inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3, - p->dmmap_section, "ssidinstance", "ssidalias"); - - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_wifi_ssid_args, inst) == DM_STOP) - break; - } - free_dmmap_config_dup_list(&dup_list); - 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) -{ - char *inst = NULL, *ifname, *max_inst = NULL, *mode = NULL; - struct wifi_acp_args curr_wifi_acp_args = {0}; - struct dmmap_dup *p = NULL; - LIST_HEAD(dup_list); - - synchronize_specific_config_sections_with_dmmap("wireless", "wifi-iface", "dmmap_wireless", &dup_list); - list_for_each_entry(p, &dup_list, list) { - dmuci_get_value_by_section_string(p->config_section, "mode", &mode); - if ((strlen(mode)>0 || mode[0] != '\0') && strcmp(mode, "ap") != 0) - continue; - dmuci_get_value_by_section_string(p->config_section, "ifname", &ifname); - init_wifi_acp(&curr_wifi_acp_args, p->config_section, ifname); - - inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3, - p->dmmap_section, "ap_instance", "ap_alias"); - - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_wifi_acp_args, 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) -{ - char *inst = NULL, *ifname, *max_inst = NULL, *mode = NULL; - struct wifi_enp_args curr_wifi_enp_args = {0}; - struct dmmap_dup *p = NULL; - LIST_HEAD(dup_list); - - synchronize_specific_config_sections_with_dmmap("wireless", "wifi-iface", "dmmap_wireless", &dup_list); - list_for_each_entry(p, &dup_list, list) { - - dmuci_get_value_by_section_string(p->config_section, "mode", &mode); - if (strcmp(mode, "sta") != 0) - continue; - - dmuci_get_value_by_section_string(p->config_section, "ifname", &ifname); - init_wifi_enp(&curr_wifi_enp_args, p->config_section, ifname); - - inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3, - p->dmmap_section, "endpointinstance", "endpointalias"); - - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_wifi_enp_args, 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 *max_inst = NULL, *ep_instance = NULL; - struct wifi_enp_args *ep_args = (struct wifi_enp_args *)prev_data; - struct uci_section *dmmap_section = NULL; - - get_dmmap_section_of_config_section("dmmap_wireless", "wifi-iface", section_name(ep_args->wifi_enp_sec), &dmmap_section); - dmuci_get_value_by_section_string(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); - - handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 3, - s, "ep_profile_instance", "ep_profile_alias"); - - DM_LINK_INST_OBJ(dmctx, parent_node, ep_args->wifi_enp_sec, "1"); - return 0; -} - -int set_neighboring_wifi_diagnostics_diagnostics_state(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +static int set_neighboring_wifi_diagnostics_diagnostics_state(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) { struct uci_section *ss = NULL; @@ -2157,7 +2228,7 @@ int set_neighboring_wifi_diagnostics_diagnostics_state(char *refparam, struct dm case VALUESET: if (strcmp(value, "Requested") == 0) { uci_foreach_sections("wireless", "wifi-device", ss) - os__wifi_start_scan(section_name(ss)); + wifi_start_scan(section_name(ss)); dmubus_call_set("tr069", "inform", UBUS_ARGS{{"event", "8 DIAGNOSTICS COMPLETE", String}}, 1); } @@ -2166,15 +2237,1828 @@ int set_neighboring_wifi_diagnostics_diagnostics_state(char *refparam, struct dm 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", ((struct wifi_ssid_args *)data)->ifname); + dmubus_call(object, "status", UBUS_ARGS{}, 0, &res); + DM_ASSERT(res, *value = ""); + *value = dmjson_get_value(res, 1, "bssid"); + return 0; +} + +static int ssid_read_ubus(const struct wifi_ssid_args *args, const char *name, char **value) +{ + json_object *res = NULL; + char object[32]; + + snprintf(object, sizeof(object), "wifi.ap.%s", args->ifname); + dmubus_call(object, "stats", UBUS_ARGS{}, 0, &res); + DM_ASSERT(res, *value = "0"); + *value = dmjson_get_value(res, 1, name); + return 0; +} + +static int radio_read_ubus(const struct wifi_radio_args *args, const char *name, char **value) +{ + json_object *res = NULL; + char object[32]; + + snprintf(object, sizeof(object), "wifi.radio.%s", section_name(args->wifi_radio_sec)); + dmubus_call(object, "stats", UBUS_ARGS{}, 0, &res); + DM_ASSERT(res, *value = "0"); + *value = dmjson_get_value(res, 1, name); + 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((json_object *)data, 1, "noise"); + return 0; +} + +/*#Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}.MACAddress!UBUS:wifi.ap.@Name/stations//stations[i-1].macaddr*/ +static int get_WiFiAccessPointAssociatedDevice_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "macaddr"); + return 0; +} + +/*#Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}.LastDataDownlinkRate!UBUS:wifi.ap.@Name/stations//stations[i-1].stats.rx_rate_latest.rate*/ +static int get_WiFiAccessPointAssociatedDevice_LastDataDownlinkRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + char *rate_mbps = dmjson_get_value((json_object *)data, 3, "stats", "rx_rate_latest", "rate"); + unsigned int rate_kbps = (rate_mbps && *rate_mbps != '\0') ? atoi(rate_mbps) * 1000 : 1000; + + dmasprintf(value, "%u", 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((json_object *)data, 3, "stats", "tx_rate_latest", "rate"); + unsigned int rate_kbps = (rate_mbps && *rate_mbps != '\0') ? atoi(rate_mbps) * 1000 : 1000; + + dmasprintf(value, "%u", 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((json_object *)data, 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((json_object *)data, 1, "in_network"); + if (in_network && *in_network != '\0' && atoi(in_network) > 0) { + time_t t_time = time(NULL) - atoi(in_network); + if (localtime(&t_time) == NULL) + return -1; + + char local_time[32] = {0}; + + if (strftime(local_time, sizeof(local_time), "%Y-%m-%dT%H:%M:%SZ", localtime(&t_time)) == 0) + return -1; + + *value = dmstrdup(local_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((json_object *)data, 2, "stats", "tx_total_bytes"); + return 0; +} + +/*#Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}.Stats.BytesReceived!UBUS:wifi.ap.@Name/stations//stations[i-1].stats.rx_data_bytes*/ +static int get_access_point_associative_device_statistics_rx_bytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 2, "stats", "rx_data_bytes"); + return 0; +} + +/*#Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}.Stats.PacketsSent!UBUS:wifi.ap.@Name/stations//stations[i-1].stats.tx_total_pkts*/ +static int get_access_point_associative_device_statistics_tx_packets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 2, "stats", "tx_total_pkts"); + return 0; +} + +/*#Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}.Stats.PacketsReceived!UBUS:wifi.ap.@Name/stations//stations[i-1].stats.rx_data_pkts*/ +static int get_access_point_associative_device_statistics_rx_packets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 2, "stats", "rx_data_pkts"); + return 0; +} + +/*#Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}.Stats.ErrorsSent!UBUS:wifi.ap.@Name/stations//stations[i-1].stats.tx_failures*/ +static int get_access_point_associative_device_statistics_tx_errors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 2, "stats", "tx_failures"); + return 0; +} + +/*#Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}.Stats.RetransCount!UBUS:wifi.ap.@Name/stations//stations[i-1].stats.tx_pkts_retries*/ +static int get_access_point_associative_device_statistics_retrans_count(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 2, "stats", "tx_pkts_retries"); + 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; + char object[32], *status = NULL, *iface; + + dmuci_get_value_by_section_string(((struct wifi_ssid_args *)data)->wifi_ssid_sec, "device", &iface); + snprintf(object, sizeof(object), "wifi.ap.%s", iface); + dmubus_call(object, "status", UBUS_ARGS{}, 0, &res); + DM_ASSERT(res, status = "Error_Misconfigured"); + status = dmjson_get_value(res, 1, "status"); + + if (strcmp(status, "running") == 0 || strcmp(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[32]; + + snprintf(object, sizeof(object), "wifi.radio.%s", section_name(((struct wifi_radio_args *)data)->wifi_radio_sec)); + dmubus_call(object, "status", UBUS_ARGS{}, 0, &res); + DM_ASSERT(res, *value = "0"); + *value = dmjson_get_value(res, 1, "maxrate"); + 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[32]; + + snprintf(object, sizeof(object), "wifi.radio.%s", section_name(((struct wifi_radio_args *)data)->wifi_radio_sec)); + dmubus_call(object, "status", UBUS_ARGS{}, 0, &res); + DM_ASSERT(res, *value = ""); + *value = dmjson_get_value(res, 1, "band"); + 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[32]; + + snprintf(object, sizeof(object), "wifi.radio.%s", section_name(((struct wifi_radio_args *)data)->wifi_radio_sec)); + dmubus_call(object, "status", UBUS_ARGS{}, 0, &res); + DM_ASSERT(res, *value = "2.4GHz,5GHz"); + *value = dmjson_get_value_array_all(res, ",", 1, "supp_bands"); + return 0; +} + +/*#Device.WiFi.Radio.{i}.ChannelsInUse!UCI:wireless/wifi-device,@i-1/channel*/ +static int get_radio_channel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + json_object *res = NULL; + + dmuci_get_value_by_section_string(((struct wifi_radio_args *)data)->wifi_radio_sec, "channel", value); + if (strcmp(*value, "auto") == 0 || (*value)[0] == '\0') { + char object[32]; + snprintf(object, sizeof(object), "wifi.radio.%s", section_name(((struct wifi_radio_args *)data)->wifi_radio_sec)); + dmubus_call(object, "status", UBUS_ARGS{}, 0, &res); + DM_ASSERT(res, *value = "1"); + *value = dmjson_get_value(res, 1, "channel"); + } + return 0; +} + +static int get_neighboring_wifi_diagnostics_diagnostics_state(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct uci_section *ss = NULL; + json_object *res = NULL, *neighboring_wifi_obj = NULL; + char object[32]; + + *value = "None"; + uci_foreach_sections("wireless", "wifi-device", ss) { + snprintf(object, sizeof(object), "wifi.radio.%s", section_name(ss)); + dmubus_call(object, "scanresults", UBUS_ARGS{}, 0, &res); + DM_ASSERT(res, *value = "None"); + neighboring_wifi_obj = dmjson_select_obj_in_array_idx(res, 0, 1, "accesspoints"); + if (neighboring_wifi_obj) { + *value = "Complete"; + break; + } else + *value = "None"; + } + return 0; +} + +static int get_neighboring_wifi_diagnostics_result_number_entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct uci_section *ss = NULL; + json_object *res = NULL, *accesspoints = NULL; + size_t entries = 0, result = 0; + char object[32]; + *value = "0"; + + uci_foreach_sections("wireless", "wifi-device", ss) { + snprintf(object, sizeof(object), "wifi.radio.%s", section_name(ss)); + dmubus_call(object, "scanresults", UBUS_ARGS{}, 0, &res); + if (res) { + json_object_object_get_ex(res, "accesspoints", &accesspoints); + entries = (accesspoints) ? json_object_array_length(accesspoints) : 0; + } + result = result + entries; + entries = 0; + } + dmasprintf(value, "%d", result); // MEM WILL BE FREED IN DMMEMCLEAN + 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) +{ + *value = dmjson_get_value((json_object *)data, 1, "ssid"); + 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) +{ + *value = dmjson_get_value((json_object *)data, 1, "bssid"); + 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) +{ + *value = dmjson_get_value((json_object *)data, 1, "channel"); + 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) +{ + *value = dmjson_get_value((json_object *)data, 1, "rssi"); + 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) +{ + *value = dmjson_get_value((json_object *)data, 1, "band"); + 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) +{ + *value = dmjson_get_value((json_object *)data, 1, "noise"); + 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, *supp_channels = NULL, *arrobj = NULL; + char object[32], *cur_opclass = NULL; + int i = 0; + + snprintf(object, sizeof(object), "wifi.radio.%s", section_name(((struct wifi_radio_args *)data)->wifi_radio_sec)); + dmubus_call(object, "status", UBUS_ARGS{}, 0, &res); + DM_ASSERT(res, *value = ""); + cur_opclass = dmjson_get_value(res, 1, "opclass"); + dmjson_foreach_obj_in_array(res, arrobj, supp_channels, i, 1, "supp_channels") { + char *opclass = dmjson_get_value(supp_channels, 1, "opclass"); + if (opclass && strcmp(opclass, cur_opclass) != 0) + continue; + + *value = dmjson_get_value_array_all(supp_channels, ",", 1, "channels"); + break; + } + 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, *supp_channels = NULL, *arrobj = NULL; + char object[32], *bandwidth = NULL, *bandwidth_list = ""; + int i = 0; + + snprintf(object, sizeof(object), "wifi.radio.%s", section_name(((struct wifi_radio_args *)data)->wifi_radio_sec)); + dmubus_call(object, "status", UBUS_ARGS{}, 0, &res); + DM_ASSERT(res, *value = "Auto"); + dmjson_foreach_obj_in_array(res, arrobj, supp_channels, i, 1, "supp_channels") { + bandwidth = dmjson_get_value(supp_channels, 1, "bandwidth"); + if (bandwidth && !strstr(bandwidth_list, !strcmp(bandwidth, "8080") ? "80+80" : !strcmp(bandwidth, "80") ? ",80MHz" : bandwidth)) { + if (*bandwidth_list == '\0') + dmasprintf(&bandwidth_list, "%sMHz", !strcmp(bandwidth, "8080") ? "80+80" : bandwidth); + else { + char *tmp = dmstrdup(bandwidth_list); + dmfree(bandwidth_list); + dmasprintf(&bandwidth_list, "%s,%sMHz", tmp, !strcmp(bandwidth, "8080") ? "80+80" : bandwidth); + dmfree(tmp); + } + } + } + *value = bandwidth_list; + 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; + char object[32], *bandwidth = NULL; + + snprintf(object, sizeof(object), "wifi.radio.%s", section_name(((struct wifi_radio_args *)data)->wifi_radio_sec)); + dmubus_call(object, "status", UBUS_ARGS{}, 0, &res); + DM_ASSERT(res, *value = "20MHz"); + bandwidth = dmjson_get_value(res, 1, "bandwidth"); + if (bandwidth) + dmasprintf(value, "%sMHz", bandwidth); + 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 uci_section *ss = NULL; + json_object *res = NULL, *accesspoints = NULL, *arrobj = NULL; + char object[32], *inst = NULL, *max_inst = NULL; + int id = 0, i = 0; + + uci_foreach_sections("wireless", "wifi-device", ss) { + snprintf(object, sizeof(object), "wifi.radio.%s", section_name(ss)); + dmubus_call(object, "scanresults", UBUS_ARGS{}, 0, &res); + if (res) { + dmjson_foreach_obj_in_array(res, arrobj, accesspoints, i, 1, "accesspoints") { + inst = handle_update_instance(1, dmctx, &max_inst, update_instance_without_section, 1, ++id); + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)accesspoints, inst) == DM_STOP) + return 0; + } + } + } + return 0; +} + +static int get_radio_standards(struct uci_section *section, char **value) +{ + json_object *res; + char object[32], *standard = NULL; + char **standards = NULL, *str_append = NULL; + int i; + size_t length; + + snprintf(object, sizeof(object), "wifi.radio.%s", section_name(section)); + dmubus_call(object, "status", UBUS_ARGS{}, 0, &res); + DM_ASSERT(res, *value = "n,ax"); + + standard = dmjson_get_value(res, 1, "standard"); + standards = strsplit(standard, "/", &length); + + for (i = 0; i < length; i++) { + if (strstr(standards[i], "802.11") == standards[i]) + str_append = dmstrdup(strstr(standards[i], "802.11") + strlen("802.11")); + else + str_append = dmstrdup(standards[i]); + if (strlen(*value) == 0){ + dmasprintf(value, "%s", str_append); + continue; + } + dmasprintf(value, "%s,%s", *value, str_append); + FREE(str_append); + } + + return 0; +} + +/*#Device.WiFi.Radio.{i}.SupportedStandards!UBUS:wifi.radio.@Name/status//standard*/ +static int get_radio_supported_standard(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + return get_radio_standards(((struct wifi_radio_args *)data)->wifi_radio_sec, value); +} + +/*#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) +{ + return get_radio_standards(((struct wifi_radio_args *)data)->wifi_radio_sec, value); +} + +static int get_access_point_total_associations(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + json_object *res = NULL, *assoclist = NULL, *arrobj = NULL; + char object[32]; + int i = 0, entries = 0; + + snprintf(object, sizeof(object), "wifi.ap.%s", ((struct wifi_acp_args *)data)->ifname); + dmubus_call(object, "assoclist", UBUS_ARGS{}, 0, &res); + dmjson_foreach_obj_in_array(res, arrobj, assoclist, i, 1, "assoclist") { + entries++; + } + dmasprintf(value, "%d", entries); + 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, *max_inst = NULL; + int id = 0, i = 0; + + snprintf(object, sizeof(object), "wifi.ap.%s", ((struct wifi_acp_args *)prev_data)->ifname); + dmubus_call(object, "stations", UBUS_ARGS{}, 0, &res); + dmjson_foreach_obj_in_array(res, arrobj, stations, i, 1, "stations") { + inst = handle_update_instance(2, dmctx, &max_inst, update_instance_without_section, 1, ++id); + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)stations, inst) == DM_STOP) + return 0; + } + return 0; +} + +static int get_WiFiDataElementsNetwork_option(const char *option, char **value) +{ + int i = 0; + json_object *res, *data_arr = NULL, *data_obj = NULL, *net_obj = NULL; + + dmubus_call("wifi.dataelements.collector", "dump", UBUS_ARGS{}, 0, &res); + DM_ASSERT(res, *value = ""); + dmjson_foreach_obj_in_array(res, data_arr, data_obj, i, 1, "data") { + json_object_object_get_ex(data_obj, "wfa-dataelements:Network", &net_obj); + *value = dmjson_get_value(net_obj, 1, option); + } + return 0; +} + +/*#Device.WiFi.DataElements.Network.ID!UBUS:wifi.dataelements.collector/dump//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("ID", value); +} + +static int set_WiFiDataElementsNetwork_ID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, -1, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + //TODO + break; + } + return 0; +} + +/*#Device.WiFi.DataElements.Network.TimeStamp!UBUS:wifi.dataelements.collector/dump//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("TimeStamp", value); +} + +/*#Device.WiFi.DataElements.Network.ControllerID!UBUS:wifi.dataelements.collector/dump//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("ControllerID", value); +} + +static int set_WiFiDataElementsNetwork_ControllerID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, -1, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + //TODO + break; + } + return 0; +} + +/*#Device.WiFi.DataElements.Network.DeviceNumberOfEntries!UBUS:wifi.dataelements.collector/dump//data[@i-1].wfa-dataelements:Network.NumberOfDevices*/ +static int get_WiFiDataElementsNetwork_DeviceNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + int i = 0; + json_object *res, *data_arr = NULL, *data_obj = NULL, *net_obj = NULL; + + dmubus_call("wifi.dataelements.collector", "dump", UBUS_ARGS{}, 0, &res); + DM_ASSERT(res, *value = "0"); + dmjson_foreach_obj_in_array(res, data_arr, data_obj, i, 1, "data") { + json_object_object_get_ex(data_obj, "wfa-dataelements:Network", &net_obj); + *value = dmjson_get_value(net_obj, 1, "NumberOfDevices"); + } + return 0; +} + +/*#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((json_object *)data, 1, "ID"); + return 0; +} + +#if 0 +static int get_WiFiDataElementsNetworkDevice_MultiAPCapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + //TODO + return 0; +} +#endif + +/*#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((json_object *)data, 1, "CollectionInterval"); + 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((json_object *)data, 1, "NumberOfRadios"); + 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((json_object *)data, 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((json_object *)data, 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((json_object *)data, 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((json_object *)data, 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((json_object *)data, 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((json_object *)data, 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((json_object *)data, 1, "RecieveOther"); + 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((json_object *)data, 1, "NumberOfCurrOpClass"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.UnassociatedSTANumberOfEntries!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].NumberOfUnassocSta*/ +static int get_WiFiDataElementsNetworkDeviceRadio_UnassociatedSTANumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "NumberOfUnassocSta"); + 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((json_object *)data, 1, "NumberOfBSS"); + 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) +{ + int num_scanres = 0; + json_object *scanres_arr = NULL; + + json_object_object_get_ex((json_object *)data, "ScanResultList", &scanres_arr); + num_scanres = (scanres_arr) ? json_object_array_length(scanres_arr) : 0; + + dmasprintf(value, "%d", num_scanres); + 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) +{ + json_object *backsta_obj = NULL; + + if (data) { + json_object_object_get_ex((json_object *)data, "BackhaulSta", &backsta_obj); + *value = (backsta_obj) ? dmjson_get_value(backsta_obj, 1, "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) +{ + json_object *caps_obj = NULL; + + json_object_object_get_ex((json_object *)data, "Capabilites", &caps_obj); + *value = (caps_obj) ? dmjson_get_value(caps_obj, 1, "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) +{ + json_object *caps_obj = NULL; + + json_object_object_get_ex((json_object *)data, "Capabilites", &caps_obj); + *value = (caps_obj) ? dmjson_get_value(caps_obj, 1, "VHTCapabilities") : ""; + + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.Capabilities.HECapabilities!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].Capabilites.HECapabilities*/ +static int get_WiFiDataElementsNetworkDeviceRadioCapabilities_HECapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + json_object *caps_obj = NULL; + + json_object_object_get_ex((json_object *)data, "Capabilites", &caps_obj); + *value = (caps_obj) ? dmjson_get_value(caps_obj, 1, "HECapabilities") : ""; + + 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) +{ + json_object *caps_obj = NULL; + + json_object_object_get_ex((json_object *)data, "Capabilites", &caps_obj); + *value = (caps_obj) ? dmjson_get_value(caps_obj, 1, "NumberOfOpClass") : "0"; + + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.Capabilities.CapableOperatingClassProfile.{i}.Class!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].Capabilites.OperatingClasses[@i-1].Class*/ +static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfile_Class(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "Class"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.Capabilities.CapableOperatingClassProfile.{i}.MaxTxPower!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].Capabilites.OperatingClasses[@i-1].MaxTxPower*/ +static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfile_MaxTxPower(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "MaxTxPower"); + 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((json_object *)data, 1, "NonOperable"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.Capabilities.CapableOperatingClassProfile.{i}.NumberOfNonOperChan!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].Capabilites.OperatingClasses[@i-1].NumberOfNonOperChan*/ +static int get_WiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfile_NumberOfNonOperChan(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "NumberOfNonOperChan"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.CurrentOperatingClassProfile.{i}.Class!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].CurrentOperatingClasses[@i-1].Class*/ +static int get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_Class(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "Class"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.CurrentOperatingClassProfile.{i}.Channel!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].CurrentOperatingClasses[@i-1].Channel*/ +static int get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_Channel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "Channel"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.CurrentOperatingClassProfile.{i}.TxPower!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].CurrentOperatingClasses[@i-1].TxPower*/ +static int get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_TxPower(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "TxPower"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.CurrentOperatingClassProfile.{i}.TimeStamp!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].CurrentOperatingClasses[@i-1].TimeStamp*/ +static int get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "TimeStamp"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.BSSID!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].BSSID*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSS_BSSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "BSSID"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.SSID!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].SSID*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSS_SSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "SSID"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.Enabled!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].Enabled*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSS_Enabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "Enabled"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.LastChange!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].LastChange*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSS_LastChange(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "LastChange"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.TimeStamp!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].TimeStamp*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSS_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "TimeStamp"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.UnicastBytesSent!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].UnicastBytesSent*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSS_UnicastBytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "UnicastBytesSent"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.UnicastBytesReceived!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].UnicastBytesReceived*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSS_UnicastBytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "UnicastBytesReceived"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.MulticastBytesSent!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].MulticastBytesSent*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSS_MulticastBytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "MulticastBytesSent"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.MulticastBytesReceived!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].MulticastBytesReceived*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSS_MulticastBytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "MulticastBytesReceived"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.BroadcastBytesSent!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].BroadcastBytesSent*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSS_BroadcastBytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "BroadcastBytesSent"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.BroadcastBytesReceived!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].BroadcastBytesReceived*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSS_BroadcastBytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "BroadcastBytesReceived"); + 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((json_object *)data, 1, "EstServiceParametersBE"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.EstServiceParametersBK!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].EstServiceParametersBK*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSS_EstServiceParametersBK(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "EstServiceParametersBK"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.EstServiceParametersVI!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].EstServiceParametersVI*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSS_EstServiceParametersVI(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "EstServiceParametersVI"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.EstServiceParametersVO!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].EstServiceParametersVO*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSS_EstServiceParametersVO(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "EstServiceParametersVO"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STANumberOfEntries!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].NumberofSTA*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSS_STANumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "NumberofSTA"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.MACAddress!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].MACAddress*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "MACAddress"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.TimeStamp!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].TimeStamp*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "TimeStamp"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.HTCapabilities!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].HTCapabilities*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_HTCapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "HTCapabilities"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.VHTCapabilities!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].VHTCapabilities*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_VHTCapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "VHTCapabilities"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.HECapabilities!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].HECapabilities*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_HECapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "HECapabilities"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.LastDataDownlinkRate!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].LastDataDownlinkRate*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_LastDataDownlinkRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "LastDataDownlinkRate"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.LastDataUplinkRate!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].LastDataUplinkRate*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_LastDataUplinkRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "LastDataUplinkRate"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.UtilizationReceive!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].UtilizationReceive*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_UtilizationReceive(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "UtilizationReceive"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.UtilizationTransmit!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].UtilizationTransmit*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_UtilizationTransmit(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "UtilizationTransmit"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.EstMACDataRateDownlink!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].EstMACDataRateDownlink*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_EstMACDataRateDownlink(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "EstMACDataRateDownlink"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.EstMACDataRateUplink!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].EstMACDataRateUplink*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_EstMACDataRateUplink(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "EstMACDataRateUplink"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.SignalStrength!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].SignalStrength*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_SignalStrength(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "SignalStrength"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.LastConnectTime!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].LastConnectTime*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_LastConnectTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "LastConnectTime"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.BytesSent!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].BytesSent*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "BytesSent"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.BytesReceived!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].BytesReceived*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "BytesReceived"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.PacketsSent!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].PacketsSent*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "PacketsSent"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.PacketsReceived!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].PacketsReceived*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "PacketsReceived"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.ErrorsSent!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].ErrorsSent*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_ErrorsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "ErrorsSent"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.ErrorsReceived!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].ErrorsReceived*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_ErrorsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "ErrorsReceived"); + return 0; +} + +#if 0 +static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_RetransCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + //TODO + return 0; +} +#endif + +/*#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((json_object *)data, 1, "Measurementreport"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.NumberOfMeasureReports!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].NumberOfMeasureReports*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_NumberOfMeasureReports(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "NumberOfMeasureReports"); + return 0; +} + +#if 0 +static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_IPV4Address(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + //TODO + return 0; +} + +static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_IPV6Address(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + //TODO + return 0; +} +#endif + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}.Hostname!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].STAList[@i-1].Hostname*/ +static int get_WiFiDataElementsNetworkDeviceRadioBSSSTA_Hostname(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "Hostname"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.TimeStamp!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].ScanResultList[@i-1].TimeStamp*/ +static int get_WiFiDataElementsNetworkDeviceRadioScanResult_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "TimeStamp"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.OpClassScanNumberOfEntries!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].ScanResultList[@i-1].NumberOfOpClassScans*/ +static int get_WiFiDataElementsNetworkDeviceRadioScanResult_OpClassScanNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "NumberOfOpClassScans"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.OpClassScan.{i}.OperatingClass!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].ScanResultList[@i-1].OpClassScanList[@i-1].OperatingClass*/ +static int get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScan_OperatingClass(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "OperatingClass"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.OpClassScan.{i}.ChannelScanNumberOfEntries!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].ScanResultList[@i-1].OpClassScanList[@i-1].NumberOfChannelScans*/ +static int get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScan_ChannelScanNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "NumberOfChannelScans"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.OpClassScan.{i}.ChannelScan.{i}.Channel!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].ScanResultList[@i-1].OpClassScanList[@i-1].ChannelScanList[@i-1].Channel*/ +static int get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_Channel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "Channel"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.OpClassScan.{i}.ChannelScan.{i}.TimeStamp!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].ScanResultList[@i-1].OpClassScanList[@i-1].ChannelScanList[@i-1].TimeStamp*/ +static int get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "TimeStamp"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.OpClassScan.{i}.ChannelScan.{i}.Utilization!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].ScanResultList[@i-1].OpClassScanList[@i-1].ChannelScanList[@i-1].Utilization*/ +static int get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_Utilization(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "Utilization"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.OpClassScan.{i}.ChannelScan.{i}.Noise!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].ScanResultList[@i-1].OpClassScanList[@i-1].ChannelScanList[@i-1].Noise*/ +static int get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_Noise(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "Noise"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.OpClassScan.{i}.ChannelScan.{i}.NeighborBSSNumberOfEntries!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].ScanResultList[@i-1].OpClassScanList[@i-1].ChannelScanList[@i-1].NumberofNeighbors*/ +static int get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_NeighborBSSNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "NumberofNeighbors"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.OpClassScan.{i}.ChannelScan.{i}.NeighborBSS.{i}.BSSID!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].ScanResultList[@i-1].OpClassScanList[@i-1].ChannelScanList[@i-1].NeighborList[@i-1].BSSID*/ +static int get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_BSSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "BSSID"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.OpClassScan.{i}.ChannelScan.{i}.NeighborBSS.{i}.SSID!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].ScanResultList[@i-1].OpClassScanList[@i-1].ChannelScanList[@i-1].NeighborList[@i-1].SSID*/ +static int get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_SSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "SSID"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.OpClassScan.{i}.ChannelScan.{i}.NeighborBSS.{i}.SignalStrength!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].ScanResultList[@i-1].OpClassScanList[@i-1].ChannelScanList[@i-1].NeighborList[@i-1].SignalStrengh*/ +static int get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_SignalStrength(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "SignalStrengh"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.OpClassScan.{i}.ChannelScan.{i}.NeighborBSS.{i}.ChannelBandwidth!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].ScanResultList[@i-1].OpClassScanList[@i-1].ChannelScanList[@i-1].NeighborList[@i-1].ChannelBandwidth*/ +static int get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_ChannelBandwidth(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "ChannelBandwidth"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.OpClassScan.{i}.ChannelScan.{i}.NeighborBSS.{i}.ChannelUtilization!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].ScanResultList[@i-1].OpClassScanList[@i-1].ChannelScanList[@i-1].NeighborList[@i-1].ChannelUtilization*/ +static int get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_ChannelUtilization(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "ChannelUtilization"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}.OpClassScan.{i}.ChannelScan.{i}.NeighborBSS.{i}.StationCount!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].BSSList[@i-1].ScanResultList[@i-1].OpClassScanList[@i-1].ChannelScanList[@i-1].NeighborList[@i-1].StationCount*/ +static int get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_StationCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "StationCount"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.UnassociatedSTA.{i}.MACAddress!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].UnassociatedStaList[@i-1].MACAddress*/ +static int get_WiFiDataElementsNetworkDeviceRadioUnassociatedSTA_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "MACAddress"); + return 0; +} + +/*#Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.UnassociatedSTA.{i}.SignalStrength!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.DeviceList[@i-1].RadioList[@i-1].UnassociatedStaList[@i-1].SignalStrength*/ +static int get_WiFiDataElementsNetworkDeviceRadioUnassociatedSTA_SignalStrength(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmjson_get_value((json_object *)data, 1, "SignalStrength"); + return 0; +} + +static int get_WiFiDataElementsAssociationEvent_AssociationEventDataNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + json_object *res = NULL, *notify_arr = NULL, *notify_obj = NULL, *assoc_ev = NULL; + int num_assoc_ev = 0, i = 0; + + dmubus_call("wifi.dataelements.collector", "event", UBUS_ARGS{}, 0, &res); + dmjson_foreach_obj_in_array(res, notify_arr, notify_obj, i, 1, "notification") { + if (json_object_object_get_ex(notify_obj, "wfa-dataelements:AssociationEvent", &assoc_ev)) { + num_assoc_ev++; + } + } + + dmasprintf(value, "%d", num_assoc_ev); + return 0; +} + +static int get_WiFiDataElementsAssociationEventAssociationEventData_BSSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + json_object *assoc_ev = NULL, *assoc_data = NULL; + + if (data) { + if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:AssociationEvent", &assoc_ev)) { + if (json_object_object_get_ex(assoc_ev, "AssocData", &assoc_data)) + *value = dmjson_get_value(assoc_data, 1, "BSSID"); + } + } + return 0; +} + +static int get_WiFiDataElementsAssociationEventAssociationEventData_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + json_object *assoc_ev = NULL, *assoc_data = NULL; + + if (data) { + if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:AssociationEvent", &assoc_ev)) { + if (json_object_object_get_ex(assoc_ev, "AssocData", &assoc_data)) + *value = dmjson_get_value(assoc_data, 1, "MACAddress"); + } + } + return 0; +} + +static int get_WiFiDataElementsAssociationEventAssociationEventData_StatusCode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + json_object *assoc_ev = NULL, *assoc_data = NULL; + + if (data) { + if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:AssociationEvent", &assoc_ev)) { + if (json_object_object_get_ex(assoc_ev, "AssocData", &assoc_data)) + *value = dmjson_get_value(assoc_data, 1, "StatusCode"); + } + } + return 0; +} + +static int get_WiFiDataElementsAssociationEventAssociationEventData_HTCapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + json_object *assoc_ev = NULL, *assoc_data = NULL; + + if (data) { + if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:AssociationEvent", &assoc_ev)) { + if (json_object_object_get_ex(assoc_ev, "AssocData", &assoc_data)) + *value = dmjson_get_value(assoc_data, 1, "HTCapabilities"); + } + } + return 0; +} + +static int get_WiFiDataElementsAssociationEventAssociationEventData_VHTCapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + json_object *assoc_ev = NULL, *assoc_data = NULL; + + if (data) { + if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:AssociationEvent", &assoc_ev)) { + if (json_object_object_get_ex(assoc_ev, "AssocData", &assoc_data)) + *value = dmjson_get_value(assoc_data, 1, "VHTCapabilities"); + } + } + return 0; +} + +static int get_WiFiDataElementsAssociationEventAssociationEventData_HECapabilities(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + json_object *assoc_ev = NULL, *assoc_data = NULL; + + if (data) { + if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:AssociationEvent", &assoc_ev)) { + if (json_object_object_get_ex(assoc_ev, "AssocData", &assoc_data)) + *value = dmjson_get_value(assoc_data, 1, "HECapabilities"); + } + } + return 0; +} + +static int get_WiFiDataElementsAssociationEventAssociationEventData_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + json_object *assoc_ev = NULL; + + if (data) { + if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:AssociationEvent", &assoc_ev)) { + *value = dmjson_get_value((json_object *)data, 1, "eventTime"); + } + } + return 0; +} + +static int get_WiFiDataElementsDisassociationEvent_DisassociationEventDataNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + json_object *res = NULL, *notify_arr = NULL, *notify_obj = NULL, *disassoc_ev = NULL; + int num_disassoc_ev = 0, i = 0; + + dmubus_call("wifi.dataelements.collector", "event", UBUS_ARGS{}, 0, &res); + dmjson_foreach_obj_in_array(res, notify_arr, notify_obj, i, 1, "notification") { + if (json_object_object_get_ex(notify_obj, "wfa-dataelements:DisassociationEvent", &disassoc_ev)) { + num_disassoc_ev++; + } + } + dmasprintf(value, "%d", num_disassoc_ev); + return 0; +} + +static int get_WiFiDataElementsDisassociationEventDisassociationEventData_BSSID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + json_object *disassoc_ev = NULL, *disassoc_data = NULL; + + if (data) { + if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:DisassociationEvent", &disassoc_ev)) { + if (json_object_object_get_ex(disassoc_ev, "DisassocData", &disassoc_data)) + *value = dmjson_get_value(disassoc_data, 1, "BSSID"); + } + } + return 0; +} + +static int get_WiFiDataElementsDisassociationEventDisassociationEventData_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + json_object *disassoc_ev = NULL, *disassoc_data = NULL; + + if (data) { + if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:DisassociationEvent", &disassoc_ev)) { + if (json_object_object_get_ex(disassoc_ev, "DisassocData", &disassoc_data)) + *value = dmjson_get_value(disassoc_data, 1, "MACAddress"); + } + } + return 0; +} + +static int get_WiFiDataElementsDisassociationEventDisassociationEventData_ReasonCode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + json_object *disassoc_ev = NULL, *disassoc_data = NULL; + + if (data) { + if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:DisassociationEvent", &disassoc_ev)) { + if (json_object_object_get_ex(disassoc_ev, "DisassocData", &disassoc_data)) + *value = dmjson_get_value(disassoc_data, 1, "ReasonCode"); + } + } + return 0; +} + +static int get_WiFiDataElementsDisassociationEventDisassociationEventData_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + json_object *disassoc_ev = NULL, *disassoc_data = NULL; + + if (data) { + if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:DisassociationEvent", &disassoc_ev)) { + if (json_object_object_get_ex(disassoc_ev, "DisassocData", &disassoc_data)) + *value = dmjson_get_value(disassoc_data, 1, "BytesSent"); + } + } + return 0; +} + +static int get_WiFiDataElementsDisassociationEventDisassociationEventData_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + json_object *disassoc_ev = NULL, *disassoc_data = NULL; + + if (data) { + if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:DisassociationEvent", &disassoc_ev)) { + if (json_object_object_get_ex(disassoc_ev, "DisassocData", &disassoc_data)) + *value = dmjson_get_value(disassoc_data, 1, "BytesReceived"); + } + } + return 0; +} + +static int get_WiFiDataElementsDisassociationEventDisassociationEventData_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + json_object *disassoc_ev = NULL, *disassoc_data = NULL; + + if (data) { + if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:DisassociationEvent", &disassoc_ev)) { + if (json_object_object_get_ex(disassoc_ev, "DisassocData", &disassoc_data)) + *value = dmjson_get_value(disassoc_data, 1, "PacketsSent"); + } + } + return 0; +} + +static int get_WiFiDataElementsDisassociationEventDisassociationEventData_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + json_object *disassoc_ev = NULL, *disassoc_data = NULL; + + if (data) { + if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:DisassociationEvent", &disassoc_ev)) { + if (json_object_object_get_ex(disassoc_ev, "DisassocData", &disassoc_data)) + *value = dmjson_get_value(disassoc_data, 1, "PacketsReceived"); + } + } + return 0; +} + +static int get_WiFiDataElementsDisassociationEventDisassociationEventData_ErrorsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + json_object *disassoc_ev = NULL, *disassoc_data = NULL; + + if (data) { + if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:DisassociationEvent", &disassoc_ev)) { + if (json_object_object_get_ex(disassoc_ev, "DisassocData", &disassoc_data)) + *value = dmjson_get_value(disassoc_data, 1, "ErrorsSent"); + } + } + return 0; +} + +static int get_WiFiDataElementsDisassociationEventDisassociationEventData_ErrorsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + json_object *disassoc_ev = NULL, *disassoc_data = NULL; + + if (data) { + if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:DisassociationEvent", &disassoc_ev)) { + if (json_object_object_get_ex(disassoc_ev, "DisassocData", &disassoc_data)) + *value = dmjson_get_value(disassoc_data, 1, "ErrorsReceived"); + } + } + return 0; +} + +static int get_WiFiDataElementsDisassociationEventDisassociationEventData_RetransCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + json_object *disassoc_ev = NULL, *disassoc_data = NULL; + + if (data) { + if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:DisassociationEvent", &disassoc_ev)) { + if (json_object_object_get_ex(disassoc_ev, "DisassocData", &disassoc_data)) + *value = dmjson_get_value(disassoc_data, 1, "RetransCount"); + } + } + return 0; +} + +static int get_WiFiDataElementsDisassociationEventDisassociationEventData_TimeStamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + json_object *disassoc_ev = NULL; + + if (data) { + if (json_object_object_get_ex((json_object *)data, "wfa-dataelements:DisassociationEvent", &disassoc_ev)) { + *value = dmjson_get_value((json_object *)data, 1, "eventTime"); + } + } + return 0; +} + +/************************************************************* + * ENTRY METHOD + **************************************************************/ +static int browseWiFiDataElementsNetworkDeviceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) +{ + int i = 0, j = 0, id = 0; + char *inst = NULL, *max_inst = NULL; + json_object *res = NULL, *data_arr = NULL, *data_obj = NULL, *net_obj = NULL; + json_object *dev_arr = NULL, *dev_obj = NULL; + + dmubus_call("wifi.dataelements.collector", "dump", UBUS_ARGS{}, 0, &res); + dmjson_foreach_obj_in_array(res, data_arr, data_obj, i, 1, "data") { + json_object_object_get_ex(data_obj, "wfa-dataelements:Network", &net_obj); + dmjson_foreach_obj_in_array(net_obj, dev_arr, dev_obj, j, 1, "DeviceList") { + inst = handle_update_instance(1, dmctx, &max_inst, update_instance_without_section, 1, ++id); + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)dev_obj, inst) == DM_STOP) + break; + } + } + return 0; +} + +static int browseWiFiDataElementsNetworkDeviceRadioInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) +{ + json_object *radio_arr = NULL, *radio_obj = NULL; + char *inst = NULL, *max_inst = NULL; + int id = 0, i = 0; + + dmjson_foreach_obj_in_array((json_object *)prev_data, radio_arr, radio_obj, i, 1, "RadioList") { + inst = handle_update_instance(2, dmctx, &max_inst, update_instance_without_section, 1, ++id); + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)radio_obj, 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; + char *inst = NULL, *max_inst = NULL; + int id = 0, i = 0; + + dmjson_foreach_obj_in_array((json_object *)prev_data, opclass_arr, opclass_obj, i, 1, "CurrentOperatingClasses") { + inst = handle_update_instance(3, dmctx, &max_inst, update_instance_without_section, 1, ++id); + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)opclass_obj, 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; + char *inst = NULL, *max_inst = NULL; + int id = 0, i = 0; + + dmjson_foreach_obj_in_array((json_object *)prev_data, bss_arr, bss_obj, i, 1, "BSSList") { + inst = handle_update_instance(3, dmctx, &max_inst, update_instance_without_section, 1, ++id); + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)bss_obj, 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; + char *inst = NULL, *max_inst = NULL; + int id = 0, i = 0; + + dmjson_foreach_obj_in_array((json_object *)prev_data, scanres_arr, scanres_obj, i, 1, "ScanResultList") { + inst = handle_update_instance(3, dmctx, &max_inst, update_instance_without_section, 1, ++id); + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)scanres_obj, inst) == DM_STOP) + break; + } + 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; + char *inst = NULL, *max_inst = NULL; + int id = 0, i = 0; + + dmjson_foreach_obj_in_array((json_object *)prev_data, unassoc_arr, unassoc_obj, i, 1, "UnassociatedStaList") { + inst = handle_update_instance(3, dmctx, &max_inst, update_instance_without_section, 1, ++id); + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)unassoc_obj, inst) == DM_STOP) + break; + } + return 0; +} + +static int browseWiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfileInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) +{ + json_object *caps_obj = NULL, *opclass_arr = NULL, *opclass_obj = NULL; + char *inst = NULL, *max_inst = NULL; + int id = 0, i = 0; + + json_object_object_get_ex((json_object *)prev_data, "Capabilites", &caps_obj); + dmjson_foreach_obj_in_array(caps_obj, opclass_arr, opclass_obj, i, 1, "OperatingClasses") { + inst = handle_update_instance(3, dmctx, &max_inst, update_instance_without_section, 1, ++id); + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)opclass_obj, 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; + char *inst = NULL, *max_inst = NULL; + int id = 0, i = 0; + + dmjson_foreach_obj_in_array((json_object *)prev_data, sta_arr, sta_obj, i, 1, "STAList") { + inst = handle_update_instance(4, dmctx, &max_inst, update_instance_without_section, 1, ++id); + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)sta_obj, 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; + char *inst = NULL, *max_inst = NULL; + int id = 0, i = 0; + + dmjson_foreach_obj_in_array((json_object *)prev_data, opclass_scan_arr, opclass_scan_obj, i, 1, "OpClassScanList") { + inst = handle_update_instance(4, dmctx, &max_inst, update_instance_without_section, 1, ++id); + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)opclass_scan_obj, 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; + char *inst = NULL, *max_inst = NULL; + int id = 0, i = 0; + + dmjson_foreach_obj_in_array((json_object *)prev_data, chscan_arr, chscan_obj, i, 1, "ChannelScanList") { + inst = handle_update_instance(5, dmctx, &max_inst, update_instance_without_section, 1, ++id); + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)chscan_obj, 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; + char *inst = NULL, *max_inst = NULL; + int id = 0, i = 0; + + dmjson_foreach_obj_in_array((json_object *)prev_data, neigh_arr, neigh_obj, i, 1, "NeighborList") { + inst = handle_update_instance(6, dmctx, &max_inst, update_instance_without_section, 1, ++id); + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)neigh_obj, inst) == DM_STOP) + break; + } + return 0; +} + +static int browseWiFiDataElementsAssociationEventAssociationEventDataInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) +{ + json_object *res = NULL, *notify_arr = NULL, *notify_obj = NULL, *assoc_ev = NULL; + char *inst = NULL, *max_inst = NULL; + int id = 0, i = 0; + + dmubus_call("wifi.dataelements.collector", "event", UBUS_ARGS{}, 0, &res); + dmjson_foreach_obj_in_array(res, notify_arr, notify_obj, i, 1, "notification") { + if (json_object_object_get_ex(notify_obj, "wfa-dataelements:AssociationEvent", &assoc_ev)) { + inst = handle_update_instance(1, dmctx, &max_inst, update_instance_without_section, 1, ++id); + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)notify_obj, inst) == DM_STOP) + break; + } + } + return 0; +} + +static int browseWiFiDataElementsDisassociationEventDisassociationEventDataInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) +{ + json_object *res = NULL, *notify_arr = NULL, *notify_obj = NULL, *disassoc_ev = NULL; + char *inst = NULL, *max_inst = NULL; + int id = 0, i = 0; + + dmubus_call("wifi.dataelements.collector", "event", UBUS_ARGS{}, 0, &res); + dmjson_foreach_obj_in_array(res, notify_arr, notify_obj, i, 1, "notification") { + if (json_object_object_get_ex(notify_obj, "wfa-dataelements:DisassociationEvent", &disassoc_ev)) { + inst = handle_update_instance(1, dmctx, &max_inst, update_instance_without_section, 1, ++id); + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)notify_obj, inst) == DM_STOP) + break; + } + } + return 0; +} + /* *** Device.WiFi. *** */ DMOBJ tWiFiObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"DataElements", &DMREAD, NULL, NULL, NULL, NULL, NULL, tWiFiDataElementsObj, NULL, NULL, BBFDM_BOTH}, -{"Radio", &DMREAD, NULL, NULL, NULL, browseWifiRadioInst, NULL, tWiFiRadioObj, tWiFiRadioParams, get_linker_Wifi_Radio, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, -{"SSID", &DMWRITE, add_wifi_ssid, delete_wifi_iface, NULL, browseWifiSsidInst, NULL, tWiFiSSIDObj, tWiFiSSIDParams, get_linker_Wifi_Ssid, BBFDM_BOTH, LIST_KEY{"Name", "Alias", "BSSID", NULL}}, -{"AccessPoint", &DMWRITE, add_wifi_accesspoint, delete_wifi_iface, NULL, browseWifiAccessPointInst, NULL, tWiFiAccessPointObj, tWiFiAccessPointParams, NULL, BBFDM_BOTH, LIST_KEY{"SSIDReference", "Alias", NULL}}, -{"NeighboringWiFiDiagnostic", &DMREAD, NULL, NULL, NULL, NULL, NULL, tWiFiNeighboringWiFiDiagnosticObj, tWiFiNeighboringWiFiDiagnosticParams, NULL, BBFDM_BOTH}, -{"EndPoint", &DMWRITE, addObjWiFiEndPoint, delObjWiFiEndPoint, NULL, browseWiFiEndPointInst, NULL, tWiFiEndPointObj, tWiFiEndPointParams, NULL, BBFDM_BOTH, LIST_KEY{"SSIDReference", "Alias", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"DataElements", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiDataElementsObj, NULL, NULL, BBFDM_BOTH}, +{"Radio", &DMREAD, NULL, NULL, NULL, browseWifiRadioInst, NULL, NULL, tWiFiRadioObj, tWiFiRadioParams, get_linker_Wifi_Radio, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}}, +{"SSID", &DMWRITE, add_wifi_ssid, delete_wifi_iface, NULL, browseWifiSsidInst, NULL, NULL, tWiFiSSIDObj, tWiFiSSIDParams, get_linker_Wifi_Ssid, BBFDM_BOTH, LIST_KEY{"Name", "Alias", "BSSID", NULL}}, +{"AccessPoint", &DMWRITE, add_wifi_accesspoint, delete_wifi_iface, NULL, browseWifiAccessPointInst, NULL, NULL, tWiFiAccessPointObj, tWiFiAccessPointParams, NULL, BBFDM_BOTH, LIST_KEY{"SSIDReference", "Alias", NULL}}, +{"NeighboringWiFiDiagnostic", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiNeighboringWiFiDiagnosticObj, tWiFiNeighboringWiFiDiagnosticParams, NULL, BBFDM_BOTH}, +{"EndPoint", &DMWRITE, addObjWiFiEndPoint, delObjWiFiEndPoint, NULL, browseWiFiEndPointInst, NULL, NULL, tWiFiEndPointObj, tWiFiEndPointParams, NULL, BBFDM_BOTH, LIST_KEY{"SSIDReference", "Alias", NULL}}, {0} }; @@ -2189,8 +4073,8 @@ DMLEAF tWiFiParams[] = { /* *** Device.WiFi.Radio.{i}. *** */ DMOBJ tWiFiRadioObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiRadioStatsParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiRadioStatsParams, NULL, BBFDM_BOTH}, {0} }; @@ -2201,15 +4085,15 @@ DMLEAF tWiFiRadioParams[] = { {"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}, -{"MaxBitRate", &DMREAD, DMT_UNINT, os__get_radio_max_bit_rate, NULL, BBFDM_BOTH}, -{"OperatingFrequencyBand", &DMWRITE, DMT_STRING, os__get_radio_frequency, set_radio_frequency, BBFDM_BOTH}, -{"SupportedFrequencyBands", &DMREAD, DMT_STRING, os__get_radio_supported_frequency_bands, NULL, BBFDM_BOTH}, -{"SupportedStandards", &DMREAD, DMT_STRING, os__get_radio_supported_standard, NULL, BBFDM_BOTH}, -{"OperatingStandards", &DMWRITE, DMT_STRING, os_get_radio_operating_standard, set_radio_operating_standard, BBFDM_BOTH}, -{"ChannelsInUse", &DMREAD, DMT_STRING, os__get_radio_channel, NULL, BBFDM_BOTH}, -{"Channel", &DMWRITE, DMT_UNINT, os__get_radio_channel, set_radio_channel, BBFDM_BOTH}, +{"MaxBitRate", &DMREAD, DMT_UNINT, get_radio_max_bit_rate, NULL, BBFDM_BOTH}, +{"OperatingFrequencyBand", &DMWRITE, DMT_STRING, get_radio_frequency, set_radio_frequency, BBFDM_BOTH}, +{"SupportedFrequencyBands", &DMREAD, DMT_STRING, get_radio_supported_frequency_bands, NULL, 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_channel, 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, os__get_radio_possible_channels, NULL, 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}, @@ -2217,9 +4101,9 @@ DMLEAF tWiFiRadioParams[] = { {"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, os__get_WiFiRadio_SupportedOperatingChannelBandwidths, NULL, 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, os__get_WiFiRadio_CurrentOperatingChannelBandwidth, NULL, 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}, @@ -2231,48 +4115,48 @@ DMLEAF tWiFiRadioParams[] = { /* *** Device.WiFi.Radio.{i}.Stats. *** */ DMLEAF tWiFiRadioStatsParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"BytesSent", &DMREAD, DMT_UNLONG, os__get_WiFiRadioStats_BytesSent, NULL, BBFDM_BOTH}, -{"BytesReceived", &DMREAD, DMT_UNLONG, os__get_WiFiRadioStats_BytesReceived, NULL, BBFDM_BOTH}, -{"PacketsSent", &DMREAD, DMT_UNLONG, os__get_WiFiRadioStats_PacketsSent, NULL, BBFDM_BOTH}, -{"PacketsReceived", &DMREAD, DMT_UNLONG, os__get_WiFiRadioStats_PacketsReceived, NULL, BBFDM_BOTH}, -{"ErrorsSent", &DMREAD, DMT_UNINT, os__get_WiFiRadioStats_ErrorsSent, NULL, BBFDM_BOTH}, -{"ErrorsReceived", &DMREAD, DMT_UNINT, os__get_WiFiRadioStats_ErrorsReceived, NULL, BBFDM_BOTH}, -{"DiscardPacketsSent", &DMREAD, DMT_UNINT, os__get_WiFiRadioStats_DiscardPacketsSent, NULL, BBFDM_BOTH}, -{"DiscardPacketsReceived", &DMREAD, DMT_UNINT, os__get_WiFiRadioStats_DiscardPacketsReceived, NULL, BBFDM_BOTH}, -{"FCSErrorCount", &DMREAD, DMT_UNINT, os__get_WiFiRadioStats_FCSErrorCount, 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, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Result", &DMREAD, NULL, NULL, NULL, os__browseWifiNeighboringWiFiDiagnosticResultInst, NULL, NULL, tWiFiNeighboringWiFiDiagnosticResultParams, NULL, BBFDM_CWMP}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Result", &DMREAD, NULL, NULL, NULL, browseWifiNeighboringWiFiDiagnosticResultInst, NULL, NULL, NULL, tWiFiNeighboringWiFiDiagnosticResultParams, NULL, BBFDM_CWMP}, {0} }; DMLEAF tWiFiNeighboringWiFiDiagnosticParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"DiagnosticsState", &DMWRITE, DMT_STRING, os__get_neighboring_wifi_diagnostics_diagnostics_state, set_neighboring_wifi_diagnostics_diagnostics_state, BBFDM_CWMP}, -{"ResultNumberOfEntries", &DMREAD, DMT_UNINT, os__get_neighboring_wifi_diagnostics_result_number_entries, NULL, BBFDM_CWMP}, +{"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*/ -{"SSID", &DMREAD, DMT_STRING, os__get_neighboring_wifi_diagnostics_result_ssid, NULL, BBFDM_CWMP}, -{"BSSID", &DMREAD, DMT_STRING, os__get_neighboring_wifi_diagnostics_result_bssid, NULL, BBFDM_CWMP}, -{"Channel", &DMREAD, DMT_UNINT, os__get_neighboring_wifi_diagnostics_result_channel, NULL, BBFDM_CWMP}, -{"SignalStrength", &DMREAD, DMT_INT, os__get_neighboring_wifi_diagnostics_result_signal_strength, NULL, BBFDM_CWMP}, -{"OperatingFrequencyBand", &DMREAD, DMT_STRING, os__get_neighboring_wifi_diagnostics_result_operating_frequency_band, NULL, BBFDM_CWMP}, -{"Noise", &DMREAD, DMT_INT, os__get_neighboring_wifi_diagnostics_result_noise, 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}, {0} }; /* *** Device.WiFi.SSID.{i}. *** */ DMOBJ tWiFiSSIDObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiSSIDStatsParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiSSIDStatsParams, NULL, BBFDM_BOTH}, {0} }; @@ -2284,7 +4168,7 @@ DMLEAF tWiFiSSIDParams[] = { {"SSID", &DMWRITE, DMT_STRING, get_wlan_ssid, set_wlan_ssid, BBFDM_BOTH}, {"Name", &DMREAD, DMT_STRING, get_wlan_name, NULL, BBFDM_BOTH}, {"LowerLayers", &DMWRITE, DMT_STRING, get_ssid_lower_layer, set_ssid_lower_layer, BBFDM_BOTH}, -{"BSSID", &DMREAD, DMT_STRING, os__get_wlan_bssid, NULL, BBFDM_BOTH}, +{"BSSID", &DMREAD, DMT_STRING, get_wlan_bssid, NULL, BBFDM_BOTH}, {"MACAddress", &DMREAD, DMT_STRING, get_WiFiSSID_MACAddress, NULL, BBFDM_BOTH}, {0} }; @@ -2292,37 +4176,37 @@ DMLEAF tWiFiSSIDParams[] = { /* *** Device.WiFi.SSID.{i}.Stats. *** */ DMLEAF tWiFiSSIDStatsParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"BytesSent", &DMREAD, DMT_UNLONG, os__get_WiFiSSIDStats_BytesSent, NULL, BBFDM_BOTH}, -{"BytesReceived", &DMREAD, DMT_UNLONG, os__get_WiFiSSIDStats_BytesReceived, NULL, BBFDM_BOTH}, -{"PacketsSent", &DMREAD, DMT_UNLONG, os__get_WiFiSSIDStats_PacketsSent, NULL, BBFDM_BOTH}, -{"PacketsReceived", &DMREAD, DMT_UNLONG, os__get_WiFiSSIDStats_PacketsReceived, NULL, BBFDM_BOTH}, -{"ErrorsSent", &DMREAD, DMT_UNINT, os__get_WiFiSSIDStats_ErrorsSent, NULL, BBFDM_BOTH}, -{"RetransCount", &DMREAD, DMT_UNINT, os__get_WiFiSSIDStats_RetransCount, NULL, BBFDM_BOTH}, -{"FailedRetransCount", &DMREAD, DMT_UNINT, os__get_WiFiSSIDStats_FailedRetransCount, NULL, BBFDM_BOTH}, -{"RetryCount", &DMREAD, DMT_UNINT, os__get_WiFiSSIDStats_RetryCount, NULL, BBFDM_BOTH}, -{"MultipleRetryCount", &DMREAD, DMT_UNINT, os__get_WiFiSSIDStats_MultipleRetryCount, NULL, BBFDM_BOTH}, -{"ACKFailureCount", &DMREAD, DMT_UNINT, os__get_WiFiSSIDStats_ACKFailureCount, NULL, BBFDM_BOTH}, -{"AggregatedPacketCount", &DMREAD, DMT_UNINT, os__get_WiFiSSIDStats_AggregatedPacketCount, NULL, BBFDM_BOTH}, -{"ErrorsReceived", &DMREAD, DMT_UNINT, os__get_WiFiSSIDStats_ErrorsReceived, NULL, BBFDM_BOTH}, -{"UnicastPacketsSent", &DMREAD, DMT_UNLONG, os__get_WiFiSSIDStats_UnicastPacketsSent, NULL, BBFDM_BOTH}, -{"UnicastPacketsReceived", &DMREAD, DMT_UNLONG, os__get_WiFiSSIDStats_UnicastPacketsReceived, NULL, BBFDM_BOTH}, -{"DiscardPacketsSent", &DMREAD, DMT_UNINT, os__get_WiFiSSIDStats_DiscardPacketsSent, NULL, BBFDM_BOTH}, -{"DiscardPacketsReceived", &DMREAD, DMT_UNINT, os__get_WiFiSSIDStats_DiscardPacketsReceived, NULL, BBFDM_BOTH}, -{"MulticastPacketsSent", &DMREAD, DMT_UNLONG, os__get_WiFiSSIDStats_MulticastPacketsSent, NULL, BBFDM_BOTH}, -{"MulticastPacketsReceived", &DMREAD, DMT_UNLONG, os__get_WiFiSSIDStats_MulticastPacketsReceived, NULL, BBFDM_BOTH}, -{"BroadcastPacketsSent", &DMREAD, DMT_UNLONG, os__get_WiFiSSIDStats_BroadcastPacketsSent, NULL, BBFDM_BOTH}, -{"BroadcastPacketsReceived", &DMREAD, DMT_UNLONG, os__get_WiFiSSIDStats_BroadcastPacketsReceived, NULL, BBFDM_BOTH}, -{"UnknownProtoPacketsReceived", &DMREAD, DMT_UNINT, os__get_WiFiSSIDStats_UnknownProtoPacketsReceived, NULL, BBFDM_BOTH}, +{"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, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Security", &DMWRITE, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiAccessPointSecurityParams, NULL, BBFDM_BOTH}, -{"AssociatedDevice", &DMREAD, NULL, NULL, NULL, os__browse_wifi_associated_device, NULL, tWiFiAccessPointAssociatedDeviceObj, tWiFiAccessPointAssociatedDeviceParams, get_linker_associated_device, BBFDM_BOTH, LIST_KEY{"MACAddress", NULL}}, -{"WPS", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiAccessPointWPSParams, NULL, BBFDM_BOTH}, -{"Accounting", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiAccessPointAccountingParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Security", &DMWRITE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiAccessPointSecurityParams, NULL, BBFDM_BOTH}, +{"AssociatedDevice", &DMREAD, NULL, NULL, NULL, browse_wifi_associated_device, NULL, NULL, tWiFiAccessPointAssociatedDeviceObj, tWiFiAccessPointAssociatedDeviceParams, get_linker_associated_device, BBFDM_BOTH, LIST_KEY{"MACAddress", NULL}}, +{"WPS", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiAccessPointWPSParams, NULL, BBFDM_BOTH}, +{"Accounting", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiAccessPointAccountingParams, NULL, BBFDM_BOTH}, {0} }; @@ -2330,12 +4214,12 @@ DMLEAF tWiFiAccessPointParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ {"Alias", &DMWRITE, DMT_STRING, get_access_point_alias, set_access_point_alias, BBFDM_BOTH}, {"Enable", &DMWRITE, DMT_BOOL, get_wifi_enable, set_wifi_enable, BBFDM_BOTH}, -{"Status", &DMREAD, DMT_STRING, os_get_wifi_access_point_status, NULL, BBFDM_BOTH}, +{"Status", &DMREAD, DMT_STRING, get_wifi_access_point_status, NULL, BBFDM_BOTH}, {"SSIDReference", &DMREAD, DMT_STRING, get_ap_ssid_ref, NULL, BBFDM_BOTH}, {"SSIDAdvertisementEnabled", &DMWRITE, DMT_BOOL, get_wlan_ssid_advertisement_enable, set_wlan_ssid_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, os__get_access_point_total_associations, NULL, 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}, @@ -2376,36 +4260,36 @@ DMLEAF tWiFiAccessPointWPSParams[] = { /* *** Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}. *** */ DMOBJ tWiFiAccessPointAssociatedDeviceObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiAccessPointAssociatedDeviceStatsParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiAccessPointAssociatedDeviceStatsParams, NULL, BBFDM_BOTH}, {0} }; DMLEAF tWiFiAccessPointAssociatedDeviceParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"Active", &DMREAD, DMT_BOOL, os__get_WiFiAccessPointAssociatedDevice_Active, NULL, BBFDM_BOTH}, -{"Noise", &DMREAD, DMT_INT, os__get_WiFiAccessPointAssociatedDevice_Noise, NULL, BBFDM_BOTH}, -{"MACAddress", &DMREAD, DMT_STRING , os__get_WiFiAccessPointAssociatedDevice_MACAddress, NULL, BBFDM_BOTH}, -{"LastDataDownlinkRate", &DMREAD, DMT_UNINT, os__get_WiFiAccessPointAssociatedDevice_LastDataDownlinkRate, NULL, BBFDM_BOTH}, -{"LastDataUplinkRate", &DMREAD, DMT_UNINT, os__get_WiFiAccessPointAssociatedDevice_LastDataUplinkRate, NULL, BBFDM_BOTH}, -{"SignalStrength", &DMREAD, DMT_INT, os__get_WiFiAccessPointAssociatedDevice_SignalStrength, NULL, BBFDM_BOTH}, -//{"Retransmissions", &DMREAD, DMT_UNINT, os__get_WiFiAccessPointAssociatedDevice_Retransmissions, NULL, BBFDM_BOTH}, -{"AssociationTime", &DMREAD, DMT_TIME, os__get_WiFiAccessPointAssociatedDevice_AssociationTime, NULL, BBFDM_BOTH}, +{"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}, +{"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*/ -{"BytesSent", &DMREAD, DMT_UNLONG, os__get_access_point_associative_device_statistics_tx_bytes, NULL, BBFDM_BOTH}, -{"BytesReceived", &DMREAD, DMT_UNLONG, os__get_access_point_associative_device_statistics_rx_bytes, NULL, BBFDM_BOTH}, -{"PacketsSent", &DMREAD, DMT_UNLONG, os__get_access_point_associative_device_statistics_tx_packets, NULL, BBFDM_BOTH}, -{"PacketsReceived", &DMREAD, DMT_UNLONG, os__get_access_point_associative_device_statistics_rx_packets, NULL, BBFDM_BOTH}, -{"ErrorsSent", &DMREAD, DMT_UNINT, os__get_access_point_associative_device_statistics_tx_errors, NULL, BBFDM_BOTH}, -{"RetransCount", &DMREAD, DMT_UNINT, os__get_access_point_associative_device_statistics_retrans_count, NULL, BBFDM_BOTH}, -//{"FailedRetransCount", &DMREAD, DMT_UNINT, os__get_access_point_associative_device_statistics_failed_retrans_count, NULL, BBFDM_BOTH}, -//{"RetryCount", &DMREAD, DMT_UNINT, os__get_access_point_associative_device_statistics_retry_count, NULL, BBFDM_BOTH}, -//{"MultipleRetryCount", &DMREAD, DMT_UNINT, os__get_access_point_associative_device_statistics_multiple_retry_count, NULL, BBFDM_BOTH}, +{"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} }; @@ -2425,11 +4309,11 @@ DMLEAF tWiFiAccessPointAccountingParams[] = { /* *** Device.WiFi.EndPoint.{i}. *** */ DMOBJ tWiFiEndPointObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiEndPointStatsParams, NULL, BBFDM_BOTH}, -{"Security", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiEndPointSecurityParams, NULL, BBFDM_BOTH}, -{"Profile", &DMREAD, NULL, NULL, NULL, browseWiFiEndPointProfileInst, NULL, tWiFiEndPointProfileObj, tWiFiEndPointProfileParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", "SSID", "Location", "Priority", NULL}}, -{"WPS", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiEndPointWPSParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiEndPointStatsParams, NULL, BBFDM_BOTH}, +{"Security", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiEndPointSecurityParams, NULL, BBFDM_BOTH}, +{"Profile", &DMREAD, NULL, NULL, NULL, browseWiFiEndPointProfileInst, NULL, NULL, tWiFiEndPointProfileObj, tWiFiEndPointProfileParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", "SSID", "Location", "Priority", NULL}}, +{"WPS", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiEndPointWPSParams, NULL, BBFDM_BOTH}, {0} }; @@ -2463,8 +4347,8 @@ DMLEAF tWiFiEndPointSecurityParams[] = { /* *** Device.WiFi.EndPoint.{i}.Profile.{i}. *** */ DMOBJ tWiFiEndPointProfileObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Security", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiEndPointProfileSecurityParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Security", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiEndPointProfileSecurityParams, NULL, BBFDM_BOTH}, {0} }; @@ -2505,292 +4389,292 @@ DMLEAF tWiFiEndPointWPSParams[] = { /* *** Device.WiFi.DataElements. *** */ DMOBJ tWiFiDataElementsObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Network", &DMREAD, NULL, NULL, NULL, NULL, NULL, tWiFiDataElementsNetworkObj, tWiFiDataElementsNetworkParams, NULL, BBFDM_BOTH}, -{"AssociationEvent", &DMREAD, NULL, NULL, NULL, NULL, NULL, tWiFiDataElementsAssociationEventObj, tWiFiDataElementsAssociationEventParams, NULL, BBFDM_BOTH}, -{"DisassociationEvent", &DMREAD, NULL, NULL, NULL, NULL, NULL, tWiFiDataElementsDisassociationEventObj, tWiFiDataElementsDisassociationEventParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Network", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiDataElementsNetworkObj, tWiFiDataElementsNetworkParams, NULL, BBFDM_BOTH}, +{"AssociationEvent", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiDataElementsAssociationEventObj, tWiFiDataElementsAssociationEventParams, NULL, BBFDM_BOTH}, +{"DisassociationEvent", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiDataElementsDisassociationEventObj, tWiFiDataElementsDisassociationEventParams, NULL, BBFDM_BOTH}, {0} }; /* *** Device.WiFi.DataElements.Network. *** */ DMOBJ tWiFiDataElementsNetworkObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Device", &DMREAD, NULL, NULL, NULL, os__browseWiFiDataElementsNetworkDeviceInst, NULL, tWiFiDataElementsNetworkDeviceObj, tWiFiDataElementsNetworkDeviceParams, NULL, BBFDM_BOTH, LIST_KEY{"ID", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Device", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceInst, NULL, NULL, tWiFiDataElementsNetworkDeviceObj, tWiFiDataElementsNetworkDeviceParams, NULL, BBFDM_BOTH, LIST_KEY{"ID", NULL}}, {0} }; DMLEAF tWiFiDataElementsNetworkParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"ID", &DMWRITE, DMT_STRING, os__get_WiFiDataElementsNetwork_ID, os__set_WiFiDataElementsNetwork_ID, BBFDM_BOTH}, -{"TimeStamp", &DMREAD, DMT_STRING, os__get_WiFiDataElementsNetwork_TimeStamp, NULL, BBFDM_BOTH}, -{"ControllerID", &DMWRITE, DMT_STRING, os__get_WiFiDataElementsNetwork_ControllerID, os__set_WiFiDataElementsNetwork_ControllerID, BBFDM_BOTH}, -{"DeviceNumberOfEntries", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetwork_DeviceNumberOfEntries, NULL, BBFDM_BOTH}, +{"ID", &DMWRITE, DMT_STRING, get_WiFiDataElementsNetwork_ID, set_WiFiDataElementsNetwork_ID, BBFDM_BOTH}, +{"TimeStamp", &DMREAD, DMT_STRING, get_WiFiDataElementsNetwork_TimeStamp, NULL, BBFDM_BOTH}, +{"ControllerID", &DMWRITE, DMT_STRING, get_WiFiDataElementsNetwork_ControllerID, set_WiFiDataElementsNetwork_ControllerID, BBFDM_BOTH}, +{"DeviceNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetwork_DeviceNumberOfEntries, NULL, BBFDM_BOTH}, {0} }; /* *** Device.WiFi.DataElements.Network.Device.{i}. *** */ DMOBJ tWiFiDataElementsNetworkDeviceObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Radio", &DMREAD, NULL, NULL, NULL, os__browseWiFiDataElementsNetworkDeviceRadioInst, NULL, tWiFiDataElementsNetworkDeviceRadioObj, tWiFiDataElementsNetworkDeviceRadioParams, NULL, BBFDM_BOTH, LIST_KEY{"ID", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Radio", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceRadioInst, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioObj, tWiFiDataElementsNetworkDeviceRadioParams, NULL, BBFDM_BOTH, LIST_KEY{"ID", NULL}}, {0} }; DMLEAF tWiFiDataElementsNetworkDeviceParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"ID", &DMREAD, DMT_STRING, os__get_WiFiDataElementsNetworkDevice_ID, NULL, BBFDM_BOTH}, -//{"MultiAPCapabilities", &DMREAD, DMT_BASE64, os__get_WiFiDataElementsNetworkDevice_MultiAPCapabilities, NULL, BBFDM_BOTH}, -{"CollectionInterval", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDevice_CollectionInterval, NULL, BBFDM_BOTH}, -{"RadioNumberOfEntries", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDevice_RadioNumberOfEntries, NULL, BBFDM_BOTH}, +{"ID", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDevice_ID, NULL, BBFDM_BOTH}, +//{"MultiAPCapabilities", &DMREAD, DMT_BASE64, get_WiFiDataElementsNetworkDevice_MultiAPCapabilities, NULL, BBFDM_BOTH}, +{"CollectionInterval", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDevice_CollectionInterval, NULL, BBFDM_BOTH}, +{"RadioNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDevice_RadioNumberOfEntries, NULL, BBFDM_BOTH}, {0} }; /* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}. *** */ DMOBJ tWiFiDataElementsNetworkDeviceRadioObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"BackhaulSta", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioBackhaulStaParams, NULL, BBFDM_BOTH}, -{"Capabilities", &DMREAD, NULL, NULL, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioCapabilitiesObj, tWiFiDataElementsNetworkDeviceRadioCapabilitiesParams, NULL, BBFDM_BOTH}, -{"CurrentOperatingClassProfile", &DMREAD, NULL, NULL, NULL, os__browseWiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfileInst, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfileParams, NULL, BBFDM_BOTH, LIST_KEY{"Class", NULL}}, -{"BSS", &DMREAD, NULL, NULL, NULL, os__browseWiFiDataElementsNetworkDeviceRadioBSSInst, NULL, tWiFiDataElementsNetworkDeviceRadioBSSObj, tWiFiDataElementsNetworkDeviceRadioBSSParams, NULL, BBFDM_BOTH, LIST_KEY{"BSSID", NULL}}, -{"ScanResult", &DMREAD, NULL, NULL, NULL, os__browseWiFiDataElementsNetworkDeviceRadioScanResultInst, NULL, tWiFiDataElementsNetworkDeviceRadioScanResultObj, tWiFiDataElementsNetworkDeviceRadioScanResultParams, NULL, BBFDM_BOTH}, -{"UnassociatedSTA", &DMREAD, NULL, NULL, NULL, os__browseWiFiDataElementsNetworkDeviceRadioUnassociatedSTAInst, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioUnassociatedSTAParams, NULL, BBFDM_BOTH, LIST_KEY{"MACAddress", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"BackhaulSta", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioBackhaulStaParams, NULL, BBFDM_BOTH}, +{"Capabilities", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioCapabilitiesObj, tWiFiDataElementsNetworkDeviceRadioCapabilitiesParams, NULL, BBFDM_BOTH}, +{"CurrentOperatingClassProfile", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfileInst, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfileParams, NULL, BBFDM_BOTH, LIST_KEY{"Class", NULL}}, +{"BSS", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceRadioBSSInst, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioBSSObj, tWiFiDataElementsNetworkDeviceRadioBSSParams, NULL, BBFDM_BOTH, LIST_KEY{"BSSID", NULL}}, +{"ScanResult", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceRadioScanResultInst, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioScanResultObj, tWiFiDataElementsNetworkDeviceRadioScanResultParams, NULL, BBFDM_BOTH}, +{"UnassociatedSTA", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceRadioUnassociatedSTAInst, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioUnassociatedSTAParams, NULL, BBFDM_BOTH, LIST_KEY{"MACAddress", NULL}}, {0} }; DMLEAF tWiFiDataElementsNetworkDeviceRadioParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"ID", &DMREAD, DMT_BASE64, os__get_WiFiDataElementsNetworkDeviceRadio_ID, NULL, BBFDM_BOTH}, -{"Enabled", &DMREAD, DMT_BOOL, os__get_WiFiDataElementsNetworkDeviceRadio_Enabled, NULL, BBFDM_BOTH}, -{"Noise", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadio_Noise, NULL, BBFDM_BOTH}, -{"Utilization", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadio_Utilization, NULL, BBFDM_BOTH}, -{"Transmit", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadio_Transmit, NULL, BBFDM_BOTH}, -{"ReceiveSelf", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadio_ReceiveSelf, NULL, BBFDM_BOTH}, -{"ReceiveOther", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadio_ReceiveOther, NULL, BBFDM_BOTH}, -{"CurrentOperatingClassProfileNumberOfEntries", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadio_CurrentOperatingClassProfileNumberOfEntries, NULL, BBFDM_BOTH}, -{"UnassociatedSTANumberOfEntries", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadio_UnassociatedSTANumberOfEntries, NULL, BBFDM_BOTH}, -{"BSSNumberOfEntries", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadio_BSSNumberOfEntries, NULL, BBFDM_BOTH}, -{"ScanResultNumberOfEntries", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadio_ScanResultNumberOfEntries, NULL, BBFDM_BOTH}, +{"ID", &DMREAD, DMT_BASE64, get_WiFiDataElementsNetworkDeviceRadio_ID, NULL, BBFDM_BOTH}, +{"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}, +{"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}, {0} }; /* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BackhaulSta. *** */ DMLEAF tWiFiDataElementsNetworkDeviceRadioBackhaulStaParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"MACAddress", &DMREAD, DMT_STRING, os__get_WiFiDataElementsNetworkDeviceRadioBackhaulSta_MACAddress, NULL, BBFDM_BOTH}, +{"MACAddress", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioBackhaulSta_MACAddress, NULL, BBFDM_BOTH}, {0} }; /* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.Capabilities. *** */ DMOBJ tWiFiDataElementsNetworkDeviceRadioCapabilitiesObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"CapableOperatingClassProfile", &DMREAD, NULL, NULL, NULL, os__browseWiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfileInst, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfileParams, NULL, BBFDM_BOTH, LIST_KEY{"Class", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"CapableOperatingClassProfile", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfileInst, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfileParams, NULL, BBFDM_BOTH, LIST_KEY{"Class", NULL}}, {0} }; DMLEAF tWiFiDataElementsNetworkDeviceRadioCapabilitiesParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"HTCapabilities", &DMREAD, DMT_BASE64, os__get_WiFiDataElementsNetworkDeviceRadioCapabilities_HTCapabilities, NULL, BBFDM_BOTH}, -{"VHTCapabilities", &DMREAD, DMT_BASE64, os__get_WiFiDataElementsNetworkDeviceRadioCapabilities_VHTCapabilities, NULL, BBFDM_BOTH}, -{"HECapabilities", &DMREAD, DMT_BASE64, os__get_WiFiDataElementsNetworkDeviceRadioCapabilities_HECapabilities, NULL, BBFDM_BOTH}, -{"CapableOperatingClassProfileNumberOfEntries", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioCapabilities_CapableOperatingClassProfileNumberOfEntries, NULL, BBFDM_BOTH}, +{"HTCapabilities", &DMREAD, DMT_BASE64, get_WiFiDataElementsNetworkDeviceRadioCapabilities_HTCapabilities, NULL, BBFDM_BOTH}, +{"VHTCapabilities", &DMREAD, DMT_BASE64, get_WiFiDataElementsNetworkDeviceRadioCapabilities_VHTCapabilities, NULL, BBFDM_BOTH}, +{"HECapabilities", &DMREAD, DMT_BASE64, get_WiFiDataElementsNetworkDeviceRadioCapabilities_HECapabilities, NULL, BBFDM_BOTH}, +{"CapableOperatingClassProfileNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioCapabilities_CapableOperatingClassProfileNumberOfEntries, NULL, BBFDM_BOTH}, {0} }; /* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.Capabilities.CapableOperatingClassProfile.{i}. *** */ DMLEAF tWiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfileParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"Class", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfile_Class, NULL, BBFDM_BOTH}, -{"MaxTxPower", &DMREAD, DMT_INT, os__get_WiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfile_MaxTxPower, NULL, BBFDM_BOTH}, -{"NonOperable", &DMREAD, DMT_STRING, os__get_WiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfile_NonOperable, NULL, BBFDM_BOTH}, -{"NumberOfNonOperChan", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfile_NumberOfNonOperChan, NULL, BBFDM_BOTH}, +{"Class", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfile_Class, NULL, BBFDM_BOTH}, +{"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*/ -{"Class", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_Class, NULL, BBFDM_BOTH}, -{"Channel", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_Channel, NULL, BBFDM_BOTH}, -{"TxPower", &DMREAD, DMT_INT, os__get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_TxPower, NULL, BBFDM_BOTH}, -{"TimeStamp", &DMREAD, DMT_STRING, os__get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_TimeStamp, NULL, BBFDM_BOTH}, +{"Class", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_Class, NULL, BBFDM_BOTH}, +{"Channel", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_Channel, NULL, BBFDM_BOTH}, +{"TxPower", &DMREAD, DMT_INT, get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_TxPower, NULL, BBFDM_BOTH}, +{"TimeStamp", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfile_TimeStamp, NULL, BBFDM_BOTH}, {0} }; /* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}. *** */ DMOBJ tWiFiDataElementsNetworkDeviceRadioBSSObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"STA", &DMREAD, NULL, NULL, NULL, os__browseWiFiDataElementsNetworkDeviceRadioBSSSTAInst, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioBSSSTAParams, NULL, BBFDM_BOTH, LIST_KEY{"MACAddress", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"STA", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceRadioBSSSTAInst, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioBSSSTAParams, NULL, BBFDM_BOTH, LIST_KEY{"MACAddress", NULL}}, {0} }; DMLEAF tWiFiDataElementsNetworkDeviceRadioBSSParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"BSSID", &DMREAD, DMT_STRING, os__get_WiFiDataElementsNetworkDeviceRadioBSS_BSSID, NULL, BBFDM_BOTH}, -{"SSID", &DMREAD, DMT_STRING, os__get_WiFiDataElementsNetworkDeviceRadioBSS_SSID, NULL, BBFDM_BOTH}, -{"Enabled", &DMREAD, DMT_BOOL, os__get_WiFiDataElementsNetworkDeviceRadioBSS_Enabled, NULL, BBFDM_BOTH}, -{"LastChange", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioBSS_LastChange, NULL, BBFDM_BOTH}, -{"TimeStamp", &DMREAD, DMT_STRING, os__get_WiFiDataElementsNetworkDeviceRadioBSS_TimeStamp, NULL, BBFDM_BOTH}, -{"UnicastBytesSent", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioBSS_UnicastBytesSent, NULL, BBFDM_BOTH}, -{"UnicastBytesReceived", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioBSS_UnicastBytesReceived, NULL, BBFDM_BOTH}, -{"MulticastBytesSent", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioBSS_MulticastBytesSent, NULL, BBFDM_BOTH}, -{"MulticastBytesReceived", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioBSS_MulticastBytesReceived, NULL, BBFDM_BOTH}, -{"BroadcastBytesSent", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioBSS_BroadcastBytesSent, NULL, BBFDM_BOTH}, -{"BroadcastBytesReceived", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioBSS_BroadcastBytesReceived, NULL, BBFDM_BOTH}, -{"EstServiceParametersBE", &DMREAD, DMT_BASE64, os__get_WiFiDataElementsNetworkDeviceRadioBSS_EstServiceParametersBE, NULL, BBFDM_BOTH}, -{"EstServiceParametersBK", &DMREAD, DMT_BASE64, os__get_WiFiDataElementsNetworkDeviceRadioBSS_EstServiceParametersBK, NULL, BBFDM_BOTH}, -{"EstServiceParametersVI", &DMREAD, DMT_BASE64, os__get_WiFiDataElementsNetworkDeviceRadioBSS_EstServiceParametersVI, NULL, BBFDM_BOTH}, -{"EstServiceParametersVO", &DMREAD, DMT_BASE64, os__get_WiFiDataElementsNetworkDeviceRadioBSS_EstServiceParametersVO, NULL, BBFDM_BOTH}, -{"STANumberOfEntries", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioBSS_STANumberOfEntries, NULL, BBFDM_BOTH}, +{"BSSID", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioBSS_BSSID, NULL, BBFDM_BOTH}, +{"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_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSS_UnicastBytesSent, NULL, BBFDM_BOTH}, +{"UnicastBytesReceived", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSS_UnicastBytesReceived, NULL, BBFDM_BOTH}, +{"MulticastBytesSent", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSS_MulticastBytesSent, NULL, BBFDM_BOTH}, +{"MulticastBytesReceived", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSS_MulticastBytesReceived, NULL, BBFDM_BOTH}, +{"BroadcastBytesSent", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSS_BroadcastBytesSent, NULL, BBFDM_BOTH}, +{"BroadcastBytesReceived", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSS_BroadcastBytesReceived, 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}, +{"STANumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSS_STANumberOfEntries, NULL, BBFDM_BOTH}, {0} }; /* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.BSS.{i}.STA.{i}. *** */ DMLEAF tWiFiDataElementsNetworkDeviceRadioBSSSTAParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"MACAddress", &DMREAD, DMT_STRING, os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_MACAddress, NULL, BBFDM_BOTH}, -{"TimeStamp", &DMREAD, DMT_STRING, os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_TimeStamp, NULL, BBFDM_BOTH}, -{"HTCapabilities", &DMREAD, DMT_BASE64, os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_HTCapabilities, NULL, BBFDM_BOTH}, -{"VHTCapabilities", &DMREAD, DMT_BASE64, os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_VHTCapabilities, NULL, BBFDM_BOTH}, -{"HECapabilities", &DMREAD, DMT_BASE64, os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_HECapabilities, NULL, BBFDM_BOTH}, -{"LastDataDownlinkRate", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_LastDataDownlinkRate, NULL, BBFDM_BOTH}, -{"LastDataUplinkRate", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_LastDataUplinkRate, NULL, BBFDM_BOTH}, -{"UtilizationReceive", &DMREAD, DMT_UNLONG, os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_UtilizationReceive, NULL, BBFDM_BOTH}, -{"UtilizationTransmit", &DMREAD, DMT_UNLONG, os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_UtilizationTransmit, NULL, BBFDM_BOTH}, -{"EstMACDataRateDownlink", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_EstMACDataRateDownlink, NULL, BBFDM_BOTH}, -{"EstMACDataRateUplink", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_EstMACDataRateUplink, NULL, BBFDM_BOTH}, -{"SignalStrength", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_SignalStrength, NULL, BBFDM_BOTH}, -{"LastConnectTime", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_LastConnectTime, NULL, BBFDM_BOTH}, -{"BytesSent", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_BytesSent, NULL, BBFDM_BOTH}, -{"BytesReceived", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_BytesReceived, NULL, BBFDM_BOTH}, -{"PacketsSent", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_PacketsSent, NULL, BBFDM_BOTH}, -{"PacketsReceived", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_PacketsReceived, NULL, BBFDM_BOTH}, -{"ErrorsSent", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_ErrorsSent, NULL, BBFDM_BOTH}, -{"ErrorsReceived", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_ErrorsReceived, NULL, BBFDM_BOTH}, -//{"RetransCount", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_RetransCount, NULL, BBFDM_BOTH}, -{"MeasurementReport", &DMREAD, DMT_STRING, os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_MeasurementReport, NULL, BBFDM_BOTH}, -{"NumberOfMeasureReports", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_NumberOfMeasureReports, NULL, BBFDM_BOTH}, -//{"IPV4Address", &DMREAD, DMT_STRING, os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_IPV4Address, NULL, BBFDM_BOTH}, -//{"IPV6Address", &DMREAD, DMT_STRING, os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_IPV6Address, NULL, BBFDM_BOTH}, -{"Hostname", &DMREAD, DMT_STRING, os__get_WiFiDataElementsNetworkDeviceRadioBSSSTA_Hostname, NULL, BBFDM_BOTH}, +{"MACAddress", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_MACAddress, NULL, BBFDM_BOTH}, +{"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}, +{"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_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_BytesSent, NULL, BBFDM_BOTH}, +{"BytesReceived", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_BytesReceived, NULL, BBFDM_BOTH}, +{"PacketsSent", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_PacketsSent, NULL, BBFDM_BOTH}, +{"PacketsReceived", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_PacketsReceived, NULL, BBFDM_BOTH}, +{"ErrorsSent", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_ErrorsSent, NULL, BBFDM_BOTH}, +{"ErrorsReceived", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioBSSSTA_ErrorsReceived, NULL, BBFDM_BOTH}, +//{"RetransCount", &DMREAD, DMT_UNINT, 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}, {0} }; /* *** Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.{i}. *** */ DMOBJ tWiFiDataElementsNetworkDeviceRadioScanResultObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"OpClassScan", &DMREAD, NULL, NULL, NULL, os__browseWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanInst, NULL, tWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanObj, tWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanParams, NULL, BBFDM_BOTH, LIST_KEY{"OperatingClass", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"OpClassScan", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanInst, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanObj, tWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanParams, NULL, BBFDM_BOTH, LIST_KEY{"OperatingClass", NULL}}, {0} }; DMLEAF tWiFiDataElementsNetworkDeviceRadioScanResultParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"TimeStamp", &DMREAD, DMT_STRING, os__get_WiFiDataElementsNetworkDeviceRadioScanResult_TimeStamp, NULL, BBFDM_BOTH}, -{"OpClassScanNumberOfEntries", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioScanResult_OpClassScanNumberOfEntries, NULL, BBFDM_BOTH}, +{"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, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"ChannelScan", &DMREAD, NULL, NULL, NULL, os__browseWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanInst, NULL, tWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanObj, tWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanParams, NULL, BBFDM_BOTH, LIST_KEY{"Channel", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"ChannelScan", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanInst, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanObj, tWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanParams, NULL, BBFDM_BOTH, LIST_KEY{"Channel", NULL}}, {0} }; DMLEAF tWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"OperatingClass", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScan_OperatingClass, NULL, BBFDM_BOTH}, -{"ChannelScanNumberOfEntries", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScan_ChannelScanNumberOfEntries, NULL, BBFDM_BOTH}, +{"OperatingClass", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScan_OperatingClass, NULL, BBFDM_BOTH}, +{"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, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"NeighborBSS", &DMREAD, NULL, NULL, NULL, os__browseWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSSInst, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSSParams, NULL, BBFDM_BOTH, LIST_KEY{"BSSID", NULL}}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"NeighborBSS", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSSInst, NULL, NULL, NULL, tWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSSParams, NULL, BBFDM_BOTH, LIST_KEY{"BSSID", NULL}}, {0} }; DMLEAF tWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"Channel", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_Channel, NULL, BBFDM_BOTH}, -{"TimeStamp", &DMREAD, DMT_STRING, os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_TimeStamp, NULL, BBFDM_BOTH}, -{"Utilization", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_Utilization, NULL, BBFDM_BOTH}, -{"Noise", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_Noise, NULL, BBFDM_BOTH}, -{"NeighborBSSNumberOfEntries", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_NeighborBSSNumberOfEntries, NULL, BBFDM_BOTH}, +{"Channel", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScan_Channel, NULL, BBFDM_BOTH}, +{"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*/ -{"BSSID", &DMREAD, DMT_STRING, os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_BSSID, NULL, BBFDM_BOTH}, -{"SSID", &DMREAD, DMT_STRING, os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_SSID, NULL, BBFDM_BOTH}, -{"SignalStrength", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_SignalStrength, NULL, BBFDM_BOTH}, -{"ChannelBandwidth", &DMREAD, DMT_STRING, os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_ChannelBandwidth, NULL, BBFDM_BOTH}, -{"ChannelUtilization", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_ChannelUtilization, NULL, BBFDM_BOTH}, -{"StationCount", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_StationCount, NULL, BBFDM_BOTH}, +{"BSSID", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSS_BSSID, NULL, BBFDM_BOTH}, +{"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}.UnassociatedSTA.{i}. *** */ DMLEAF tWiFiDataElementsNetworkDeviceRadioUnassociatedSTAParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"MACAddress", &DMREAD, DMT_STRING, os__get_WiFiDataElementsNetworkDeviceRadioUnassociatedSTA_MACAddress, NULL, BBFDM_BOTH}, -{"SignalStrength", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsNetworkDeviceRadioUnassociatedSTA_SignalStrength, NULL, BBFDM_BOTH}, +{"MACAddress", &DMREAD, DMT_STRING, get_WiFiDataElementsNetworkDeviceRadioUnassociatedSTA_MACAddress, NULL, BBFDM_BOTH}, +{"SignalStrength", &DMREAD, DMT_UNINT, get_WiFiDataElementsNetworkDeviceRadioUnassociatedSTA_SignalStrength, NULL, BBFDM_BOTH}, {0} }; /* *** Device.WiFi.DataElements.AssociationEvent. *** */ DMOBJ tWiFiDataElementsAssociationEventObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"AssociationEventData", &DMREAD, NULL, NULL, NULL, os__browseWiFiDataElementsAssociationEventAssociationEventDataInst, NULL, NULL, tWiFiDataElementsAssociationEventAssociationEventDataParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"AssociationEventData", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsAssociationEventAssociationEventDataInst, NULL, NULL, NULL, tWiFiDataElementsAssociationEventAssociationEventDataParams, NULL, BBFDM_BOTH}, {0} }; DMLEAF tWiFiDataElementsAssociationEventParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"AssociationEventDataNumberOfEntries", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsAssociationEvent_AssociationEventDataNumberOfEntries, NULL, BBFDM_BOTH}, +{"AssociationEventDataNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsAssociationEvent_AssociationEventDataNumberOfEntries, NULL, BBFDM_BOTH}, {0} }; /* *** Device.WiFi.DataElements.AssociationEvent.AssociationEventData.{i}. *** */ DMLEAF tWiFiDataElementsAssociationEventAssociationEventDataParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"BSSID", &DMREAD, DMT_STRING, os__get_WiFiDataElementsAssociationEventAssociationEventData_BSSID, NULL, BBFDM_BOTH}, -{"MACAddress", &DMREAD, DMT_STRING, os__get_WiFiDataElementsAssociationEventAssociationEventData_MACAddress, NULL, BBFDM_BOTH}, -{"StatusCode", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsAssociationEventAssociationEventData_StatusCode, NULL, BBFDM_BOTH}, -{"HTCapabilities", &DMREAD, DMT_BASE64, os__get_WiFiDataElementsAssociationEventAssociationEventData_HTCapabilities, NULL, BBFDM_BOTH}, -{"VHTCapabilities", &DMREAD, DMT_BASE64, os__get_WiFiDataElementsAssociationEventAssociationEventData_VHTCapabilities, NULL, BBFDM_BOTH}, -{"HECapabilities", &DMREAD, DMT_BASE64, os__get_WiFiDataElementsAssociationEventAssociationEventData_HECapabilities, NULL, BBFDM_BOTH}, -{"TimeStamp", &DMREAD, DMT_STRING, os__get_WiFiDataElementsAssociationEventAssociationEventData_TimeStamp, NULL, BBFDM_BOTH}, +{"BSSID", &DMREAD, DMT_STRING, get_WiFiDataElementsAssociationEventAssociationEventData_BSSID, NULL, BBFDM_BOTH}, +{"MACAddress", &DMREAD, DMT_STRING, get_WiFiDataElementsAssociationEventAssociationEventData_MACAddress, NULL, BBFDM_BOTH}, +{"StatusCode", &DMREAD, DMT_UNINT, get_WiFiDataElementsAssociationEventAssociationEventData_StatusCode, NULL, BBFDM_BOTH}, +{"HTCapabilities", &DMREAD, DMT_BASE64, get_WiFiDataElementsAssociationEventAssociationEventData_HTCapabilities, NULL, BBFDM_BOTH}, +{"VHTCapabilities", &DMREAD, DMT_BASE64, get_WiFiDataElementsAssociationEventAssociationEventData_VHTCapabilities, NULL, BBFDM_BOTH}, +{"HECapabilities", &DMREAD, DMT_BASE64, get_WiFiDataElementsAssociationEventAssociationEventData_HECapabilities, NULL, BBFDM_BOTH}, +{"TimeStamp", &DMREAD, DMT_STRING, get_WiFiDataElementsAssociationEventAssociationEventData_TimeStamp, NULL, BBFDM_BOTH}, {0} }; /* *** Device.WiFi.DataElements.DisassociationEvent. *** */ DMOBJ tWiFiDataElementsDisassociationEventObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"DisassociationEventData", &DMREAD, NULL, NULL, NULL, os__browseWiFiDataElementsDisassociationEventDisassociationEventDataInst, NULL, NULL, tWiFiDataElementsDisassociationEventDisassociationEventDataParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"DisassociationEventData", &DMREAD, NULL, NULL, NULL, browseWiFiDataElementsDisassociationEventDisassociationEventDataInst, NULL, NULL, NULL, tWiFiDataElementsDisassociationEventDisassociationEventDataParams, NULL, BBFDM_BOTH}, {0} }; DMLEAF tWiFiDataElementsDisassociationEventParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"DisassociationEventDataNumberOfEntries", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsDisassociationEvent_DisassociationEventDataNumberOfEntries, NULL, BBFDM_BOTH}, +{"DisassociationEventDataNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFiDataElementsDisassociationEvent_DisassociationEventDataNumberOfEntries, NULL, BBFDM_BOTH}, {0} }; /* *** Device.WiFi.DataElements.DisassociationEvent.DisassociationEventData.{i}. *** */ DMLEAF tWiFiDataElementsDisassociationEventDisassociationEventDataParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"BSSID", &DMREAD, DMT_STRING, os__get_WiFiDataElementsDisassociationEventDisassociationEventData_BSSID, NULL, BBFDM_BOTH}, -{"MACAddress", &DMREAD, DMT_STRING, os__get_WiFiDataElementsDisassociationEventDisassociationEventData_MACAddress, NULL, BBFDM_BOTH}, -{"ReasonCode", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsDisassociationEventDisassociationEventData_ReasonCode, NULL, BBFDM_BOTH}, -{"BytesSent", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsDisassociationEventDisassociationEventData_BytesSent, NULL, BBFDM_BOTH}, -{"BytesReceived", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsDisassociationEventDisassociationEventData_BytesReceived, NULL, BBFDM_BOTH}, -{"PacketsSent", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsDisassociationEventDisassociationEventData_PacketsSent, NULL, BBFDM_BOTH}, -{"PacketsReceived", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsDisassociationEventDisassociationEventData_PacketsReceived, NULL, BBFDM_BOTH}, -{"ErrorsSent", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsDisassociationEventDisassociationEventData_ErrorsSent, NULL, BBFDM_BOTH}, -{"ErrorsReceived", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsDisassociationEventDisassociationEventData_ErrorsReceived, NULL, BBFDM_BOTH}, -{"RetransCount", &DMREAD, DMT_UNINT, os__get_WiFiDataElementsDisassociationEventDisassociationEventData_RetransCount, NULL, BBFDM_BOTH}, -{"TimeStamp", &DMREAD, DMT_STRING, os__get_WiFiDataElementsDisassociationEventDisassociationEventData_TimeStamp, NULL, BBFDM_BOTH}, +{"BSSID", &DMREAD, DMT_STRING, get_WiFiDataElementsDisassociationEventDisassociationEventData_BSSID, NULL, BBFDM_BOTH}, +{"MACAddress", &DMREAD, DMT_STRING, get_WiFiDataElementsDisassociationEventDisassociationEventData_MACAddress, NULL, BBFDM_BOTH}, +{"ReasonCode", &DMREAD, DMT_UNINT, get_WiFiDataElementsDisassociationEventDisassociationEventData_ReasonCode, NULL, BBFDM_BOTH}, +{"BytesSent", &DMREAD, DMT_UNINT, get_WiFiDataElementsDisassociationEventDisassociationEventData_BytesSent, NULL, BBFDM_BOTH}, +{"BytesReceived", &DMREAD, DMT_UNINT, get_WiFiDataElementsDisassociationEventDisassociationEventData_BytesReceived, NULL, BBFDM_BOTH}, +{"PacketsSent", &DMREAD, DMT_UNINT, get_WiFiDataElementsDisassociationEventDisassociationEventData_PacketsSent, NULL, BBFDM_BOTH}, +{"PacketsReceived", &DMREAD, DMT_UNINT, get_WiFiDataElementsDisassociationEventDisassociationEventData_PacketsReceived, NULL, BBFDM_BOTH}, +{"ErrorsSent", &DMREAD, DMT_UNINT, get_WiFiDataElementsDisassociationEventDisassociationEventData_ErrorsSent, NULL, BBFDM_BOTH}, +{"ErrorsReceived", &DMREAD, DMT_UNINT, get_WiFiDataElementsDisassociationEventDisassociationEventData_ErrorsReceived, NULL, BBFDM_BOTH}, +{"RetransCount", &DMREAD, DMT_UNINT, get_WiFiDataElementsDisassociationEventDisassociationEventData_RetransCount, NULL, BBFDM_BOTH}, +{"TimeStamp", &DMREAD, DMT_STRING, get_WiFiDataElementsDisassociationEventDisassociationEventData_TimeStamp, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/x_iopsys_eu_buttons.c b/dmtree/tr181/x_iopsys_eu_buttons.c deleted file mode 100644 index 87744f4e..00000000 --- a/dmtree/tr181/x_iopsys_eu_buttons.c +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (C) 2019 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 Imen Bhiri - * Author Omar Kallel - * - */ - -#include "x_iopsys_eu_buttons.h" - -int browseXIopsysEuButton(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - char *inst = NULL, *max_inst = NULL; - struct dmmap_dup *p = NULL; - LIST_HEAD(dup_list); - - synchronize_specific_config_sections_with_dmmap("buttons", "button", "dmmap_buttons", &dup_list); - list_for_each_entry(p, &dup_list, list) { - - inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3, - p->dmmap_section, "buttoninstance", "buttonalias"); - - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP) - break; - } - free_dmmap_config_dup_list(&dup_list); - return 0; -} - -/************************************************************************************* -**** function related to button **** -**************************************************************************************/ - -static int get_x_iopsys_eu_button_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmasprintf(value, "%s", section_name((struct uci_section *)data)); - return 0; -} - -static int get_x_iopsys_eu_button_gpio(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct uci_list *val = NULL; - - dmuci_get_value_by_section_list((struct uci_section *)data, "button", &val); - *value = dmuci_list_to_string(val, " "); - return 0; -} - -static int get_x_iopsys_eu_button_hotplug(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "hotplug", value); - return 0; -} - -static int get_x_iopsys_eu_button_hotplug_long(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "hotplug_long", value); - return 0; -} - -static int get_x_iopsys_eu_button_minpress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "minpress", "0"); - return 0; -} - -static int set_x_iopsys_eu_button_minpress(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "minpress", value); - return 0; - } - return 0; -} - -static int get_x_iopsys_eu_button_longpress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "longpress", "0"); - return 0; -} - -static int set_x_iopsys_eu_button_longpress(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "longpress", value); - return 0; - } - return 0; -} - - -static int get_x_iopsys_eu_button_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "enable", "1"); - return 0; -} - -static int set_x_iopsys_eu_button_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - - switch (action) { - case VALUECHECK: - if (dm_validate_boolean(value)) - return FAULT_9007; - return 0; - case VALUESET: - string_to_bool(value, &b); - dmuci_set_value_by_section((struct uci_section *)data, "enable", b ? "1" : "0"); - return 0; - } - return 0; -} -////////////////////////SET AND GET ALIAS///////////////////////////////// -static int get_x_iopsys_eu_button_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct uci_section *dmmap_section = NULL; - - get_dmmap_section_of_config_section("dmmap_buttons", "button", section_name((struct uci_section *)data), &dmmap_section); - dmuci_get_value_by_section_string(dmmap_section, "buttonalias", value); - if ((*value)[0] == '\0') - dmasprintf(value, "cpe-%s", instance); - return 0; -} - -static int set_x_iopsys_eu_button_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - struct uci_section *dmmap_section = NULL; - - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, NULL)) - return FAULT_9007; - return 0; - case VALUESET: - get_dmmap_section_of_config_section("dmmap_buttons", "button", section_name((struct uci_section *)data), &dmmap_section); - dmuci_set_value_by_section(dmmap_section, "buttonalias", value); - return 0; - } - return 0; -} - -/*** DMROOT.X_IOPSYS_EU_Buttons.{i}. ****/ -DMLEAF X_IOPSYS_EU_ButtonParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"Alias", &DMWRITE, DMT_STRING, get_x_iopsys_eu_button_alias, set_x_iopsys_eu_button_alias, BBFDM_BOTH}, -{"Enable", &DMWRITE, DMT_BOOL, get_x_iopsys_eu_button_enable, set_x_iopsys_eu_button_enable, BBFDM_BOTH}, -{"Name", &DMREAD, DMT_STRING, get_x_iopsys_eu_button_name, NULL, BBFDM_BOTH}, -{"GPIOButton", &DMREAD, DMT_STRING, get_x_iopsys_eu_button_gpio, NULL, BBFDM_BOTH}, -{"HotplugInterface", &DMREAD, DMT_STRING, get_x_iopsys_eu_button_hotplug, NULL, BBFDM_BOTH}, -{"HotplugInterfaceForLongPress", &DMREAD, DMT_STRING, get_x_iopsys_eu_button_hotplug_long, NULL, BBFDM_BOTH}, -{"MinPressTime", &DMWRITE, DMT_UNINT, get_x_iopsys_eu_button_minpress, set_x_iopsys_eu_button_minpress, BBFDM_BOTH}, -{"LongPressTime", &DMWRITE, DMT_UNINT, get_x_iopsys_eu_button_longpress, set_x_iopsys_eu_button_longpress, BBFDM_BOTH}, -{0} -}; diff --git a/dmtree/tr181/x_iopsys_eu_buttons.h b/dmtree/tr181/x_iopsys_eu_buttons.h deleted file mode 100644 index cb1ce301..00000000 --- a/dmtree/tr181/x_iopsys_eu_buttons.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2019 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 Imen Bhiri - * Author Omar Kallel - * - */ - -#ifndef __SE_BUTTONS_H -#define __SE_BUTTONS_H - -#include - -extern DMLEAF X_IOPSYS_EU_ButtonParams[]; - -int browseXIopsysEuButton(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance); - -#endif diff --git a/dmtree/tr181/x_iopsys_eu_owsd.c b/dmtree/tr181/x_iopsys_eu_owsd.c deleted file mode 100644 index 159bccd3..00000000 --- a/dmtree/tr181/x_iopsys_eu_owsd.c +++ /dev/null @@ -1,483 +0,0 @@ -/* - * Copyright (C) 2019 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 Imen Bhiri - * Author Omar Kallel - * - */ - -#include "dmentry.h" -#include "x_iopsys_eu_owsd.h" - -static int browseXIopsysEuOWSDVirtualHost(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - char *inst = NULL, *max_inst = NULL; - struct dmmap_dup *p = NULL; - LIST_HEAD(dup_list); - - synchronize_specific_config_sections_with_dmmap("owsd", "owsd-listen", "dmmap_owsd", &dup_list); - list_for_each_entry(p, &dup_list, list) { - - inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3, - p->dmmap_section, "olisteninstance", "olistenalias"); - - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP) - break; - } - free_dmmap_config_dup_list(&dup_list); - return 0; -} - -/************************************************************************************* -**** function related to owsd_origin **** -**************************************************************************************/ -static int get_x_iopsys_eu_owsd_global_sock(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_option_value_string("owsd", "global", "sock", value); - return 0; -} - -static int set_x_iopsys_eu_owsd_global_sock(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_set_value("owsd", "global", "sock", value); - return 0; - } - return 0; -} - -static int get_x_iopsys_eu_owsd_global_redirect(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_option_value_string("owsd", "global", "redirect", value); - return 0; -} - -static int set_x_iopsys_eu_owsd_global_redirect(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_set_value("owsd", "global", "redirect", value); - return 0; - } - return 0; -} - -/************************************************************************************* -**** function related to owsd_websocket_interface **** -**************************************************************************************/ -static int get_x_iopsys_eu_owsd_virtualhost_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "port", "0"); - return 0; -} - -static int set_x_iopsys_eu_owsd_virtualhost_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "port", value); - return 0; - } - return 0; -} - -static int get_x_iopsys_eu_owsd_virtualhost_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *iface; - - dmuci_get_value_by_section_string((struct uci_section *)data, "interface", &iface); - if (iface[0] != '\0') { - adm_entry_get_linker_param(ctx, "Device.IP.Interface.", iface, value); // MEM WILL BE FREED IN DMMEMCLEAN - if (*value == NULL) - *value = ""; - } - return 0; -} - -static int set_x_iopsys_eu_owsd_virtualhost_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - char *linker = NULL; - - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - adm_entry_get_linker_value(ctx, value, &linker); - if (linker && *linker) { - dmuci_set_value_by_section((struct uci_section *)data, "interface", linker); - dmfree(linker); - } - return 0; - } - return 0; -} - -static int get_x_iopsys_eu_owsd_virtualhost_ipv6_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *res = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "ipv6", "1"); - *value = (strcmp(res, "on") == 0) ? "1" : "0"; - return 0; -} - -static int set_x_iopsys_eu_owsd_virtualhost_ipv6_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - - switch (action) { - case VALUECHECK: - if (dm_validate_boolean(value)) - return FAULT_9007; - return 0; - case VALUESET: - string_to_bool(value, &b); - dmuci_set_value_by_section((struct uci_section *)data, "ipv6", b ? "on" : "off"); - return 0; - } - return 0; -} - -static int get_x_iopsys_eu_owsd_virtualhost_whitelist_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "whitelist_interface_as_origin", "0"); - return 0; -} - -static int set_x_iopsys_eu_owsd_virtualhost_whitelist_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - - switch (action) { - case VALUECHECK: - if (dm_validate_boolean(value)) - return FAULT_9007; - return 0; - case VALUESET: - string_to_bool(value, &b); - dmuci_set_value_by_section((struct uci_section *)data, "whitelist_interface_as_origin", b ? "1" : "0"); - return 0; - } - return 0; -} - -static int get_x_iopsys_eu_owsd_virtualhost_whitelist_dhcp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "whitelist_dhcp_domains", "0"); - return 0; -} - -static int set_x_iopsys_eu_owsd_virtualhost_whitelist_dhcp(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - - switch (action) { - case VALUECHECK: - if (dm_validate_boolean(value)) - return FAULT_9007; - return 0; - case VALUESET: - string_to_bool(value, &b); - dmuci_set_value_by_section((struct uci_section *)data, "whitelist_dhcp_domains", b ? "1" : "0"); - return 0; - } - return 0; -} - -static int get_x_iopsys_eu_owsd_virtualhost_origin(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct uci_list *val = NULL; - - dmuci_get_value_by_section_list((struct uci_section *)data, "origin", &val); - *value = dmuci_list_to_string(val, " "); - return 0; -} - -static int set_x_iopsys_eu_owsd_virtualhost_origin(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - char *pch, *spch; - - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_delete_by_section((struct uci_section *)data, "origin", NULL); - value = dmstrdup(value); - pch = strtok_r(value, " ", &spch); - while (pch != NULL) { - dmuci_add_list_value_by_section((struct uci_section *)data, "origin", pch); - pch = strtok_r(NULL, " ", &spch); - } - dmfree(value); - return 0; - } - return 0; -} - -////////////////////////SET AND GET ALIAS///////////////////////////////// -static int get_x_iopsys_eu_owsd_virtualhost_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct uci_section *dmmap_section = NULL; - - get_dmmap_section_of_config_section("dmmap_owsd", "owsd-listen", section_name((struct uci_section *)data), &dmmap_section); - dmuci_get_value_by_section_string(dmmap_section, "olistenalias", value); - if ((*value)[0] == '\0') - dmasprintf(value, "cpe-%s", instance); - return 0; -} - -static int set_x_iopsys_eu_owsd_virtualhost_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - struct uci_section *dmmap_section = NULL; - - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, NULL)) - return FAULT_9007; - return 0; - case VALUESET: - get_dmmap_section_of_config_section("dmmap_owsd", "owsd-listen", section_name((struct uci_section *)data), &dmmap_section); - dmuci_set_value_by_section(dmmap_section, "olistenalias", value); - return 0; - } - return 0; -} - -static int get_x_iopsys_eu_owsd_ubus_proxy_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_option_value_fallback_def("owsd","ubusproxy","enable", "1"); - return 0; -} - -static int set_x_iopsys_eu_owsd_ubus_proxy_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - switch (action) { - case VALUECHECK: - if (dm_validate_boolean(value)) - return FAULT_9007; - return 0; - case VALUESET: - string_to_bool(value, &b); - dmuci_set_value("owsd", "ubusproxy", "enable", b ? "1" : "0"); - return 0; - } - return 0; -} - -static int get_x_iopsys_eu_owsd_ubus_proxy_cert(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_option_value_string("owsd","ubusproxy","peer_cert", value); - return 0; -} - -static int set_x_iopsys_eu_owsd_ubus_proxy_cert(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_set_value("owsd", "ubusproxy", "peer_cert", value); - return 0; - } - return 0; -} - -static int get_x_iopsys_eu_owsd_ubus_proxy_key(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_option_value_string("owsd","ubusproxy","peer_key", value); - return 0; -} - -static int set_x_iopsys_eu_owsd_ubus_proxy_key(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_set_value("owsd", "ubusproxy", "peer_key", value); - return 0; - } - return 0; -} - -static int get_x_iopsys_eu_owsd_ubus_proxy_ca(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_option_value_string("owsd","ubusproxy","peer_ca", value); - return 0; -} - -static int set_x_iopsys_eu_owsd_ubus_proxy_ca(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_set_value("owsd", "ubusproxy", "peer_ca", value); - return 0; - } - return 0; -} - -static int get_x_iopsys_eu_owsd_virtualhost_certificate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "cert", value); - return 0; -} - -static int set_x_iopsys_eu_owsd_virtualhost_certificate(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "cert", value); - return 0; - } - return 0; -} - -static int get_x_iopsys_eu_owsd_virtualhost_key(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "key", value); - - return 0; -} - -static int set_x_iopsys_eu_owsd_virtualhost_key(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "key", value); - return 0; - } - return 0; -} - -static int get_x_iopsys_eu_owsd_virtualhost_ca(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "ca", value); - return 0; -} - -static int set_x_iopsys_eu_owsd_virtualhost_ca(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "ca", value); - return 0; - } - return 0; -} - -/***** ADD DEL OBJ *******/ -static int add_owsd_listen(char *refparam, struct dmctx *ctx, void *data, char **instancepara) -{ - struct uci_section *listen_sec = NULL, *dmmap_sec = NULL; - - char *instance = get_last_instance_bbfdm("dmmap_owsd", "owsd-listen", "olisteninstance"); - - dmuci_add_section("owsd", "owsd-listen", &listen_sec); - dmuci_set_value_by_section(listen_sec, "ipv6", "on"); - dmuci_set_value_by_section(listen_sec, "whitelist_interface_as_origin", "1"); - dmuci_add_list_value_by_section(listen_sec, "origin", "*"); - - dmuci_add_section_bbfdm("dmmap_owsd", "owsd-listen", &dmmap_sec); - dmuci_set_value_by_section(dmmap_sec, "section_name", section_name(listen_sec)); - *instancepara = update_instance(instance, 2, dmmap_sec, "olisteninstance"); - - return 0; -} - -static int delete_owsd_listen_instance(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) -{ - struct uci_section *s = NULL, *ss = NULL, *dmmap_section = NULL; - - int found = 0; - switch (del_action) { - case DEL_INST: - if (is_section_unnamed(section_name((struct uci_section *)data))) { - LIST_HEAD(dup_list); - delete_sections_save_next_sections("dmmap_owsd", "owsd-listen", "olisteninstance", section_name((struct uci_section *)data), atoi(instance), &dup_list); - update_dmmap_sections(&dup_list, "olisteninstance", "dmmap_owsd", "owsd-listen"); - dmuci_delete_by_section_unnamed((struct uci_section *)data, NULL, NULL); - } else { - get_dmmap_section_of_config_section("dmmap_owsd", "owsd-listen", section_name((struct uci_section *)data), &dmmap_section); - if (dmmap_section) - dmuci_delete_by_section_unnamed_bbfdm(dmmap_section, NULL, NULL); - dmuci_delete_by_section((struct uci_section *)data, NULL, NULL); - } - break; - case DEL_ALL: - uci_foreach_sections("owsd", "owsd-listen", s) { - if (found != 0) { - get_dmmap_section_of_config_section("dmmap_owsd", "listen", section_name(s), &dmmap_section); - if (dmmap_section) - dmuci_delete_by_section(dmmap_section, NULL, NULL); - dmuci_delete_by_section(ss, NULL, NULL); - } - ss = s; - found++; - } - if (ss != NULL) { - get_dmmap_section_of_config_section("dmmap_owsd", "listen", section_name(ss), &dmmap_section); - if (dmmap_section) - dmuci_delete_by_section(dmmap_section, NULL, NULL); - dmuci_delete_by_section(ss, NULL, NULL); - } - return 0; - } - return 0; -} - -/*** DMROOT.X_IOPSYS_EU_OWSD. ***/ -DMLEAF X_IOPSYS_EU_OWSDParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"UnixSocket", &DMWRITE, DMT_STRING, get_x_iopsys_eu_owsd_global_sock, set_x_iopsys_eu_owsd_global_sock, BBFDM_BOTH}, -{"URLRedirect", &DMWRITE, DMT_STRING, get_x_iopsys_eu_owsd_global_redirect, set_x_iopsys_eu_owsd_global_redirect, BBFDM_BOTH}, -{0} -}; - -DMOBJ X_IOPSYS_EU_OWSDObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"UbusProxy", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, UbusProxyParams, NULL, BBFDM_BOTH}, -{"VirtualHost", &DMWRITE, add_owsd_listen, delete_owsd_listen_instance, NULL, browseXIopsysEuOWSDVirtualHost, NULL, NULL, VirtualHostParams, NULL, BBFDM_BOTH}, -{0} -}; - -DMLEAF UbusProxyParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"Enable", &DMWRITE, DMT_BOOL, get_x_iopsys_eu_owsd_ubus_proxy_enable, set_x_iopsys_eu_owsd_ubus_proxy_enable, BBFDM_BOTH}, -{"PeerCertificate", &DMWRITE, DMT_STRING, get_x_iopsys_eu_owsd_ubus_proxy_cert, set_x_iopsys_eu_owsd_ubus_proxy_cert, BBFDM_BOTH}, -{"PeerKey", &DMWRITE, DMT_STRING, get_x_iopsys_eu_owsd_ubus_proxy_key, set_x_iopsys_eu_owsd_ubus_proxy_key, BBFDM_BOTH}, -{"PeerCA", &DMWRITE, DMT_STRING, get_x_iopsys_eu_owsd_ubus_proxy_ca, set_x_iopsys_eu_owsd_ubus_proxy_ca, BBFDM_BOTH}, -{0} -}; - -DMLEAF VirtualHostParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"Alias", &DMWRITE, DMT_STRING, get_x_iopsys_eu_owsd_virtualhost_alias, set_x_iopsys_eu_owsd_virtualhost_alias, BBFDM_BOTH}, -{"Interface", &DMWRITE, DMT_STRING, get_x_iopsys_eu_owsd_virtualhost_interface, set_x_iopsys_eu_owsd_virtualhost_interface, BBFDM_BOTH}, -{"Port", &DMWRITE, DMT_UNINT, get_x_iopsys_eu_owsd_virtualhost_port, set_x_iopsys_eu_owsd_virtualhost_port, BBFDM_BOTH}, -{"IPv6Enable", &DMWRITE, DMT_BOOL, get_x_iopsys_eu_owsd_virtualhost_ipv6_enable, set_x_iopsys_eu_owsd_virtualhost_ipv6_enable, BBFDM_BOTH}, -{"AllowInterfaceIPAddressAsOrigin", &DMWRITE, DMT_BOOL, get_x_iopsys_eu_owsd_virtualhost_whitelist_interface, set_x_iopsys_eu_owsd_virtualhost_whitelist_interface, BBFDM_BOTH}, -{"AllowDHCPDomainsAsOrigin", &DMWRITE, DMT_BOOL, get_x_iopsys_eu_owsd_virtualhost_whitelist_dhcp, set_x_iopsys_eu_owsd_virtualhost_whitelist_dhcp, BBFDM_BOTH}, -{"AllowedOrigins", &DMWRITE, DMT_STRING, get_x_iopsys_eu_owsd_virtualhost_origin, set_x_iopsys_eu_owsd_virtualhost_origin, BBFDM_BOTH}, -{"Certificate", &DMWRITE, DMT_STRING, get_x_iopsys_eu_owsd_virtualhost_certificate, set_x_iopsys_eu_owsd_virtualhost_certificate, BBFDM_BOTH}, -{"Key", &DMWRITE, DMT_STRING, get_x_iopsys_eu_owsd_virtualhost_key, set_x_iopsys_eu_owsd_virtualhost_key, BBFDM_BOTH}, -{"CA", &DMWRITE, DMT_STRING, get_x_iopsys_eu_owsd_virtualhost_ca, set_x_iopsys_eu_owsd_virtualhost_ca, BBFDM_BOTH}, -{0} -}; diff --git a/dmtree/tr181/x_iopsys_eu_owsd.h b/dmtree/tr181/x_iopsys_eu_owsd.h deleted file mode 100644 index 9a9eb96f..00000000 --- a/dmtree/tr181/x_iopsys_eu_owsd.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2019 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 Imen Bhiri - * Author Omar Kallel - * - */ - -#ifndef __SE_OWSD_H -#define __SE_OWSD_H - -#include - -extern DMLEAF X_IOPSYS_EU_OWSDParams[]; -extern DMOBJ X_IOPSYS_EU_OWSDObj[]; -extern DMLEAF VirtualHostParams[]; -extern DMLEAF UbusProxyParams[]; - -#endif diff --git a/dmtree/tr181/x_iopsys_eu_syslog.c b/dmtree/tr181/x_iopsys_eu_syslog.c deleted file mode 100644 index e135515d..00000000 --- a/dmtree/tr181/x_iopsys_eu_syslog.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2019 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 Imen Bhiri - * - */ - -#include "x_iopsys_eu_syslog.h" - - -static int get_server_ip_address(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_option_value_string("system", "@system[0]", "log_ip", value); - return 0; -} - -static int set_server_ip_address(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_set_value("system", "@system[0]", "log_ip", value); - return 0; - } - return 0; -} - -static int get_server_port_number(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_option_value_fallback_def("system", "@system[0]", "log_port", "514"); - return 0; -} - -static int set_server_port_number(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_set_value("system", "@system[0]", "log_port", value); - return 0; - } - return 0; -} - -static int get_remote_log_level(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_option_value_fallback_def("system", "@system[0]", "conloglevel", "7"); - return 0; -} - -static int set_remote_log_level(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_set_value("system", "@system[0]", "conloglevel", value); - return 0; - } - return 0; -} - -/*** DMROOT.X_IOPSYS_EU_Syslog. ***/ -DMLEAF tSe_SyslogParam[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"ServerIPAddress", &DMWRITE, DMT_STRING, get_server_ip_address, set_server_ip_address, BBFDM_BOTH}, -{"ServerPort", &DMWRITE, DMT_UNINT, get_server_port_number, set_server_port_number, BBFDM_BOTH}, -{"ConsoleLogLevel", &DMWRITE, DMT_UNINT, get_remote_log_level, set_remote_log_level, BBFDM_BOTH}, -{0} -}; diff --git a/dmtree/vendor/iopsys/tr181/bridging.c b/dmtree/vendor/iopsys/tr181/bridging.c new file mode 100644 index 00000000..2e8d4e61 --- /dev/null +++ b/dmtree/vendor/iopsys/tr181/bridging.c @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2021 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 Ramdhane + * + */ + +#include "tr181/bridging.h" +#include "bridging.h" + +static int get_BridgingBridgePort_Egress_PriorityRegeneration(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + bridging_get_priority_list("egress_qos_mapping", data, value); + return 0; +} + +static int set_BridgingBridgePort_Egress_PriorityRegeneration(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_unsignedInt_list(value, 8, 8, -1, RANGE_ARGS{{"0","7"}}, 1)) + return FAULT_9007; + return 0; + + case VALUESET: + bridging_set_priority_list("egress_qos_mapping", data, value); + return 0; + } + return 0; +} + +static int get_BridgingBridgePort_DSCP_Eth_Priority_Map(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + bridging_get_priority_list("dscp2pbit", data, value); + return 0; +} + +static int set_BridgingBridgePort_DSCP_Eth_Priority_Map(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_unsignedInt_list(value, 1, 64, -1, RANGE_ARGS{{"0","7"}}, 1)) + return FAULT_9007; + return 0; + + case VALUESET: + bridging_set_priority_list("dscp2pbit", data, value); + return 0; + } + return 0; +} + +/********************************************************************************************************************************** +* OBJ & PARAM DEFINITION +***********************************************************************************************************************************/ +DMLEAF tIOPSYS_BridgingBridgePortParams[] = { +/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ +{BBF_VENDOR_PREFIX"EgressPriorityRegeneration", &DMWRITE, DMT_STRING, get_BridgingBridgePort_Egress_PriorityRegeneration, set_BridgingBridgePort_Egress_PriorityRegeneration, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"DSCPEthernetPriorityMapping", &DMWRITE, DMT_STRING, get_BridgingBridgePort_DSCP_Eth_Priority_Map, set_BridgingBridgePort_DSCP_Eth_Priority_Map, BBFDM_BOTH}, +{0} +}; diff --git a/dmtree/vendor/iopsys/tr181/bridging.h b/dmtree/vendor/iopsys/tr181/bridging.h new file mode 100644 index 00000000..05807fe7 --- /dev/null +++ b/dmtree/vendor/iopsys/tr181/bridging.h @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2021 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 Ramdhane + * + */ + +#ifndef __IOPSYS_BRIDGING_H +#define __IOPSYS_BRIDGING_H + +#include + +extern DMLEAF tIOPSYS_BridgingBridgePortParams[]; + +#endif //__IOPSYS_BRIDGING_H diff --git a/dmtree/vendor/iopsys/tr181/device.c b/dmtree/vendor/iopsys/tr181/device.c new file mode 100644 index 00000000..a5a65639 --- /dev/null +++ b/dmtree/vendor/iopsys/tr181/device.c @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2021 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 Ramdhane + * + */ + +#include "device.h" +#include "x_iopsys_eu_igmp.h" +#include "x_iopsys_eu_mld.h" + +DMOBJ tIOPSYS_DeviceObj[] = { +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{BBF_VENDOR_PREFIX"IGMP", &DMREAD, NULL, NULL, "file:/etc/config/mcast", NULL, NULL, NULL, X_IOPSYS_EU_IGMPObj, X_IOPSYS_EU_IGMPParams, NULL, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"MLD", &DMREAD, NULL, NULL, "file:/etc/config/mcast", NULL, NULL, NULL, X_IOPSYS_EU_MLDObj, X_IOPSYS_EU_MLDParams, NULL, BBFDM_BOTH}, +{0} +}; diff --git a/dmtree/vendor/iopsys/tr181/device.h b/dmtree/vendor/iopsys/tr181/device.h new file mode 100644 index 00000000..14a3a8b7 --- /dev/null +++ b/dmtree/vendor/iopsys/tr181/device.h @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2021 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 Ramdhane + * + */ + +#ifndef __IOPSYS_DEVICE_H +#define __IOPSYS_DEVICE_H + +#include + +extern DMOBJ tIOPSYS_DeviceObj[]; + +#endif //__IOPSYS_DEVICE_H diff --git a/dmtree/vendor/iopsys/tr181/deviceinfo.c b/dmtree/vendor/iopsys/tr181/deviceinfo.c new file mode 100644 index 00000000..b3e67c44 --- /dev/null +++ b/dmtree/vendor/iopsys/tr181/deviceinfo.c @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2021 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 Ramdhane + * + */ + +#include "deviceinfo.h" + +static int get_base_mac_addr(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + db_get_value_string("device", "deviceinfo", "BaseMACAddress", value); + return 0; +} + +/********************************************************************************************************************************** +* OBJ & PARAM DEFINITION +***********************************************************************************************************************************/ +DMLEAF tIOPSYS_DeviceInfoParams[] = { +/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ +{BBF_VENDOR_PREFIX"BaseMACAddress", &DMREAD, DMT_STRING, get_base_mac_addr, NULL, BBFDM_BOTH}, +{0} +}; diff --git a/dmtree/vendor/iopsys/tr181/deviceinfo.h b/dmtree/vendor/iopsys/tr181/deviceinfo.h new file mode 100644 index 00000000..dd77480f --- /dev/null +++ b/dmtree/vendor/iopsys/tr181/deviceinfo.h @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2021 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 Ramdhane + * + */ + +#ifndef __IOPSYS_DEVICEINFO_H +#define __IOPSYS_DEVICEINFO_H + +#include + +extern DMLEAF tIOPSYS_DeviceInfoParams[]; + +#endif //__IOPSYS_DEVICEINFO_H diff --git a/dmtree/vendor/iopsys/tr181/ethernet.c b/dmtree/vendor/iopsys/tr181/ethernet.c new file mode 100644 index 00000000..ea9f02ef --- /dev/null +++ b/dmtree/vendor/iopsys/tr181/ethernet.c @@ -0,0 +1,124 @@ +/* + * Copyright (C) 2021 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 Ramdhane + * + */ + +#include "tr181/ethernet.h" +#include "ethernet.h" + +static int get_EthernetVLANTermination_MACVLAN(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "type", value); + *value = (strcmp(*value, "macvlan") == 0) ? "1" : "0"; + return 0; +} + +static int set_EthernetVLANTermination_MACVLAN(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + char *name, *ifname; + bool b; + + switch (action) { + case VALUECHECK: + if (dm_validate_boolean(value)) + return FAULT_9007; + break; + case VALUESET: + string_to_bool(value, &b); + dmuci_get_value_by_section_string((struct uci_section *)data, "ifname", &ifname); + dmuci_get_value_by_section_string((struct uci_section *)data, "name", &name); + struct uci_section *s = NULL, *dmmap_s = NULL; + if (b && *name != '\0') { + char *link_instance = NULL, new_name[16] = {0}; + int name_found = 0; + + uci_foreach_option_eq("network", "interface", "ifname", name, s) { + + get_dmmap_section_of_config_section_eq("dmmap", "link", "device", ifname, &dmmap_s); + if (dmmap_s) { + dmuci_get_value_by_section_string(dmmap_s, "link_instance", &link_instance); + snprintf(new_name, sizeof(new_name), "%s_%s", ifname, link_instance); + + if (ethernet_name_exists_in_devices(new_name)) + return -1; + + dmuci_set_value_by_section(dmmap_s, "device", new_name); + dmuci_set_value_by_section(dmmap_s, "section_name", section_name(s)); + + } + + dmuci_set_value_by_section(s, "ifname", new_name); + + name_found = 1; + break; + } + + if (name_found == 0) { + int ifname_found = 0; + struct uci_section *ss = NULL; + + uci_foreach_option_eq("network", "interface", "ifname", ifname, ss) { + + uci_path_foreach_option_eq(bbfdm, "dmmap", "link", "device", ifname, dmmap_s) { + char *sec_name; + dmuci_get_value_by_section_string(dmmap_s, "section_name", &sec_name); + /* Check section name exist => if yes, continue*/ + if (!ethernet_check_section_in_curr_section(sec_name, section_name(ss))) + continue; + + dmuci_get_value_by_section_string(dmmap_s, "link_instance", &link_instance); + snprintf(new_name, sizeof(new_name), "%s_%s", ifname, link_instance); + + if (ethernet_name_exists_in_devices(new_name)) + return -1; + + dmuci_set_value_by_section(dmmap_s, "device", new_name); + dmuci_set_value_by_section(dmmap_s, "section_name", section_name(ss)); + } + + dmuci_set_value_by_section(ss, "ifname", new_name); + + ifname_found = 1; + break; + } + + if (ifname_found == 0) { + get_dmmap_section_of_config_section_eq("dmmap", "link", "device", ifname, &dmmap_s); + if (dmmap_s) { + dmuci_get_value_by_section_string(dmmap_s, "link_instance", &link_instance); + snprintf(new_name, sizeof(new_name), "%s_%s", ifname, link_instance); + + if (ethernet_name_exists_in_devices(new_name)) + return -1; + + dmuci_set_value_by_section(dmmap_s, "device", new_name); + dmuci_set_value_by_section(dmmap_s, "section_name", ""); + + } + } + } + + dmuci_set_value_by_section((struct uci_section *)data, "name", new_name); + dmuci_set_value_by_section((struct uci_section *)data, "type", "macvlan"); + } else { + dmuci_set_value_by_section((struct uci_section *)data, "type", b ? "macvlan" : "8021q"); + } + break; + } + return 0; +} + +/********************************************************************************************************************************** +* OBJ & PARAM DEFINITION +***********************************************************************************************************************************/ +DMLEAF tIOPSYS_EthernetVLANTerminationParams[] = { +/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ +{BBF_VENDOR_PREFIX"MACVLAN", &DMWRITE, DMT_BOOL, get_EthernetVLANTermination_MACVLAN, set_EthernetVLANTermination_MACVLAN, BBFDM_BOTH}, +{0} +}; diff --git a/dmtree/vendor/iopsys/tr181/ethernet.h b/dmtree/vendor/iopsys/tr181/ethernet.h new file mode 100644 index 00000000..45572139 --- /dev/null +++ b/dmtree/vendor/iopsys/tr181/ethernet.h @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2021 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 Ramdhane + * + */ + +#ifndef __IOPSYS_ETHERNET_H +#define __IOPSYS_ETHERNET_H + +#include + +extern DMLEAF tIOPSYS_EthernetVLANTerminationParams[]; + +#endif //__IOPSYS_ETHERNET_H diff --git a/dmtree/vendor/iopsys/tr181/ieee1905.c b/dmtree/vendor/iopsys/tr181/ieee1905.c new file mode 100644 index 00000000..05ce95bb --- /dev/null +++ b/dmtree/vendor/iopsys/tr181/ieee1905.c @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2021 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 Ramdhane + * + */ + +#include "ieee1905.h" + +static int browseIEEE1905ALNetworkTopologyNonIEEE1905NeighborInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) +{ + json_object *res = NULL, *arrobj = NULL, *res_self = NULL; + char *inst = NULL, *max_inst = NULL, *obj = NULL; + int id = 0, i = 0; + + dmubus_call("topology", "dump", UBUS_ARGS{}, 0, &res_self); + if (res_self) + json_object_object_get_ex(res_self, "self", &res); + dmjson_foreach_value_in_array(res, arrobj, obj, i, 1, "non1905_neighbors") { + + inst = handle_update_instance(1, dmctx, &max_inst, update_instance_without_section, 1, ++id); + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)obj, inst) == DM_STOP) + break; + } + return 0; +} + +static int get_IEEE1905ALNetworkTopology_NonIEEE1905NeighborNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + json_object *res = NULL, *obj = NULL, *obj_nbr = NULL; + size_t num_nodes = 0; + + dmubus_call("topology", "dump", UBUS_ARGS{}, 0, &res); + DM_ASSERT(res, *value = "0"); + json_object_object_get_ex(res, "self", &obj); + if (obj) { + json_object_object_get_ex(obj, "non1905_neighbors", &obj_nbr); + num_nodes = (obj_nbr) ? json_object_array_length(obj_nbr) : 0; + } + dmasprintf(value, "%d", num_nodes); + return 0; +} + +static int get_IEEE1905ALNetworkTopologyNonIEEE1905Neighbor(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = (char *)data; + return 0; +} + +/********************************************************************************************************************************** +* OBJ & PARAM DEFINITION +***********************************************************************************************************************************/ +/* *** Device.IEEE1905.AL.NetworkTopology. *** */ +DMOBJ tIOPSYS_IEEE1905ALNetworkTopologyObj[] = { +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{BBF_VENDOR_PREFIX"NonIEEE1905Neighbor", &DMREAD, NULL, NULL, NULL, browseIEEE1905ALNetworkTopologyNonIEEE1905NeighborInst, NULL, NULL, NULL, tIEEE1905ALNetworkTopologyNonIEEE1905NeighborParams, NULL, BBFDM_BOTH}, +{0} +}; + +DMLEAF tIOPSYS_IEEE1905ALNetworkTopologyParams[] = { +/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ +{BBF_VENDOR_PREFIX"NonIEEE1905NeighborNumberOfEntries", &DMREAD, DMT_UNINT, get_IEEE1905ALNetworkTopology_NonIEEE1905NeighborNumberOfEntries, NULL, BBFDM_BOTH}, +{0} +}; + +/* *** Device.IEEE1905.AL.NetworkTopology.X_IOPSYS_EU_NonIEEE1905Neighbor.{i}. *** */ +DMLEAF tIEEE1905ALNetworkTopologyNonIEEE1905NeighborParams[] = { +/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ +{"NonIEEE1905NeighborId", &DMREAD, DMT_STRING, get_IEEE1905ALNetworkTopologyNonIEEE1905Neighbor, NULL, BBFDM_BOTH}, +{0} +}; diff --git a/dmtree/vendor/iopsys/tr181/ieee1905.h b/dmtree/vendor/iopsys/tr181/ieee1905.h new file mode 100644 index 00000000..60a89f6b --- /dev/null +++ b/dmtree/vendor/iopsys/tr181/ieee1905.h @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2021 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 Ramdhane + * + */ + +#ifndef __IOPSYS_IEEE1905_H +#define __IOPSYS_IEEE1905_H + +#include + +extern DMOBJ tIOPSYS_IEEE1905ALNetworkTopologyObj[]; +extern DMLEAF tIOPSYS_IEEE1905ALNetworkTopologyParams[]; +extern DMLEAF tIEEE1905ALNetworkTopologyNonIEEE1905NeighborParams[]; + +#endif //__IOPSYS_IEEE1905_H diff --git a/dmtree/vendor/iopsys/tr181/times.c b/dmtree/vendor/iopsys/tr181/times.c new file mode 100644 index 00000000..f34b6b97 --- /dev/null +++ b/dmtree/vendor/iopsys/tr181/times.c @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2021 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 Ramdhane + * + */ + +#include "dmentry.h" +#include "times.h" + +static int get_local_time_zone_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_option_value_string("system", "@system[0]", "zonename", value); + return 0; +} + +static int get_time_source_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + char *iface = NULL; + + dmuci_get_option_value_string("system", "ntp", "interface", &iface); + if (*iface == '\0' || strlen(iface) == 0) + return 0; + adm_entry_get_linker_param(ctx, "Device.IP.Interface.", iface, value); + if (*value == NULL) + *value = ""; + return 0; +} + +static int set_time_source_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + char *iface = NULL; + + switch (action) { + case VALUECHECK: + adm_entry_get_linker_value(ctx, value, &iface); + if (iface == NULL || iface[0] == '\0') + return FAULT_9007; + break; + case VALUESET: + adm_entry_get_linker_value(ctx, value, &iface); + dmuci_set_value("system", "ntp", "interface", iface); + return 0; + } + return 0; +} + +/********************************************************************************************************************************** +* OBJ & PARAM DEFINITION +***********************************************************************************************************************************/ +DMLEAF tIOPSYS_TimeParams[] = { +/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ +{BBF_VENDOR_PREFIX"LocalTimeZoneName", &DMREAD, DMT_STRING, get_local_time_zone_name, NULL, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"SourceInterface", &DMWRITE, DMT_STRING, get_time_source_interface, set_time_source_interface, BBFDM_BOTH}, +{0} +}; diff --git a/dmtree/vendor/iopsys/tr181/times.h b/dmtree/vendor/iopsys/tr181/times.h new file mode 100644 index 00000000..10b471d7 --- /dev/null +++ b/dmtree/vendor/iopsys/tr181/times.h @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2021 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 Ramdhane + * + */ + +#ifndef __IOPSYS_TIMES_H +#define __IOPSYS_TIMES_H + +#include + +extern DMLEAF tIOPSYS_TimeParams[]; + +#endif //__IOPSYS_TIMES_H diff --git a/dmtree/vendor/iopsys/tr181/vendor.c b/dmtree/vendor/iopsys/tr181/vendor.c new file mode 100644 index 00000000..335b3f4c --- /dev/null +++ b/dmtree/vendor/iopsys/tr181/vendor.c @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2021 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 Ramdhane + * + */ + +#include "device.h" +#include "deviceinfo.h" +#include "bridging.h" +#include "ethernet.h" +#include "ieee1905.h" +#include "ip.h" +#include "times.h" +#include "vendor.h" + +DM_MAP_OBJ tVendorExtensionIOPSYS[] = { +/* parentobj, nextobject, parameter */ +{"Device.", tIOPSYS_DeviceObj, NULL}, +{"Device.DeviceInfo.", NULL, tIOPSYS_DeviceInfoParams}, +{"Device.Ethernet.VLANTermination.{i}.", NULL, tIOPSYS_EthernetVLANTerminationParams}, +{"Device.Time.", NULL, tIOPSYS_TimeParams}, +{"Device.IEEE1905.AL.NetworkTopology.", tIOPSYS_IEEE1905ALNetworkTopologyObj, tIOPSYS_IEEE1905ALNetworkTopologyParams}, +{"Device.Bridging.Bridge.{i}.Port.{i}.", NULL, tIOPSYS_BridgingBridgePortParams}, +{0} +}; diff --git a/dmtree/vendor/iopsys/tr181/vendor.h b/dmtree/vendor/iopsys/tr181/vendor.h new file mode 100644 index 00000000..bbfde365 --- /dev/null +++ b/dmtree/vendor/iopsys/tr181/vendor.h @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2021 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 Ramdhane + * + */ + +#ifndef __IOPSYS_VENDOR_H +#define __IOPSYS_VENDOR_H + +#include + +extern DM_MAP_OBJ tVendorExtensionIOPSYS[]; + +#endif //__IOPSYS_VENDOR_H diff --git a/dmtree/tr181/x_iopsys_eu_igmp.c b/dmtree/vendor/iopsys/tr181/x_iopsys_eu_igmp.c similarity index 96% rename from dmtree/tr181/x_iopsys_eu_igmp.c rename to dmtree/vendor/iopsys/tr181/x_iopsys_eu_igmp.c index 67047227..31b6331e 100644 --- a/dmtree/tr181/x_iopsys_eu_igmp.c +++ b/dmtree/vendor/iopsys/tr181/x_iopsys_eu_igmp.c @@ -10,7 +10,6 @@ */ #include "dmentry.h" -#include "ethernet.h" #include "x_iopsys_eu_igmp.h" static void get_mcast_iface_key(char *p_ifname, char *key, size_t key_size) @@ -95,6 +94,28 @@ static void add_empty_mcast_iface_to_list(char *dmmap_package, char *dmmap_sec, } } +void get_mcast_bridge_port_linker(struct dmctx *ctx, char *intf_name, char **value) +{ + struct uci_section *dmmap_br_section = NULL, *bridge_port_s = NULL; + + *value = NULL; + get_dmmap_section_of_config_section("dmmap_bridge", "bridge", intf_name, &dmmap_br_section); + if (dmmap_br_section != NULL) { + char *br_inst, *mg; + dmuci_get_value_by_section_string(dmmap_br_section, "bridge_instance", &br_inst); + uci_path_foreach_option_eq(bbfdm, "dmmap_bridge_port", "bridge_port", "br_inst", br_inst, bridge_port_s) { + dmuci_get_value_by_section_string(bridge_port_s, "management", &mg); + if (strcmp(mg, "1") == 0) { + char *device, linker[512] = ""; + dmuci_get_value_by_section_string(bridge_port_s, "device", &device); + snprintf(linker, sizeof(linker), "br_%s:%s+%s", br_inst, section_name(bridge_port_s), device); + adm_entry_get_linker_param(ctx, "Device.Bridging.Bridge.", linker, value); + break; + } + } + } +} + void synchronize_specific_config_sections_with_dmmap_mcast_iface(char *package, char *section_type, void *data, char *dmmap_package, char *dmmap_sec, char *proto, struct list_head *dup_list) @@ -944,7 +965,7 @@ int get_mcast_snooping_interface(char *refparam, struct dmctx *ctx, void *data, DM_STRNCPY(sec_name, end, sizeof(sec_name)); // In the dmmap_bridge file, the details related to the instance id etc. associated with this bridge // is stored, we now switch our focus to it to extract the necessary information. - get_bridge_port_linker(ctx, sec_name, value); + get_mcast_bridge_port_linker(ctx, sec_name, value); if (*value == NULL) *value = ""; @@ -1823,7 +1844,7 @@ static int get_igmpp_interface_iface(char *refparam, struct dmctx *ctx, void *da adm_entry_get_linker_param(ctx, "Device.IP.Interface.", sec_name, value); } else { // It is a L2 bridge, get the linker accordingly - get_bridge_port_linker(ctx, sec_name, value); + get_mcast_bridge_port_linker(ctx, sec_name, value); } break; } @@ -1980,11 +2001,14 @@ int set_mcastp_iface_snoop_mode(char *refparam, struct dmctx *ctx, void *data, c return 0; } +/********************************************************************************************************************************** +* OBJ & PARAM DEFINITION +***********************************************************************************************************************************/ /* ***Device.X_IOPSYS_EU_IGMP. *** */ DMOBJ X_IOPSYS_EU_IGMPObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Snooping", &DMWRITE, add_igmp_snooping_obj, del_igmp_snooping_obj, NULL, browse_igmp_snooping_inst, NULL, X_IOPSYS_EU_IGMPSnoopingObj, X_IOPSYS_EU_IGMPSnoopingParams, NULL, BBFDM_BOTH}, -{"Proxy", &DMWRITE, add_igmp_proxy_obj, del_igmp_proxy_obj, NULL, browse_igmp_proxy_inst, NULL, X_IOPSYS_EU_IGMPProxyObj, X_IOPSYS_EU_IGMPProxyParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Snooping", &DMWRITE, add_igmp_snooping_obj, del_igmp_snooping_obj, NULL, browse_igmp_snooping_inst, NULL, NULL, X_IOPSYS_EU_IGMPSnoopingObj, X_IOPSYS_EU_IGMPSnoopingParams, NULL, BBFDM_BOTH}, +{"Proxy", &DMWRITE, add_igmp_proxy_obj, del_igmp_proxy_obj, NULL, browse_igmp_proxy_inst, NULL, NULL, X_IOPSYS_EU_IGMPProxyObj, X_IOPSYS_EU_IGMPProxyParams, NULL, BBFDM_BOTH}, {0} }; @@ -1995,14 +2019,14 @@ DMLEAF X_IOPSYS_EU_IGMPParams[] = { }; DMOBJ X_IOPSYS_EU_IGMPSnoopingObj[] = { -{"ClientGroup", &DMREAD, NULL, NULL, NULL, browse_igmp_cgrp_inst, NULL, IGMPSnoopingCLientGroupObj, IGMPSnoopingClientGroupParams, NULL, BBFDM_BOTH}, -{"Filter", &DMWRITE, add_igmps_filter_obj, del_mcasts_filter_obj, NULL, browse_igmps_filter_inst, NULL, NULL, IGMPSnoopingFilterParams, NULL, BBFDM_BOTH}, +{"ClientGroup", &DMREAD, NULL, NULL, NULL, browse_igmp_cgrp_inst, NULL, NULL, IGMPSnoopingCLientGroupObj, IGMPSnoopingClientGroupParams, NULL, BBFDM_BOTH}, +{"Filter", &DMWRITE, add_igmps_filter_obj, del_mcasts_filter_obj, NULL, browse_igmps_filter_inst, NULL, NULL, NULL, IGMPSnoopingFilterParams, NULL, BBFDM_BOTH}, {0} }; DMOBJ IGMPSnoopingCLientGroupObj[] = { -{"AssociatedDevice", &DMREAD, NULL, NULL, NULL, browse_igmp_cgrp_assoc_dev_inst, NULL, NULL, IGMPSnoopingClientGroupAssociatedDeviceParams, NULL, BBFDM_BOTH}, -//{"ClientGroupStats", &DMREAD, NULL, NULL, NULL, browse_igmps_cgrp_stats_inst, NULL, NULL, NULL, IGMPSnoopingClientGroupStatsParams, NULL, BBFDM_BOTH}, +{"AssociatedDevice", &DMREAD, NULL, NULL, NULL, browse_igmp_cgrp_assoc_dev_inst, NULL, NULL, NULL, IGMPSnoopingClientGroupAssociatedDeviceParams, NULL, BBFDM_BOTH}, +//{"ClientGroupStats", &DMREAD, NULL, NULL, NULL, browse_igmps_cgrp_stats_inst, NULL, NULL, NULL, NULL, IGMPSnoopingClientGroupStatsParams, NULL, BBFDM_BOTH}, {0} }; @@ -2050,15 +2074,15 @@ DMLEAF X_IOPSYS_EU_IGMPSnoopingParams[] = { }; DMOBJ X_IOPSYS_EU_IGMPProxyObj[] = { -{"Interface", &DMWRITE, add_igmpp_interface_obj, del_igmpp_interface_obj, NULL, browse_igmpp_interface_inst, NULL, NULL, IGMPProxyInterfaceParams, NULL, BBFDM_BOTH}, -{"ClientGroup", &DMREAD, NULL, NULL, NULL, browse_igmp_cgrp_inst, NULL, IGMPProxyCLientGroupObj, IGMPProxyClientGroupParams, NULL, BBFDM_BOTH}, -{"Filter", &DMWRITE, add_igmpp_filter_obj, del_mcastp_filter_obj, NULL, browse_igmpp_filter_inst, NULL, NULL, IGMPProxyFilterParams, NULL, BBFDM_BOTH}, +{"Interface", &DMWRITE, add_igmpp_interface_obj, del_igmpp_interface_obj, NULL, browse_igmpp_interface_inst, NULL, NULL, NULL, IGMPProxyInterfaceParams, NULL, BBFDM_BOTH}, +{"ClientGroup", &DMREAD, NULL, NULL, NULL, browse_igmp_cgrp_inst, NULL, NULL, IGMPProxyCLientGroupObj, IGMPProxyClientGroupParams, NULL, BBFDM_BOTH}, +{"Filter", &DMWRITE, add_igmpp_filter_obj, del_mcastp_filter_obj, NULL, browse_igmpp_filter_inst, NULL, NULL, NULL, IGMPProxyFilterParams, NULL, BBFDM_BOTH}, {0} }; DMOBJ IGMPProxyCLientGroupObj[] = { -{"AssociatedDevice", &DMREAD, NULL, NULL, NULL, browse_igmp_cgrp_assoc_dev_inst, NULL, NULL, IGMPProxyClientGroupAssociatedDeviceParams, NULL, BBFDM_BOTH}, -//{"ClientGroupStats", &DMREAD, NULL, NULL, NULL, browse_igmpp_cgrp_stats_inst, NULL, NULL, IGMPProxyClientGroupStatsParams, NULL, BBFDM_BOTH}, +{"AssociatedDevice", &DMREAD, NULL, NULL, NULL, browse_igmp_cgrp_assoc_dev_inst, NULL, NULL, NULL, IGMPProxyClientGroupAssociatedDeviceParams, NULL, BBFDM_BOTH}, +//{"ClientGroupStats", &DMREAD, NULL, NULL, NULL, browse_igmpp_cgrp_stats_inst, NULL, NULL, NULL, IGMPProxyClientGroupStatsParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/x_iopsys_eu_igmp.h b/dmtree/vendor/iopsys/tr181/x_iopsys_eu_igmp.h similarity index 97% rename from dmtree/tr181/x_iopsys_eu_igmp.h rename to dmtree/vendor/iopsys/tr181/x_iopsys_eu_igmp.h index 00b501fd..ee107fe0 100644 --- a/dmtree/tr181/x_iopsys_eu_igmp.h +++ b/dmtree/vendor/iopsys/tr181/x_iopsys_eu_igmp.h @@ -9,8 +9,8 @@ * */ -#ifndef __SE_IGMP_H -#define __SE_IGMP_H +#ifndef __IOPSYS_IGMP_H +#define __IOPSYS_IGMP_H #include @@ -84,6 +84,7 @@ void update_snooping_mode(struct uci_section *s); int get_mcast_snooping_interface_val(char *value, char *ifname, size_t s_ifname); int del_proxy_obj(void *data, char *proto, unsigned char del_action); int del_snooping_obj(void *data, char *proto, unsigned char del_action); +void get_mcast_bridge_port_linker(struct dmctx *ctx, char *intf_name, char **value); int browse_proxy_interface_inst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *proto); int browse_filter_inst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *section_type, char *option_name, char *option_value); @@ -94,4 +95,4 @@ void synchronize_specific_config_sections_with_dmmap_mcast_filter(char *package, void *data, char *dmmap_package, char *dmmap_sec, char *proto, struct list_head *dup_list); -#endif +#endif //__IOPSYS_IGMP_H diff --git a/dmtree/tr181/x_iopsys_eu_mld.c b/dmtree/vendor/iopsys/tr181/x_iopsys_eu_mld.c similarity index 94% rename from dmtree/tr181/x_iopsys_eu_mld.c rename to dmtree/vendor/iopsys/tr181/x_iopsys_eu_mld.c index 5a9b567a..88beb370 100644 --- a/dmtree/tr181/x_iopsys_eu_mld.c +++ b/dmtree/vendor/iopsys/tr181/x_iopsys_eu_mld.c @@ -10,7 +10,6 @@ */ #include "dmentry.h" -#include "ethernet.h" #include "x_iopsys_eu_mld.h" #include "x_iopsys_eu_igmp.h" @@ -579,7 +578,7 @@ static int get_mldp_interface_iface(char *refparam, struct dmctx *ctx, void *dat adm_entry_get_linker_param(ctx, "Device.IP.Interface.", sec_name, value); } else { // It is a L2 bridge, get the linker accordingly - get_bridge_port_linker(ctx, sec_name, value); + get_mcast_bridge_port_linker(ctx, sec_name, value); } break; } @@ -641,11 +640,14 @@ static int set_mldp_interface_upstream(char *refparam, struct dmctx *ctx, void * return 0; } +/********************************************************************************************************************************** +* OBJ & PARAM DEFINITION +***********************************************************************************************************************************/ /* ***Device.X_IOPSYS_EU_MLD. *** */ DMOBJ X_IOPSYS_EU_MLDObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Snooping", &DMWRITE, add_mld_snooping_obj, del_mld_snooping_obj, NULL, browse_mld_snooping_inst, NULL, X_IOPSYS_EU_MLDSnoopingObj, X_IOPSYS_EU_MLDSnoopingParams, NULL, BBFDM_BOTH}, -{"Proxy", &DMWRITE, add_mld_proxy_obj, del_mld_proxy_obj, NULL, browse_mld_proxy_inst, NULL, X_IOPSYS_EU_MLDProxyObj, X_IOPSYS_EU_MLDProxyParams, NULL, BBFDM_BOTH}, +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Snooping", &DMWRITE, add_mld_snooping_obj, del_mld_snooping_obj, NULL, browse_mld_snooping_inst, NULL, NULL, X_IOPSYS_EU_MLDSnoopingObj, X_IOPSYS_EU_MLDSnoopingParams, NULL, BBFDM_BOTH}, +{"Proxy", &DMWRITE, add_mld_proxy_obj, del_mld_proxy_obj, NULL, browse_mld_proxy_inst, NULL, NULL, X_IOPSYS_EU_MLDProxyObj, X_IOPSYS_EU_MLDProxyParams, NULL, BBFDM_BOTH}, {0} }; @@ -656,14 +658,14 @@ DMLEAF X_IOPSYS_EU_MLDParams[] = { }; DMOBJ X_IOPSYS_EU_MLDSnoopingObj[] = { -//{"ClientGroup", &DMREAD, NULL, NULL, NULL, browse_mlds_cgrp_inst, NULL, NULL, MLDSnoopingCLientGroupObj, MLDSnoopingClientGroupParams, NULL, BBFDM_BOTH}, -{"Filter", &DMWRITE, add_mlds_filter_obj, del_mcasts_filter_obj, NULL, browse_mlds_filter_inst, NULL, NULL, MLDSnoopingFilterParams, NULL, BBFDM_BOTH}, +//{"ClientGroup", &DMREAD, NULL, NULL, NULL, browse_mlds_cgrp_inst, NULL, NULL, NULL, MLDSnoopingCLientGroupObj, MLDSnoopingClientGroupParams, NULL, BBFDM_BOTH}, +{"Filter", &DMWRITE, add_mlds_filter_obj, del_mcasts_filter_obj, NULL, browse_mlds_filter_inst, NULL, NULL, NULL, MLDSnoopingFilterParams, NULL, BBFDM_BOTH}, {0} }; DMOBJ MLDSnoopingCLientGroupObj[] = { -//{"AssociatedDevice", &DMREAD, NULL, NULL, NULL, browse_mlds_cgrp_assoc_dev_inst, NULL, NULL, MLDSnoopingClientGroupAssociatedDeviceParams, NULL, BBFDM_BOTH}, -//{"ClientGroupStats", &DMREAD, NULL, NULL, NULL, browse_mlds_cgrp_stats_inst, NULL, NULL, MLDSnoopingClientGroupStatsParams, NULL, BBFDM_BOTH}, +//{"AssociatedDevice", &DMREAD, NULL, NULL, NULL, browse_mlds_cgrp_assoc_dev_inst, NULL, NULL, NULL, MLDSnoopingClientGroupAssociatedDeviceParams, NULL, BBFDM_BOTH}, +//{"ClientGroupStats", &DMREAD, NULL, NULL, NULL, browse_mlds_cgrp_stats_inst, NULL, NULL, NULL, MLDSnoopingClientGroupStatsParams, NULL, BBFDM_BOTH}, {0} }; @@ -709,15 +711,15 @@ DMLEAF X_IOPSYS_EU_MLDSnoopingParams[] = { }; DMOBJ X_IOPSYS_EU_MLDProxyObj[] = { -{"Interface", &DMWRITE, add_mldp_interface_obj, del_mldp_interface_obj, NULL, browse_mldp_interface_inst, NULL, NULL, MLDProxyInterfaceParams, NULL, BBFDM_BOTH}, -//{"ClientGroup", &DMREAD, NULL, NULL, NULL, browse_mldp_cgrp_inst, NULL, MLDProxyCLientGroupObj, MLDProxyClientGroupParams, NULL, BBFDM_BOTH}, -{"Filter", &DMWRITE, add_mldp_filter_obj, del_mcastp_filter_obj, NULL, browse_mldp_filter_inst, NULL, NULL, MLDProxyFilterParams, NULL, BBFDM_BOTH}, +{"Interface", &DMWRITE, add_mldp_interface_obj, del_mldp_interface_obj, NULL, browse_mldp_interface_inst, NULL, NULL, NULL, MLDProxyInterfaceParams, NULL, BBFDM_BOTH}, +//{"ClientGroup", &DMREAD, NULL, NULL, NULL, browse_mldp_cgrp_inst, NULL, NULL, MLDProxyCLientGroupObj, MLDProxyClientGroupParams, NULL, BBFDM_BOTH}, +{"Filter", &DMWRITE, add_mldp_filter_obj, del_mcastp_filter_obj, NULL, browse_mldp_filter_inst, NULL, NULL, NULL, MLDProxyFilterParams, NULL, BBFDM_BOTH}, {0} }; DMOBJ MLDProxyCLientGroupObj[] = { -//{"AssociatedDevice", &DMREAD, NULL, NULL, NULL, browse_mldp_cgrp_assoc_dev_inst, NULL, NULL, MLDProxyClientGroupAssociatedDeviceParams, NULL, BBFDM_BOTH}, -//{"ClientGroupStats", &DMREAD, NULL, NULL, NULL, browse_mldp_cgrp_stats_inst, NULL, NULL, MLDProxyClientGroupStatsParams, NULL, BBFDM_BOTH}, +//{"AssociatedDevice", &DMREAD, NULL, NULL, NULL, browse_mldp_cgrp_assoc_dev_inst, NULL, NULL, NULL, MLDProxyClientGroupAssociatedDeviceParams, NULL, BBFDM_BOTH}, +//{"ClientGroupStats", &DMREAD, NULL, NULL, NULL, browse_mldp_cgrp_stats_inst, NULL, NULL, NULL, MLDProxyClientGroupStatsParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/x_iopsys_eu_mld.h b/dmtree/vendor/iopsys/tr181/x_iopsys_eu_mld.h similarity index 93% rename from dmtree/tr181/x_iopsys_eu_mld.h rename to dmtree/vendor/iopsys/tr181/x_iopsys_eu_mld.h index 1d1b88ce..110b12f0 100644 --- a/dmtree/tr181/x_iopsys_eu_mld.h +++ b/dmtree/vendor/iopsys/tr181/x_iopsys_eu_mld.h @@ -9,8 +9,8 @@ * */ -#ifndef __SE_MLD_H -#define __SE_MLD_H +#ifndef __IOPSYS_MLD_H +#define __IOPSYS_MLD_H #include @@ -33,4 +33,5 @@ extern DMLEAF MLDProxyClientGroupParams[]; extern DMLEAF MLDProxyClientGroupStatsParams[]; extern DMLEAF MLDProxyClientGroupAssociatedDeviceParams[]; extern DMLEAF MLDProxyFilterParams[]; -#endif + +#endif //__IOPSYS_MLD_H diff --git a/dmtree/vendor/openwrt/tr181/deviceinfo.c b/dmtree/vendor/openwrt/tr181/deviceinfo.c new file mode 100644 index 00000000..9cf83a6a --- /dev/null +++ b/dmtree/vendor/openwrt/tr181/deviceinfo.c @@ -0,0 +1,95 @@ +#include "deviceinfo.h" + +static char *get_uci_deviceinfo(char *opt) +{ + char *v; + + dmuci_get_option_value_string("cwmp", "@deviceinfo[0]", opt, &v); + return v; +} + +static int openwrt__get_device_manufacturer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = get_uci_deviceinfo("Manufacturer"); + return 0; +} + +static int openwrt__get_device_manufactureroui(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = get_uci_deviceinfo("ManufacturerOUI"); + return 0; +} + +static int openwrt__get_device_productclass(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = get_uci_deviceinfo("ProductClass"); + return 0; +} + +static int openwrt__get_device_serialnumber(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = get_uci_deviceinfo("SerialNumber"); + return 0; +} + +static int openwrt__get_device_softwareversion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = get_uci_deviceinfo("SoftwareVersion"); + return 0; +} + +static int openwrt__get_device_hardwareversion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = get_uci_deviceinfo("HardwareVersion"); + return 0; +} + +static int openwrt__get_device_devicecategory(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = get_uci_deviceinfo("DeviceCategory"); + return 0; +} + +static int openwrt__get_device_additionalhardwareversion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = get_uci_deviceinfo("AdditionalHardwareVersion"); + return 0; +} + +static int openwrt__get_device_additionalsoftwareversion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = get_uci_deviceinfo("AdditionalSoftwareVersion"); + return 0; +} + +static int openwrt__get_device_modelname(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = get_uci_deviceinfo("ModelName"); + return 0; +} + +static int openwrt__get_device_description(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = get_uci_deviceinfo("Description"); + return 0; +} + +/********************************************************************************************************************************** +* OBJ & PARAM DEFINITION +***********************************************************************************************************************************/ +/* *** Device.DeviceInfo. *** */ +DMLEAF tOPENWRT_DeviceInfoParams[] = { +/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ +{"DeviceCategory", &DMREAD, DMT_STRING, openwrt__get_device_devicecategory, NULL, BBFDM_BOTH}, +{"Manufacturer", &DMREAD, DMT_STRING, openwrt__get_device_manufacturer, NULL, BBFDM_BOTH}, +{"ManufacturerOUI", &DMREAD, DMT_STRING, openwrt__get_device_manufactureroui, NULL, BBFDM_BOTH}, +{"ModelName", &DMREAD, DMT_STRING, openwrt__get_device_modelname, NULL, BBFDM_BOTH}, +{"Description", &DMREAD, DMT_STRING, openwrt__get_device_description, NULL, BBFDM_BOTH}, +{"ProductClass", &DMREAD, DMT_STRING, openwrt__get_device_productclass, NULL, BBFDM_BOTH}, +{"SerialNumber", &DMREAD, DMT_STRING, openwrt__get_device_serialnumber, NULL, BBFDM_BOTH}, +{"HardwareVersion", &DMREAD, DMT_STRING, openwrt__get_device_hardwareversion, NULL, BBFDM_BOTH}, +{"SoftwareVersion", &DMREAD, DMT_STRING, openwrt__get_device_softwareversion, NULL, BBFDM_BOTH}, +{"AdditionalHardwareVersion", &DMREAD, DMT_STRING, openwrt__get_device_additionalhardwareversion, NULL, BBFDM_BOTH}, +{"AdditionalSoftwareVersion", &DMREAD, DMT_STRING, openwrt__get_device_additionalsoftwareversion, NULL, BBFDM_BOTH}, +{0} +}; diff --git a/dmtree/vendor/openwrt/tr181/deviceinfo.h b/dmtree/vendor/openwrt/tr181/deviceinfo.h new file mode 100644 index 00000000..279f4099 --- /dev/null +++ b/dmtree/vendor/openwrt/tr181/deviceinfo.h @@ -0,0 +1,8 @@ +#ifndef __OPENWRT_DEVICEINFO_H +#define __OPENWRT_DEVICEINFO_H + +#include + +extern DMLEAF tOPENWRT_DeviceInfoParams[]; + +#endif //__OPENWRT_DEVICEINFO_H diff --git a/dmtree/vendor/openwrt/tr181/qos.c b/dmtree/vendor/openwrt/tr181/qos.c new file mode 100644 index 00000000..ed3f2d23 --- /dev/null +++ b/dmtree/vendor/openwrt/tr181/qos.c @@ -0,0 +1,564 @@ +/* + * Copyright (C) 2021 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: Amin Ben Ramdhane + */ + +#include "qos.h" + +struct queuestats +{ + struct uci_section *dmsect; + char dev[50]; + char user[50]; + char priomap[50]; + int noqueue; + int pfifo_fast; + int refcnt; + int bands; + int bytes_sent; + int pkt_sent; + int pkt_dropped; + int pkt_overlimits; + int pkt_requeues; + int backlog_b; + int backlog_p; + int backlog_requeues; +}; + +/************************************************************************** +* Browse functions +***************************************************************************/ +/*#Device.QoS.Classification.{i}.!UCI:qos/classify/dmmap_qos*/ +static int openwrt__browseQoSClassificationInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) +{ + char *inst = NULL, *max_inst = NULL; + struct dmmap_dup *p = NULL; + LIST_HEAD(dup_list); + + synchronize_specific_config_sections_with_dmmap("qos", "classify", "dmmap_qos", &dup_list); + list_for_each_entry(p, &dup_list, list) { + + inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3, + p->dmmap_section, "classifinstance", "classifalias"); + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP) + break; + } + free_dmmap_config_dup_list(&dup_list); + return 0; +} + +static struct uci_section *get_dup_qstats_section_in_dmmap(char *dmmap_package, char *section_type, char *dev) +{ + struct uci_section *s = NULL; + + uci_path_foreach_option_eq(bbfdm, dmmap_package, section_type, "dev_link", dev, s) { + return s; + } + + return NULL; +} + +static int openwrt__browseQoSQueueStatsInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) +{ + struct uci_section *dmmap_sect; + char *questatsout[256], *inst = NULL, *max_inst = NULL, *lastinstancestore = NULL, dev[50] = "", user[50] = ""; + static int length = 0, i, ret = 0; + struct queuestats queuests = {0}, emptyquestats = {0}; + regex_t regex1 = {}, regex2 = {}; + + regcomp(®ex1, "^qdisc noqueue [0-9]*: dev [[:alnum:]]* [[:alnum:]]* refcnt [0-9]*", 0); + regcomp(®ex2, "^qdisc pfifo_fast [0-9]*: dev [[:alnum:]]* [[:alnum:]]* refcnt [0-9]*", 0); + + command_exec_output_to_array("tc -s qdisc", questatsout, &length); + + for (i = 0; i < length; i++) { + switch (i%3) { + case 0: ret = regexec(®ex1, questatsout[i], 0, NULL, 0); + if (ret == 0) + sscanf(questatsout[i], "qdisc noqueue %d: dev %49s %49s refcnt %d\n", &queuests.noqueue, dev, user, &queuests.refcnt); + else { + ret= regexec(®ex2, questatsout[i], 0, NULL, 0); + if (ret == 0) + sscanf(questatsout[i], "qdisc pfifo_fast %d: dev %49s %49s refcnt %d\n", &queuests.pfifo_fast, dev, user, &queuests.refcnt); + } + DM_STRNCPY(queuests.dev, dev, sizeof(queuests.dev)); + break; + case 1: sscanf(questatsout[i], " Sent %d bytes %d pkt (dropped %d, overlimits %d requeues %d)\n", &queuests.bytes_sent, &queuests.pkt_sent, &queuests.pkt_dropped, &queuests.pkt_overlimits, &queuests.pkt_requeues); + break; + case 2: sscanf(questatsout[i], " backlog %db %dp requeues %d\n", &queuests.backlog_b, &queuests.backlog_p, &queuests.backlog_requeues); + if ((dmmap_sect = get_dup_qstats_section_in_dmmap("dmmap_qos", "qqueue_stats", queuests.dev)) == NULL) { + dmuci_add_section_bbfdm("dmmap_qos", "qqueue_stats", &dmmap_sect); + dmuci_set_value_by_section_bbfdm(dmmap_sect, "dev_link", queuests.dev); + } + + queuests.dmsect= dmmap_sect; + + if (lastinstancestore != NULL && max_inst != NULL) + max_inst = dmstrdup(lastinstancestore); + + inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3, + dmmap_sect, "queuestatsinstance", "queuestatsalias"); + + lastinstancestore = dmstrdup(max_inst); + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&queuests, inst) == DM_STOP) + goto end; + + queuests = emptyquestats; + break; + } + } + + regfree(®ex1); + regfree(®ex2); +end: + return 0; +} + +static int openwrt__addObjQoSClassification(char *refparam, struct dmctx *ctx, void *data, char **instance) +{ + struct uci_section *s, *dmmap_qclassify; + char qcomment[32]; + + char *last_inst = get_last_instance_bbfdm("dmmap_qos", "classify", "classifinstance"); + snprintf(qcomment, sizeof(qcomment), "QoS classify %s", (last_inst) ? last_inst : "1"); + + dmuci_add_section("qos", "classify", &s); + dmuci_set_value_by_section(s, "comment", qcomment); + + dmuci_add_section_bbfdm("dmmap_qos", "classify", &dmmap_qclassify); + dmuci_set_value_by_section(dmmap_qclassify, "section_name", section_name(s)); + *instance = update_instance(last_inst, 2, dmmap_qclassify, "classifinstance"); + return 0; +} + +static int openwrt__delObjQoSClassification(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) +{ + struct dmmap_dup *p = (struct dmmap_dup*)data; + struct uci_section *s = NULL, *stmp = NULL, *dmmap_section = NULL; + + switch (del_action) { + case DEL_INST: + if(is_section_unnamed(section_name(p->config_section))){ + LIST_HEAD(dup_list); + delete_sections_save_next_sections("dmmap_qos", "classify", "classifinstance", section_name(p->config_section), atoi(instance), &dup_list); + update_dmmap_sections(&dup_list, "classifinstance", "dmmap_qos", "classify"); + dmuci_delete_by_section_unnamed(p->config_section, NULL, NULL); + } else { + get_dmmap_section_of_config_section("dmmap_qos", "classify", section_name(p->config_section), &dmmap_section); + dmuci_delete_by_section_unnamed_bbfdm(dmmap_section, NULL, NULL); + + dmuci_delete_by_section(p->config_section, NULL, NULL); + } + break; + case DEL_ALL: + uci_foreach_sections_safe("qos", "classify", stmp, s) { + get_dmmap_section_of_config_section("dmmap_qos", "classify", section_name(s), &dmmap_section); + dmuci_delete_by_section(dmmap_section, NULL, NULL); + + dmuci_delete_by_section(s, NULL, NULL); + } + break; + } + return 0; +} + +static int openwrt__addObjQoSQueueStats(char *refparam, struct dmctx *ctx, void *data, char **instance) +{ + return 0; +} + +static int openwrt__delObjQoSQueueStats(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) +{ + return 0; +} + +/*#Device.QoS.ClassificationNumberOfEntries!UCI:qos/classify/*/ +static int openwrt__get_QClassificationNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct uci_section *s = NULL; + static int nbre= 0; + + uci_foreach_sections("qos", "classify", s) { + nbre++; + } + + dmasprintf(value, "%d", nbre); + return 0; +} + +static int openwrt__get_QQueueStatsNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + char *questatsout[256]; + static int length = 0; + + command_exec_output_to_array("tc -s qdisc", questatsout, &length); + dmasprintf(value, "%d", length/3); + return 0; +} + +static int openwrt__get_QoSClassification_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct dmmap_dup *p= (struct dmmap_dup*)data; + dmuci_get_value_by_section_string(p->dmmap_section, "classifalias", value); + if ((*value)[0] == '\0') + dmasprintf(value, "cpe-%s", instance); + return 0; +} + +static int openwrt__set_QoSClassification_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + struct dmmap_dup *p= (struct dmmap_dup*)data; + + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 64, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(p->dmmap_section, "classifalias", value); + break; + } + return 0; +} + +static int openwrt__get_QoSClassification_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct dmmap_dup *p = (struct dmmap_dup *)data; + struct uci_section *s = NULL; + char *classes = NULL, **classesarr = NULL, *classgroup = NULL, *ifaceclassgrp = NULL, *targetclass = NULL; + size_t length; + + dmuci_get_value_by_section_string(p->config_section, "target", &targetclass); + uci_foreach_sections("qos", "classgroup", s) { + dmuci_get_value_by_section_string(s, "classes", &classes); + classesarr = strsplit(classes, " ", &length); + if (classes != NULL && elt_exists_in_array(classesarr, targetclass, length)) { + dmasprintf(&classgroup, "%s", section_name(s)); + break; + } + } + if (classgroup == NULL) + return 0; + uci_foreach_sections("qos", "interface", s) { + dmuci_get_value_by_section_string(s, "classgroup", &ifaceclassgrp); + if (ifaceclassgrp != NULL && strcmp(ifaceclassgrp, classgroup) == 0) { + adm_entry_get_linker_param(ctx, "Device.IP.Interface.", section_name(s), value); + if (*value == NULL) + adm_entry_get_linker_param(ctx, "Device.PPP.Interface.", section_name(s), value); + if (*value == NULL) + adm_entry_get_linker_param(ctx, "Device.Ethernet.Interface.", section_name(s), value); + if (*value == NULL) + *value = ""; + } + } + return 0; +} + +static int openwrt__set_QoSClassification_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 256, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + break; + } + return 0; +} + +/*#Device.QoS.Classification.{i}.DestIP!UCI:qos/classify,@i-1/dsthost*/ +static int openwrt__get_QoSClassification_DestIP(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct dmmap_dup *p= (struct dmmap_dup*)data; + dmuci_get_value_by_section_string(p->config_section, "dsthost", value); + return 0; +} + +static int openwrt__set_QoSClassification_DestIP(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + struct dmmap_dup *p= (struct dmmap_dup*)data; + + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 45, NULL, IPAddress)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(p->config_section, "dsthost", value); + break; + } + return 0; +} + + + +/*#Device.QoS.Classification.{i}.SourceIP!UCI:qos/classify,@i-1/srchost*/ +static int openwrt__get_QoSClassification_SourceIP(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct dmmap_dup *p= (struct dmmap_dup*)data; + dmuci_get_value_by_section_string(p->config_section, "srchost", value); + return 0; +} + +static int openwrt__set_QoSClassification_SourceIP(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + struct dmmap_dup *p= (struct dmmap_dup*)data; + + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 45, NULL, IPAddress)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(p->config_section, "srchost", value); + break; + } + return 0; +} + +/*#Device.QoS.Classification.{i}.Protocol!UCI:qos/classify,@i-1/proto*/ +static int openwrt__get_QoSClassification_Protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct dmmap_dup *p= (struct dmmap_dup*)data; + dmuci_get_value_by_section_string(p->config_section, "proto", value); + return 0; +} + +static int openwrt__set_QoSClassification_Protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + struct dmmap_dup *p= (struct dmmap_dup*)data; + switch (action) { + case VALUECHECK: + if (dm_validate_int(value, RANGE_ARGS{{"-1","255"}}, 1)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(p->config_section, "proto", value); + break; + } + return 0; +} + +/*#Device.QoS.Classification.{i}.DestPort!UCI:qos/classify,@i-1/dstports*/ +static int openwrt__get_QoSClassification_DestPort(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct dmmap_dup *p= (struct dmmap_dup*)data; + dmuci_get_value_by_section_string(p->config_section, "dstports", value); + return 0; +} + +static int openwrt__set_QoSClassification_DestPort(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + struct dmmap_dup *p= (struct dmmap_dup*)data; + + switch (action) { + case VALUECHECK: + if (dm_validate_int(value, RANGE_ARGS{{"-1","65535"}}, 1)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(p->config_section, "dstports", value); + break; + } + return 0; +} + +/*#Device.QoS.Classification.{i}.DestPortRangeMax!UCI:qos/classify,@i-1/portrange*/ +static int openwrt__get_QoSClassification_DestPortRangeMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct dmmap_dup *p= (struct dmmap_dup*)data; + dmuci_get_value_by_section_string(p->config_section, "portrange", value); + return 0; +} + +static int openwrt__set_QoSClassification_DestPortRangeMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + struct dmmap_dup *p= (struct dmmap_dup*)data; + + switch (action) { + case VALUECHECK: + if (dm_validate_int(value, RANGE_ARGS{{"-1","65535"}}, 1)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(p->config_section, "portrange", value); + break; + } + return 0; +} + +/*#Device.QoS.Classification.{i}.SourcePort!UCI:qos/classify,@i-1/srcports*/ +static int openwrt__get_QoSClassification_SourcePort(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct dmmap_dup *p = (struct dmmap_dup*)data; + dmuci_get_value_by_section_string(p->config_section, "srcports", value); + return 0; +} + +static int openwrt__set_QoSClassification_SourcePort(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + struct dmmap_dup *p= (struct dmmap_dup*)data; + + switch (action) { + case VALUECHECK: + if (dm_validate_int(value, RANGE_ARGS{{"-1","65535"}}, 1)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(p->config_section, "srcports", value); + break; + } + return 0; +} + +/*#Device.QoS.Classification.{i}.DSCPMark!UCI:qos/classify,@i-1/dscp*/ +static int openwrt__get_QoSClassification_DSCPMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct dmmap_dup *p = (struct dmmap_dup *)data; + dmuci_get_value_by_section_string(p->config_section, "dscp", value); + return 0; +} + +static int openwrt__set_QoSClassification_DSCPMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + struct dmmap_dup *p= (struct dmmap_dup *)data; + + switch (action) { + case VALUECHECK: + if (dm_validate_int(value, RANGE_ARGS{{"-2",NULL}}, 1)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(p->config_section, "dscp", value); + break; + } + return 0; +} + +static int openwrt__get_QoSQueueStats_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct queuestats *qts= (struct queuestats*)data; + dmuci_get_value_by_section_string(qts->dmsect, "queuestatsalias", value); + if ((*value)[0] == '\0') + dmasprintf(value, "cpe-%s", instance); + return 0; +} + +static int openwrt__set_QoSQueueStats_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + struct queuestats *qts= (struct queuestats*)data; + + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 64, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(qts->dmsect, "queuestatsalias", value); + break; + } + return 0; +} + +static int openwrt__get_QoSQueueStats_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct queuestats *qts = (struct queuestats*)data; + + adm_entry_get_linker_param(ctx, "Device.IP.Interface.", qts->dev, value); + if (*value == NULL) + adm_entry_get_linker_param(ctx, "Device.PPP.Interface.", qts->dev, value); + if (*value == NULL) + adm_entry_get_linker_param(ctx, "Device.Ethernet.Interface.", qts->dev, value); + if (*value == NULL) + adm_entry_get_linker_param(ctx, "Device.WiFi.Radio.", qts->dev, value); + if (*value == NULL) + *value = ""; + return 0; +} + +static int openwrt__set_QoSQueueStats_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 256, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + break; + } + return 0; +} + +static int openwrt__get_QoSQueueStats_OutputPackets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct queuestats *queuests = (struct queuestats*)data; + dmasprintf(value, "%d", queuests->pkt_sent); + return 0; +} + +static int openwrt__get_QoSQueueStats_OutputBytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct queuestats *queuests = (struct queuestats*)data; + dmasprintf(value, "%d", queuests->bytes_sent); + return 0; +} + +static int openwrt__get_QoSQueueStats_DroppedPackets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct queuestats *queuests = (struct queuestats*)data; + dmasprintf(value, "%d", queuests->pkt_dropped); + return 0; +} + +/********************************************************************************************************************************** +* OBJ & PARAM DEFINITION +***********************************************************************************************************************************/ +/* *** Device.QoS. *** */ +DMOBJ tOPENWRT_QoSObj[] = { +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Classification", &DMWRITE, openwrt__addObjQoSClassification, openwrt__delObjQoSClassification, NULL, openwrt__browseQoSClassificationInst, NULL, NULL, NULL, tOPENWRT_QoSClassificationParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, +{"QueueStats", &DMWRITE, openwrt__addObjQoSQueueStats, openwrt__delObjQoSQueueStats, NULL, openwrt__browseQoSQueueStatsInst, NULL, NULL, NULL, tOPENWRT_QoSQueueStatsParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", "Queue", "Interface", NULL}}, +{0} +}; + +DMLEAF tOPENWRT_QoSParams[] = { +/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ +{"ClassificationNumberOfEntries", &DMREAD, DMT_UNINT, openwrt__get_QClassificationNumberOfEntries, NULL, BBFDM_BOTH}, +{"QueueStatsNumberOfEntries", &DMREAD, DMT_UNINT, openwrt__get_QQueueStatsNumberOfEntries, NULL, BBFDM_BOTH}, +{0} +}; + +/* *** Device.QoS.Classification.{i}. *** */ +DMLEAF tOPENWRT_QoSClassificationParams[] = { +/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ +{"Alias", &DMWRITE, DMT_STRING, openwrt__get_QoSClassification_Alias, openwrt__set_QoSClassification_Alias, BBFDM_BOTH}, +{"Interface", &DMWRITE, DMT_STRING, openwrt__get_QoSClassification_Interface, openwrt__set_QoSClassification_Interface, BBFDM_BOTH}, +{"DestIP", &DMWRITE, DMT_STRING, openwrt__get_QoSClassification_DestIP, openwrt__set_QoSClassification_DestIP, BBFDM_BOTH}, +{"SourceIP", &DMWRITE, DMT_STRING, openwrt__get_QoSClassification_SourceIP, openwrt__set_QoSClassification_SourceIP, BBFDM_BOTH}, +{"Protocol", &DMWRITE, DMT_INT, openwrt__get_QoSClassification_Protocol, openwrt__set_QoSClassification_Protocol, BBFDM_BOTH}, +{"DestPort", &DMWRITE, DMT_INT, openwrt__get_QoSClassification_DestPort, openwrt__set_QoSClassification_DestPort, BBFDM_BOTH}, +{"DestPortRangeMax", &DMWRITE, DMT_INT, openwrt__get_QoSClassification_DestPortRangeMax, openwrt__set_QoSClassification_DestPortRangeMax, BBFDM_BOTH}, +{"SourcePort", &DMWRITE, DMT_INT, openwrt__get_QoSClassification_SourcePort, openwrt__set_QoSClassification_SourcePort, BBFDM_BOTH}, +{"DSCPMark", &DMWRITE, DMT_INT, openwrt__get_QoSClassification_DSCPMark, openwrt__set_QoSClassification_DSCPMark, BBFDM_BOTH}, +{0} +}; + +/* *** Device.QoS.QueueStats.{i}. *** */ +DMLEAF tOPENWRT_QoSQueueStatsParams[] = { +/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ +{"Alias", &DMWRITE, DMT_STRING, openwrt__get_QoSQueueStats_Alias, openwrt__set_QoSQueueStats_Alias, BBFDM_BOTH}, +{"Interface", &DMWRITE, DMT_STRING, openwrt__get_QoSQueueStats_Interface, openwrt__set_QoSQueueStats_Interface, BBFDM_BOTH}, +{"OutputPackets", &DMREAD, DMT_UNINT, openwrt__get_QoSQueueStats_OutputPackets, NULL, BBFDM_BOTH}, +{"OutputBytes", &DMREAD, DMT_UNINT, openwrt__get_QoSQueueStats_OutputBytes, NULL, BBFDM_BOTH}, +{"DroppedPackets", &DMREAD, DMT_UNINT, openwrt__get_QoSQueueStats_DroppedPackets, NULL, BBFDM_BOTH}, +{0} +}; diff --git a/dmtree/vendor/openwrt/tr181/qos.h b/dmtree/vendor/openwrt/tr181/qos.h new file mode 100644 index 00000000..56346726 --- /dev/null +++ b/dmtree/vendor/openwrt/tr181/qos.h @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2021 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: Amin Ben Ramdhane + */ + +#ifndef __OPENWRT_QOS_H +#define __OPENWRT_QOS_H + +#include + +extern DMOBJ tOPENWRT_QoSObj[]; +extern DMLEAF tOPENWRT_QoSParams[]; +extern DMLEAF tOPENWRT_QoSClassificationParams[]; +extern DMLEAF tOPENWRT_QoSQueueStatsParams[]; + +#endif //__OPENWRT_QOS_H + diff --git a/dmtree/vendor/openwrt/tr181/vendor.c b/dmtree/vendor/openwrt/tr181/vendor.c new file mode 100644 index 00000000..cb864f5d --- /dev/null +++ b/dmtree/vendor/openwrt/tr181/vendor.c @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2021 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 Ramdhane + * + */ + +#include "deviceinfo.h" +#include "qos.h" +#include "vendor.h" + +DM_MAP_OBJ tVendorExtensionOverwriteOPENWRT[] = { +/* parentobj, nextobject, parameter */ +{"Device.DeviceInfo.", NULL, tOPENWRT_DeviceInfoParams}, +{"Device.QoS.", tOPENWRT_QoSObj, tOPENWRT_QoSParams}, +{0} +}; + +char *VendorExtensionExcludeOPENWRT[] = { + "Device.Hosts.", //Object + "Device.WiFi.Radio.{i}.Stats.", //Object + "Device.WiFi.SSID.{i}.Stats.", //Object + "Device.WiFi.AccessPoint.{i}.AssociatedDevice.", //Object + "Device.WiFi.NeighboringWiFiDiagnostic.", //Object + "Device.WiFi.DataElements.Network.", //Object + "Device.DeviceInfo.MemoryStatus.", //Object + "Device.DeviceInfo.ProcessStatus.", //Object + "Device.QoS.Policer.{i}.", //Object + "Device.QoS.Queue.{i}.", //Object + "Device.QoS.Shaper.{i}.", //Object + + "Device.Ethernet.Interface.{i}.Stats.MulticastPacketsSent", //Parameter + "Device.Ethernet.Interface.{i}.Stats.UnicastPacketsSent", //Parameter + "Device.Ethernet.Interface.{i}.Stats.UnicastPacketsReceived", //Parameter + "Device.Ethernet.Interface.{i}.Stats.BroadcastPacketsSent", //Parameter + "Device.Ethernet.Interface.{i}.Stats.BroadcastPacketsReceived", //Parameter + "Device.Ethernet.Interface.{i}.Stats.UnknownProtoPacketsReceived", //Parameter + "Device.Ethernet.Link.{i}.Stats.MulticastPacketsSent", //Parameter + "Device.Ethernet.Link.{i}.Stats.UnicastPacketsSent", //Parameter + "Device.Ethernet.Link.{i}.Stats.UnicastPacketsReceived", //Parameter + "Device.Ethernet.Link.{i}.Stats.BroadcastPacketsSent", //Parameter + "Device.Ethernet.Link.{i}.Stats.BroadcastPacketsReceived", //Parameter + "Device.Ethernet.Link.{i}.Stats.UnknownProtoPacketsReceived", //Parameter + "Device.Firewall.Chain.{i}.Rule.{i}.ExpiryDate", //Parameter + "Device.NAT.PortMapping.{i}.LeaseDuration", //Parameter + "Device.WiFi.Radio.{i}.MaxBitRate", //Parameter + "Device.WiFi.Radio.{i}.OperatingFrequencyBand", //Parameter + "Device.WiFi.Radio.{i}.SupportedFrequencyBands", //Parameter + "Device.WiFi.Radio.{i}.SupportedStandards", //Parameter + "Device.WiFi.Radio.{i}.OperatingStandards", //Parameter + "Device.WiFi.Radio.{i}.ChannelsInUse", //Parameter + "Device.WiFi.Radio.{i}.Channel", //Parameter + "Device.WiFi.Radio.{i}.PossibleChannels", //Parameter + "Device.WiFi.Radio.{i}.SupportedOperatingChannelBandwidths", //Parameter + "Device.WiFi.Radio.{i}.CurrentOperatingChannelBandwidth", //Parameter + "Device.WiFi.SSID.{i}.BSSID", //Parameter + "Device.WiFi.AccessPoint.{i}.Status", //Parameter + "Device.WiFi.AccessPoint.{i}.AssociatedDeviceNumberOfEntries", //Parameter + "Device.QoS.ShaperNumberOfEntries", //Parameter + "Device.QoS.QueueNumberOfEntries", //Parameter + "Device.QoS.PolicerNumberOfEntries", //Parameter + "Device.QoS.QueueStats.{i}.Enable", //Parameter + "Device.QoS.QueueStats.{i}.Status", //Parameter + "Device.QoS.QueueStats.{i}.Queue", //Parameter + "Device.QoS.QueueStats.{i}.DroppedBytes", //Parameter + "Device.QoS.Classification.{i}.Enable", //Parameter + "Device.QoS.Classification.{i}.DestMask", //Parameter + "Device.QoS.Classification.{i}.SourceMask", //Parameter + "Device.QoS.Classification.{i}.SourcePortRangeMax", //Parameter + "Device.QoS.Classification.{i}.SourceMACAddress", //Parameter + "Device.QoS.Classification.{i}.DestMACAddress", //Parameter + "Device.QoS.Classification.{i}.Ethertype", //Parameter + "Device.QoS.Classification.{i}.SourceVendorClassID", //Parameter + "Device.QoS.Classification.{i}.DestVendorClassID", //Parameter + "Device.QoS.Classification.{i}.SourceClientID", //Parameter + "Device.QoS.Classification.{i}.DestClientID", //Parameter + "Device.QoS.Classification.{i}.SourceUserClassID", //Parameter + "Device.QoS.Classification.{i}.DestUserClassID", //Parameter + "Device.QoS.Classification.{i}.IPLengthMin", //Parameter + "Device.QoS.Classification.{i}.IPLengthMax", //Parameter + "Device.QoS.Classification.{i}.DSCPCheck", //Parameter + "Device.QoS.Classification.{i}.EthernetPriorityCheck", //Parameter + "Device.QoS.Classification.{i}.VLANIDCheck", //Parameter + "Device.QoS.Classification.{i}.TrafficClass", //Parameter + "Device.QoS.Classification.{i}.Policer", //Parameter + NULL +}; diff --git a/dmtree/vendor/openwrt/tr181/vendor.h b/dmtree/vendor/openwrt/tr181/vendor.h new file mode 100644 index 00000000..7641a59e --- /dev/null +++ b/dmtree/vendor/openwrt/tr181/vendor.h @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2021 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 Ramdhane + * + */ + +#ifndef __OPENWRT_VENDOR_H +#define __OPENWRT_VENDOR_H + +#include + +extern DM_MAP_OBJ tVendorExtensionOverwriteOPENWRT[]; +extern char *VendorExtensionExcludeOPENWRT[]; + +#endif //__OPENWRT_VENDOR_H diff --git a/dmtree/vendor/test/tr181/device.c b/dmtree/vendor/test/tr181/device.c new file mode 100644 index 00000000..5c192871 --- /dev/null +++ b/dmtree/vendor/test/tr181/device.c @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2021 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 Ramdhane + * + */ + +#include "device.h" +#include "x_test_com_dropbear.h" + +DMOBJ tTEST_DeviceObj[] = { +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{BBF_VENDOR_PREFIX"Dropbear", &DMWRITE, add_dropbear_instance, delete_dropbear_instance, "file:/etc/config/dropbear", browse_dropbear_instance, NULL, NULL, NULL, X_TEST_COM_DropbearParams, NULL, BBFDM_BOTH}, +{0} +}; diff --git a/dmtree/tr181/x_iopsys_eu_syslog.h b/dmtree/vendor/test/tr181/device.h similarity index 52% rename from dmtree/tr181/x_iopsys_eu_syslog.h rename to dmtree/vendor/test/tr181/device.h index 740c33c5..4ffc35c8 100644 --- a/dmtree/tr181/x_iopsys_eu_syslog.h +++ b/dmtree/vendor/test/tr181/device.h @@ -1,19 +1,19 @@ /* - * Copyright (C) 2019 iopsys Software Solutions AB + * Copyright (C) 2021 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 Imen Bhiri + * Author Amin Ben Ramdhane * */ -#ifndef __SE_SYSLOG_H -#define __SE_SYSLOG_H +#ifndef __TEST_DEVICE_H +#define __TEST_DEVICE_H #include -extern DMLEAF tSe_SyslogParam[]; +extern DMOBJ tTEST_DeviceObj[]; -#endif +#endif //__TEST_DEVICE_H diff --git a/dmtree/vendor/test/tr181/deviceinfo.c b/dmtree/vendor/test/tr181/deviceinfo.c new file mode 100644 index 00000000..5e22f502 --- /dev/null +++ b/dmtree/vendor/test/tr181/deviceinfo.c @@ -0,0 +1,25 @@ +#include "deviceinfo.h" + +static char *get_uci_deviceinfo(char *opt) +{ + char *v; + + dmuci_get_option_value_string("cwmp", "@deviceinfotest[0]", opt, &v); + return v; +} + +static int test__get_device_manufacturer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = get_uci_deviceinfo("Manufacturer"); + return 0; +} + +/********************************************************************************************************************************** +* OBJ & PARAM DEFINITION +***********************************************************************************************************************************/ +/* *** Device.DeviceInfo. *** */ +DMLEAF tTEST_DeviceInfoParams[] = { +/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ +{"Manufacturer", &DMREAD, DMT_STRING, test__get_device_manufacturer, NULL, BBFDM_BOTH}, +{0} +}; diff --git a/dmtree/vendor/test/tr181/deviceinfo.h b/dmtree/vendor/test/tr181/deviceinfo.h new file mode 100644 index 00000000..33b4af4a --- /dev/null +++ b/dmtree/vendor/test/tr181/deviceinfo.h @@ -0,0 +1,8 @@ +#ifndef __TEST_DEVICEINFO_H +#define __TEST_DEVICEINFO_H + +#include + +extern DMLEAF tTEST_DeviceInfoParams[]; + +#endif //__TEST_DEVICEINFO_H diff --git a/dmtree/vendor/test/tr181/firewall.c b/dmtree/vendor/test/tr181/firewall.c new file mode 100644 index 00000000..71cf414f --- /dev/null +++ b/dmtree/vendor/test/tr181/firewall.c @@ -0,0 +1,197 @@ +/* + * Copyright (C) 2021 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 Ramdhane + * + */ + +#include "firewall.h" + +static int get_rule_icmp_type(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct uci_list *v= NULL; + struct uci_element *e = NULL; + char *ptr = NULL; + + dmasprintf(value, "%s", ""); + dmuci_get_value_by_section_list((struct uci_section *)data, "icmp_type", &v); + if (v != NULL) { + uci_foreach_element(v, e) { + ptr = dmstrdup(*value); + dmfree(*value); + + if (strlen(ptr) == 0) + dmasprintf(value, "%s", e->name); + else { + dmasprintf(value, "%s %s", ptr, e->name); + dmfree(ptr); + } + } + } + return 0; +} + +static int get_rule_source_mac(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + char *v = NULL; + dmuci_get_value_by_section_string((struct uci_section *)data, "src_mac", &v); + *value = (v) ? v : ""; + return 0; +} + +static int get_time_span_supported_days(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = "mon,tue,wed,thu,fri,sat,sun"; + return 0; +} + +static int get_time_span_days(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + char *v; + dmuci_get_value_by_section_string((struct uci_section *)data, "weekdays", &v); + *value = (v) ? v : ""; + return 0; +} + +static int get_time_span_start_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + char *v; + dmuci_get_value_by_section_string((struct uci_section *)data, "start_time", &v); + *value = (v) ? v : ""; + return 0; +} + +static int get_time_span_stop_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + char *v; + dmuci_get_value_by_section_string((struct uci_section *)data, "stop_time", &v); + *value = (v) ? v : ""; + return 0; +} + +static int set_rule_icmp_type(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + int i; + size_t length; + char **devices = NULL; + + switch (action) { + case VALUECHECK: + //TODO + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "icmp_type", ""); + devices = strsplit(value, " ", &length); + for (i = 0; i < length; i++) + dmuci_add_list_value_by_section((struct uci_section *)data, "icmp_type", devices[i]); + break; + } + return 0; +} + +static int set_rule_source_mac(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + //TODO + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "src_mac", value); + break; + } + return 0; +} + +static int set_time_span_supported_days(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + //TODO + break; + case VALUESET: + break; + } + return 0; +} + +static int set_time_span_days(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + //TODO + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "weekdays", value); + break; + } + return 0; +} + +static int set_time_span_start_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + //TODO + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "start_time", value); + break; + } + return 0; +} + +static int set_time_span_stop_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + //TODO + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "stop_time", value); + break; + } + return 0; +} + +static int test__get_firewall_expriydate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = "2030-07-02T14:33:51Z"; + return 0; +} + +/********************************************************************************************************************************** +* OBJ & PARAM DEFINITION +***********************************************************************************************************************************/ +/* *** Device.Firewall.Chain.{i}.Rule.{i}. *** */ +DMLEAF tTEST_FirewallRuleParams[] = { +/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ +{"ExpiryDate", &DMWRITE, DMT_TIME, test__get_firewall_expriydate, NULL, BBFDM_BOTH}, +{0} +}; + +DMOBJ tTEST_FirewallChainRuleObj[] = { +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{BBF_VENDOR_PREFIX"TimeSpan", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tTEST_FirewallChainRuleTimeSpanParams, NULL, BBFDM_BOTH}, +{0} +}; + +DMLEAF tTEST_FirewallChainRuleParams[] = { +/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ +{BBF_VENDOR_PREFIX"ICMPType", &DMWRITE, DMT_STRING, get_rule_icmp_type, set_rule_icmp_type, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"SourceMACAddress", &DMWRITE, DMT_STRING, get_rule_source_mac, set_rule_source_mac, BBFDM_BOTH}, +{0} +}; + +DMLEAF tTEST_FirewallChainRuleTimeSpanParams[] = { +/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ +{"SupportedDays", &DMWRITE, DMT_STRING, get_time_span_supported_days, set_time_span_supported_days, BBFDM_BOTH}, +{"Days", &DMWRITE, DMT_STRING, get_time_span_days, set_time_span_days, BBFDM_BOTH}, +{"StartTime", &DMWRITE, DMT_STRING, get_time_span_start_time, set_time_span_start_time, BBFDM_BOTH}, +{"StopTime", &DMWRITE, DMT_STRING, get_time_span_stop_time, set_time_span_stop_time, BBFDM_BOTH}, +{0} +}; + diff --git a/dmtree/vendor/test/tr181/firewall.h b/dmtree/vendor/test/tr181/firewall.h new file mode 100644 index 00000000..414cc6dc --- /dev/null +++ b/dmtree/vendor/test/tr181/firewall.h @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2021 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 Ramdhane + * + */ + +#ifndef __TEST_FIREWALL_H +#define __TEST_FIREWALL_H + +#include + +extern DMLEAF tTEST_FirewallRuleParams[]; +extern DMOBJ tTEST_FirewallChainRuleObj[]; +extern DMLEAF tTEST_FirewallChainRuleParams[]; +extern DMLEAF tTEST_FirewallChainRuleTimeSpanParams[]; + +#endif //__TEST_FIREWALL_H diff --git a/dmtree/vendor/test/tr181/vendor.c b/dmtree/vendor/test/tr181/vendor.c new file mode 100644 index 00000000..4a2ab513 --- /dev/null +++ b/dmtree/vendor/test/tr181/vendor.c @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 Ramdhane + * + */ + +#include "device.h" +#include "deviceinfo.h" +#include "firewall.h" +#include "vendor.h" + +DM_MAP_OBJ tVendorExtensionOverwriteTEST[] = { +/* parentobj, nextobject, parameter */ +{"Device.DeviceInfo.", NULL, tTEST_DeviceInfoParams}, +{"Device.Firewall.Chain.{i}.Rule.{i}.", NULL, tTEST_FirewallRuleParams}, +{0} +}; + +DM_MAP_OBJ tVendorExtensionTEST[] = { +/* parentobj, nextobject, parameter */ +{"Device.", tTEST_DeviceObj, NULL}, +{"Device.Firewall.Chain.{i}.Rule.{i}.", tTEST_FirewallChainRuleObj, NULL}, +{0} +}; + +char *VendorExtensionExcludeTEST[] = { + "Device.USB.", //Object + "Device.DeviceInfo.VendorConfigFile.{i}.", //Object + "Device.DSL.Channel.{i}.Stats.", //Object + + "Device.QoS.Queue.{i}.SchedulerAlgorithm", //Parameter + "Device.FAST.Line.{i}.Stats.CurrentDay.ErroredSecs", //Parameter + "Device.Ethernet.RMONStats.{i}.Packets1024to1518Bytes", //Parameter + + NULL +}; diff --git a/dmtree/vendor/test/tr181/vendor.h b/dmtree/vendor/test/tr181/vendor.h new file mode 100644 index 00000000..c2db0fbb --- /dev/null +++ b/dmtree/vendor/test/tr181/vendor.h @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2021 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 Ramdhane + * + */ + +#ifndef __TEST_VENDOR_H +#define __TEST_VENDOR_H + +#include + +extern DM_MAP_OBJ tVendorExtensionOverwriteTEST[]; +extern DM_MAP_OBJ tVendorExtensionTEST[]; +extern char *VendorExtensionExcludeTEST[]; + +#endif //__TEST_VENDOR_H diff --git a/dmtree/tr181/x_iopsys_eu_dropbear.c b/dmtree/vendor/test/tr181/x_test_com_dropbear.c similarity index 61% rename from dmtree/tr181/x_iopsys_eu_dropbear.c rename to dmtree/vendor/test/tr181/x_test_com_dropbear.c index 7d8dd3bf..c348cbae 100644 --- a/dmtree/tr181/x_iopsys_eu_dropbear.c +++ b/dmtree/vendor/test/tr181/x_test_com_dropbear.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 iopsys Software Solutions AB + * Copyright (C) 2021 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 @@ -9,10 +9,12 @@ * */ -#include "x_iopsys_eu_dropbear.h" +#include "x_test_com_dropbear.h" - -int browseXIopsysEuDropbear(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) +/************************************************************* +* ENTRY METHOD +**************************************************************/ +int browse_dropbear_instance(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { char *inst = NULL, *max_inst = NULL; struct dmmap_dup *p = NULL; @@ -30,303 +32,12 @@ int browseXIopsysEuDropbear(struct dmctx *dmctx, DMNODE *parent_node, void *prev return 0; } -/************************************************************************************* -**** function **** -**************************************************************************************/ -static int get_x_iopsys_eu_dropbear_password_auth(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *res = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "PasswordAuth", "1"); - *value = ((strcmp(res, "on") == 0) || *res == '1') ? "1" : "0"; - return 0; -} - -static int set_x_iopsys_eu_dropbear_password_auth(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - - switch (action) { - case VALUECHECK: - if (dm_validate_boolean(value)) - return FAULT_9007; - return 0; - case VALUESET: - string_to_bool(value, &b); - dmuci_set_value_by_section((struct uci_section *)data, "PasswordAuth", b ? "1" : "0"); - return 0; - } - return 0; -} - -static int get_x_iopsys_eu_dropbear_root_password_auth(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - char *res = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "RootPasswordAuth", "1"); - *value = ((strcmp(res, "on") == 0) || *res == '1') ? "1" : "0"; - return 0; -} - -static int set_x_iopsys_eu_dropbear_root_password_auth(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - - switch (action) { - case VALUECHECK: - if (dm_validate_boolean(value)) - return FAULT_9007; - return 0; - case VALUESET: - string_to_bool(value, &b); - dmuci_set_value_by_section((struct uci_section *)data, "RootPasswordAuth", b ? "1" : "0"); - return 0; - } - return 0; -} - -static int get_x_iopsys_eu_dropbear_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "Port", "22"); - return 0; -} - -static int set_x_iopsys_eu_dropbear_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "Port", value); - return 0; - } - return 0; -} - -static int get_x_iopsys_eu_dropbear_root_login(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "RootLogin", value); - if ((*value)[0] == '\0' || ((*value)[0] == 'o' && (*value)[1] == 'n') || (*value)[0] == '1' ) - *value = "1"; - else - *value = "0"; - return 0; -} - -static int set_x_iopsys_eu_dropbear_root_login(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - - switch (action) { - case VALUECHECK: - if (dm_validate_boolean(value)) - return FAULT_9007; - return 0; - case VALUESET: - string_to_bool(value, &b); - dmuci_set_value_by_section((struct uci_section *)data, "RootLogin", b ? "1" : "0"); - return 0; - } - return 0; -} - -static int get_x_iopsys_eu_dropbear_verbose(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "verbose", "0"); - return 0; -} - -static int set_x_iopsys_eu_dropbear_verbose(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - - switch (action) { - case VALUECHECK: - if (dm_validate_boolean(value)) - return FAULT_9007; - return 0; - case VALUESET: - string_to_bool(value, &b); - dmuci_set_value_by_section((struct uci_section *)data, "verbose", b ? "1" : "0"); - return 0; - } - return 0; -} - -static int get_x_iopsys_eu_dropbear_gateway_ports(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "GatewayPorts", "0"); - return 0; -} - -static int set_x_iopsys_eu_dropbear_gateway_ports(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - - switch (action) { - case VALUECHECK: - if (dm_validate_boolean(value)) - return FAULT_9007; - return 0; - case VALUESET: - string_to_bool(value, &b); - dmuci_set_value_by_section((struct uci_section *)data, "GatewayPorts", b ? "1" : ""); - return 0; - } - return 0; -} - -static int get_x_iopsys_eu_dropbear_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "Interface", value); - return 0; -} - -static int set_x_iopsys_eu_dropbear_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "Interface", value); - return 0; - } - return 0; -} - -static int get_x_iopsys_eu_dropbear_rsakeyfile(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "rsakeyfile", value); - return 0; -} - -static int set_x_iopsys_eu_dropbear_rsakeyfile(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "rsakeyfile", value); - return 0; - } - return 0; -} - -static int get_x_iopsys_eu_dropbear_dsskeyfile(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "dsskeyfile", value); - return 0; -} - -static int set_x_iopsys_eu_dropbear_dsskeyfile(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "dsskeyfile", value); - return 0; - } - return 0; -} - -static int get_x_iopsys_eu_dropbear_ssh_keepalive(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "SSHKeepAlive", "300"); - return 0; -} - -static int set_x_iopsys_eu_dropbear_ssh_keepalive(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - if (strcmp(value, "300") == 0) - dmuci_set_value_by_section((struct uci_section *)data, "SSHKeepAlive", ""); - else - dmuci_set_value_by_section((struct uci_section *)data, "SSHKeepAlive", value); - return 0; - } - return 0; -} - -static int get_x_iopsys_eu_dropbear_idle_timeout(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "IdleTimeout", "300"); - return 0; -} - -static int set_x_iopsys_eu_dropbear_idle_timeout(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - if (value[0] == '0') - dmuci_set_value_by_section((struct uci_section *)data, "IdleTimeout", ""); - else - dmuci_set_value_by_section((struct uci_section *)data, "IdleTimeout", value); - return 0; - } - return 0; -} - -static int get_x_iopsys_eu_dropbear_banner_file(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "BannerFile", value); - return 0; -} - -static int set_x_iopsys_eu_dropbear_banner_file(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "BannerFile", value); - return 0; - } - return 0; -} - -////////////////////////SET AND GET ALIAS///////////////////////////////// - -static int get_x_iopsys_eu_dropbear_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct uci_section *dmmap_section = NULL; - - get_dmmap_section_of_config_section("dmmap_dropbear", "dropbear", section_name((struct uci_section *)data), &dmmap_section); - dmuci_get_value_by_section_string(dmmap_section, "dropbearalias", value); - if ((*value)[0] == '\0') - dmasprintf(value, "cpe-%s", instance); - return 0; -} - -static int set_x_iopsys_eu_dropbear_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - struct uci_section *dmmap_section = NULL; - - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, NULL)) - return FAULT_9007; - return 0; - case VALUESET: - get_dmmap_section_of_config_section("dmmap_dropbear", "dropbear", section_name((struct uci_section *)data), &dmmap_section); - dmuci_set_value_by_section(dmmap_section, "dropbearalias", value); - return 0; - } - return 0; -} - -/***** ADD DEL OBJ *******/ +/************************************************************* +* ADD & DEL OBJ +**************************************************************/ int add_dropbear_instance(char *refparam, struct dmctx *ctx, void *data, char **instancepara) { - struct uci_section *dropbear_sec = NULL, *dmmap_sec= NULL; + struct uci_section *dropbear_sec = NULL, *dmmap_sec = NULL; char *instance = get_last_instance_bbfdm("dmmap_dropbear", "dropbear", "dropbearinstance"); @@ -382,21 +93,305 @@ int delete_dropbear_instance(char *refparam, struct dmctx *ctx, void *data, char return 0; } -/*** DMROOT.X_IOPSYS_EU_Dropbear.{i}. ****/ -DMLEAF X_IOPSYS_EU_DropbearParams[] = { +/************************************************************* +* GET & SET PARAM +**************************************************************/ +static int get_x_test_com_dropbear_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct uci_section *dmmap_section = NULL; + + get_dmmap_section_of_config_section("dmmap_dropbear", "dropbear", section_name((struct uci_section *)data), &dmmap_section); + dmuci_get_value_by_section_string(dmmap_section, "dropbearalias", value); + if ((*value)[0] == '\0') + dmasprintf(value, "cpe-%s", instance); + return 0; +} + +static int set_x_test_com_dropbear_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + struct uci_section *dmmap_section = NULL; + + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 64, NULL, NULL)) + return FAULT_9007; + return 0; + case VALUESET: + get_dmmap_section_of_config_section("dmmap_dropbear", "dropbear", section_name((struct uci_section *)data), &dmmap_section); + dmuci_set_value_by_section(dmmap_section, "dropbearalias", value); + return 0; + } + return 0; +} + +static int get_x_test_com_dropbear_password_auth(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + char *res = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "PasswordAuth", "1"); + *value = ((strcmp(res, "on") == 0) || *res == '1') ? "1" : "0"; + return 0; +} + +static int set_x_test_com_dropbear_password_auth(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + bool b; + + switch (action) { + case VALUECHECK: + if (dm_validate_boolean(value)) + return FAULT_9007; + return 0; + case VALUESET: + string_to_bool(value, &b); + dmuci_set_value_by_section((struct uci_section *)data, "PasswordAuth", b ? "1" : "0"); + return 0; + } + return 0; +} + +static int get_x_test_com_dropbear_root_password_auth(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + char *res = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "RootPasswordAuth", "1"); + *value = ((strcmp(res, "on") == 0) || *res == '1') ? "1" : "0"; + return 0; +} + +static int set_x_test_com_dropbear_root_password_auth(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + bool b; + + switch (action) { + case VALUECHECK: + if (dm_validate_boolean(value)) + return FAULT_9007; + return 0; + case VALUESET: + string_to_bool(value, &b); + dmuci_set_value_by_section((struct uci_section *)data, "RootPasswordAuth", b ? "1" : "0"); + return 0; + } + return 0; +} + +static int get_x_test_com_dropbear_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "Port", "22"); + return 0; +} + +static int set_x_test_com_dropbear_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + + switch (action) { + case VALUECHECK: + return 0; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "Port", value); + return 0; + } + return 0; +} + +static int get_x_test_com_dropbear_root_login(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "RootLogin", value); + if ((*value)[0] == '\0' || ((*value)[0] == 'o' && (*value)[1] == 'n') || (*value)[0] == '1' ) + *value = "1"; + else + *value = "0"; + return 0; +} + +static int set_x_test_com_dropbear_root_login(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + bool b; + + switch (action) { + case VALUECHECK: + if (dm_validate_boolean(value)) + return FAULT_9007; + return 0; + case VALUESET: + string_to_bool(value, &b); + dmuci_set_value_by_section((struct uci_section *)data, "RootLogin", b ? "1" : "0"); + return 0; + } + return 0; +} + +static int get_x_test_com_dropbear_verbose(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "verbose", "0"); + return 0; +} + +static int set_x_test_com_dropbear_verbose(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + bool b; + + switch (action) { + case VALUECHECK: + if (dm_validate_boolean(value)) + return FAULT_9007; + return 0; + case VALUESET: + string_to_bool(value, &b); + dmuci_set_value_by_section((struct uci_section *)data, "verbose", b ? "1" : "0"); + return 0; + } + return 0; +} + +static int get_x_test_com_dropbear_gateway_ports(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "GatewayPorts", "0"); + return 0; +} + +static int set_x_test_com_dropbear_gateway_ports(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + bool b; + + switch (action) { + case VALUECHECK: + if (dm_validate_boolean(value)) + return FAULT_9007; + return 0; + case VALUESET: + string_to_bool(value, &b); + dmuci_set_value_by_section((struct uci_section *)data, "GatewayPorts", b ? "1" : ""); + return 0; + } + return 0; +} + +static int get_x_test_com_dropbear_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "Interface", value); + return 0; +} + +static int set_x_test_com_dropbear_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + return 0; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "Interface", value); + return 0; + } + return 0; +} + +static int get_x_test_com_dropbear_rsakeyfile(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "rsakeyfile", value); + return 0; +} + +static int set_x_test_com_dropbear_rsakeyfile(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + return 0; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "rsakeyfile", value); + return 0; + } + return 0; +} + +static int get_x_test_com_dropbear_dsskeyfile(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "dsskeyfile", value); + return 0; +} + +static int set_x_test_com_dropbear_dsskeyfile(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + return 0; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "dsskeyfile", value); + return 0; + } + return 0; +} + +static int get_x_test_com_dropbear_ssh_keepalive(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "SSHKeepAlive", "300"); + return 0; +} + +static int set_x_test_com_dropbear_ssh_keepalive(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + return 0; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "SSHKeepAlive", (strcmp(value, "300") == 0) ? "" : value); + + return 0; + } + return 0; +} + +static int get_x_test_com_dropbear_idle_timeout(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "IdleTimeout", "300"); + return 0; +} + +static int set_x_test_com_dropbear_idle_timeout(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + return 0; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "IdleTimeout", (value[0] == '0') ? "" : value); + return 0; + } + return 0; +} + +static int get_x_test_com_dropbear_banner_file(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "BannerFile", value); + return 0; +} + +static int set_x_test_com_dropbear_banner_file(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + + switch (action) { + case VALUECHECK: + return 0; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "BannerFile", value); + return 0; + } + return 0; +} + +/********************************************************************************************************************************** +* OBJ & PARAM DEFINITION +***********************************************************************************************************************************/ +/*** Device.X_TEST_COM_Dropbear.{i}. ****/ +DMLEAF X_TEST_COM_DropbearParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"Alias", &DMWRITE, DMT_STRING, get_x_iopsys_eu_dropbear_alias, set_x_iopsys_eu_dropbear_alias, BBFDM_BOTH}, -{"PasswordAuth", &DMWRITE, DMT_BOOL, get_x_iopsys_eu_dropbear_password_auth, set_x_iopsys_eu_dropbear_password_auth, BBFDM_BOTH}, -{"RootPasswordAuth", &DMWRITE, DMT_BOOL, get_x_iopsys_eu_dropbear_root_password_auth, set_x_iopsys_eu_dropbear_root_password_auth, BBFDM_BOTH}, -{"Port", &DMWRITE, DMT_UNINT, get_x_iopsys_eu_dropbear_port, set_x_iopsys_eu_dropbear_port, BBFDM_BOTH}, -{"RootLogin", &DMWRITE, DMT_BOOL, get_x_iopsys_eu_dropbear_root_login, set_x_iopsys_eu_dropbear_root_login, BBFDM_BOTH}, -{"GatewayPorts", &DMWRITE, DMT_BOOL, get_x_iopsys_eu_dropbear_gateway_ports, set_x_iopsys_eu_dropbear_gateway_ports, BBFDM_BOTH}, -{"Interface", &DMWRITE, DMT_STRING, get_x_iopsys_eu_dropbear_interface, set_x_iopsys_eu_dropbear_interface, BBFDM_BOTH}, -{"RSAKeyFile", &DMWRITE, DMT_STRING, get_x_iopsys_eu_dropbear_rsakeyfile, set_x_iopsys_eu_dropbear_rsakeyfile, BBFDM_BOTH}, -{"DSSKeyFile", &DMWRITE, DMT_STRING, get_x_iopsys_eu_dropbear_dsskeyfile, set_x_iopsys_eu_dropbear_dsskeyfile, BBFDM_BOTH}, -{"SSHKeepAlive", &DMWRITE, DMT_UNINT, get_x_iopsys_eu_dropbear_ssh_keepalive, set_x_iopsys_eu_dropbear_ssh_keepalive, BBFDM_BOTH}, -{"IdleTimeout", &DMWRITE, DMT_UNINT, get_x_iopsys_eu_dropbear_idle_timeout, set_x_iopsys_eu_dropbear_idle_timeout, BBFDM_BOTH}, -{"Verbose", &DMWRITE, DMT_BOOL, get_x_iopsys_eu_dropbear_verbose, set_x_iopsys_eu_dropbear_verbose, BBFDM_BOTH}, -{"BannerFile", &DMWRITE, DMT_STRING, get_x_iopsys_eu_dropbear_banner_file, set_x_iopsys_eu_dropbear_banner_file, BBFDM_BOTH}, +{"Alias", &DMWRITE, DMT_STRING, get_x_test_com_dropbear_alias, set_x_test_com_dropbear_alias, BBFDM_BOTH}, +{"PasswordAuth", &DMWRITE, DMT_BOOL, get_x_test_com_dropbear_password_auth, set_x_test_com_dropbear_password_auth, BBFDM_BOTH}, +{"RootPasswordAuth", &DMWRITE, DMT_BOOL, get_x_test_com_dropbear_root_password_auth, set_x_test_com_dropbear_root_password_auth, BBFDM_BOTH}, +{"Port", &DMWRITE, DMT_UNINT, get_x_test_com_dropbear_port, set_x_test_com_dropbear_port, BBFDM_BOTH}, +{"RootLogin", &DMWRITE, DMT_BOOL, get_x_test_com_dropbear_root_login, set_x_test_com_dropbear_root_login, BBFDM_BOTH}, +{"GatewayPorts", &DMWRITE, DMT_BOOL, get_x_test_com_dropbear_gateway_ports, set_x_test_com_dropbear_gateway_ports, BBFDM_BOTH}, +{"Interface", &DMWRITE, DMT_STRING, get_x_test_com_dropbear_interface, set_x_test_com_dropbear_interface, BBFDM_BOTH}, +{"RSAKeyFile", &DMWRITE, DMT_STRING, get_x_test_com_dropbear_rsakeyfile, set_x_test_com_dropbear_rsakeyfile, BBFDM_BOTH}, +{"DSSKeyFile", &DMWRITE, DMT_STRING, get_x_test_com_dropbear_dsskeyfile, set_x_test_com_dropbear_dsskeyfile, BBFDM_BOTH}, +{"SSHKeepAlive", &DMWRITE, DMT_UNINT, get_x_test_com_dropbear_ssh_keepalive, set_x_test_com_dropbear_ssh_keepalive, BBFDM_BOTH}, +{"IdleTimeout", &DMWRITE, DMT_UNINT, get_x_test_com_dropbear_idle_timeout, set_x_test_com_dropbear_idle_timeout, BBFDM_BOTH}, +{"Verbose", &DMWRITE, DMT_BOOL, get_x_test_com_dropbear_verbose, set_x_test_com_dropbear_verbose, BBFDM_BOTH}, +{"BannerFile", &DMWRITE, DMT_STRING, get_x_test_com_dropbear_banner_file, set_x_test_com_dropbear_banner_file, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/x_iopsys_eu_dropbear.h b/dmtree/vendor/test/tr181/x_test_com_dropbear.h similarity index 64% rename from dmtree/tr181/x_iopsys_eu_dropbear.h rename to dmtree/vendor/test/tr181/x_test_com_dropbear.h index c279dffa..44fdd855 100644 --- a/dmtree/tr181/x_iopsys_eu_dropbear.h +++ b/dmtree/vendor/test/tr181/x_test_com_dropbear.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 iopsys Software Solutions AB + * Copyright (C) 2021 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 @@ -9,15 +9,15 @@ * */ -#ifndef __SE_DROPBEAR_H -#define __SE_DROPBEAR_H +#ifndef __TEST_DROPBEAR_H +#define __TEST_DROPBEAR_H #include -extern DMLEAF X_IOPSYS_EU_DropbearParams[]; +extern DMLEAF X_TEST_COM_DropbearParams[]; int add_dropbear_instance(char *refparam, struct dmctx *ctx, void *data, char **instancepara); int delete_dropbear_instance(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action); -int browseXIopsysEuDropbear(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance); +int browse_dropbear_instance(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance); -#endif +#endif //__TEST_DROPBEAR_H diff --git a/dmtree/vendor/vendor.c b/dmtree/vendor/vendor.c new file mode 100644 index 00000000..f19627d3 --- /dev/null +++ b/dmtree/vendor/vendor.c @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2021 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 Ramdhane + * + */ + +#include "vendor.h" + +#ifdef BBF_VENDOR_IOPSYS +#include "iopsys/tr181/vendor.h" +#endif + +#ifdef BBF_VENDOR_OPENWRT +#include "openwrt/tr181/vendor.h" +#endif + +#ifdef BBF_VENDOR_TEST +#include "test/tr181/vendor.h" +#endif + +/** This table is defined to add a new custom obj/param in the tree **/ +DM_MAP_VENDOR tVendorExtension[] = { +/* customer, tableobject */ + +#ifdef BBF_VENDOR_IOPSYS +{"iopsys", tVendorExtensionIOPSYS}, +#endif + +#ifdef BBF_VENDOR_TEST +{"test", tVendorExtensionTEST}, +#endif + +{0} +}; + +/** This table is defined to overwrite an existing obj/param in the tree **/ +DM_MAP_VENDOR tVendorExtensionOverwrite[] = { +/* customer, tableobject */ + +#ifdef BBF_VENDOR_OPENWRT +{"openwrt", tVendorExtensionOverwriteOPENWRT}, +#endif + +#ifdef BBF_VENDOR_TEST +{"test", tVendorExtensionOverwriteTEST}, +#endif + +{0} +}; + +/** This table is defined to exclude some obj/param from the tree **/ +DM_MAP_VENDOR_EXCLUDE tVendorExtensionExclude[] = { +/* customer, tableobject */ + +#ifdef BBF_VENDOR_OPENWRT +{"openwrt", VendorExtensionExcludeOPENWRT}, +#endif + +#ifdef BBF_VENDOR_TEST +{"test", VendorExtensionExcludeTEST}, +#endif + + +{0} +}; diff --git a/dmtree/vendor/vendor.h b/dmtree/vendor/vendor.h new file mode 100644 index 00000000..a13c5e0b --- /dev/null +++ b/dmtree/vendor/vendor.h @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2021 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 Ramdhane + * + */ + +#ifndef __VENDOR_EXTENSION_H +#define __VENDOR_EXTENSION_H + +#include + +extern DM_MAP_VENDOR tVendorExtension[]; +extern DM_MAP_VENDOR tVendorExtensionOverwrite[]; +extern DM_MAP_VENDOR_EXCLUDE tVendorExtensionExclude[]; + +#endif //__VENDOR_EXTENSION_H diff --git a/dynamic_parameters/json/example.json b/dynamic_parameters/json/example.json deleted file mode 100644 index df68a0aa..00000000 --- a/dynamic_parameters/json/example.json +++ /dev/null @@ -1,298 +0,0 @@ -{ - "Device.DSL.Line.{i}.": { - "type": "object", - "protocols": [ - "cwmp", - "usp" - ], - "array": true, - "mapping": { - "type": "ubus", - "ubus": { - "object": "dsl", - "method": "status", - "args": {}, - "key": "line" - } - }, - "FirmwareVersion": { - "type": "string­", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": false, - "mapping": { - "type": "ubus", - "ubus": { - "object": "dsl.line.@i-1", - "method": "status", - "args": {}, - "key": "firmware_version" - } - } - }, - "UpstreamMaxBitRate": { - "type": "unsignedInt", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": false, - "mapping": { - "type": "ubus", - "ubus": { - "object": "dsl.line.@i-1", - "method": "status", - "args": {}, - "key": "max_bit_rate.us" - } - } - }, - "Device.DSL.Line.{i}.Stats.": { - "type": "object", - "protocols": [ - "cwmp", - "usp" - ], - "array": false, - "TotalStart": { - "type": "unsignedInt", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": false, - "mapping": { - "type": "ubus", - "ubus": { - "object": "dsl.line.@i-1", - "method": "stats", - "args": {}, - "key": "total_start" - } - } - }, - "ShowtimeStart": { - "type": "unsignedInt", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": false, - "mapping": { - "type": "ubus", - "ubus": { - "object": "dsl.line.@i-1", - "method": "stats", - "args": {}, - "key": "showtime_start" - } - } - }, - "QuarterHourStart": { - "type": "unsignedInt", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": false, - "mapping": { - "type": "ubus", - "ubus": { - "object": "dsl.line.@i-1", - "method": "stats", - "args": {}, - "key": "quarter_hour_start" - } - } - }, - "Device.DSL.Line.{i}.Stats.Total.": { - "type": "object", - "protocols": [ - "cwmp", - "usp" - ], - "array": false, - "ErroredSecs": { - "type": "unsignedInt", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": false, - "mapping": { - "type": "ubus", - "ubus": { - "object": "dsl.line.@i-1", - "method": "stats", - "args": {}, - "key": "total.errored_secs" - } - } - }, - "SeverelyErroredSecs": { - "type": "unsignedInt", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": false, - "mapping": { - "type": "ubus", - "ubus": { - "object": "dsl.line.@i-1", - "method": "stats", - "args": {}, - "key": "total.severely_errored_secs" - } - } - } - }, - "Device.DSL.Line.{i}.Stats.LastShowtime.": { - "type": "object", - "protocols": [ - "cwmp", - "usp" - ], - "array": false, - "ErroredSecs": { - "type": "unsignedInt", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": false, - "mapping": { - "type": "ubus", - "ubus": { - "object": "dsl.line.@i-1", - "method": "stats", - "args": {}, - "key": "lastshowtime.errored_secs" - } - } - }, - "SeverelyErroredSecs": { - "type": "unsignedInt", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": false, - "mapping": { - "type": "ubus", - "ubus": { - "object": "dsl.line.@i-1", - "method": "stats", - "args": {}, - "key": "lastshowtime.severely_errored_secs" - } - } - } - } - } - }, - "Device.X_IOPSYS_EU_WiFiLife.": { - "type": "object", - "protocols": [ - "cwmp", - "usp" - ], - "array": false, - "Enable": { - "type": "boolean", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": { - "type": "uci", - "uci": { - "file": "wifilife", - "section": { - "type": "wifilife", - "name": "@wifilife[0]" - }, - "option": { - "name": "enabled" - } - } - } - }, - "Device.X_IOPSYS_EU_WiFiLife.Steering.{i}.": { - "type": "object", - "protocols": [ - "cwmp", - "usp" - ], - "array": true, - "mapping": { - "type": "uci", - "uci": { - "file": "wifilife", - "section": { - "type": "steer" - }, - "dmmapfile": "dmmap_wifilife" - } - }, - "Enable": { - "type": "boolean", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": { - "type": "uci", - "uci": { - "file": "wifilife", - "section": { - "type": "steer", - "index": "@i-1" - }, - "option": { - "name": "enabled" - } - } - } - }, - "LegacyFallback": { - "type": "boolean", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": { - "type": "uci", - "uci": { - "file": "wifilife", - "section": { - "type": "steer", - "index": "@i-1" - }, - "option": { - "name": "fallback_legacy" - } - } - } - } - } - } -} - diff --git a/dynamic_parameters/library/example.json b/dynamic_parameters/library/example.json deleted file mode 100644 index 1cd95d84..00000000 --- a/dynamic_parameters/library/example.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "Device.IP.Diagnostics.X_IOPSYS_EU_BBKSpeedTest.": { - "type": "object", - "protocols": [ - "cwmp", - "usp" - ], - "access": false, - "DiagnosticsState": { - "type": "string", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true - }, - "Latency": { - "type": "string", - "protocols": [ - "cwmp", - "usp" - - ], - "read": true, - "write": false - }, - "Download": { - "type": "string", - "protocols": [ - "cwmp", - "usp" - - ], - "read": true, - "write": false - }, - "Upload": { - "type": "string", - "protocols": [ - "cwmp", - "usp" - - ], - "read": true, - "write": false - } - }, - "Device.BBKSpeedTest": { - "type": "operate", - "optype": "async" - } -} - diff --git a/dynamic_parameters/library/example/Makefile b/dynamic_parameters/library/example/Makefile deleted file mode 100644 index e4c46815..00000000 --- a/dynamic_parameters/library/example/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -LIB_EXAMPLE := libexample.so - -OBJS := example.o - -LIB_CFLAGS = $(CFLAGS) -fstrict-aliasing -LIB_LDFLAGS = $(LDFLAGS) -lbbf_api -FPIC := -fPIC - -.PHONY: all - -%.o: %.c - $(CC) $(LIB_CFLAGS) $(FPIC) -c -o $@ $< - -all: $(LIB_EXAMPLE) - -$(LIB_EXAMPLE): $(OBJS) - $(CC) $(LIB_CFLAGS) $(LIB_LDFLAGS) -shared -o $@ $^ - -clean: - rm -f *.o $(LIB_EXAMPLE) - diff --git a/dynamic_parameters/library/example/example.c b/dynamic_parameters/library/example/example.c deleted file mode 100644 index 78447dde..00000000 --- a/dynamic_parameters/library/example/example.c +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (C) 2020 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 Ramdhane - */ - -#include -#include -#include -#include -#include -#include "example.h" - -/* ********** RootDynamicObj ********** */ -LIB_MAP_OBJ tRootDynamicObj[] = { -/* parentobj, nextobject */ -{"Device.IP.Diagnostics.", tdynamicIPDiagnosticsObj}, -{0} -}; - -/* ********** RootDynamicOperate ********** */ -LIB_MAP_OPERATE tRootDynamicOperate[] = { -/* pathname, operation, type */ -{"Device.BBKSpeedTest", dynamicDeviceOperate, "async"}, -{0} -}; - -/************************************************************* - * GET & SET PARAM -/*************************************************************/ -static int execute_bbk_speedtest() -{ - json_object *res = NULL; - char *latency = NULL, *download = NULL, *upload = NULL; - - dmubus_call("bbk", "start", UBUS_ARGS{}, 0, &res); - if (res) { - dmuci_set_value_bbfdm("dmmap_diagnostics", "bbkspeedtest", "DiagnosticState", "Complete"); - latency = dmjson_get_value(res, 1, "latency"); - if (latency != NULL && strlen(latency) > 0) - dmuci_set_value_bbfdm("dmmap_diagnostics", "bbkspeedtest", "Latency", latency); - download = dmjson_get_value(res, 1, "download"); - if (download != NULL && strlen(latency) > 0) - dmuci_set_value_bbfdm("dmmap_diagnostics", "bbkspeedtest", "Download", download); - upload=dmjson_get_value(res, 1, "upload"); - if (upload != NULL && strlen(upload) > 0) - dmuci_set_value_bbfdm("dmmap_diagnostics", "bbkspeedtest", "Upload", upload); - } - return 0; -} - -static char *bbk_speedtest_get(char *option, char *default_value) -{ - char *value; - dmuci_get_option_value_string_bbfdm("dmmap_diagnostics", "bbkspeedtest", option, &value); - return (*value != '\0') ? value : default_value; -} - -void bbk_speedtest_set(char *option, char *value) -{ - check_create_dmmap_package("dmmap_diagnostics"); - struct uci_section *section = dmuci_walk_section_bbfdm("dmmap_diagnostics", "bbkspeedtest", NULL, NULL, CMP_SECTION, NULL, NULL, GET_FIRST_SECTION); - if (!section) - dmuci_set_value_bbfdm("dmmap_diagnostics", "bbkspeedtest", "", "bbkspeedtest"); - - dmuci_set_value_bbfdm("dmmap_diagnostics", "bbkspeedtest", option, value); -} - -static int getdynamic_IPDiagnosticsX_IOPSYS_EU_BBKSpeedTest_DiagnosticsState(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = bbk_speedtest_get("DiagnosticState", "None"); - return 0; -} - -static int setdynamic_IPDiagnosticsX_IOPSYS_EU_BBKSpeedTest_DiagnosticsState(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - char *tmp; - struct uci_section *curr_section = NULL; - - switch (action) { - case VALUECHECK: - break; - case VALUESET: - if (strcmp(value, "Requested") == 0) { - bbk_speedtest_set("DiagnosticState", value); - execute_bbk_speedtest(); - } - break; - } - return 0; -} - -static int getdynamic_IPDiagnosticsX_IOPSYS_EU_BBKSpeedTest_Latency(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = bbk_speedtest_get("Latency", "0"); - return 0; -} - -static int getdynamic_IPDiagnosticsX_IOPSYS_EU_BBKSpeedTest_Download(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = bbk_speedtest_get("Download", "0"); - return 0; -} - -static int getdynamic_IPDiagnosticsX_IOPSYS_EU_BBKSpeedTest_Upload(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - *value = bbk_speedtest_get("Upload", "0"); - return 0; -} - -/************************************************************* - * OPERATE -/*************************************************************/ -opr_ret_t dynamicDeviceOperate(struct dmctx *dmctx, char *path, json_object *input) -{ - json_object *ubus_res = NULL; - - dmubus_call("bbk", "start", UBUS_ARGS{}, 0, &ubus_res); - - char *param_latency = (char *) dmjson_get_value(ubus_res, 1, "latency"); - char *param_download = (char *) dmjson_get_value(ubus_res, 1, "download"); - char *param_upload = (char *) dmjson_get_value(ubus_res, 1, "upload"); - - add_list_parameter(dmctx, dmstrdup("Latency"), param_latency, "string", NULL); - add_list_parameter(dmctx, dmstrdup("Download"), param_download, "string", NULL); - add_list_parameter(dmctx, dmstrdup("Upload"), param_upload, "string", NULL); - - return SUCCESS; -} - -/* *** Device.IP.Diagnostics. *** */ -DMOBJ tdynamicIPDiagnosticsObj[] = { -/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"X_IOPSYS_EU_BBKSpeedTest", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tdynamicIPDiagnosticsX_IOPSYS_EU_BBKSpeedTestParams, NULL, BBFDM_BOTH}, -{0} -}; - -/* *** Device.IP.Diagnostics.X_IOPSYS_EU_BBKSpeedTest. *** */ -DMLEAF tdynamicIPDiagnosticsX_IOPSYS_EU_BBKSpeedTestParams[] = { -/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"DiagnosticsState", &DMWRITE, DMT_STRING, getdynamic_IPDiagnosticsX_IOPSYS_EU_BBKSpeedTest_DiagnosticsState, setdynamic_IPDiagnosticsX_IOPSYS_EU_BBKSpeedTest_DiagnosticsState, BBFDM_BOTH}, -{"Latency", &DMREAD, DMT_STRING, getdynamic_IPDiagnosticsX_IOPSYS_EU_BBKSpeedTest_Latency, NULL, BBFDM_BOTH}, -{"Download", &DMREAD, DMT_STRING, getdynamic_IPDiagnosticsX_IOPSYS_EU_BBKSpeedTest_Download, NULL, BBFDM_BOTH}, -{"Upload", &DMREAD, DMT_STRING, getdynamic_IPDiagnosticsX_IOPSYS_EU_BBKSpeedTest_Upload, NULL, BBFDM_BOTH}, -{0} -}; - diff --git a/dynamic_parameters/library/example/example.h b/dynamic_parameters/library/example/example.h deleted file mode 100644 index db534bc3..00000000 --- a/dynamic_parameters/library/example/example.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2020 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 Ramdhane - */ - -#ifndef __EXAMPLE_H -#define __EXAMPLE_H - -DMOBJ tdynamicIPDiagnosticsObj[]; -DMLEAF tdynamicIPDiagnosticsX_IOPSYS_EU_BBKSpeedTestParams[]; - - -#endif //__EXAMPLE_H - diff --git a/dynamic_parameters/library/generate_library.py b/dynamic_parameters/library/generate_library.py deleted file mode 100755 index 078fd975..00000000 --- a/dynamic_parameters/library/generate_library.py +++ /dev/null @@ -1,579 +0,0 @@ -#!/usr/bin/python - -# Copyright (C) 2020 iopsys Software Solutions AB -# Author: Amin Ben Ramdhane - -import os -import sys -import time -import json -from collections import OrderedDict - -arrtype = { -"string": "DMT_STRING", -"unsignedInt": "DMT_UNINT", -"unsignedLong": "DMT_UNLONG", -"int": "DMT_INT", -"long": "DMT_LONG", -"boolean": "DMT_BOOL", -"dateTime": "DMT_TIME", -"hexBinary": "DMT_HEXBIN", -"base64": "DMT_BASE64", -} - -def removefile( filename ): - try: - os.remove(filename) - except OSError: - pass - -def securemkdir( folder ): - try: - os.mkdir(folder) - except: - pass - -def getlastname( name ): - lastname = name - lastname = lastname.replace(".{i}", "") - namelist = lastname.split('.') - lastname = namelist[-1] - if lastname == "": - lastname = namelist[-2] - return lastname; - -def getname( objname ): - OBJSname = objname - if (objname.count('.') > 1 and (objname.count('.') != 2 or objname.count('{i}') != 1)): - OBJSname = objname.replace("Device", "", 1) - OBJSname = OBJSname.replace("{i}", "") - OBJSname = OBJSname.replace(".", "") - if (objname.count('.') == 1): - OBJSname = "Device" - return OBJSname - return OBJSname; - -def getoptionparam( value, option ): - val = "false" - if isinstance(value,dict): - for k,v in value.items(): - if k == option: - return v - return val - -def getprotocolsparam( value, option ): - if isinstance(value,dict): - for k,v in value.items(): - if k == option and isinstance(v, list): - if len(v) == 2: - return "BBFDM_BOTH" - elif v[0] == "usp": - return "BBFDM_USP" - else: - return "BBFDM_CWMP" - return "BBFDM_BOTH" - -def getparamtype( value ): - ptype = None - paramtype = getoptionparam(value, "type") - ptype = arrtype.get(paramtype, None) - if ptype == None: - ptype = "__NA__" - return ptype - -def objhaschild( value ): - if isinstance(value,dict): - for k,v in value.items(): - if isinstance(v,dict): - for k1,v1 in v.items(): - if k1 == "type" and v1 == "object": - return 1 - return 0 - -def objhasparam( value ): - if isinstance(value,dict): - for k,v in value.items(): - if isinstance(v,dict): - for k1,v1 in v.items(): - if k1 == "type" and v1 != "object": - return 1 - return 0 - -def printheaderObjCommon( objname ): - fp = open('./.objparamarray.c', 'a') - print >> fp, "/* *** %s *** */" % objname - fp.close() - -def cprintheaderOBJS( objname ): - fp = open('./.objparamarray.c', 'a') - print >> fp, "DMOBJ %s[] = {" % ("tdynamic" + getname(objname) + "Obj") - print >> fp, "/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/" - fp.close() - -def cprintheaderRootDynamicObj( ): - fp = open('./.objroot.c', 'a') - print >> fp, "/* ********** RootDynamicObj ********** */" - print >> fp, "LIB_MAP_OBJ tRootDynamicObj[] = {" - print >> fp, "/* parentobj, nextobject */" - fp.close() - -def cprintheaderRootDynamicOperate( ): - fp = open('./.objroot.c', 'a') - print >> fp, "/* ********** RootDynamicOperate ********** */" - print >> fp, "LIB_MAP_OPERATE tRootDynamicOperate[] = {" - print >> fp, "/* pathname, operation, type */" - fp.close() - -def printObjRootDynamic( dmobject ): - commonname = getname(dmobject) - fp = open('./.objroot.c', 'a') - print >> fp, "{\"%s\", %s}," % (dmobject, "tdynamic" + commonname + "Obj") - fp.close() - -def printOperateRootDynamic( dmobject, commonname , optype): - fp = open('./.objroot.c', 'a') - print >> fp, "{\"%s\", %s, \"%s\"}," % (dmobject, "dynamic" + commonname + "Operate", optype) - fp.close() - -def printtailArrayRootDynamic( ): - fp = open('./.objroot.c', 'a') - print >> fp, "{0}" - print >> fp, "};" - print >> fp, "" - fp.close() - -def hprintheaderOBJS( objname ): - fp = open('./.objparamarray.h', 'a') - print >> fp, "DMOBJ %s[];" % ("tdynamic" + getname(objname) + "Obj") - fp.close() - -def cprinttopfile ( fp ): - print >> fp, "/*" - print >> fp, " * Copyright (C) 2020 iopsys Software Solutions AB" - print >> fp, " *" - print >> fp, " * This program is free software; you can redistribute it and/or modify" - print >> fp, " * it under the terms of the GNU Lesser General Public License version 2.1" - print >> fp, " * as published by the Free Software Foundation" - print >> fp, " *" - print >> fp, " * Author: Amin Ben Ramdhane " - print >> fp, " */" - print >> fp, "" - print >> fp, "#include " - print >> fp, "#include " - print >> fp, "#include " - print >> fp, "#include " - print >> fp, "#include " - print >> fp, "#include \"example.h\"" - print >> fp, "" - -def hprinttopfile ( fp ): - print >> fp, "/*" - print >> fp, " * Copyright (C) 2020 iopsys Software Solutions AB" - print >> fp, " *" - print >> fp, " * This program is free software; you can redistribute it and/or modify" - print >> fp, " * it under the terms of the GNU Lesser General Public License version 2.1" - print >> fp, " * as published by the Free Software Foundation" - print >> fp, " *" - print >> fp, " * Author: Amin Ben Ramdhane " - print >> fp, " */" - print >> fp, "" - print >> fp, "#ifndef __EXAMPLE_H" - print >> fp, "#define __EXAMPLE_H" - print >> fp, "" - -def printmakefile ( fp ): - print >> fp, "LIB_EXAMPLE := libexample.so" - print >> fp, "" - print >> fp, "OBJS := example.o" - print >> fp, "" - print >> fp, "LIB_CFLAGS = $(CFLAGS) -fstrict-aliasing" - print >> fp, "LIB_LDFLAGS = $(LDFLAGS) -lbbf_api" - print >> fp, "FPIC := -fPIC" - print >> fp, "" - print >> fp, ".PHONY: all" - print >> fp, "" - print >> fp, "%.o: %.c" - print >> fp, " $(CC) $(LIB_CFLAGS) $(FPIC) -c -o $@ $<" - print >> fp, "" - print >> fp, "all: $(LIB_EXAMPLE)" - print >> fp, "" - print >> fp, "$(LIB_EXAMPLE): $(OBJS)" - print >> fp, " $(CC) $(LIB_CFLAGS) $(LIB_LDFLAGS) -shared -o $@ $^" - print >> fp, "" - print >> fp, "clean:" - print >> fp, " rm -f *.o $(LIB_EXAMPLE)" - print >> fp, "" - -def hprintfootfile ( fp ): - print >> fp, "" - print >> fp, "#endif //__EXAMPLE_H" - print >> fp, "" - -def cprintAddDelObj( faddobj, fdelobj, name, mappingobj, dmobject ): - fp = open('./.objadddel.c', 'a') - print >> fp, "static int %s(char *refparam, struct dmctx *ctx, void *data, char **instance)" % faddobj - print >> fp, "{" - print >> fp, " //TODO" - print >> fp, " return 0;" - print >> fp, "}" - print >> fp, "" - print >> fp, "static int %s(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action)" % fdelobj - print >> fp, "{" - print >> fp, " switch (del_action) {" - print >> fp, " case DEL_INST:" - print >> fp, " //TODO" - print >> fp, " break;" - print >> fp, " case DEL_ALL:" - print >> fp, " //TODO" - print >> fp, " break;" - print >> fp, " }" - print >> fp, " return 0;" - print >> fp, "}" - print >> fp, "" - fp.close() - -def cprintBrowseObj( fbrowse, name, mappingobj, dmobject ): - fp = open('./.objbrowse.c', 'a') - print >> fp, "static int %s(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)" % fbrowse - print >> fp, "{" - print >> fp, " //TODO" - print >> fp, " return 0;" - print >> fp, "}" - print >> fp, "" - fp.close() - -def cprintGetSetValue(getvalue, setvalue, mappingparam, instance, typeparam, parentname, dmparam): - fp = open('./.getstevalue.c', 'a') - print >> fp, "static int %s(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)" % getvalue - print >> fp, "{" - print >> fp, " //TODO" - print >> fp, " return 0;" - print >> fp, "}" - print >> fp, "" - if setvalue != "NULL": - print >> fp, "static int %s(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)" % setvalue - print >> fp, "{" - print >> fp, " switch (action) {" - print >> fp, " case VALUECHECK:" - print >> fp, " break;" - print >> fp, " case VALUESET:" - print >> fp, " //TODO" - print >> fp, " break;" - print >> fp, " }" - print >> fp, " return 0;" - print >> fp, "}" - print >> fp, "" - fp.close() - -def cprintOperate( get_operate ): - fp = open('./.operate.c', 'a') - print >> fp, "opr_ret_t %s(struct dmctx *dmctx, char *path, json_object *input)" % ("dynamic" + get_operate + "Operate") - print >> fp, "{" - print >> fp, " return SUCCESS;" - print >> fp, "}" - fp.close() - -def cprintheaderPARAMS( objname ): - fp = open('./.objparamarray.c', 'a') - print >> fp, "DMLEAF %s[] = {" % ("tdynamic" + getname(objname) + "Params") - print >> fp, "/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/" - fp.close() - -def hprintheaderPARAMS( objname ): - fp = open('./.objparamarray.h', 'a') - print >> fp, "DMLEAF %s[];" % ("tdynamic" + getname(objname) + "Params") - fp.close() - -def printPARAMline( parentname, dmparam, value ): - commonname = getname(parentname) + "_" + dmparam - ptype = getparamtype(value) - getvalue = "getdynamic_" + commonname - mappingparam = getoptionparam(value, "mapping") - typeparam = getoptionparam(value, "type") - bbfdm = getprotocolsparam(value, "protocols") - accessparam = getoptionparam(value, "write") - - if accessparam: - access = "&DMWRITE" - setvalue = "setdynamic_" + commonname - else: - access = "&DMREAD" - setvalue = "NULL" - - if parentname.endswith(".{i}."): - instance = "TRUE" - else: - instance = "FALSE" - - cprintGetSetValue(getvalue, setvalue, mappingparam, instance, typeparam, parentname, dmparam) - - fp = open('./.objparamarray.c', 'a') - print >> fp, "{\"%s\", %s, %s, %s, %s, %s}," % (dmparam, access, ptype, getvalue, setvalue, bbfdm) - fp.close() - -def printtailArray( ): - fp = open('./.objparamarray.c', 'a') - print >> fp, "{0}" - print >> fp, "};" - print >> fp, "" - fp.close() - -def printOBJline( dmobject, value ): - commonname = getname(dmobject) - hasobj = objhaschild(value) - hasparam = objhasparam(value) - accessobj = getoptionparam(value, "access") - mappingobj = getoptionparam(value, "mapping") - bbfdm = getprotocolsparam(value, "protocols") - - if accessobj: - access = "&DMWRITE" - faddobj = "adddynamicObj" + commonname - fdelobj = "deldynamicObj" + commonname - cprintAddDelObj(faddobj, fdelobj, (getlastname(dmobject)).lower(), mappingobj, dmobject) - hprintAddDelObj(faddobj, fdelobj) - else: - access = "&DMREAD" - faddobj = "NULL" - fdelobj = "NULL" - - if dmobject.endswith(".{i}."): - fbrowse = "browse" + commonname + "Inst" - cprintBrowseObj(fbrowse, (getlastname(dmobject)).lower(), mappingobj, dmobject) - hprintBrowseObj(fbrowse) - else: - fbrowse = "NULL" - - if hasobj: - objchildarray = "tdynamic" + commonname + "Obj" - else: - objchildarray = "NULL" - - if hasparam: - paramarray = "tdynamic" + commonname + "Params" - else: - paramarray = "NULL" - - fp = open('./.objparamarray.c', 'a') - print >> fp, "{\"%s\", %s, %s, %s, NULL, %s, NULL, %s, %s, NULL, %s}," % (getlastname(dmobject), access, faddobj, fdelobj, fbrowse, objchildarray, paramarray, bbfdm) - fp.close() - -def printusage(): - print "Usage: " + sys.argv[0] + " " - print "Examples:" - print " - " + sys.argv[0] + " example.json" - print " ==> Generate the C code in example/ folder" - -def object_parse_childs( dmobject , value, nextlevel ): - hasobj = objhaschild(value) - hasparam = objhasparam(value) - - if hasobj or hasparam: - printheaderObjCommon(dmobject) - - if hasobj: - cprintheaderOBJS(dmobject) - hprintheaderOBJS(dmobject) - - if isinstance(value,dict): - for k,v in value.items(): - if isinstance(v,dict): - for k1,v1 in v.items(): - if k1 == "type" and v1 == "object": - printOBJline(k, v) - break - printtailArray() - - if hasparam: - cprintheaderPARAMS(dmobject) - hprintheaderPARAMS(dmobject) - if isinstance(value,dict): - for k,v in value.items(): - if k == "mapping": - continue - if isinstance(v,dict): - for k1,v1 in v.items(): - if k1 == "type" and v1 != "object": - printPARAMline(dmobject, k, v) - break - printtailArray() - - if hasobj and nextlevel == 0: - if isinstance(value,dict): - for k,v in value.items(): - if isinstance(v,dict): - for k1,v1 in v.items(): - if k1 == "type" and v1 == "object": - object_parse_childs(k , v, 0) - -def generatecfiles( pdir ): - securemkdir(pdir) - dmfpc = open(pdir + "/example" + ".c", "w") - dmfph = open(pdir + "/example" + ".h", "w") - makefile = open(pdir + "/Makefile", "w") - - cprinttopfile(dmfpc) - hprinttopfile(dmfph) - printmakefile(makefile) - - try: - tmpf = open("./.objroot.c", "r") - tmpd = tmpf.read() - tmpf.close() - dmfpc.write(tmpd) - except: - pass - try: - tmpf = open("./.objparamarray.h", "r") - tmpd = tmpf.read() - tmpf.close() - dmfph.write(tmpd) - print >> dmfph, "" - except: - pass - try: - exists = os.path.isfile("./.objbrowse.c") - if exists: - print >> dmfpc, "/*************************************************************" - print >> dmfpc, " * ENTRY METHOD" - print >> dmfpc, "/*************************************************************/" - tmpf = open("./.objbrowse.c", "r") - tmpd = tmpf.read() - tmpf.close() - dmfpc.write(tmpd) - except: - pass - try: - exists = os.path.isfile("./.objadddel.c") - if exists: - print >> dmfpc, "/*************************************************************" - print >> dmfpc, " * ADD & DEL OBJ" - print >> dmfpc, "/*************************************************************/" - tmpf = open("./.objadddel.c", "r") - tmpd = tmpf.read() - tmpf.close() - dmfpc.write(tmpd) - except: - pass - try: - exists = os.path.isfile("./.getstevalue.c") - if exists: - print >> dmfpc, "/*************************************************************" - print >> dmfpc, " * GET & SET PARAM" - print >> dmfpc, "/*************************************************************/" - tmpf = open("./.getstevalue.c", "r") - tmpd = tmpf.read() - tmpf.close() - dmfpc.write(tmpd) - except: - pass - try: - exists = os.path.isfile("./.operate.c") - if exists: - print >> dmfpc, "/*************************************************************" - print >> dmfpc, " * OPERATE" - print >> dmfpc, "/*************************************************************/" - tmpf = open("./.operate.c", "r") - tmpd = tmpf.read() - tmpf.close() - dmfpc.write(tmpd) - except: - pass - try: - tmpf = open("./.objparamarray.c", "r") - tmpd = tmpf.read() - tmpf.close() - dmfpc.write(tmpd) - except: - pass - hprintfootfile(dmfph) - removetmpfiles() - -def generatestartedobject( key , value ): - obj_type = getoptionparam(value, "type") - if obj_type == "operate": - op_type = getoptionparam(value, "optype") - key = key.replace(".{i}.", ".*.") - if key not in DictOperate: - DictOperate[key] = op_type; - else: - key = key.replace(".{i}", "") - obj = '.'.join(key.split(".")[0:key.count('.')-1]) + '.' - if obj not in ListObjects: - ListObjects.append(obj) - -def generateRootDynamicarray( ): - cprintheaderRootDynamicObj() - for x in ListObjects: - printObjRootDynamic(x) - printtailArrayRootDynamic() - - cprintheaderRootDynamicOperate() - for x in DictOperate: - commonname = getname(x) - printOperateRootDynamic(x, commonname, DictOperate[x]) - cprintOperate(commonname) - printtailArrayRootDynamic() - -def removetmpfiles( ): - removefile("./.objparamarray.c") - removefile("./.objparamarray.h") - removefile("./.objadddel.c") - removefile("./.objbrowse.c") - removefile("./.getstevalue.c") - removefile("./.operate.c") - removefile("./.objroot.c") - -### main ### -if len(sys.argv) < 2: - printusage() - exit(1) - -if (sys.argv[1]).lower() == "-h" or (sys.argv[1]).lower() == "--help": - printusage() - exit(1) - -json_file = sys.argv[1] -gendir = "example" -removetmpfiles() - -with open(json_file) as file: - data = json.loads(file.read(), object_pairs_hook=OrderedDict) - -ListObjects = [] -DictOperate = {} -for i,(key,value) in enumerate(data.items()): - generatestartedobject(key, value) - -generateRootDynamicarray() - -for x in ListObjects: - printheaderObjCommon(x) - cprintheaderOBJS(x) - hprintheaderOBJS(x) - for i,(key,value) in enumerate(data.items()): - obj_type = getoptionparam(value, "type") - if obj_type == "operate": - continue - objstart = key - key = key.replace(".{i}", "") - obj = '.'.join(key.split(".")[0:key.count('.')-1]) + '.' - if x == obj: - printOBJline(objstart, value) - printtailArray() - -for i,(key,value) in enumerate(data.items()): - objstart = key - device = key.split(".") - if device[0] == None: - print "Wrong JSON Data model format!" - exit(1) - object_parse_childs(objstart, value, 0) - -generatecfiles(gendir) - -if (os.path.isdir(gendir)): - print "Source code generated under \"./%s\" folder" % gendir -else: - print "No source code generated!" - diff --git a/json/X_IOPSYS_EU_Buttons.json b/json/X_IOPSYS_EU_Buttons.json deleted file mode 100644 index 1c95cff7..00000000 --- a/json/X_IOPSYS_EU_Buttons.json +++ /dev/null @@ -1,213 +0,0 @@ -{ - "Device.X_IOPSYS_EU_Buttons.": { - "type": "object", - "protocols": [ - "cwmp", - "usp" - ], - "array": true, - "mapping": { - "type": "uci", - "uci": { - "file": "buttons", - "section": { - "type": "button" - }, - "dmmapfile": "dmmap_buttons" - } - }, - "Alias": { - "type": "string", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "dmmap_buttons", - "section": { - "type": "button", - "index": "@i-1" - }, - "option": { - "name": "buttonalias" - }, - "path": "/etc/bbfdm" - } - } - ] - }, - "Enable": { - "type": "boolean", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "buttons", - "section": { - "type": "button", - "index": "@i-1" - }, - "option": { - "name": "enable" - } - } - } - ] - }, - "Name": { - "type": "string", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "buttons", - "section": { - "type": "button", - "index": "@i-1" - }, - "option": { - "name": "@Name" - } - } - } - ] - }, - "GPIOButton": { - "type": "string", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": false, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "buttons", - "section": { - "type": "button", - "index": "@i-1" - }, - "option": { - "name": "button" - } - } - } - ] - }, - "HotplugInterface": { - "type": "string", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": false, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "buttons", - "section": { - "type": "button", - "index": "@i-1" - }, - "option": { - "name": "hotplug" - } - } - } - ] - }, - "HotplugInterfaceForLongPress": { - "type": "string", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": false, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "buttons", - "section": { - "type": "button", - "index": "@i-1" - }, - "option": { - "name": "hotplug_long" - } - } - } - ] - }, - "MinPressTime": { - "type": "unsignedInt", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "buttons", - "section": { - "type": "button", - "index": "@i-1" - }, - "option": { - "name": "minpress" - } - } - } - ] - }, - "LongPressTime": { - "type": "unsignedInt", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "buttons", - "section": { - "type": "button", - "index": "@i-1" - }, - "option": { - "name": "longpress" - } - } - } - ] - } - } -} diff --git a/json/X_IOPSYS_EU_Dropbear.json b/json/X_IOPSYS_EU_Dropbear.json deleted file mode 100644 index 4a2fb033..00000000 --- a/json/X_IOPSYS_EU_Dropbear.json +++ /dev/null @@ -1,333 +0,0 @@ -{ - "Device.X_IOPSYS_EU_Dropbear.": { - "type": "object", - "protocols": [ - "cwmp", - "usp" - ], - "array": true, - "mapping": { - "type": "uci", - "uci": { - "file": "dropbear", - "section": { - "type": "dropbear" - }, - "dmmapfile": "dmmap_dropbear" - } - }, - "Alias": { - "type": "string", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "dmmap_dropbear", - "section": { - "type": "dropbear", - "index": "@i-1" - }, - "option": { - "name": "dropbearalias" - }, - "path":"/etc/bbfdm", - } - } - ] - }, - "PasswordAuth": { - "type": "boolean", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "dropbear", - "section": { - "type": "dropbear", - "index": "@i-1" - }, - "option": { - "name": "PasswordAuth" - } - } - } - ] - }, - "RootPasswordAuth": { - "type": "boolean", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "dropbear", - "section": { - "type": "dropbear", - "index": "@i-1" - }, - "option": { - "name": "RootPasswordAuth" - } - } - } - ] - }, - "Port": { - "type": "unsignedInt", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "dropbear", - "section": { - "type": "dropbear", - "index": "@i-1" - }, - "option": { - "name": "Port" - } - } - } - ] - }, - "RootLogin": { - "type": "boolean", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "dropbear", - "section": { - "type": "dropbear", - "index": "@i-1" - }, - "option": { - "name": "RootLogin" - } - } - } - ] - }, - "GatewayPorts": { - "type": "boolean", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "dropbear", - "section": { - "type": "dropbear", - "index": "@i-1" - }, - "option": { - "name": "GatewayPorts" - } - } - } - ] - }, - "Interface": { - "type": "string", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "dropbear", - "section": { - "type": "dropbear", - "index": "@i-1" - }, - "option": { - "name": "Interface" - } - } - } - ] - }, - "RSAKeyFile": { - "type": "string", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "dropbear", - "section": { - "type": "dropbear", - "index": "@i-1" - }, - "option": { - "name": "rsakeyfile" - } - } - } - ] - }, - "DSSKeyFile": { - "type": "string", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "dropbear", - "section": { - "type": "dropbear", - "index": "@i-1" - }, - "option": { - "name": "dsskeyfile" - } - } - } - ] - }, - "SSHKeepAlive": { - "type": "unsignedInt", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "dropbear", - "section": { - "type": "dropbear", - "index": "@i-1" - }, - "option": { - "name": "SSHKeepAlive" - } - } - } - ] - }, - "IdleTimeout": { - "type": "unsignedInt", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "dropbear", - "section": { - "type": "dropbear", - "index": "@i-1" - }, - "option": { - "name": "IdleTimeout" - } - } - } - ] - }, - "Verbose": { - "type": "boolean", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "dropbear", - "section": { - "type": "dropbear", - "index": "@i-1" - }, - "option": { - "name": "verbose" - } - } - } - ] - }, - "BannerFile": { - "type": "string", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "dropbear", - "section": { - "type": "dropbear", - "index": "@i-1" - }, - "option": { - "name": "BannerFile" - } - } - } - ] - } - } -} diff --git a/json/X_IOPSYS_EU_OWSD.json b/json/X_IOPSYS_EU_OWSD.json deleted file mode 100644 index ff198b98..00000000 --- a/json/X_IOPSYS_EU_OWSD.json +++ /dev/null @@ -1,417 +0,0 @@ -{ - "Device.X_IOPSYS_EU_OWSD.": { - "type": "object", - "protocols": [ - "cwmp", - "usp" - ], - "array": false, - "UnixSocket": { - "type": "string", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "owsd", - "section": { - "name": "global" - }, - "option": { - "name": "sock" - } - } - } - ] - }, - "URLRedirect": { - "type": "string", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "owsd", - "section": { - "name": "global" - }, - "option": { - "name": "redirect" - } - } - } - ] - }, - "Device.X_IOPSYS_EU_OWSD.UbusProxy.": { - "type": "object", - "protocols": [ - "cwmp", - "usp" - ], - "array": false, - "Enable": { - "type": "boolean", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "owsd", - "section": { - "name": "ubusproxy" - }, - "option": { - "name": "enable" - } - } - } - ] - - }, - "PeerCertificate": { - "type": "string", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "owsd", - "section": { - "name": "ubusproxy" - }, - "option": { - "name": "peer_cert" - } - } - } - ] - }, - "PeerKey": { - "type": "string", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "owsd", - "section": { - "name": "ubusproxy" - }, - "option": { - "name": "peer_key" - } - } - } - ] - }, - "PeerCA": { - "type": "string", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "owsd", - "section": { - "name": "ubusproxy" - }, - "option": { - "name": "peer_ca" - } - } - } - ] - } - }, - "Device.X_IOPSYS_EU_OWSD.VirtualHost.{i}.": { - "type": "object", - "protocols": [ - "cwmp", - "usp" - ], - "array": true, - "mapping": { - "type": "uci", - "uci": { - "file": "owsd", - "section": { - "type": "owsd-listen" - }, - "dmmapfile": "dmmap_owsd" - } - }, - "Alias": { - "type": "string", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "dmmap_owsd", - "section": { - "type": "owsd-listen", - "index": "@i-1" - }, - "option": { - "name": "olistenalias" - }, - "path":"/etc/bbfdm", - } - } - ] - }, - "Interface": { - "type": "string", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "owsd", - "section": { - "type": "owsd-listen", - "index": "@i-1" - }, - "option": { - "name": "interface" - }, - "ref": "Device.IP.Interface" - } - } - ] - }, - "Port": { - "type": "unsignedInt", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "owsd", - "section": { - "type": "owsd-listen", - "index": "@i-1" - }, - "option": { - "name": "port" - } - } - } - ] - }, - "IPv6Enable": { - "type": "boolean", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "owsd", - "section": { - "type": "owsd-listen", - "index": "@i-1" - }, - "option": { - "name": "ipv6" - } - } - } - ] - }, - "AllowInterfaceIPAddressAsOrigin": { - "type": "boolean", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "owsd", - "section": { - "type": "owsd-listen", - "index": "@i-1" - }, - "option": { - "name": "whitelist_interface_as_origin" - } - } - } - ] - }, - "AllowDHCPDomainsAsOrigin": { - "type": "boolean", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "owsd", - "section": { - "type": "owsd-listen", - "index": "@i-1" - }, - "option": { - "name": "whitelist_dhcp_domains" - } - } - } - ] - }, - "AllowedOrigins": { - "type": "string", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "owsd", - "section": { - "type": "owsd-listen", - "index": "@i-1" - }, - "option": { - "name": "origin" - } - } - } - ] - }, - "Certificate": { - "type": "string", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "owsd", - "section": { - "type": "owsd-listen", - "index": "@i-1" - }, - "option": { - "name": "cert" - } - } - } - ] - }, - "Key": { - "type": "string", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "owsd", - "section": { - "type": "owsd-listen", - "index": "@i-1" - }, - "option": { - "name": "key" - } - } - } - ] - }, - "CA": { - "type": "string", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "owsd", - "section": { - "type": "owsd-listen", - "index": "@i-1" - }, - "option": { - "name": "ca" - } - } - } - ] - } - } - } -} diff --git a/json/X_IOPSYS_EU_Syslog.json b/json/X_IOPSYS_EU_Syslog.json deleted file mode 100644 index fc71c867..00000000 --- a/json/X_IOPSYS_EU_Syslog.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "Device.X_IOPSYS_EU_Syslog.": { - "type": "object", - "protocols": [ - "cwmp", - "usp" - ], - "array": false, - "ServerIPAddress": { - "type": "string", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "system", - "section": { - "name": "@system[0]" - }, - "option": { - "name": "log_ip" - } - } - } - ] - }, - "ServerPort": { - "type": "unsignedInt", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "system", - "section": { - "name": "@system[0]" - }, - "option": { - "name": "log_port" - } - } - } - ] - }, - "ConsoleLogLevel": { - "type": "unsignedInt", - "protocols": [ - "cwmp", - "usp" - ], - "read": true, - "write": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "system", - "section": { - "name": "@system[0]" - }, - "option": { - "name": "conloglevel" - } - } - } - ] - } - } -} diff --git a/json/generate_excel.py b/json/generate_excel.py index 076b00d2..406faab2 100755 --- a/json/generate_excel.py +++ b/json/generate_excel.py @@ -134,7 +134,7 @@ def check_commands(param): def printOBJPARAM(obj, supported, protocols, types): fp = open('./.tmp', 'a') - print("%s::%s::%s::%s::" % (obj, protocols, "Yes" if CUSTOM_PREFIX in obj else supported, types), file=fp) + print("%s::%s::%s::%s::" % (obj, protocols, supported, types), file=fp) fp.close() def printusage(): @@ -253,7 +253,6 @@ except getopt.GetoptError: printusage() exit(1) -CUSTOM_PREFIX = "X_IOPSYS_EU" remotedm = None for opt, arg in opts: diff --git a/json/generate_source_code.py b/json/generate_source_code.py index 705fa962..3866caee 100755 --- a/json/generate_source_code.py +++ b/json/generate_source_code.py @@ -343,7 +343,7 @@ def printheaderObjCommon( objname ): def cprintheaderOBJS( objname ): fp = open('./.objparamarray.c', 'a') print("DMOBJ %s[] = {" % ("t" + getname(objname) + "Obj"), file=fp) - print("/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/", file=fp) + print("/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/", file=fp) fp.close() def hprintheaderOBJS( objname ): @@ -837,9 +837,9 @@ def printOBJline( dmobject, value ): fp = open('./.objparamarray.c', 'a') if uniquekeys: - print("{\"%s\", %s, %s, %s, NULL, %s, NULL, %s, %s, NULL, %s, %s}," % (getlastname(dmobject), access, faddobj, fdelobj, fbrowse, objchildarray, paramarray, bbfdm, uniquekeys), file=fp) + print("{\"%s\", %s, %s, %s, NULL, %s, NULL, NULL, %s, %s, NULL, %s, %s}," % (getlastname(dmobject), access, faddobj, fdelobj, fbrowse, objchildarray, paramarray, bbfdm, uniquekeys), file=fp) else: - print("{\"%s\", %s, %s, %s, NULL, %s, NULL, %s, %s, NULL, %s}," % (getlastname(dmobject), access, faddobj, fdelobj, fbrowse, objchildarray, paramarray, bbfdm), file=fp) + print("{\"%s\", %s, %s, %s, NULL, %s, NULL, NULL, %s, %s, NULL, %s}," % (getlastname(dmobject), access, faddobj, fdelobj, fbrowse, objchildarray, paramarray, bbfdm), file=fp) fp.close() def printusage(): diff --git a/json/tr181.json b/json/tr181.json index bab5c18e..6b18838c 100644 --- a/json/tr181.json +++ b/json/tr181.json @@ -42294,16 +42294,6 @@ } } ] - }, - "X_IOPSYS_EU_FirewallEnabled": { - "type": "boolean", - "read": true, - "write": true, - "protocols": [ - "cwmp", - "usp" - ], - "datatype": "boolean" } }, "Device.IP.Interface.{i}.Stats.": { @@ -65241,16 +65231,6 @@ ], "datatype": "boolean" }, - "X_IOPSYS_EU_Status": { - "type": "string", - "read": true, - "write": false, - "protocols": [ - "cwmp", - "usp" - ], - "datatype": "string" - }, "Device.UPnP.Device.Capabilities.": { "type": "object", "protocols": [ @@ -67716,152 +67696,7 @@ "usp" ], "datatype": "boolean" - }, - "X_IOPSYS_EU_ICMPType": { - "type": "string", - "read": true, - "write": true, - "protocols": [ - "cwmp", - "usp" - ], - "datatype": "string", - "mapping": [ - { - "type": "uci", - "uci": { - "file": "firewall", - "section": { - "type": "rule", - "index": "@i-1" - }, - "option": { - "name": "icmp_type" } - } - } - ] - }, - "X_IOPSYS_EU_SourceMACAddress": { - "type": "string", - "read": true, - "write": true, - "protocols": [ - "cwmp", - "usp" - ], - "datatype": "string", - "mapping": [ - { - "type": "uci", - "uci": { - "file": "firewall", - "section": { - "type": "rule", - "index": "@i-1" - }, - "option": { - "name": "src_mac" - } - } - } - ] - }, - "Device.Firewall.Chain.{i}.Rule.{i}.X_IOPSYS_EU_TimeSpan.": { - "type": "object", - "protocols": [ - "cwmp", - "usp" - ], - "access": false, - "array": false, - "SupportedDays": { - "type": "string", - "read": true, - "write": true, - "protocols": [ - "cwmp", - "usp" - ], - "datatype": "string" - }, - "Days": { - "type": "string", - "read": true, - "write": true, - "protocols": [ - "cwmp", - "usp" - ], - "datatype": "string", - "mapping": [ - { - "type": "uci", - "uci": { - "file": "firewall", - "section": { - "type": "rule", - "index": "@i-1" - }, - "option": { - "name": "weekdays" - } - } - } - ] - }, - "StartTime": { - "type": "string", - "read": true, - "write": true, - "protocols": [ - "cwmp", - "usp" - ], - "datatype": "string", - "mapping": [ - { - "type": "uci", - "uci": { - "file": "firewall", - "section": { - "type": "rule", - "index": "@i-1" - }, - "option": { - "name": "start_time" - } - } - } - ] - }, - "StopTime": { - "type": "string", - "read": true, - "write": true, - "protocols": [ - "cwmp", - "usp" - ], - "datatype": "string", - "mapping": [ - { - "type": "uci", - "uci": { - "file": "firewall", - "section": { - "type": "rule", - "index": "@i-1" - }, - "option": { - "name": "stop_time" - } - } - } - ] - } - } - } } }, diff --git a/libbbf_api/dmbbf.c b/libbbf_api/dmbbf.c index 52a615cd..ac0bf4d5 100644 --- a/libbbf_api/dmbbf.c +++ b/libbbf_api/dmbbf.c @@ -189,7 +189,7 @@ static int plugin_dynamic_obj_match(struct dmctx *dmctx, struct dmnode *node, ch static int bbfdatamodel_matches(const enum bbfdm_type_enum type) { - return bbfdatamodel_type == BBFDM_BOTH || type == BBFDM_BOTH || bbfdatamodel_type == type; + return (bbfdatamodel_type == BBFDM_BOTH || type == BBFDM_BOTH || bbfdatamodel_type == type) && type != BBFDM_NONE; } static bool check_dependency(const char *conf_obj) @@ -225,16 +225,34 @@ static bool check_dependency(const char *conf_obj) static int dm_browse_leaf(struct dmctx *dmctx, DMNODE *parent_node, DMLEAF *leaf, void *data, char *instance) { int err = 0; - if (!leaf) - return 0; - - for (; leaf->parameter; leaf++) { + for (; (leaf && leaf->parameter); leaf++) { if (!bbfdatamodel_matches(leaf->bbfdm_type)) continue; err = dmctx->method_param(dmctx, parent_node, leaf->parameter, leaf->permission, leaf->type, leaf->getvalue, leaf->setvalue, data, instance); if (dmctx->stop) return err; } + + if (parent_node->obj) { + if (parent_node->obj->dynamicleaf) { + for (int i = 0; i < __INDX_DYNAMIC_MAX; i++) { + struct dm_dynamic_leaf *next_dyn_array = parent_node->obj->dynamicleaf + i; + if (next_dyn_array->nextleaf) { + for (int j = 0; next_dyn_array->nextleaf[j]; j++) { + DMLEAF *jleaf = next_dyn_array->nextleaf[j]; + for (; (jleaf && jleaf->parameter); jleaf++) { + if (!bbfdatamodel_matches(jleaf->bbfdm_type)) + continue; + err = dmctx->method_param(dmctx, parent_node, jleaf->parameter, jleaf->permission, jleaf->type, jleaf->getvalue, jleaf->setvalue, data, instance); + if (dmctx->stop) + return err; + } + } + } + } + } + } + return err; } @@ -276,7 +294,7 @@ static void dm_browse_entry(struct dmctx *dmctx, DMNODE *parent_node, DMOBJ *ent return; } - if (entryobj->leaf) { + if (entryobj->leaf || entryobj->dynamicleaf) { if (dmctx->checkleaf) { *err = dmctx->checkleaf(dmctx, &node, entryobj->permission, entryobj->addobj, entryobj->delobj, entryobj->get_linker, data, instance); if (!*err) { @@ -300,12 +318,10 @@ static int dm_browse(struct dmctx *dmctx, DMNODE *parent_node, DMOBJ *entryobj, char *parent_obj = parent_node->current_object; int err = 0; - if (entryobj) { - for (; entryobj->obj; entryobj++) { - dm_browse_entry(dmctx, parent_node, entryobj, data, instance, parent_obj, &err); - if (dmctx->stop) - return err; - } + for (; (entryobj && entryobj->obj); entryobj++) { + dm_browse_entry(dmctx, parent_node, entryobj, data, instance, parent_obj, &err); + if (dmctx->stop) + return err; } if (parent_node->obj) { @@ -370,7 +386,7 @@ int dm_link_inst_obj(struct dmctx *dmctx, DMNODE *parent_node, void *data, char return err; } } - if (nextobj) { + if (nextobj || prevobj->nextdynamicobj) { err = dm_browse(dmctx, &node, nextobj, data, instance); if (dmctx->stop) return err; @@ -378,19 +394,43 @@ int dm_link_inst_obj(struct dmctx *dmctx, DMNODE *parent_node, void *data, char return err; } -void dm_check_dynamic_obj(struct dmctx *dmctx, DMNODE *parent_node, DMOBJ *entryobj, char *full_obj, char *obj, DMOBJ **root_entry, int *obj_found) +void dm_exclude_obj(struct dmctx *dmctx, DMNODE *parent_node, DMOBJ *entryobj, char *data) { - if (!entryobj) - return; - char *parent_obj = parent_node->current_object; - for (; entryobj->obj; entryobj++) { + for (; (entryobj && entryobj->obj); entryobj++) { DMNODE node = {0}; node.obj = entryobj; node.parent = parent_node; node.instance_level = parent_node->instance_level; node.matched = parent_node->matched; + + dmasprintf(&(node.current_object), "%s%s.", parent_obj, entryobj->obj); + if (strcmp(node.current_object, data) == 0) { + entryobj->bbfdm_type = BBFDM_NONE; + return; + } + + int err = plugin_dynamic_obj_match(dmctx, &node, entryobj->obj, data); + if (err) + continue; + + if (entryobj->nextobj) + dm_exclude_obj(dmctx, &node, entryobj->nextobj, data); + } +} + +void dm_check_dynamic_obj(struct dmctx *dmctx, DMNODE *parent_node, DMOBJ *entryobj, char *full_obj, char *obj, DMOBJ **root_entry, int *obj_found) +{ + char *parent_obj = parent_node->current_object; + + for (; (entryobj && entryobj->obj); entryobj++) { + DMNODE node = {0}; + node.obj = entryobj; + node.parent = parent_node; + node.instance_level = parent_node->instance_level; + node.matched = parent_node->matched; + dmasprintf(&(node.current_object), "%s%s.", parent_obj, entryobj->obj); if (strcmp(node.current_object, obj) == 0) { *root_entry = entryobj; @@ -407,20 +447,57 @@ void dm_check_dynamic_obj(struct dmctx *dmctx, DMNODE *parent_node, DMOBJ *entry } } -int free_dm_browse_node_dynamic_object_tree(DMNODE *parent_node, DMOBJ *entryobj) +bool find_root_entry(struct dmctx *ctx, char *in_param, DMOBJ **root_entry) { - if (!entryobj) - return 0; + int obj_found = 0; + DMOBJ *root = ctx->dm_entryobj; + DMNODE node = {.current_object = ""}; + + char *obj_path = replace_str(in_param, ".{i}.", "."); + dm_check_dynamic_obj(ctx, &node, root, obj_path, obj_path, root_entry, &obj_found); + dmfree(obj_path); + + return (obj_found && *root_entry) ? true : false; +} + +int get_obj_idx_dynamic_array(DMOBJ **entryobj) +{ + int i, idx = 0; + for (i = 0; entryobj[i]; i++) { + idx++; + } + return idx; +} + +int get_leaf_idx_dynamic_array(DMLEAF **entryleaf) +{ + int i, idx = 0; + for (i = 0; entryleaf[i]; i++) { + idx++; + } + return idx; +} + +void free_dm_browse_node_dynamic_object_tree(DMNODE *parent_node, DMOBJ *entryobj) +{ + for (; (entryobj && entryobj->obj); entryobj++) { - for (; entryobj->obj; entryobj++) { if (entryobj->nextdynamicobj) { for (int i = 0; i < __INDX_DYNAMIC_MAX; i++) { struct dm_dynamic_obj *next_dyn_array = entryobj->nextdynamicobj + i; - if (next_dyn_array->nextobj) FREE(next_dyn_array->nextobj); + FREE(next_dyn_array->nextobj); } FREE(entryobj->nextdynamicobj); } + if (entryobj->dynamicleaf) { + for (int i = 0; i < __INDX_DYNAMIC_MAX; i++) { + struct dm_dynamic_leaf *next_dyn_array = entryobj->dynamicleaf + i; + FREE(next_dyn_array->nextleaf); + } + FREE(entryobj->dynamicleaf); + } + DMNODE node = {0}; node.obj = entryobj; node.parent = parent_node; @@ -430,7 +507,6 @@ int free_dm_browse_node_dynamic_object_tree(DMNODE *parent_node, DMOBJ *entryobj if (entryobj->nextobj) free_dm_browse_node_dynamic_object_tree(&node, entryobj->nextobj); } - return 0; } static int rootcmp(char *inparam, char *rootobj) diff --git a/libbbf_api/dmbbf.h b/libbbf_api/dmbbf.h index c8ddb349..70f675f1 100644 --- a/libbbf_api/dmbbf.h +++ b/libbbf_api/dmbbf.h @@ -75,7 +75,12 @@ struct dmctx; struct dm_dynamic_obj { struct dm_obj_s **nextobj; - int isstatic; + int idx_type; +}; + +struct dm_dynamic_leaf { + struct dm_leaf_s **nextleaf; + int idx_type; }; struct dm_permession_s { @@ -99,7 +104,7 @@ typedef struct dm_leaf_s { } DMLEAF; typedef struct dm_obj_s { - /* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys(12)*/ + /* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys(13)*/ char *obj; struct dm_permession_s *permission; int (*addobj)(char *refparam, struct dmctx *ctx, void *data, char **instance); @@ -107,6 +112,7 @@ typedef struct dm_obj_s { char *checkdep; int (*browseinstobj)(struct dmctx *dmctx, struct dmnode *node, void *data, char *instance); struct dm_dynamic_obj *nextdynamicobj; + struct dm_dynamic_leaf *dynamicleaf; struct dm_obj_s *nextobj; struct dm_leaf_s *leaf; int (*get_linker)(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker); @@ -194,10 +200,21 @@ struct notification { char *type; }; -typedef struct lib_map_obj { +typedef struct dm_map_obj { char *path; struct dm_obj_s *root_obj; -} LIB_MAP_OBJ; + struct dm_leaf_s *root_leaf; +} DM_MAP_OBJ; + +typedef struct dm_map_vendor { + char *vendor; + struct dm_map_obj *vendor_obj; +} DM_MAP_VENDOR; + +typedef struct dm_map_vendor_exclude { + char *vendor; + char **vendor_obj; +} DM_MAP_VENDOR_EXCLUDE; enum operate_ret_status{ UBUS_INVALID_ARGUMENTS, @@ -216,11 +233,11 @@ typedef enum operate_ret_status opr_ret_t; typedef opr_ret_t (*operation) (struct dmctx *dmctx, char *p, json_object *input); -typedef struct lib_map_operate { +typedef struct dm_map_operate { char *path; operation operate; char *type; // sync or async -} LIB_MAP_OPERATE; +} DM_MAP_OPERATE; enum set_value_action { VALUECHECK, @@ -381,11 +398,13 @@ enum bbfdm_type_enum { BBFDM_BOTH, BBFDM_CWMP, BBFDM_USP, + BBFDM_NONE }; enum { - INDX_JSON_OBJ_MOUNT, - INDX_LIBRARY_OBJ_MOUNT, + INDX_JSON_MOUNT, + INDX_LIBRARY_MOUNT, + INDX_VENDOR_MOUNT, __INDX_DYNAMIC_MAX }; @@ -431,8 +450,12 @@ char *get_last_instance_lev2_bbfdm_dmmap_opt(char* dmmap_package, char *section, char *get_last_instance_lev2_bbfdm(char *package, char *section, char* dmmap_package, char *opt_inst, char *opt_check, char *value_check); char *handle_update_instance(int instance_ranck, struct dmctx *ctx, char **max_inst, char * (*up_instance)(int action, char **last_inst, char **max_inst, void *argv[]), int argc, ...); int dm_link_inst_obj(struct dmctx *dmctx, DMNODE *parent_node, void *data, char *instance); +void dm_exclude_obj(struct dmctx *dmctx, DMNODE *parent_node, DMOBJ *entryobj, char *data); void dm_check_dynamic_obj(struct dmctx *dmctx, DMNODE *parent_node, DMOBJ *entryobj, char *full_obj, char *obj, DMOBJ **root_entry, int *obj_found); -int free_dm_browse_node_dynamic_object_tree(DMNODE *parent_node, DMOBJ *entryobj); +bool find_root_entry(struct dmctx *ctx, char *in_param, DMOBJ **root_entry); +int get_obj_idx_dynamic_array(DMOBJ **entryobj); +int get_leaf_idx_dynamic_array(DMLEAF **entryleaf); +void free_dm_browse_node_dynamic_object_tree(DMNODE *parent_node, DMOBJ *entryobj); char *check_parameter_forced_notification(const char *parameter); static inline int DM_LINK_INST_OBJ(struct dmctx *dmctx, DMNODE *parent_node, void *data, char *instance) diff --git a/libbbf_api/dmcommon.c b/libbbf_api/dmcommon.c index dd42cadb..5b6c0518 100644 --- a/libbbf_api/dmcommon.c +++ b/libbbf_api/dmcommon.c @@ -853,9 +853,9 @@ char *get_device_from_wifi_iface(const char *wifi_iface, const char *wifi_sectio json_object *j_e = jarr->array[i]; const char *sect; - sect = __dmjson_get_string(j_e, "section"); + sect = dmjson_get_value(j_e, 1, "section"); if (!strcmp(sect, wifi_section)) { - ifname = __dmjson_get_string(j_e, "ifname"); + ifname = dmjson_get_value(j_e, 2, "config", "ifname"); break; } } diff --git a/libbbf_api/dmcommon.h b/libbbf_api/dmcommon.h index 341409de..54476918 100644 --- a/libbbf_api/dmcommon.h +++ b/libbbf_api/dmcommon.h @@ -240,6 +240,8 @@ void get_dmmap_section_of_config_section(char* dmmap_package, char* section_type void get_dmmap_section_of_config_section_eq(char* dmmap_package, char* section_type, char *opt, char* value, struct uci_section **dmmap_section); void get_dmmap_section_of_config_section_cont(char* dmmap_package, char* section_type, char *opt, char* value, struct uci_section **dmmap_section); void get_config_section_of_dmmap_section(char* package, char* section_type, char *section_name, struct uci_section **config_section); +int adm_entry_get_linker_param(struct dmctx *ctx, char *param, char *linker, char **value); +int adm_entry_get_linker_value(struct dmctx *ctx, char *param, char **value); char *check_create_dmmap_package(const char *dmmap_package); int is_section_unnamed(char *section_name); void delete_sections_save_next_sections(char* dmmap_package, char *section_type, char *instancename, char *section_name, int instance, struct list_head *dup_list); diff --git a/libbbf_api/dmjson.c b/libbbf_api/dmjson.c index ae23805f..99677bb6 100644 --- a/libbbf_api/dmjson.c +++ b/libbbf_api/dmjson.c @@ -82,19 +82,6 @@ json_object *bbf_api_dmjson_select_obj(json_object *jobj, char *argv[]) return jobj; } -const char * __dmjson_get_string(json_object *jobj, const char *name) -{ - const char *str = ""; - - json_object_object_get_ex(jobj, name, &jobj); - if (jobj) { - str = json_object_get_string(jobj); - if (str == NULL) - str = ""; - } - return str; -} - json_object *____dmjson_select_obj_in_array_idx(json_object *mainjobj, json_object **arrobj, int index, char *argv[]) { json_object *jobj = NULL; diff --git a/libbbf_api/dmjson.h b/libbbf_api/dmjson.h index a7252fb0..295751db 100644 --- a/libbbf_api/dmjson.h +++ b/libbbf_api/dmjson.h @@ -33,7 +33,6 @@ char *____dmjson_get_value_in_obj(json_object *mainjobj, char *argv[]); char *__dmjson_get_value_in_obj(json_object *mainjobj, int argc, ...); char *__dmjson_get_value_in_array_idx(json_object *mainjobj, json_object **arrobj, char *defret, int index, int argc, ...); json_object *__dmjson_select_obj_in_array_idx(json_object *mainjobj, json_object **arrobj, int index, int argc, ...); -const char * __dmjson_get_string(json_object *jobj, const char *name); char *____dmjson_get_value_array_all(json_object *mainjobj, char *delim, char *argv[]); char *__dmjson_get_value_array_all(json_object *mainjobj, char *delim, int argc, ...); diff --git a/openwrt/bbf/Config_bbfdm.in b/openwrt/bbf/Config_bbfdm.in index 97315926..fdade713 100644 --- a/openwrt/bbf/Config_bbfdm.in +++ b/openwrt/bbf/Config_bbfdm.in @@ -1,19 +1,27 @@ if PACKAGE_libbbfdm -config LIBBBFDM_VENDOR_PREFIX - string "Vendor Prefix" - default "X_IOPSYS_EU_" +config BBF_VENDOR_EXTENSION + bool "Enable Vendor Extension" + default y + +config BBF_VENDOR_LIST + string "Vendor List" + default "openwrt" + +config BBF_VENDOR_PREFIX + string "Vendor Prefix" + default "X_IOPSYS_EU_" config BBF_TR181 - bool "Compile with tr181 device features" + bool "Enable TR-181 Data Model Support" default y config BBF_TR104 - bool "Compile with tr104 voice features" + bool "Enable TR-104 Data Model Support" default y config BBF_TR143 - bool "Compile with tr143 diagnostics features" + bool "Enable TR-143 Data Model Support" default y endif diff --git a/openwrt/bbf/Makefile b/openwrt/bbf/Makefile index 88e3210d..2829b875 100644 --- a/openwrt/bbf/Makefile +++ b/openwrt/bbf/Makefile @@ -40,11 +40,10 @@ define Package/libbbfdm/description endef TARGET_CFLAGS += \ - -DCUSTOM_PREFIX=\\\"$(CONFIG_LIBBBFDM_VENDOR_PREFIX)\\\" \ + -DBBF_VENDOR_LIST=\\\"$(CONFIG_BBF_VENDOR_LIST)\\\" \ + -DBBF_VENDOR_PREFIX=\\\"$(CONFIG_BBF_VENDOR_PREFIX)\\\" \ -D_GNU_SOURCE -D_AADJ -CONFIGURE_ARGS += --enable-generic-openwrt - ifeq ($(CONFIG_BBF_TR181),y) CONFIGURE_ARGS += \ --enable-tr181 @@ -60,13 +59,22 @@ CONFIGURE_ARGS += \ --enable-tr143 endif +ifeq ($(CONFIG_BBF_VENDOR_EXTENSION),y) +CONFIGURE_ARGS += \ + --enable-vendor-extension + +CONFIGURE_ARGS += \ + BBF_VENDOR_LIST="$(CONFIG_BBF_VENDOR_LIST)" + +endif ##CONFIG_BBF_VENDOR_EXTENSION + define Package/libbbfdm/install $(INSTALL_DIR) $(1)/lib $(CP) $(PKG_BUILD_DIR)/bin/.libs/libbbfdm.so* $(1)/lib/ $(CP) $(PKG_BUILD_DIR)/bin/.libs/libbbf_api.so* $(1)/lib/ $(INSTALL_DIR) $(1)/etc/bbfdm $(INSTALL_DIR) $(1)/usr/share/bbfdm - $(CP) $(PKG_BUILD_DIR)/scripts/functions $(1)/usr/share/bbfdm + $(CP) $(PKG_BUILD_DIR)/scripts $(1)/usr/share/bbfdm endef define Build/InstallDev diff --git a/scripts/functions/download_launch b/scripts/download_launch similarity index 100% rename from scripts/functions/download_launch rename to scripts/download_launch diff --git a/scripts/functions/ipping_launch b/scripts/ipping_launch similarity index 100% rename from scripts/functions/ipping_launch rename to scripts/ipping_launch diff --git a/scripts/functions/nslookup_launch b/scripts/nslookup_launch similarity index 100% rename from scripts/functions/nslookup_launch rename to scripts/nslookup_launch diff --git a/scripts/functions/serverselection_launch b/scripts/serverselection_launch similarity index 100% rename from scripts/functions/serverselection_launch rename to scripts/serverselection_launch diff --git a/scripts/functions/traceroute_launch b/scripts/traceroute_launch similarity index 100% rename from scripts/functions/traceroute_launch rename to scripts/traceroute_launch diff --git a/scripts/functions/udpecho_launch b/scripts/udpecho_launch similarity index 100% rename from scripts/functions/udpecho_launch rename to scripts/udpecho_launch diff --git a/scripts/functions/upload_launch b/scripts/upload_launch similarity index 100% rename from scripts/functions/upload_launch rename to scripts/upload_launch diff --git a/tools/generate_xml.sh b/tools/generate_xml.sh index 9cad769e..23f6b9fc 100755 --- a/tools/generate_xml.sh +++ b/tools/generate_xml.sh @@ -188,7 +188,7 @@ gen_dm_tree(){ fi fi dyn_obj=0 - done <<<"`sed -n $line_number',/{0}/p' $file | cut -d \" \" -f 1-4,6- | sed '/#ifdef GENERIC_OPENWRT/,/#else/d' | sed -e '/{0}/d' | sed -e '/^{/!d'`" + done <<<"`sed -n $line_number',/{0}/p' $file | cut -d \" \" -f 1-4,6- | sed -e '/{0}/d' | sed -e '/^{/!d'`" ######### Remove object from list of object looking there childs for obj in $obj_look_obj_child_list; do diff --git a/tools/generate_xml_bbf.sh b/tools/generate_xml_bbf.sh index e28fb8c4..956f9ebe 100755 --- a/tools/generate_xml_bbf.sh +++ b/tools/generate_xml_bbf.sh @@ -242,7 +242,7 @@ gen_dm_tree(){ fi fi dyn_obj=0 - done <<<"`sed -n $line_number',/{0}/p' $file | cut -d \" \" -f 1-4,6- | sed '/#ifdef GENERIC_OPENWRT/,/#else/d' | sed -e '/{0}/d' | sed -e '/^{/!d'`" + done <<<"`sed -n $line_number',/{0}/p' $file | cut -d \" \" -f 1-4,6- | sed -e '/{0}/d' | sed -e '/^{/!d'`" ######### Remove object from list of object looking there childs for obj in $obj_look_obj_child_list; do