mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-24 11:05:02 +08:00
Compare commits
57 Commits
gsv_ponmng
...
add_libblo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
08dbacb62a | ||
|
|
71ea7517a7 | ||
|
|
306aabe4ea | ||
|
|
21b15495da | ||
|
|
96c2a4885a | ||
|
|
6e992b3a8b | ||
|
|
4d17441d44 | ||
|
|
41f83bb782 | ||
|
|
80fbdf2afe | ||
|
|
a0477ff19d | ||
|
|
73e6a19070 | ||
|
|
1811f4e42f | ||
|
|
177d4b43b2 | ||
|
|
c86a387a17 | ||
|
|
c8c1bb2a47 | ||
|
|
45f4468736 | ||
|
|
43fe6e522b | ||
|
|
b731667227 | ||
|
|
302a93121a | ||
|
|
212872b353 | ||
|
|
1d894d390b | ||
|
|
9b3611b287 | ||
|
|
de8c4dbc02 | ||
|
|
e8c3370f35 | ||
|
|
c37809e629 | ||
|
|
376b69eef1 | ||
|
|
92cde1ab5f | ||
|
|
f722c70859 | ||
|
|
ed1194be9d | ||
|
|
ef0c49d853 | ||
|
|
44ad141311 | ||
|
|
28e8fda73b | ||
|
|
44c6d5e7e6 | ||
|
|
6a8734ad4f | ||
|
|
91cd49c655 | ||
|
|
cb7256eba9 | ||
|
|
82fe2012eb | ||
|
|
26d9c43c7a | ||
|
|
a88061f8bf | ||
|
|
a92372c236 | ||
|
|
f4a33e75bd | ||
|
|
7c8b92e588 | ||
|
|
cd29e81357 | ||
|
|
da85372764 | ||
|
|
5b7a4d13ca | ||
|
|
86a553c697 | ||
|
|
769d814a6a | ||
|
|
51b076831a | ||
|
|
316a861269 | ||
|
|
d88eb8054b | ||
|
|
7d3387b095 | ||
|
|
f3059ca516 | ||
|
|
ae94f3390f | ||
|
|
5b3ad47604 | ||
|
|
e5bda20934 | ||
|
|
a6bde81c24 | ||
|
|
d1f74be5d5 |
10
bbf/Makefile
10
bbf/Makefile
@@ -5,11 +5,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libbbfdm
|
||||
PKG_VERSION:=6.8.42
|
||||
PKG_VERSION:=6.8.49
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/bbf.git
|
||||
PKG_SOURCE_VERSION:=976744360c6f2b676046aee5cb6f61326e876b13
|
||||
PKG_SOURCE_VERSION:=87ae46df8b4e221b8894fd861d2eb785ae1f3bf3
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -161,13 +161,11 @@ define Package/libbbfdm/default/install
|
||||
$(INSTALL_DIR) $(1)/usr/share/bbfdm
|
||||
$(INSTALL_DIR) $(1)/usr/lib/bbfdm
|
||||
$(INSTALL_DIR) $(1)/usr/libexec/rpcd
|
||||
$(INSTALL_DIR) $(1)/lib/upgrade/keep.d
|
||||
$(CP) $(PKG_BUILD_DIR)/libbbfdm.so $(1)/lib/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/* $(1)/usr/share/bbfdm
|
||||
$(LN) /usr/share/bbfdm/bbf.diag $(1)/usr/libexec/rpcd/bbf.diag
|
||||
ifeq ($(CONFIG_PACKAGE_mosquitto-ssl),y)
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/01-mosquitto-config $(1)/etc/uci-defaults/
|
||||
endif
|
||||
$(INSTALL_DATA) ./files/lib/upgrade/keep.d/bbf $(1)/lib/upgrade/keep.d/bbf
|
||||
endef
|
||||
|
||||
define Package/libbbfdm/default/prerm
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
config_mosquitto_owrt() {
|
||||
sec=$(uci -q get mosquitto.owrt)
|
||||
if [ -z "${sec}" ]; then
|
||||
sec=$(uci -q add mosquitto owrt)
|
||||
uci -q rename mosquitto."${sec}=owrt"
|
||||
fi
|
||||
|
||||
uci -q set mosquitto.owrt.use_uci="1"
|
||||
uci -q set mosquitto.owrt.write_pid="1"
|
||||
uci -q commit mosquitto
|
||||
}
|
||||
|
||||
config_mosquitto_general() {
|
||||
sec=$(uci -q get mosquitto.mosquitto)
|
||||
if [ -z "${sec}" ]; then
|
||||
sec=$(uci -q add mosquitto mosquitto)
|
||||
uci -q rename mosquitto."${sec}=mosquitto"
|
||||
fi
|
||||
|
||||
uci -q set mosquitto.mosquitto.log_dest="syslog"
|
||||
uci -q set mosquitto.mosquitto.log_facility="5"
|
||||
uci -q set mosquitto.mosquitto.log_timestamp="1"
|
||||
uci -q set mosquitto.mosquitto.log_types="error"
|
||||
uci -q set mosquitto.mosquitto.per_listener_settings="1"
|
||||
uci -q commit mosquitto
|
||||
}
|
||||
|
||||
config_mosquitto_persistence() {
|
||||
sec=$(uci -q get mosquitto.persistence)
|
||||
if [ -z "${sec}" ]; then
|
||||
sec=$(uci -q add mosquitto persistence)
|
||||
uci -q rename mosquitto."${sec}=persistence"
|
||||
fi
|
||||
|
||||
uci -q set mosquitto.persistence.persistence="0"
|
||||
uci -q set mosquitto.persistence.location="/var/run"
|
||||
uci -q commit mosquitto
|
||||
}
|
||||
|
||||
if [ -f "/etc/config/mosquitto" ]; then
|
||||
config_mosquitto_owrt
|
||||
config_mosquitto_general
|
||||
config_mosquitto_persistence
|
||||
fi
|
||||
1
bbf/files/lib/upgrade/keep.d/bbf
Normal file
1
bbf/files/lib/upgrade/keep.d/bbf
Normal file
@@ -0,0 +1 @@
|
||||
/etc/bbfdm/sysctl.conf
|
||||
@@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dectmngr
|
||||
PKG_RELEASE:=3
|
||||
PKG_VERSION:=3.5.6
|
||||
PKG_VERSION:=3.5.7
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/dectmngr.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=81450033d98fcdb68911e2148f48d190492090a6
|
||||
PKG_SOURCE_VERSION:=83f89a83cf860bbcf2b7f2e030215db315a5bbbf
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=easy-soc-libs
|
||||
PKG_VERSION:=7.2.16
|
||||
PKG_VERSION:=7.2.26
|
||||
PKG_RELEASE:=1
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=ff2fca6e57f6da1384f6a5f7741d8d1b2aa114fb
|
||||
PKG_SOURCE_VERSION:=350793b45873480d8981dac540c4145705a7b7ba
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/easy-soc-libs.git
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
@@ -53,7 +53,7 @@ else ifeq ($(CONFIG_TARGET_iopsys_armvirt),y)
|
||||
TARGET_CFLAGS +=-DIOPSYS_TEST
|
||||
else ifeq ($(CONFIG_TARGET_airoha),y)
|
||||
TARGET_PLATFORM=ECONET
|
||||
TARGET_WIFI_TYPE=MAC80211
|
||||
TARGET_WIFI_TYPE=MEDIATEK MAC80211
|
||||
TARGET_CFLAGS +=-DIOPSYS_ECONET
|
||||
else ifeq ($(CONFIG_TARGET_ipq95xx),y)
|
||||
TARGET_PLATFORM=IPQ95XX
|
||||
@@ -70,9 +70,6 @@ else
|
||||
TARGET_CFLAGS +=-DIOPSYS_MAC80211
|
||||
endif
|
||||
|
||||
export TARGET_PLATFORM
|
||||
export TARGET_WIFI_TYPE
|
||||
|
||||
subdirs := \
|
||||
$(if $(CONFIG_PACKAGE_libeasy),libeasy) \
|
||||
$(if $(CONFIG_PACKAGE_libwifiutils),libwifi) \
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=icwmp
|
||||
PKG_VERSION:=9.1.14
|
||||
PKG_VERSION:=9.1.19
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/icwmp.git
|
||||
PKG_SOURCE_VERSION:=d135d87f65e569b504464738e2b0c2041865a20a
|
||||
PKG_SOURCE_VERSION:=9d8389cda16f410826920bb27fd8af4d28c79de9
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ config cpe 'cpe'
|
||||
option periodic_notify_enable '1'
|
||||
option periodic_notify_interval '10'
|
||||
option incoming_rule 'Port_Only'
|
||||
option active_notif_throttle '0'
|
||||
|
||||
config lwn 'lwn'
|
||||
option enable '1'
|
||||
|
||||
@@ -411,7 +411,6 @@ boot() {
|
||||
|
||||
# Copy backup data so that if it restart latter on, it gets the info
|
||||
copy_cwmp_etc_files_to_varstate
|
||||
touch /etc/icwmpd/cwmp_notification
|
||||
mkdir -p /var/run/icwmpd/
|
||||
touch /var/run/icwmpd/cwmp
|
||||
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ieee1905
|
||||
PKG_VERSION:=8.0.10
|
||||
PKG_VERSION:=8.0.12
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=69b1073cfe3dc936c9cbe3e8a71005e9fa9f57e0
|
||||
PKG_SOURCE_VERSION:=b265053762a3d6c901872f29fa3e70b8666daf46
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/ieee1905.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
52
libpicoevent-bcm/Makefile
Normal file
52
libpicoevent-bcm/Makefile
Normal file
@@ -0,0 +1,52 @@
|
||||
#
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=0.3
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/libpicoevent.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=f446f186102539cceedaa15a95a33547ac3c1fd7
|
||||
PKG_NAME:=libpicoevent-bcm
|
||||
|
||||
PKG_LICENSE:=LGPL-2.1-only
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/libpicoevent-bcm
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=Libpicoevent-bcm
|
||||
URL:=
|
||||
DEPENDS:= +TARGET_brcmbca:bcmkernel
|
||||
include $(TOPDIR)/feeds/broadcom/bcmkernel/bcm-toolchain.mk
|
||||
TARGET_CFLAGS := -Os -pipe -mfpu=vfpv3-d16 -mfloat-abi=softfp -DCONFIG_TARGET_brcmbca -g3 -fno-caller-saves -fno-plt -Wno-error=unused-but-set-variable -Wno-error=unused-result \
|
||||
-mfloat-abi=soft -fmacro-prefix-map=$(BUILD_DIR)libpicoevent-bcm-0.3=libpicoevent-bcm-0.3 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 \
|
||||
-Wl,-z,now -Wl,-z,relro -Wl,--build-i
|
||||
endef
|
||||
|
||||
define Package/libpicoevent-bcm/description
|
||||
Minimal event library
|
||||
endef
|
||||
|
||||
define Package/libpicoevent-bcm/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/lib
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/lib/broadcom
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx
|
||||
$(CP) $(PKG_BUILD_DIR)/libpicoevent.h $(STAGING_DIR)/usr/include/bcm963xx
|
||||
mkdir -p $(1)/usr/lib/broadcom
|
||||
$(CP) $(PKG_BUILD_DIR)/libpicoevent.so $(STAGING_DIR)/usr/lib/broadcom
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libpicoevent.so $(1)/usr/lib/broadcom
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,libpicoevent-bcm))
|
||||
@@ -16,7 +16,7 @@ LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/$(PKG_NAME).git
|
||||
PKG_SOURCE_VERSION:=9133eacf5665dc01fa58d819bcc96f0a97ebd63c
|
||||
PKG_SOURCE_VERSION:=2a6ef141747ad0f7b32a536b5b5bd174834a7af5
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -16,7 +16,7 @@ LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/$(PKG_NAME).git
|
||||
PKG_SOURCE_VERSION:=415e36c4007040f723b164dee79a1719d9c77f0a
|
||||
PKG_SOURCE_VERSION:=401a392a72e2933f527eb92466faaf2907c38730
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -27,7 +27,6 @@ PKG_CONFIG_DEPENDS:=CONFIG_TARGET_BOARD
|
||||
|
||||
LIBVOICE_PKG_BUILD_DIR := $(PKG_BUILD_DIR)
|
||||
|
||||
export BCM_VOICEMNGR_WORKAROUND=y
|
||||
export CONFIG_BCM_CHIP_ID
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
@@ -16,7 +16,7 @@ LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/$(PKG_NAME).git
|
||||
PKG_SOURCE_VERSION:=abedc475cac1a21ad434dbf2131eb42aa495744d
|
||||
PKG_SOURCE_VERSION:=8a67b666e57836600457167ccadfba8c46461e5c
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -25,17 +25,17 @@ endif
|
||||
# indirectly. This ensures that the package is rebuilt on config-changes.
|
||||
PKG_CONFIG_DEPENDS:=CONFIG_TARGET_BOARD
|
||||
|
||||
LIBVOICE_PKG_BUILD_DIR := $(PKG_BUILD_DIR)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
export D2_VTSP_PLATFORM := $(shell echo $(CONFIG_D2_VTSP_PLATFORM))
|
||||
|
||||
TARGET_CFLAGS += -Wall -Werror
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=IOPSYS libvoice for D2 which is software DSP
|
||||
URL:=
|
||||
DEPENDS:=
|
||||
DEPENDS:=+d2-voice
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=map-agent
|
||||
PKG_VERSION:=4.2.0.4
|
||||
PKG_VERSION:=4.2.0.7
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=57a01fc4c8846486960a53d4ca808617520a051c
|
||||
PKG_SOURCE_VERSION:=142314d9a555ce30399d99ae1a44fbf8be8bb247
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=map-controller
|
||||
PKG_VERSION:=4.2.0.2
|
||||
PKG_VERSION:=4.2.0.3
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=47e0c27b8a4f08e1dbebab98c3c3aa72dae22dd0
|
||||
PKG_SOURCE_VERSION:=a88dea065f40c81d3356d850fe447a9deeb972e4
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
|
||||
@@ -6,11 +6,11 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=map-topology
|
||||
PKG_VERSION:=2.5.1.17
|
||||
PKG_VERSION:=2.5.1.18
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_VERSION:=7683a1b6a08996f07de573c67a33ad143dffeaa8
|
||||
PKG_SOURCE_VERSION:=4320fa30e73b916ae6e4ff489294640e61feeb34
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/map-topology.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
|
||||
|
||||
@@ -20,9 +20,31 @@ generate_igmp_global_params(){
|
||||
uci commit mcast
|
||||
}
|
||||
|
||||
generate_mcast_config(){
|
||||
generate_mld_proxy_config(){
|
||||
local u_itf="$1"
|
||||
|
||||
up_itf="$(uci -q get network.wan.device)"
|
||||
uci add mcast proxy
|
||||
uci rename mcast.@proxy[-1]="mc_proxy_MLD"
|
||||
uci set mcast.@proxy[-1].enable="1"
|
||||
uci set mcast.@proxy[-1].proto="mld"
|
||||
uci set mcast.@proxy[-1].version="2"
|
||||
uci set mcast.@proxy[-1].robustness="2"
|
||||
uci set mcast.@proxy[-1].query_interval="125"
|
||||
uci set mcast.@proxy[-1].query_response_interval="100"
|
||||
uci set mcast.@proxy[-1].last_member_query_interval="10"
|
||||
uci set mcast.@proxy[-1].fast_leave="1"
|
||||
uci set mcast.@proxy[-1].snooping_mode="2"
|
||||
uci add_list mcast.@proxy[-1].downstream_interface="br-lan"
|
||||
|
||||
IFS=" "
|
||||
for itf in $u_itf; do
|
||||
uci add_list mcast.@proxy[-1].upstream_interface="$itf"
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
generate_igmp_proxy_config(){
|
||||
local u_itf="$1"
|
||||
|
||||
uci add mcast proxy
|
||||
uci rename mcast.@proxy[-1]="igmp_proxy_1"
|
||||
@@ -38,46 +60,56 @@ generate_mcast_config(){
|
||||
uci add_list mcast.@proxy[-1].downstream_interface="br-lan"
|
||||
|
||||
IFS=" "
|
||||
for itf in $up_itf; do
|
||||
for itf in $u_itf; do
|
||||
uci add_list mcast.@proxy[-1].upstream_interface="$itf"
|
||||
done
|
||||
|
||||
uci add_list mcast.@proxy[-1].filter="239.0.0.0/8"
|
||||
}
|
||||
|
||||
generate_mcast_config(){
|
||||
|
||||
uci add mcast proxy
|
||||
uci rename mcast.@proxy[-1]="mc_proxy_MLD"
|
||||
uci set mcast.@proxy[-1].enable="1"
|
||||
uci set mcast.@proxy[-1].proto="mld"
|
||||
uci set mcast.@proxy[-1].version="1"
|
||||
uci set mcast.@proxy[-1].robustness="2"
|
||||
uci set mcast.@proxy[-1].query_interval="125"
|
||||
uci set mcast.@proxy[-1].query_response_interval="100"
|
||||
uci set mcast.@proxy[-1].last_member_query_interval="10"
|
||||
uci set mcast.@proxy[-1].fast_leave="1"
|
||||
uci set mcast.@proxy[-1].snooping_mode="2"
|
||||
uci add_list mcast.@proxy[-1].downstream_interface="br-lan"
|
||||
|
||||
IFS=" "
|
||||
for itf in $up_itf; do
|
||||
uci add_list mcast.@proxy[-1].upstream_interface="$itf"
|
||||
done
|
||||
up_itf="$(uci -q get network.wan.device)"
|
||||
|
||||
generate_igmp_proxy_config "$up_itf"
|
||||
generate_mld_proxy_config "$up_itf"
|
||||
|
||||
uci commit mcast
|
||||
}
|
||||
|
||||
interfaces_ok(){
|
||||
local section_name=$1
|
||||
|
||||
local up_interf=$(uci -q get ${section_name}.upstream_interface)
|
||||
[ -z "$up_interf" ] && return 1
|
||||
|
||||
local down_interf=$(uci -q get ${section_name}.downstream_interface)
|
||||
[ -z "$down_interf" ] && return 1
|
||||
|
||||
# check if upstream untagged
|
||||
IFS=" "
|
||||
for itf in $up_interf; do
|
||||
# check if there exist a device section for this upstream interface, if yes the
|
||||
# do nothing, if no then split the it at . and use the native interface as
|
||||
# upstream interface
|
||||
dev_section=$(ubus call uci get '{"config":"network", "type":"device", "match":{"name":"'"$itf"'"}}' | jsonfilter -e @.values | jq keys[])
|
||||
|
||||
# mcast config is outdated, simply generate as per new logic
|
||||
[ -z "$dev_section" ] && return 1
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
if [ -s "/etc/config/mcast" ]; then
|
||||
if uci -q get mcast.@proxy[0] >/dev/null; then
|
||||
# return if there is any valid content
|
||||
exit
|
||||
interfaces_ok "mcast.@proxy[0]" && exit
|
||||
elif uci -q get mcast.@snooping[0] >/dev/null; then
|
||||
# return if there is any valid content
|
||||
exit
|
||||
else
|
||||
rm -f /etc/config/mcast
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -f /etc/config/mcast
|
||||
touch /etc/config/mcast
|
||||
|
||||
generate_igmp_global_params
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=obuspa
|
||||
PKG_VERSION:=7.0.0.7
|
||||
PKG_VERSION:=7.0.0.9
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
@@ -110,7 +110,7 @@ define Package/obuspa/install
|
||||
$(INSTALL_DATA) ./files/etc/bbfdm/json/USPAgent.json $(1)/etc/bbfdm/json/USPAgent.json
|
||||
$(INSTALL_DATA) ./files/etc/bbfdm/json/TransferComplete.json $(1)/etc/bbfdm/json/TransferComplete.json
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/01-fix-upgrade-uci $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/50-add-mqtt-usp-test $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/05-obuspa-mqtt-config $(1)/etc/uci-defaults/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,obuspa))
|
||||
|
||||
22
obuspa/files/etc/uci-defaults/05-obuspa-mqtt-config
Executable file
22
obuspa/files/etc/uci-defaults/05-obuspa-mqtt-config
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
if [ ! -f "/etc/config/mosquitto" ]; then
|
||||
echo "Local mosquitto broker not available"
|
||||
return 0
|
||||
fi
|
||||
|
||||
add_obuspa_config()
|
||||
{
|
||||
if ! uci_get mosquitto obuspa >/dev/null 2>&1; then
|
||||
uci_add mosquitto listener obuspa
|
||||
uci_set mosquitto obuspa enabled 1
|
||||
uci_set mosquitto obuspa port '1883'
|
||||
uci_set mosquitto obuspa no_remote_access '1'
|
||||
uci_set mosquitto obuspa allow_anonymous '1'
|
||||
fi
|
||||
}
|
||||
|
||||
uci_load mosquitto
|
||||
add_obuspa_config
|
||||
@@ -1,14 +0,0 @@
|
||||
add_usp_test()
|
||||
{
|
||||
if ! uci_get mosquitto usptest >/dev/null 2>&1; then
|
||||
uci_add mosquitto listener usptest
|
||||
uci_set mosquitto usptest enabled 1
|
||||
uci_set mosquitto usptest port '9001'
|
||||
uci_set mosquitto usptest protocol 'websockets'
|
||||
uci_set mosquitto usptest require_certificates '0'
|
||||
uci_set mosquitto usptest auth_plugin '/usr/lib/mosquitto_auth_shadow.so'
|
||||
fi
|
||||
}
|
||||
|
||||
uci_load mosquitto
|
||||
add_usp_test
|
||||
372
obuspa/patches/0006-bdc_json_obj_hierarchy.patch
Normal file
372
obuspa/patches/0006-bdc_json_obj_hierarchy.patch
Normal file
@@ -0,0 +1,372 @@
|
||||
diff --git a/src/core/bdc_exec.c b/src/core/bdc_exec.c
|
||||
index 6b5c11d..3670361 100644
|
||||
--- a/src/core/bdc_exec.c
|
||||
+++ b/src/core/bdc_exec.c
|
||||
@@ -548,9 +548,14 @@ int StartSendingReport(bdc_connection_t *bc)
|
||||
// Set the list of headers
|
||||
bc->headers = NULL;
|
||||
bc->headers = curl_slist_append(bc->headers, "Content-Type: application/json; charset=UTF-8");
|
||||
- bc->headers = curl_slist_append(bc->headers, "BBF-Report-Format: NameValuePair");
|
||||
+ if (bc->flags & BDC_FLAG_HEADER_OBJ_HIER)
|
||||
+ bc->headers = curl_slist_append(bc->headers, "BBF-Report-Format: ObjectHierarchy");
|
||||
+ else
|
||||
+ bc->headers = curl_slist_append(bc->headers, "BBF-Report-Format: NameValuePair");
|
||||
+
|
||||
if (bc->flags & BDC_FLAG_GZIP)
|
||||
{
|
||||
+ curl_easy_setopt(curl_ctx, CURLOPT_ACCEPT_ENCODING, "gzip");
|
||||
bc->headers = curl_slist_append(bc->headers, "Content-Encoding: gzip");
|
||||
}
|
||||
|
||||
diff --git a/src/core/bdc_exec.h b/src/core/bdc_exec.h
|
||||
index c58c6d5..ff37a2d 100644
|
||||
--- a/src/core/bdc_exec.h
|
||||
+++ b/src/core/bdc_exec.h
|
||||
@@ -53,6 +53,6 @@ void BDC_EXEC_ScheduleExit(void);
|
||||
#define BDC_FLAG_PUT 0x00000001 // If set, HTTP PUT should be used instead of HTTP POST when sending the report to the BDC server
|
||||
#define BDC_FLAG_GZIP 0x00000002 // If set, the reports contants are Gzipped
|
||||
#define BDC_FLAG_DATE_HEADER 0x00000004 // If set, the date header should be included in the HTTP post.
|
||||
-
|
||||
+#define BDC_FLAG_HEADER_OBJ_HIER 0x00000008 // If set, report format in header would be ObjectHierarchy otherwise NameValuePair
|
||||
|
||||
#endif
|
||||
diff --git a/src/core/device_bulkdata.c b/src/core/device_bulkdata.c
|
||||
index 5b1aff2..a7d1b3e 100755
|
||||
--- a/src/core/device_bulkdata.c
|
||||
+++ b/src/core/device_bulkdata.c
|
||||
@@ -68,7 +68,8 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Definitions for formats that we support
|
||||
#define BULKDATA_ENCODING_TYPE "JSON"
|
||||
-#define BULKDATA_JSON_REPORT_FORMAT "NameValuePair"
|
||||
+#define BULKDATA_JSON_REPORT_FORMAT_NAME_VALUE "NameValuePair"
|
||||
+#define BULKDATA_JSON_REPORT_FORMAT_OBJ_HIER "ObjectHierarchy"
|
||||
|
||||
|
||||
// Definitions for Device.BulkData.Profile.{i}.JSONEncoding.ReportTimestamp
|
||||
@@ -159,6 +160,7 @@ typedef struct
|
||||
char compression[9];
|
||||
char method[9];
|
||||
bool use_date_header;
|
||||
+ char report_format[20];
|
||||
} profile_ctrl_params_t;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -233,7 +235,7 @@ bulkdata_profile_t *bulkdata_find_free_profile(void);
|
||||
bulkdata_profile_t *bulkdata_find_profile(int profile_id);
|
||||
int bulkdata_calc_report_map(bulkdata_profile_t *bp, kv_vector_t *report_map);
|
||||
int bulkdata_reduce_to_alt_name(char *spec, char *path, char *alt_name, char *out_buf, int buf_len);
|
||||
-char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timestamp);
|
||||
+char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timestamp, char *report_format);
|
||||
unsigned char *bulkdata_compress_report(profile_ctrl_params_t *ctrl, char *input_buf, int input_len, int *p_output_len);
|
||||
int bulkdata_schedule_sending_http_report(profile_ctrl_params_t *ctrl, bulkdata_profile_t *bp, unsigned char *json_report, int report_len);
|
||||
int bulkdata_start_profile(bulkdata_profile_t *bp);
|
||||
@@ -307,7 +309,7 @@ int DEVICE_BULKDATA_Init(void)
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.Parameter.{i}.Reference", "", Validate_BulkDataReference, NULL, DM_STRING);
|
||||
|
||||
// Device.BulkData.Profile.{i}.JSONEncoding
|
||||
- err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.JSONEncoding.ReportFormat", BULKDATA_JSON_REPORT_FORMAT, Validate_BulkDataReportFormat, NULL, DM_STRING);
|
||||
+ err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.JSONEncoding.ReportFormat", BULKDATA_JSON_REPORT_FORMAT_NAME_VALUE, Validate_BulkDataReportFormat, NULL, DM_STRING);
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.JSONEncoding.ReportTimestamp", BULKDATA_JSON_TIMESTAMP_FORMAT_EPOCH, Validate_BulkDataReportTimestamp, NULL, DM_STRING);
|
||||
|
||||
// Device.BulkData.Profile.{i}.HTTP
|
||||
@@ -661,9 +663,11 @@ int Validate_BulkDataReference(dm_req_t *req, char *value)
|
||||
int Validate_BulkDataReportFormat(dm_req_t *req, char *value)
|
||||
{
|
||||
// Exit if trying to set a value outside of the range we accept
|
||||
- if (strcmp(value, BULKDATA_JSON_REPORT_FORMAT) != 0)
|
||||
+ if (strcmp(value, BULKDATA_JSON_REPORT_FORMAT_NAME_VALUE) != 0 &&
|
||||
+ strcmp(value, BULKDATA_JSON_REPORT_FORMAT_OBJ_HIER) != 0)
|
||||
{
|
||||
- USP_ERR_SetMessage("%s: Only JSON Report Format supported is '%s'", __FUNCTION__, BULKDATA_JSON_REPORT_FORMAT);
|
||||
+ USP_ERR_SetMessage("%s: Only JSON Report Format supported are '%s', '%s'", __FUNCTION__,
|
||||
+ BULKDATA_JSON_REPORT_FORMAT_NAME_VALUE, BULKDATA_JSON_REPORT_FORMAT_OBJ_HIER);
|
||||
return USP_ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
@@ -1974,6 +1978,14 @@ int bulkdata_platform_get_profile_control_params(bulkdata_profile_t *bp, profile
|
||||
return err;
|
||||
}
|
||||
|
||||
+ // Exit if unable to get ReportFormat
|
||||
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.JSONEncoding.ReportFormat", bp->profile_id);
|
||||
+ err = DATA_MODEL_GetParameterValue(path, ctrl_params->report_format, sizeof(ctrl_params->report_format), 0);
|
||||
+ if (err != USP_ERR_OK)
|
||||
+ {
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
return USP_ERR_OK;
|
||||
}
|
||||
|
||||
@@ -2249,7 +2261,7 @@ void bulkdata_process_profile_http(bulkdata_profile_t *bp)
|
||||
}
|
||||
|
||||
// Exit if unable to generate the report
|
||||
- json_report = bulkdata_generate_json_report(bp, ctrl.report_timestamp);
|
||||
+ json_report = bulkdata_generate_json_report(bp, ctrl.report_timestamp, ctrl.report_format);
|
||||
if (json_report == NULL)
|
||||
{
|
||||
USP_ERR_SetMessage("%s: bulkdata_generate_json_report failed", __FUNCTION__);
|
||||
@@ -2299,7 +2311,8 @@ void bulkdata_process_profile_usp_event(bulkdata_profile_t *bp)
|
||||
kv_pair_t kv;
|
||||
report_t *cur_report;
|
||||
char *json_report;
|
||||
- char report_timestamp[33];
|
||||
+ char report_timestamp[33] = {0};
|
||||
+ char report_format[20] = {0};
|
||||
|
||||
// Exit if the MTP has not been connected to successfully after bootup
|
||||
// This is to prevent BDC events being enqueued before the Boot! event is sent (the Boot! event is only sent after successfully connecting to the MTP).
|
||||
@@ -2316,6 +2329,14 @@ void bulkdata_process_profile_usp_event(bulkdata_profile_t *bp)
|
||||
return;
|
||||
}
|
||||
|
||||
+ // Exit if unable to get ReportFormat
|
||||
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.JSONEncoding.ReportFormat", bp->profile_id);
|
||||
+ err = DATA_MODEL_GetParameterValue(path, report_format, sizeof(report_format), 0);
|
||||
+ if (err != USP_ERR_OK)
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
// When sending via USP events, only one report is ever sent in each USP event
|
||||
// So ensure all retained reports are removed. NOTE: Clearing the reports here is only necessary when switching protocol from HTTP to USP event, and where HTTP had some unsent reports
|
||||
bulkdata_clear_retained_reports(bp);
|
||||
@@ -2333,7 +2354,7 @@ void bulkdata_process_profile_usp_event(bulkdata_profile_t *bp)
|
||||
bp->num_retained_reports = 1;
|
||||
|
||||
// Exit if unable to generate the report
|
||||
- json_report = bulkdata_generate_json_report(bp, report_timestamp);
|
||||
+ json_report = bulkdata_generate_json_report(bp, report_timestamp, report_format);
|
||||
if (json_report == NULL)
|
||||
{
|
||||
USP_ERR_SetMessage("%s: bulkdata_generate_json_report failed", __FUNCTION__);
|
||||
@@ -2545,21 +2566,7 @@ int bulkdata_reduce_to_alt_name(char *spec, char *path, char *alt_name, char *ou
|
||||
return USP_ERR_OK;
|
||||
}
|
||||
|
||||
-/*********************************************************************//**
|
||||
-**
|
||||
-** bulkdata_generate_json_report
|
||||
-**
|
||||
-** Generates a JSON name-value pair format report
|
||||
-** NOTE: The report contains all retained failed reports, as well as the current report
|
||||
-** See TR-157 section A.4.2 (end) for an example, and section A.3.5.2 for layout of content containing failed report transmissions
|
||||
-**
|
||||
-** \param bp - pointer to bulk data profile containing all reports (current and retained)
|
||||
-** \param report_timestamp - value of Device.BulkData.Profile.{i}.JSONEncoding.ReportTimestamp
|
||||
-**
|
||||
-** \return pointer to NULL terminated dynamically allocated buffer containing the serialized report to send
|
||||
-**
|
||||
-**************************************************************************/
|
||||
-char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timestamp)
|
||||
+static char *create_json_name_value_pair_report(bulkdata_profile_t *bp, char *report_timestamp)
|
||||
{
|
||||
JsonNode *top; // top of report
|
||||
JsonNode *array; // array of reports (retained + current)
|
||||
@@ -2574,7 +2581,6 @@ char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timesta
|
||||
long long value_as_ll;
|
||||
unsigned long long value_as_ull;
|
||||
bool value_as_bool;
|
||||
- char *result;
|
||||
int i, j;
|
||||
char buf[32];
|
||||
kv_pair_t *kv;
|
||||
@@ -2597,7 +2603,7 @@ char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timesta
|
||||
}
|
||||
else if (strcmp(report_timestamp, "ISO-8601")==0)
|
||||
{
|
||||
- result = iso8601_from_unix_time(report->collection_time, buf, sizeof(buf));
|
||||
+ char *result = iso8601_from_unix_time(report->collection_time, buf, sizeof(buf));
|
||||
if (result != NULL)
|
||||
{
|
||||
json_append_member(element, "CollectionTime", json_mkstring(buf));
|
||||
@@ -2656,11 +2662,174 @@ char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timesta
|
||||
json_append_member(top, "Report", array);
|
||||
|
||||
// Serialize the JSON tree
|
||||
- result = json_stringify(top, " ");
|
||||
+ char *output = json_stringify(top, " ");
|
||||
+
|
||||
+ // Clean up the JSON tree
|
||||
+ json_delete(top); // Other JsonNodes which are children of this top level tree will be deleted
|
||||
+
|
||||
+ return output;
|
||||
+}
|
||||
+
|
||||
+static char *create_json_obj_hier_report(bulkdata_profile_t *bp, char *report_timestamp)
|
||||
+{
|
||||
+ JsonNode *top; // top of report
|
||||
+ JsonNode *array; // array of reports (retained + current)
|
||||
+ JsonNode *element; // element of json array, containing an individual report
|
||||
+ JsonNode *temp;
|
||||
+ char *param_path;
|
||||
+ char *param_type_value;
|
||||
+ char param_type;
|
||||
+ char *param_value;
|
||||
+ kv_vector_t *report_map;
|
||||
+ report_t *report;
|
||||
+ double value_as_number;
|
||||
+ long long value_as_ll;
|
||||
+ unsigned long long value_as_ull;
|
||||
+ bool value_as_bool;
|
||||
+ int i, j;
|
||||
+ char buf[32];
|
||||
+ kv_pair_t *kv;
|
||||
+ int err;
|
||||
+
|
||||
+ top = json_mkobject();
|
||||
+ array = json_mkarray();
|
||||
+
|
||||
+ // Iterate over all reports adding them to the JSON array
|
||||
+ for (i=0; i < bp->num_retained_reports; i++)
|
||||
+ {
|
||||
+ report = &bp->reports[i];
|
||||
+ report_map = &report->report_map;
|
||||
+
|
||||
+ // Add Collection time to each json report element (only if specified and not 'None')
|
||||
+ element = json_mkobject();
|
||||
+ if (strcmp(report_timestamp, "Unix-Epoch")==0)
|
||||
+ {
|
||||
+ json_append_member(element, "CollectionTime", json_mknumber(report->collection_time));
|
||||
+ }
|
||||
+ else if (strcmp(report_timestamp, "ISO-8601")==0)
|
||||
+ {
|
||||
+ char *result = iso8601_from_unix_time(report->collection_time, buf, sizeof(buf));
|
||||
+ if (result != NULL)
|
||||
+ {
|
||||
+ json_append_member(element, "CollectionTime", json_mkstring(buf));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ temp = element;
|
||||
+ // Iterate over each parameter, adding it to the json element. Take account of the parameter's type
|
||||
+ for (j=0; j < report_map->num_entries; j++)
|
||||
+ {
|
||||
+ char buff[2056] = {0};
|
||||
+ char *pch = NULL, *pchr = NULL, *argv[128] = {0};
|
||||
+ int n = 0;
|
||||
+
|
||||
+ kv = &report_map->vector[j];
|
||||
+ param_path = kv->key;
|
||||
+ param_type_value = kv->value;
|
||||
+ param_type = param_type_value[0]; // First character denotes the type of the parameter
|
||||
+ param_value = ¶m_type_value[1]; // Subsequent characters contain the parameter's value
|
||||
+
|
||||
+ strncpy(buff, param_path, sizeof(buff));
|
||||
+ for (pch = strtok_r(buff, ".", &pchr); pch != NULL; pch = strtok_r(NULL, ".", &pchr)) {
|
||||
+ int idx;
|
||||
+ JsonNode *obj = element;
|
||||
+ argv[n] = pch;
|
||||
+
|
||||
+ for (idx = 0; idx <= n; idx++) {
|
||||
+ if (obj == NULL)
|
||||
+ break;
|
||||
+ obj = json_find_member(obj, argv[idx]);
|
||||
+ }
|
||||
+
|
||||
+ if (obj)
|
||||
+ temp = obj;
|
||||
+ else {
|
||||
+ if (pchr != NULL && *pchr != '\0') {
|
||||
+ // It is a DMOBJ
|
||||
+ JsonNode *new = json_mkobject();
|
||||
+ json_append_member(temp, pch, new);
|
||||
+ temp = new;
|
||||
+ } else {
|
||||
+ // It is a DMPARAM
|
||||
+ switch (param_type)
|
||||
+ {
|
||||
+ case 'S':
|
||||
+ json_append_member(temp, pch, json_mkstring(param_value) );
|
||||
+ break;
|
||||
+
|
||||
+ case 'U':
|
||||
+ value_as_ull = strtoull(param_value, NULL, 10);
|
||||
+ json_append_member(temp, pch, json_mkulonglong(value_as_ull) );
|
||||
+ break;
|
||||
+
|
||||
+ case 'L':
|
||||
+ value_as_ll = strtoll(param_value, NULL, 10);
|
||||
+ json_append_member(temp, pch, json_mklonglong(value_as_ll) );
|
||||
+ break;
|
||||
+
|
||||
+ case 'N':
|
||||
+ value_as_number = atof(param_value);
|
||||
+ json_append_member(temp, pch, json_mknumber(value_as_number) );
|
||||
+ break;
|
||||
+
|
||||
+ case 'B':
|
||||
+ err = TEXT_UTILS_StringToBool(param_value, &value_as_bool);
|
||||
+ if (err == USP_ERR_OK)
|
||||
+ {
|
||||
+ json_append_member(temp, pch, json_mkbool(value_as_bool) );
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ USP_ERR_SetMessage("%s: Invalid JSON parameter type ('%c') in report map for %s", __FUNCTION__, param_type_value[0], param_path);
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ n++;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // Add the json element to the json array
|
||||
+ json_append_element(array, element);
|
||||
+ }
|
||||
+
|
||||
+ // Finally add the array to the report top level
|
||||
+ json_append_member(top, "Report", array);
|
||||
+
|
||||
+ // Serialize the JSON tree
|
||||
+ char *output = json_stringify(top, " ");
|
||||
|
||||
// Clean up the JSON tree
|
||||
json_delete(top); // Other JsonNodes which are children of this top level tree will be deleted
|
||||
|
||||
+ return output;
|
||||
+}
|
||||
+
|
||||
+/*********************************************************************//**
|
||||
+**
|
||||
+** bulkdata_generate_json_report
|
||||
+**
|
||||
+** Generates a JSON name-value pair or object-hierarchy format report
|
||||
+** NOTE: The report contains all retained failed reports, as well as the current report
|
||||
+** See TR-157 section A.4.2 (end) for an example, and section A.3.5.2 for layout of content containing failed report transmissions
|
||||
+**
|
||||
+** \param bp - pointer to bulk data profile containing all reports (current and retained)
|
||||
+** \param report_timestamp - value of Device.BulkData.Profile.{i}.JSONEncoding.ReportTimestamp
|
||||
+**
|
||||
+** \return pointer to NULL terminated dynamically allocated buffer containing the serialized report to send
|
||||
+**
|
||||
+**************************************************************************/
|
||||
+char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timestamp, char *report_format)
|
||||
+{
|
||||
+ char *result = NULL;
|
||||
+
|
||||
+ if (strcmp(report_format, BULKDATA_JSON_REPORT_FORMAT_NAME_VALUE) == 0) {
|
||||
+ result = create_json_name_value_pair_report(bp, report_timestamp);
|
||||
+ } else if (strcmp(report_format, BULKDATA_JSON_REPORT_FORMAT_OBJ_HIER) == 0) {
|
||||
+ result = create_json_obj_hier_report(bp, report_timestamp);
|
||||
+ }
|
||||
+
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2817,6 +2986,11 @@ int bulkdata_schedule_sending_http_report(profile_ctrl_params_t *ctrl, bulkdata_
|
||||
flags |= BDC_FLAG_DATE_HEADER;
|
||||
}
|
||||
|
||||
+ if (strcmp(ctrl->report_format, BULKDATA_JSON_REPORT_FORMAT_OBJ_HIER) == 0)
|
||||
+ {
|
||||
+ flags |= BDC_FLAG_HEADER_OBJ_HIER;
|
||||
+ }
|
||||
+
|
||||
// Exit if failed to post a message to BDC thread
|
||||
// NOTE: Ownership of full_url, query_string, report, username and password passes to BDC_EXEC
|
||||
err = BDC_EXEC_PostReportToSend(bp->profile_id, full_url, query_string, username, password, report, report_len, flags);
|
||||
673
obuspa/patches/0007-bdc_csv_format.patch
Normal file
673
obuspa/patches/0007-bdc_csv_format.patch
Normal file
@@ -0,0 +1,673 @@
|
||||
diff --git a/src/core/bdc_exec.c b/src/core/bdc_exec.c
|
||||
index 3670361..6a6325d 100644
|
||||
--- a/src/core/bdc_exec.c
|
||||
+++ b/src/core/bdc_exec.c
|
||||
@@ -547,11 +547,19 @@ int StartSendingReport(bdc_connection_t *bc)
|
||||
|
||||
// Set the list of headers
|
||||
bc->headers = NULL;
|
||||
- bc->headers = curl_slist_append(bc->headers, "Content-Type: application/json; charset=UTF-8");
|
||||
- if (bc->flags & BDC_FLAG_HEADER_OBJ_HIER)
|
||||
+ if (bc->flags & BDC_FLAG_HEADER_OBJ_HIER) {
|
||||
+ bc->headers = curl_slist_append(bc->headers, "Content-Type: application/json; charset=UTF-8");
|
||||
bc->headers = curl_slist_append(bc->headers, "BBF-Report-Format: ObjectHierarchy");
|
||||
- else
|
||||
+ } else if (bc->flags & BDC_FLAG_HEADER_NAME_VAL) {
|
||||
+ bc->headers = curl_slist_append(bc->headers, "Content-Type: application/json; charset=UTF-8");
|
||||
bc->headers = curl_slist_append(bc->headers, "BBF-Report-Format: NameValuePair");
|
||||
+ } else if (bc->flags & BDC_FLAG_HEADER_PER_COL) {
|
||||
+ bc->headers = curl_slist_append(bc->headers, "Content-Type: text/csv; charset=UTF-8");
|
||||
+ bc->headers = curl_slist_append(bc->headers, "BBF-Report-Format: ParameterPerColumn");
|
||||
+ } else {
|
||||
+ bc->headers = curl_slist_append(bc->headers, "Content-Type: text/csv; charset=UTF-8");
|
||||
+ bc->headers = curl_slist_append(bc->headers, "BBF-Report-Format: ParameterPerRow");
|
||||
+ }
|
||||
|
||||
if (bc->flags & BDC_FLAG_GZIP)
|
||||
{
|
||||
diff --git a/src/core/bdc_exec.h b/src/core/bdc_exec.h
|
||||
index ff37a2d..ee29c85 100644
|
||||
--- a/src/core/bdc_exec.h
|
||||
+++ b/src/core/bdc_exec.h
|
||||
@@ -53,6 +53,9 @@ void BDC_EXEC_ScheduleExit(void);
|
||||
#define BDC_FLAG_PUT 0x00000001 // If set, HTTP PUT should be used instead of HTTP POST when sending the report to the BDC server
|
||||
#define BDC_FLAG_GZIP 0x00000002 // If set, the reports contants are Gzipped
|
||||
#define BDC_FLAG_DATE_HEADER 0x00000004 // If set, the date header should be included in the HTTP post.
|
||||
-#define BDC_FLAG_HEADER_OBJ_HIER 0x00000008 // If set, report format in header would be ObjectHierarchy otherwise NameValuePair
|
||||
+#define BDC_FLAG_HEADER_OBJ_HIER 0x00000008 // If set, report format in header would be json ObjectHierarchy
|
||||
+#define BDC_FLAG_HEADER_NAME_VAL 0x00000010 // If set, report format in header would be json NameValuePair
|
||||
+#define BDC_FLAG_HEADER_PER_ROW 0x00000020 // If set, report format in header would be csv ParameterPerRow
|
||||
+#define BDC_FLAG_HEADER_PER_COL 0x00000040 // If set, report format in header would be csv ParameterPerColumn
|
||||
|
||||
#endif
|
||||
diff --git a/src/core/device_bulkdata.c b/src/core/device_bulkdata.c
|
||||
index a7d1b3e..fab9731 100755
|
||||
--- a/src/core/device_bulkdata.c
|
||||
+++ b/src/core/device_bulkdata.c
|
||||
@@ -67,9 +67,12 @@
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Definitions for formats that we support
|
||||
-#define BULKDATA_ENCODING_TYPE "JSON"
|
||||
+#define BULKDATA_ENCODING_TYPE_JSON "JSON"
|
||||
+#define BULKDATA_ENCODING_TYPE_CSV "CSV"
|
||||
#define BULKDATA_JSON_REPORT_FORMAT_NAME_VALUE "NameValuePair"
|
||||
#define BULKDATA_JSON_REPORT_FORMAT_OBJ_HIER "ObjectHierarchy"
|
||||
+#define BULKDATA_CSV_REPORT_FORMAT_PER_COLUMN "ParameterPerColumn"
|
||||
+#define BULKDATA_CSV_REPORT_FORMAT_PER_ROW "ParameterPerRow"
|
||||
|
||||
|
||||
// Definitions for Device.BulkData.Profile.{i}.JSONEncoding.ReportTimestamp
|
||||
@@ -153,6 +156,7 @@ static char *profile_push_event_args[] =
|
||||
typedef struct
|
||||
{
|
||||
int num_retained_failed_reports;
|
||||
+ char encoding_type[10];
|
||||
char report_timestamp[33];
|
||||
char url[1025];
|
||||
char username[257];
|
||||
@@ -161,6 +165,11 @@ typedef struct
|
||||
char method[9];
|
||||
bool use_date_header;
|
||||
char report_format[20];
|
||||
+ char field_separator[10];
|
||||
+ char row_separator[10];
|
||||
+ char escape_char[10];
|
||||
+ char csv_format[20];
|
||||
+ char row_timestamp[33];
|
||||
} profile_ctrl_params_t;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -208,6 +217,7 @@ int Validate_BulkDataEncodingType(dm_req_t *req, char *value);
|
||||
int Validate_BulkDataReportingInterval(dm_req_t *req, char *value);
|
||||
int Validate_BulkDataReference(dm_req_t *req, char *value);
|
||||
int Validate_BulkDataReportFormat(dm_req_t *req, char *value);
|
||||
+int Validate_BulkDataCSVReportFormat(dm_req_t *req, char *value);
|
||||
int Validate_BulkDataReportTimestamp(dm_req_t *req, char *value);
|
||||
int Validate_BulkDataCompression(dm_req_t *req, char *value);
|
||||
int Validate_BulkDataHTTPMethod(dm_req_t *req, char *value);
|
||||
@@ -236,6 +246,8 @@ bulkdata_profile_t *bulkdata_find_profile(int profile_id);
|
||||
int bulkdata_calc_report_map(bulkdata_profile_t *bp, kv_vector_t *report_map);
|
||||
int bulkdata_reduce_to_alt_name(char *spec, char *path, char *alt_name, char *out_buf, int buf_len);
|
||||
char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timestamp, char *report_format);
|
||||
+char *bulkdata_generate_csv_report(bulkdata_profile_t *bp, char *field_separator, char *row_separator,
|
||||
+ char *escape_char, char *csv_format, char *row_timestamp);
|
||||
unsigned char *bulkdata_compress_report(profile_ctrl_params_t *ctrl, char *input_buf, int input_len, int *p_output_len);
|
||||
int bulkdata_schedule_sending_http_report(profile_ctrl_params_t *ctrl, bulkdata_profile_t *bp, unsigned char *json_report, int report_len);
|
||||
int bulkdata_start_profile(bulkdata_profile_t *bp);
|
||||
@@ -250,6 +262,7 @@ char *bulkdata_platform_calc_uri_query_string(kv_vector_t *escaped_map);
|
||||
int bulkdata_platform_get_param_refs(int profile_id, param_ref_vector_t *param_refs);
|
||||
void bulkdata_expand_param_ref(param_ref_entry_t *pr, group_get_vector_t *ggv);
|
||||
void bulkdata_append_to_result_map(param_ref_entry_t *pr, group_get_vector_t *ggv, kv_vector_t *report_map);
|
||||
+void append_string_to_target(char *str, char **output);
|
||||
|
||||
/*********************************************************************//**
|
||||
**
|
||||
@@ -282,7 +295,7 @@ int DEVICE_BULKDATA_Init(void)
|
||||
err |= USP_REGISTER_VendorParam_ReadOnly("Device.BulkData.Status", Get_BulkDataGlobalStatus, DM_STRING);
|
||||
err |= USP_REGISTER_Param_Constant("Device.BulkData.MinReportingInterval", BULKDATA_MINIMUM_REPORTING_INTERVAL_STR, DM_UINT);
|
||||
err |= USP_REGISTER_Param_SupportedList("Device.BulkData.Protocols", bdc_protocols, NUM_ELEM(bdc_protocols));
|
||||
- err |= USP_REGISTER_Param_Constant("Device.BulkData.EncodingTypes", BULKDATA_ENCODING_TYPE, DM_STRING);
|
||||
+ err |= USP_REGISTER_Param_Constant("Device.BulkData.EncodingTypes", "CSV,JSON", DM_STRING);
|
||||
err |= USP_REGISTER_Param_Constant("Device.BulkData.ParameterWildCardSupported", "true", DM_BOOL);
|
||||
err |= USP_REGISTER_Param_Constant("Device.BulkData.MaxNumberOfProfiles", BULKDATA_MAX_PROFILES_STR, DM_INT);
|
||||
err |= USP_REGISTER_Param_Constant("Device.BulkData.MaxNumberOfParameterReferences", "-1", DM_INT);
|
||||
@@ -297,7 +310,7 @@ int DEVICE_BULKDATA_Init(void)
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.Name", "", NULL, NULL, DM_STRING);
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.NumberOfRetainedFailedReports", "0", Validate_NumberOfRetainedFailedReports, NULL, DM_INT);
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.Protocol", BULKDATA_PROTOCOL_HTTP, Validate_BulkDataProtocol, NULL, DM_STRING);
|
||||
- err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.EncodingType", BULKDATA_ENCODING_TYPE, Validate_BulkDataEncodingType, NULL, DM_STRING);
|
||||
+ err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.EncodingType", BULKDATA_ENCODING_TYPE_JSON, Validate_BulkDataEncodingType, NULL, DM_STRING);
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.ReportingInterval", "86400", Validate_BulkDataReportingInterval, NotifyChange_BulkDataReportingInterval, DM_UINT);
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.TimeReference", UNKNOWN_TIME_STR, NULL, NotifyChange_BulkDataTimeReference, DM_DATETIME);
|
||||
|
||||
@@ -312,6 +325,13 @@ int DEVICE_BULKDATA_Init(void)
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.JSONEncoding.ReportFormat", BULKDATA_JSON_REPORT_FORMAT_NAME_VALUE, Validate_BulkDataReportFormat, NULL, DM_STRING);
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.JSONEncoding.ReportTimestamp", BULKDATA_JSON_TIMESTAMP_FORMAT_EPOCH, Validate_BulkDataReportTimestamp, NULL, DM_STRING);
|
||||
|
||||
+ // Device.BulkData.Profile.{i}.CSVEncoding
|
||||
+ err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.CSVEncoding.FieldSeparator", ",", NULL, NULL, DM_STRING);
|
||||
+ err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.CSVEncoding.RowSeparator", " ", NULL, NULL, DM_STRING);
|
||||
+ err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.CSVEncoding.EscapeCharacter", """, NULL, NULL, DM_STRING);
|
||||
+ err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.CSVEncoding.ReportFormat", BULKDATA_CSV_REPORT_FORMAT_PER_COLUMN, Validate_BulkDataCSVReportFormat, NULL, DM_STRING);
|
||||
+ err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.CSVEncoding.RowTimestamp", BULKDATA_JSON_TIMESTAMP_FORMAT_EPOCH, Validate_BulkDataReportTimestamp, NULL, DM_STRING);
|
||||
+
|
||||
// Device.BulkData.Profile.{i}.HTTP
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.HTTP.URL", "", NULL, NotifyChange_BulkDataURL, DM_STRING);
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.HTTP.Username", "", NULL, NULL, DM_STRING);
|
||||
@@ -591,9 +611,10 @@ int Validate_BulkDataProtocol(dm_req_t *req, char *value)
|
||||
int Validate_BulkDataEncodingType(dm_req_t *req, char *value)
|
||||
{
|
||||
// Exit if trying to set a value outside of the range we accept
|
||||
- if (strcmp(value, BULKDATA_ENCODING_TYPE) != 0)
|
||||
+ if (strcmp(value, BULKDATA_ENCODING_TYPE_JSON) != 0 && strcmp(value, BULKDATA_ENCODING_TYPE_CSV) != 0)
|
||||
{
|
||||
- USP_ERR_SetMessage("%s: Only EncodingType supported is '%s'", __FUNCTION__, BULKDATA_ENCODING_TYPE);
|
||||
+ USP_ERR_SetMessage("%s: Only EncodingType supported are '%s,%s'", __FUNCTION__,
|
||||
+ BULKDATA_ENCODING_TYPE_JSON, BULKDATA_ENCODING_TYPE_CSV);
|
||||
return USP_ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
@@ -674,6 +695,32 @@ int Validate_BulkDataReportFormat(dm_req_t *req, char *value)
|
||||
return USP_ERR_OK;
|
||||
}
|
||||
|
||||
+/*********************************************************************//**
|
||||
+**
|
||||
+** Validate_BulkDataCSVReportFormat
|
||||
+**
|
||||
+** Validates Device.BulkData.Profile.{i}.CSVEncoding.ReportFormat
|
||||
+**
|
||||
+** \param req - pointer to structure identifying the parameter
|
||||
+** \param value - value that the controller would like to set the parameter to
|
||||
+**
|
||||
+** \return USP_ERR_OK if successful
|
||||
+**
|
||||
+**************************************************************************/
|
||||
+int Validate_BulkDataCSVReportFormat(dm_req_t *req, char *value)
|
||||
+{
|
||||
+ // Exit if trying to set a value outside of the range we accept
|
||||
+ if (strcmp(value, BULKDATA_CSV_REPORT_FORMAT_PER_COLUMN) != 0 &&
|
||||
+ strcmp(value, BULKDATA_CSV_REPORT_FORMAT_PER_ROW) != 0)
|
||||
+ {
|
||||
+ USP_ERR_SetMessage("%s: Only JSON Report Format supported are '%s', '%s'", __FUNCTION__,
|
||||
+ BULKDATA_CSV_REPORT_FORMAT_PER_COLUMN, BULKDATA_CSV_REPORT_FORMAT_PER_ROW);
|
||||
+ return USP_ERR_INVALID_VALUE;
|
||||
+ }
|
||||
+
|
||||
+ return USP_ERR_OK;
|
||||
+}
|
||||
+
|
||||
/*********************************************************************//**
|
||||
**
|
||||
** Validate_BulkDataReportTimestamp
|
||||
@@ -1970,6 +2017,14 @@ int bulkdata_platform_get_profile_control_params(bulkdata_profile_t *bp, profile
|
||||
return err;
|
||||
}
|
||||
|
||||
+ // Exit if unable to get EncodingType
|
||||
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.EncodingType", bp->profile_id);
|
||||
+ err = DATA_MODEL_GetParameterValue(path, ctrl_params->encoding_type, sizeof(ctrl_params->encoding_type), 0);
|
||||
+ if (err != USP_ERR_OK)
|
||||
+ {
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
// Exit if unable to get ReportTimestamp
|
||||
USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.JSONEncoding.ReportTimestamp", bp->profile_id);
|
||||
err = DATA_MODEL_GetParameterValue(path, ctrl_params->report_timestamp, sizeof(ctrl_params->report_timestamp), 0);
|
||||
@@ -1986,6 +2041,46 @@ int bulkdata_platform_get_profile_control_params(bulkdata_profile_t *bp, profile
|
||||
return err;
|
||||
}
|
||||
|
||||
+ // Exit if unable to get FieldSeparator
|
||||
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.CSVEncoding.FieldSeparator", bp->profile_id);
|
||||
+ err = DATA_MODEL_GetParameterValue(path, ctrl_params->field_separator, sizeof(ctrl_params->field_separator), 0);
|
||||
+ if (err != USP_ERR_OK)
|
||||
+ {
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ // Exit if unable to get RowSeparator
|
||||
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.CSVEncoding.RowSeparator", bp->profile_id);
|
||||
+ err = DATA_MODEL_GetParameterValue(path, ctrl_params->row_separator, sizeof(ctrl_params->row_separator), 0);
|
||||
+ if (err != USP_ERR_OK)
|
||||
+ {
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ // Exit if unable to get EscapeCharacter
|
||||
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.CSVEncoding.EscapeCharacter", bp->profile_id);
|
||||
+ err = DATA_MODEL_GetParameterValue(path, ctrl_params->escape_char, sizeof(ctrl_params->escape_char), 0);
|
||||
+ if (err != USP_ERR_OK)
|
||||
+ {
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ // Exit if unable to get ReportFormat
|
||||
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.CSVEncoding.ReportFormat", bp->profile_id);
|
||||
+ err = DATA_MODEL_GetParameterValue(path, ctrl_params->csv_format, sizeof(ctrl_params->csv_format), 0);
|
||||
+ if (err != USP_ERR_OK)
|
||||
+ {
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ // Exit if unable to get RowTimestamp
|
||||
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.CSVEncoding.RowTimestamp", bp->profile_id);
|
||||
+ err = DATA_MODEL_GetParameterValue(path, ctrl_params->row_timestamp, sizeof(ctrl_params->row_timestamp), 0);
|
||||
+ if (err != USP_ERR_OK)
|
||||
+ {
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
return USP_ERR_OK;
|
||||
}
|
||||
|
||||
@@ -2222,7 +2317,7 @@ void bulkdata_process_profile_http(bulkdata_profile_t *bp)
|
||||
{
|
||||
int err;
|
||||
report_t *cur_report;
|
||||
- char *json_report;
|
||||
+ char *report;
|
||||
profile_ctrl_params_t ctrl;
|
||||
unsigned char *compressed_report;
|
||||
int compressed_len;
|
||||
@@ -2261,10 +2356,23 @@ void bulkdata_process_profile_http(bulkdata_profile_t *bp)
|
||||
}
|
||||
|
||||
// Exit if unable to generate the report
|
||||
- json_report = bulkdata_generate_json_report(bp, ctrl.report_timestamp, ctrl.report_format);
|
||||
- if (json_report == NULL)
|
||||
- {
|
||||
- USP_ERR_SetMessage("%s: bulkdata_generate_json_report failed", __FUNCTION__);
|
||||
+ if (strcmp(ctrl.encoding_type, BULKDATA_ENCODING_TYPE_JSON) == 0) {
|
||||
+ report = bulkdata_generate_json_report(bp, ctrl.report_timestamp, ctrl.report_format);
|
||||
+ if (report == NULL)
|
||||
+ {
|
||||
+ USP_ERR_SetMessage("%s: bulkdata_generate_json_report failed", __FUNCTION__);
|
||||
+ return;
|
||||
+ }
|
||||
+ } else if (strcmp(ctrl.encoding_type, BULKDATA_ENCODING_TYPE_CSV) == 0) {
|
||||
+ report = bulkdata_generate_csv_report(bp, ctrl.field_separator, ctrl.row_separator, ctrl.escape_char,
|
||||
+ ctrl.csv_format, ctrl.row_timestamp);
|
||||
+ if (report == NULL)
|
||||
+ {
|
||||
+ USP_ERR_SetMessage("%s: bulkdata_generate_csv_report failed", __FUNCTION__);
|
||||
+ return;
|
||||
+ }
|
||||
+ } else {
|
||||
+ USP_ERR_SetMessage("%s: bulkdata invalid report encoding type %s", __FUNCTION__, ctrl.encoding_type);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2273,14 +2381,14 @@ void bulkdata_process_profile_http(bulkdata_profile_t *bp)
|
||||
USP_LOG_Info("BULK DATA: using compression method=%s", ctrl.compression);
|
||||
if (enable_protocol_trace)
|
||||
{
|
||||
- USP_LOG_String(kLogLevel_Info, kLogType_Protocol, json_report);
|
||||
+ USP_LOG_String(kLogLevel_Info, kLogType_Protocol, report);
|
||||
}
|
||||
|
||||
// Compress the report, if enabled
|
||||
- compressed_report = bulkdata_compress_report(&ctrl, json_report, strlen(json_report), &compressed_len);
|
||||
- if (compressed_report != (unsigned char *)json_report)
|
||||
+ compressed_report = bulkdata_compress_report(&ctrl, report, strlen(report), &compressed_len);
|
||||
+ if (compressed_report != (unsigned char *)report)
|
||||
{
|
||||
- free(json_report);
|
||||
+ free(report);
|
||||
}
|
||||
// NOTE: From this point on, only the compressed_report exists
|
||||
|
||||
@@ -2310,9 +2418,15 @@ void bulkdata_process_profile_usp_event(bulkdata_profile_t *bp)
|
||||
kv_vector_t event_args;
|
||||
kv_pair_t kv;
|
||||
report_t *cur_report;
|
||||
- char *json_report;
|
||||
+ char *report;
|
||||
+ char encoding_type[10] = {0};
|
||||
char report_timestamp[33] = {0};
|
||||
char report_format[20] = {0};
|
||||
+ char field_separator[10];
|
||||
+ char row_separator[10];
|
||||
+ char escape_char[10];
|
||||
+ char csv_format[20];
|
||||
+ char row_timestamp[33];
|
||||
|
||||
// Exit if the MTP has not been connected to successfully after bootup
|
||||
// This is to prevent BDC events being enqueued before the Boot! event is sent (the Boot! event is only sent after successfully connecting to the MTP).
|
||||
@@ -2321,20 +2435,62 @@ void bulkdata_process_profile_usp_event(bulkdata_profile_t *bp)
|
||||
goto exit;
|
||||
}
|
||||
|
||||
- // Exit if unable to get ReportTimestamp
|
||||
- USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.JSONEncoding.ReportTimestamp", bp->profile_id);
|
||||
- err = DATA_MODEL_GetParameterValue(path, report_timestamp, sizeof(report_timestamp), 0);
|
||||
- if (err != USP_ERR_OK)
|
||||
- {
|
||||
+ // Exit if unable to get EncodingType
|
||||
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.EncodingType", bp->profile_id);
|
||||
+ err = DATA_MODEL_GetParameterValue(path, encoding_type, sizeof(encoding_type), 0);
|
||||
+ if (err != USP_ERR_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
- // Exit if unable to get ReportFormat
|
||||
- USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.JSONEncoding.ReportFormat", bp->profile_id);
|
||||
- err = DATA_MODEL_GetParameterValue(path, report_format, sizeof(report_format), 0);
|
||||
- if (err != USP_ERR_OK)
|
||||
- {
|
||||
- return;
|
||||
+ if (strcmp(encoding_type, BULKDATA_ENCODING_TYPE_JSON) == 0) {
|
||||
+ // Exit if unable to get ReportTimestamp
|
||||
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.JSONEncoding.ReportTimestamp", bp->profile_id);
|
||||
+ err = DATA_MODEL_GetParameterValue(path, report_timestamp, sizeof(report_timestamp), 0);
|
||||
+ if (err != USP_ERR_OK) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // Exit if unable to get ReportFormat
|
||||
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.JSONEncoding.ReportFormat", bp->profile_id);
|
||||
+ err = DATA_MODEL_GetParameterValue(path, report_format, sizeof(report_format), 0);
|
||||
+ if (err != USP_ERR_OK) {
|
||||
+ return;
|
||||
+ }
|
||||
+ } else {
|
||||
+ // Exit if unable to get FieldSeparator
|
||||
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.CSVEncoding.FieldSeparator", bp->profile_id);
|
||||
+ err = DATA_MODEL_GetParameterValue(path, field_separator, sizeof(field_separator), 0);
|
||||
+ if (err != USP_ERR_OK) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // Exit if unable to get RowSeparator
|
||||
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.CSVEncoding.RowSeparator", bp->profile_id);
|
||||
+ err = DATA_MODEL_GetParameterValue(path, row_separator, sizeof(row_separator), 0);
|
||||
+ if (err != USP_ERR_OK) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // Exit if unable to get EscapeCharacter
|
||||
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.CSVEncoding.EscapeCharacter", bp->profile_id);
|
||||
+ err = DATA_MODEL_GetParameterValue(path, escape_char, sizeof(escape_char), 0);
|
||||
+ if (err != USP_ERR_OK) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // Exit if unable to get ReportFormat
|
||||
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.CSVEncoding.ReportFormat", bp->profile_id);
|
||||
+ err = DATA_MODEL_GetParameterValue(path, csv_format, sizeof(csv_format), 0);
|
||||
+ if (err != USP_ERR_OK) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // Exit if unable to get RowTimestamp
|
||||
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.CSVEncoding.RowTimestamp", bp->profile_id);
|
||||
+ err = DATA_MODEL_GetParameterValue(path, row_timestamp, sizeof(row_timestamp), 0);
|
||||
+ if (err != USP_ERR_OK) {
|
||||
+ return;
|
||||
+ }
|
||||
}
|
||||
|
||||
// When sending via USP events, only one report is ever sent in each USP event
|
||||
@@ -2354,10 +2510,16 @@ void bulkdata_process_profile_usp_event(bulkdata_profile_t *bp)
|
||||
bp->num_retained_reports = 1;
|
||||
|
||||
// Exit if unable to generate the report
|
||||
- json_report = bulkdata_generate_json_report(bp, report_timestamp, report_format);
|
||||
- if (json_report == NULL)
|
||||
+ if (strcmp(encoding_type, BULKDATA_ENCODING_TYPE_JSON) == 0) {
|
||||
+ report = bulkdata_generate_json_report(bp, report_timestamp, report_format);
|
||||
+ } else {
|
||||
+ report = bulkdata_generate_csv_report(bp, field_separator, row_separator, escape_char,
|
||||
+ csv_format, row_timestamp);
|
||||
+ }
|
||||
+
|
||||
+ if (report == NULL)
|
||||
{
|
||||
- USP_ERR_SetMessage("%s: bulkdata_generate_json_report failed", __FUNCTION__);
|
||||
+ USP_ERR_SetMessage("%s: bulkdata failed to generate report", __FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2365,15 +2527,15 @@ void bulkdata_process_profile_usp_event(bulkdata_profile_t *bp)
|
||||
|
||||
// Construct event_args manually to avoid the overhead of a malloc and copy of the report in KV_VECTOR_Add()
|
||||
kv.key = "Data";
|
||||
- kv.value = json_report;
|
||||
+ kv.value = report;
|
||||
event_args.vector = &kv;
|
||||
event_args.num_entries = 1;
|
||||
|
||||
USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.Push!", bp->profile_id);
|
||||
DEVICE_SUBSCRIPTION_ProcessAllEventCompleteSubscriptions(path, &event_args);
|
||||
|
||||
- // Free the report. No need to free the event_args as json_report is the only thing dynamically allocated in it
|
||||
- free(json_report); // The report is not allocated via USP_MALLOC
|
||||
+ // Free the report. No need to free the event_args as report is the only thing dynamically allocated in it
|
||||
+ free(report); // The report is not allocated via USP_MALLOC
|
||||
|
||||
// From the point of view of this code, the report(s) have been successfully sent, so don't retain them
|
||||
// NOTE: Sending of the reports successfully is delegated to the USP notification retry mechanism
|
||||
@@ -2833,6 +2995,219 @@ char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timesta
|
||||
return result;
|
||||
}
|
||||
|
||||
+/*********************************************************************//**
|
||||
+**
|
||||
+** append_string_to_target
|
||||
+**
|
||||
+** concatenates the src string with target string in newly allocated memory
|
||||
+** and assign back the new pointer.
|
||||
+**
|
||||
+** \param str - pointer to the src string
|
||||
+** \param output - address of the pointer that points to the target string
|
||||
+**
|
||||
+** \return None
|
||||
+**
|
||||
+**************************************************************************/
|
||||
+void append_string_to_target(char *str, char **output)
|
||||
+{
|
||||
+ char *tmp = NULL;
|
||||
+
|
||||
+ if (str == NULL || strlen(str) == 0)
|
||||
+ return;
|
||||
+
|
||||
+ if (*output == NULL || strlen(*output) == 0) {
|
||||
+ *output = USP_STRDUP(str);
|
||||
+ return;
|
||||
+ } else {
|
||||
+ tmp = USP_STRDUP(*output);
|
||||
+ free(*output);
|
||||
+ }
|
||||
+
|
||||
+ assert(tmp != NULL);
|
||||
+ asprintf(output, "%s%s", tmp, str);
|
||||
+ free(tmp);
|
||||
+}
|
||||
+
|
||||
+/*********************************************************************//**
|
||||
+**
|
||||
+** bulkdata_generate_csv_report
|
||||
+**
|
||||
+** Generates a CSV ParameterPerRow or ParameterPerColumn format report
|
||||
+** NOTE: The report contains all retained failed reports, as well as the current report
|
||||
+** See TR-157 section A.4.2 (end) for an example, and section A.3.5.2 for layout of content containing failed report transmissions
|
||||
+**
|
||||
+** \param bp - pointer to bulk data profile containing all reports (current and retained)
|
||||
+** \param field_separator - value of Device.Bulkdata.Profile.{i}.CSVEncoding.FieldSeparator
|
||||
+** \param row_separator - value of Device.Bulkdata.Profile.{i}.CSVEncoding.RowSeparator
|
||||
+** \param escape_char - value of Device.Bulkdata.Profile.{i}.CSVEncoding.EscapeCharacter
|
||||
+** \param csv_format - value of Device.BulkData.Profile.{i}.CSVEncoding.ReportFormat
|
||||
+** \param row_timestamp - value of Device.Bulkdata.Profile.{i}.CSVEncoding.RowTimestamp
|
||||
+**
|
||||
+** \return pointer to NULL terminated dynamically allocated buffer containing the serialized report to send
|
||||
+**
|
||||
+**************************************************************************/
|
||||
+char *bulkdata_generate_csv_report(bulkdata_profile_t *bp, char *field_separator, char *row_separator,
|
||||
+ char *escape_char, char *csv_format, char *row_timestamp)
|
||||
+{
|
||||
+ char *param_path;
|
||||
+ char *param_type_value;
|
||||
+ char param_type;
|
||||
+ char *param_value;
|
||||
+ kv_vector_t *report_map;
|
||||
+ report_t *report;
|
||||
+ int i, j;
|
||||
+ bool value_as_bool;
|
||||
+ char buf[32];
|
||||
+ kv_pair_t *kv;
|
||||
+ int err;
|
||||
+ char *output = NULL, *str = NULL, *str1 = NULL, *str2 = NULL, rowseparator = '\0', separator = '\0';
|
||||
+
|
||||
+ if (strcmp(row_separator, " ") == 0)
|
||||
+ rowseparator = '\n';
|
||||
+ else if (strcmp(row_separator, " ") == 0)
|
||||
+ rowseparator = '\r';
|
||||
+
|
||||
+ if (field_separator)
|
||||
+ separator = field_separator[0];
|
||||
+
|
||||
+ if (strcasecmp(csv_format, "ParameterPerRow") == 0) {
|
||||
+ if (strcmp(row_timestamp, "None") == 0)
|
||||
+ asprintf(&str, "ParameterName%cParameterValue%cParameterType%c", separator, separator, rowseparator);
|
||||
+ else
|
||||
+ asprintf(&str, "ReportTimestamp%cParameterName%cParameterValue%cParameterType%c", separator, separator, separator, rowseparator);
|
||||
+
|
||||
+ assert(str != NULL);
|
||||
+ append_string_to_target(str, &output);
|
||||
+ free(str);
|
||||
+ str = NULL;
|
||||
+ }
|
||||
+
|
||||
+ for (i=0; i < bp->num_retained_reports; i++)
|
||||
+ {
|
||||
+ char *timestamp = NULL;
|
||||
+ report = &bp->reports[i];
|
||||
+ report_map = &report->report_map;
|
||||
+
|
||||
+ // Add Collection time to each csv report element (only if specified and not 'None')
|
||||
+ if (strcmp(row_timestamp, "Unix-Epoch")==0)
|
||||
+ {
|
||||
+ asprintf(×tamp, "%lld", (long long int)report->collection_time);
|
||||
+ }
|
||||
+ else if (strcmp(row_timestamp, "ISO-8601")==0)
|
||||
+ {
|
||||
+ char *result = iso8601_from_unix_time(report->collection_time, buf, sizeof(buf));
|
||||
+ if (result != NULL)
|
||||
+ {
|
||||
+ asprintf(×tamp, "%s", buf);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (strcasecmp(csv_format, "ParameterPerColumn") == 0 && timestamp) {
|
||||
+ append_string_to_target("ReportTimestamp", &str1);
|
||||
+ append_string_to_target(timestamp, &str2);
|
||||
+ }
|
||||
+
|
||||
+ // Iterate over each parameter, adding it to the json element. Take account of the parameter's type
|
||||
+ for (j=0; j < report_map->num_entries; j++)
|
||||
+ {
|
||||
+ kv = &report_map->vector[j];
|
||||
+ param_path = kv->key;
|
||||
+ param_type_value = kv->value;
|
||||
+ param_type = param_type_value[0]; // First character denotes the type of the parameter
|
||||
+ param_value = ¶m_type_value[1]; // Subsequent characters contain the parameter's valu
|
||||
+ char *type = NULL;
|
||||
+ switch (param_type)
|
||||
+ {
|
||||
+ case 'S':
|
||||
+ type = "string";
|
||||
+ break;
|
||||
+
|
||||
+ case 'U':
|
||||
+ type = "unsignedInt";
|
||||
+ break;
|
||||
+
|
||||
+ case 'L':
|
||||
+ type = "long";
|
||||
+ break;
|
||||
+
|
||||
+ case 'N':
|
||||
+ type = "decimal";
|
||||
+ break;
|
||||
+
|
||||
+ case 'B':
|
||||
+ err = TEXT_UTILS_StringToBool(param_value, &value_as_bool);
|
||||
+ if (err == USP_ERR_OK)
|
||||
+ {
|
||||
+ type = "boolean";
|
||||
+ param_value = value_as_bool ? "True" : "False";
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ USP_ERR_SetMessage("%s: Invalid JSON parameter type ('%c') in report map for %s", __FUNCTION__, param_type_value[0], param_path);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (type) {
|
||||
+ if (strcasecmp(csv_format, "ParameterPerRow") == 0) {
|
||||
+ if (timestamp == NULL)
|
||||
+ asprintf(&str, "%s%c%s%c%s%c", param_path, separator, param_value, separator, type, rowseparator);
|
||||
+ else
|
||||
+ asprintf(&str, "%s%c%s%c%s%c%s%c", timestamp, separator, param_path, separator, param_value, separator, type, rowseparator);
|
||||
+
|
||||
+ assert(str != NULL);
|
||||
+ append_string_to_target(str, &output);
|
||||
+ free(str);
|
||||
+ str = NULL;
|
||||
+ } else {
|
||||
+ if (str1 == NULL || strlen(str1) == 0)
|
||||
+ asprintf(&str, "%s", param_path);
|
||||
+ else
|
||||
+ asprintf(&str, "%c%s", separator, param_path);
|
||||
+
|
||||
+ assert(str != NULL);
|
||||
+ append_string_to_target(str, &str1);
|
||||
+ free(str);
|
||||
+ str = NULL;
|
||||
+
|
||||
+ if (str2 == NULL || strlen(str2) == 0)
|
||||
+ asprintf(&str, "%s", param_value);
|
||||
+ else
|
||||
+ asprintf(&str, "%c%s", separator, param_value);
|
||||
+
|
||||
+ assert(str != NULL);
|
||||
+ append_string_to_target(str, &str2);
|
||||
+ free(str);
|
||||
+ str = NULL;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (timestamp) {
|
||||
+ free(timestamp);
|
||||
+ timestamp = NULL;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (strcasecmp(csv_format, "ParameterPerColumn") == 0) {
|
||||
+ asprintf(&str, "%c", rowseparator);
|
||||
+ assert(str != NULL);
|
||||
+ append_string_to_target(str, &str1);
|
||||
+ append_string_to_target(str, &str2);
|
||||
+ append_string_to_target(str1, &output);
|
||||
+ append_string_to_target(str2, &output);
|
||||
+ }
|
||||
+
|
||||
+ if (str)
|
||||
+ free(str);
|
||||
+ if (str1)
|
||||
+ free(str1);
|
||||
+ if (str2)
|
||||
+ free(str2);
|
||||
+
|
||||
+ return output;
|
||||
+}
|
||||
+
|
||||
/*********************************************************************//**
|
||||
**
|
||||
** bulkdata_compress_report
|
||||
@@ -2986,9 +3361,18 @@ int bulkdata_schedule_sending_http_report(profile_ctrl_params_t *ctrl, bulkdata_
|
||||
flags |= BDC_FLAG_DATE_HEADER;
|
||||
}
|
||||
|
||||
- if (strcmp(ctrl->report_format, BULKDATA_JSON_REPORT_FORMAT_OBJ_HIER) == 0)
|
||||
- {
|
||||
- flags |= BDC_FLAG_HEADER_OBJ_HIER;
|
||||
+ if (strcmp(ctrl->encoding_type, BULKDATA_ENCODING_TYPE_JSON) == 0) {
|
||||
+ if (strcmp(ctrl->report_format, BULKDATA_JSON_REPORT_FORMAT_OBJ_HIER) == 0) {
|
||||
+ flags |= BDC_FLAG_HEADER_OBJ_HIER;
|
||||
+ } else {
|
||||
+ flags |= BDC_FLAG_HEADER_NAME_VAL;
|
||||
+ }
|
||||
+ } else {
|
||||
+ if (strcmp(ctrl->csv_format, BULKDATA_CSV_REPORT_FORMAT_PER_COLUMN) == 0) {
|
||||
+ flags |= BDC_FLAG_HEADER_PER_COL;
|
||||
+ } else {
|
||||
+ flags |= BDC_FLAG_HEADER_PER_ROW;
|
||||
+ }
|
||||
}
|
||||
|
||||
// Exit if failed to post a message to BDC thread
|
||||
@@ -6,6 +6,8 @@ set_serial_number() {
|
||||
vendor_id=$1
|
||||
vssn=$2
|
||||
|
||||
# Vendor id is not taken from serial automatically, propagate it as well
|
||||
/userfs/bin/omcicfgCmd set vendorId ${vendor_id}
|
||||
/userfs/bin/omcicfgCmd set sn ${vendor_id}${vssn}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sulu-base
|
||||
PKG_VERSION:=2.0.3
|
||||
PKG_VERSION:=2.0.8
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu.git
|
||||
PKG_SOURCE_VERSION:=424fb2c76b8b59d235705c5ea8cb0a188d72024d
|
||||
PKG_SOURCE_VERSION:=c867e8ba1f2a61e88b8c7eb4331465d2dc90c412
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
SULU_MOD:=core
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sulu-builder
|
||||
PKG_VERSION:=2.0.4
|
||||
PKG_VERSION:=2.0.8
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu-builder.git
|
||||
PKG_SOURCE_VERSION:=fc2b367cb949fd247fce78e7bf06bd24c97aa9b4
|
||||
PKG_SOURCE_VERSION:=cc34ec44b9d6803bc80752e2a87fbd9c476fc0dc
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/sulu-$(PKG_VERSION)/sulu-builder-$(PKG_SOURCE_VERSION)
|
||||
@@ -19,8 +19,7 @@ PKG_MIRROR_HASH:=skip
|
||||
PKG_LICENSE:=PROPRIETARY IOPSYS
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
SULU_PLUGINS:=$(filter-out Readme.md,$(notdir $(wildcard ../*)))
|
||||
SULU_PLUGINS:=$(filter-out sulu-builder,$(notdir $(wildcard ../*)))
|
||||
SULU_PLUGINS:=$(filter-out sulu-builder,$(filter-out Readme.md,$(notdir $(wildcard ../*))))
|
||||
SULU_EXTRA:=$(subst $\",,$(CONFIG_SULU_EXTRA_PACKAGES))
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
||||
@@ -7,17 +7,6 @@ if [ ! -f "/etc/config/mosquitto" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
add_obuspa_config()
|
||||
{
|
||||
if ! uci_get mosquitto obuspa >/dev/null 2>&1; then
|
||||
uci_add mosquitto listener obuspa
|
||||
uci_set mosquitto obuspa enabled 1
|
||||
uci_set mosquitto obuspa port '1883'
|
||||
uci_set mosquitto obuspa no_remote_access '1'
|
||||
uci_set mosquitto obuspa allow_anonymous '1'
|
||||
fi
|
||||
}
|
||||
|
||||
add_sulu_config()
|
||||
{
|
||||
if ! uci_get mosquitto sulu >/dev/null 2>&1; then
|
||||
@@ -33,5 +22,4 @@ add_sulu_config()
|
||||
}
|
||||
|
||||
uci_load mosquitto
|
||||
add_obuspa_config
|
||||
add_sulu_config
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=sulu-multi-ap
|
||||
PKG_VERSION:=2.0.3
|
||||
PKG_VERSION:=2.0.7
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu-multi-ap.git
|
||||
PKG_SOURCE_VERSION:=b1e144f1c9bbf641754a6a88693d1c7f8700e6bf
|
||||
PKG_SOURCE_VERSION:=ce924795ad6cabe054a1051fb430f515d0961bbc
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
include ../sulu-builder/sulu.mk
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=sulu-parental-control
|
||||
PKG_VERSION:=2.0.2
|
||||
PKG_VERSION:=2.0.7
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu-parental-control.git
|
||||
PKG_SOURCE_VERSION:=484c0bcb1ced835a3ca2f26cadb7180fd7572ddd
|
||||
PKG_SOURCE_VERSION:=83d89da5172a5921cd2fa456ca35c181fb9dd7a5
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
include ../sulu-builder/sulu.mk
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=swmodd
|
||||
PKG_VERSION:=2.1.22
|
||||
PKG_VERSION:=2.1.23
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
|
||||
@@ -48,17 +48,17 @@ configure_crun_container() {
|
||||
uci_set ocicontainer "${1}" password ""
|
||||
result=$(${RUNNER} -b "${BUNDLE}" -n "${name}" -r "${url}" -l "${username}:${password}")
|
||||
if [ "$?" -eq 0 ]; then
|
||||
result=$(cat "${BUNDLE}"/"${name}"/config.json |jq ".annotations.org_opencontainers_image_description")
|
||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_description")
|
||||
if [ "${result}" != "null" ]; then
|
||||
uci_set ocicontainer "${1}" description "${result}"
|
||||
fi
|
||||
|
||||
result=$(cat "${BUNDLE}"/"${name}"/config.json |jq ".annotations.org_opencontainers_image_vendor")
|
||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_vendor")
|
||||
if [ "${result}" != "null" ]; then
|
||||
uci_set ocicontainer "${1}" vendor "${result}"
|
||||
fi
|
||||
|
||||
result=$(cat "${BUNDLE}"/"${name}"/config.json |jq ".annotations.org_opencontainers_image_version")
|
||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_version")
|
||||
if [ "${result}" != "null" ]; then
|
||||
uci_set ocicontainer "${1}" version "${result}"
|
||||
fi
|
||||
@@ -106,17 +106,17 @@ configure_crun_container() {
|
||||
if [ "${BOOT}" -eq "1" ]; then
|
||||
if [ "${autostart}" -eq 1 ]; then
|
||||
${RUNNER} -U -b "${BUNDLE}" -n "${name}"
|
||||
result=$(cat "${BUNDLE}"/"${name}"/config.json |jq ".annotations.org_opencontainers_image_description")
|
||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_description")
|
||||
if [ "${result}" != "null" ]; then
|
||||
uci_set ocicontainer "${1}" description "${result}"
|
||||
fi
|
||||
|
||||
result=$(cat "${BUNDLE}"/"${name}"/config.json |jq ".annotations.org_opencontainers_image_vendor")
|
||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_vendor")
|
||||
if [ "${result}" != "null" ]; then
|
||||
uci_set ocicontainer "${1}" vendor "${result}"
|
||||
fi
|
||||
|
||||
result=$(cat "${BUNDLE}"/"${name}"/config.json |jq ".annotations.org_opencontainers_image_version")
|
||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_version")
|
||||
if [ "${result}" != "null" ]; then
|
||||
uci_set ocicontainer "${1}" version "${result}"
|
||||
fi
|
||||
@@ -139,17 +139,17 @@ configure_crun_container() {
|
||||
crun resume "${name}"
|
||||
else
|
||||
${RUNNER} -U -b "${BUNDLE}" -n "${name}"
|
||||
result=$(cat "${BUNDLE}"/"${name}"/config.json |jq ".annotations.org_opencontainers_image_description")
|
||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_description")
|
||||
if [ "${result}" != "null" ]; then
|
||||
uci_set ocicontainer "${1}" description "${result}"
|
||||
fi
|
||||
|
||||
result=$(cat "${BUNDLE}"/"${name}"/config.json |jq ".annotations.org_opencontainers_image_vendor")
|
||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_vendor")
|
||||
if [ "${result}" != "null" ]; then
|
||||
uci_set ocicontainer "${1}" vendor "${result}"
|
||||
fi
|
||||
|
||||
result=$(cat "${BUNDLE}"/"${name}"/config.json |jq ".annotations.org_opencontainers_image_version")
|
||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_version")
|
||||
if [ "${result}" != "null" ]; then
|
||||
uci_set ocicontainer "${1}" version "${result}"
|
||||
fi
|
||||
|
||||
@@ -35,12 +35,12 @@ mount_cgroup()
|
||||
fi
|
||||
|
||||
mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
|
||||
cd /sys/fs/cgroup || return 1
|
||||
cd /sys/fs/cgroup
|
||||
for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do
|
||||
mkdir -p "${sys}"
|
||||
if ! mountpoint -q "${sys}"; then
|
||||
if ! mount -n -t cgroup -o "${sys}" cgroup "${sys}"; then
|
||||
rm -f "${sys}" || true
|
||||
mkdir -p $sys
|
||||
if ! mountpoint -q $sys; then
|
||||
if ! mount -n -t cgroup -o $sys cgroup $sys; then
|
||||
rm -f $sys || true
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -92,11 +92,11 @@ run_container() {
|
||||
|
||||
update_network_ns() {
|
||||
local type
|
||||
json_select "${2}"
|
||||
json_select $2
|
||||
json_get_var type type
|
||||
if [ "${type}" = "network" ]; then
|
||||
json_add_string path "/var/run/netns/${NAME}"
|
||||
return;
|
||||
break;
|
||||
fi
|
||||
json_select ..
|
||||
}
|
||||
@@ -121,7 +121,7 @@ update_config_json() {
|
||||
log "jshn.sh missing in the system"
|
||||
exit 1;
|
||||
fi
|
||||
cd "${BUNDLE}/${NAME}" || exit 1;
|
||||
cd "${BUNDLE}/${NAME}"
|
||||
if cat config.json |jq '.linux.namespaces[] |select (.type == "network") |.path' |grep -q ${NAME}; then
|
||||
exit 0;
|
||||
fi
|
||||
@@ -157,20 +157,20 @@ pull_image_from_registry() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "${temp}" || exit 1;
|
||||
cd "${temp}"
|
||||
OPTS=""
|
||||
INSPECT_OPT=""
|
||||
if [ "${#LOGIN}" -gt 3 ]; then
|
||||
OPTS="--src-creds ${LOGIN}"
|
||||
INSPECT_OPT="--creds ${LOGIN}"
|
||||
fi
|
||||
if ! skopeo --command-timeout 4m copy "${OPTS}" "${REGURL}" oci:"${NAME}"_tmp:latest >/dev/null 2>&1; then
|
||||
if ! skopeo --command-timeout 4m copy ${OPTS} ${REGURL} oci:${NAME}_tmp:latest >/dev/null 2>&1; then
|
||||
log "Failed to download image"
|
||||
cd -
|
||||
rm -rf "${temp}"
|
||||
exit 1
|
||||
fi
|
||||
if ! umoci unpack --image "${NAME}"_tmp:latest "${NAME}" >/dev/null 2>&1; then
|
||||
if ! umoci unpack --image ${NAME}_tmp:latest ${NAME} >/dev/null 2>&1; then
|
||||
log "Failed to unpack image"
|
||||
cd -
|
||||
rm -rf "${temp}"
|
||||
@@ -185,8 +185,8 @@ pull_image_from_registry() {
|
||||
fi
|
||||
|
||||
# Check disk available space before copy
|
||||
disksize=$(df -P -k "${BUNDLE}" |tail -n +2 |awk '{print $4}')
|
||||
exsize=$(du -s "${temp}" |awk '{print $1}')
|
||||
disksize=$(df -P -k ${BUNDLE} |tail -n +2 |awk '{print $4}')
|
||||
exsize=$(du -s ${temp} |awk '{print $1}')
|
||||
if [ "${disksize}" -lt "${exsize}" ]; then
|
||||
log "Disk space ${disksize} less than required ${exsize}"
|
||||
cd -
|
||||
@@ -194,12 +194,12 @@ pull_image_from_registry() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mv "${NAME}" "${BUNDLE}"/
|
||||
mv ${NAME} ${BUNDLE}/
|
||||
if [ "$?" -ne 0 ]; then
|
||||
log "Failed ${name} move in ${BUNDLE}"
|
||||
cd -
|
||||
rm -rf "${temp}"
|
||||
rm -rf "${BUNDLE}"/"${NAME}"
|
||||
rm -rf ${BUNDLE}/${NAME}
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ if [ -n "${lxc_bundle}" ]; then
|
||||
echo "lxc.lxcpath = ${lxc_bundle}" > /etc/lxc/lxc.conf
|
||||
elif [ -n "${lxc}" ]; then
|
||||
# if lxc_bundle_root not define in swmodd, update it with lxc path
|
||||
uci_set swmodd globals lxc_bundle_root "${lxc}"
|
||||
uci_set swmodd globals lxc_bundle_root ${lxc}
|
||||
uci_commit
|
||||
else
|
||||
mkdir -p /etc/lxc
|
||||
@@ -35,7 +35,7 @@ if [ -z "${oci_bundle}" ] && [ -n "${lxc_bundle}" ]; then
|
||||
uci_commit
|
||||
elif [ -z "${oci_bundle}" ] && [ -n "${lxc}" ]; then
|
||||
# if oci_bundle_root not defined in swmodd, update it with lxc path
|
||||
uci_set swmodd globals oci_bundle_root "${lxc}"
|
||||
uci_set swmodd globals oci_bundle_root ${lxc}
|
||||
uci_commit
|
||||
elif [ -z "${oci_bundle}" ]; then
|
||||
uci_set swmodd globals oci_bundle_root "/srv/"
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=uspd
|
||||
PKG_VERSION:=2.2.25
|
||||
PKG_VERSION:=2.2.27
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/uspd.git
|
||||
PKG_SOURCE_VERSION:=d29d9581ac2d1a31e0a55ba472d1fc1c494cb392
|
||||
PKG_SOURCE_VERSION:=35d2c6f62d1b6513826d3f7beab11687b7d7def7
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -2,5 +2,5 @@ config uspd 'usp'
|
||||
option granularitylevel '0'
|
||||
option debug '0'
|
||||
option loglevel '1'
|
||||
option refresh_time '5'
|
||||
option refresh_time '10'
|
||||
option transaction_timeout '10'
|
||||
|
||||
@@ -45,19 +45,35 @@ configure_uspd()
|
||||
fi
|
||||
}
|
||||
|
||||
apply_sysctl_configuration() {
|
||||
local sysctl_conf
|
||||
|
||||
sysctl_conf="/etc/bbfdm/sysctl.conf"
|
||||
|
||||
[ -f "${sysctl_conf}" ] || touch "${sysctl_conf}"
|
||||
|
||||
sysctl -e -p "${sysctl_conf}" >&-
|
||||
}
|
||||
|
||||
start_service() {
|
||||
local sysctl_reload
|
||||
|
||||
ubus -t 5 wait_for network.device
|
||||
[ "$?" -eq 0 ] && sysctl_reload=1
|
||||
|
||||
procd_open_instance usp
|
||||
configure_uspd
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
|
||||
[ "${sysctl_reload}" -eq 1 ] && apply_sysctl_configuration
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
apply_sysctl_configuration
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger "uspd"
|
||||
procd_add_reload_trigger "uspd" "network"
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/$(PKG_NAME).git
|
||||
PKG_SOURCE_VERSION:=049933cc516d7cd6105e13b7ac5a61c8c2aed55f
|
||||
PKG_SOURCE_VERSION:=97f67f99b542fdfffab1195cbd4300b57a3f19e1
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -38,10 +38,22 @@ define Package/$(PKG_NAME)
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=IOPSYS Voice Manager
|
||||
URL:=
|
||||
DEPENDS:= +libubox +ubus +libpicoevent +uci \
|
||||
|
||||
DEPENDS:= +libubox +ubus +libblobmsg-json +!TARGET_brcmbca:libpicoevent +TARGET_brcmbca:libpicoevent-bcm \
|
||||
+!TARGET_brcmbca:uci +TARGET_brcmbca:uci-bcm \
|
||||
+TARGET_brcmbca:bcmkernel +TARGET_brcmbca:libvoice-broadcom \
|
||||
+TARGET_ipq95xx:libvoice-d2 +TARGET_ipq95xx:d2-voice +TARGET_ipq95xx:kmod-d2-voice \
|
||||
+TARGET_ipq95xx:libvoice-d2 +TARGET_ipq95xx:kmod-d2-voice \
|
||||
+TARGET_airoha:kmod-voip_driver +TARGET_airoha:voip_app +TARGET_airoha:libvoice-airoha
|
||||
|
||||
ifeq ($(CONFIG_TARGET_brcmbca),y)
|
||||
include $(TOPDIR)/feeds/broadcom/bcmkernel/bcm-toolchain.mk
|
||||
TARGET_CFLAGS := -I$(STAGING_DIR)/usr/include/bcm963xx/ -L$(STAGING_DIR)/root-brcmbca/usr/lib/broadcom -L$(STAGING_DIR)/usr/lib/broadcom
|
||||
TARGET_CPPFLAGS :=
|
||||
TARGET_CXXFLAGS :=
|
||||
EXTRA_CFLAGS :=
|
||||
endif
|
||||
|
||||
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
@@ -68,6 +80,5 @@ define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/sbin/
|
||||
$(CP) $(PKG_BUILD_DIR)/libvoice/libvoice.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
|
||||
|
||||
@@ -9,9 +9,12 @@ NAME=voicemngr
|
||||
start_service() {
|
||||
[ "$(db -q get hw.board.hasVoice)" = "1" ] || return
|
||||
|
||||
[ -d "/usr/lib/broadcom" ] && BCM_LIBS=LD_LIBRARY_PATH=/usr/lib/broadcom
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param env hw_board_hasDect="$(db get hw.board.hasDect)" \
|
||||
hw_board_VoicePortNames="$(db get hw.board.VoicePortNames)"
|
||||
hw_board_VoicePortNames="$(db get hw.board.VoicePortNames)" \
|
||||
$BCM_LIBS
|
||||
procd_set_param command $NAME
|
||||
procd_set_param respawn "5" "0" "3"
|
||||
procd_set_param nice -12
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=wfadatad
|
||||
PKG_VERSION:=4.0.1.6
|
||||
PKG_VERSION:=4.0.1.7
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=7f882307d34a09b1cf09ea3335c2fa71a59ce92f
|
||||
PKG_SOURCE_VERSION:=b165177f12b2cef129f36bff1be077b65fbc86aa
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/wfadatad.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=wifimngr
|
||||
PKG_VERSION:=15.0.6
|
||||
PKG_VERSION:=15.0.7
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=fdbc45c18f67655544546868b2069c028e1e0628
|
||||
PKG_SOURCE_VERSION:=2da5a816e034751baa426605e1e653ec62afc749
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/wifimngr.git
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
|
||||
Reference in New Issue
Block a user