From b8bc5c3423df4e81b48de5d2910b8c22b3e69c40 Mon Sep 17 00:00:00 2001 From: Amin Ben Romdhane Date: Mon, 27 Mar 2023 14:14:08 +0200 Subject: [PATCH] Create a new libraries 'libbbf_api' && 'libbbf_dm' --- CMakeLists.txt | 148 +----------------- README.md | 4 +- dmbbfcommon.c | 80 ---------- dmbbfcommon.h | 27 ---- docs/guide/dynamic_dm.md | 4 +- docs/guide/obj_param_extension.md | 2 +- docs/guide/tools.md | 8 +- docs/guide/vendor.md | 8 +- gitlab-ci/iopsys-supervisord.conf | 6 - gitlab-ci/setup.sh | 2 +- gitlab-ci/tools-test.sh | 4 +- libbbf_api/CMakeLists.txt | 52 ++++++ .../dm_plugin/dmdynamicjson.c | 1 - .../dm_plugin/dmdynamicjson.h | 2 +- .../dm_plugin/dmdynamiclibrary.c | 0 .../dm_plugin/dmdynamiclibrary.h | 2 +- .../dm_plugin/dmdynamicvendor.c | 13 +- .../dm_plugin/dmdynamicvendor.h | 2 +- libbbf_api/dmapi.h | 22 +-- dmentry.c => libbbf_api/dmentry.c | 79 +++++----- dmentry.h => libbbf_api/dmentry.h | 11 +- {include => libbbf_api/include}/libbbf_api.h | 0 libbbf_dm/CMakeLists.txt | 111 +++++++++++++ dmdiagnostics.c => libbbf_dm/dmdiagnostics.c | 1 - dmdiagnostics.h => libbbf_dm/dmdiagnostics.h | 0 {dmtree => libbbf_dm/dmtree}/json/tr104.json | 0 {dmtree => libbbf_dm/dmtree}/json/tr181.json | 0 {dmtree => libbbf_dm/dmtree}/tr104/common.c | 0 {dmtree => libbbf_dm/dmtree}/tr104/common.h | 0 .../dmtree}/tr104/servicesvoiceservice.c | 0 .../dmtree}/tr104/servicesvoiceservice.h | 0 .../tr104/servicesvoiceservicecallcontrol.c | 0 .../tr104/servicesvoiceservicecallcontrol.h | 0 .../tr104/servicesvoiceservicecalllog.c | 0 .../tr104/servicesvoiceservicecalllog.h | 0 .../tr104/servicesvoiceservicecapabilities.c | 0 .../tr104/servicesvoiceservicecapabilities.h | 0 .../tr104/servicesvoiceservicecodecprofile.c | 0 .../tr104/servicesvoiceservicecodecprofile.h | 0 .../dmtree}/tr104/servicesvoiceservicedect.c | 0 .../dmtree}/tr104/servicesvoiceservicedect.h | 0 .../dmtree}/tr104/servicesvoiceservicepots.c | 0 .../dmtree}/tr104/servicesvoiceservicepots.h | 0 .../tr104/servicesvoiceservicereservedports.c | 0 .../tr104/servicesvoiceservicereservedports.h | 0 .../dmtree}/tr104/servicesvoiceservicesip.c | 0 .../dmtree}/tr104/servicesvoiceservicesip.h | 0 .../tr104/servicesvoiceservicevoipprofile.c | 0 .../tr104/servicesvoiceservicevoipprofile.h | 0 .../dmtree}/tr143/diagnostics.c | 1 - .../dmtree}/tr143/diagnostics.h | 0 {dmtree => libbbf_dm/dmtree}/tr181/atm.c | 0 {dmtree => libbbf_dm/dmtree}/tr181/atm.h | 0 {dmtree => libbbf_dm/dmtree}/tr181/bridging.c | 0 {dmtree => libbbf_dm/dmtree}/tr181/bridging.h | 0 {dmtree => libbbf_dm/dmtree}/tr181/device.c | 0 {dmtree => libbbf_dm/dmtree}/tr181/device.h | 0 .../dmtree}/tr181/deviceinfo.c | 0 .../dmtree}/tr181/deviceinfo.h | 0 {dmtree => libbbf_dm/dmtree}/tr181/dhcpv4.c | 0 {dmtree => libbbf_dm/dmtree}/tr181/dhcpv4.h | 0 {dmtree => libbbf_dm/dmtree}/tr181/dhcpv6.c | 0 {dmtree => libbbf_dm/dmtree}/tr181/dhcpv6.h | 0 {dmtree => libbbf_dm/dmtree}/tr181/dns.c | 1 - {dmtree => libbbf_dm/dmtree}/tr181/dns.h | 0 {dmtree => libbbf_dm/dmtree}/tr181/dsl.c | 0 {dmtree => libbbf_dm/dmtree}/tr181/dsl.h | 0 .../dmtree}/tr181/dynamicdns.c | 0 .../dmtree}/tr181/dynamicdns.h | 0 {dmtree => libbbf_dm/dmtree}/tr181/ethernet.c | 0 {dmtree => libbbf_dm/dmtree}/tr181/ethernet.h | 0 {dmtree => libbbf_dm/dmtree}/tr181/fast.c | 0 {dmtree => libbbf_dm/dmtree}/tr181/fast.h | 0 {dmtree => libbbf_dm/dmtree}/tr181/firewall.c | 0 {dmtree => libbbf_dm/dmtree}/tr181/firewall.h | 0 .../dmtree}/tr181/gatewayinfo.c | 1 - .../dmtree}/tr181/gatewayinfo.h | 0 {dmtree => libbbf_dm/dmtree}/tr181/gre.c | 0 {dmtree => libbbf_dm/dmtree}/tr181/gre.h | 0 {dmtree => libbbf_dm/dmtree}/tr181/hosts.c | 0 {dmtree => libbbf_dm/dmtree}/tr181/hosts.h | 0 {dmtree => libbbf_dm/dmtree}/tr181/ieee1905.c | 0 {dmtree => libbbf_dm/dmtree}/tr181/ieee1905.h | 0 .../dmtree}/tr181/interfacestack.c | 0 .../dmtree}/tr181/interfacestack.h | 0 {dmtree => libbbf_dm/dmtree}/tr181/ip.c | 0 {dmtree => libbbf_dm/dmtree}/tr181/ip.h | 0 .../dmtree}/tr181/lanconfigsecurity.c | 0 .../dmtree}/tr181/lanconfigsecurity.h | 0 {dmtree => libbbf_dm/dmtree}/tr181/mqtt.c | 55 ++++--- {dmtree => libbbf_dm/dmtree}/tr181/mqtt.h | 0 {dmtree => libbbf_dm/dmtree}/tr181/nat.c | 0 {dmtree => libbbf_dm/dmtree}/tr181/nat.h | 0 {dmtree => libbbf_dm/dmtree}/tr181/ppp.c | 0 {dmtree => libbbf_dm/dmtree}/tr181/ppp.h | 0 {dmtree => libbbf_dm/dmtree}/tr181/ptm.c | 0 {dmtree => libbbf_dm/dmtree}/tr181/ptm.h | 0 {dmtree => libbbf_dm/dmtree}/tr181/qos.c | 0 {dmtree => libbbf_dm/dmtree}/tr181/qos.h | 0 .../dmtree}/tr181/routeradvertisement.c | 0 .../dmtree}/tr181/routeradvertisement.h | 0 {dmtree => libbbf_dm/dmtree}/tr181/routing.c | 0 {dmtree => libbbf_dm/dmtree}/tr181/routing.h | 0 {dmtree => libbbf_dm/dmtree}/tr181/security.c | 0 {dmtree => libbbf_dm/dmtree}/tr181/security.h | 0 {dmtree => libbbf_dm/dmtree}/tr181/ssh.c | 1 - {dmtree => libbbf_dm/dmtree}/tr181/ssh.h | 0 {dmtree => libbbf_dm/dmtree}/tr181/times.c | 0 {dmtree => libbbf_dm/dmtree}/tr181/times.h | 0 {dmtree => libbbf_dm/dmtree}/tr181/upnp.c | 0 {dmtree => libbbf_dm/dmtree}/tr181/upnp.h | 0 {dmtree => libbbf_dm/dmtree}/tr181/usb.c | 0 {dmtree => libbbf_dm/dmtree}/tr181/usb.h | 0 .../dmtree}/tr181/userinterface.c | 0 .../dmtree}/tr181/userinterface.h | 0 {dmtree => libbbf_dm/dmtree}/tr181/wifi.c | 1 - {dmtree => libbbf_dm/dmtree}/tr181/wifi.h | 0 .../dmtree}/tr471/iplayercap.c | 1 - .../dmtree}/tr471/iplayercap.h | 0 .../tr104/servicesvoiceservicecallcontrol.c | 0 .../tr104/servicesvoiceservicecallcontrol.h | 0 .../tr104/servicesvoiceservicecalllog.c | 0 .../tr104/servicesvoiceservicecalllog.h | 0 .../iopsys/tr104/servicesvoiceservicedect.c | 0 .../iopsys/tr104/servicesvoiceservicedect.h | 0 .../dmtree}/vendor/iopsys/tr181/bridging.c | 0 .../dmtree}/vendor/iopsys/tr181/bridging.h | 0 .../dmtree}/vendor/iopsys/tr181/device.c | 0 .../dmtree}/vendor/iopsys/tr181/device.h | 0 .../dmtree}/vendor/iopsys/tr181/deviceinfo.c | 0 .../dmtree}/vendor/iopsys/tr181/deviceinfo.h | 0 .../dmtree}/vendor/iopsys/tr181/ethernet.c | 0 .../dmtree}/vendor/iopsys/tr181/ethernet.h | 0 .../dmtree}/vendor/iopsys/tr181/times.c | 0 .../dmtree}/vendor/iopsys/tr181/times.h | 0 .../dmtree}/vendor/iopsys/tr181/vendor.c | 0 .../dmtree}/vendor/iopsys/tr181/vendor.h | 0 .../dmtree}/vendor/iopsys/tr181/wifi.c | 0 .../dmtree}/vendor/iopsys/tr181/wifi.h | 0 .../vendor/iopsys/tr181/x_iopsys_eu_igmp.c | 0 .../vendor/iopsys/tr181/x_iopsys_eu_igmp.h | 0 .../vendor/iopsys/tr181/x_iopsys_eu_mld.c | 0 .../vendor/iopsys/tr181/x_iopsys_eu_mld.h | 0 .../dmtree}/vendor/iopsys/vendor.json | 0 .../dmtree}/vendor/openwrt/tr181/deviceinfo.c | 0 .../dmtree}/vendor/openwrt/tr181/deviceinfo.h | 0 .../dmtree}/vendor/openwrt/tr181/qos.c | 0 .../dmtree}/vendor/openwrt/tr181/qos.h | 0 .../dmtree}/vendor/openwrt/tr181/vendor.c | 0 .../dmtree}/vendor/openwrt/tr181/vendor.h | 0 .../dmtree}/vendor/test/tr181/device.c | 0 .../dmtree}/vendor/test/tr181/device.h | 0 .../dmtree}/vendor/test/tr181/deviceinfo.c | 0 .../dmtree}/vendor/test/tr181/deviceinfo.h | 0 .../dmtree}/vendor/test/tr181/firewall.c | 0 .../dmtree}/vendor/test/tr181/firewall.h | 0 .../dmtree}/vendor/test/tr181/vendor.c | 0 .../dmtree}/vendor/test/tr181/vendor.h | 0 .../vendor/test/tr181/x_test_com_dropbear.c | 0 .../vendor/test/tr181/x_test_com_dropbear.h | 0 {dmtree => libbbf_dm/dmtree}/vendor/vendor.c | 0 {dmtree => libbbf_dm/dmtree}/vendor/vendor.h | 0 {scripts => libbbf_dm/scripts}/bbf.diag | 0 .../scripts}/bbf_activate_handler.sh | 0 {scripts => libbbf_dm/scripts}/bbf_api | 0 .../scripts}/bbf_check_idle.sh | 0 {scripts => libbbf_dm/scripts}/download | 0 {scripts => libbbf_dm/scripts}/iplayercap | 0 {scripts => libbbf_dm/scripts}/ipping | 0 {scripts => libbbf_dm/scripts}/nslookup | 0 .../scripts}/serverselection | 0 {scripts => libbbf_dm/scripts}/traceroute | 0 {scripts => libbbf_dm/scripts}/udpecho | 0 {scripts => libbbf_dm/scripts}/upload | 0 test/bbf_test/Makefile | 2 +- test/bbf_test/bbf_dm.c | 16 +- test/cmocka/Makefile | 2 +- test/cmocka/functional_test_bbfd.c | 19 ++- test/cmocka/unit_test_bbfd.c | 25 ++- test/dynamicdm_ubus_test/Makefile | 16 -- tools/bbf_common.py | 2 +- tools/convert_dm_xml_to_json.py | 8 +- tools/tools_input.json | 6 +- 183 files changed, 325 insertions(+), 421 deletions(-) delete mode 100644 dmbbfcommon.c delete mode 100644 dmbbfcommon.h create mode 100644 libbbf_api/CMakeLists.txt rename dmdynamicjson.c => libbbf_api/dm_plugin/dmdynamicjson.c (99%) rename dmdynamicjson.h => libbbf_api/dm_plugin/dmdynamicjson.h (94%) rename dmdynamiclibrary.c => libbbf_api/dm_plugin/dmdynamiclibrary.c (100%) rename dmdynamiclibrary.h => libbbf_api/dm_plugin/dmdynamiclibrary.h (94%) rename dmdynamicvendor.c => libbbf_api/dm_plugin/dmdynamicvendor.c (95%) rename dmdynamicvendor.h => libbbf_api/dm_plugin/dmdynamicvendor.h (94%) rename dmentry.c => libbbf_api/dmentry.c (85%) rename dmentry.h => libbbf_api/dmentry.h (76%) rename {include => libbbf_api/include}/libbbf_api.h (100%) create mode 100644 libbbf_dm/CMakeLists.txt rename dmdiagnostics.c => libbbf_dm/dmdiagnostics.c (99%) rename dmdiagnostics.h => libbbf_dm/dmdiagnostics.h (100%) rename {dmtree => libbbf_dm/dmtree}/json/tr104.json (100%) rename {dmtree => libbbf_dm/dmtree}/json/tr181.json (100%) rename {dmtree => libbbf_dm/dmtree}/tr104/common.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr104/common.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr104/servicesvoiceservice.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr104/servicesvoiceservice.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr104/servicesvoiceservicecallcontrol.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr104/servicesvoiceservicecallcontrol.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr104/servicesvoiceservicecalllog.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr104/servicesvoiceservicecalllog.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr104/servicesvoiceservicecapabilities.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr104/servicesvoiceservicecapabilities.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr104/servicesvoiceservicecodecprofile.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr104/servicesvoiceservicecodecprofile.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr104/servicesvoiceservicedect.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr104/servicesvoiceservicedect.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr104/servicesvoiceservicepots.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr104/servicesvoiceservicepots.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr104/servicesvoiceservicereservedports.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr104/servicesvoiceservicereservedports.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr104/servicesvoiceservicesip.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr104/servicesvoiceservicesip.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr104/servicesvoiceservicevoipprofile.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr104/servicesvoiceservicevoipprofile.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr143/diagnostics.c (99%) rename {dmtree => libbbf_dm/dmtree}/tr143/diagnostics.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/atm.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/atm.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/bridging.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/bridging.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/device.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/device.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/deviceinfo.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/deviceinfo.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/dhcpv4.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/dhcpv4.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/dhcpv6.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/dhcpv6.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/dns.c (99%) rename {dmtree => libbbf_dm/dmtree}/tr181/dns.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/dsl.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/dsl.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/dynamicdns.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/dynamicdns.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/ethernet.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/ethernet.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/fast.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/fast.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/firewall.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/firewall.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/gatewayinfo.c (98%) rename {dmtree => libbbf_dm/dmtree}/tr181/gatewayinfo.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/gre.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/gre.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/hosts.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/hosts.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/ieee1905.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/ieee1905.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/interfacestack.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/interfacestack.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/ip.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/ip.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/lanconfigsecurity.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/lanconfigsecurity.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/mqtt.c (80%) rename {dmtree => libbbf_dm/dmtree}/tr181/mqtt.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/nat.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/nat.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/ppp.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/ppp.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/ptm.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/ptm.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/qos.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/qos.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/routeradvertisement.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/routeradvertisement.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/routing.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/routing.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/security.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/security.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/ssh.c (99%) rename {dmtree => libbbf_dm/dmtree}/tr181/ssh.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/times.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/times.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/upnp.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/upnp.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/usb.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/usb.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/userinterface.c (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/userinterface.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr181/wifi.c (99%) rename {dmtree => libbbf_dm/dmtree}/tr181/wifi.h (100%) rename {dmtree => libbbf_dm/dmtree}/tr471/iplayercap.c (99%) rename {dmtree => libbbf_dm/dmtree}/tr471/iplayercap.h (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/iopsys/tr104/servicesvoiceservicecallcontrol.c (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/iopsys/tr104/servicesvoiceservicecallcontrol.h (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/iopsys/tr104/servicesvoiceservicecalllog.c (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/iopsys/tr104/servicesvoiceservicecalllog.h (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/iopsys/tr104/servicesvoiceservicedect.c (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/iopsys/tr104/servicesvoiceservicedect.h (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/iopsys/tr181/bridging.c (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/iopsys/tr181/bridging.h (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/iopsys/tr181/device.c (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/iopsys/tr181/device.h (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/iopsys/tr181/deviceinfo.c (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/iopsys/tr181/deviceinfo.h (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/iopsys/tr181/ethernet.c (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/iopsys/tr181/ethernet.h (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/iopsys/tr181/times.c (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/iopsys/tr181/times.h (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/iopsys/tr181/vendor.c (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/iopsys/tr181/vendor.h (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/iopsys/tr181/wifi.c (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/iopsys/tr181/wifi.h (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/iopsys/tr181/x_iopsys_eu_igmp.c (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/iopsys/tr181/x_iopsys_eu_igmp.h (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/iopsys/tr181/x_iopsys_eu_mld.c (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/iopsys/tr181/x_iopsys_eu_mld.h (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/iopsys/vendor.json (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/openwrt/tr181/deviceinfo.c (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/openwrt/tr181/deviceinfo.h (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/openwrt/tr181/qos.c (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/openwrt/tr181/qos.h (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/openwrt/tr181/vendor.c (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/openwrt/tr181/vendor.h (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/test/tr181/device.c (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/test/tr181/device.h (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/test/tr181/deviceinfo.c (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/test/tr181/deviceinfo.h (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/test/tr181/firewall.c (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/test/tr181/firewall.h (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/test/tr181/vendor.c (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/test/tr181/vendor.h (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/test/tr181/x_test_com_dropbear.c (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/test/tr181/x_test_com_dropbear.h (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/vendor.c (100%) rename {dmtree => libbbf_dm/dmtree}/vendor/vendor.h (100%) rename {scripts => libbbf_dm/scripts}/bbf.diag (100%) rename {scripts => libbbf_dm/scripts}/bbf_activate_handler.sh (100%) rename {scripts => libbbf_dm/scripts}/bbf_api (100%) rename {scripts => libbbf_dm/scripts}/bbf_check_idle.sh (100%) rename {scripts => libbbf_dm/scripts}/download (100%) rename {scripts => libbbf_dm/scripts}/iplayercap (100%) rename {scripts => libbbf_dm/scripts}/ipping (100%) rename {scripts => libbbf_dm/scripts}/nslookup (100%) rename {scripts => libbbf_dm/scripts}/serverselection (100%) rename {scripts => libbbf_dm/scripts}/traceroute (100%) rename {scripts => libbbf_dm/scripts}/udpecho (100%) rename {scripts => libbbf_dm/scripts}/upload (100%) delete mode 100644 test/dynamicdm_ubus_test/Makefile diff --git a/CMakeLists.txt b/CMakeLists.txt index 80c265ba..c93f4594 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,149 +2,7 @@ cmake_minimum_required(VERSION 3.0) PROJECT(bbf C) -ADD_DEFINITIONS(-Wall -Werror) -ADD_DEFINITIONS(-D_GNU_SOURCE) -ADD_DEFINITIONS(-DBBF_VENDOR_PREFIX="${BBF_VENDOR_PREFIX}") +OPTION(BBFD_ENABLED "build bbfd daemon with their dependencies" OFF) -IF(${BBF_MAX_OBJECT_INSTANCES}) - ADD_DEFINITIONS(-DBBF_MAX_OBJECT_INSTANCES=${BBF_MAX_OBJECT_INSTANCES}) -ENDIF() - -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${PROJECT_SOURCE_DIR} -I${PROJECT_SOURCE_DIR}/dmtree") - -OPTION(BBF_TR181 "build with tr181 datamodel" ON) -OPTION(BBF_TR104 "build with tr104 datamodel" ON) -OPTION(BBF_TR143 "build with tr143 datamodel" ON) -OPTION(BBF_TR471 "build with tr471 datamodel" ON) -OPTION(BBF_DOTSO_PLUGIN "build with dotso plugin" ON) -OPTION(BBF_JSON_PLUGIN "build with json plugin" ON) -OPTION(BBF_VENDOR_EXTENSION "build with vendor extension enabled" ON) -OPTION(WITH_WOLFSSL "build with lib wolfssl" OFF) -OPTION(WITH_OPENSSL "build with lib openssl" OFF) -OPTION(WITH_MBEDTLS "build with lib mbedtls" OFF) - -IF(NOT WITH_WOLFSSL AND NOT WITH_OPENSSL AND NOT WITH_MBEDTLS) - MESSAGE(FATAL_ERROR "You must enable one of the SSL libraries: {'WOLFSSL','OPENSSL','MBEDTLS'}") -ENDIF() - -FILE(GLOB BBF_API_SOURCES ${PROJECT_SOURCE_DIR}/libbbf_api/*.c) - -SET(BBF_DM_SOURCES dmentry.c dmdiagnostics.c dmbbfcommon.c) - -IF(BBF_TR181) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${PROJECT_SOURCE_DIR}/dmtree/tr181") - FILE(GLOB BBF_TR181_SOURCES ${PROJECT_SOURCE_DIR}/dmtree/tr181/*.c) - add_compile_definitions(BBF_TR181) -ENDIF(BBF_TR181) - -IF(BBF_TR104) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${PROJECT_SOURCE_DIR}/dmtree/tr104") - FILE(GLOB BBF_TR104_SOURCES ${PROJECT_SOURCE_DIR}/dmtree/tr104/*.c) - add_compile_definitions(BBF_TR104) -ENDIF(BBF_TR104) - -IF(BBF_TR143) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${PROJECT_SOURCE_DIR}/dmtree/tr143") - FILE(GLOB BBF_TR143_SOURCES ${PROJECT_SOURCE_DIR}/dmtree/tr143/*.c) - add_compile_definitions(BBF_TR143) -ENDIF(BBF_TR143) - -IF(BBF_TR471) - IF(NOT BBF_TR143) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${PROJECT_SOURCE_DIR}/dmtree/tr143") - FILE(GLOB BBF_TR143_SOURCES ${PROJECT_SOURCE_DIR}/dmtree/tr143/diagnostics.c) - ENDIF() - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${PROJECT_SOURCE_DIR}/dmtree/tr471") - FILE(GLOB BBF_TR471_SOURCES ${PROJECT_SOURCE_DIR}/dmtree/tr471/*.c) - add_compile_definitions(BBF_TR471) -ENDIF(BBF_TR471) - -IF(BBF_DOTSO_PLUGIN) - SET(BBF_DOTSO_PLUGIN_SOURCES dmdynamiclibrary.c) - add_compile_definitions(BBFDM_ENABLE_DOTSO_PLUGIN) -ENDIF(BBF_DOTSO_PLUGIN) - -IF(BBF_JSON_PLUGIN) - SET(BBF_JSON_PLUGIN_SOURCES dmdynamicjson.c) - add_compile_definitions(BBFDM_ENABLE_JSON_PLUGIN) -endif(BBF_JSON_PLUGIN) - -IF(WITH_WOLFSSL) - SET(SSL_LIBS wolfssl) - add_compile_definitions(LWOLFSSL) -ENDIF(WITH_WOLFSSL) - -IF(WITH_OPENSSL) - SET(SSL_LIBS ssl) - add_compile_definitions(LOPENSSL) -ENDIF(WITH_OPENSSL) - -IF(WITH_MBEDTLS) - SET(SSL_LIBS mbedtls) - add_compile_definitions(LMBEDTLS) -ENDIF(WITH_MBEDTLS) - -IF(BBF_VENDOR_EXTENSION) - SET(BBF_VENDOR_EXTENSION_SOURCES dmdynamicvendor.c dmtree/vendor/vendor.c) - ADD_DEFINITIONS(-DBBF_VENDOR_LIST="${BBF_VENDOR_LIST}") - add_compile_definitions(BBF_VENDOR_EXTENSION) - - SET(BBF_VENDOR_LIST "iopsys" CACHE STRING "vendor list to be used") - - STRING(REPLACE "," ";" VENDOR_LIST ${BBF_VENDOR_LIST}) - - foreach(VENDOR IN LISTS VENDOR_LIST) - FILE(GLOB_RECURSE BBF_VENDOR_SOURCES ${PROJECT_SOURCE_DIR}/dmtree/vendor/${VENDOR}/*.c) - LIST(APPEND BBF_VENDOR_EXTENSION_SOURCES ${BBF_VENDOR_SOURCES}) - - STRING(TOUPPER ${VENDOR} VENDOR) - add_compile_definitions(BBF_VENDOR_${VENDOR}) - endforeach() -ENDIF(BBF_VENDOR_EXTENSION) - -ADD_LIBRARY(bbfdm SHARED ${BBF_API_SOURCES} ${BBF_DM_SOURCES} - ${BBF_TR181_SOURCES} ${BBF_TR104_SOURCES} ${BBF_TR143_SOURCES} ${BBF_TR471_SOURCES} - ${BBF_DOTSO_PLUGIN_SOURCES} - ${BBF_JSON_PLUGIN_SOURCES} - ${BBF_VENDOR_EXTENSION_SOURCES}) - -TARGET_LINK_LIBRARIES(bbfdm uci ubus ubox json-c blobmsg_json dl curl ${SSL_LIBS}) - -INSTALL(TARGETS bbfdm - LIBRARY DESTINATION usr/lib) - -INSTALL(DIRECTORY DESTINATION etc/bbfdm) -INSTALL(DIRECTORY DESTINATION etc/bbfdm/dmmap) -INSTALL(DIRECTORY DESTINATION etc/bbfdm/json) -INSTALL(DIRECTORY DESTINATION usr/share/bbfdm) -INSTALL(DIRECTORY DESTINATION usr/lib/bbfdm) - -FILE(GLOB headers include/*.h) -INSTALL(FILES ${headers} - DESTINATION usr/include -) - -FILE(GLOB libbbf_api_headers libbbf_api/*.h) -INSTALL(FILES ${libbbf_api_headers} - DESTINATION usr/include/libbbf_api -) - -FILE(GLOB libbbfdm_headers *.h) -INSTALL(FILES ${libbbfdm_headers} - DESTINATION usr/include/libbbfdm -) - -FILE(GLOB scripts scripts/*) -INSTALL(FILES ${scripts} - PERMISSIONS OWNER_EXECUTE - DESTINATION usr/share/bbfdm -) - -# add CPack to project -SET(CPACK_PACKAGE_NAME "libbbf") -SET(CPACK_PACKAGE_VENDOR "iopsys.io") -SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "libbbf - Datamodel library") -SET(CPACK_PACKAGE_VERSION "1.0.0") -SET(CPACK_GENERATOR STGZ) - -include(CPack) +add_subdirectory(libbbf_api) +add_subdirectory(libbbf_dm) diff --git a/README.md b/README.md index 1a814981..2f38b745 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ This package comprises of the below libraries: | Library | Description | | ------- | ------------------------------------------------- | -| libbbfdm | This provides the mechanism to add new parameters or extend the existing DM tree using json plugin or shared library plugin. | +| libbbf_dm | This provides the mechanism to add new parameters or extend the existing DM tree using json plugin or shared library plugin. | | libbbf_api | This provides the APIs for UCI, Ubus, JSON, CLI and memory management. | ## Design of bbfdm @@ -42,7 +42,7 @@ This package comprises of the below libraries: - `json` folder : TR-181 and TR-104 JSON files - `libbbf_api` folder which contains the source code of all API functions (UCI, Ubus, JSON, CLI and memory management). These API are used for GET/SET/ADD/Delete/Operate calls which can be called in internal or external packages. -All APIs exposed by libbbf_api are presented in this header file [libbbf_api.h](https://dev.iopsys.eu/iopsys/bbf/-/tree/devel/include/libbbf_api.h). +All APIs exposed by libbbf_api are presented in this header file [libbbf_api.h](https://dev.iopsys.eu/iopsys/bbf/-/tree/devel/libbbf_api/include/libbbf_api.h). - `scripts` folder which contains the Diagnostics scripts diff --git a/dmbbfcommon.c b/dmbbfcommon.c deleted file mode 100644 index b5290f8e..00000000 --- a/dmbbfcommon.c +++ /dev/null @@ -1,80 +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 Omar Kallel - */ - -#include "dmbbfcommon.h" - -int set_bbfdatamodel_type(int bbf_type) -{ - bbfdatamodel_type = bbf_type; - return 0; -} - -int get_bbfdatamodel_type(void) -{ - return bbfdatamodel_type; -} - -int bbfdmuci_lookup_ptr(struct uci_context *ctx, struct uci_ptr *ptr, char *package, char *section, char *option, char *value) -{ - return dmuci_lookup_ptr(ctx, ptr, package, section, option, value); -} - -void bbf_uci_commit_bbfdm(void) -{ - dmuci_init_bbfdm(); - dmuci_commit_bbfdm(); - dmuci_exit_bbfdm(); -} - -void bbf_uci_revert_bbfdm(void) -{ - dmuci_init_bbfdm(); - dmuci_revert_bbfdm(); - dmuci_exit_bbfdm(); -} - -void del_list_fault_param(struct param_fault *param_fault) -{ - bbf_api_del_list_fault_param(param_fault); -} - -int get_dm_type(char *dm_str) -{ - if (dm_str == NULL) - return DMT_STRING; - - if (DM_STRCMP(dm_str, DMT_TYPE[DMT_STRING]) == 0) - return DMT_STRING; - else if (DM_STRCMP(dm_str, DMT_TYPE[DMT_UNINT]) == 0) - return DMT_UNINT; - else if (DM_STRCMP(dm_str, DMT_TYPE[DMT_INT]) == 0) - return DMT_INT; - else if (DM_STRCMP(dm_str, DMT_TYPE[DMT_UNLONG]) == 0) - return DMT_UNLONG; - else if (DM_STRCMP(dm_str, DMT_TYPE[DMT_LONG]) == 0) - return DMT_LONG; - else if (DM_STRCMP(dm_str, DMT_TYPE[DMT_BOOL]) == 0) - return DMT_BOOL; - else if (DM_STRCMP(dm_str, DMT_TYPE[DMT_TIME]) == 0) - return DMT_TIME; - else if (DM_STRCMP(dm_str, DMT_TYPE[DMT_HEXBIN]) == 0) - return DMT_HEXBIN; - else if (DM_STRCMP(dm_str, DMT_TYPE[DMT_BASE64]) == 0) - return DMT_BASE64; - else if (DM_STRCMP(dm_str, DMT_TYPE[DMT_COMMAND]) == 0) - return DMT_COMMAND; - else if (DM_STRCMP(dm_str, DMT_TYPE[DMT_EVENT]) == 0) - return DMT_EVENT; - else - return DMT_STRING; - - return DMT_STRING; -} diff --git a/dmbbfcommon.h b/dmbbfcommon.h deleted file mode 100644 index 64e78733..00000000 --- a/dmbbfcommon.h +++ /dev/null @@ -1,27 +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 Omar Kallel - */ - -#ifndef __DMBBFCOMMON_H__ -#define __DMBBFCOMMON_H__ - -#include "libbbf_api/dmcommon.h" -#include "dmentry.h" - -void bbf_uci_commit_bbfdm(void); -void bbf_uci_revert_bbfdm(void); -int set_bbfdatamodel_type(int bbf_type); -int get_bbfdatamodel_type(void); -void del_list_fault_param(struct param_fault *param_fault); - -int bbfdmuci_lookup_ptr(struct uci_context *ctx, struct uci_ptr *ptr, char *package, char *section, char *option, char *value); -int get_dm_type(char *dm_str); - -#endif //__DMBBFCOMMON_H__ diff --git a/docs/guide/dynamic_dm.md b/docs/guide/dynamic_dm.md index 72c17d7c..0d454fe2 100644 --- a/docs/guide/dynamic_dm.md +++ b/docs/guide/dynamic_dm.md @@ -28,7 +28,7 @@ The **DM_MAP_OBJ** structure contains three arguments: For the other tables, they are defined in the same way as the Object and Parameter definition described above. -> Note1: Shared library can only add vendor or standard objects that are not implemented by `libbbfdm` +> Note1: Shared library can only add vendor or standard objects that are not implemented by `libbbf_dm` > Note2: Shared library is not allowed to overwrite objects/parameters @@ -470,7 +470,7 @@ The application should bring its JSON file under **'/etc/bbfdm/json/'** path wit } ``` -> Note1: JSON File can only add vendor or standard objects that are not implemented by `libbbfdm` +> Note1: JSON File can only add vendor or standard objects that are not implemented by `libbbf_dm` > Note2: JSON File is not allowed to overwrite objects/parameters diff --git a/docs/guide/obj_param_extension.md b/docs/guide/obj_param_extension.md index c5ce9732..4e0dc0df 100644 --- a/docs/guide/obj_param_extension.md +++ b/docs/guide/obj_param_extension.md @@ -2,7 +2,7 @@ As mentioned in README, all Data Models are stored in the **'dmtree'** folder. In order to implement a new object/parameter, you need to expand its get/set/add/delete functions and then save them in the right folder. -`bbfdm` library offers a tool to generate templates of the source code from json files placed under **'dmtree/json'**. So, any developer can fill these json files ([tr181](https://dev.iopsys.eu/iopsys/bbf/-/tree/devel/dmtree/json/tr181.json) or [tr104](https://dev.iopsys.eu/iopsys/bbf/-/tree/devel/dmtree/json/tr104.json)) with mapping field according to UCI, UBUS or CLI commands then generate the source code in C. +`bbfdm` library offers a tool to generate templates of the source code from json files placed under **'dmtree/json'**. So, any developer can fill these json files ([tr181](https://dev.iopsys.eu/iopsys/bbf/-/tree/devel/libbbf_dm/dmtree/json/tr181.json) or [tr104](https://dev.iopsys.eu/iopsys/bbf/-/tree/devel/libbbf_dm/dmtree/json/tr104.json)) with mapping field according to UCI, UBUS or CLI commands then generate the source code in C. ```bash $ ./convert_dm_json_to_c.py diff --git a/docs/guide/tools.md b/docs/guide/tools.md index 379a5126..12d74232 100644 --- a/docs/guide/tools.md +++ b/docs/guide/tools.md @@ -119,7 +119,7 @@ $ ./generate_dm_excel.py -d tr181 -v iopsys -p X_IOPSYS_EU_ -r git^https://dev.i ``` ## Validate JSON plugin -It is a [python script](https://dev.iopsys.eu/iopsys/bbf/-/tree/devel/tools/validate_json_plugin.py) to validate JSON plugin files for dynamic library or standard data model [TR181](https://dev.iopsys.eu/iopsys/bbf/-/tree/devel/dmtree/json/tr181.json), [TR104](https://dev.iopsys.eu/iopsys/bbf/-/tree/devel/dmtree/json/tr104.json), etc.. +It is a [python script](https://dev.iopsys.eu/iopsys/bbf/-/tree/devel/tools/validate_json_plugin.py) to validate JSON plugin files for dynamic library or standard data model [TR181](https://dev.iopsys.eu/iopsys/bbf/-/tree/devel/libbbf_dm/dmtree/json/tr181.json), [TR104](https://dev.iopsys.eu/iopsys/bbf/-/tree/devel/libbbf_dm/dmtree/json/tr104.json), etc.. ```bash $ ./tools/validate_json_plugin.py test/files/etc/bbfdm/json/UserInterface.json @@ -151,7 +151,7 @@ The parameters/keys used in tools_input.json file are mostly self-explanatory bu | | default: This contains the generic definition which has the capability to define more descriptive DM objects/parameters | | output.file_format | xls: An excel file listing the supported and unsupported DM objects/parameters | -> Note: To add more description about the vendor extended DM objects/parameters, it is required to add the definition of the required/related DM objects/parameters in a json file (The json structure should follow same format as given in [tr181.json](https://dev.iopsys.eu/iopsys/bbf/-/tree/devel/dmtree/json/tr181.json)), The same json file need to be defined in dm_json_files list. +> Note: To add more description about the vendor extended DM objects/parameters, it is required to add the definition of the required/related DM objects/parameters in a json file (The json structure should follow same format as given in [tr181.json](https://dev.iopsys.eu/iopsys/bbf/-/tree/devel/libbbf_dm/dmtree/json/tr181.json)), The same json file need to be defined in dm_json_files list. The input json file should be defined as follow: @@ -169,8 +169,8 @@ The input json file should be defined as follow: "test" ], "dm_json_files": [ - "../dmtree/json/tr181.json", - "../dmtree/json/tr104.json" + "../libbbf_dm/dmtree/json/tr181.json", + "../libbbf_dm/dmtree/json/tr104.json" ] "vendor_prefix": "X_IOPSYS_EU_", "plugins": [ diff --git a/docs/guide/vendor.md b/docs/guide/vendor.md index e1e55822..a8dba633 100644 --- a/docs/guide/vendor.md +++ b/docs/guide/vendor.md @@ -28,13 +28,13 @@ The **DM_MAP_OBJ** structure contains three arguments: Each entry in the exclude table is a string which could be a path of object or parameter that need to be excluded from the tree -The following [link](https://dev.iopsys.eu/iopsys/bbf/-/blob/devel/dmtree/vendor/test/tr181/vendor.c) contains example of Extend, Overwrite and Exclude table. +The following [link](https://dev.iopsys.eu/iopsys/bbf/-/blob/devel/libbbf_dm/dmtree/vendor/test/tr181/vendor.c) contains example of Extend, Overwrite and Exclude table. ### 3. Adding vendor and standard objects/Parameters Implement the new vendor/standard objects and parameters as defined above in the first section. -Example: [Custom Vendor Object Dropbear](https://dev.iopsys.eu/iopsys/bbf/-/blob/devel/dmtree/vendor/test/tr181/x_test_com_dropbear.c) +Example: [Custom Vendor Object Dropbear](https://dev.iopsys.eu/iopsys/bbf/-/blob/devel/libbbf_dm/dmtree/vendor/test/tr181/x_test_com_dropbear.c) ### 4. link vendor tables to the main tree @@ -48,7 +48,7 @@ To register the new vendor tables, you need to link them in the main three table These tables are defined in the file **'dmtree/vendor/vendor.c'**. -Example: [Link vendor tables to the main tree](https://dev.iopsys.eu/iopsys/bbf/-/blob/devel/dmtree/vendor/vendor.c) +Example: [Link vendor tables to the main tree](https://dev.iopsys.eu/iopsys/bbf/-/blob/devel/libbbf_dm/dmtree/vendor/vendor.c) ### 5. Enable vendor @@ -68,7 +68,7 @@ BBF_VENDOR_LIST="iopsys,test" BBF_VENDOR_PREFIX="X_TEST_COM_" ``` -> Note1: The `libbbfdm` vendor list can support multi-vendor with comma seperated. +> Note1: The `libbbf_dm` vendor list can support multi-vendor with comma seperated. > Note2: If multi vendors are supported and there is a object/parameter that is implmented by multi customers in different way, the implemented object/parameter of the first vendor name in the **BBF_VENDOR_LIST** will be considered. diff --git a/gitlab-ci/iopsys-supervisord.conf b/gitlab-ci/iopsys-supervisord.conf index 38549ef3..6092415a 100755 --- a/gitlab-ci/iopsys-supervisord.conf +++ b/gitlab-ci/iopsys-supervisord.conf @@ -11,9 +11,3 @@ numprocs_start=1 startretries=0 priority=2 command=/bin/bash -c "/usr/sbin/rpcd" - -[program:bbf_ubus] -autorestart=false -numprocs_start=2 -priority=3 -command=/bin/bash -c "/usr/bin/valgrind --xml=yes --xml-file=./memory-report.xml --leak-check=full --show-reachable=yes --show-leak-kinds=all --errors-for-leak-kinds=all --error-exitcode=1 --track-origins=yes --leak-resolution=high --show-error-list=yes --child-silent-after-fork=yes ./test/dynamicdm_ubus_test/bbf_ubus" diff --git a/gitlab-ci/setup.sh b/gitlab-ci/setup.sh index ac4b28c3..758d1f1a 100755 --- a/gitlab-ci/setup.sh +++ b/gitlab-ci/setup.sh @@ -12,6 +12,6 @@ cp -r ./test/files/var/* /var/ cp -r ./test/files/tmp/* /tmp/ cp -r ./test/files/lib/* /lib/ -apt install -y iproute2 +apt update && apt install -y iproute2 ls /etc/config/ diff --git a/gitlab-ci/tools-test.sh b/gitlab-ci/tools-test.sh index aef23e33..7ae0ba5e 100755 --- a/gitlab-ci/tools-test.sh +++ b/gitlab-ci/tools-test.sh @@ -18,11 +18,11 @@ exec_cmd_verbose pylint -d R,C,W0603 tools/*.py echo "********* Validate JSON Plugin *********" echo "Validate BBF TR-181 JSON Plugin" -./tools/validate_json_plugin.py dmtree/json/tr181.json +./tools/validate_json_plugin.py libbbf_dm/dmtree/json/tr181.json check_ret $? echo "Validate BBF TR-104 JSON Plugin" -./tools/validate_json_plugin.py dmtree/json/tr104.json +./tools/validate_json_plugin.py libbbf_dm/dmtree/json/tr104.json check_ret $? echo "Validate X_IOPSYS_EU_Dropbear JSON Plugin" diff --git a/libbbf_api/CMakeLists.txt b/libbbf_api/CMakeLists.txt new file mode 100644 index 00000000..a76b4e35 --- /dev/null +++ b/libbbf_api/CMakeLists.txt @@ -0,0 +1,52 @@ +cmake_minimum_required(VERSION 3.0) + +PROJECT(libbbf_api) + +ADD_DEFINITIONS(-Wall -Werror) +ADD_DEFINITIONS(-D_GNU_SOURCE) +ADD_DEFINITIONS(-DBBF_VENDOR_PREFIX="${BBF_VENDOR_PREFIX}") + +IF(${BBF_MAX_OBJECT_INSTANCES}) + ADD_DEFINITIONS(-DBBF_MAX_OBJECT_INSTANCES=${BBF_MAX_OBJECT_INSTANCES}) +ENDIF() + +OPTION(BBF_DOTSO_PLUGIN "build with dotso plugin" ON) +OPTION(BBF_JSON_PLUGIN "build with json plugin" ON) +OPTION(BBF_VENDOR_EXTENSION "build with vendor extension enabled" ON) + +IF(BBF_DOTSO_PLUGIN) + SET(BBF_DOTSO_PLUGIN_SOURCES dm_plugin/dmdynamiclibrary.c) + add_compile_definitions(BBFDM_ENABLE_DOTSO_PLUGIN) +ENDIF(BBF_DOTSO_PLUGIN) + +IF(BBF_JSON_PLUGIN) + SET(BBF_JSON_PLUGIN_SOURCES dm_plugin/dmdynamicjson.c) + add_compile_definitions(BBFDM_ENABLE_JSON_PLUGIN) +endif(BBF_JSON_PLUGIN) + +IF(BBF_VENDOR_EXTENSION) + SET(BBF_VENDOR_EXTENSION_SOURCES dm_plugin/dmdynamicvendor.c) + ADD_DEFINITIONS(-DBBF_VENDOR_LIST="${BBF_VENDOR_LIST}") + add_compile_definitions(BBF_VENDOR_EXTENSION) + SET(BBF_VENDOR_LIST "iopsys" CACHE STRING "vendor list to be used") + STRING(REPLACE "," ";" VENDOR_LIST ${BBF_VENDOR_LIST}) +ENDIF(BBF_VENDOR_EXTENSION) + +FILE(GLOB BBF_API_SOURCES *.c) + +ADD_LIBRARY(bbf_api SHARED ${BBF_API_SOURCES} ${BBF_DOTSO_PLUGIN_SOURCES} ${BBF_JSON_PLUGIN_SOURCES} ${BBF_VENDOR_EXTENSION_SOURCES}) + +TARGET_LINK_LIBRARIES(bbf_api uci ubus ubox json-c blobmsg_json dl) + +INSTALL(TARGETS bbf_api + LIBRARY DESTINATION usr/lib) + +FILE(GLOB libbbf_api_headers *.h) +INSTALL(FILES ${libbbf_api_headers} + DESTINATION usr/include/libbbf_api +) + +FILE(GLOB libbbf_api_include_headers include/*.h) +INSTALL(FILES ${libbbf_api_include_headers} + DESTINATION usr/include +) diff --git a/dmdynamicjson.c b/libbbf_api/dm_plugin/dmdynamicjson.c similarity index 99% rename from dmdynamicjson.c rename to libbbf_api/dm_plugin/dmdynamicjson.c index eac8c437..77418600 100644 --- a/dmdynamicjson.c +++ b/libbbf_api/dm_plugin/dmdynamicjson.c @@ -10,7 +10,6 @@ */ #include "dmdynamicjson.h" -#include "dmentry.h" #define MAX_DM_LENGTH (1024) #define json_object_get_string(x) (char *)json_object_get_string(x) diff --git a/dmdynamicjson.h b/libbbf_api/dm_plugin/dmdynamicjson.h similarity index 94% rename from dmdynamicjson.h rename to libbbf_api/dm_plugin/dmdynamicjson.h index 68080315..76710fc7 100644 --- a/dmdynamicjson.h +++ b/libbbf_api/dm_plugin/dmdynamicjson.h @@ -12,7 +12,7 @@ #ifndef __DMENTRYJSON_H__ #define __DMENTRYJSON_H__ -#include "libbbf_api/dmcommon.h" +#include "../dmcommon.h" #define JSON_FOLDER_PATH "/etc/bbfdm/json" diff --git a/dmdynamiclibrary.c b/libbbf_api/dm_plugin/dmdynamiclibrary.c similarity index 100% rename from dmdynamiclibrary.c rename to libbbf_api/dm_plugin/dmdynamiclibrary.c diff --git a/dmdynamiclibrary.h b/libbbf_api/dm_plugin/dmdynamiclibrary.h similarity index 94% rename from dmdynamiclibrary.h rename to libbbf_api/dm_plugin/dmdynamiclibrary.h index 49a71647..9dfa47ff 100644 --- a/dmdynamiclibrary.h +++ b/libbbf_api/dm_plugin/dmdynamiclibrary.h @@ -12,7 +12,7 @@ #ifndef __DMENTRYLIBRARY_H__ #define __DMENTRYLIBRARY_H__ -#include "libbbf_api/dmcommon.h" +#include "../dmcommon.h" #define LIBRARY_FOLDER_PATH "/usr/lib/bbfdm" diff --git a/dmdynamicvendor.c b/libbbf_api/dm_plugin/dmdynamicvendor.c similarity index 95% rename from dmdynamicvendor.c rename to libbbf_api/dm_plugin/dmdynamicvendor.c index 9ff8010f..0a6a5018 100644 --- a/dmdynamicvendor.c +++ b/libbbf_api/dm_plugin/dmdynamicvendor.c @@ -10,7 +10,6 @@ */ #include "dmdynamicvendor.h" -#include "dmtree/vendor/vendor.h" static void dm_browse_node_vendor_object_tree(DMNODE *parent_node, DMOBJ *entryobj) { @@ -109,9 +108,9 @@ static void load_vendor_extension_arrays(struct dmctx *ctx) for (int idx = length - 1; idx >= 0; idx--) { - DM_MAP_VENDOR *vendor_map_obj = tVendorExtension; + DM_MAP_VENDOR *vendor_map_obj = ctx->dm_vendor_extension[0]; - for (int j = 0; vendor_map_obj[j].vendor; j++) { + for (int j = 0; vendor_map_obj && vendor_map_obj[j].vendor; j++) { if (DM_STRCMP(vendor_map_obj[j].vendor, tokens[idx]) != 0) continue; @@ -181,9 +180,9 @@ static void load_vendor_extension_overwrite_arrays(struct dmctx *ctx) for (int idx = length - 1; idx >= 0; idx--) { - DM_MAP_VENDOR *vendor_map_obj = tVendorExtensionOverwrite; + DM_MAP_VENDOR *vendor_map_obj = ctx->dm_vendor_extension[1]; - for (int j = 0; vendor_map_obj[j].vendor; j++) { + for (int j = 0; vendor_map_obj && vendor_map_obj[j].vendor; j++) { if (DM_STRCMP(vendor_map_obj[j].vendor, tokens[idx]) != 0) continue; @@ -273,9 +272,9 @@ static void load_vendor_extension_exclude_arrays(struct dmctx *ctx) for (int idx = length - 1; idx >= 0; idx--) { - DM_MAP_VENDOR_EXCLUDE *vendor_map_exclude_obj = tVendorExtensionExclude; + DM_MAP_VENDOR_EXCLUDE *vendor_map_exclude_obj = ctx->dm_vendor_extension_exclude; - for (int j = 0; vendor_map_exclude_obj[j].vendor; j++) { + for (int j = 0; vendor_map_exclude_obj && vendor_map_exclude_obj[j].vendor; j++) { if (DM_STRCMP(vendor_map_exclude_obj[j].vendor, tokens[idx]) != 0) continue; diff --git a/dmdynamicvendor.h b/libbbf_api/dm_plugin/dmdynamicvendor.h similarity index 94% rename from dmdynamicvendor.h rename to libbbf_api/dm_plugin/dmdynamicvendor.h index abc452d8..30600e7b 100644 --- a/dmdynamicvendor.h +++ b/libbbf_api/dm_plugin/dmdynamicvendor.h @@ -12,7 +12,7 @@ #ifndef __DMENTRYVENDOR_H__ #define __DMENTRYVENDOR_H__ -#include "libbbf_api/dmcommon.h" +#include "../dmcommon.h" void load_vendor_dynamic_arrays(struct dmctx *ctx); void free_vendor_dynamic_arrays(DMOBJ *dm_entryobj); diff --git a/libbbf_api/dmapi.h b/libbbf_api/dmapi.h index b0df64ca..c04265f3 100644 --- a/libbbf_api/dmapi.h +++ b/libbbf_api/dmapi.h @@ -176,6 +176,16 @@ struct dm_parameter { char *additional_data; }; +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; + struct dmctx { bool stop; @@ -189,6 +199,8 @@ struct dmctx struct list_head list_fault_param; struct list_head list_json_parameter; DMOBJ *dm_entryobj; + DM_MAP_VENDOR *dm_vendor_extension[2]; + DM_MAP_VENDOR_EXCLUDE *dm_vendor_extension_exclude; bool nextlevel; bool iswildcard; int faultcode; @@ -231,16 +243,6 @@ typedef struct dm_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 { CMD_SUCCESS, CMD_INVALID_ARGUMENTS, diff --git a/dmentry.c b/libbbf_api/dmentry.c similarity index 85% rename from dmentry.c rename to libbbf_api/dmentry.c index 44698bb2..4cc0b0dd 100644 --- a/dmentry.c +++ b/libbbf_api/dmentry.c @@ -13,15 +13,9 @@ */ #include "dmentry.h" -#include "dmdynamicjson.h" -#include "dmdynamiclibrary.h" -#include "dmdynamicvendor.h" - -#ifdef BBF_TR181 -#include "device.h" -#endif /* BBF_TR181 */ - -#include "dmbbfcommon.h" +#include "dm_plugin/dmdynamicjson.h" +#include "dm_plugin/dmdynamiclibrary.h" +#include "dm_plugin/dmdynamicvendor.h" LIST_HEAD(head_package_change); LIST_HEAD(main_memhead); @@ -133,7 +127,8 @@ int usp_fault_map(int fault) return out_fault; } -static int dm_ctx_init_custom(struct dmctx *ctx, unsigned int instance_mode, DMOBJ *tEntryObj, int custom) +static int dm_ctx_init_custom(struct dmctx *ctx, unsigned int instance_mode, DMOBJ *tEntryObj, + DM_MAP_VENDOR *tVendorExtension[], DM_MAP_VENDOR_EXCLUDE *tVendorExtensionExclude, int custom) { if (custom == CTX_INIT_ALL) bbf_uci_init(); @@ -143,6 +138,9 @@ static int dm_ctx_init_custom(struct dmctx *ctx, unsigned int instance_mode, DMO INIT_LIST_HEAD(&ctx->list_fault_param); ctx->instance_mode = instance_mode; ctx->dm_entryobj = tEntryObj; + ctx->dm_vendor_extension[0] = tVendorExtension ? tVendorExtension[0] : NULL; + ctx->dm_vendor_extension[1] = tVendorExtension ? tVendorExtension[1] : NULL; + ctx->dm_vendor_extension_exclude = tVendorExtensionExclude; ctx->dm_version = DEFAULT_DMVERSION; return 0; } @@ -165,19 +163,15 @@ void dm_config_ubus(struct ubus_context *ctx) dmubus_configure(ctx); } -int dm_ctx_init_entry(struct dmctx *ctx, DMOBJ *tEntryObj, unsigned int instance_mode) +int dm_ctx_init_entry(struct dmctx *ctx, DMOBJ *tEntryObj, DM_MAP_VENDOR *tVendorExtension[], DM_MAP_VENDOR_EXCLUDE *tVendorExtensionExclude, unsigned int instance_mode) { - return dm_ctx_init_custom(ctx, instance_mode, tEntryObj, CTX_INIT_ALL); + return dm_ctx_init_custom(ctx, instance_mode, tEntryObj, tVendorExtension, tVendorExtensionExclude, CTX_INIT_ALL); } -int dm_ctx_init(struct dmctx *ctx, unsigned int instance_mode) +int dm_ctx_init(struct dmctx *ctx, DMOBJ *tEntryObj, DM_MAP_VENDOR *tVendorExtension[], DM_MAP_VENDOR_EXCLUDE *tVendorExtensionExclude, unsigned int instance_mode) { -#ifdef BBF_TR181 dmubus_clean_endlife_entries(); - return dm_ctx_init_custom(ctx, instance_mode, tEntry181Obj, CTX_INIT_ALL); -#else - return 0; -#endif /* BBF_TR181 */ + return dm_ctx_init_custom(ctx, instance_mode, tEntryObj, tVendorExtension, tVendorExtensionExclude, CTX_INIT_ALL); } int dm_ctx_clean(struct dmctx *ctx) @@ -192,13 +186,9 @@ int dm_ctx_init_cache(int time) return 0; } -int dm_ctx_init_sub(struct dmctx *ctx, unsigned int instance_mode) +int dm_ctx_init_sub(struct dmctx *ctx, DMOBJ *tEntryObj, DM_MAP_VENDOR *tVendorExtension[], DM_MAP_VENDOR_EXCLUDE *tVendorExtensionExclude, unsigned int instance_mode) { -#ifdef BBF_TR181 - return dm_ctx_init_custom(ctx, instance_mode, tEntry181Obj, CTX_INIT_SUB); -#else - return 0; -#endif /* BBF_TR181 */ + return dm_ctx_init_custom(ctx, instance_mode, tEntryObj, tVendorExtension, tVendorExtensionExclude, CTX_INIT_SUB); } int dm_ctx_clean_sub(struct dmctx *ctx) @@ -380,7 +370,7 @@ int adm_entry_get_linker_param(struct dmctx *ctx, char *param, char *linker, cha if (!param || !linker || *linker == 0) return 0; - dm_ctx_init_sub(&dmctx, ctx->instance_mode); + dm_ctx_init_sub(&dmctx, ctx->dm_entryobj, ctx->dm_vendor_extension, ctx->dm_vendor_extension_exclude, ctx->instance_mode); dmctx.in_param = param; dmctx.linker = linker; @@ -402,7 +392,7 @@ int adm_entry_get_linker_value(struct dmctx *ctx, char *param, char **value) snprintf(linker, sizeof(linker), "%s%c", param, (param[DM_STRLEN(param) - 1] != '.') ? '.' : '\0'); - dm_ctx_init_sub(&dmctx, ctx->instance_mode); + dm_ctx_init_sub(&dmctx, ctx->dm_entryobj, ctx->dm_vendor_extension, ctx->dm_vendor_extension_exclude, ctx->instance_mode); dmctx.in_param = linker; dm_entry_get_linker_value(&dmctx); @@ -453,7 +443,7 @@ int dm_entry_manage_services(struct blob_buf *bb, bool restart) } blobmsg_close_array(bb, arr); - bbf_uci_commit_bbfdm(); + dmuci_commit_bbfdm(); free_all_list_package_change(&head_package_change); return 0; @@ -463,7 +453,7 @@ int dm_entry_restart_services(void) { struct package_change *pc = NULL; - bbf_uci_commit_bbfdm(); + dmuci_commit_bbfdm(); list_for_each_entry(pc, &head_package_change, list) { dmubus_call_set("uci", "commit", UBUS_ARGS{{"config", pc->package, String}}, 1); @@ -478,7 +468,7 @@ int dm_entry_revert_changes(void) { struct package_change *pc = NULL; - bbf_uci_revert_bbfdm(); + dmuci_revert_bbfdm(); list_for_each_entry(pc, &head_package_change, list) { dmubus_call_set("uci", "revert", UBUS_ARGS{{"config", pc->package, String}}, 1); @@ -574,7 +564,7 @@ static void load_dynamic_arrays(struct dmctx *ctx) #ifdef BBFDM_ENABLE_JSON_PLUGIN // Load dynamic objects and parameters exposed via a JSON file if (check_stats_folder(true)) { - free_json_dynamic_arrays(tEntry181Obj); + free_json_dynamic_arrays(ctx->dm_entryobj); load_json_dynamic_arrays(ctx); } #endif /* BBFDM_ENABLE_JSON_PLUGIN */ @@ -582,7 +572,7 @@ static void load_dynamic_arrays(struct dmctx *ctx) #ifdef BBFDM_ENABLE_DOTSO_PLUGIN // Load dynamic objects and parameters exposed via a library if (check_stats_folder(false)) { - free_library_dynamic_arrays(tEntry181Obj); + free_library_dynamic_arrays(ctx->dm_entryobj); load_library_dynamic_arrays(ctx); } #endif /* BBFDM_ENABLE_DOTSO_PLUGIN */ @@ -590,40 +580,36 @@ static void load_dynamic_arrays(struct dmctx *ctx) #ifdef BBF_VENDOR_EXTENSION // Load objects and parameters exposed via vendor extension if (first_boot == false) { - free_vendor_dynamic_arrays(tEntry181Obj); + free_vendor_dynamic_arrays(ctx->dm_entryobj); load_vendor_dynamic_arrays(ctx); first_boot = true; } #endif } -static void free_dynamic_arrays(void) +static void free_dynamic_arrays(DMOBJ *tEntryObj) { -#ifdef BBF_TR181 - DMOBJ *root = tEntry181Obj; - DMNODE node = {.current_object = ""}; #ifdef BBFDM_ENABLE_JSON_PLUGIN - free_json_dynamic_arrays(tEntry181Obj); + free_json_dynamic_arrays(tEntryObj); #endif /* BBFDM_ENABLE_JSON_PLUGIN */ #ifdef BBFDM_ENABLE_DOTSO_PLUGIN - free_library_dynamic_arrays(tEntry181Obj); + free_library_dynamic_arrays(tEntryObj); #endif /* BBFDM_ENABLE_DOTSO_PLUGIN */ #ifdef BBF_VENDOR_EXTENSION - free_vendor_dynamic_arrays(tEntry181Obj); + free_vendor_dynamic_arrays(tEntryObj); #endif - free_dm_browse_node_dynamic_object_tree(&node, root); -#endif /* BBF_TR181 */ + free_dm_browse_node_dynamic_object_tree(&node, tEntryObj); } -void bbf_dm_cleanup(void) +void bbf_dm_cleanup(DMOBJ *tEntryObj) { dmubus_free(); dm_dynamic_cleanmem(&main_memhead); - free_dynamic_arrays(); + free_dynamic_arrays(tEntryObj); } void dm_cleanup_dynamic_entry(DMOBJ *root) @@ -633,3 +619,10 @@ void dm_cleanup_dynamic_entry(DMOBJ *root) dm_dynamic_cleanmem(&main_memhead); free_dm_browse_node_dynamic_object_tree(&node, root); } + +int set_bbfdatamodel_type(int bbf_type) +{ + bbfdatamodel_type = bbf_type; + return 0; +} + diff --git a/dmentry.h b/libbbf_api/dmentry.h similarity index 76% rename from dmentry.h rename to libbbf_api/dmentry.h index c152c379..11945f20 100644 --- a/dmentry.h +++ b/libbbf_api/dmentry.h @@ -15,7 +15,7 @@ #ifndef __DMENTRY_H__ #define __DMENTRY_H__ -#include "libbbf_api/dmcommon.h" +#include "dmcommon.h" extern struct list_head head_package_change; extern struct list_head main_memhead; @@ -31,9 +31,9 @@ typedef enum { COMMAND_ONLY } schema_type_t; -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_ctx_init_entry(struct dmctx *ctx, DMOBJ tEntryObj[], unsigned int instance_mode); +int dm_ctx_init(struct dmctx *ctx, DMOBJ *tEntryObj, DM_MAP_VENDOR *tVendorExtension[], DM_MAP_VENDOR_EXCLUDE *tVendorExtensionExclude, unsigned int instance_mode); +int dm_ctx_init_sub(struct dmctx *ctx, DMOBJ *tEntryObj, DM_MAP_VENDOR *tVendorExtension[], DM_MAP_VENDOR_EXCLUDE *tVendorExtensionExclude, unsigned int instance_mode); +int dm_ctx_init_entry(struct dmctx *ctx, DMOBJ *tEntryObj, DM_MAP_VENDOR *tVendorExtension[], DM_MAP_VENDOR_EXCLUDE *tVendorExtensionExclude, 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); int dm_entry_restart_services(void); @@ -45,7 +45,7 @@ int dm_ctx_clean_sub(struct dmctx *ctx); int dm_get_supported_dm(struct dmctx *ctx, char *path, bool first_level, schema_type_t schema_type); void dm_config_ubus(struct ubus_context *ctx); int dm_ctx_init_cache(int time); -void bbf_dm_cleanup(void); +void bbf_dm_cleanup(DMOBJ *tEntryObj); /** * @brief dm_debug_browse_path @@ -64,5 +64,6 @@ void bbf_dm_cleanup(void); */ int dm_debug_browse_path(char *buff, size_t len); void dm_cleanup_dynamic_entry(DMOBJ *root); +int set_bbfdatamodel_type(int bbf_type); #endif diff --git a/include/libbbf_api.h b/libbbf_api/include/libbbf_api.h similarity index 100% rename from include/libbbf_api.h rename to libbbf_api/include/libbbf_api.h diff --git a/libbbf_dm/CMakeLists.txt b/libbbf_dm/CMakeLists.txt new file mode 100644 index 00000000..0b5d0843 --- /dev/null +++ b/libbbf_dm/CMakeLists.txt @@ -0,0 +1,111 @@ +cmake_minimum_required(VERSION 3.0) + +PROJECT(libbbf_dm) + +ADD_DEFINITIONS(-Wall -Werror) +ADD_DEFINITIONS(-D_GNU_SOURCE) +ADD_DEFINITIONS(-DBBF_VENDOR_PREFIX="${BBF_VENDOR_PREFIX}") + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${CMAKE_SOURCE_DIR} -I${CMAKE_CURRENT_SOURCE_DIR} -I${CMAKE_CURRENT_SOURCE_DIR}/dmtree") + +OPTION(BBF_TR181 "build with tr181 datamodel" ON) +OPTION(BBF_TR104 "build with tr104 datamodel" ON) +OPTION(BBF_TR143 "build with tr143 datamodel" ON) +OPTION(BBF_TR471 "build with tr471 datamodel" ON) +OPTION(BBF_VENDOR_EXTENSION "build with vendor extension enabled" ON) +OPTION(WITH_WOLFSSL "build with lib wolfssl" OFF) +OPTION(WITH_OPENSSL "build with lib openssl" OFF) +OPTION(WITH_MBEDTLS "build with lib mbedtls" OFF) + +IF(NOT WITH_WOLFSSL AND NOT WITH_OPENSSL AND NOT WITH_MBEDTLS) + MESSAGE(FATAL_ERROR "You must enable one of the SSL libraries: {'WOLFSSL','OPENSSL','MBEDTLS'}") +ENDIF() + +SET(BBF_DM_SOURCES dmdiagnostics.c) + +IF(BBF_TR181) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}/dmtree/tr181") + FILE(GLOB BBF_TR181_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/dmtree/tr181/*.c) + add_compile_definitions(BBF_TR181) +ENDIF(BBF_TR181) + +IF(BBF_TR104) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}/dmtree/tr104") + FILE(GLOB BBF_TR104_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/dmtree/tr104/*.c) + add_compile_definitions(BBF_TR104) +ENDIF(BBF_TR104) + +IF(BBF_TR143) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}/dmtree/tr143") + FILE(GLOB BBF_TR143_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/dmtree/tr143/*.c) + add_compile_definitions(BBF_TR143) +ENDIF(BBF_TR143) + +IF(BBF_TR471) + IF(NOT BBF_TR143) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}/dmtree/tr143") + FILE(GLOB BBF_TR143_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/dmtree/tr143/diagnostics.c) + ENDIF() + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}/dmtree/tr471") + FILE(GLOB BBF_TR471_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/dmtree/tr471/*.c) + add_compile_definitions(BBF_TR471) +ENDIF(BBF_TR471) + +IF(WITH_WOLFSSL) + SET(SSL_LIBS wolfssl) + add_compile_definitions(LWOLFSSL) +ENDIF(WITH_WOLFSSL) + +IF(WITH_OPENSSL) + SET(SSL_LIBS ssl) + add_compile_definitions(LOPENSSL) +ENDIF(WITH_OPENSSL) + +IF(WITH_MBEDTLS) + SET(SSL_LIBS mbedtls) + add_compile_definitions(LMBEDTLS) +ENDIF(WITH_MBEDTLS) + +IF(BBF_VENDOR_EXTENSION) + SET(BBF_VENDOR_EXTENSION_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/dmtree/vendor/vendor.c) + ADD_DEFINITIONS(-DBBF_VENDOR_LIST="${BBF_VENDOR_LIST}") + add_compile_definitions(BBF_VENDOR_EXTENSION) + + SET(BBF_VENDOR_LIST "iopsys" CACHE STRING "vendor list to be used") + + STRING(REPLACE "," ";" VENDOR_LIST ${BBF_VENDOR_LIST}) + + foreach(VENDOR IN LISTS VENDOR_LIST) + FILE(GLOB_RECURSE BBF_VENDOR_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/dmtree/vendor/${VENDOR}/*.c) + LIST(APPEND BBF_VENDOR_EXTENSION_SOURCES ${BBF_VENDOR_SOURCES}) + + STRING(TOUPPER ${VENDOR} VENDOR) + add_compile_definitions(BBF_VENDOR_${VENDOR}) + endforeach() +ENDIF(BBF_VENDOR_EXTENSION) + +ADD_LIBRARY(bbf_dm SHARED ${BBF_DM_SOURCES} ${BBF_TR181_SOURCES} ${BBF_TR104_SOURCES} ${BBF_TR143_SOURCES} ${BBF_TR471_SOURCES} ${BBF_VENDOR_EXTENSION_SOURCES}) + +TARGET_LINK_LIBRARIES(bbf_dm uci ubus ubox json-c blobmsg_json curl bbf_api ${SSL_LIBS}) + +INSTALL(TARGETS bbf_dm + LIBRARY DESTINATION usr/lib) + +INSTALL(DIRECTORY DESTINATION etc/bbfdm) +INSTALL(DIRECTORY DESTINATION etc/bbfdm/dmmap) +INSTALL(DIRECTORY DESTINATION etc/bbfdm/json) +INSTALL(DIRECTORY DESTINATION usr/lib/bbfdm) + +FILE(GLOB root_device dmtree/tr181/device.h dmtree/vendor/vendor.h) +INSTALL(FILES ${root_device} + DESTINATION usr/include/libbbf_dm +) + +IF(BBF_TR143) + INSTALL(DIRECTORY DESTINATION usr/share/bbfdm) + FILE(GLOB scripts scripts/*) + INSTALL(FILES ${scripts} + PERMISSIONS OWNER_EXECUTE + DESTINATION usr/share/bbfdm + ) +ENDIF(BBF_TR143) diff --git a/dmdiagnostics.c b/libbbf_dm/dmdiagnostics.c similarity index 99% rename from dmdiagnostics.c rename to libbbf_dm/dmdiagnostics.c index a65d1a71..d21fce05 100644 --- a/dmdiagnostics.c +++ b/libbbf_dm/dmdiagnostics.c @@ -27,7 +27,6 @@ #include #endif -#include "dmentry.h" #include "dmdiagnostics.h" #define READ_BUF_SIZE (1024 * 16) diff --git a/dmdiagnostics.h b/libbbf_dm/dmdiagnostics.h similarity index 100% rename from dmdiagnostics.h rename to libbbf_dm/dmdiagnostics.h diff --git a/dmtree/json/tr104.json b/libbbf_dm/dmtree/json/tr104.json similarity index 100% rename from dmtree/json/tr104.json rename to libbbf_dm/dmtree/json/tr104.json diff --git a/dmtree/json/tr181.json b/libbbf_dm/dmtree/json/tr181.json similarity index 100% rename from dmtree/json/tr181.json rename to libbbf_dm/dmtree/json/tr181.json diff --git a/dmtree/tr104/common.c b/libbbf_dm/dmtree/tr104/common.c similarity index 100% rename from dmtree/tr104/common.c rename to libbbf_dm/dmtree/tr104/common.c diff --git a/dmtree/tr104/common.h b/libbbf_dm/dmtree/tr104/common.h similarity index 100% rename from dmtree/tr104/common.h rename to libbbf_dm/dmtree/tr104/common.h diff --git a/dmtree/tr104/servicesvoiceservice.c b/libbbf_dm/dmtree/tr104/servicesvoiceservice.c similarity index 100% rename from dmtree/tr104/servicesvoiceservice.c rename to libbbf_dm/dmtree/tr104/servicesvoiceservice.c diff --git a/dmtree/tr104/servicesvoiceservice.h b/libbbf_dm/dmtree/tr104/servicesvoiceservice.h similarity index 100% rename from dmtree/tr104/servicesvoiceservice.h rename to libbbf_dm/dmtree/tr104/servicesvoiceservice.h diff --git a/dmtree/tr104/servicesvoiceservicecallcontrol.c b/libbbf_dm/dmtree/tr104/servicesvoiceservicecallcontrol.c similarity index 100% rename from dmtree/tr104/servicesvoiceservicecallcontrol.c rename to libbbf_dm/dmtree/tr104/servicesvoiceservicecallcontrol.c diff --git a/dmtree/tr104/servicesvoiceservicecallcontrol.h b/libbbf_dm/dmtree/tr104/servicesvoiceservicecallcontrol.h similarity index 100% rename from dmtree/tr104/servicesvoiceservicecallcontrol.h rename to libbbf_dm/dmtree/tr104/servicesvoiceservicecallcontrol.h diff --git a/dmtree/tr104/servicesvoiceservicecalllog.c b/libbbf_dm/dmtree/tr104/servicesvoiceservicecalllog.c similarity index 100% rename from dmtree/tr104/servicesvoiceservicecalllog.c rename to libbbf_dm/dmtree/tr104/servicesvoiceservicecalllog.c diff --git a/dmtree/tr104/servicesvoiceservicecalllog.h b/libbbf_dm/dmtree/tr104/servicesvoiceservicecalllog.h similarity index 100% rename from dmtree/tr104/servicesvoiceservicecalllog.h rename to libbbf_dm/dmtree/tr104/servicesvoiceservicecalllog.h diff --git a/dmtree/tr104/servicesvoiceservicecapabilities.c b/libbbf_dm/dmtree/tr104/servicesvoiceservicecapabilities.c similarity index 100% rename from dmtree/tr104/servicesvoiceservicecapabilities.c rename to libbbf_dm/dmtree/tr104/servicesvoiceservicecapabilities.c diff --git a/dmtree/tr104/servicesvoiceservicecapabilities.h b/libbbf_dm/dmtree/tr104/servicesvoiceservicecapabilities.h similarity index 100% rename from dmtree/tr104/servicesvoiceservicecapabilities.h rename to libbbf_dm/dmtree/tr104/servicesvoiceservicecapabilities.h diff --git a/dmtree/tr104/servicesvoiceservicecodecprofile.c b/libbbf_dm/dmtree/tr104/servicesvoiceservicecodecprofile.c similarity index 100% rename from dmtree/tr104/servicesvoiceservicecodecprofile.c rename to libbbf_dm/dmtree/tr104/servicesvoiceservicecodecprofile.c diff --git a/dmtree/tr104/servicesvoiceservicecodecprofile.h b/libbbf_dm/dmtree/tr104/servicesvoiceservicecodecprofile.h similarity index 100% rename from dmtree/tr104/servicesvoiceservicecodecprofile.h rename to libbbf_dm/dmtree/tr104/servicesvoiceservicecodecprofile.h diff --git a/dmtree/tr104/servicesvoiceservicedect.c b/libbbf_dm/dmtree/tr104/servicesvoiceservicedect.c similarity index 100% rename from dmtree/tr104/servicesvoiceservicedect.c rename to libbbf_dm/dmtree/tr104/servicesvoiceservicedect.c diff --git a/dmtree/tr104/servicesvoiceservicedect.h b/libbbf_dm/dmtree/tr104/servicesvoiceservicedect.h similarity index 100% rename from dmtree/tr104/servicesvoiceservicedect.h rename to libbbf_dm/dmtree/tr104/servicesvoiceservicedect.h diff --git a/dmtree/tr104/servicesvoiceservicepots.c b/libbbf_dm/dmtree/tr104/servicesvoiceservicepots.c similarity index 100% rename from dmtree/tr104/servicesvoiceservicepots.c rename to libbbf_dm/dmtree/tr104/servicesvoiceservicepots.c diff --git a/dmtree/tr104/servicesvoiceservicepots.h b/libbbf_dm/dmtree/tr104/servicesvoiceservicepots.h similarity index 100% rename from dmtree/tr104/servicesvoiceservicepots.h rename to libbbf_dm/dmtree/tr104/servicesvoiceservicepots.h diff --git a/dmtree/tr104/servicesvoiceservicereservedports.c b/libbbf_dm/dmtree/tr104/servicesvoiceservicereservedports.c similarity index 100% rename from dmtree/tr104/servicesvoiceservicereservedports.c rename to libbbf_dm/dmtree/tr104/servicesvoiceservicereservedports.c diff --git a/dmtree/tr104/servicesvoiceservicereservedports.h b/libbbf_dm/dmtree/tr104/servicesvoiceservicereservedports.h similarity index 100% rename from dmtree/tr104/servicesvoiceservicereservedports.h rename to libbbf_dm/dmtree/tr104/servicesvoiceservicereservedports.h diff --git a/dmtree/tr104/servicesvoiceservicesip.c b/libbbf_dm/dmtree/tr104/servicesvoiceservicesip.c similarity index 100% rename from dmtree/tr104/servicesvoiceservicesip.c rename to libbbf_dm/dmtree/tr104/servicesvoiceservicesip.c diff --git a/dmtree/tr104/servicesvoiceservicesip.h b/libbbf_dm/dmtree/tr104/servicesvoiceservicesip.h similarity index 100% rename from dmtree/tr104/servicesvoiceservicesip.h rename to libbbf_dm/dmtree/tr104/servicesvoiceservicesip.h diff --git a/dmtree/tr104/servicesvoiceservicevoipprofile.c b/libbbf_dm/dmtree/tr104/servicesvoiceservicevoipprofile.c similarity index 100% rename from dmtree/tr104/servicesvoiceservicevoipprofile.c rename to libbbf_dm/dmtree/tr104/servicesvoiceservicevoipprofile.c diff --git a/dmtree/tr104/servicesvoiceservicevoipprofile.h b/libbbf_dm/dmtree/tr104/servicesvoiceservicevoipprofile.h similarity index 100% rename from dmtree/tr104/servicesvoiceservicevoipprofile.h rename to libbbf_dm/dmtree/tr104/servicesvoiceservicevoipprofile.h diff --git a/dmtree/tr143/diagnostics.c b/libbbf_dm/dmtree/tr143/diagnostics.c similarity index 99% rename from dmtree/tr143/diagnostics.c rename to libbbf_dm/dmtree/tr143/diagnostics.c index 3a317897..8ff06639 100644 --- a/dmtree/tr143/diagnostics.c +++ b/libbbf_dm/dmtree/tr143/diagnostics.c @@ -10,7 +10,6 @@ */ #include "dmdiagnostics.h" -#include "dmbbfcommon.h" #include "diagnostics.h" #ifdef BBF_TR471 #include "iplayercap.h" diff --git a/dmtree/tr143/diagnostics.h b/libbbf_dm/dmtree/tr143/diagnostics.h similarity index 100% rename from dmtree/tr143/diagnostics.h rename to libbbf_dm/dmtree/tr143/diagnostics.h diff --git a/dmtree/tr181/atm.c b/libbbf_dm/dmtree/tr181/atm.c similarity index 100% rename from dmtree/tr181/atm.c rename to libbbf_dm/dmtree/tr181/atm.c diff --git a/dmtree/tr181/atm.h b/libbbf_dm/dmtree/tr181/atm.h similarity index 100% rename from dmtree/tr181/atm.h rename to libbbf_dm/dmtree/tr181/atm.h diff --git a/dmtree/tr181/bridging.c b/libbbf_dm/dmtree/tr181/bridging.c similarity index 100% rename from dmtree/tr181/bridging.c rename to libbbf_dm/dmtree/tr181/bridging.c diff --git a/dmtree/tr181/bridging.h b/libbbf_dm/dmtree/tr181/bridging.h similarity index 100% rename from dmtree/tr181/bridging.h rename to libbbf_dm/dmtree/tr181/bridging.h diff --git a/dmtree/tr181/device.c b/libbbf_dm/dmtree/tr181/device.c similarity index 100% rename from dmtree/tr181/device.c rename to libbbf_dm/dmtree/tr181/device.c diff --git a/dmtree/tr181/device.h b/libbbf_dm/dmtree/tr181/device.h similarity index 100% rename from dmtree/tr181/device.h rename to libbbf_dm/dmtree/tr181/device.h diff --git a/dmtree/tr181/deviceinfo.c b/libbbf_dm/dmtree/tr181/deviceinfo.c similarity index 100% rename from dmtree/tr181/deviceinfo.c rename to libbbf_dm/dmtree/tr181/deviceinfo.c diff --git a/dmtree/tr181/deviceinfo.h b/libbbf_dm/dmtree/tr181/deviceinfo.h similarity index 100% rename from dmtree/tr181/deviceinfo.h rename to libbbf_dm/dmtree/tr181/deviceinfo.h diff --git a/dmtree/tr181/dhcpv4.c b/libbbf_dm/dmtree/tr181/dhcpv4.c similarity index 100% rename from dmtree/tr181/dhcpv4.c rename to libbbf_dm/dmtree/tr181/dhcpv4.c diff --git a/dmtree/tr181/dhcpv4.h b/libbbf_dm/dmtree/tr181/dhcpv4.h similarity index 100% rename from dmtree/tr181/dhcpv4.h rename to libbbf_dm/dmtree/tr181/dhcpv4.h diff --git a/dmtree/tr181/dhcpv6.c b/libbbf_dm/dmtree/tr181/dhcpv6.c similarity index 100% rename from dmtree/tr181/dhcpv6.c rename to libbbf_dm/dmtree/tr181/dhcpv6.c diff --git a/dmtree/tr181/dhcpv6.h b/libbbf_dm/dmtree/tr181/dhcpv6.h similarity index 100% rename from dmtree/tr181/dhcpv6.h rename to libbbf_dm/dmtree/tr181/dhcpv6.h diff --git a/dmtree/tr181/dns.c b/libbbf_dm/dmtree/tr181/dns.c similarity index 99% rename from dmtree/tr181/dns.c rename to libbbf_dm/dmtree/tr181/dns.c index e63f6317..71eb1825 100644 --- a/dmtree/tr181/dns.c +++ b/libbbf_dm/dmtree/tr181/dns.c @@ -9,7 +9,6 @@ */ #include "dmdiagnostics.h" -#include "dmbbfcommon.h" #include "dns.h" /************************************************************* diff --git a/dmtree/tr181/dns.h b/libbbf_dm/dmtree/tr181/dns.h similarity index 100% rename from dmtree/tr181/dns.h rename to libbbf_dm/dmtree/tr181/dns.h diff --git a/dmtree/tr181/dsl.c b/libbbf_dm/dmtree/tr181/dsl.c similarity index 100% rename from dmtree/tr181/dsl.c rename to libbbf_dm/dmtree/tr181/dsl.c diff --git a/dmtree/tr181/dsl.h b/libbbf_dm/dmtree/tr181/dsl.h similarity index 100% rename from dmtree/tr181/dsl.h rename to libbbf_dm/dmtree/tr181/dsl.h diff --git a/dmtree/tr181/dynamicdns.c b/libbbf_dm/dmtree/tr181/dynamicdns.c similarity index 100% rename from dmtree/tr181/dynamicdns.c rename to libbbf_dm/dmtree/tr181/dynamicdns.c diff --git a/dmtree/tr181/dynamicdns.h b/libbbf_dm/dmtree/tr181/dynamicdns.h similarity index 100% rename from dmtree/tr181/dynamicdns.h rename to libbbf_dm/dmtree/tr181/dynamicdns.h diff --git a/dmtree/tr181/ethernet.c b/libbbf_dm/dmtree/tr181/ethernet.c similarity index 100% rename from dmtree/tr181/ethernet.c rename to libbbf_dm/dmtree/tr181/ethernet.c diff --git a/dmtree/tr181/ethernet.h b/libbbf_dm/dmtree/tr181/ethernet.h similarity index 100% rename from dmtree/tr181/ethernet.h rename to libbbf_dm/dmtree/tr181/ethernet.h diff --git a/dmtree/tr181/fast.c b/libbbf_dm/dmtree/tr181/fast.c similarity index 100% rename from dmtree/tr181/fast.c rename to libbbf_dm/dmtree/tr181/fast.c diff --git a/dmtree/tr181/fast.h b/libbbf_dm/dmtree/tr181/fast.h similarity index 100% rename from dmtree/tr181/fast.h rename to libbbf_dm/dmtree/tr181/fast.h diff --git a/dmtree/tr181/firewall.c b/libbbf_dm/dmtree/tr181/firewall.c similarity index 100% rename from dmtree/tr181/firewall.c rename to libbbf_dm/dmtree/tr181/firewall.c diff --git a/dmtree/tr181/firewall.h b/libbbf_dm/dmtree/tr181/firewall.h similarity index 100% rename from dmtree/tr181/firewall.h rename to libbbf_dm/dmtree/tr181/firewall.h diff --git a/dmtree/tr181/gatewayinfo.c b/libbbf_dm/dmtree/tr181/gatewayinfo.c similarity index 98% rename from dmtree/tr181/gatewayinfo.c rename to libbbf_dm/dmtree/tr181/gatewayinfo.c index 92fb5169..8bfbfb66 100644 --- a/dmtree/tr181/gatewayinfo.c +++ b/libbbf_dm/dmtree/tr181/gatewayinfo.c @@ -9,7 +9,6 @@ */ #include "gatewayinfo.h" -#include "dmbbfcommon.h" static int get_manufacturer_oui(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { diff --git a/dmtree/tr181/gatewayinfo.h b/libbbf_dm/dmtree/tr181/gatewayinfo.h similarity index 100% rename from dmtree/tr181/gatewayinfo.h rename to libbbf_dm/dmtree/tr181/gatewayinfo.h diff --git a/dmtree/tr181/gre.c b/libbbf_dm/dmtree/tr181/gre.c similarity index 100% rename from dmtree/tr181/gre.c rename to libbbf_dm/dmtree/tr181/gre.c diff --git a/dmtree/tr181/gre.h b/libbbf_dm/dmtree/tr181/gre.h similarity index 100% rename from dmtree/tr181/gre.h rename to libbbf_dm/dmtree/tr181/gre.h diff --git a/dmtree/tr181/hosts.c b/libbbf_dm/dmtree/tr181/hosts.c similarity index 100% rename from dmtree/tr181/hosts.c rename to libbbf_dm/dmtree/tr181/hosts.c diff --git a/dmtree/tr181/hosts.h b/libbbf_dm/dmtree/tr181/hosts.h similarity index 100% rename from dmtree/tr181/hosts.h rename to libbbf_dm/dmtree/tr181/hosts.h diff --git a/dmtree/tr181/ieee1905.c b/libbbf_dm/dmtree/tr181/ieee1905.c similarity index 100% rename from dmtree/tr181/ieee1905.c rename to libbbf_dm/dmtree/tr181/ieee1905.c diff --git a/dmtree/tr181/ieee1905.h b/libbbf_dm/dmtree/tr181/ieee1905.h similarity index 100% rename from dmtree/tr181/ieee1905.h rename to libbbf_dm/dmtree/tr181/ieee1905.h diff --git a/dmtree/tr181/interfacestack.c b/libbbf_dm/dmtree/tr181/interfacestack.c similarity index 100% rename from dmtree/tr181/interfacestack.c rename to libbbf_dm/dmtree/tr181/interfacestack.c diff --git a/dmtree/tr181/interfacestack.h b/libbbf_dm/dmtree/tr181/interfacestack.h similarity index 100% rename from dmtree/tr181/interfacestack.h rename to libbbf_dm/dmtree/tr181/interfacestack.h diff --git a/dmtree/tr181/ip.c b/libbbf_dm/dmtree/tr181/ip.c similarity index 100% rename from dmtree/tr181/ip.c rename to libbbf_dm/dmtree/tr181/ip.c diff --git a/dmtree/tr181/ip.h b/libbbf_dm/dmtree/tr181/ip.h similarity index 100% rename from dmtree/tr181/ip.h rename to libbbf_dm/dmtree/tr181/ip.h diff --git a/dmtree/tr181/lanconfigsecurity.c b/libbbf_dm/dmtree/tr181/lanconfigsecurity.c similarity index 100% rename from dmtree/tr181/lanconfigsecurity.c rename to libbbf_dm/dmtree/tr181/lanconfigsecurity.c diff --git a/dmtree/tr181/lanconfigsecurity.h b/libbbf_dm/dmtree/tr181/lanconfigsecurity.h similarity index 100% rename from dmtree/tr181/lanconfigsecurity.h rename to libbbf_dm/dmtree/tr181/lanconfigsecurity.h diff --git a/dmtree/tr181/mqtt.c b/libbbf_dm/dmtree/tr181/mqtt.c similarity index 80% rename from dmtree/tr181/mqtt.c rename to libbbf_dm/dmtree/tr181/mqtt.c index 7d152053..f7715761 100644 --- a/dmtree/tr181/mqtt.c +++ b/libbbf_dm/dmtree/tr181/mqtt.c @@ -8,7 +8,6 @@ * Author: Suvendhu Hansa */ -#include "include/libbbf_api.h" #include "mqtt.h" static bool duplicate_entry_exist(char *name, char *section_type) @@ -37,13 +36,13 @@ static int addMQTTBroker(char *refparam, struct dmctx *ctx, void *data, char **i snprintf(sec_name, sizeof(sec_name), "broker_%s", *instance); - if (bbf_uci_add_section("mosquitto", "listener", &s) == 0) { - bbf_uci_rename_section(s, sec_name); - bbf_uci_set_value_by_section(s, "enabled", "0"); - bbf_uci_set_value_by_section(s, "port", "1883"); - bbf_uci_add_section_bbfdm("dmmap_mqtt", "listener", &dmmap_broker); - bbf_uci_set_value_by_section(dmmap_broker, "section_name", sec_name); - bbf_uci_set_value_by_section(dmmap_broker, "listener_instance", *instance); + if (dmuci_add_section("mosquitto", "listener", &s) == 0) { + dmuci_rename_section_by_section(s, sec_name); + dmuci_set_value_by_section(s, "enabled", "0"); + dmuci_set_value_by_section(s, "port", "1883"); + dmuci_add_section_bbfdm("dmmap_mqtt", "listener", &dmmap_broker); + dmuci_set_value_by_section(dmmap_broker, "section_name", sec_name); + dmuci_set_value_by_section(dmmap_broker, "listener_instance", *instance); } return 0; @@ -55,15 +54,15 @@ static int delMQTTBroker(char *refparam, struct dmctx *ctx, void *data, char *in switch (del_action) { case DEL_INST: - bbf_uci_delete_section_by_section(((struct dmmap_dup *)data)->config_section, NULL, NULL); - bbf_uci_delete_section_by_section(((struct dmmap_dup *)data)->dmmap_section, NULL, NULL); + dmuci_delete_by_section(((struct dmmap_dup *)data)->config_section, NULL, NULL); + dmuci_delete_by_section(((struct dmmap_dup *)data)->dmmap_section, NULL, NULL); break; case DEL_ALL: - bbf_uci_foreach_sections_safe("mosquitto", "listener", stmp, s) { + uci_foreach_sections_safe("mosquitto", "listener", stmp, s) { struct uci_section *dmmap_section = NULL; get_dmmap_section_of_config_section("dmmap_mqtt", "listener", section_name(s), &dmmap_section); - bbf_uci_delete_section_by_section(s, NULL, NULL); - bbf_uci_delete_section_by_section(dmmap_section, NULL, NULL); + dmuci_delete_by_section(s, NULL, NULL); + dmuci_delete_by_section(dmmap_section, NULL, NULL); } break; } @@ -96,14 +95,14 @@ static int browseMQTTBrokerInst(struct dmctx *dmctx, DMNODE *parent_node, void * **************************************************************/ static int get_MQTT_BrokerNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - int cnt = bbf_get_number_of_entries(ctx, data, instance, browseMQTTBrokerInst); + int cnt = get_number_of_entries(ctx, data, instance, browseMQTTBrokerInst); dmasprintf(value, "%d", cnt); return 0; } static int get_MQTTBroker_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - bbf_uci_get_value_by_section(((struct dmmap_dup *)data)->dmmap_section, "listener_alias", value); + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->dmmap_section, "listener_alias", value); if ((*value)[0] == '\0') dmasprintf(value, "cpe-%s", instance); return 0; @@ -117,7 +116,7 @@ static int set_MQTTBroker_Alias(char *refparam, struct dmctx *ctx, void *data, c return FAULT_9007; break; case VALUESET: - bbf_uci_set_value_by_section(((struct dmmap_dup *)data)->dmmap_section, "listener_alias", value); + dmuci_set_value_by_section(((struct dmmap_dup *)data)->dmmap_section, "listener_alias", value); return 0; } return 0; @@ -125,7 +124,7 @@ static int set_MQTTBroker_Alias(char *refparam, struct dmctx *ctx, void *data, c static int get_MQTTBroker_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = bbf_uci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "enabled", "0"); + *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "enabled", "0"); return 0; } @@ -139,7 +138,7 @@ static int set_MQTTBroker_Enable(char *refparam, struct dmctx *ctx, void *data, break; case VALUESET: string_to_bool(value, &b); - bbf_uci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "enabled", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "enabled", b ? "1" : "0"); break; } return 0; @@ -147,7 +146,7 @@ static int set_MQTTBroker_Enable(char *refparam, struct dmctx *ctx, void *data, static int get_MQTTBroker_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - bbf_uci_get_value_by_section(((struct dmmap_dup *)data)->dmmap_section, "section_name", value); + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->dmmap_section, "section_name", value); return 0; } @@ -181,11 +180,11 @@ static int set_MQTTBroker_Name(char *refparam, struct dmctx *ctx, void *data, ch break; // Update mosquitto config - if (0 != bbf_uci_rename_section(((struct dmmap_dup *)data)->config_section, value)) + if (0 != dmuci_rename_section_by_section(((struct dmmap_dup *)data)->config_section, value)) return FAULT_9001; // Update dmmap_mqtt file - bbf_uci_set_value_by_section(((struct dmmap_dup *)data)->dmmap_section, "section_name", value); + dmuci_set_value_by_section(((struct dmmap_dup *)data)->dmmap_section, "section_name", value); break; } @@ -194,7 +193,7 @@ static int set_MQTTBroker_Name(char *refparam, struct dmctx *ctx, void *data, ch static int get_MQTTBroker_Port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - bbf_uci_get_value_by_section(((struct dmmap_dup *)data)->config_section, "port", value); + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "port", value); return 0; } @@ -206,7 +205,7 @@ static int set_MQTTBroker_Port(char *refparam, struct dmctx *ctx, void *data, ch return FAULT_9007; break; case VALUESET: - bbf_uci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "port", value); + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "port", value); break; } return 0; @@ -216,7 +215,7 @@ static int get_MQTTBroker_Interface(char *refparam, struct dmctx *ctx, void *dat { char *intf = NULL; - bbf_uci_get_value_by_section(((struct dmmap_dup *)data)->config_section, "interface", &intf); + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "interface", &intf); if (DM_STRLEN(intf) == 0) return 0; @@ -241,7 +240,7 @@ static int set_MQTTBroker_Interface(char *refparam, struct dmctx *ctx, void *dat case VALUESET: adm_entry_get_linker_value(ctx, value, &iface); if (DM_STRLEN(iface) != 0) - bbf_uci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "interface", iface); + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "interface", iface); break; } return 0; @@ -249,7 +248,7 @@ static int set_MQTTBroker_Interface(char *refparam, struct dmctx *ctx, void *dat static int get_MQTTBroker_Username(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - bbf_uci_get_value_by_section(((struct dmmap_dup *)data)->config_section, "username", value); + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "username", value); return 0; } @@ -265,7 +264,7 @@ static int set_MQTTBroker_Username(char *refparam, struct dmctx *ctx, void *data return FAULT_9007; break; case VALUESET: - bbf_uci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "username", value); + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "username", value); break; } return 0; @@ -285,7 +284,7 @@ static int set_MQTTBroker_Password(char *refparam, struct dmctx *ctx, void *data return FAULT_9007; break; case VALUESET: - bbf_uci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "password", value); + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "password", value); break; } return 0; diff --git a/dmtree/tr181/mqtt.h b/libbbf_dm/dmtree/tr181/mqtt.h similarity index 100% rename from dmtree/tr181/mqtt.h rename to libbbf_dm/dmtree/tr181/mqtt.h diff --git a/dmtree/tr181/nat.c b/libbbf_dm/dmtree/tr181/nat.c similarity index 100% rename from dmtree/tr181/nat.c rename to libbbf_dm/dmtree/tr181/nat.c diff --git a/dmtree/tr181/nat.h b/libbbf_dm/dmtree/tr181/nat.h similarity index 100% rename from dmtree/tr181/nat.h rename to libbbf_dm/dmtree/tr181/nat.h diff --git a/dmtree/tr181/ppp.c b/libbbf_dm/dmtree/tr181/ppp.c similarity index 100% rename from dmtree/tr181/ppp.c rename to libbbf_dm/dmtree/tr181/ppp.c diff --git a/dmtree/tr181/ppp.h b/libbbf_dm/dmtree/tr181/ppp.h similarity index 100% rename from dmtree/tr181/ppp.h rename to libbbf_dm/dmtree/tr181/ppp.h diff --git a/dmtree/tr181/ptm.c b/libbbf_dm/dmtree/tr181/ptm.c similarity index 100% rename from dmtree/tr181/ptm.c rename to libbbf_dm/dmtree/tr181/ptm.c diff --git a/dmtree/tr181/ptm.h b/libbbf_dm/dmtree/tr181/ptm.h similarity index 100% rename from dmtree/tr181/ptm.h rename to libbbf_dm/dmtree/tr181/ptm.h diff --git a/dmtree/tr181/qos.c b/libbbf_dm/dmtree/tr181/qos.c similarity index 100% rename from dmtree/tr181/qos.c rename to libbbf_dm/dmtree/tr181/qos.c diff --git a/dmtree/tr181/qos.h b/libbbf_dm/dmtree/tr181/qos.h similarity index 100% rename from dmtree/tr181/qos.h rename to libbbf_dm/dmtree/tr181/qos.h diff --git a/dmtree/tr181/routeradvertisement.c b/libbbf_dm/dmtree/tr181/routeradvertisement.c similarity index 100% rename from dmtree/tr181/routeradvertisement.c rename to libbbf_dm/dmtree/tr181/routeradvertisement.c diff --git a/dmtree/tr181/routeradvertisement.h b/libbbf_dm/dmtree/tr181/routeradvertisement.h similarity index 100% rename from dmtree/tr181/routeradvertisement.h rename to libbbf_dm/dmtree/tr181/routeradvertisement.h diff --git a/dmtree/tr181/routing.c b/libbbf_dm/dmtree/tr181/routing.c similarity index 100% rename from dmtree/tr181/routing.c rename to libbbf_dm/dmtree/tr181/routing.c diff --git a/dmtree/tr181/routing.h b/libbbf_dm/dmtree/tr181/routing.h similarity index 100% rename from dmtree/tr181/routing.h rename to libbbf_dm/dmtree/tr181/routing.h diff --git a/dmtree/tr181/security.c b/libbbf_dm/dmtree/tr181/security.c similarity index 100% rename from dmtree/tr181/security.c rename to libbbf_dm/dmtree/tr181/security.c diff --git a/dmtree/tr181/security.h b/libbbf_dm/dmtree/tr181/security.h similarity index 100% rename from dmtree/tr181/security.h rename to libbbf_dm/dmtree/tr181/security.h diff --git a/dmtree/tr181/ssh.c b/libbbf_dm/dmtree/tr181/ssh.c similarity index 99% rename from dmtree/tr181/ssh.c rename to libbbf_dm/dmtree/tr181/ssh.c index 15923b87..6d98967f 100644 --- a/dmtree/tr181/ssh.c +++ b/libbbf_dm/dmtree/tr181/ssh.c @@ -9,7 +9,6 @@ * */ -#include "dmbbfcommon.h" #include "ssh.h" #define DROPBEAR_KEY_FILE "/etc/dropbear/authorized_keys" diff --git a/dmtree/tr181/ssh.h b/libbbf_dm/dmtree/tr181/ssh.h similarity index 100% rename from dmtree/tr181/ssh.h rename to libbbf_dm/dmtree/tr181/ssh.h diff --git a/dmtree/tr181/times.c b/libbbf_dm/dmtree/tr181/times.c similarity index 100% rename from dmtree/tr181/times.c rename to libbbf_dm/dmtree/tr181/times.c diff --git a/dmtree/tr181/times.h b/libbbf_dm/dmtree/tr181/times.h similarity index 100% rename from dmtree/tr181/times.h rename to libbbf_dm/dmtree/tr181/times.h diff --git a/dmtree/tr181/upnp.c b/libbbf_dm/dmtree/tr181/upnp.c similarity index 100% rename from dmtree/tr181/upnp.c rename to libbbf_dm/dmtree/tr181/upnp.c diff --git a/dmtree/tr181/upnp.h b/libbbf_dm/dmtree/tr181/upnp.h similarity index 100% rename from dmtree/tr181/upnp.h rename to libbbf_dm/dmtree/tr181/upnp.h diff --git a/dmtree/tr181/usb.c b/libbbf_dm/dmtree/tr181/usb.c similarity index 100% rename from dmtree/tr181/usb.c rename to libbbf_dm/dmtree/tr181/usb.c diff --git a/dmtree/tr181/usb.h b/libbbf_dm/dmtree/tr181/usb.h similarity index 100% rename from dmtree/tr181/usb.h rename to libbbf_dm/dmtree/tr181/usb.h diff --git a/dmtree/tr181/userinterface.c b/libbbf_dm/dmtree/tr181/userinterface.c similarity index 100% rename from dmtree/tr181/userinterface.c rename to libbbf_dm/dmtree/tr181/userinterface.c diff --git a/dmtree/tr181/userinterface.h b/libbbf_dm/dmtree/tr181/userinterface.h similarity index 100% rename from dmtree/tr181/userinterface.h rename to libbbf_dm/dmtree/tr181/userinterface.h diff --git a/dmtree/tr181/wifi.c b/libbbf_dm/dmtree/tr181/wifi.c similarity index 99% rename from dmtree/tr181/wifi.c rename to libbbf_dm/dmtree/tr181/wifi.c index 4261be8b..8224a117 100644 --- a/dmtree/tr181/wifi.c +++ b/libbbf_dm/dmtree/tr181/wifi.c @@ -13,7 +13,6 @@ */ #include "wifi.h" -#include "dmbbfcommon.h" struct wifi_radio_args { diff --git a/dmtree/tr181/wifi.h b/libbbf_dm/dmtree/tr181/wifi.h similarity index 100% rename from dmtree/tr181/wifi.h rename to libbbf_dm/dmtree/tr181/wifi.h diff --git a/dmtree/tr471/iplayercap.c b/libbbf_dm/dmtree/tr471/iplayercap.c similarity index 99% rename from dmtree/tr471/iplayercap.c rename to libbbf_dm/dmtree/tr471/iplayercap.c index 1b910a37..aaf5cc2b 100644 --- a/dmtree/tr471/iplayercap.c +++ b/libbbf_dm/dmtree/tr471/iplayercap.c @@ -10,7 +10,6 @@ */ #include "dmdiagnostics.h" -#include "dmbbfcommon.h" #include "iplayercap.h" #define IPLAYER_CAP_DIAGNOSTIC_PATH "/usr/share/bbfdm/iplayercap" diff --git a/dmtree/tr471/iplayercap.h b/libbbf_dm/dmtree/tr471/iplayercap.h similarity index 100% rename from dmtree/tr471/iplayercap.h rename to libbbf_dm/dmtree/tr471/iplayercap.h diff --git a/dmtree/vendor/iopsys/tr104/servicesvoiceservicecallcontrol.c b/libbbf_dm/dmtree/vendor/iopsys/tr104/servicesvoiceservicecallcontrol.c similarity index 100% rename from dmtree/vendor/iopsys/tr104/servicesvoiceservicecallcontrol.c rename to libbbf_dm/dmtree/vendor/iopsys/tr104/servicesvoiceservicecallcontrol.c diff --git a/dmtree/vendor/iopsys/tr104/servicesvoiceservicecallcontrol.h b/libbbf_dm/dmtree/vendor/iopsys/tr104/servicesvoiceservicecallcontrol.h similarity index 100% rename from dmtree/vendor/iopsys/tr104/servicesvoiceservicecallcontrol.h rename to libbbf_dm/dmtree/vendor/iopsys/tr104/servicesvoiceservicecallcontrol.h diff --git a/dmtree/vendor/iopsys/tr104/servicesvoiceservicecalllog.c b/libbbf_dm/dmtree/vendor/iopsys/tr104/servicesvoiceservicecalllog.c similarity index 100% rename from dmtree/vendor/iopsys/tr104/servicesvoiceservicecalllog.c rename to libbbf_dm/dmtree/vendor/iopsys/tr104/servicesvoiceservicecalllog.c diff --git a/dmtree/vendor/iopsys/tr104/servicesvoiceservicecalllog.h b/libbbf_dm/dmtree/vendor/iopsys/tr104/servicesvoiceservicecalllog.h similarity index 100% rename from dmtree/vendor/iopsys/tr104/servicesvoiceservicecalllog.h rename to libbbf_dm/dmtree/vendor/iopsys/tr104/servicesvoiceservicecalllog.h diff --git a/dmtree/vendor/iopsys/tr104/servicesvoiceservicedect.c b/libbbf_dm/dmtree/vendor/iopsys/tr104/servicesvoiceservicedect.c similarity index 100% rename from dmtree/vendor/iopsys/tr104/servicesvoiceservicedect.c rename to libbbf_dm/dmtree/vendor/iopsys/tr104/servicesvoiceservicedect.c diff --git a/dmtree/vendor/iopsys/tr104/servicesvoiceservicedect.h b/libbbf_dm/dmtree/vendor/iopsys/tr104/servicesvoiceservicedect.h similarity index 100% rename from dmtree/vendor/iopsys/tr104/servicesvoiceservicedect.h rename to libbbf_dm/dmtree/vendor/iopsys/tr104/servicesvoiceservicedect.h diff --git a/dmtree/vendor/iopsys/tr181/bridging.c b/libbbf_dm/dmtree/vendor/iopsys/tr181/bridging.c similarity index 100% rename from dmtree/vendor/iopsys/tr181/bridging.c rename to libbbf_dm/dmtree/vendor/iopsys/tr181/bridging.c diff --git a/dmtree/vendor/iopsys/tr181/bridging.h b/libbbf_dm/dmtree/vendor/iopsys/tr181/bridging.h similarity index 100% rename from dmtree/vendor/iopsys/tr181/bridging.h rename to libbbf_dm/dmtree/vendor/iopsys/tr181/bridging.h diff --git a/dmtree/vendor/iopsys/tr181/device.c b/libbbf_dm/dmtree/vendor/iopsys/tr181/device.c similarity index 100% rename from dmtree/vendor/iopsys/tr181/device.c rename to libbbf_dm/dmtree/vendor/iopsys/tr181/device.c diff --git a/dmtree/vendor/iopsys/tr181/device.h b/libbbf_dm/dmtree/vendor/iopsys/tr181/device.h similarity index 100% rename from dmtree/vendor/iopsys/tr181/device.h rename to libbbf_dm/dmtree/vendor/iopsys/tr181/device.h diff --git a/dmtree/vendor/iopsys/tr181/deviceinfo.c b/libbbf_dm/dmtree/vendor/iopsys/tr181/deviceinfo.c similarity index 100% rename from dmtree/vendor/iopsys/tr181/deviceinfo.c rename to libbbf_dm/dmtree/vendor/iopsys/tr181/deviceinfo.c diff --git a/dmtree/vendor/iopsys/tr181/deviceinfo.h b/libbbf_dm/dmtree/vendor/iopsys/tr181/deviceinfo.h similarity index 100% rename from dmtree/vendor/iopsys/tr181/deviceinfo.h rename to libbbf_dm/dmtree/vendor/iopsys/tr181/deviceinfo.h diff --git a/dmtree/vendor/iopsys/tr181/ethernet.c b/libbbf_dm/dmtree/vendor/iopsys/tr181/ethernet.c similarity index 100% rename from dmtree/vendor/iopsys/tr181/ethernet.c rename to libbbf_dm/dmtree/vendor/iopsys/tr181/ethernet.c diff --git a/dmtree/vendor/iopsys/tr181/ethernet.h b/libbbf_dm/dmtree/vendor/iopsys/tr181/ethernet.h similarity index 100% rename from dmtree/vendor/iopsys/tr181/ethernet.h rename to libbbf_dm/dmtree/vendor/iopsys/tr181/ethernet.h diff --git a/dmtree/vendor/iopsys/tr181/times.c b/libbbf_dm/dmtree/vendor/iopsys/tr181/times.c similarity index 100% rename from dmtree/vendor/iopsys/tr181/times.c rename to libbbf_dm/dmtree/vendor/iopsys/tr181/times.c diff --git a/dmtree/vendor/iopsys/tr181/times.h b/libbbf_dm/dmtree/vendor/iopsys/tr181/times.h similarity index 100% rename from dmtree/vendor/iopsys/tr181/times.h rename to libbbf_dm/dmtree/vendor/iopsys/tr181/times.h diff --git a/dmtree/vendor/iopsys/tr181/vendor.c b/libbbf_dm/dmtree/vendor/iopsys/tr181/vendor.c similarity index 100% rename from dmtree/vendor/iopsys/tr181/vendor.c rename to libbbf_dm/dmtree/vendor/iopsys/tr181/vendor.c diff --git a/dmtree/vendor/iopsys/tr181/vendor.h b/libbbf_dm/dmtree/vendor/iopsys/tr181/vendor.h similarity index 100% rename from dmtree/vendor/iopsys/tr181/vendor.h rename to libbbf_dm/dmtree/vendor/iopsys/tr181/vendor.h diff --git a/dmtree/vendor/iopsys/tr181/wifi.c b/libbbf_dm/dmtree/vendor/iopsys/tr181/wifi.c similarity index 100% rename from dmtree/vendor/iopsys/tr181/wifi.c rename to libbbf_dm/dmtree/vendor/iopsys/tr181/wifi.c diff --git a/dmtree/vendor/iopsys/tr181/wifi.h b/libbbf_dm/dmtree/vendor/iopsys/tr181/wifi.h similarity index 100% rename from dmtree/vendor/iopsys/tr181/wifi.h rename to libbbf_dm/dmtree/vendor/iopsys/tr181/wifi.h diff --git a/dmtree/vendor/iopsys/tr181/x_iopsys_eu_igmp.c b/libbbf_dm/dmtree/vendor/iopsys/tr181/x_iopsys_eu_igmp.c similarity index 100% rename from dmtree/vendor/iopsys/tr181/x_iopsys_eu_igmp.c rename to libbbf_dm/dmtree/vendor/iopsys/tr181/x_iopsys_eu_igmp.c diff --git a/dmtree/vendor/iopsys/tr181/x_iopsys_eu_igmp.h b/libbbf_dm/dmtree/vendor/iopsys/tr181/x_iopsys_eu_igmp.h similarity index 100% rename from dmtree/vendor/iopsys/tr181/x_iopsys_eu_igmp.h rename to libbbf_dm/dmtree/vendor/iopsys/tr181/x_iopsys_eu_igmp.h diff --git a/dmtree/vendor/iopsys/tr181/x_iopsys_eu_mld.c b/libbbf_dm/dmtree/vendor/iopsys/tr181/x_iopsys_eu_mld.c similarity index 100% rename from dmtree/vendor/iopsys/tr181/x_iopsys_eu_mld.c rename to libbbf_dm/dmtree/vendor/iopsys/tr181/x_iopsys_eu_mld.c diff --git a/dmtree/vendor/iopsys/tr181/x_iopsys_eu_mld.h b/libbbf_dm/dmtree/vendor/iopsys/tr181/x_iopsys_eu_mld.h similarity index 100% rename from dmtree/vendor/iopsys/tr181/x_iopsys_eu_mld.h rename to libbbf_dm/dmtree/vendor/iopsys/tr181/x_iopsys_eu_mld.h diff --git a/dmtree/vendor/iopsys/vendor.json b/libbbf_dm/dmtree/vendor/iopsys/vendor.json similarity index 100% rename from dmtree/vendor/iopsys/vendor.json rename to libbbf_dm/dmtree/vendor/iopsys/vendor.json diff --git a/dmtree/vendor/openwrt/tr181/deviceinfo.c b/libbbf_dm/dmtree/vendor/openwrt/tr181/deviceinfo.c similarity index 100% rename from dmtree/vendor/openwrt/tr181/deviceinfo.c rename to libbbf_dm/dmtree/vendor/openwrt/tr181/deviceinfo.c diff --git a/dmtree/vendor/openwrt/tr181/deviceinfo.h b/libbbf_dm/dmtree/vendor/openwrt/tr181/deviceinfo.h similarity index 100% rename from dmtree/vendor/openwrt/tr181/deviceinfo.h rename to libbbf_dm/dmtree/vendor/openwrt/tr181/deviceinfo.h diff --git a/dmtree/vendor/openwrt/tr181/qos.c b/libbbf_dm/dmtree/vendor/openwrt/tr181/qos.c similarity index 100% rename from dmtree/vendor/openwrt/tr181/qos.c rename to libbbf_dm/dmtree/vendor/openwrt/tr181/qos.c diff --git a/dmtree/vendor/openwrt/tr181/qos.h b/libbbf_dm/dmtree/vendor/openwrt/tr181/qos.h similarity index 100% rename from dmtree/vendor/openwrt/tr181/qos.h rename to libbbf_dm/dmtree/vendor/openwrt/tr181/qos.h diff --git a/dmtree/vendor/openwrt/tr181/vendor.c b/libbbf_dm/dmtree/vendor/openwrt/tr181/vendor.c similarity index 100% rename from dmtree/vendor/openwrt/tr181/vendor.c rename to libbbf_dm/dmtree/vendor/openwrt/tr181/vendor.c diff --git a/dmtree/vendor/openwrt/tr181/vendor.h b/libbbf_dm/dmtree/vendor/openwrt/tr181/vendor.h similarity index 100% rename from dmtree/vendor/openwrt/tr181/vendor.h rename to libbbf_dm/dmtree/vendor/openwrt/tr181/vendor.h diff --git a/dmtree/vendor/test/tr181/device.c b/libbbf_dm/dmtree/vendor/test/tr181/device.c similarity index 100% rename from dmtree/vendor/test/tr181/device.c rename to libbbf_dm/dmtree/vendor/test/tr181/device.c diff --git a/dmtree/vendor/test/tr181/device.h b/libbbf_dm/dmtree/vendor/test/tr181/device.h similarity index 100% rename from dmtree/vendor/test/tr181/device.h rename to libbbf_dm/dmtree/vendor/test/tr181/device.h diff --git a/dmtree/vendor/test/tr181/deviceinfo.c b/libbbf_dm/dmtree/vendor/test/tr181/deviceinfo.c similarity index 100% rename from dmtree/vendor/test/tr181/deviceinfo.c rename to libbbf_dm/dmtree/vendor/test/tr181/deviceinfo.c diff --git a/dmtree/vendor/test/tr181/deviceinfo.h b/libbbf_dm/dmtree/vendor/test/tr181/deviceinfo.h similarity index 100% rename from dmtree/vendor/test/tr181/deviceinfo.h rename to libbbf_dm/dmtree/vendor/test/tr181/deviceinfo.h diff --git a/dmtree/vendor/test/tr181/firewall.c b/libbbf_dm/dmtree/vendor/test/tr181/firewall.c similarity index 100% rename from dmtree/vendor/test/tr181/firewall.c rename to libbbf_dm/dmtree/vendor/test/tr181/firewall.c diff --git a/dmtree/vendor/test/tr181/firewall.h b/libbbf_dm/dmtree/vendor/test/tr181/firewall.h similarity index 100% rename from dmtree/vendor/test/tr181/firewall.h rename to libbbf_dm/dmtree/vendor/test/tr181/firewall.h diff --git a/dmtree/vendor/test/tr181/vendor.c b/libbbf_dm/dmtree/vendor/test/tr181/vendor.c similarity index 100% rename from dmtree/vendor/test/tr181/vendor.c rename to libbbf_dm/dmtree/vendor/test/tr181/vendor.c diff --git a/dmtree/vendor/test/tr181/vendor.h b/libbbf_dm/dmtree/vendor/test/tr181/vendor.h similarity index 100% rename from dmtree/vendor/test/tr181/vendor.h rename to libbbf_dm/dmtree/vendor/test/tr181/vendor.h diff --git a/dmtree/vendor/test/tr181/x_test_com_dropbear.c b/libbbf_dm/dmtree/vendor/test/tr181/x_test_com_dropbear.c similarity index 100% rename from dmtree/vendor/test/tr181/x_test_com_dropbear.c rename to libbbf_dm/dmtree/vendor/test/tr181/x_test_com_dropbear.c diff --git a/dmtree/vendor/test/tr181/x_test_com_dropbear.h b/libbbf_dm/dmtree/vendor/test/tr181/x_test_com_dropbear.h similarity index 100% rename from dmtree/vendor/test/tr181/x_test_com_dropbear.h rename to libbbf_dm/dmtree/vendor/test/tr181/x_test_com_dropbear.h diff --git a/dmtree/vendor/vendor.c b/libbbf_dm/dmtree/vendor/vendor.c similarity index 100% rename from dmtree/vendor/vendor.c rename to libbbf_dm/dmtree/vendor/vendor.c diff --git a/dmtree/vendor/vendor.h b/libbbf_dm/dmtree/vendor/vendor.h similarity index 100% rename from dmtree/vendor/vendor.h rename to libbbf_dm/dmtree/vendor/vendor.h diff --git a/scripts/bbf.diag b/libbbf_dm/scripts/bbf.diag similarity index 100% rename from scripts/bbf.diag rename to libbbf_dm/scripts/bbf.diag diff --git a/scripts/bbf_activate_handler.sh b/libbbf_dm/scripts/bbf_activate_handler.sh similarity index 100% rename from scripts/bbf_activate_handler.sh rename to libbbf_dm/scripts/bbf_activate_handler.sh diff --git a/scripts/bbf_api b/libbbf_dm/scripts/bbf_api similarity index 100% rename from scripts/bbf_api rename to libbbf_dm/scripts/bbf_api diff --git a/scripts/bbf_check_idle.sh b/libbbf_dm/scripts/bbf_check_idle.sh similarity index 100% rename from scripts/bbf_check_idle.sh rename to libbbf_dm/scripts/bbf_check_idle.sh diff --git a/scripts/download b/libbbf_dm/scripts/download similarity index 100% rename from scripts/download rename to libbbf_dm/scripts/download diff --git a/scripts/iplayercap b/libbbf_dm/scripts/iplayercap similarity index 100% rename from scripts/iplayercap rename to libbbf_dm/scripts/iplayercap diff --git a/scripts/ipping b/libbbf_dm/scripts/ipping similarity index 100% rename from scripts/ipping rename to libbbf_dm/scripts/ipping diff --git a/scripts/nslookup b/libbbf_dm/scripts/nslookup similarity index 100% rename from scripts/nslookup rename to libbbf_dm/scripts/nslookup diff --git a/scripts/serverselection b/libbbf_dm/scripts/serverselection similarity index 100% rename from scripts/serverselection rename to libbbf_dm/scripts/serverselection diff --git a/scripts/traceroute b/libbbf_dm/scripts/traceroute similarity index 100% rename from scripts/traceroute rename to libbbf_dm/scripts/traceroute diff --git a/scripts/udpecho b/libbbf_dm/scripts/udpecho similarity index 100% rename from scripts/udpecho rename to libbbf_dm/scripts/udpecho diff --git a/scripts/upload b/libbbf_dm/scripts/upload similarity index 100% rename from scripts/upload rename to libbbf_dm/scripts/upload diff --git a/test/bbf_test/Makefile b/test/bbf_test/Makefile index f754402c..639262b8 100644 --- a/test/bbf_test/Makefile +++ b/test/bbf_test/Makefile @@ -5,7 +5,7 @@ BIN_OBJ = bbf_dm.o LIB_OBJS = libbbf_test.o LIB_CFLAGS = $(CFLAGS) -Wall -Werror -fPIC -I /usr/local/include/ LIB_LDFLAGS = $(LDFLAGS) -lubus -BIN_LDFLAGS = $(LDFLAGS) -lbbfdm -lubus +BIN_LDFLAGS = $(LDFLAGS) -lbbf_api -lbbf_dm -lubus %.o: %.c $(CC) $(LIB_CFLAGS) $(FPIC) -c -o $@ $< diff --git a/test/bbf_test/bbf_dm.c b/test/bbf_test/bbf_dm.c index 1eaab174..ec74d8a8 100644 --- a/test/bbf_test/bbf_dm.c +++ b/test/bbf_test/bbf_dm.c @@ -1,8 +1,16 @@ #include #include -#include -#include +#include +#include +#include + +static DMOBJ *TR181_ROOT_TREE = tEntry181Obj; +static DM_MAP_VENDOR *TR181_VENDOR_EXTENSION[2] = { + tVendorExtension, + tVendorExtensionOverwrite +}; +static DM_MAP_VENDOR_EXCLUDE *TR181_VENDOR_EXTENSION_EXCLUDE = tVendorExtensionExclude; #ifndef CMD_GET_INFO #define CMD_GET_INFO (CMD_EXTERNAL_COMMAND + 1) @@ -62,7 +70,7 @@ int usp_dm_exec(int cmd, char *path, char *arg1, char *arg2) printf("cmd[%d], path[%s]\n", cmd, path); set_bbfdatamodel_type(g_proto); - dm_ctx_init(&bbf_ctx, 0); + dm_ctx_init(&bbf_ctx, TR181_ROOT_TREE, TR181_VENDOR_EXTENSION, TR181_VENDOR_EXTENSION_EXCLUDE, 0); if (arg2 && *arg2) { bbf_ctx.dm_version = arg2; @@ -121,6 +129,6 @@ int main(int argc, char *argv[]) version = argv[5]; usp_dm_exec(cmd, param, value, version); - bbf_dm_cleanup(); + bbf_dm_cleanup(TR181_ROOT_TREE); ubus_free(ubus_ctx); } diff --git a/test/cmocka/Makefile b/test/cmocka/Makefile index 5e1e6c3f..79056ed5 100644 --- a/test/cmocka/Makefile +++ b/test/cmocka/Makefile @@ -1,6 +1,6 @@ CC = gcc CFLAGS = -g -Wall -Werror -LDFLAGS = -lcmocka -lbbfdm -lubus +LDFLAGS = -lcmocka -lbbf_api -lbbf_dm -lubus UNIT_TESTS = unit_test_bbfd FUNCTIONAL_TESTS = functional_test_bbfd FUNCTIONAL_API_TESTS = functional_api_test_bbfd diff --git a/test/cmocka/functional_test_bbfd.c b/test/cmocka/functional_test_bbfd.c index aee54c88..1627418f 100644 --- a/test/cmocka/functional_test_bbfd.c +++ b/test/cmocka/functional_test_bbfd.c @@ -5,7 +5,16 @@ #include #include -#include +#include +#include +#include + +static DMOBJ *TR181_ROOT_TREE = tEntry181Obj; +static DM_MAP_VENDOR *TR181_VENDOR_EXTENSION[2] = { + tVendorExtension, + tVendorExtensionOverwrite +}; +static DM_MAP_VENDOR_EXCLUDE *TR181_VENDOR_EXTENSION_EXCLUDE = tVendorExtensionExclude; static struct ubus_context *ubus_ctx = NULL; @@ -25,7 +34,7 @@ static int setup(void **state) if (!ctx) return -1; - dm_ctx_init(ctx, INSTANCE_MODE_NUMBER); + dm_ctx_init(ctx, TR181_ROOT_TREE, TR181_VENDOR_EXTENSION, TR181_VENDOR_EXTENSION_EXCLUDE, INSTANCE_MODE_NUMBER); *state = ctx; return 0; @@ -37,7 +46,7 @@ static int setup_alias(void **state) if (!ctx) return -1; - dm_ctx_init(ctx, INSTANCE_MODE_ALIAS); + dm_ctx_init(ctx, TR181_ROOT_TREE, TR181_VENDOR_EXTENSION, TR181_VENDOR_EXTENSION_EXCLUDE, INSTANCE_MODE_ALIAS); *state = ctx; return 0; @@ -56,7 +65,7 @@ static int teardown_commit(void **state) static int group_teardown(void **state) { - bbf_dm_cleanup(); + bbf_dm_cleanup(TR181_ROOT_TREE); if (ubus_ctx != NULL) { ubus_free(ubus_ctx); ubus_ctx = NULL; @@ -71,7 +80,7 @@ static void validate_parameter(struct dmctx *ctx, const char *name, const char * struct dm_parameter *n; dm_ctx_clean_sub(ctx); - dm_ctx_init_sub(ctx, INSTANCE_MODE_NUMBER); + dm_ctx_init_sub(ctx, TR181_ROOT_TREE, TR181_VENDOR_EXTENSION, TR181_VENDOR_EXTENSION_EXCLUDE, INSTANCE_MODE_NUMBER); list_for_each_entry(n, &ctx->list_parameter, list) { diff --git a/test/cmocka/unit_test_bbfd.c b/test/cmocka/unit_test_bbfd.c index be18b6bc..07cd5eb5 100644 --- a/test/cmocka/unit_test_bbfd.c +++ b/test/cmocka/unit_test_bbfd.c @@ -5,7 +5,16 @@ #include #include -#include +#include +#include +#include + +static DMOBJ *TR181_ROOT_TREE = tEntry181Obj; +static DM_MAP_VENDOR *TR181_VENDOR_EXTENSION[2] = { + tVendorExtension, + tVendorExtensionOverwrite +}; +static DM_MAP_VENDOR_EXCLUDE *TR181_VENDOR_EXTENSION_EXCLUDE = tVendorExtensionExclude; #define DROPBEAR_FILE_PATH "../files/etc/bbfdm/json/X_IOPSYS_EU_Dropbear.json" #define DROPBEAR_JSON_PATH "/etc/bbfdm/json/X_IOPSYS_EU_Dropbear.json" @@ -30,7 +39,7 @@ static int setup(void **state) if (!ctx) return -1; - dm_ctx_init(ctx, INSTANCE_MODE_NUMBER); + dm_ctx_init(ctx, TR181_ROOT_TREE, TR181_VENDOR_EXTENSION, TR181_VENDOR_EXTENSION_EXCLUDE, INSTANCE_MODE_NUMBER); *state = ctx; return 0; @@ -42,7 +51,7 @@ static int setup_alias(void **state) if (!ctx) return -1; - dm_ctx_init(ctx, INSTANCE_MODE_ALIAS); + dm_ctx_init(ctx, TR181_ROOT_TREE, TR181_VENDOR_EXTENSION, TR181_VENDOR_EXTENSION_EXCLUDE, INSTANCE_MODE_ALIAS); *state = ctx; return 0; @@ -72,7 +81,7 @@ static int teardown_revert(void **state) static int group_teardown(void **state) { - bbf_dm_cleanup(); + bbf_dm_cleanup(TR181_ROOT_TREE); if (ubus_ctx != NULL) { ubus_free(ubus_ctx); ubus_ctx = NULL; @@ -575,7 +584,7 @@ static void test_api_bbfdm_json_get_value(void **state) assert_true(&first_entry->list != &ctx->list_parameter); dm_ctx_clean_sub(ctx); - dm_ctx_init_sub(ctx, INSTANCE_MODE_NUMBER); + dm_ctx_init_sub(ctx, TR181_ROOT_TREE, TR181_VENDOR_EXTENSION, TR181_VENDOR_EXTENSION_EXCLUDE, INSTANCE_MODE_NUMBER); /* * Test of JSON Parameter Path @@ -587,7 +596,7 @@ static void test_api_bbfdm_json_get_value(void **state) assert_true(&first_entry->list != &ctx->list_parameter); dm_ctx_clean_sub(ctx); - dm_ctx_init_sub(ctx, INSTANCE_MODE_NUMBER); + dm_ctx_init_sub(ctx, TR181_ROOT_TREE, TR181_VENDOR_EXTENSION, TR181_VENDOR_EXTENSION_EXCLUDE, INSTANCE_MODE_NUMBER); remove(DROPBEAR_JSON_PATH); @@ -662,7 +671,7 @@ static void test_api_bbfdm_library_get_value(void **state) assert_true(&first_entry->list != &ctx->list_parameter); dm_ctx_clean_sub(ctx); - dm_ctx_init_sub(ctx, INSTANCE_MODE_NUMBER); + dm_ctx_init_sub(ctx, TR181_ROOT_TREE, TR181_VENDOR_EXTENSION, TR181_VENDOR_EXTENSION_EXCLUDE, INSTANCE_MODE_NUMBER); fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.WiFi.SSID.1.Enable", NULL, NULL); assert_int_equal(fault, 0); @@ -671,7 +680,7 @@ static void test_api_bbfdm_library_get_value(void **state) assert_true(&first_entry->list != &ctx->list_parameter); dm_ctx_clean_sub(ctx); - dm_ctx_init_sub(ctx, INSTANCE_MODE_NUMBER); + dm_ctx_init_sub(ctx, TR181_ROOT_TREE, TR181_VENDOR_EXTENSION, TR181_VENDOR_EXTENSION_EXCLUDE, INSTANCE_MODE_NUMBER); remove(LIBBBF_TEST_BBFDM_PATH); diff --git a/test/dynamicdm_ubus_test/Makefile b/test/dynamicdm_ubus_test/Makefile deleted file mode 100644 index 68aedece..00000000 --- a/test/dynamicdm_ubus_test/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -BIN = bbf_ubus - -BIN_OBJ = bbf_ubus.o -BIN_CFLAGS = $(CFLAGS) -Wall -Werror -fPIC -I /usr/local/include/ -BIN_LDFLAGS = $(LDFLAGS) -lbbf_ubus -lubus -lubox -lbbf_test - -%.o: %.c - $(CC) $(BIN_CFLAGS) $(FPIC) -c -o $@ $< - -all: $(BIN) - -$(BIN): $(BIN_OBJ) - $(CC) -o $@ $^ $(BIN_LDFLAGS) - -clean: - rm -fv *.o $(BIN) diff --git a/tools/bbf_common.py b/tools/bbf_common.py index b2126ef1..b546fb0f 100755 --- a/tools/bbf_common.py +++ b/tools/bbf_common.py @@ -16,7 +16,7 @@ BBF_TR181_ROOT_FILE = "device.c" BBF_TR104_ROOT_FILE = "servicesvoiceservice.c" BBF_VENDOR_ROOT_FILE = "vendor.c" BBF_VENDOR_PREFIX = "X_IOPSYS_EU_" -BBF_DMTREE_PATH = CURRENT_PATH + "/../dmtree" +BBF_DMTREE_PATH = CURRENT_PATH + "/../libbbf_dm/dmtree" BBF_DMTREE_PATH_TR181 = BBF_DMTREE_PATH + "/tr181" BBF_DMTREE_PATH_TR104 = BBF_DMTREE_PATH + "/tr104" BBF_DMTREE_PATH_TR143 = BBF_DMTREE_PATH + "/tr143" diff --git a/tools/convert_dm_xml_to_json.py b/tools/convert_dm_xml_to_json.py index fac97b97..eb409543 100755 --- a/tools/convert_dm_xml_to_json.py +++ b/tools/convert_dm_xml_to_json.py @@ -253,12 +253,12 @@ listmapping = [] def generatelistfromfile(dmobject): obj = dmobject.get('name').split(".") if "tr-104" in sys.argv[1]: - pathfilename = "../dmtree/tr104/" + obj[1].lower() + ".c" - pathiopsyswrtfilename = "../dmtree/tr104/" + \ + pathfilename = "../libbbf_dm/dmtree/tr104/" + obj[1].lower() + ".c" + pathiopsyswrtfilename = "../libbbf_dm/dmtree/tr104/" + \ obj[1].lower() + "-iopsyswrt.c" else: - pathfilename = "../dmtree/tr181/" + obj[1].lower() + ".c" - pathiopsyswrtfilename = "../dmtree/tr181/" + \ + pathfilename = "../libbbf_dm/dmtree/tr181/" + obj[1].lower() + ".c" + pathiopsyswrtfilename = "../libbbf_dm/dmtree/tr181/" + \ obj[1].lower() + "-iopsyswrt.c" for x in range(0, 2): diff --git a/tools/tools_input.json b/tools/tools_input.json index b28277a1..1c1b0440 100644 --- a/tools/tools_input.json +++ b/tools/tools_input.json @@ -10,9 +10,9 @@ "iopsys" ], "dm_json_files": [ - "../dmtree/json/tr181.json", - "../dmtree/json/tr104.json", - "../dmtree/vendor/iopsys/vendor.json" + "../libbbf_dm/dmtree/json/tr181.json", + "../libbbf_dm/dmtree/json/tr104.json", + "../libbbf_dm/dmtree/vendor/iopsys/vendor.json" ], "vendor_prefix": "X_IOPSYS_EU_", "plugins": [