mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-24 19:14:05 +08:00
Compare commits
108 Commits
mapcext
...
test_app_l
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
530cca802a | ||
|
|
d7f6c6a9f7 | ||
|
|
1416a64348 | ||
|
|
611d6bcee9 | ||
|
|
8dba98e282 | ||
|
|
febad86760 | ||
|
|
a56f8d7be9 | ||
|
|
5ea8207cef | ||
|
|
1dfba64bde | ||
|
|
bcbc7999cd | ||
|
|
5c78b83ac8 | ||
|
|
ef8c6eb8c9 | ||
|
|
7e7867becf | ||
|
|
a03a91f858 | ||
|
|
370d03eaf6 | ||
|
|
e142514135 | ||
|
|
7e19d3550a | ||
|
|
b0cc223750 | ||
|
|
bf8c210f3b | ||
|
|
493d8b05cd | ||
|
|
13b5958852 | ||
|
|
02ff58d9c2 | ||
|
|
59dc9afe0f | ||
|
|
70f9fc7854 | ||
|
|
da43c27174 | ||
|
|
82b06b2365 | ||
|
|
ad64108ada | ||
|
|
9108ff44bc | ||
|
|
0915525fd0 | ||
|
|
958ff29190 | ||
|
|
cc32f540d4 | ||
|
|
b2823a6b1d | ||
|
|
d3d0584056 | ||
|
|
8372c9c7ad | ||
|
|
faa39d1d15 | ||
|
|
e0b38245e1 | ||
|
|
f40d078a3b | ||
|
|
87cf33663c | ||
|
|
99e5dd1443 | ||
|
|
7f53336a83 | ||
|
|
32479eab89 | ||
|
|
7e607d8e09 | ||
|
|
7528a4a11f | ||
|
|
77b306d598 | ||
|
|
575a88afdd | ||
|
|
6741df8952 | ||
|
|
60f9815721 | ||
|
|
4cab43e30d | ||
|
|
342bec0b25 | ||
|
|
3942b33e1e | ||
|
|
3c3608e87c | ||
|
|
aaf0029500 | ||
|
|
7b80bcf104 | ||
|
|
f419a955f6 | ||
|
|
d644ce7be6 | ||
|
|
887ff49b95 | ||
|
|
9c6533f45f | ||
|
|
08f903e2c1 | ||
|
|
833837cea1 | ||
|
|
dabf83ea1d | ||
|
|
0e6146f105 | ||
|
|
220a4efbf7 | ||
|
|
e5d8d81019 | ||
|
|
70442e891f | ||
|
|
ec021d54f5 | ||
|
|
421e633094 | ||
|
|
068308f052 | ||
|
|
8809a7aba7 | ||
|
|
7575dccbc0 | ||
|
|
871831fdac | ||
|
|
db41d298c3 | ||
|
|
ad372152d5 | ||
|
|
926648b090 | ||
|
|
240bdc5bb8 | ||
|
|
45e0b4f2ed | ||
|
|
332a90d087 | ||
|
|
09937f540a | ||
|
|
af8f27ef65 | ||
|
|
8a799f183b | ||
|
|
2dbf38c06c | ||
|
|
b1fcc12599 | ||
|
|
9041f616e7 | ||
|
|
dc14b18428 | ||
|
|
e41f973953 | ||
|
|
9889814f0b | ||
|
|
2922f211f7 | ||
|
|
22dd43c79e | ||
|
|
478c34d48f | ||
|
|
49f46ef075 | ||
|
|
03dc0ebb72 | ||
|
|
fa44657557 | ||
|
|
42a3ed939a | ||
|
|
6e35356954 | ||
|
|
7978a656a7 | ||
|
|
17322c3cba | ||
|
|
890b627139 | ||
|
|
0ad28b756b | ||
|
|
309c26f4b0 | ||
|
|
df4e11ae30 | ||
|
|
9de4a18a20 | ||
|
|
bfcc877a6a | ||
|
|
d9527a5a1a | ||
|
|
e707922d29 | ||
|
|
cfc2e6d9eb | ||
|
|
0ec3e0eae8 | ||
|
|
38c4c7ded0 | ||
|
|
24a82ab61c | ||
|
|
5977ec807c |
77
ated/Makefile
Normal file
77
ated/Makefile
Normal file
@@ -0,0 +1,77 @@
|
||||
#
|
||||
# Copyright (C) 2019 iopsys Software Solutions AB. All rights reserved.
|
||||
#
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=ated
|
||||
PKG_VERSION:=1.2.2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_VERSION:=f614cba983d827d5185c60a6a5a35530621d44d2
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/mediatek/ated.git
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
# support parallel build
|
||||
#PKG_BUILD_PARALLEL:=1
|
||||
|
||||
#re create configure scripts if not present.
|
||||
#PKG_FIXUP:=autoreconf
|
||||
|
||||
# run install target when cross compiling. basically, make install DESTDIR=$(PKG_INSTALL_DIR)
|
||||
# this way we don't need to pick out the resulting files from the build dir.
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ated
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Daemon for handling wifi calibration
|
||||
URL:=
|
||||
DEPENDS:= libc
|
||||
endef
|
||||
|
||||
define Package/ated/description
|
||||
Daemon for handling wifi calibration
|
||||
endef
|
||||
|
||||
#TARGET_CFLAGS += -I$(LINUX_DIR)/include -I$(LINUX_DIR)/arch/mips/include
|
||||
|
||||
MAKE_FLAGS += \
|
||||
v=2 \
|
||||
m=3
|
||||
|
||||
|
||||
#TARGET_CPPFLAGS := \
|
||||
# -I$(STAGING_DIR)/usr/include/bcm963xx/shared/opensource/include/bcm963xx \
|
||||
# -I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx \
|
||||
# $(TARGET_CPPFLAGS)
|
||||
|
||||
# we donot wwant to have any install.
|
||||
define Build/Install/Default
|
||||
endef
|
||||
|
||||
define Package/ated/install
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ated $(1)/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ated))
|
||||
27
bbf/Config_bbfdm.in
Normal file
27
bbf/Config_bbfdm.in
Normal file
@@ -0,0 +1,27 @@
|
||||
if PACKAGE_libbbfdm
|
||||
|
||||
config LIBBBFDM_VENDOR_PREFIX
|
||||
string "Vendor Prefix"
|
||||
default "X_IOPSYS_EU_"
|
||||
|
||||
config BBF_TR181
|
||||
bool "Compile with tr181 device features"
|
||||
default y
|
||||
|
||||
config BBF_TR104
|
||||
bool "Compile with tr104 voice features"
|
||||
default y
|
||||
|
||||
config BBF_TR143
|
||||
bool "Compile with tr143 diagnostics features"
|
||||
default y
|
||||
|
||||
config BBF_TR157
|
||||
bool "Compile with tr157 bulkdata collector features"
|
||||
default y
|
||||
|
||||
config BBF_TR064
|
||||
bool "Compile with tr064 features"
|
||||
default n
|
||||
|
||||
endif
|
||||
126
bbf/Makefile
Normal file
126
bbf/Makefile
Normal file
@@ -0,0 +1,126 @@
|
||||
#
|
||||
# Copyright (C) 2019 IOPSYS
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libbbfdm
|
||||
PKG_VERSION:=2.5-2020-10-26
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/bbf.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=b0cd55880850efc7995f8cb82ac6dd55e75c7b97
|
||||
PKG_RELEASE=$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=LGPL-2.1
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/libbbf_api
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=Library for libbbfdm API
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c
|
||||
endef
|
||||
|
||||
define Package/libbbfdm
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=Library for broadband-forum data model
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libtrace +libbbf_api +libopenssl +libmbedtls
|
||||
endef
|
||||
|
||||
define Package/libbbfdm/config
|
||||
source "$(SOURCE)/Config_bbfdm.in"
|
||||
endef
|
||||
|
||||
define Package/libbbf_api/description
|
||||
Library contains the API(UCI, UBUS, JSON, CLI and Browse) of libbbfdm
|
||||
endef
|
||||
|
||||
define Package/libbbfdm/description
|
||||
Library contains the data model tree. It includes TR181, TR104, TR143, TR157 and TR064 data models
|
||||
endef
|
||||
|
||||
USE_LOCAL=$(shell ls ./src/ 2>/dev/null >/dev/null && echo 1)
|
||||
ifneq ($(USE_LOCAL),)
|
||||
define Build/Prepare
|
||||
$(CP) ./src/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
TARGET_CFLAGS += -DCUSTOM_PREFIX=\\\"$(CONFIG_LIBBBFDM_VENDOR_PREFIX)\\\"
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-D_GNU_SOURCE -D_AADJ
|
||||
|
||||
ifeq ($(CONFIG_BBF_TR181),y)
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-tr181
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BBF_TR104),y)
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-tr104
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BBF_TR143),y)
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-tr143
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BBF_TR157),y)
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-tr157
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BBF_TR064),y)
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-tr064
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PACKAGE_libopenssl),y)
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-libopenssl
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PACKAGE_libmbedtls),y)
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-libmbedtls
|
||||
endif
|
||||
|
||||
define Package/libbbf_api/install
|
||||
$(INSTALL_DIR) $(1)/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/bin/.libs/libbbf_api.so* $(1)/lib/
|
||||
endef
|
||||
|
||||
define Package/libbbfdm/install
|
||||
$(INSTALL_DIR) $(1)/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/bin/.libs/libbbfdm.so* $(1)/lib/
|
||||
$(INSTALL_DIR) $(1)/etc/bbfdm
|
||||
$(INSTALL_DIR) $(1)/etc/bbfdm/json
|
||||
$(INSTALL_CONF) $(PKG_BUILD_DIR)/config/dmmap $(1)/etc/bbfdm
|
||||
$(INSTALL_DIR) $(1)/usr/share/bbfdm
|
||||
$(CP) $(PKG_BUILD_DIR)/scripts/functions $(1)/usr/share/bbfdm
|
||||
$(INSTALL_DIR) $(1)/usr/lib/bbfdm
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include/libbbfdm
|
||||
$(INSTALL_DIR) $(1)/usr/include/libbbf_api
|
||||
$(CP) $(PKG_BUILD_DIR)/*.h $(1)/usr/include/libbbfdm/
|
||||
$(CP) $(PKG_BUILD_DIR)/dmtree/tr181/*.h $(1)/usr/include/libbbfdm/
|
||||
$(CP) $(PKG_BUILD_DIR)/dmtree/tr157/*.h $(1)/usr/include/libbbfdm/
|
||||
$(CP) $(PKG_BUILD_DIR)/libbbf_api/*.h $(1)/usr/include/libbbf_api/
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/bin/.libs/libbbfdm.{a,so*} $(1)/usr/lib/
|
||||
$(CP) $(PKG_BUILD_DIR)/bin/.libs/libbbf_api.{a,so*} $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,libbbf_api))
|
||||
$(eval $(call BuildPackage,libbbfdm))
|
||||
@@ -1,10 +0,0 @@
|
||||
if PACKAGE_bbfdmd
|
||||
|
||||
config BBF_VENDOR_PREFIX
|
||||
string "Vendor Prefix"
|
||||
default "X_IOWRT_EU_"
|
||||
|
||||
config BBF_OBFUSCATION_KEY
|
||||
string "Obfuscation key"
|
||||
default "371d530c95a17d1ca223a29b7a6cdc97e1135c1e0959b51106cca91a0b148b5e42742d372a359760742803f2a44bd88fca67ccdcfaeed26d02ce3b6049cb1e04"
|
||||
endif
|
||||
217
bbfdm/Makefile
217
bbfdm/Makefile
@@ -1,217 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2023 IOPSYS
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bbfdm
|
||||
PKG_VERSION:=1.16.6.2
|
||||
|
||||
USE_LOCAL:=0
|
||||
ifneq ($(USE_LOCAL),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/bbfdm.git
|
||||
PKG_SOURCE_VERSION:=aa480554461c82e6f6f44ee6c23108d3e44fce21
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
RSTRIP:=true
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
include bbfdm.mk
|
||||
|
||||
define Package/libbbfdm-api
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
TITLE:=BBF datamodel library, provides API to extend datamodel using DotSO plugins
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libcurl
|
||||
ABI_VERSION:=1.0
|
||||
endef
|
||||
|
||||
define Package/libbbfdm-ubus
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
TITLE:=BBF datamodel ubus library, provides API to expose datamodel over ubus
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libbbfdm-api
|
||||
endef
|
||||
|
||||
define Package/bbfdmd
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
TITLE:=Datamodel ubus backend to expose core tree
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libbbfdm-api +libopenssl +libbbfdm-ubus +bbf_configmngr
|
||||
endef
|
||||
|
||||
define Package/dm-service
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
TITLE:=Datamodel ubus backend to expose micro-service tree
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libbbfdm-api +libbbfdm-ubus +bbf_configmngr
|
||||
endef
|
||||
|
||||
define Package/bbf_configmngr
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
TITLE:= BBF Config Manager
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json
|
||||
endef
|
||||
|
||||
define Package/bbfdmd/config
|
||||
source "$(SOURCE)/Config_bbfdmd.in"
|
||||
endef
|
||||
|
||||
# Below config is a hack to force-recompile dependent micro-services
|
||||
define Package/libbbfdm-api/config
|
||||
if PACKAGE_bbfdmd
|
||||
config BBF_LIBBBFDM_VERSION
|
||||
string "Internal config variable to force recompile"
|
||||
default "v${PKG_VERSION}"
|
||||
endif
|
||||
endef
|
||||
|
||||
define Package/libbbfdm-api/description
|
||||
Library contains the API(UCI, UBUS, JSON, CLI and Browse) of libbbfdm
|
||||
endef
|
||||
|
||||
define Package/libbbfdm-ubus/description
|
||||
Library contains the APIs to expose data model over ubus
|
||||
endef
|
||||
|
||||
define Package/bbfdmd/description
|
||||
Daemon to expose Datamodel core tree
|
||||
endef
|
||||
|
||||
define Package/dm-service/description
|
||||
Daemon to expose Datamodel micro-service tree
|
||||
endef
|
||||
|
||||
define Package/bbf_configmngr/description
|
||||
Daemon for handling bbf reload services via ubus bbf.config
|
||||
endef
|
||||
|
||||
ifeq ($(USE_LOCAL),1)
|
||||
define Build/Prepare
|
||||
$(CP) ~/git/bbfdm/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
CMAKE_OPTIONS += \
|
||||
-DBBF_VENDOR_PREFIX:String="$(CONFIG_BBF_VENDOR_PREFIX)" \
|
||||
-DBBFDMD_MAX_MSG_LEN:Integer=10485760 \
|
||||
-DCMAKE_BUILD_TYPE:String="Debug" \
|
||||
|
||||
|
||||
define Package/libbbfdm-api/install
|
||||
$(INSTALL_DIR) $(1)/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libbbfdm-api/legacy/libbbfdm-api.so $(1)/lib/
|
||||
$(CP) $(PKG_BUILD_DIR)/libbbfdm-api/version-2/libbbfdm-api-v2.so $(1)/lib/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/libexec/rpcd
|
||||
$(CP) $(PKG_BUILD_DIR)/utilities/files/usr/libexec/rpcd/bbf.secure $(1)/usr/libexec/rpcd/bbf.secure
|
||||
$(CP) $(PKG_BUILD_DIR)/utilities/files/usr/libexec/rpcd/bbf.diag $(1)/usr/libexec/rpcd/bbf.diag
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/bbfdm/scripts/
|
||||
$(CP) $(PKG_BUILD_DIR)/utilities/files/usr/share/bbfdm/scripts/bbf_api $(1)/usr/share/bbfdm/scripts/
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/bbfdm/certificates
|
||||
echo "$(CONFIG_BBF_OBFUSCATION_KEY)" > $(1)/etc/bbfdm/.secure_hash
|
||||
endef
|
||||
|
||||
define Package/libbbfdm-ubus/install
|
||||
$(INSTALL_DIR) $(1)/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libbbfdm-ubus/libbbfdm-ubus.so $(1)/lib/
|
||||
endef
|
||||
|
||||
define Package/bbfdmd/install
|
||||
$(INSTALL_DIR) $(1)/etc/bbfdm/dmmap
|
||||
$(INSTALL_DIR) $(1)/usr/share/bbfdm
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) ./files/etc/config/bbfdm $(1)/etc/config/bbfdm
|
||||
$(INSTALL_CONF) ./files/etc/config/schedules $(1)/etc/config/schedules
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bbfdmd/ubus/bbfdmd $(1)/usr/sbin/
|
||||
$(STRIP) $(1)/usr/sbin/bbfdmd
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/etc/init.d/bbfdmd $(1)/etc/init.d/bbfdmd
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
|
||||
$(INSTALL_BIN) ./files/etc/hotplug.d/iface/85-bbfdm-sysctl $(1)/etc/hotplug.d/iface/85-bbfdm-sysctl
|
||||
|
||||
$(INSTALL_DIR) $(1)/lib/upgrade/keep.d
|
||||
$(INSTALL_DATA) ./files/lib/upgrade/keep.d/bbf $(1)/lib/upgrade/keep.d/bbf
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/91-fix-bbfdmd-enabled-option $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/ruleng.bbfdm $(1)/etc/uci-defaults
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/ruleng
|
||||
$(INSTALL_BIN) ./files/etc/ruleng/bbfdm.json $(1)/etc/ruleng
|
||||
endef
|
||||
|
||||
define Package/dm-service/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/etc/init.d/bbfdm.services $(1)/etc/init.d/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/dm-service/dm-service $(1)/usr/sbin/
|
||||
|
||||
$(BBFDM_REGISTER_SERVICES) -v ${CONFIG_BBF_VENDOR_PREFIX} ./bbfdm_service.json $(1) core
|
||||
$(BBFDM_INSTALL_MS_DM) $(PKG_BUILD_DIR)/libbbfdm/libcore.so $(1) core
|
||||
endef
|
||||
|
||||
define Package/bbf_configmngr/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/etc/bbfdm/
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/usr/share/bbfdm/scripts
|
||||
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/bbf_configd $(1)/usr/sbin/
|
||||
$(STRIP) $(1)/usr/sbin/bbf_configd
|
||||
|
||||
$(INSTALL_BIN) ./files/etc/init.d/bbf_configd $(1)/etc/init.d/bbf_configd
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/files/usr/share/bbfdm/scripts/bbf_config_notify.sh $(1)/usr/share/bbfdm/scripts/
|
||||
$(INSTALL_DATA) ./files/etc/bbfdm/critical_services.json $(1)/etc/bbfdm/
|
||||
endef
|
||||
|
||||
define Package/bbfdmd/prerm
|
||||
#!/bin/sh
|
||||
rm -rf /etc/bbfdm/dmmap/*
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(INSTALL_DIR) $(1)/usr/include/libbbfdm-api
|
||||
$(INSTALL_DIR) $(1)/usr/include/libbbfdm-api/legacy
|
||||
$(INSTALL_DIR) $(1)/usr/include/libbbfdm-api/version-2
|
||||
$(INSTALL_DIR) $(1)/usr/include/libbbfdm-ubus
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libbbfdm-api/legacy/*.h $(1)/usr/include/libbbfdm-api/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libbbfdm-api/legacy/*.h $(1)/usr/include/libbbfdm-api/legacy/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libbbfdm-api/version-2/*.h $(1)/usr/include/libbbfdm-api/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libbbfdm-api/version-2/*.h $(1)/usr/include/libbbfdm-api/version-2/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libbbfdm-ubus/bbfdm-ubus.h $(1)/usr/include/libbbfdm-ubus/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libbbfdm-api/legacy/include/*.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/libbbfdm-api/legacy/libbbfdm-api.so $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libbbfdm-api/version-2/libbbfdm-api-v2.so $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libbbfdm-ubus/libbbfdm-ubus.so $(1)/usr/lib
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,bbf_configmngr))
|
||||
$(eval $(call BuildPackage,libbbfdm-api))
|
||||
$(eval $(call BuildPackage,libbbfdm-ubus))
|
||||
$(eval $(call BuildPackage,bbfdmd))
|
||||
$(eval $(call BuildPackage,dm-service))
|
||||
@@ -1,38 +0,0 @@
|
||||
# BBFDM configuration options and utilities
|
||||
|
||||
bbfdm provides few compile time configuration options and compile time help utility called [bbfdm.mk](./bbfdm.mk), this document aimed to explain the available usages and best practices.
|
||||
|
||||
## Compilation options
|
||||
|
||||
| Configuration option | Description | Default Value |
|
||||
| ----------------------- | ------------- | ----------- |
|
||||
| CONFIG_BBF_VENDOR_LIST | List of vendor extension directories | iopsys |
|
||||
| CONFIG_BBF_VENDOR_PREFIX | Prefix for Vendor extension datamodel objects/parameters | X_IOPSYS_EU_ |
|
||||
| CONFIG_BBF_MAX_OBJECT_INSTANCES | Maximum number of instances per object | 255 |
|
||||
| BBF_OBFUSCATION_KEY | Hash used to encode/decode in `bbf.secure` object | 371d530c95a17d1ca223a29b7a6cdc97e1135c1e0959b51106cca91a0b148b5e42742d372a359760742803f2a44bd88fca67ccdcfaeed26d02ce3b6049cb1e04 |
|
||||
|
||||
|
||||
#### BBF_OBFUSCATION_KEY
|
||||
|
||||
`bbfdm` provides an ubus object called `bbf.secure` to allow encoding/decoding the values, `bbf.secure` currently support following methods internally to encode/decode
|
||||
|
||||
- Encode/Decode using a predefined SHA512 Hash key
|
||||
- Encode/Decode using a private/public RSA key pair
|
||||
|
||||
The `BBF_OBFUSCATION_KEY` compile time configuration option used to defined the SHA512 HASH, if this option is undefined, then it usages a default value as mention in the above table.
|
||||
|
||||
User must override this parameter with their own hash value, to generate a hash user can run below command and copy the hash value to this option.
|
||||
|
||||
ex: User wants to use 'Sup3rS3cur3Passw0rd' as passkey, then can get the SHA512 sum with
|
||||
|
||||
```bash
|
||||
$ echo -n "Sup3rS3cur3Passw0rd" | sha512sum
|
||||
371d530c95a17d1ca223a29b7a6cdc97e1135c1e0959b51106cca91a0b148b5e42742d372a359760742803f2a44bd88fca67ccdcfaeed26d02ce3b6049cb1e04 -
|
||||
```
|
||||
|
||||
> Note: Additionally, user can install RSA private key in '/etc/bbfdm/certificates/private_key.pem' path, if private key is present `bbf.secure` shall use rsa private certificate for encrypt/decrypt function. In case of key not present in the pre-defined path, hash will be used for the same.
|
||||
|
||||
## Helper utility (bbfdm.mk)
|
||||
|
||||
bbfdm provides a helper utility [bbfdm.mk](./bbfdm.mk) to install datamodel plugins in bbfdm core or in microservice directory.
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2023 IOPSYS
|
||||
#
|
||||
|
||||
BBFDM_BASE_DM_PATH=/usr/share/bbfdm
|
||||
BBFDM_INPUT_PATH=/etc/bbfdm/micro_services
|
||||
BBFDM_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||
|
||||
PKG_CONFIG_DEPENDS += CONFIG_BBF_LIBBBFDM_VERSION
|
||||
#BBFDM_VERSION:=$(shell grep -oP '(?<=^PKG_VERSION:=).*' ${BBFDM_DIR}/Makefile)
|
||||
#BBFDM_TOOLS:=$(BUILD_DIR)/bbfdm-$(BBFDM_VERSION)/tools
|
||||
|
||||
# Utility to install the plugin in bbfdm core path with priority.
|
||||
# Its now possible to overwrite/remove core datamodel with plugin, so, if some
|
||||
# datamodel objects/parameters are present in more than one plugin, order in
|
||||
# which they loaded into memory becomes crucial, this Utility help to configure
|
||||
# a priority order in which they gets loaded in memory.
|
||||
#
|
||||
# ARGS:
|
||||
# $1 => Plugin artifact
|
||||
# $2 => package install directory
|
||||
# $3 => Priority of the installed plugin (Optional)
|
||||
#
|
||||
# Note:
|
||||
# - Last loaded plugin gets the highest priority
|
||||
#
|
||||
# Example:
|
||||
# BBFDM_INSTALL_CORE_PLUGIN ./files/etc/bbfdm/json/CWMPManagementServer.json $(1)
|
||||
#
|
||||
# Example to install plugin with priority:
|
||||
# BBFDM_INSTALL_CORE_PLUGIN ./files/etc/bbfdm/json/CWMPManagementServer.json $(1) 01
|
||||
#
|
||||
BBFDM_INSTALL_CORE_PLUGIN:=$(BBFDM_DIR)/tools/bbfdm.sh -p
|
||||
|
||||
|
||||
# Utility to install the micro-service datamodel
|
||||
# Use Case:
|
||||
# user wants to run a datamodel micro-service, it required to install the
|
||||
# DotSO/JSON plugin into a bbf shared directory, this utility helps in
|
||||
# installing the DotSO/JSON plugin in bbfdm shared directory, and auto-generate
|
||||
# input file for the micro-service
|
||||
#
|
||||
# ARGS:
|
||||
# $1 => DotSo or Json plugin with complete path
|
||||
# $2 => package install directory
|
||||
# $3 => service name
|
||||
#
|
||||
# Note:
|
||||
# - There could be only one main plugin file, so its bind to PKG_NAME
|
||||
# - Micro-service input.json will be auto generated with this call
|
||||
#
|
||||
# Example:
|
||||
# BBFDM_INSTALL_MS_DM $(PKG_BUILD_DIR)/libcwmp.so $(1) $(PKG_NAME)
|
||||
#
|
||||
BBFDM_INSTALL_MS_DM:=$(BBFDM_DIR)/tools/bbfdm.sh -m
|
||||
|
||||
|
||||
# Utility to install a plugins in datamodel micro-service
|
||||
#
|
||||
# ARGS:
|
||||
# $1 => DotSo or Json plugin with complete path
|
||||
# $2 => package install directory
|
||||
# $3 => service name
|
||||
#
|
||||
# Note:
|
||||
# - Use the service_name/PKG_NAME of the service in which this has to run
|
||||
#
|
||||
# Example:
|
||||
# BBFDM_INSTALL_MS_PLUGIN $(PKG_BUILD_DIR)/libxmpp.so $(1) icwmp
|
||||
#
|
||||
BBFDM_INSTALL_MS_PLUGIN:=$(BBFDM_DIR)/tools/bbfdm.sh -m -p
|
||||
|
||||
# Utility to install the helper scripts in default bbfdm script path
|
||||
#
|
||||
# Use Case:
|
||||
# User want to install some script for running diagnostics
|
||||
#
|
||||
# ARGS:
|
||||
# $1 => Script with complete path
|
||||
# $2 => package install directory
|
||||
#
|
||||
# Note:
|
||||
# - Use with -d option to install script in bbf.diag directory
|
||||
#
|
||||
# Example:
|
||||
# BBFDM_INSTALL_SCRIPT $(PKG_BUILD_DIR)/download $(1)
|
||||
# BBFDM_INSTALL_SCRIPT -d $(PKG_BUILD_DIR)/ipping $(1)
|
||||
#
|
||||
BBFDM_INSTALL_SCRIPT:=$(BBFDM_DIR)/tools/bbfdm.sh -s
|
||||
|
||||
|
||||
BBFDM_REGISTER_SERVICES:=$(BBFDM_DIR)/tools/bbfdm.sh -t
|
||||
@@ -1,54 +0,0 @@
|
||||
{
|
||||
"daemon": {
|
||||
"enable": "1",
|
||||
"service_name": "core",
|
||||
"unified_daemon": false,
|
||||
"services": [
|
||||
{
|
||||
"parent_dm": "Device.",
|
||||
"object": "LANConfigSecurity"
|
||||
},
|
||||
{
|
||||
"parent_dm": "Device.",
|
||||
"object": "Schedules"
|
||||
},
|
||||
{
|
||||
"parent_dm": "Device.",
|
||||
"object": "Security",
|
||||
"proto": "cwmp"
|
||||
},
|
||||
{
|
||||
"parent_dm": "Device.",
|
||||
"object": "PacketCaptureDiagnostics"
|
||||
},
|
||||
{
|
||||
"parent_dm": "Device.",
|
||||
"object": "SelfTestDiagnostics"
|
||||
},
|
||||
{
|
||||
"parent_dm": "Device.",
|
||||
"object": "Syslog"
|
||||
},
|
||||
{
|
||||
"parent_dm": "Device.",
|
||||
"object": "{BBF_VENDOR_PREFIX}OpenVPN",
|
||||
"proto": "usp"
|
||||
},
|
||||
{
|
||||
"parent_dm": "Device.",
|
||||
"object": "RootDataModelVersion"
|
||||
},
|
||||
{
|
||||
"parent_dm": "Device.",
|
||||
"object": "Reboot()"
|
||||
},
|
||||
{
|
||||
"parent_dm": "Device.",
|
||||
"object": "FactoryReset()"
|
||||
}
|
||||
],
|
||||
"config": {
|
||||
"loglevel": "3"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"usp": [
|
||||
"firewall",
|
||||
"network",
|
||||
"dhcp",
|
||||
"time",
|
||||
"wireless",
|
||||
"ieee1905",
|
||||
"mapcontroller",
|
||||
"mosquitto",
|
||||
"nginx",
|
||||
"netmode"
|
||||
],
|
||||
"cwmp": [
|
||||
"firewall",
|
||||
"network",
|
||||
"dhcp",
|
||||
"mapcontroller",
|
||||
"wireless",
|
||||
"time",
|
||||
"netmode"
|
||||
]
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
config bbfdmd 'bbfdmd'
|
||||
option enable '1'
|
||||
option debug '0'
|
||||
option loglevel '3'
|
||||
|
||||
config micro_services 'micro_services'
|
||||
option enable '1'
|
||||
option enable_core '0'
|
||||
|
||||
|
||||
config reload_handler 'reload_handler'
|
||||
option log_level '1'
|
||||
@@ -1,2 +0,0 @@
|
||||
config global 'global'
|
||||
option enable '1'
|
||||
@@ -1,17 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "$ACTION" = "ifup" ] || exit 0
|
||||
|
||||
apply_sysctl_configuration() {
|
||||
local sysctl_conf
|
||||
|
||||
sysctl_conf="/etc/bbfdm/sysctl.conf"
|
||||
|
||||
[ -f "${sysctl_conf}" ] || touch "${sysctl_conf}"
|
||||
|
||||
sysctl -e -p "${sysctl_conf}" >&-
|
||||
}
|
||||
|
||||
|
||||
ubus -t 10 wait_for network.device
|
||||
apply_sysctl_configuration
|
||||
@@ -1,41 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=80
|
||||
STOP=07
|
||||
|
||||
USE_PROCD=1
|
||||
PROG=/usr/sbin/bbf_configd
|
||||
|
||||
log() {
|
||||
echo "${@}"|logger -t bbf.config -p info
|
||||
}
|
||||
|
||||
create_needed_directories()
|
||||
{
|
||||
mkdir -p /tmp/bbfdm/.cwmp
|
||||
mkdir -p /tmp/bbfdm/.usp
|
||||
mkdir -p /tmp/bbfdm/.bbfdm
|
||||
}
|
||||
|
||||
start_service()
|
||||
{
|
||||
local log_level
|
||||
|
||||
create_needed_directories
|
||||
|
||||
config_load bbfdm
|
||||
config_get log_level "reload_handler" log_level 2
|
||||
|
||||
procd_open_instance "bbf_configd"
|
||||
procd_set_param command ${PROG}
|
||||
procd_append_param command -l "${log_level}"
|
||||
procd_set_param respawn
|
||||
procd_close_instance "bbf_configd"
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
for config_file in /etc/config/*; do
|
||||
config_name=$(basename "$config_file")
|
||||
procd_add_config_trigger "config.change" "$config_name" /usr/share/bbfdm/scripts/bbf_config_notify.sh
|
||||
done
|
||||
}
|
||||
@@ -1,114 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=60
|
||||
STOP=05
|
||||
|
||||
USE_PROCD=1
|
||||
PROG=/usr/sbin/dm-service
|
||||
|
||||
BBFDM_MICROSERVICE_DIR="/etc/bbfdm/services"
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
log() {
|
||||
echo "${@}"|logger -t bbfdmd.services -p info
|
||||
}
|
||||
|
||||
validate_bbfdm_micro_service_section()
|
||||
{
|
||||
uci_validate_section bbfdm micro_services "micro_services" \
|
||||
'enable:bool:true' \
|
||||
'enable_core:bool:false'
|
||||
}
|
||||
|
||||
_add_microservice()
|
||||
{
|
||||
local name path loglevel
|
||||
local enable enable_core unified_daemon
|
||||
|
||||
# Check enable from micro-service
|
||||
path="${1}"
|
||||
enable_core="${2}"
|
||||
|
||||
name="$(basename ${path})"
|
||||
name="${name//.json}"
|
||||
|
||||
json_load_file "${path}"
|
||||
json_select daemon
|
||||
|
||||
json_get_var enable enable 1
|
||||
if [ "${enable}" -eq "0" ]; then
|
||||
log "datamodel micro-service ${name} not enabled"
|
||||
return 0
|
||||
fi
|
||||
|
||||
json_get_var unified_daemon unified_daemon 0
|
||||
if [ "${unified_daemon}" -eq "1" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
json_select config
|
||||
json_get_var loglevel loglevel 4
|
||||
|
||||
procd_open_instance "${name}"
|
||||
|
||||
procd_set_param command ${PROG}
|
||||
procd_append_param command -m "${name}"
|
||||
procd_append_param command -l "${loglevel}"
|
||||
|
||||
if [ "${enable_core}" -eq "1" ]; then
|
||||
procd_set_param limits core="unlimited"
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
fi
|
||||
|
||||
procd_set_param respawn
|
||||
procd_close_instance "${name}"
|
||||
}
|
||||
|
||||
configure_bbfdm_micro_services()
|
||||
{
|
||||
local enable enable_core
|
||||
|
||||
config_load bbfdm
|
||||
validate_bbfdm_micro_service_section || {
|
||||
log "Validation of micro_service section failed"
|
||||
return 1;
|
||||
}
|
||||
|
||||
[ "${enable}" -eq "0" ] && return 0
|
||||
|
||||
if [ -d "${BBFDM_MICROSERVICE_DIR}" ]; then
|
||||
FILES="$(ls -1 ${BBFDM_MICROSERVICE_DIR}/*.json)"
|
||||
|
||||
for file in $FILES;
|
||||
do
|
||||
[ -e "$file" ] || continue
|
||||
|
||||
_add_microservice $file "${enable_core}"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
_start_single_service()
|
||||
{
|
||||
local service file
|
||||
|
||||
service="${1}"
|
||||
|
||||
if [ -d "${BBFDM_MICROSERVICE_DIR}" ]; then
|
||||
file="$(ls -1 ${BBFDM_MICROSERVICE_DIR}/${service}.json)"
|
||||
[ -e "$file" ] || return
|
||||
|
||||
_add_microservice $file "0"
|
||||
fi
|
||||
}
|
||||
|
||||
start_service()
|
||||
{
|
||||
if [ -n "${1}" ]; then
|
||||
_start_single_service "${1}"
|
||||
else
|
||||
configure_bbfdm_micro_services
|
||||
fi
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=97
|
||||
STOP=06
|
||||
|
||||
USE_PROCD=1
|
||||
PROG=/usr/sbin/bbfdmd
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
log() {
|
||||
echo "${@}"|logger -t bbfdmd.init -p info
|
||||
}
|
||||
|
||||
validate_bbfdm_bbfdmd_section()
|
||||
{
|
||||
uci_validate_section bbfdm bbfdmd "bbfdmd" \
|
||||
'enable:bool:true' \
|
||||
'debug:bool:false' \
|
||||
'loglevel:uinteger:4'
|
||||
}
|
||||
|
||||
configure_bbfdmd()
|
||||
{
|
||||
local enable debug
|
||||
local jlog jrefresh jtimeout jlevel
|
||||
|
||||
config_load bbfdm
|
||||
validate_bbfdm_bbfdmd_section || {
|
||||
log "Validation of bbfdmd section failed"
|
||||
return 1;
|
||||
}
|
||||
|
||||
[ "${enable}" -eq 0 ] && return 0
|
||||
|
||||
procd_set_param command ${PROG}
|
||||
procd_append_param command -l "${loglevel}"
|
||||
|
||||
if [ "${debug}" -eq 1 ]; then
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
fi
|
||||
}
|
||||
|
||||
start_service()
|
||||
{
|
||||
procd_open_instance "bbfdm"
|
||||
configure_bbfdmd
|
||||
procd_set_param respawn
|
||||
procd_close_instance "bbfdm"
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger "bbfdm"
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
{
|
||||
"hosts_refresh": {
|
||||
"if" : [
|
||||
{
|
||||
"event": "host"
|
||||
}
|
||||
],
|
||||
"then" : [
|
||||
{
|
||||
"object": "bbfdm.hostmngr",
|
||||
"method":"refresh_references_db",
|
||||
"args" : {},
|
||||
"timeout": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"dhcp_refresh": {
|
||||
"if_operator": "OR",
|
||||
"if" : [
|
||||
{
|
||||
"event": "host"
|
||||
},
|
||||
{
|
||||
"event": "wifi.dataelements.Associated"
|
||||
}
|
||||
],
|
||||
"then" : [
|
||||
{
|
||||
"object": "bbfdm.dhcpmngr",
|
||||
"method":"refresh_references_db",
|
||||
"args" : {},
|
||||
"timeout": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"ieee1905_refresh_add": {
|
||||
"if" : [
|
||||
{
|
||||
"event": "ieee1905.neighbor.add"
|
||||
}
|
||||
],
|
||||
"then" : [
|
||||
{
|
||||
"object": "bbfdm.ieee1905",
|
||||
"method":"refresh_references_db",
|
||||
"args" : {},
|
||||
"timeout": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"ieee1905_refresh_del": {
|
||||
"if" : [
|
||||
{
|
||||
"event": "ieee1905.neighbor.del"
|
||||
}
|
||||
],
|
||||
"then" : [
|
||||
{
|
||||
"object": "bbfdm.ieee1905",
|
||||
"method":"refresh_references_db",
|
||||
"args" : {},
|
||||
"timeout": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# rename bbfdmd enabled option to enable
|
||||
val="$(uci -q get bbfdm.bbfdmd.enabled)"
|
||||
if [ -n "${val}" ]; then
|
||||
uci -q set bbfdm.bbfdmd.enabled=""
|
||||
uci -q set bbfdm.bbfdmd.enable="${val}"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
bbfdm_sysctl_conf="/etc/bbfdm/sysctl.conf"
|
||||
|
||||
update_device_section() {
|
||||
local section="${1}"
|
||||
local dev_name="${2}"
|
||||
local ipv6="${3}"
|
||||
local name
|
||||
|
||||
# Get name value
|
||||
config_get name "${section}" name
|
||||
|
||||
# Retrun if the name value is different to the dev_name value
|
||||
[ "${name}" != "${dev_name}" ] && return
|
||||
|
||||
if [ "${ipv6}" = "0" ]; then
|
||||
ipv6="1"
|
||||
else
|
||||
ipv6="0"
|
||||
fi
|
||||
|
||||
# Add ipv6 option
|
||||
uci -q set network.${section}.ipv6="${ipv6}"
|
||||
}
|
||||
|
||||
parse_bbfdm_sysctl_conf_file() {
|
||||
# Check if the file exists
|
||||
[ -f "${bbfdm_sysctl_conf}" ] || return
|
||||
|
||||
# Create a temporary file
|
||||
tmpfile=$(mktemp)
|
||||
|
||||
# Load network config
|
||||
config_load network
|
||||
|
||||
# Read each line of the file
|
||||
while read -r line; do
|
||||
if echo "$line" | grep -Eq '^net\.ipv6\.conf\.(.+)\.disable_ipv6=([0-1])$'; then
|
||||
name=$(echo "$line" | sed -n 's/^net\.ipv6\.conf\.\(.*\)\.disable_ipv6=[0-1]$/\1/p')
|
||||
value=$(echo "$line" | sed -n 's/^net\.ipv6\.conf\.\(.*\)\.disable_ipv6=\([0-1]\)$/\2/p')
|
||||
|
||||
config_foreach update_device_section device "${name}" "${value}"
|
||||
else
|
||||
# If the line doesn't match, preserve it in the temporary file
|
||||
echo "$line" >> "$tmpfile"
|
||||
fi
|
||||
done < "${bbfdm_sysctl_conf}"
|
||||
|
||||
# Replace the original file with the modified content
|
||||
mv "$tmpfile" "${bbfdm_sysctl_conf}"
|
||||
}
|
||||
|
||||
parse_bbfdm_sysctl_conf_file
|
||||
|
||||
exit 0
|
||||
@@ -1,2 +0,0 @@
|
||||
uci -q set ruleng.bbfdm=rule
|
||||
uci -q set ruleng.bbfdm.recipe='/etc/ruleng/bbfdm.json'
|
||||
@@ -1 +0,0 @@
|
||||
/etc/bbfdm/sysctl.conf
|
||||
@@ -1,203 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
BBFDM_BASE_DM_PATH="usr/share/bbfdm"
|
||||
BBFDM_INPUT_PATH="etc/bbfdm/micro_services"
|
||||
INPUT_FILE="0"
|
||||
|
||||
MICRO_SERVICE=0
|
||||
SCRIPT=0
|
||||
DIAG=0
|
||||
PLUGIN=0
|
||||
DEST=""
|
||||
VENDOR_EXTN=""
|
||||
TOOLS="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||
SRC=""
|
||||
EXTRA_DATA=""
|
||||
|
||||
while getopts ":mpsdtv:" opt; do
|
||||
case ${opt} in
|
||||
m)
|
||||
MICRO_SERVICE=1
|
||||
;;
|
||||
p)
|
||||
PLUGIN=1
|
||||
;;
|
||||
s)
|
||||
SCRIPT=1
|
||||
;;
|
||||
d)
|
||||
DIAG=1
|
||||
;;
|
||||
t)
|
||||
INPUT_FILE=1
|
||||
;;
|
||||
v)
|
||||
VENDOR_EXTN=${OPTARG}
|
||||
;;
|
||||
?)
|
||||
echo "Invalid option: ${OPTARG}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
SRC="${1}"
|
||||
shift
|
||||
DEST="${1}"
|
||||
shift
|
||||
DATA="${1}"
|
||||
shift
|
||||
EXTRA_DATA="${1}"
|
||||
|
||||
|
||||
install_bin() {
|
||||
if ! install -m0755 ${1} ${2}; then
|
||||
echo "Failed to install bin ${1} => ${2}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
install_dir() {
|
||||
if ! install -d -m0755 ${1}; then
|
||||
echo "Failed to create directory ${1}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
install_data() {
|
||||
if ! install -m0644 ${1} ${2}; then
|
||||
echo "Failed to install ${1} => ${2}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Installing datamodel
|
||||
bbfdm_install_dm()
|
||||
{
|
||||
local src dest minfile
|
||||
|
||||
src="$1"
|
||||
dest="$2"
|
||||
minfile=""
|
||||
|
||||
if [ -z ${src} ] || [ -z "${dest}" ] || [ -z "${TOOLS}" ]; then
|
||||
echo "Invalid input option for install dm $@"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "${src}" ]; then
|
||||
echo "File $src does not exists..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${src##*.}" = "json" ]; then
|
||||
echo "Compacting BBFDM JSON file"
|
||||
minfile=$(mktemp)
|
||||
jq -c 'del(..|.description?)' ${src} > ${minfile}
|
||||
|
||||
if [ -n "${VENDOR_EXTN}" ]; then
|
||||
sed -i "s/{BBF_VENDOR_PREFIX}/${VENDOR_EXTN}/g" ${minfile}
|
||||
fi
|
||||
|
||||
src=${minfile}
|
||||
if dpkg -s python3-jsonschema >/dev/null 2>&1; then
|
||||
echo "Verifying bbfdm Datamodel JSON file"
|
||||
if ! ${TOOLS}/validate_plugins.py ${src}; then
|
||||
echo "Validation of the plugin failed ${src}"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "## Install python3-jsonschema to verify datamodel plugins"
|
||||
fi
|
||||
fi
|
||||
|
||||
install_bin ${src} ${dest}
|
||||
|
||||
if [ -f "${minfile}" ]; then
|
||||
rm ${minfile}
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -z "$SRC" ] || [ -z "${DEST}" ] ; then
|
||||
echo "# BBFDM Null value in src[${SRC}], dest[${DEST}]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${SCRIPT}" -eq "1" ]; then
|
||||
if [ "${DIAG}" -eq "1" ]; then
|
||||
install_dir ${DEST}/${BBFDM_BASE_DM_PATH}/scripts/bbf_diag
|
||||
install_bin ${SRC} ${DEST}/${BBFDM_BASE_DM_PATH}/scripts/bbf_diag/
|
||||
else
|
||||
install_dir ${DEST}/${BBFDM_BASE_DM_PATH}/scripts
|
||||
install_bin ${SRC} ${DEST}/${BBFDM_BASE_DM_PATH}/scripts/
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "${INPUT_FILE}" -eq "1" ]; then
|
||||
|
||||
tempfile=""
|
||||
if [ ! -f "${SRC}" ]; then
|
||||
echo "# Datamodel Input file ${SRC} not available"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! cat ${SRC} |jq >/dev/null 2>&1; then
|
||||
echo "# Invalid datamodel json input file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
service_name="$(cat ${SRC}|jq -r '.daemon.service_name')"
|
||||
if [ -z "${service_name}" ]; then
|
||||
echo "# service_name not defined in service json ...."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tempfile=$(mktemp)
|
||||
cp ${SRC} ${tempfile}
|
||||
if [ -n "${VENDOR_EXTN}" ]; then
|
||||
sed -i "s/{BBF_VENDOR_PREFIX}/${VENDOR_EXTN}/g" ${tempfile}
|
||||
fi
|
||||
|
||||
install_dir ${DEST}/etc/bbfdm/services
|
||||
install_data ${tempfile} ${DEST}/etc/bbfdm/services/${service_name}.json
|
||||
|
||||
if [ -f "${tempfile}" ]; then
|
||||
rm ${tempfile}
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "${MICRO_SERVICE}" -eq "1" ]; then
|
||||
if [ -z "${DATA}" ]; then
|
||||
echo "# service_name[${DATA}] not provided"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${PLUGIN}" -ne "1" ]; then
|
||||
extn="$(basename ${SRC})"
|
||||
install_dir ${DEST}/${BBFDM_BASE_DM_PATH}/micro_services
|
||||
bbfdm_install_dm ${SRC} ${DEST}/${BBFDM_BASE_DM_PATH}/micro_services/${DATA}.${extn##*.}
|
||||
else
|
||||
install_dir ${DEST}/${BBFDM_BASE_DM_PATH}/micro_services/${DATA}
|
||||
bbfdm_install_dm ${SRC} ${DEST}/${BBFDM_BASE_DM_PATH}/micro_services/${DATA}/$(printf "%02d" ${EXTRA_DATA})$(basename ${SRC})
|
||||
fi
|
||||
else
|
||||
if [ "${PLUGIN}" -eq "1" ]; then
|
||||
echo "# WARNING: BBFDM_INSTALL_CORE_PLUGIN macro will be deprecated soon. Please use BBFDM_INSTALL_MS_PLUGIN macro instead, specifying 'core' as micro-service name #"
|
||||
priority="${DATA:-0}"
|
||||
install_dir ${DEST}/${BBFDM_BASE_DM_PATH}/micro_services/core
|
||||
|
||||
if [ "${priority}" -gt "0" ]; then
|
||||
# install with priority if defined
|
||||
bbfdm_install_dm ${SRC} ${DEST}/${BBFDM_BASE_DM_PATH}/micro_services/core/${priority}_$(basename ${SRC})
|
||||
elif [ "${priority}" -eq "0" ]; then
|
||||
bbfdm_install_dm ${SRC} ${DEST}/${BBFDM_BASE_DM_PATH}/micro_services/core/$(basename ${SRC})
|
||||
else
|
||||
echo "# Priority should be an unsigned integer"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -1,333 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
# Copyright (C) 2024 iopsys Software Solutions AB
|
||||
# Author: Amin Ben Romdhane <amin.benromdhane@iopsys.eu>
|
||||
|
||||
import sys
|
||||
import json
|
||||
from jsonschema import validate
|
||||
|
||||
JSON_PLUGIN_VERSION = 0
|
||||
|
||||
obj_schema = {
|
||||
"definitions": {
|
||||
"type_t": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"object"
|
||||
]
|
||||
},
|
||||
"map_type_t": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"uci",
|
||||
"ubus"
|
||||
]
|
||||
},
|
||||
"protocols_t": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"none",
|
||||
"cwmp",
|
||||
"usp"
|
||||
]
|
||||
}
|
||||
},
|
||||
"type" : "object",
|
||||
"properties" : {
|
||||
"type" : {"$ref": "#/definitions/type_t"},
|
||||
"version" : {"type": "string"},
|
||||
"protocols" : {"type" : "array", "items" : {"$ref": "#/definitions/protocols_t"}},
|
||||
"uniqueKeys" : {"type" : "array"},
|
||||
"access" : {"type" : "boolean"},
|
||||
"array" : {"type" : "boolean"},
|
||||
"mapping" : {"type" : "object", "properties" : {
|
||||
"type" : {"$ref": "#/definitions/map_type_t"},
|
||||
"uci" : {"type" : "object", "properties" : {
|
||||
"file" : {"type": "string"},
|
||||
"section" : {"type": "object", "properties" : {
|
||||
"type" : {"type": "string"}
|
||||
}
|
||||
},
|
||||
"dmmapfile" : {"type": "string"}
|
||||
}
|
||||
},
|
||||
"ubus" : {"type" : "object", "properties" : {
|
||||
"object" : {"type": "string"},
|
||||
"method" : {"type": "string"},
|
||||
"args" : {"type": "object"},
|
||||
"key" : {"type": "string"}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"type",
|
||||
"protocols",
|
||||
"array",
|
||||
"access"
|
||||
]
|
||||
}
|
||||
|
||||
obj_schema_v1 = {
|
||||
"definitions": {
|
||||
"type_t": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"object"
|
||||
]
|
||||
},
|
||||
"map_type_t": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"uci",
|
||||
"ubus"
|
||||
]
|
||||
},
|
||||
"protocols_t": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"cwmp",
|
||||
"usp",
|
||||
"none"
|
||||
]
|
||||
}
|
||||
},
|
||||
"type" : "object",
|
||||
"properties" : {
|
||||
"type" : {"$ref": "#/definitions/type_t"},
|
||||
"version" : {"type": "string"},
|
||||
"protocols" : {"type" : "array", "items" : {"$ref": "#/definitions/protocols_t"}},
|
||||
"uniqueKeys" : {"type" : "array"},
|
||||
"access" : {"type" : "boolean"},
|
||||
"array" : {"type" : "boolean"},
|
||||
"mapping" : {"type" : "array", "items" : {
|
||||
"type" : "object", "properties" : {
|
||||
"type" : {"$ref": "#/definitions/map_type_t"},
|
||||
"uci" : {"type" : "object", "properties" : {
|
||||
"file" : {"type": "string"},
|
||||
"section" : {"type": "object", "properties" : {
|
||||
"type" : {"type": "string"}
|
||||
}
|
||||
},
|
||||
"dmmapfile" : {"type": "string"}
|
||||
}
|
||||
},
|
||||
"ubus" : {"type" : "object", "properties" : {
|
||||
"object" : {"type": "string"},
|
||||
"method" : {"type": "string"},
|
||||
"args" : {"type": "object"},
|
||||
"key" : {"type": "string"}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"type",
|
||||
"protocols",
|
||||
"array",
|
||||
"access"
|
||||
]
|
||||
}
|
||||
|
||||
param_schema = {
|
||||
"definitions": {
|
||||
"type_t": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"string",
|
||||
"unsignedInt",
|
||||
"unsignedLong",
|
||||
"int",
|
||||
"long",
|
||||
"boolean",
|
||||
"dateTime",
|
||||
"hexBinary",
|
||||
"base64",
|
||||
"decimal"
|
||||
]
|
||||
},
|
||||
"map_type_t": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"uci",
|
||||
"ubus",
|
||||
"procfs",
|
||||
"sysfs",
|
||||
"json",
|
||||
"uci_sec"
|
||||
]
|
||||
},
|
||||
"protocols_t": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"cwmp",
|
||||
"usp",
|
||||
"none"
|
||||
]
|
||||
}
|
||||
},
|
||||
"type" : "object",
|
||||
"properties" : {
|
||||
"type" : {"$ref": "#/definitions/type_t"},
|
||||
"protocols" : {"type" : "array", "items" : {"$ref": "#/definitions/protocols_t"}},
|
||||
"read" : {"type" : "boolean"},
|
||||
"write" : {"type" : "boolean"},
|
||||
"mapping" : {"type" : "array", "items" : {"type": "object", "properties" : {
|
||||
"type" : {"$ref": "#/definitions/map_type_t"},
|
||||
"uci" : {"type" : "object", "properties" : {
|
||||
"file" : {"type": "string"},
|
||||
"section" : {"type": "object", "properties" : {
|
||||
"type" : {"type": "string"},
|
||||
"index" : {"type": "string"}
|
||||
}
|
||||
},
|
||||
"option" : {"type": "object", "properties" : {
|
||||
"name" : {"type": "string"} }
|
||||
}
|
||||
}
|
||||
},
|
||||
"ubus" : {"type" : "object", "properties" : {
|
||||
"object" : {"type": "string"},
|
||||
"method" : {"type": "string"},
|
||||
"args" : {"type": "object"},
|
||||
"key" : {"type": "string"}
|
||||
}
|
||||
},
|
||||
"procfs" : {"type" : "object", "properties" : {
|
||||
"file" : {"type": "string"}
|
||||
}
|
||||
},
|
||||
"sysfs" : {"type" : "object", "properties" : {
|
||||
"file" : {"type": "string"}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"type",
|
||||
"protocols",
|
||||
"read",
|
||||
"write"
|
||||
]
|
||||
}
|
||||
|
||||
event_schema = {
|
||||
"definitions": {
|
||||
"type_t": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"event"
|
||||
]
|
||||
},
|
||||
"protocols_t": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"none",
|
||||
"usp"
|
||||
]
|
||||
}
|
||||
},
|
||||
"type" : "object",
|
||||
"properties" : {
|
||||
"type" : {"$ref": "#/definitions/type_t"},
|
||||
"version" : {"type": "string"},
|
||||
"protocols" : {"type" : "array", "items" : {"$ref": "#/definitions/protocols_t"}}
|
||||
},
|
||||
"required": [
|
||||
"type",
|
||||
"protocols"
|
||||
]
|
||||
}
|
||||
|
||||
command_schema = {
|
||||
"definitions": {
|
||||
"type_t": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"command"
|
||||
]
|
||||
},
|
||||
"protocols_t": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"none",
|
||||
"usp"
|
||||
]
|
||||
}
|
||||
},
|
||||
"type" : "object",
|
||||
"properties" : {
|
||||
"type" : {"$ref": "#/definitions/type_t"},
|
||||
"async" : {"type" : "boolean"},
|
||||
"protocols" : {"type" : "array", "items" : {"$ref": "#/definitions/protocols_t"}},
|
||||
"input" : {"type" : "object"},
|
||||
"output" : {"type" : "object"}
|
||||
},
|
||||
"required": [
|
||||
"type",
|
||||
"async",
|
||||
"protocols"
|
||||
]
|
||||
}
|
||||
|
||||
def print_validate_json_usage():
|
||||
print("Usage: " + sys.argv[0] + " <dm json file>")
|
||||
print("Examples:")
|
||||
print(" - " + sys.argv[0] + " datamodel.json")
|
||||
print(" ==> Validate the json file")
|
||||
print("")
|
||||
exit(1)
|
||||
|
||||
def parse_value( key , value ):
|
||||
|
||||
if key.endswith('.') and not key.startswith('Device.'):
|
||||
print(key + " is not a valid path")
|
||||
exit(1)
|
||||
|
||||
if key.endswith('.') and (JSON_PLUGIN_VERSION == 1 or JSON_PLUGIN_VERSION == 2):
|
||||
__schema = obj_schema_v1
|
||||
elif key.endswith('.'):
|
||||
__schema = obj_schema
|
||||
elif key.endswith('!'):
|
||||
__schema = event_schema
|
||||
elif key.endswith('()'):
|
||||
__schema = command_schema
|
||||
else:
|
||||
__schema = param_schema
|
||||
|
||||
validate(instance = value, schema = __schema)
|
||||
|
||||
for k, v in value.items():
|
||||
if k != "list" and k != "mapping" and k != "input" and k != "output" and isinstance(v, dict):
|
||||
parse_value(k, v)
|
||||
|
||||
### main ###
|
||||
if len(sys.argv) < 2:
|
||||
print_validate_json_usage()
|
||||
|
||||
json_file = open(sys.argv[1], "r", encoding='utf-8')
|
||||
try:
|
||||
json_data = json.loads(json_file.read())
|
||||
except ValueError:
|
||||
print(sys.argv[1] + " file has a wrong JSON format!!!!!")
|
||||
exit(1)
|
||||
|
||||
for __key, __value in json_data.items():
|
||||
|
||||
if __key == "json_plugin_version":
|
||||
|
||||
if not isinstance(__value, int) or __value not in [0, 1, 2]:
|
||||
raise ValueError("Invalid value for json_plugin_version")
|
||||
|
||||
JSON_PLUGIN_VERSION = __value
|
||||
continue
|
||||
|
||||
parse_value(__key , __value)
|
||||
|
||||
print("JSON File is Valid")
|
||||
@@ -1,45 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
# Copyright (C) 2025 IOPSYS Software Solutions AB
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=blkpg-part
|
||||
PKG_VERSION:=1
|
||||
PKG_RELEASE:=1
|
||||
PKG_SOURCE_VERSION:=5a4ec5f53ed904b37fba03f3797fbe2af3077f8d
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/gportay/blkpg-part.git
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
PKG_MAINTAINER:=Andreas Gnau <andreas.gnau@iopsys.eu>
|
||||
PKG_LICENSE:=LGPL-2.1-or-later
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
MAKE_INSTALL_FLAGS += PREFIX=/usr
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Disc
|
||||
TITLE:=User space partition table and disk geometry handling utility
|
||||
URL:=https://www.portay.io/blkpg-part/
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
blkpg-part creates temporary partitions that are not part of the GPT/MBR.
|
||||
It makes a partition block device from any consecutive blocks that are
|
||||
not partitioned. It creates, resizes and deletes partitions on the fly
|
||||
without writing back the changes to the partition table.
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/blkpg-part $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
@@ -1,17 +0,0 @@
|
||||
if PACKAGE_bridgemngr
|
||||
|
||||
config BRIDGEMNGR_BRIDGE_VLAN
|
||||
bool "Use bridge-vlan backend"
|
||||
help
|
||||
Set this option to use bridge-vlan as backend for VLAN objects.
|
||||
|
||||
config BRIDGEMNGR_BRIDGE_VENDOR_EXT
|
||||
bool "Use bridge BBF vendor extensions"
|
||||
default y
|
||||
help
|
||||
Set this option to use bridge BBF vendor extensions.
|
||||
|
||||
config BRIDGEMNGR_BRIDGE_VENDOR_PREFIX
|
||||
string "Package specific datamodel Vendor Prefix for TR181 extensions"
|
||||
default ""
|
||||
endif
|
||||
@@ -1,75 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2020-2024 iopsys
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bridgemngr
|
||||
PKG_VERSION:=1.0.18.2
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/bridgemngr
|
||||
PKG_SOURCE_VERSION:=71ed529be038392071b0399bcfe9d46e89d3cb46
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include ../bbfdm/bbfdm.mk
|
||||
|
||||
define Package/bridgemngr
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Bridge Manager
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json
|
||||
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service
|
||||
endef
|
||||
|
||||
define Package/bridgemngr/description
|
||||
Package to add Device.Bridging. data model support.
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
MAKE_PATH:=src
|
||||
|
||||
ifeq ($(CONFIG_BRIDGEMNGR_BRIDGE_VENDOR_PREFIX),"")
|
||||
VENDOR_PREFIX = $(CONFIG_BBF_VENDOR_PREFIX)
|
||||
else
|
||||
VENDOR_PREFIX = $(CONFIG_BRIDGEMNGR_BRIDGE_VENDOR_PREFIX)
|
||||
endif
|
||||
|
||||
TARGET_CFLAGS += -DBBF_VENDOR_PREFIX=\\\"$(VENDOR_PREFIX)\\\"
|
||||
|
||||
ifeq ($(CONFIG_BRIDGEMNGR_BRIDGE_VLAN),y)
|
||||
TARGET_CFLAGS += -DBRIDGE_VLAN_BACKEND
|
||||
endif
|
||||
|
||||
define Package/bridgemngr/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
|
||||
$(BBFDM_REGISTER_SERVICES) ./bbfdm_service.json $(1) $(PKG_NAME)
|
||||
$(BBFDM_INSTALL_MS_DM) $(PKG_BUILD_DIR)/src/libbridgemngr.so $(1) $(PKG_NAME)
|
||||
ifeq ($(CONFIG_BRIDGEMNGR_BRIDGE_VENDOR_EXT), y)
|
||||
$(BBFDM_INSTALL_MS_PLUGIN) $(PKG_BUILD_DIR)/src/libbridgeext.so $(1) $(PKG_NAME) 10
|
||||
$(BBFDM_INSTALL_MS_PLUGIN) -v ${VENDOR_PREFIX} ./files/VLAN_Filtering_Extension.json $(1) $(PKG_NAME) 11
|
||||
endif
|
||||
|
||||
$(INSTALL_BIN) ./files/etc/init.d/bridging $(1)/etc/init.d/
|
||||
$(INSTALL_DATA) ./files/etc/config/bridging $(1)/etc/config/
|
||||
endef
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) ~/git/bridgemngr/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
$(eval $(call BuildPackage,bridgemngr))
|
||||
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"daemon": {
|
||||
"enable": "1",
|
||||
"service_name": "bridgemngr",
|
||||
"unified_daemon": false,
|
||||
"services": [
|
||||
{
|
||||
"parent_dm": "Device.",
|
||||
"object": "Bridging"
|
||||
}
|
||||
],
|
||||
"config": {
|
||||
"loglevel": "3"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
{
|
||||
"json_plugin_version": 2,
|
||||
"Device.Bridging.Bridge.{i}.": {
|
||||
"type": "object",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"access": true,
|
||||
"array": true,
|
||||
"{BBF_VENDOR_PREFIX}VLANFiltering": {
|
||||
"type": "boolean",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "boolean",
|
||||
"description": "Enable or disable VLAN Filtering on this bridge.",
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "uci_sec",
|
||||
"key": "vlan_filtering"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
#L2 filter UCI file
|
||||
|
||||
config chain 'qos_output'
|
||||
option target 'qos_output'
|
||||
option table 'nat'
|
||||
option chain 'OUTPUT'
|
||||
option policy 'RETURN'
|
||||
|
||||
config chain 'dscp2pbits'
|
||||
option target 'dscp2pbits'
|
||||
option table 'broute'
|
||||
option chain 'BROUTING'
|
||||
option policy 'RETURN'
|
||||
|
||||
config chain 'qos'
|
||||
option target 'qos'
|
||||
option table 'broute'
|
||||
option chain 'BROUTING'
|
||||
option policy 'RETURN'
|
||||
|
||||
config chain 'prevlanxlate'
|
||||
option target 'prevlanxlate'
|
||||
option table 'broute'
|
||||
option chain 'BROUTING'
|
||||
option policy 'RETURN'
|
||||
option append 'false'
|
||||
|
||||
config chain 'mcsnooping'
|
||||
option target 'mcsnooping'
|
||||
option table 'broute'
|
||||
option chain 'BROUTING'
|
||||
option policy 'RETURN'
|
||||
option append 'false'
|
||||
@@ -1,93 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
# Start after bdmf shell, wanconf, and switch-script but before the network-script
|
||||
START=20
|
||||
STOP=10
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
handle_ebtables_chain() {
|
||||
local sid="$1"
|
||||
local table
|
||||
local chain
|
||||
local target
|
||||
local policy
|
||||
local append
|
||||
local enabled
|
||||
local ret
|
||||
|
||||
config_get table "$sid" table filter
|
||||
config_get chain "$sid" chain
|
||||
config_get policy "$sid" policy RETURN
|
||||
config_get target "$sid" target
|
||||
config_get_bool append "$sid" append 1
|
||||
config_get_bool enabled "$sid" enabled 1
|
||||
|
||||
[ "$enabled" = "0" ] && return
|
||||
[ -z "${chain}" -o -z "${target}" ] && return
|
||||
|
||||
if [ "$append" != "0" ]; then
|
||||
append="-A"
|
||||
else
|
||||
append="-I"
|
||||
fi
|
||||
|
||||
ebtables --concurrent -t "$table" -N "$target" -P "$policy" 2> /dev/null
|
||||
ret=$?
|
||||
|
||||
if [ $ret -eq 0 ]; then
|
||||
ebtables --concurrent -t "$table" ${append} "$chain" -j "$target"
|
||||
else
|
||||
ebtables --concurrent -t "$table" -D "$chain" -j "$target"
|
||||
ebtables --concurrent -t "$table" ${append} "$chain" -j "$target"
|
||||
fi
|
||||
}
|
||||
|
||||
handle_ebtables_rule() {
|
||||
local sid="$1"
|
||||
local table
|
||||
local chain
|
||||
local target
|
||||
local match
|
||||
local value
|
||||
local enabled
|
||||
local ret
|
||||
|
||||
config_get table "$sid" table filter
|
||||
config_get chain "$sid" chain
|
||||
config_get match "$sid" match
|
||||
config_get value "$sid" value
|
||||
config_get target "$sid" target RETURN
|
||||
config_get_bool append "$sid" append 1
|
||||
config_get_bool enabled "$sid" enabled 1
|
||||
|
||||
[ "$enabled" = "0" ] && return
|
||||
[ -z "${chain}" -o -z "${target}" ] && return
|
||||
|
||||
if [ "$append" != "0" ]; then
|
||||
append="-A"
|
||||
else
|
||||
append="-I"
|
||||
fi
|
||||
|
||||
ebtables --concurrent -t "$table" -D "$chain" ${match} -j "$target" ${value} 2> /dev/null
|
||||
ebtables --concurrent -t "$table" ${append} "$chain" ${match} -j "$target" ${value}
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load bridging
|
||||
config_foreach handle_ebtables_chain chain
|
||||
config_foreach handle_ebtables_rule rule
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger bridging
|
||||
}
|
||||
@@ -1,61 +1,44 @@
|
||||
#
|
||||
# Copyright (C) 2022 iopsys Software Solutions AB
|
||||
# Copyright (C) 2020 iopsys Software Solutions AB
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bulkdata
|
||||
PKG_VERSION:=2.1.20
|
||||
PKG_VERSION:=1.0.0
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/bulkdata.git
|
||||
PKG_SOURCE_VERSION:=a5e57962938ca143ede65d92be90b6e9fce66e15
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(TOPDIR)/feeds/iopsys/bbfdm/bbfdm.mk
|
||||
|
||||
define Package/bulkdata
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
TITLE:=BBF BulkData Collection
|
||||
DEPENDS:=+ubus +libuci +libubox +libjson-c +libcurl +libblobmsg-json +zlib
|
||||
DEPENDS+=+libbbfdm-api +libbbfdm-ubus
|
||||
DEPENDS:=+libubus +libuci +libubox +libjson-c +libcurl +curl +libblobmsg-json +libbbfdm +libbbf_api
|
||||
endef
|
||||
|
||||
define Package/bulkdata/description
|
||||
BulkData daemon for TR069 with bbfdm backend.
|
||||
define Package/$(PKG_NAME)/description
|
||||
BBF BulkData Collection
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
$(CP) ./src/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-D_GNU_SOURCE \
|
||||
-Wall -Werror
|
||||
-D_GNU_SOURCE
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) -rf ~/git/bulkdata/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/bulkdata/install
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bulkdatad $(1)/usr/sbin/
|
||||
$(INSTALL_DATA) ./files/etc/config/bulkdata $(1)/etc/config/
|
||||
$(INSTALL_BIN) ./files/etc/init.d/bulkdatad $(1)/etc/init.d/
|
||||
|
||||
$(BBFDM_REGISTER_SERVICES) ./bbfdm_service.json $(1) $(PKG_NAME)
|
||||
$(INSTALL_DIR) $(1)/usr/lib/bbfdm
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/*.so $(1)/usr/lib/bbfdm
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,bulkdata))
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"daemon": {
|
||||
"enable": "1",
|
||||
"service_name": "bulkdata",
|
||||
"unified_daemon": true,
|
||||
"proto": "cwmp",
|
||||
"services": [
|
||||
{
|
||||
"parent_dm": "Device.",
|
||||
"object": "BulkData"
|
||||
}
|
||||
],
|
||||
"config": {
|
||||
"loglevel": "3"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,43 @@
|
||||
|
||||
config bulkdata 'bulkdata'
|
||||
option enable '0'
|
||||
#Log levels: As per syslog 0-7, default 6=>LOG_INFO
|
||||
option loglevel '3'
|
||||
#Log levels: Critical=0, Warning=1, Notice=2, Info=3, Debug=4
|
||||
option log_level '3'
|
||||
|
||||
config profile
|
||||
option profile_id '1'
|
||||
option enable '0'
|
||||
option name ''
|
||||
option nbre_of_retained_failed_reports '0'
|
||||
option protocol 'http'
|
||||
option encoding_type ''
|
||||
option reporting_interval '86400'
|
||||
option time_reference '0'
|
||||
option csv_encoding_field_separator ','
|
||||
option csv_encoding_row_separator ' '
|
||||
option csv_encoding_escape_character '"'
|
||||
option csv_encoding_report_format 'column'
|
||||
option csv_encoding_row_time_stamp 'unix'
|
||||
option json_encoding_report_format 'objecthierarchy'
|
||||
option json_encoding_report_time_stamp 'unix'
|
||||
option http_url ''
|
||||
option http_username ''
|
||||
option http_password ''
|
||||
option http_compression 'none'
|
||||
option http_method 'post'
|
||||
option http_use_date_header '1'
|
||||
option http_retry_enable '0'
|
||||
option http_retry_minimum_wait_interval '5'
|
||||
option http_retry_interval_multiplier '2000'
|
||||
option http_persist_across_reboot '0'
|
||||
|
||||
config profile_parameter
|
||||
option profile_id '1'
|
||||
option name ''
|
||||
option reference ''
|
||||
|
||||
config profile_http_request_uri_parameter
|
||||
option profile_id '1'
|
||||
option name ''
|
||||
option reference ''
|
||||
|
||||
|
||||
@@ -1,41 +1,34 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Bulkdata Software
|
||||
# Copyright (C) 2020 iopsys Software Solutions AB
|
||||
# Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
|
||||
|
||||
START=60
|
||||
START=99
|
||||
STOP=10
|
||||
|
||||
USE_PROCD=1
|
||||
PROG="/usr/sbin/bulkdatad"
|
||||
|
||||
validate_global_section() {
|
||||
uci_validate_section bulkdata bulkdata bulkdata \
|
||||
'enable:bool:1' \
|
||||
'loglevel:uinteger:3'
|
||||
start_service() {
|
||||
local bulkdata_enable=`uci -q get bulkdata.bulkdata.enable`
|
||||
if [ "$bulkdata_enable" = "1" ]; then
|
||||
procd_open_instance
|
||||
procd_set_param command "$PROG"
|
||||
procd_set_param respawn "3" "7" "0"
|
||||
procd_close_instance
|
||||
fi
|
||||
}
|
||||
|
||||
start_service() {
|
||||
local enable loglevel
|
||||
|
||||
validate_global_section
|
||||
|
||||
procd_open_instance "bulkdata"
|
||||
procd_set_param command "$PROG"
|
||||
procd_append_param command -l ${loglevel}
|
||||
procd_set_param respawn
|
||||
procd_close_instance "bulkdata"
|
||||
boot() {
|
||||
start
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
ret=$(ubus call service list '{"name":"bulkdatad"}' | jsonfilter -qe '@.bulkdatad.instances.bulkdata.running')
|
||||
if [ "$ret" != "true" ]; then
|
||||
stop
|
||||
start
|
||||
else
|
||||
ubus send bulkdata.reload
|
||||
fi
|
||||
|
||||
return 0
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger bulkdata
|
||||
}
|
||||
|
||||
23
bulkdata/src/Makefile
Normal file
23
bulkdata/src/Makefile
Normal file
@@ -0,0 +1,23 @@
|
||||
PROG = bulkdatad
|
||||
LIB = libbulkdata.so
|
||||
|
||||
PROG_OBJS = bulkdata.o common.o config.o http.o log.o report.o times.o buci.o
|
||||
LIB_OBJS = datamodel.o
|
||||
|
||||
PROG_CFLAGS = $(CFLAGS) -Wall -Werror -fPIC
|
||||
PROG_LDFLAGS = $(LDFLAGS) -lubus -luci -lubox -ljson-c -lcurl -lblobmsg_json -lbbfdm
|
||||
LIB_LDFLAGS = $(LDFLAGS) -lbbf_api
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(PROG_CFLAGS) $(FPIC) -c -o $@ $<
|
||||
|
||||
all: $(PROG) $(LIB)
|
||||
|
||||
$(PROG): $(PROG_OBJS)
|
||||
$(CC) $(PROG_CFLAGS) -o $@ $^ $(PROG_LDFLAGS)
|
||||
|
||||
$(LIB): $(LIB_OBJS)
|
||||
$(CC) $(PROG_CFLAGS) $(LIB_LDFLAGS) -shared -o $@ $^
|
||||
|
||||
clean:
|
||||
rm -f *.o $(PROG) $(LIB)
|
||||
265
bulkdata/src/buci.c
Normal file
265
bulkdata/src/buci.c
Normal file
@@ -0,0 +1,265 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Copyright (C) 2020 iopsys Software Solutions AB
|
||||
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <strings.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "buci.h"
|
||||
|
||||
struct uci_context *uci_ctx = NULL;
|
||||
|
||||
int buci_init(void)
|
||||
{
|
||||
uci_ctx = uci_alloc_context();
|
||||
if (!uci_ctx) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int buci_fini(void)
|
||||
{
|
||||
if (uci_ctx) {
|
||||
uci_free_context(uci_ctx);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool buci_validate_section(const char *str)
|
||||
{
|
||||
if (!*str)
|
||||
return false;
|
||||
|
||||
for (; *str; str++) {
|
||||
unsigned char c = *str;
|
||||
|
||||
if (isalnum(c) || c == '_')
|
||||
continue;
|
||||
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static int buci_init_ptr(struct uci_context *ctx, struct uci_ptr *ptr, char *package, char *section, char *option, char *value)
|
||||
{
|
||||
memset(ptr, 0, sizeof(struct uci_ptr));
|
||||
|
||||
/* value */
|
||||
if (value) {
|
||||
ptr->value = value;
|
||||
}
|
||||
ptr->package = package;
|
||||
if (!ptr->package)
|
||||
goto error;
|
||||
|
||||
ptr->section = section;
|
||||
if (!ptr->section) {
|
||||
ptr->target = UCI_TYPE_PACKAGE;
|
||||
goto lastval;
|
||||
}
|
||||
|
||||
ptr->option = option;
|
||||
if (!ptr->option) {
|
||||
ptr->target = UCI_TYPE_SECTION;
|
||||
goto lastval;
|
||||
} else {
|
||||
ptr->target = UCI_TYPE_OPTION;
|
||||
}
|
||||
|
||||
lastval:
|
||||
if (ptr->section && !buci_validate_section(ptr->section))
|
||||
ptr->flags |= UCI_LOOKUP_EXTENDED;
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct uci_section *buci_walk_section(char *package, char *section_type, struct uci_section *prev_section)
|
||||
{
|
||||
struct uci_ptr ptr;
|
||||
struct uci_element *e;
|
||||
struct uci_section *next_section;
|
||||
|
||||
if (section_type == NULL) {
|
||||
if (prev_section) {
|
||||
e = &prev_section->e;
|
||||
if (e->list.next == &prev_section->package->sections)
|
||||
return NULL;
|
||||
e = container_of(e->list.next, struct uci_element, list);
|
||||
next_section = uci_to_section(e);
|
||||
return next_section;
|
||||
}
|
||||
else {
|
||||
if (buci_init_ptr(uci_ctx, &ptr, package, NULL, NULL, NULL)) {
|
||||
return NULL;
|
||||
}
|
||||
if (uci_lookup_ptr(uci_ctx, &ptr, NULL, true) != UCI_OK) {
|
||||
return NULL;
|
||||
}
|
||||
if (ptr.p->sections.next == &ptr.p->sections)
|
||||
return NULL;
|
||||
e = container_of(ptr.p->sections.next, struct uci_element, list);
|
||||
next_section = uci_to_section(e);
|
||||
|
||||
return next_section;
|
||||
}
|
||||
}
|
||||
else {
|
||||
struct uci_list *ul, *shead = NULL;
|
||||
|
||||
if (prev_section) {
|
||||
ul = &prev_section->e.list;
|
||||
shead = &prev_section->package->sections;
|
||||
}
|
||||
else {
|
||||
if (buci_init_ptr(uci_ctx, &ptr, package, NULL, NULL, NULL)) {
|
||||
return NULL;
|
||||
}
|
||||
if (uci_lookup_ptr(uci_ctx, &ptr, NULL, true) != UCI_OK) {
|
||||
return NULL;
|
||||
}
|
||||
ul = &ptr.p->sections;
|
||||
shead = &ptr.p->sections;
|
||||
}
|
||||
while (ul->next != shead) {
|
||||
e = container_of(ul->next, struct uci_element, list);
|
||||
next_section = uci_to_section(e);
|
||||
if (strcmp(next_section->type, section_type) == 0)
|
||||
return next_section;
|
||||
ul = ul->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void buci_print_list(struct uci_list *uh, char **val, char *delimiter)
|
||||
{
|
||||
struct uci_element *e;
|
||||
static char buffer[512];
|
||||
char *buf = buffer;
|
||||
*buf = '\0';
|
||||
|
||||
uci_foreach_element(uh, e) {
|
||||
if (*buf) {
|
||||
strcat(buf, delimiter);
|
||||
strcat(buf, e->name);
|
||||
}
|
||||
else {
|
||||
strcpy(buf, e->name);
|
||||
}
|
||||
}
|
||||
*val = buf;
|
||||
}
|
||||
|
||||
struct uci_element *buci_lookup_list(struct uci_list *list, const char *name)
|
||||
{
|
||||
struct uci_element *e;
|
||||
|
||||
uci_foreach_element(list, e) {
|
||||
if (!strcmp(e->name, name))
|
||||
return e;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int uci_lookup_ptr_bysection(struct uci_context *ctx, struct uci_ptr *ptr, struct uci_section *section, char *option, char *value)
|
||||
{
|
||||
struct uci_element *e;
|
||||
memset(ptr, 0, sizeof(struct uci_ptr));
|
||||
|
||||
ptr->package = section->package->e.name;
|
||||
ptr->section = section->e.name;
|
||||
ptr->option = option;
|
||||
ptr->value = value;
|
||||
ptr->flags |= UCI_LOOKUP_DONE;
|
||||
|
||||
ptr->p = section->package;
|
||||
ptr->s = section;
|
||||
|
||||
if (ptr->option) {
|
||||
e = buci_lookup_list(&ptr->s->options, ptr->option);
|
||||
if (!e)
|
||||
return UCI_OK;
|
||||
ptr->o = uci_to_option(e);
|
||||
ptr->last = e;
|
||||
ptr->target = UCI_TYPE_OPTION;
|
||||
}
|
||||
else {
|
||||
ptr->last = &ptr->s->e;
|
||||
ptr->target = UCI_TYPE_SECTION;
|
||||
}
|
||||
|
||||
ptr->flags |= UCI_LOOKUP_COMPLETE;
|
||||
|
||||
return UCI_OK;
|
||||
}
|
||||
|
||||
char *buci_get_value_bysection(struct uci_section *section, char *option)
|
||||
{
|
||||
struct uci_ptr ptr;
|
||||
char *val = "";
|
||||
|
||||
if (uci_lookup_ptr_bysection(uci_ctx, &ptr, section, option, NULL) != UCI_OK) {
|
||||
return val;
|
||||
}
|
||||
|
||||
if (!ptr.o)
|
||||
return val;
|
||||
|
||||
if(ptr.o->type == UCI_TYPE_LIST) {
|
||||
buci_print_list(&ptr.o->v.list, &val, " ");
|
||||
return val;
|
||||
}
|
||||
|
||||
if (ptr.o->v.string)
|
||||
return ptr.o->v.string;
|
||||
else
|
||||
return val;
|
||||
}
|
||||
|
||||
char *buci_get_value(char *package, char *section, char *option)
|
||||
{
|
||||
struct uci_ptr ptr;
|
||||
char *val = "";
|
||||
|
||||
if (!section || !option)
|
||||
return val;
|
||||
|
||||
if (buci_init_ptr(uci_ctx, &ptr, package, section, option, NULL)) {
|
||||
return val;
|
||||
}
|
||||
if (uci_lookup_ptr(uci_ctx, &ptr, NULL, true) != UCI_OK) {
|
||||
return val;
|
||||
}
|
||||
|
||||
if (!ptr.o)
|
||||
return val;
|
||||
|
||||
if(ptr.o->type == UCI_TYPE_LIST) {
|
||||
buci_print_list(&ptr.o->v.list, &val, " ");
|
||||
return val;
|
||||
}
|
||||
|
||||
if (ptr.o->v.string)
|
||||
return ptr.o->v.string;
|
||||
else
|
||||
return val;
|
||||
}
|
||||
31
bulkdata/src/buci.h
Normal file
31
bulkdata/src/buci.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Copyright (C) 2020 iopsys Software Solutions AB
|
||||
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __BUCI_H
|
||||
#define __BUCI_H
|
||||
|
||||
#include <uci.h>
|
||||
|
||||
int buci_init(void);
|
||||
int buci_fini(void);
|
||||
struct uci_section *buci_walk_section(char *package, char *section_type, struct uci_section *prev_section);
|
||||
void buci_print_list(struct uci_list *uh, char **val, char *delimiter);
|
||||
struct uci_element *buci_lookup_list(struct uci_list *list, const char *name);
|
||||
int uci_lookup_ptr_bysection(struct uci_context *ctx, struct uci_ptr *ptr, struct uci_section *section, char *option, char *value);
|
||||
char *buci_get_value_bysection(struct uci_section *section, char *option);
|
||||
char *buci_get_value(char *package, char *section, char *option);
|
||||
|
||||
#define buci_foreach_section(package, section_type, section) \
|
||||
for (section = buci_walk_section(package, section_type, NULL); \
|
||||
section != NULL; \
|
||||
section = buci_walk_section(package, section_type, section))
|
||||
|
||||
#endif //__BUCI_H
|
||||
144
bulkdata/src/bulkdata.c
Normal file
144
bulkdata/src/bulkdata.c
Normal file
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Copyright (C) 2020 iopsys Software Solutions AB
|
||||
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
|
||||
* Omar Kallel <omar.kallel@pivasoftware.com>
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <libubox/uloop.h>
|
||||
|
||||
#include "http.h"
|
||||
#include "config.h"
|
||||
#include "log.h"
|
||||
#include "common.h"
|
||||
#include "report.h"
|
||||
#include "times.h"
|
||||
#include "bulkdata.h"
|
||||
|
||||
struct bulkdata bulkdata_main = {0};
|
||||
int profiles_number = 0;
|
||||
|
||||
void bulkdata_profile_cb(struct uloop_timeout *timeout);
|
||||
|
||||
int get_retry_period(int min)
|
||||
{
|
||||
srand(time(NULL));
|
||||
return rand()%min + min;
|
||||
}
|
||||
|
||||
static void bulkdata_run_profiles(struct bulkdata *bulkdata)
|
||||
{
|
||||
unsigned int next_period;
|
||||
int i = 0;
|
||||
|
||||
for (i = 0; i < profiles_number; i++) {
|
||||
bulkdata->profile[i].utimer.cb = bulkdata_profile_cb;
|
||||
LIST_HEAD(failedreports);
|
||||
bulkdata->profile[i].failed_reports = &failedreports;
|
||||
next_period = get_next_period(bulkdata->profile[i].time_reference, bulkdata->profile[i].reporting_interval);
|
||||
bulkdata_log(SINFO, "The session of profile_id %d will be start in %d sec", bulkdata->profile[i].profile_id, next_period);
|
||||
uloop_timeout_set(&bulkdata->profile[i].utimer, next_period * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
int http_send_report(struct profile *profile, char *report)
|
||||
{
|
||||
char *msg_in = NULL;
|
||||
int http_code;
|
||||
|
||||
http_client_init(profile);
|
||||
bulkdata_log(SINFO, "Send the report of profile_id %d to Bulkdata Collector", profile->profile_id);
|
||||
http_code = http_send_message(profile, report, strlen(report), &msg_in);
|
||||
http_client_exit();
|
||||
return http_code;
|
||||
}
|
||||
|
||||
void bulkdata_profile_cb(struct uloop_timeout *timeout)
|
||||
{
|
||||
struct profile *profile;
|
||||
unsigned int http_code, retry_period;
|
||||
char *report = NULL;
|
||||
|
||||
profile = container_of(timeout, struct profile, utimer);
|
||||
time_t now = time(NULL);
|
||||
|
||||
bulkdata_log(SINFO, "New session of profile_id %d started", profile->profile_id);
|
||||
if(profile->retry_count == 0 || profile->next_retry > now || !profile->http_retry_enable) //Perdiodic execution
|
||||
create_encoding_bulkdata_report(profile, &report);
|
||||
else
|
||||
create_failed_report(profile, &report);
|
||||
|
||||
bulkdata_log(SDEBUG, "The content of the profile_id report %d is :\n==========\n%s\n==========\n", profile->profile_id, report);
|
||||
http_code= http_send_report(profile, report);
|
||||
if(http_code != 200){
|
||||
if(profile->retry_count == 0 || profile->next_retry > now || !profile->http_retry_enable) { //Perdiodic execution
|
||||
retry_period = get_retry_period(profile->http_retry_minimum_wait_interval);
|
||||
profile->next_period = now + profile->reporting_interval;
|
||||
profile->next_retry = now + retry_period;
|
||||
profile->retry_count = 1;
|
||||
profile->min_retry = profile->http_retry_minimum_wait_interval * 2;
|
||||
if((profile->next_retry < profile->next_period) && profile->http_retry_enable) {
|
||||
bulkdata_log(SINFO, "Retry session of profile_id %d in %d sec", profile->profile_id, retry_period);
|
||||
uloop_timeout_set(timeout, 1000 * retry_period);
|
||||
}
|
||||
else {
|
||||
bulkdata_log(SINFO, "Start New session of profile_id %d in %d sec", profile->profile_id, profile->reporting_interval);
|
||||
uloop_timeout_set(timeout, 1000 * profile->reporting_interval);
|
||||
}
|
||||
} else { //Retry execution
|
||||
retry_period= get_retry_period(profile->min_retry);
|
||||
profile->min_retry*=2;
|
||||
profile->next_retry+=retry_period;
|
||||
profile->retry_count++;
|
||||
if(profile->next_retry < profile->next_period) {
|
||||
bulkdata_log(SINFO, "Retry session of profile_id %d in %d sec", profile->profile_id, retry_period);
|
||||
uloop_timeout_set(timeout, 1000 * retry_period);
|
||||
}
|
||||
else {
|
||||
bulkdata_log(SINFO, "Retry session of profile_id %d in %d sec", profile->profile_id, (profile->next_period-profile->next_retry+retry_period));
|
||||
uloop_timeout_set(timeout, 1000 * (profile->next_period-profile->next_retry+retry_period));
|
||||
}
|
||||
}
|
||||
if(profile->new_report){
|
||||
bulkdata_add_failed_report(profile, profile->new_report);
|
||||
FREE(profile->new_report);
|
||||
}
|
||||
FREE(report);
|
||||
} else {
|
||||
if(profile->retry_count == 0 || profile->next_retry > now || !profile->http_retry_enable) {
|
||||
bulkdata_log(SINFO, "Start New session of profile_id %d in %d sec", profile->profile_id, profile->reporting_interval);
|
||||
uloop_timeout_set(timeout, 1000 * profile->reporting_interval);
|
||||
}
|
||||
else {
|
||||
bulkdata_log(SINFO, "Retry session of profile_id %d in %d sec", profile->profile_id, (profile->next_period-profile->next_retry));
|
||||
uloop_timeout_set(timeout, 1000 * (profile->next_period-profile->next_retry));
|
||||
}
|
||||
FREE(profile->new_report);
|
||||
FREE(report);
|
||||
empty_failed_reports_list(profile);
|
||||
profile->retry_count= 0;
|
||||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
struct bulkdata *bulkdata = &bulkdata_main;
|
||||
if (bulkdata_config_init(bulkdata) == -1)
|
||||
return -1;
|
||||
bulkdata_log(SINFO, "Start bulkdatad daemon");
|
||||
|
||||
uloop_init();
|
||||
bulkdata_run_profiles(bulkdata);
|
||||
uloop_run();
|
||||
uloop_done();
|
||||
|
||||
bulkdata_config_fini(bulkdata);
|
||||
bulkdata_log(SINFO, "Stop bulkdatad daemon");
|
||||
return 0;
|
||||
}
|
||||
18
bulkdata/src/bulkdata.h
Normal file
18
bulkdata/src/bulkdata.h
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Copyright (C) 2020 iopsys Software Solutions AB
|
||||
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __BULKDATA_H
|
||||
#define __BULKDATA_H
|
||||
|
||||
extern struct bulkdata bulkdata_main;
|
||||
extern int profiles_number;
|
||||
|
||||
#endif /* __BULKDATA_H */
|
||||
105
bulkdata/src/bulkdata.md
Normal file
105
bulkdata/src/bulkdata.md
Normal file
@@ -0,0 +1,105 @@
|
||||
# README #
|
||||
|
||||
bulkdatad is an implementation of The HTTP bulk data collection mechanism which is an extended feature of CPE and other agents implementing TR-069(CWMP) or TR-369(USP), defined by the Broadband Forum. It provides a means by which an Auto-Configuration Server (ACS), or USP Controller, can configure an agent to periodically send a JSON or CSV formatted set of Device information to an HTTP server running a data collection application.
|
||||
|
||||
## Configuration File ##
|
||||
|
||||
The bulkdatad UCI configuration is located in **'/etc/config/bulkdata'**, and contains 4 sections: **bulkdata**, **profile**, **profile\_parameter** and **profile\_http\_request\_uri\_parameter**.
|
||||
|
||||
```
|
||||
config bulkdata 'bulkdata'
|
||||
option enable '0'
|
||||
option log_level '3'
|
||||
|
||||
config profile
|
||||
option profile_id '1'
|
||||
option enable '0'
|
||||
option csv_encoding_row_time_stamp 'unix'
|
||||
option json_encoding_report_time_stamp 'unix'
|
||||
option http_retry_minimum_wait_interval '5'
|
||||
option http_retry_interval_multiplier '2000'
|
||||
|
||||
config profile_parameter
|
||||
option profile_id '1'
|
||||
option name ''
|
||||
option reference ''
|
||||
|
||||
config profile_http_request_uri_parameter
|
||||
option profile_id '1'
|
||||
option name ''
|
||||
option reference ''
|
||||
```
|
||||
|
||||
### bulkdata section ###
|
||||
|
||||
It defines **bulkdata configuration**: enable and log\_level.
|
||||
|
||||
| Name | Type | Description |
|
||||
| ----------- | ------- | ----------------------------------------------------------------------------------------------- |
|
||||
| `enable` | boolean | Enables the BulkData feature if set to **1**. |
|
||||
| `log_level` | integer | Specifies the log type to use, by default **'INFO'**. The possible types are **'EMERG', 'ALERT', 'CRITIC' ,'ERROR', 'WARNING', 'NOTICE', 'INFO' and 'DEBUG'**. |
|
||||
|
||||
### profile section ###
|
||||
|
||||
It defines **the profile section configuration**: enable, name,... The possible options for **profile** section are listed below:
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---------------------------------- | ------- | ---------------------------------------------- |
|
||||
| `profile_id` | integer | The profile id to use. |
|
||||
| `enable` | boolean | If set to **1**, enables the bulkdata profile. |
|
||||
| `name` | string | The name of the profile. |
|
||||
| `nbre_of_retained_failed_reports` | integer | The number of failed reports to be retained and transmitted at the end of the current reporting interval. |
|
||||
| `protocol` | string | The protocol used for the collection profile. |
|
||||
| `encoding_type` | string | The encoding type used for the collection profile. |
|
||||
| `reporting_interval` | integer | The reporting interval in seconds. |
|
||||
| `time_reference` | integer | The time reference to determine when the profile will be transmitted to the ACS collector. |
|
||||
| `csv_encoding_field_separator` | string | The field separator to use when encoding CSV data. |
|
||||
| `csv_encoding_row_separator` | string | The row separator to use when encoding CSV data. |
|
||||
| `csv_encoding_escape_character` | string | The escape character to use when encoding CSV data. |
|
||||
| `csv_encoding_report_format` | string | Describes how reports will be formatted. Two possible formats are supported: **'ParameterPerRow' and 'ParameterPerColumn'**. |
|
||||
| `csv_encoding_row_time_stamp` | string | The format of the timestamp to use for data inserted into the row. The row time stamp supported are **'Unix-Epoch', 'ISO-8601' and 'None'**. |
|
||||
| `json_encoding_report_format` | string | Describes the report format. The supported report formats are **'ObjectHierarchy' and 'NameValuePair'**. |
|
||||
| `json_encoding_report_time_stamp` | string | The format of the timestamp to use for the JSON Object named "CollectionTime". The supported timestamp are **'Unix-Epoch', 'ISO-8601' and 'None'**. |
|
||||
| `http_url` | string | The URL of the collection server. |
|
||||
| `http_username` | string | The username of the collection server. |
|
||||
| `http_password` | string | The password of the collection server. |
|
||||
| `http_compression` | string | The HTTP Compression mechanism used by the collection server. The supported compression mechanism are **'GZIP', 'Compress' and 'Deflate'**. |
|
||||
| `http_method` | string | The HTTP method used by the collection server. Two methods are supported: **'POST' and 'PUT'**. |
|
||||
| `http_use_date_header` | boolean | If set to **1**, the CPE encodes the HTTP Date Header. |
|
||||
| `http_retry_enable` | boolean | If set to **1**, the CPE retries unsuccessful attempts to transfer data. |
|
||||
| `http_retry_minimum_wait_interval` | integer | The data transfer retry wait interval. |
|
||||
| `http_retry_interval_multiplier` | integer | The retry interval multiplier. |
|
||||
| `http_persist_across_reboot` | boolean | If set to **1**, failed data transfers must be persisted across reboots. |
|
||||
|
||||
### profile_parameter section ###
|
||||
|
||||
It defines **the profile\_parameter section configuration**: profile\_id, name, reference.
|
||||
|
||||
| Name | Type | Description |
|
||||
| ------------ | ------- | --------------------------------------- |
|
||||
| `profile_id` | integer | The id of the used profile. |
|
||||
| `name` | string | The name of the profile parameter. |
|
||||
| `reference` | string | The reference of the profile parameter. |
|
||||
|
||||
### profile_http_request_uri_parameter section ###
|
||||
|
||||
It defines **the profile\_http\_request\_uri\_parameter section configuration**: profile\_id, name, reference.
|
||||
|
||||
| Name | Type | Description |
|
||||
| ------------ | ------- | --------------------------------------- |
|
||||
| `profile_id` | integer | The id of the used profile. |
|
||||
| `name` | string | The name of the Request-URI parameter. |
|
||||
| `reference` | string | The reference of the profile parameter. |
|
||||
|
||||
## Dependencies ##
|
||||
|
||||
To successfully build bulkdatad, the following libraries are needed:
|
||||
|
||||
| Dependency | Link | License |
|
||||
| ----------- | ------------------------------------------- | -------------- |
|
||||
| libuci | https://git.openwrt.org/project/uci.git | LGPL 2.1 |
|
||||
| libubox | https://git.openwrt.org/project/libubox.git | BSD |
|
||||
| libjson-c | https://s3.amazonaws.com/json-c_releases | MIT |
|
||||
| libcurl | https://dl.uxnr.de/mirror/curl | MIT |
|
||||
| libbbfdm | https://dev.iopsys.eu/iopsys/bbf.git | LGPL 2.1 |
|
||||
|
||||
450
bulkdata/src/common.c
Normal file
450
bulkdata/src/common.c
Normal file
@@ -0,0 +1,450 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Copyright (C) 2020 iopsys Software Solutions AB
|
||||
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
|
||||
* Omar Kallel <omar.kallel@pivasoftware.com>
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
static pathnode *head = NULL;
|
||||
static pathnode *temphead = NULL;
|
||||
|
||||
int bulkdata_dm_ctx_init(struct dmctx *ctx)
|
||||
{
|
||||
struct bulkdata *bulkdata = &bulkdata_main;
|
||||
dm_ctx_init(ctx, DM_CWMP, bulkdata->amd_version, bulkdata->instance_mode);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bulkdata_dm_ctx_clean(struct dmctx *ctx)
|
||||
{
|
||||
dm_ctx_clean(ctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char **str_split(const char* str, const char* delim, size_t* numtokens)
|
||||
{
|
||||
char *s = strdup(str);
|
||||
size_t tokens_alloc = 1;
|
||||
size_t tokens_used = 0;
|
||||
char **tokens = calloc(tokens_alloc, sizeof(char*));
|
||||
char *token, *strtok_ctx;
|
||||
for (token = strtok_r(s, delim, &strtok_ctx); token != NULL; token = strtok_r(NULL, delim, &strtok_ctx)) {
|
||||
if (tokens_used == tokens_alloc) {
|
||||
tokens_alloc *= 2;
|
||||
tokens = realloc(tokens, tokens_alloc * sizeof(char*));
|
||||
}
|
||||
tokens[tokens_used++] = strdup(token);
|
||||
}
|
||||
// cleanup
|
||||
if (tokens_used == 0) {
|
||||
FREE(tokens);
|
||||
} else {
|
||||
tokens = realloc(tokens, tokens_used * sizeof(char*));
|
||||
}
|
||||
*numtokens = tokens_used;
|
||||
FREE(s);
|
||||
return tokens;
|
||||
}
|
||||
|
||||
static bool bulkdata_match(const char *string, const char *pattern)
|
||||
{
|
||||
regex_t re;
|
||||
if (regcomp(&re, pattern, REG_EXTENDED) != 0) return 0;
|
||||
int status = regexec(&re, string, 0, NULL, 0);
|
||||
regfree(&re);
|
||||
if (status != 0) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool is_res_required(char *str, int *start, int *len)
|
||||
{
|
||||
char temp_char[NAME_MAX] = {'\0'};
|
||||
|
||||
if (bulkdata_match(str, GLOB_CHAR)) {
|
||||
int s_len = strlen(str);
|
||||
int b_len = s_len, p_len = s_len;
|
||||
|
||||
char *star = strchr(str, '*');
|
||||
if(star)
|
||||
s_len = star - str;
|
||||
*start = MIN(MIN(s_len, p_len), b_len);
|
||||
if (*start == s_len)
|
||||
*len = 1;
|
||||
|
||||
strncpy(temp_char, str+*start, *len);
|
||||
|
||||
if (bulkdata_match(temp_char, "[*+]+"))
|
||||
return true;
|
||||
}
|
||||
*start = strlen(str);
|
||||
return false;
|
||||
}
|
||||
|
||||
static void insert(char *data, bool active)
|
||||
{
|
||||
pathnode *link = (pathnode*) calloc(1, sizeof(pathnode));
|
||||
if(!link) {
|
||||
return;
|
||||
}
|
||||
|
||||
link->ref_path = data;
|
||||
|
||||
if(active) {
|
||||
link->next = head;
|
||||
head = link;
|
||||
} else {
|
||||
link->next = temphead;
|
||||
temphead = link;
|
||||
}
|
||||
}
|
||||
|
||||
static void swap_heads(void)
|
||||
{
|
||||
pathnode *temp = head;
|
||||
head = temphead;
|
||||
temphead = temp;
|
||||
}
|
||||
|
||||
static void deleteList(void)
|
||||
{
|
||||
pathnode *ptr = head, *temp;
|
||||
while(ptr != NULL) {
|
||||
temp = ptr;
|
||||
free(ptr->ref_path);
|
||||
if(ptr->next != NULL) {
|
||||
ptr = ptr->next;
|
||||
} else {
|
||||
ptr = NULL;
|
||||
}
|
||||
free(temp);
|
||||
}
|
||||
head = NULL;
|
||||
swap_heads();
|
||||
}
|
||||
|
||||
void bulkdata_add_data_to_list(struct list_head *dup_list, char *name, char *value, char *type)
|
||||
{
|
||||
struct resultsnode *link;
|
||||
link = calloc(1, sizeof(struct resultsnode));
|
||||
list_add_tail(&link->list, dup_list);
|
||||
link->name = strdup(name);
|
||||
link->data = strdup(value);
|
||||
link->type = strdup(type);
|
||||
}
|
||||
|
||||
void bulkdata_delete_data_from_list(struct resultsnode *link)
|
||||
{
|
||||
list_del(&link->list);
|
||||
FREE(link->name);
|
||||
FREE(link->data);
|
||||
FREE(link->type);
|
||||
FREE(link);
|
||||
}
|
||||
|
||||
void bulkdata_free_data_from_list(struct list_head *dup_list)
|
||||
{
|
||||
struct resultsnode *link;
|
||||
while (dup_list->next != dup_list) {
|
||||
link = list_entry(dup_list->next, struct resultsnode, list);
|
||||
bulkdata_delete_data_from_list(link);
|
||||
}
|
||||
}
|
||||
|
||||
static bool bulkdata_get(int operation, char *path, struct dmctx *dm_ctx)
|
||||
{
|
||||
int fault = 0;
|
||||
|
||||
switch(operation) {
|
||||
case CMD_GET_NAME:
|
||||
fault = dm_entry_param_method(dm_ctx, CMD_GET_NAME, path, "true", NULL);
|
||||
break;
|
||||
case CMD_GET_VALUE:
|
||||
fault = dm_entry_param_method(dm_ctx, CMD_GET_VALUE, path, NULL, NULL);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (dm_ctx->list_fault_param.next != &dm_ctx->list_fault_param) {
|
||||
return false;
|
||||
}
|
||||
if (fault) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
char *bulkdata_get_value_param(char *path)
|
||||
{
|
||||
struct dmctx ctx = {0};
|
||||
struct dm_parameter *n;
|
||||
char *value = NULL;
|
||||
|
||||
bulkdata_dm_ctx_init(&ctx);
|
||||
if(bulkdata_get(CMD_GET_VALUE, path, &ctx)) {
|
||||
list_for_each_entry(n, &ctx.list_parameter, list) {
|
||||
value = strdup(n->data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
bulkdata_dm_ctx_clean(&ctx);
|
||||
return value;
|
||||
}
|
||||
|
||||
void bulkdata_get_value(char *path, struct list_head *list)
|
||||
{
|
||||
struct dmctx ctx = {0};
|
||||
struct dm_parameter *n;
|
||||
|
||||
bulkdata_dm_ctx_init(&ctx);
|
||||
if(bulkdata_get(CMD_GET_VALUE, path, &ctx)) {
|
||||
list_for_each_entry(n, &ctx.list_parameter, list) {
|
||||
bulkdata_add_data_to_list(list, n->name, n->data, n->type);
|
||||
}
|
||||
}
|
||||
bulkdata_dm_ctx_clean(&ctx);
|
||||
}
|
||||
|
||||
bool bulkdata_get_name(char *path)
|
||||
{
|
||||
struct dmctx ctx = {0};
|
||||
struct dm_parameter *n;
|
||||
bool ret = false;
|
||||
|
||||
bulkdata_dm_ctx_init(&ctx);
|
||||
if(bulkdata_get(CMD_GET_NAME, path, &ctx)) {
|
||||
list_for_each_entry(n, &ctx.list_parameter, list) {
|
||||
insert(strdup(n->name), false);
|
||||
}
|
||||
ret = true;
|
||||
}
|
||||
bulkdata_dm_ctx_clean(&ctx);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void fill_node_path(void)
|
||||
{
|
||||
pathnode *p=head;
|
||||
while(p!=NULL) {
|
||||
bulkdata_get_name(p->ref_path);
|
||||
p=p->next;
|
||||
}
|
||||
deleteList();
|
||||
}
|
||||
|
||||
static void bulkdata_filter_results(char *path, int start, int end)
|
||||
{
|
||||
int startpos = start, m_index = 0, m_len = 0;
|
||||
char *pp = path + startpos;
|
||||
char exp[NAME_MAX] = {'\0'};
|
||||
|
||||
if(start >= end) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!is_res_required(pp, &m_index, &m_len)) {
|
||||
//append rest of the path to the final list
|
||||
if(pp == path ) {
|
||||
insert(strdup(pp), true);
|
||||
return;
|
||||
}
|
||||
|
||||
pathnode *p = head;
|
||||
while(p != NULL) {
|
||||
char name[NAME_MAX] = {'\0'};
|
||||
strcpy(name, p->ref_path);
|
||||
strcat(name, pp);
|
||||
insert(strdup(name), false);
|
||||
p = p->next;
|
||||
}
|
||||
deleteList();
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the string before the match
|
||||
char name[NAME_MAX]={'\0'};
|
||||
strncpy(name, pp, m_index);
|
||||
|
||||
pathnode *p = head;
|
||||
if(p == NULL) {
|
||||
insert(strdup(name), false);
|
||||
}
|
||||
|
||||
while(p != NULL) {
|
||||
char ref_name[NAME_MAX] = {'\0'};
|
||||
sprintf(ref_name, "%s%s", p->ref_path, name);
|
||||
insert(strdup(ref_name), false);
|
||||
p = p->next;
|
||||
}
|
||||
deleteList();
|
||||
|
||||
startpos += m_index;
|
||||
strncpy(exp, pp+m_index, m_len);
|
||||
pp = path + startpos;
|
||||
fill_node_path();
|
||||
startpos += 2;
|
||||
bulkdata_filter_results(path, startpos, end);
|
||||
}
|
||||
|
||||
static void bulkdata_parse_results(struct list_head *list)
|
||||
{
|
||||
pathnode *p = head;
|
||||
while(p != NULL) {
|
||||
bulkdata_get_value(p->ref_path, list);
|
||||
p = p->next;
|
||||
}
|
||||
deleteList();
|
||||
}
|
||||
|
||||
void bulkdata_get_value_results(char *path, struct list_head *list)
|
||||
{
|
||||
bulkdata_filter_results(path, 0, strlen(path));
|
||||
bulkdata_parse_results(list);
|
||||
}
|
||||
|
||||
char *create_request_url(struct profile *profile)
|
||||
{
|
||||
int i = 0, http_uri_number = profile->profile_http_request_uri_parameter_number;
|
||||
char *value, *uri_param = NULL, *uri_tmp = NULL, *http_url = NULL;
|
||||
|
||||
for (i = 0; i < http_uri_number; i++)
|
||||
{
|
||||
if((profile->profile_http_uri_parameter[i].reference == NULL) || (profile->profile_http_uri_parameter[i].name == NULL))
|
||||
continue;
|
||||
value = bulkdata_get_value_param(profile->profile_http_uri_parameter[i].reference);
|
||||
if(!uri_param) {
|
||||
asprintf(&uri_param, "&%s=%s", profile->profile_http_uri_parameter[i].name, value);
|
||||
free(value);
|
||||
}
|
||||
else {
|
||||
uri_tmp = strdup(uri_param);
|
||||
free(uri_param);
|
||||
asprintf(&uri_param, "%s&%s=%s", uri_tmp, profile->profile_http_uri_parameter[i].name, value);
|
||||
free(value);
|
||||
free(uri_tmp);
|
||||
}
|
||||
}
|
||||
if(uri_param) {
|
||||
asprintf(&http_url, "%s%s", profile->http_url, uri_param);
|
||||
free(uri_param);
|
||||
} else {
|
||||
asprintf(&http_url, "%s", profile->http_url);
|
||||
}
|
||||
return http_url;
|
||||
}
|
||||
|
||||
char *get_bulkdata_profile_parameter_name(char *paramref, char *paramname, char *param)
|
||||
{
|
||||
char **paramarr, *idx1 = NULL, *idx2 = NULL, *res = NULL, *instance = NULL, *tmp = NULL, *retparam = NULL, *s = NULL;
|
||||
int i, j = 0;
|
||||
size_t length;
|
||||
|
||||
if(paramname == NULL || strlen(paramname) <= 0)
|
||||
return strdup(param);
|
||||
paramarr = str_split(paramref, "*", &length);
|
||||
res = strdup(paramname);
|
||||
for(i = 0; i < length; i++) {
|
||||
if(i == length - 1)
|
||||
break;
|
||||
j++;
|
||||
idx1 = strstr(param, paramarr[i]);
|
||||
idx2 = strstr(param, paramarr[i+1]);
|
||||
instance = (char*)calloc(idx2 - idx1 - strlen(paramarr[i]) + 1, sizeof(char));
|
||||
memcpy(instance, idx1 + strlen(paramarr[i]), idx2 - idx1 - strlen(paramarr[i]));
|
||||
tmp = strdup(res);
|
||||
FREE(res);
|
||||
asprintf(&res, "%s.%s", tmp, instance);
|
||||
FREE(tmp);
|
||||
FREE(instance);
|
||||
}
|
||||
if ((s = strstr(param,paramarr[j]) ) != NULL && strlen(s) == strlen(paramarr[j]))
|
||||
asprintf(&retparam, "%s", res);
|
||||
else
|
||||
asprintf(&retparam, "%s.%s", res, strstr(param, paramarr[j]) + strlen(paramarr[j]));
|
||||
|
||||
FREE(res);
|
||||
for(int k = 0; k < length; k++)
|
||||
FREE(paramarr[k]);
|
||||
FREE(paramarr);
|
||||
|
||||
return retparam;
|
||||
}
|
||||
|
||||
void append_string_to_string(char *strappend, char **target)
|
||||
{
|
||||
char *tmp = NULL;
|
||||
|
||||
if(strappend == NULL || strlen(strappend) <= 0)
|
||||
return;
|
||||
if(*target == NULL || strlen(*target) <= 0) {
|
||||
*target = strdup(strappend);
|
||||
return;
|
||||
} else {
|
||||
tmp = strdup(*target);
|
||||
FREE(*target);
|
||||
}
|
||||
asprintf(target, "%s%s", tmp, strappend);
|
||||
FREE(tmp);
|
||||
}
|
||||
|
||||
void bulkdata_add_failed_report(struct profile *profile, char *freport)
|
||||
{
|
||||
struct failed_reports *report, *retreport, *rtmp;
|
||||
|
||||
if(profile->nbre_failed_reports < profile->nbre_of_retained_failed_reports || profile->nbre_of_retained_failed_reports < 0) {
|
||||
profile->nbre_failed_reports++;
|
||||
} else {
|
||||
list_for_each_entry_safe(retreport, rtmp, profile->failed_reports, list) {
|
||||
bulkdata_delete_failed_report(retreport);
|
||||
break;
|
||||
}
|
||||
}
|
||||
report = calloc(1, sizeof(struct failed_reports));
|
||||
list_add_tail(&report->list, profile->failed_reports);
|
||||
report->freport= strdup(freport);
|
||||
}
|
||||
|
||||
void bulkdata_delete_failed_report(struct failed_reports *report)
|
||||
{
|
||||
if(report != NULL) {
|
||||
list_del(&report->list);
|
||||
FREE(report->freport);
|
||||
FREE(report);
|
||||
}
|
||||
}
|
||||
|
||||
struct failed_reports* empty_failed_reports_list(struct profile *profile)
|
||||
{
|
||||
struct failed_reports *report, *rtmp;
|
||||
|
||||
if(list_empty(profile->failed_reports))
|
||||
return NULL;
|
||||
list_for_each_entry_safe(report, rtmp, profile->failed_reports, list) {
|
||||
list_del(&report->list);
|
||||
FREE(report->freport);
|
||||
FREE(report);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void add_failed_reports_to_report_csv(struct profile *profile, char **report, int isnext)
|
||||
{
|
||||
struct failed_reports *retreport = NULL;
|
||||
int j = 0;
|
||||
|
||||
if(list_empty(profile->failed_reports))
|
||||
return;
|
||||
list_for_each_entry(retreport, profile->failed_reports, list) {
|
||||
if(!j && isnext) {
|
||||
j = 1;
|
||||
continue;
|
||||
}
|
||||
append_string_to_string(retreport->freport, report);
|
||||
}
|
||||
}
|
||||
69
bulkdata/src/common.h
Normal file
69
bulkdata/src/common.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Copyright (C) 2020 iopsys Software Solutions AB
|
||||
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __COMMON_H
|
||||
#define __COMMON_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <regex.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <libubox/blobmsg.h>
|
||||
#include <libubox/blobmsg_json.h>
|
||||
#include <libubox/utils.h>
|
||||
#include <libubus.h>
|
||||
|
||||
#include <libbbfdm/dmentry.h>
|
||||
#include <libbbfdm/dmbbfcommon.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "log.h"
|
||||
#include "bulkdata.h"
|
||||
|
||||
typedef struct pathnode {
|
||||
char *ref_path;
|
||||
struct pathnode *next;
|
||||
} pathnode;
|
||||
|
||||
typedef struct resultsnode {
|
||||
struct list_head list;
|
||||
char *name;
|
||||
char *data;
|
||||
char *type;
|
||||
} resultsnode;
|
||||
|
||||
struct failed_reports {
|
||||
struct list_head list;
|
||||
char *freport;
|
||||
};
|
||||
|
||||
#define GLOB_CHAR "[[+*]+"
|
||||
|
||||
int bulkdata_dm_ctx_init(struct dmctx *ctx);
|
||||
int bulkdata_dm_ctx_clean(struct dmctx *ctx);
|
||||
|
||||
char *bulkdata_get_value_param(char *path);
|
||||
void bulkdata_get_value(char *path, struct list_head *list);
|
||||
|
||||
void bulkdata_free_data_from_list(struct list_head *dup_list);
|
||||
void bulkdata_get_value_results(char *path, struct list_head *list);
|
||||
char *create_request_url(struct profile *profile);
|
||||
char *get_bulkdata_profile_parameter_name(char *paramref, char *paramname, char *param);
|
||||
void append_string_to_string(char *strappend, char **target);
|
||||
void bulkdata_add_failed_report(struct profile *profile, char *freport);
|
||||
void bulkdata_delete_failed_report(struct failed_reports *report);
|
||||
|
||||
struct failed_reports *empty_failed_reports_list(struct profile *profile);
|
||||
void add_failed_reports_to_report_csv(struct profile *profile, char **report, int isnext);
|
||||
|
||||
#endif //__COMMON_H
|
||||
524
bulkdata/src/config.c
Normal file
524
bulkdata/src/config.c
Normal file
@@ -0,0 +1,524 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Copyright (C) 2020 iopsys Software Solutions AB
|
||||
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
|
||||
* Omar Kallel <omar.kallel@pivasoftware.com>
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <strings.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <libbbfdm/deviceinfo.h>
|
||||
|
||||
#include "log.h"
|
||||
#include "config.h"
|
||||
#include "buci.h"
|
||||
#include "common.h"
|
||||
#include "bulkdata.h"
|
||||
|
||||
int get_log_level_config(struct bulkdata *bulkdata)
|
||||
{
|
||||
char *value = NULL;
|
||||
|
||||
buci_init();
|
||||
value = buci_get_value("bulkdata", "bulkdata", "log_level");
|
||||
if(value != NULL && *value != '\0')
|
||||
bulkdata->log_level = atoi(value);
|
||||
else
|
||||
bulkdata->log_level = DEFAULT_LOGLEVEL;
|
||||
bulkdata_log(SDEBUG,"Log Level of Bulkdata is : %d", bulkdata->log_level);
|
||||
buci_fini();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int get_amd_version_config(struct bulkdata *bulkdata)
|
||||
{
|
||||
char *value = NULL;
|
||||
|
||||
buci_init();
|
||||
value = buci_get_value("cwmp", "cpe", "amd_version");
|
||||
if(value != NULL && *value != '\0')
|
||||
bulkdata->amd_version = atoi(value);
|
||||
else
|
||||
bulkdata->amd_version = DEFAULT_AMD_VERSION;
|
||||
bulkdata_log(SDEBUG,"CWMP Amendment Version is : %d", bulkdata->amd_version);
|
||||
buci_fini();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int get_instance_mode_config(struct bulkdata *bulkdata)
|
||||
{
|
||||
char *value = NULL;
|
||||
|
||||
buci_init();
|
||||
value = buci_get_value("cwmp", "cpe", "instance_mode");
|
||||
if(value != NULL && *value != '\0') {
|
||||
if(!strcmp(value, "InstanceNumber"))
|
||||
bulkdata->instance_mode = INSTANCE_MODE_NUMBER;
|
||||
else
|
||||
bulkdata->instance_mode = INSTANCE_MODE_ALIAS;
|
||||
}
|
||||
else
|
||||
bulkdata->instance_mode = DEFAULT_INSTANCE_MODE;
|
||||
bulkdata_log(SDEBUG,"CWMP Instance Mode is : %d", bulkdata->instance_mode);
|
||||
buci_fini();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int get_device_id_config(struct bulkdata *bulkdata)
|
||||
{
|
||||
struct dmctx dmctx = {0};
|
||||
|
||||
bulkdata_dm_ctx_init(&dmctx);
|
||||
bulkdata->device_id.manufacturer_oui = strdup(get_deviceid_manufactureroui());
|
||||
bulkdata->device_id.product_class = strdup(get_deviceid_productclass());
|
||||
bulkdata->device_id.serial_number = strdup(get_deviceid_serialnumber());
|
||||
bulkdata_dm_ctx_clean(&dmctx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int load_profile_config(struct bulkdata *bulkdata, struct uci_section *s, int i)
|
||||
{
|
||||
char *value = NULL;
|
||||
|
||||
value = buci_get_value_bysection(s, "profile_id");
|
||||
if(value != NULL && *value != '\0') {
|
||||
bulkdata->profile[i].profile_id = atoi(value);
|
||||
value = NULL;
|
||||
bulkdata_log(SDEBUG,"The profile_id of profile_id %d is : %d", i, bulkdata->profile[i].profile_id);
|
||||
} else
|
||||
return -1;
|
||||
|
||||
value = buci_get_value_bysection(s, "nbre_of_retained_failed_reports");
|
||||
if(value != NULL && *value != '\0') {
|
||||
bulkdata->profile[i].nbre_of_retained_failed_reports = atoi(value);
|
||||
value = NULL;
|
||||
bulkdata_log(SDEBUG,"The nombre of retained failed reports of profile_id %d is : %d", bulkdata->profile[i].profile_id, bulkdata->profile[i].nbre_of_retained_failed_reports);
|
||||
}
|
||||
|
||||
value = buci_get_value_bysection(s, "protocol");
|
||||
if(value != NULL && *value != '\0' && strcasecmp(value, "http")==0) {
|
||||
bulkdata->profile[i].protocol = strdup(value);
|
||||
value = NULL;
|
||||
bulkdata_log(SDEBUG,"The protocol of profile_id %d is : %s", bulkdata->profile[i].profile_id, bulkdata->profile[i].protocol);
|
||||
} else
|
||||
return -1;
|
||||
|
||||
value = buci_get_value_bysection(s, "encoding_type");
|
||||
if(value != NULL && *value != '\0') {
|
||||
bulkdata->profile[i].encoding_type = strdup(value);
|
||||
value = NULL;
|
||||
bulkdata_log(SDEBUG,"The encoding type of profile_id %d is : %s", bulkdata->profile[i].profile_id, bulkdata->profile[i].encoding_type);
|
||||
} else
|
||||
return -1;
|
||||
|
||||
value = buci_get_value_bysection(s, "reporting_interval");
|
||||
if(value != NULL && *value != '\0') {
|
||||
bulkdata->profile[i].reporting_interval = atoi(value);
|
||||
value = NULL;
|
||||
bulkdata_log(SDEBUG,"The reporting interval of profile_id %d is : %d", bulkdata->profile[i].profile_id, bulkdata->profile[i].reporting_interval);
|
||||
} else
|
||||
return -1;
|
||||
|
||||
value = buci_get_value_bysection(s, "time_reference");
|
||||
if(value != NULL && *value != '\0') {
|
||||
bulkdata->profile[i].time_reference = atoi(value);
|
||||
value = NULL;
|
||||
bulkdata_log(SDEBUG,"The time reference of profile_id %d is : %ld", bulkdata->profile[i].profile_id, bulkdata->profile[i].time_reference);
|
||||
} else
|
||||
return -1;
|
||||
|
||||
value = buci_get_value_bysection(s, "csv_encoding_field_separator");
|
||||
if(value != NULL && *value != '\0') {
|
||||
bulkdata->profile[i].csv_encoding_field_separator = strdup(value);
|
||||
value = NULL;
|
||||
bulkdata_log(SDEBUG,"The csv encoding field separator of profile_id %d is : %s", bulkdata->profile[i].profile_id, bulkdata->profile[i].csv_encoding_field_separator);
|
||||
} else
|
||||
return -1;
|
||||
|
||||
value = buci_get_value_bysection(s, "csv_encoding_row_separator");
|
||||
if(value != NULL && *value != '\0') {
|
||||
bulkdata->profile[i].csv_encoding_row_separator = strdup(value);
|
||||
value = NULL;
|
||||
bulkdata_log(SDEBUG,"The csv encoding row separator of profile_id %d is : %s", bulkdata->profile[i].profile_id, bulkdata->profile[i].csv_encoding_row_separator);
|
||||
} else
|
||||
return -1;
|
||||
|
||||
value = buci_get_value_bysection(s, "csv_encoding_escape_character");
|
||||
if(value != NULL && *value != '\0') {
|
||||
bulkdata->profile[i].csv_encoding_escape_character = strdup(value);
|
||||
value = NULL;
|
||||
bulkdata_log(SDEBUG,"The csv encoding escape character of profile_id %d is : %s", bulkdata->profile[i].profile_id, bulkdata->profile[i].csv_encoding_escape_character);
|
||||
}
|
||||
|
||||
value = buci_get_value_bysection(s, "csv_encoding_report_format");
|
||||
if(value != NULL && *value != '\0') {
|
||||
bulkdata->profile[i].csv_encoding_report_format = strdup(value);
|
||||
value = NULL;
|
||||
bulkdata_log(SDEBUG,"The csv encoding report format of profile_id %d is : %s", bulkdata->profile[i].profile_id, bulkdata->profile[i].csv_encoding_report_format);
|
||||
} else
|
||||
return -1;
|
||||
|
||||
value = buci_get_value_bysection(s, "csv_encoding_row_time_stamp");
|
||||
if(value != NULL && *value != '\0') {
|
||||
bulkdata->profile[i].csv_encoding_row_time_stamp = strdup(value);
|
||||
value = NULL;
|
||||
bulkdata_log(SDEBUG,"The csv encoding row time stamp of profile_id %d is : %s", bulkdata->profile[i].profile_id, bulkdata->profile[i].csv_encoding_row_time_stamp);
|
||||
} else
|
||||
return -1;
|
||||
|
||||
value = buci_get_value_bysection(s, "json_encoding_report_format");
|
||||
if(value != NULL && *value != '\0') {
|
||||
bulkdata->profile[i].json_encoding_report_format = strdup(value);
|
||||
value = NULL;
|
||||
bulkdata_log(SDEBUG,"The json encoding report format of profile_id %d is : %s", bulkdata->profile[i].profile_id, bulkdata->profile[i].json_encoding_report_format);
|
||||
} else
|
||||
return -1;
|
||||
|
||||
value = buci_get_value_bysection(s, "json_encoding_report_time_stamp");
|
||||
if(value != NULL && *value != '\0') {
|
||||
bulkdata->profile[i].json_encoding_report_time_stamp = strdup(value);
|
||||
value = NULL;
|
||||
bulkdata_log(SDEBUG,"The json encoding report time stamp of profile_id %d is : %s", bulkdata->profile[i].profile_id, bulkdata->profile[i].json_encoding_report_time_stamp);
|
||||
} else
|
||||
return -1;
|
||||
|
||||
value = buci_get_value_bysection(s, "http_url");
|
||||
if(value != NULL && *value != '\0') {
|
||||
char *url = NULL;
|
||||
asprintf(&url, "%s?oui=%s&pc=%s&sn=%s", value, bulkdata->device_id.manufacturer_oui, bulkdata->device_id.serial_number, bulkdata->device_id.serial_number);
|
||||
bulkdata->profile[i].http_url = strdup(url);
|
||||
free(url);
|
||||
value = NULL;
|
||||
bulkdata_log(SDEBUG,"The HTTP url of profile_id %d is : %s", bulkdata->profile[i].profile_id, bulkdata->profile[i].http_url);
|
||||
} else
|
||||
return -1;
|
||||
|
||||
value = buci_get_value_bysection(s, "http_username");
|
||||
if(value != NULL && *value != '\0') {
|
||||
bulkdata->profile[i].http_username = strdup(value);
|
||||
value = NULL;
|
||||
bulkdata_log(SDEBUG,"The HTTP username of profile_id %d is : %s", bulkdata->profile[i].profile_id, bulkdata->profile[i].http_username);
|
||||
} else {
|
||||
bulkdata->profile[i].http_username = NULL;
|
||||
}
|
||||
|
||||
value = buci_get_value_bysection(s, "http_password");
|
||||
if(value != NULL && *value != '\0') {
|
||||
bulkdata->profile[i].http_password = strdup(value);
|
||||
value = NULL;
|
||||
bulkdata_log(SDEBUG,"The HTTP password of profile_id %d is : %s", bulkdata->profile[i].profile_id, bulkdata->profile[i].http_password);
|
||||
} else {
|
||||
bulkdata->profile[i].http_password = NULL;
|
||||
}
|
||||
|
||||
value = buci_get_value_bysection(s, "http_compression");
|
||||
if(value != NULL && *value != '\0') {
|
||||
bulkdata->profile[i].http_compression = strdup(value);
|
||||
value = NULL;
|
||||
bulkdata_log(SDEBUG,"The HTTP compression of profile_id %d is : %s", bulkdata->profile[i].profile_id, bulkdata->profile[i].http_compression);
|
||||
} else
|
||||
return -1;
|
||||
|
||||
value = buci_get_value_bysection(s, "http_method");
|
||||
if(value != NULL && *value != '\0') {
|
||||
bulkdata->profile[i].http_method = strdup(value);
|
||||
value = NULL;
|
||||
bulkdata_log(SDEBUG,"The HTTP method of profile_id %d is : %s", bulkdata->profile[i].profile_id, bulkdata->profile[i].http_method);
|
||||
} else
|
||||
return -1;
|
||||
|
||||
value = buci_get_value_bysection(s, "http_use_date_header");
|
||||
if(value != NULL && *value != '\0') {
|
||||
bulkdata->profile[i].http_use_date_header = atoi(value);
|
||||
value = NULL;
|
||||
bulkdata_log(SDEBUG,"The HTTP use date header of profile_id %d is : %d", bulkdata->profile[i].profile_id, bulkdata->profile[i].http_use_date_header);
|
||||
}
|
||||
|
||||
value = buci_get_value_bysection(s, "http_retry_enable");
|
||||
if(value != NULL && *value != '\0') {
|
||||
bulkdata->profile[i].http_retry_enable = atoi(value);
|
||||
value = NULL;
|
||||
bulkdata_log(SDEBUG,"The HTTP retry enable of profile_id %d is : %d", bulkdata->profile[i].profile_id, bulkdata->profile[i].http_retry_enable);
|
||||
} else
|
||||
return -1;
|
||||
|
||||
value = buci_get_value_bysection(s, "http_retry_minimum_wait_interval");
|
||||
if(value != NULL && *value != '\0') {
|
||||
bulkdata->profile[i].http_retry_minimum_wait_interval = atoi(value);
|
||||
value = NULL;
|
||||
bulkdata_log(SDEBUG,"The HTTP retry minimum wait interval of profile_id %d is : %d", bulkdata->profile[i].profile_id, bulkdata->profile[i].http_retry_minimum_wait_interval);
|
||||
}
|
||||
|
||||
value = buci_get_value_bysection(s, "http_retry_interval_multiplier");
|
||||
if(value != NULL && *value != '\0') {
|
||||
bulkdata->profile[i].http_retry_interval_multiplier = atoi(value);
|
||||
value = NULL;
|
||||
bulkdata_log(SDEBUG,"The HTTP retry interval multiplier of profile_id %d is : %d", bulkdata->profile[i].profile_id, bulkdata->profile[i].http_retry_interval_multiplier);
|
||||
}
|
||||
|
||||
value = buci_get_value_bysection(s, "http_persist_across_reboot");
|
||||
if(value != NULL && *value != '\0') {
|
||||
bulkdata->profile[i].http_persist_across_reboot = atoi(value);
|
||||
value = NULL;
|
||||
bulkdata_log(SDEBUG,"The HTTP persist across reboot of profile_id %d is : %d", bulkdata->profile[i].profile_id, bulkdata->profile[i].http_persist_across_reboot);
|
||||
} else
|
||||
return -1;
|
||||
|
||||
value = buci_get_value_bysection(s, "http_ssl_capath");
|
||||
if(value != NULL && *value != '\0') {
|
||||
bulkdata->profile[i].http_ssl_capath = strdup(value);
|
||||
value = NULL;
|
||||
bulkdata_log(SDEBUG,"The HTTP ssl capath of profile_id %d is : %s", bulkdata->profile[i].profile_id, bulkdata->profile[i].http_ssl_capath);
|
||||
} else {
|
||||
bulkdata->profile[i].http_ssl_capath = NULL;
|
||||
}
|
||||
|
||||
value = buci_get_value_bysection(s, "http_insecure_enable");
|
||||
if(value != NULL && *value != '\0') {
|
||||
bulkdata->profile[i].http_insecure_enable = atoi(value);
|
||||
value = NULL;
|
||||
bulkdata_log(SDEBUG,"The HTTP insecure enable of profile_id %d is : %d", bulkdata->profile[i].profile_id, bulkdata->profile[i].http_insecure_enable);
|
||||
}
|
||||
|
||||
bulkdata->profile[i].retry_count = 0;
|
||||
bulkdata->profile[i].nbre_failed_reports = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int get_profiles_enable(struct bulkdata *bulkdata)
|
||||
{
|
||||
struct uci_section *s;
|
||||
char *enable;
|
||||
int i = 0, nbr_profiles = 0;
|
||||
|
||||
buci_init();
|
||||
|
||||
buci_foreach_section("bulkdata", "profile", s) {
|
||||
enable = buci_get_value_bysection(s, "enable");
|
||||
if(strcmp(enable, "1") == 0) {
|
||||
nbr_profiles++;
|
||||
}
|
||||
}
|
||||
|
||||
if(nbr_profiles != 0)
|
||||
bulkdata->profile = calloc(2, sizeof(struct profile));
|
||||
|
||||
buci_foreach_section("bulkdata", "profile", s) {
|
||||
enable = buci_get_value_bysection(s, "enable");
|
||||
if(strcmp(enable, "1") == 0) {
|
||||
if(load_profile_config(bulkdata, s, i) == -1) {
|
||||
bulkdata_log(SCRIT,"Not able to start bulkdata: some required bulkdata configurations in profile must be set");
|
||||
return -1;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
profiles_number = nbr_profiles;
|
||||
|
||||
buci_fini();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int load_profile_parameter_config(struct bulkdata *bulkdata, struct uci_section *s, int i, int j)
|
||||
{
|
||||
char *value = NULL;
|
||||
|
||||
value = buci_get_value_bysection(s, "name");
|
||||
if(value != NULL && *value != '\0') {
|
||||
bulkdata->profile[i].profile_parameter[j].name = strdup(value);
|
||||
value = NULL;
|
||||
bulkdata_log(SDEBUG,"The parameter name %d of profile_id %d is : %s", j+1, bulkdata->profile[i].profile_id, bulkdata->profile[i].profile_parameter[j].name);
|
||||
} else {
|
||||
bulkdata->profile[i].profile_parameter[j].name = NULL;
|
||||
}
|
||||
|
||||
value = buci_get_value_bysection(s, "reference");
|
||||
if(value != NULL && *value != '\0') {
|
||||
bulkdata->profile[i].profile_parameter[j].reference = strdup(value);
|
||||
value = NULL;
|
||||
bulkdata_log(SDEBUG,"The parameter reference %d of profile_id %d is : %s", j+1, bulkdata->profile[i].profile_id, bulkdata->profile[i].profile_parameter[j].reference);
|
||||
} else
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int get_profiles_parameters(struct bulkdata *bulkdata)
|
||||
{
|
||||
struct uci_section *s;
|
||||
char *profile_id;
|
||||
int i, j, nbr_profile_parameters;
|
||||
|
||||
buci_init();
|
||||
|
||||
for (i = 0; i < profiles_number; i++) {
|
||||
j = 0;
|
||||
nbr_profile_parameters = 0;
|
||||
buci_foreach_section("bulkdata", "profile_parameter", s) {
|
||||
profile_id = buci_get_value_bysection(s, "profile_id");
|
||||
if(bulkdata->profile[i].profile_id != atoi(profile_id))
|
||||
continue;
|
||||
nbr_profile_parameters++;
|
||||
if(nbr_profile_parameters == 1) {
|
||||
bulkdata->profile[i].profile_parameter = calloc(1, sizeof(struct profile_parameter));
|
||||
} else {
|
||||
bulkdata->profile[i].profile_parameter = realloc(bulkdata->profile[i].profile_parameter, nbr_profile_parameters * sizeof(struct profile_parameter));
|
||||
}
|
||||
if(load_profile_parameter_config(bulkdata, s, i, j) == -1) {
|
||||
bulkdata_log(SCRIT,"Not able to start bulkdata: some required bulkdata configurations in profile_parameter must be set");
|
||||
return -1;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
bulkdata->profile[i].profile_parameter_number = nbr_profile_parameters;
|
||||
}
|
||||
|
||||
buci_fini();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int load_profile_http_request_uri_parameter_config(struct bulkdata *bulkdata, struct uci_section *s, int i, int j)
|
||||
{
|
||||
char *value = NULL;
|
||||
|
||||
value = buci_get_value_bysection(s, "name");
|
||||
if(value != NULL && *value != '\0') {
|
||||
bulkdata->profile[i].profile_http_uri_parameter[j].name = strdup(value);
|
||||
value = NULL;
|
||||
bulkdata_log(SDEBUG,"The HTTP resuest URI parameter name %d of profile_id %d is : %s", j+1, bulkdata->profile[i].profile_id, bulkdata->profile[i].profile_http_uri_parameter[j].name);
|
||||
} else
|
||||
return -1;
|
||||
|
||||
value = buci_get_value_bysection(s, "reference");
|
||||
if(value != NULL && *value != '\0') {
|
||||
bulkdata->profile[i].profile_http_uri_parameter[j].reference = strdup(value);
|
||||
value = NULL;
|
||||
bulkdata_log(SDEBUG,"The HTTP resuest URI parameter reference %d of profile_id %d is : %s", j+1, bulkdata->profile[i].profile_id, bulkdata->profile[i].profile_http_uri_parameter[j].reference);
|
||||
} else
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int get_profile_http_request_uri_parameter(struct bulkdata *bulkdata)
|
||||
{
|
||||
struct uci_section *s;
|
||||
char *profile_id;
|
||||
int i, j, nbr_profile_http_request_uri_parameter;
|
||||
|
||||
buci_init();
|
||||
|
||||
for (i = 0; i < profiles_number; i++) {
|
||||
j = 0;
|
||||
nbr_profile_http_request_uri_parameter = 0;
|
||||
buci_foreach_section("bulkdata", "profile_http_request_uri_parameter", s) {
|
||||
profile_id = buci_get_value_bysection(s, "profile_id");
|
||||
if(bulkdata->profile[i].profile_id != atoi(profile_id))
|
||||
continue;
|
||||
nbr_profile_http_request_uri_parameter++;
|
||||
if(nbr_profile_http_request_uri_parameter == 1) {
|
||||
bulkdata->profile[i].profile_http_uri_parameter = calloc(1, sizeof(struct profile_http_request_uri_parameter));
|
||||
} else {
|
||||
bulkdata->profile[i].profile_http_uri_parameter = realloc(bulkdata->profile[i].profile_http_uri_parameter, nbr_profile_http_request_uri_parameter * sizeof(struct profile_http_request_uri_parameter));
|
||||
}
|
||||
if(load_profile_http_request_uri_parameter_config(bulkdata, s, i, j)== -1) {
|
||||
bulkdata_log(SCRIT,"Not able to start bulkdata: some required bulkdata configurations in profile_http_request_uri_parameter must be set");
|
||||
return -1;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
bulkdata->profile[i].profile_http_request_uri_parameter_number = nbr_profile_http_request_uri_parameter;
|
||||
}
|
||||
|
||||
buci_fini();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bulkdata_config_init(struct bulkdata *bulkdata)
|
||||
{
|
||||
get_log_level_config(bulkdata);
|
||||
get_amd_version_config(bulkdata);
|
||||
get_instance_mode_config(bulkdata);
|
||||
get_device_id_config(bulkdata);
|
||||
if (get_profiles_enable(bulkdata) == -1)
|
||||
return -1;
|
||||
if (get_profiles_parameters(bulkdata) == -1)
|
||||
return -1;
|
||||
if (get_profile_http_request_uri_parameter(bulkdata) == -1)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int free_device_id_config(struct bulkdata *bulkdata)
|
||||
{
|
||||
FREE(bulkdata->device_id.manufacturer_oui);
|
||||
FREE(bulkdata->device_id.product_class);
|
||||
FREE(bulkdata->device_id.serial_number);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int free_profiles_enable(struct bulkdata *bulkdata)
|
||||
{
|
||||
for(int i = 0; i < profiles_number; i++) {
|
||||
FREE(bulkdata->profile[i].protocol);
|
||||
FREE(bulkdata->profile[i].encoding_type);
|
||||
FREE(bulkdata->profile[i].csv_encoding_field_separator);
|
||||
FREE(bulkdata->profile[i].csv_encoding_row_separator);
|
||||
FREE(bulkdata->profile[i].csv_encoding_escape_character);
|
||||
FREE(bulkdata->profile[i].csv_encoding_report_format);
|
||||
FREE(bulkdata->profile[i].csv_encoding_row_time_stamp);
|
||||
FREE(bulkdata->profile[i].json_encoding_report_format);
|
||||
FREE(bulkdata->profile[i].json_encoding_report_time_stamp);
|
||||
FREE(bulkdata->profile[i].http_url);
|
||||
FREE(bulkdata->profile[i].http_username);
|
||||
FREE(bulkdata->profile[i].http_password);
|
||||
FREE(bulkdata->profile[i].http_compression);
|
||||
FREE(bulkdata->profile[i].http_method);
|
||||
FREE(bulkdata->profile[i].http_ssl_capath);
|
||||
}
|
||||
FREE(bulkdata->profile);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int free_profiles_parameters(struct bulkdata *bulkdata)
|
||||
{
|
||||
for(int i = 0; i < profiles_number; i++) {
|
||||
for(int j = 0; j < bulkdata->profile[i].profile_parameter_number; j++) {
|
||||
FREE(bulkdata->profile[i].profile_parameter[j].name);
|
||||
FREE(bulkdata->profile[i].profile_parameter[j].reference);
|
||||
}
|
||||
FREE(bulkdata->profile[i].profile_parameter);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int free_profile_http_request_uri_parameter(struct bulkdata *bulkdata)
|
||||
{
|
||||
for(int i = 0; i < profiles_number; i++) {
|
||||
for(int j = 0; j < bulkdata->profile[i].profile_http_request_uri_parameter_number; j++) {
|
||||
FREE(bulkdata->profile[i].profile_http_uri_parameter[j].name);
|
||||
FREE(bulkdata->profile[i].profile_http_uri_parameter[j].reference);
|
||||
}
|
||||
FREE(bulkdata->profile[i].profile_http_uri_parameter);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bulkdata_config_fini(struct bulkdata *bulkdata)
|
||||
{
|
||||
free_device_id_config(bulkdata);
|
||||
free_profiles_parameters(bulkdata);
|
||||
free_profile_http_request_uri_parameter(bulkdata);
|
||||
free_profiles_enable(bulkdata);
|
||||
return 0;
|
||||
}
|
||||
103
bulkdata/src/config.h
Normal file
103
bulkdata/src/config.h
Normal file
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Copyright (C) 2020 iopsys Software Solutions AB
|
||||
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __CONFIG_H
|
||||
#define __CONFIG_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <time.h>
|
||||
#include <libubox/uloop.h>
|
||||
|
||||
#define DEFAULT_AMD_VERSION 2
|
||||
#define DEFAULT_INSTANCE_MODE 0
|
||||
|
||||
typedef struct device_id {
|
||||
char *manufacturer_oui;
|
||||
char *product_class;
|
||||
char *serial_number;
|
||||
} device_id;
|
||||
|
||||
typedef struct profile_parameter {
|
||||
int profile_id;
|
||||
char *name;
|
||||
char *reference;
|
||||
} profile_parameter;
|
||||
|
||||
typedef struct profile_http_request_uri_parameter {
|
||||
int profile_id;
|
||||
char *name;
|
||||
char *reference;
|
||||
} profile_http_request_uri_parameter;
|
||||
|
||||
typedef struct profile {
|
||||
struct uloop_timeout utimer;
|
||||
int profile_id;
|
||||
int nbre_of_retained_failed_reports;
|
||||
int nbre_failed_reports;
|
||||
int reporting_interval;
|
||||
int profile_parameter_number;
|
||||
int profile_http_request_uri_parameter_number;
|
||||
int http_retry_minimum_wait_interval;
|
||||
int http_retry_interval_multiplier;
|
||||
int min_retry;
|
||||
int retry_count;
|
||||
char *protocol;
|
||||
char *encoding_type;
|
||||
char *csv_encoding_field_separator;
|
||||
char *csv_encoding_row_separator;
|
||||
char *csv_encoding_escape_character;
|
||||
char *csv_encoding_report_format;
|
||||
char *csv_encoding_row_time_stamp;
|
||||
char *json_encoding_report_format;
|
||||
char *json_encoding_report_time_stamp;
|
||||
char *http_url;
|
||||
char *http_username;
|
||||
char *http_password;
|
||||
char *http_compression;
|
||||
char *http_method;
|
||||
char *http_ssl_capath;
|
||||
char *new_report;
|
||||
time_t time_reference;
|
||||
time_t next_retry;
|
||||
time_t next_period;
|
||||
bool http_persist_across_reboot;
|
||||
bool http_insecure_enable;
|
||||
bool enable;
|
||||
bool http_use_date_header;
|
||||
bool http_retry_enable;
|
||||
struct profile_parameter *profile_parameter;
|
||||
struct profile_http_request_uri_parameter *profile_http_uri_parameter;
|
||||
struct list_head *failed_reports;
|
||||
} profile;
|
||||
|
||||
typedef struct bulkdata {
|
||||
struct device_id device_id;
|
||||
struct profile *profile;
|
||||
int log_level;
|
||||
int amd_version;
|
||||
unsigned int instance_mode;
|
||||
} bulkdata;
|
||||
|
||||
int bulkdata_config_init(struct bulkdata *bulkdata);
|
||||
int bulkdata_config_fini(struct bulkdata *bulkdata);
|
||||
|
||||
#ifndef FREE
|
||||
#define FREE(x) do { if(x) {free(x); x = NULL;} } while (0)
|
||||
#endif
|
||||
|
||||
#endif //__CONFIG_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1294
bulkdata/src/datamodel.c
Normal file
1294
bulkdata/src/datamodel.c
Normal file
File diff suppressed because it is too large
Load Diff
29
bulkdata/src/datamodel.h
Normal file
29
bulkdata/src/datamodel.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* 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 <amin.benramdhane@pivasoftware.com>
|
||||
*/
|
||||
|
||||
#ifndef _BULKDATA_H_
|
||||
#define _BULKDATA_H_
|
||||
|
||||
#include <libbbf_api/dmcommon.h>
|
||||
|
||||
extern DMOBJ tDeviceBulkDataObj[];
|
||||
extern DMOBJ tBulkDataObj[];
|
||||
extern DMLEAF tBulkDataParams[];
|
||||
extern DMOBJ tBulkDataProfileObj[];
|
||||
extern DMLEAF tBulkDataProfileParams[];
|
||||
extern DMLEAF tBulkDataProfileParameterParams[];
|
||||
extern DMLEAF tBulkDataProfileCSVEncodingParams[];
|
||||
extern DMLEAF tBulkDataProfileJSONEncodingParams[];
|
||||
extern DMOBJ tBulkDataProfileHTTPObj[];
|
||||
extern DMLEAF tBulkDataProfileHTTPParams[];
|
||||
extern DMLEAF tBulkDataProfileHTTPRequestURIParameterParams[];
|
||||
|
||||
#endif //__BULKDATA_H_
|
||||
|
||||
196
bulkdata/src/http.c
Normal file
196
bulkdata/src/http.c
Normal file
@@ -0,0 +1,196 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Copyright (C) 2020 iopsys Software Solutions AB
|
||||
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
|
||||
* Omar Kallel <omar.kallel@pivasoftware.com>
|
||||
*/
|
||||
|
||||
#include "http.h"
|
||||
|
||||
static struct http_client http_c;
|
||||
static CURL *curl;
|
||||
|
||||
int http_client_init(struct profile *profile)
|
||||
{
|
||||
char *url = create_request_url(profile);
|
||||
if(url) {
|
||||
asprintf(&http_c.url, "%s", url);
|
||||
free(url);
|
||||
}
|
||||
bulkdata_log(SINFO, "ACS url: %s", http_c.url);
|
||||
|
||||
curl_global_init(CURL_GLOBAL_SSL);
|
||||
curl = curl_easy_init();
|
||||
if (!curl) return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void http_client_exit(void)
|
||||
{
|
||||
FREE(http_c.url);
|
||||
|
||||
if (http_c.header_list) {
|
||||
curl_slist_free_all(http_c.header_list);
|
||||
http_c.header_list = NULL;
|
||||
}
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
}
|
||||
|
||||
static size_t http_get_response(void *buffer, size_t size, size_t rxed, char **msg_in)
|
||||
{
|
||||
char *c;
|
||||
|
||||
if (asprintf(&c, "%s%.*s", *msg_in, size * rxed, (char *)buffer) == -1) {
|
||||
FREE(*msg_in);
|
||||
return -1;
|
||||
}
|
||||
|
||||
free(*msg_in);
|
||||
*msg_in = c;
|
||||
|
||||
return size * rxed;
|
||||
}
|
||||
|
||||
int http_send_message(struct profile *profile, char *msg_out, int msg_out_len, char **msg_in)
|
||||
{
|
||||
CURLcode res;
|
||||
long http_code = 0;
|
||||
char errbuf[CURL_ERROR_SIZE];
|
||||
|
||||
http_c.header_list = NULL;
|
||||
http_c.header_list = curl_slist_append(http_c.header_list, "User-Agent: iopsys-bulkdata");
|
||||
if (!http_c.header_list) return -1;
|
||||
|
||||
if (profile->http_use_date_header) {
|
||||
if (bulkdata_get_time() != NULL) {
|
||||
http_c.header_list = curl_slist_append(http_c.header_list, bulkdata_get_time());
|
||||
if (!http_c.header_list) return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(profile->encoding_type, "json") == 0) {
|
||||
http_c.header_list = curl_slist_append(http_c.header_list, "Content-Type: application/json; charset=\"utf-8\"");
|
||||
if (!http_c.header_list) return -1;
|
||||
|
||||
if(strcmp (profile->json_encoding_report_format, "objecthierarchy") == 0) {
|
||||
http_c.header_list = curl_slist_append(http_c.header_list, "BBF-Report-Format: \"ObjectHierarchy\"");
|
||||
if (!http_c.header_list) return -1;
|
||||
} else if(strcmp(profile->json_encoding_report_format, "namevaluepair") == 0) {
|
||||
http_c.header_list = curl_slist_append(http_c.header_list, "BBF-Report-Format: \"NameValuePair\"");
|
||||
if (!http_c.header_list) return -1;
|
||||
}
|
||||
} else if(strcmp(profile->encoding_type, "csv") == 0) {
|
||||
http_c.header_list = curl_slist_append(http_c.header_list, "Content-Type: text/csv; charset=\"utf-8\"");
|
||||
if (!http_c.header_list) return -1;
|
||||
|
||||
if(strcmp (profile->csv_encoding_report_format, "row") == 0) {
|
||||
http_c.header_list = curl_slist_append(http_c.header_list, "BBF-Report-Format: \"ParameterPerRow\"");
|
||||
if (!http_c.header_list) return -1;
|
||||
} else if(strcmp (profile->csv_encoding_report_format, "column") == 0) {
|
||||
http_c.header_list = curl_slist_append(http_c.header_list, "BBF-Report-Format: \"ParameterPerColumn\"");
|
||||
if (!http_c.header_list) return -1;
|
||||
}
|
||||
}
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_URL, http_c.url);
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, profile->http_username);
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, profile->http_password);
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC|CURLAUTH_DIGEST);
|
||||
curl_easy_setopt(curl, CURLOPT_TIMEOUT, HTTP_TIMEOUT);
|
||||
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, HTTP_TIMEOUT);
|
||||
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
|
||||
curl_easy_setopt(curl, CURLOPT_POSTREDIR, CURL_REDIR_POST_ALL);
|
||||
curl_easy_setopt(curl, CURLOPT_NOBODY, 0);
|
||||
|
||||
if(strcasecmp(profile->http_compression, "gzip") == 0) {
|
||||
curl_easy_setopt(curl, CURLOPT_ACCEPT_ENCODING, "gzip");
|
||||
http_c.header_list = curl_slist_append(http_c.header_list, "Content-Encoding: gzip");
|
||||
} else if(strcasecmp(profile->http_compression, "compress") == 0) {
|
||||
curl_easy_setopt(curl, CURLOPT_ACCEPT_ENCODING, "compress");
|
||||
http_c.header_list = curl_slist_append(http_c.header_list, "Content-Encoding: compress");
|
||||
} else if(strcasecmp(profile->http_compression, "deflate") == 0) {
|
||||
curl_easy_setopt(curl, CURLOPT_ACCEPT_ENCODING, "deflate");
|
||||
http_c.header_list = curl_slist_append(http_c.header_list, "Content-Encoding: deflate");
|
||||
}
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, http_c.header_list);
|
||||
if(strcasecmp(profile->http_method, "put") == 0)
|
||||
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "PUT");
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, msg_out);
|
||||
if (msg_out)
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long) msg_out_len);
|
||||
else
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, 0);
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, http_get_response);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, msg_in);
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errbuf);
|
||||
|
||||
if (profile->http_ssl_capath)
|
||||
curl_easy_setopt(curl, CURLOPT_CAPATH, profile->http_ssl_capath);
|
||||
if (profile->http_insecure_enable) {
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
}
|
||||
*msg_in = (char *) calloc (1, sizeof(char));
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
if(res != CURLE_OK) {
|
||||
size_t len = strlen(errbuf);
|
||||
if(len) {
|
||||
if (errbuf[len - 1] == '\n') errbuf[len - 1] = '\0';
|
||||
bulkdata_log(SCRIT, "libcurl: (%d) %s", res, errbuf);
|
||||
} else {
|
||||
bulkdata_log(SCRIT, "libcurl: (%d) %s", res, curl_easy_strerror(res));
|
||||
}
|
||||
}
|
||||
|
||||
if (!strlen(*msg_in))
|
||||
FREE(*msg_in);
|
||||
|
||||
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_code);
|
||||
if(http_code == 200)
|
||||
bulkdata_log(SINFO, "Receive HTTP 200 OK from Bulkdata Collector");
|
||||
else if(http_code == 401)
|
||||
bulkdata_log(SINFO, "Receive HTTP 401 Unauthorized from Bulkdata Collector");
|
||||
else if(http_code == 204)
|
||||
bulkdata_log(SINFO, "Receive HTTP 204 No Content from Bulkdata Collector");
|
||||
else
|
||||
bulkdata_log(SINFO, "Receive HTTP %d from Bulkdata Collector", http_code);
|
||||
|
||||
if(http_code == 415)
|
||||
{
|
||||
strcpy(profile->http_compression, "None");
|
||||
goto error;
|
||||
}
|
||||
if (http_code != 200 && http_code != 204)
|
||||
goto error;
|
||||
|
||||
curl_easy_reset(curl);
|
||||
if (http_c.header_list) {
|
||||
curl_slist_free_all(http_c.header_list);
|
||||
http_c.header_list = NULL;
|
||||
}
|
||||
|
||||
if (res) goto error;
|
||||
|
||||
return http_code;
|
||||
|
||||
error:
|
||||
FREE(*msg_in);
|
||||
if (http_c.header_list) {
|
||||
curl_slist_free_all(http_c.header_list);
|
||||
http_c.header_list = NULL;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
37
bulkdata/src/http.h
Normal file
37
bulkdata/src/http.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Copyright (C) 2020 iopsys Software Solutions AB
|
||||
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __HTTP_H
|
||||
#define __HTTP_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <curl/curl.h>
|
||||
#include "config.h"
|
||||
#include "log.h"
|
||||
#include "times.h"
|
||||
#include "common.h"
|
||||
|
||||
#define HTTP_TIMEOUT 30
|
||||
|
||||
struct http_client
|
||||
{
|
||||
struct curl_slist *header_list;
|
||||
char *url;
|
||||
};
|
||||
|
||||
int http_client_init(struct profile *profile);
|
||||
void http_client_exit(void);
|
||||
int http_send_message(struct profile *profile, char *msg_out, int msg_out_len, char **msg_in);
|
||||
|
||||
#endif //__HTTP_H
|
||||
57
bulkdata/src/log.c
Normal file
57
bulkdata/src/log.c
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Copyright (C) 2020 iopsys Software Solutions AB
|
||||
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <syslog.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "bulkdata.h"
|
||||
#include "config.h"
|
||||
#include "log.h"
|
||||
|
||||
static const int log_syslogmap[] = {
|
||||
[SCRIT] = LOG_CRIT,
|
||||
[SWARNING] = LOG_WARNING,
|
||||
[SNOTICE] = LOG_NOTICE,
|
||||
[SINFO] = LOG_INFO,
|
||||
[SDEBUG] = LOG_DEBUG
|
||||
};
|
||||
|
||||
static const char* log_str[] = {
|
||||
[SCRIT] = "CRITICAL",
|
||||
[SWARNING] = "WARNING",
|
||||
[SNOTICE] = "NOTICE",
|
||||
[SINFO] = "INFO",
|
||||
[SDEBUG] = "DEBUG"
|
||||
};
|
||||
|
||||
void bulkdata_log(int priority, const char *format, ...)
|
||||
{
|
||||
va_list vl;
|
||||
|
||||
if (priority <= bulkdata_main.log_level) {
|
||||
time_t t = time(NULL);
|
||||
struct tm tm = *localtime(&t);
|
||||
va_start(vl, format);
|
||||
printf("%d-%02d-%02d %02d:%02d:%02d [bulkdata] %s - ", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, log_str[priority]);
|
||||
vprintf(format, vl);
|
||||
va_end(vl);
|
||||
printf("\n");
|
||||
|
||||
openlog("bulkdata", 0, LOG_DAEMON);
|
||||
va_start(vl, format);
|
||||
vsyslog(log_syslogmap[priority], format, vl);
|
||||
va_end(vl);
|
||||
closelog();
|
||||
}
|
||||
}
|
||||
28
bulkdata/src/log.h
Normal file
28
bulkdata/src/log.h
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Copyright (C) 2020 iopsys Software Solutions AB
|
||||
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __LOG_H
|
||||
#define __LOG_H
|
||||
|
||||
#define DEFAULT_LOGLEVEL SINFO
|
||||
|
||||
enum bulkdata_log_level_enum {
|
||||
SCRIT,
|
||||
SWARNING,
|
||||
SNOTICE,
|
||||
SINFO,
|
||||
SDEBUG,
|
||||
__MAX_SLOG
|
||||
};
|
||||
|
||||
void bulkdata_log(int priority, const char *format, ...);
|
||||
|
||||
#endif //__LOG_H
|
||||
336
bulkdata/src/report.c
Normal file
336
bulkdata/src/report.c
Normal file
@@ -0,0 +1,336 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Copyright (C) 2020 iopsys Software Solutions AB
|
||||
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
|
||||
* Author: Omar Kallel <omar.kallel@pivasoftware.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "report.h"
|
||||
|
||||
static void add_new_json_obj(json_object *json_obj, char *name, char *data, char *type)
|
||||
{
|
||||
json_object *jobj;
|
||||
if(strstr(type, "unsignedInt") || strstr(type, "int") || strstr(type, "long"))
|
||||
jobj = json_object_new_int64(atoi(data));
|
||||
else if(strstr(type, "bool"))
|
||||
jobj = json_object_new_boolean(atoi(data));
|
||||
else
|
||||
jobj = json_object_new_string(data);
|
||||
|
||||
json_object_object_add(json_obj, name, jobj);
|
||||
}
|
||||
|
||||
static void create_json_bulkdata_report_object_hierarchy(struct profile *profile, char **report)
|
||||
{
|
||||
struct json_object *json_obj, *json_obj1, *json_obj2;
|
||||
struct resultsnode *p;
|
||||
int i, j, profile_param_number = profile->profile_parameter_number;
|
||||
char *param_name, *result, *pch, *pchr, *collection_time = NULL;
|
||||
char buf[1024] = {0};
|
||||
|
||||
json_obj = json_object_new_object();
|
||||
get_time_stamp(profile->json_encoding_report_time_stamp, &collection_time);
|
||||
if(collection_time) {
|
||||
if(strcmp(profile->json_encoding_report_time_stamp, "iso8601") == 0)
|
||||
json_object_object_add(json_obj, "CollectionTime", json_object_new_string(collection_time));
|
||||
else
|
||||
json_object_object_add(json_obj, "CollectionTime", json_object_new_int64(atoi(collection_time)));
|
||||
free(collection_time);
|
||||
}
|
||||
json_obj2 = json_obj;
|
||||
for (i = 0; i < profile_param_number; i++) {
|
||||
LIST_HEAD(results_list);
|
||||
bulkdata_get_value_results(profile->profile_parameter[i].reference, &results_list);
|
||||
list_for_each_entry(p, &results_list, list) {
|
||||
char *argv[128] = {0};
|
||||
j = 0;
|
||||
param_name = get_bulkdata_profile_parameter_name(profile->profile_parameter[i].reference, profile->profile_parameter[i].name, p->name);
|
||||
strcpy(buf, param_name);
|
||||
for (pch = strtok_r(buf, ".", &pchr); pch != NULL; pch = strtok_r(NULL, ".", &pchr)) {
|
||||
argv[j] = pch;
|
||||
json_obj1 = (json_object *)dmjson_select_obj(json_obj, argv);
|
||||
if (json_obj1)
|
||||
json_obj2 = json_obj1;
|
||||
else {
|
||||
if (pchr != NULL && *pchr != '\0') {
|
||||
json_object *new_obj = json_object_new_object();
|
||||
json_object_object_add(json_obj2, pch, new_obj);
|
||||
json_obj2 = new_obj;
|
||||
}
|
||||
else
|
||||
add_new_json_obj(json_obj2, pch, p->data, p->type);
|
||||
}
|
||||
j++;
|
||||
}
|
||||
}
|
||||
bulkdata_free_data_from_list(&results_list);
|
||||
FREE(param_name);
|
||||
}
|
||||
result = (char *)json_object_to_json_string_ext(json_obj, JSON_C_TO_STRING_PRETTY);
|
||||
*report = strdup(result);
|
||||
json_object_put(json_obj);
|
||||
}
|
||||
|
||||
static void create_json_bulkdata_report_name_value_pair(struct profile *profile, char **report)
|
||||
{
|
||||
struct json_object *json_obj;
|
||||
struct resultsnode *p;
|
||||
char *param_name, *result, *collection_time = NULL;
|
||||
int i = 0, profile_param_number = profile->profile_parameter_number;
|
||||
|
||||
json_obj = json_object_new_object();
|
||||
get_time_stamp(profile->json_encoding_report_time_stamp, &collection_time);
|
||||
if(collection_time) {
|
||||
if(strcmp(profile->json_encoding_report_time_stamp, "iso8601") == 0)
|
||||
json_object_object_add(json_obj, "CollectionTime", json_object_new_string(collection_time));
|
||||
else
|
||||
json_object_object_add(json_obj, "CollectionTime", json_object_new_int64(atoi(collection_time)));
|
||||
free(collection_time);
|
||||
}
|
||||
for (i = 0; i < profile_param_number; i++) {
|
||||
LIST_HEAD(results_list);
|
||||
bulkdata_get_value_results(profile->profile_parameter[i].reference, &results_list);
|
||||
list_for_each_entry(p, &results_list, list) {
|
||||
param_name = get_bulkdata_profile_parameter_name(profile->profile_parameter[i].reference, profile->profile_parameter[i].name, p->name);
|
||||
add_new_json_obj(json_obj, param_name, p->data, p->type);
|
||||
FREE(param_name);
|
||||
}
|
||||
bulkdata_free_data_from_list(&results_list);
|
||||
}
|
||||
result = (char *)json_object_to_json_string_ext(json_obj, JSON_C_TO_STRING_PRETTY);
|
||||
*report = strdup(result);
|
||||
json_object_put(json_obj);
|
||||
}
|
||||
|
||||
static void add_failed_reports_to_report_json(struct profile *profile, char *new_report, char **report, int isnext)
|
||||
{
|
||||
json_object *json_obj, *json_array, *json_string;
|
||||
struct failed_reports *retreport = NULL;
|
||||
char *msgout = NULL;
|
||||
int j = 0;
|
||||
|
||||
json_obj = json_object_new_object();
|
||||
json_array = json_object_new_array();
|
||||
json_object_object_add(json_obj,"Report", json_array);
|
||||
|
||||
if(list_empty(profile->failed_reports))
|
||||
goto new_report;
|
||||
|
||||
list_for_each_entry(retreport, profile->failed_reports, list) {
|
||||
if(!j && isnext) {
|
||||
j = 1;
|
||||
continue;
|
||||
}
|
||||
json_string = json_tokener_parse(retreport->freport);
|
||||
json_object_array_add(json_array, json_string);
|
||||
}
|
||||
|
||||
new_report :
|
||||
if(new_report) {
|
||||
json_string = json_tokener_parse(new_report);
|
||||
json_object_array_add(json_array, json_string);
|
||||
}
|
||||
|
||||
msgout = (char *)json_object_to_json_string_ext(json_obj, JSON_C_TO_STRING_PRETTY);
|
||||
*report = strdup(msgout);
|
||||
json_object_put(json_obj);
|
||||
}
|
||||
|
||||
static void create_report_json(char *new_report, char **report)
|
||||
{
|
||||
json_object *json_obj, *json_array, *json_string;
|
||||
char *msgout = NULL;
|
||||
|
||||
json_obj = json_object_new_object();
|
||||
json_array = json_object_new_array();
|
||||
json_object_object_add(json_obj,"Report", json_array);
|
||||
|
||||
if(new_report) {
|
||||
json_string = json_tokener_parse(new_report);
|
||||
json_object_array_add(json_array, json_string);
|
||||
}
|
||||
|
||||
msgout = (char *)json_object_to_json_string_ext(json_obj, JSON_C_TO_STRING_PRETTY);
|
||||
*report = strdup(msgout);
|
||||
json_object_put(json_obj);
|
||||
}
|
||||
|
||||
int create_json_bulkdata_report(struct profile *profile, char **report)
|
||||
{
|
||||
/*
|
||||
* create json msg of current report
|
||||
* parse failed reports list and add it to the report
|
||||
* then add new report to the report
|
||||
*/
|
||||
char *msgout;
|
||||
|
||||
profile->new_report = NULL;
|
||||
if(strcmp(profile->json_encoding_report_format, "objecthierarchy") == 0) {
|
||||
create_json_bulkdata_report_object_hierarchy(profile, &msgout);
|
||||
} else if(strcmp(profile->json_encoding_report_format, "namevaluepair") == 0) {
|
||||
create_json_bulkdata_report_name_value_pair(profile, &msgout);
|
||||
}
|
||||
|
||||
if(profile->nbre_of_retained_failed_reports != 0) {
|
||||
if(profile->nbre_failed_reports >= profile->nbre_of_retained_failed_reports && profile->nbre_of_retained_failed_reports > 0)
|
||||
add_failed_reports_to_report_json(profile, msgout, report, 1);
|
||||
else
|
||||
add_failed_reports_to_report_json(profile, msgout, report, 0);
|
||||
} else {
|
||||
create_report_json(msgout, report);
|
||||
}
|
||||
|
||||
append_string_to_string(msgout, &profile->new_report);
|
||||
FREE(msgout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int create_csv_bulkdata_report(struct profile *profile, char **report)
|
||||
{
|
||||
/*
|
||||
* create csv msg of current report
|
||||
* parse failed reports list and add it to the report
|
||||
*/
|
||||
int i;
|
||||
struct resultsnode *p;
|
||||
char *str1 = NULL, *str2 = NULL, *str = NULL, *paramprofilename, *timestamp = NULL, *type = NULL, rowseparator = '\0', separator = '\0';
|
||||
|
||||
if(strcmp(profile->csv_encoding_row_separator, " ") == 0)
|
||||
rowseparator = '\n';
|
||||
else if(strcmp(profile->csv_encoding_row_separator, " ") == 0)
|
||||
rowseparator = '\r';
|
||||
|
||||
if(profile->csv_encoding_field_separator)
|
||||
separator = profile->csv_encoding_field_separator[0];
|
||||
|
||||
get_time_stamp(profile->csv_encoding_row_time_stamp, ×tamp);
|
||||
/*
|
||||
* Create header ReportTimestamp,ParameterName,ParameterValue,ParameterType in case of ParameterPerRow
|
||||
*/
|
||||
if(strcmp(profile->csv_encoding_report_format, "row") == 0) {
|
||||
if(timestamp == NULL)
|
||||
asprintf(&str, "ParameterName%cParameterValue%cParameterType%c", separator, separator, rowseparator);
|
||||
else
|
||||
asprintf(&str, "ReportTimestamp%cParameterName%cParameterValue%cParameterType%c", separator, separator, separator, rowseparator);
|
||||
append_string_to_string(str, report);
|
||||
FREE(str);
|
||||
if(profile->nbre_of_retained_failed_reports != 0) {
|
||||
if(profile->nbre_failed_reports >= profile->nbre_of_retained_failed_reports && profile->nbre_of_retained_failed_reports > 0)
|
||||
add_failed_reports_to_report_csv(profile, report, 1);
|
||||
else
|
||||
add_failed_reports_to_report_csv(profile, report, 0);
|
||||
}
|
||||
}
|
||||
if(strcmp(profile->csv_encoding_report_format, "column") == 0 && timestamp != NULL) {
|
||||
if(profile->nbre_of_retained_failed_reports != 0) {
|
||||
if(profile->nbre_failed_reports >= profile->nbre_of_retained_failed_reports && profile->nbre_of_retained_failed_reports > 0)
|
||||
add_failed_reports_to_report_csv(profile, report, 1);
|
||||
else
|
||||
add_failed_reports_to_report_csv(profile, report, 0);
|
||||
}
|
||||
append_string_to_string("ReportTimestamp", &str1);
|
||||
append_string_to_string(timestamp, &str2);
|
||||
}
|
||||
|
||||
/*
|
||||
* Add New reports
|
||||
*/
|
||||
profile->new_report = NULL;
|
||||
for(i = 0; i < profile->profile_parameter_number; i++) {
|
||||
LIST_HEAD(results_list);
|
||||
bulkdata_get_value_results(profile->profile_parameter[i].reference, &results_list);
|
||||
list_for_each_entry(p, &results_list, list) {
|
||||
paramprofilename = get_bulkdata_profile_parameter_name(profile->profile_parameter[i].reference, profile->profile_parameter[i].name, p->name);
|
||||
if(strcmp(profile->csv_encoding_report_format, "row") == 0) {
|
||||
type = strstr(p->type, ":");
|
||||
if(timestamp == NULL)
|
||||
asprintf(&str, "%s%c%s%c%s%c", paramprofilename, separator, p->data, separator, type+1, rowseparator);
|
||||
else
|
||||
asprintf(&str, "%s%c%s%c%s%c%s%c", timestamp, separator, paramprofilename, separator, p->data, separator, type+1, rowseparator);
|
||||
append_string_to_string(str, report);
|
||||
append_string_to_string(str, &profile->new_report);
|
||||
FREE(str);
|
||||
} else if(strcmp(profile->csv_encoding_report_format, "column") == 0) {
|
||||
if(str1 == NULL || strlen(str1) <= 0)
|
||||
asprintf(&str, "%s", paramprofilename);
|
||||
else
|
||||
asprintf(&str, "%c%s", separator, paramprofilename);
|
||||
append_string_to_string(str, &str1);
|
||||
FREE(str);
|
||||
if(str2 == NULL || strlen(str2) <= 0)
|
||||
asprintf(&str, "%s", p->data);
|
||||
else
|
||||
asprintf(&str, "%c%s", separator, p->data);
|
||||
append_string_to_string(str, &str2);
|
||||
FREE(str);
|
||||
}
|
||||
FREE(paramprofilename);
|
||||
}
|
||||
bulkdata_free_data_from_list(&results_list);
|
||||
}
|
||||
if(strcmp(profile->csv_encoding_report_format, "column") == 0) {
|
||||
asprintf(&str, "%c", rowseparator);
|
||||
append_string_to_string(str, &str1);
|
||||
append_string_to_string(str, &str2);
|
||||
append_string_to_string(str1, report);
|
||||
append_string_to_string(str2, report);
|
||||
append_string_to_string(str1, &profile->new_report);
|
||||
append_string_to_string(str2, &profile->new_report);
|
||||
}
|
||||
FREE(str);
|
||||
FREE(str1);
|
||||
FREE(str2);
|
||||
FREE(timestamp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void create_json_failed_report(struct profile *profile, char **report)
|
||||
{
|
||||
add_failed_reports_to_report_json(profile, NULL, report, 0);
|
||||
}
|
||||
|
||||
static void create_csv_failed_report(struct profile *profile, char **report)
|
||||
{
|
||||
char rowseparator = '\0', separator = '\0', *timestamp = NULL;
|
||||
|
||||
if(strcmp(profile->csv_encoding_row_separator, " ") == 0) {
|
||||
rowseparator = '\n';
|
||||
} else if(strcmp(profile->csv_encoding_row_separator, " ") == 0) {
|
||||
rowseparator = '\r';
|
||||
}
|
||||
|
||||
if(profile->csv_encoding_field_separator)
|
||||
separator = profile->csv_encoding_field_separator[0];
|
||||
|
||||
get_time_stamp(profile->csv_encoding_row_time_stamp, ×tamp);
|
||||
if(strcmp(profile->csv_encoding_report_format, "row") == 0) {
|
||||
if(timestamp == NULL)
|
||||
asprintf(report, "ParameterName%cParameterValue%cParameterType%c", separator, separator, rowseparator);
|
||||
else
|
||||
asprintf(report, "ReportTimestamp%cParameterName%cParameterValue%cParameterType%c", separator, separator, separator, rowseparator);
|
||||
}
|
||||
add_failed_reports_to_report_csv(profile, report, 0);
|
||||
}
|
||||
|
||||
void create_encoding_bulkdata_report(struct profile *profile, char **report)
|
||||
{
|
||||
if(strcasecmp(profile->encoding_type, "json") == 0) {
|
||||
create_json_bulkdata_report(profile, report);
|
||||
} else if(strcasecmp(profile->encoding_type, "csv") == 0) {
|
||||
create_csv_bulkdata_report(profile, report);
|
||||
}
|
||||
}
|
||||
|
||||
void create_failed_report(struct profile *profile, char **report)
|
||||
{
|
||||
if(strcasecmp(profile->encoding_type, "json") == 0) {
|
||||
create_json_failed_report(profile, report);
|
||||
} else if(strcasecmp(profile->encoding_type, "csv") == 0) {
|
||||
create_csv_failed_report(profile, report);
|
||||
}
|
||||
}
|
||||
24
bulkdata/src/report.h
Normal file
24
bulkdata/src/report.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Copyright (C) 2020 iopsys Software Solutions AB
|
||||
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
|
||||
* Author: Omar Kallel <omar.kallel@pivasoftware.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __REPORT_H_
|
||||
#define __REPORT_H_
|
||||
|
||||
#include <json-c/json.h>
|
||||
#include "common.h"
|
||||
#include "times.h"
|
||||
#include "config.h"
|
||||
|
||||
void create_encoding_bulkdata_report(struct profile *profile, char **report);
|
||||
void create_failed_report(struct profile *profile, char **report);
|
||||
|
||||
#endif /* __REPORT_H_ */
|
||||
62
bulkdata/src/times.c
Normal file
62
bulkdata/src/times.c
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Copyright (C) 2020 iopsys Software Solutions AB
|
||||
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "times.h"
|
||||
|
||||
const char *bulkdata_get_time(void)
|
||||
{
|
||||
static char local_time[64];
|
||||
|
||||
time_t t_time = time(NULL);
|
||||
struct tm *t_tm = localtime(&t_time);
|
||||
if (t_tm == NULL)
|
||||
return NULL;
|
||||
|
||||
if (strftime(local_time, sizeof(local_time),"Date: %a, %d %b %Y %X%z GMT", t_tm) == 0)
|
||||
return NULL;
|
||||
|
||||
return local_time;
|
||||
}
|
||||
|
||||
void get_time_stamp(const char *format, char **timestamp)
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
|
||||
if (strcmp(format, "unix") == 0) {
|
||||
asprintf(timestamp, "%ld", now);
|
||||
} else if (strcmp(format, "iso8601") == 0) {
|
||||
char buf[32] = {0};
|
||||
struct tm *ts = localtime(&now);
|
||||
strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%S%Z", ts);
|
||||
asprintf(timestamp, "%s", buf);
|
||||
} else
|
||||
timestamp = NULL;
|
||||
}
|
||||
|
||||
unsigned int get_next_period(time_t time_reference, int reporting_interval)
|
||||
{
|
||||
unsigned int next_period;
|
||||
time_t now = time(NULL);
|
||||
|
||||
if (now > time_reference)
|
||||
next_period = reporting_interval - ((now - time_reference) % reporting_interval);
|
||||
else
|
||||
next_period = (time_reference - now) % reporting_interval;
|
||||
|
||||
if (next_period == 0)
|
||||
next_period = reporting_interval;
|
||||
|
||||
return next_period;
|
||||
}
|
||||
19
bulkdata/src/times.h
Normal file
19
bulkdata/src/times.h
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Copyright (C) 2020 iopsys Software Solutions AB
|
||||
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __TIMES_H
|
||||
#define __TIMES_H
|
||||
|
||||
const char *bulkdata_get_time(void);
|
||||
void get_time_stamp(const char *format, char **timestamp);
|
||||
unsigned int get_next_period(time_t time_reference, int reporting_interval);
|
||||
|
||||
#endif /* __TIMES_H */
|
||||
@@ -1,38 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2019 IOPSYS
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bulut
|
||||
PKG_VERSION:=0.2
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bulut/bulut-gw-client.git
|
||||
PKG_SOURCE_VERSION:=227700c44817afa2c392fa08bf4cf70fa6177f01
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/bulut
|
||||
CATEGORY:=Utilities
|
||||
DEPENDS:=
|
||||
TITLE:=bulut
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-I$(STAGING_DIR)/usr/include
|
||||
|
||||
define Package/bulut/description
|
||||
obuspa keys
|
||||
endef
|
||||
|
||||
define Package/bulut/install
|
||||
$(CP) $(PKG_BUILD_DIR)/files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,bulut))
|
||||
@@ -1,57 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2021-2023 IOPSYS
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=capiagent
|
||||
PKG_VERSION:=2.1.1
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=136cab3a9f1eec0132db9fa3f7bb1c8748ce1449
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/capiagent.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||
PKG_LICENSE:=PROPRIETARY IOPSYS
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
||||
#define Package/capiagent/config
|
||||
# source "$(SOURCE)/Config.in"
|
||||
#endef
|
||||
|
||||
define Package/capiagent
|
||||
TITLE+= capiagent (daemon implementing Wi-Fi Alliance's CAPI commands)
|
||||
DEPENDS= +libubox +libuci +libubus +libnl-genl +libeasy +libwifi \
|
||||
+libjson-c +libblobmsg-json +ubus +libieee1905 +libwifiutils
|
||||
endef
|
||||
|
||||
define Package/capiagent/description
|
||||
This package provides agent for the WiFi Alliance's CAPI specification.
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-I$(STAGING_DIR)/usr/include \
|
||||
-I$(STAGING_DIR)/usr/include/libnl3 \
|
||||
-D_GNU_SOURCE
|
||||
|
||||
MAKE_PATH:=src
|
||||
|
||||
|
||||
define Package/capiagent/install
|
||||
$(CP) ./files/* $(1)/
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/lib/wifi/capi
|
||||
$(CP) $(PKG_BUILD_DIR)/src/capiagent $(1)/usr/sbin
|
||||
$(CP) $(PKG_BUILD_DIR)/src/scripts/* $(1)/lib/wifi/capi
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,capiagent))
|
||||
@@ -1,35 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=98
|
||||
STOP=20
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
start_service() {
|
||||
if [ -e "/etc/config/mapagent" -o -e "/etc/config/mapcontroller" ]; then
|
||||
config_load mapagent
|
||||
config_get_bool agent_enabled agent enabled 1
|
||||
config_load mapcontroller
|
||||
config_get_bool controller_enabled controller enabled 1
|
||||
|
||||
if [ $agent_enabled -eq 1 -o $controller_enabled -eq 1 ]; then
|
||||
procd_open_instance
|
||||
procd_set_param command "/usr/sbin/capiagent" "-p 9000"
|
||||
procd_set_param limits core="unlimited"
|
||||
#procd_set_param respawn
|
||||
#procd_set_param stdout 1
|
||||
#procd_set_param stderr 1
|
||||
procd_close_instance
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger "capiagent"
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
@@ -1,4 +1,7 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
#
|
||||
# Copyright (C) 2015 inteno.org
|
||||
#
|
||||
|
||||
START=71
|
||||
USE_PROCD=1
|
||||
|
||||
53
cifsd-tools/Makefile
Normal file
53
cifsd-tools/Makefile
Normal file
@@ -0,0 +1,53 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=cifsd-tools
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/namjaejeon/cifsd-tools.git
|
||||
PKG_SOURCE_DATE:=2019-02-14
|
||||
PKG_SOURCE_VERSION:=a7d7dfc40524b88dbcb2052034a75f446b3cefdd
|
||||
PKG_MIRROR_HASH:=a74f95a79c3cdcc78e66c080729141abee0d821e21a326d88b11d849738314fb
|
||||
|
||||
PKG_MAINTAINER:=Andy Walsh <andy.walsh44+github@gmail.com>
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
|
||||
PKG_INSTALL:=1
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_REMOVE_FILES:=autogen.sh aclocal.m4
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/nls.mk
|
||||
|
||||
define Package/cifsd-tools
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Filesystem
|
||||
TITLE:=Kernel CIFS/SMB server support and userspace tools
|
||||
DEPENDS:=+kmod-fs-cifsd +glib2 +libnl-core +libnl-genl $(ICONV_DEPENDS)
|
||||
endef
|
||||
|
||||
define Package/cifsd-tools/description
|
||||
Userspace tools (cifsd, cifsadmin) for the CIFS/SMB kernel fileserver.
|
||||
The config file location is /etc/cifs/smb.conf
|
||||
endef
|
||||
|
||||
define Package/cifsd-tools/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libcifsdtools.so* $(1)/usr/lib/
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/cifs
|
||||
$(INSTALL_CONF) $(PKG_BUILD_DIR)/smb.conf.example $(1)/etc/cifs
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) ./files/cifsd.config $(1)/etc/config/cifsd
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/cifsd.init $(1)/etc/init.d/cifsd
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{cifsadmin,cifsd} $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,cifsd-tools))
|
||||
9
cifsd-tools/files/cifsd.config
Normal file
9
cifsd-tools/files/cifsd.config
Normal file
@@ -0,0 +1,9 @@
|
||||
config global 'global'
|
||||
option server_string 'CIFSD on OpenWRT'
|
||||
option ipc_timeout '8' # IPC timeout is used as a workaround for uninterruptible sleep until this is fixed upstream.
|
||||
|
||||
config share
|
||||
option name 'share'
|
||||
option comment 'Default guest share'
|
||||
option path '/mnt'
|
||||
option guest_ok 'yes'
|
||||
161
cifsd-tools/files/cifsd.init
Normal file
161
cifsd-tools/files/cifsd.init
Normal file
@@ -0,0 +1,161 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=90
|
||||
USE_PROCD=1
|
||||
PROG=/usr/sbin/cifsd
|
||||
USER_DB=/etc/cifs/cifsdpwd.db
|
||||
CIFS_ADMIN=cifsadmin
|
||||
|
||||
EXTRA_COMMANDS="users"
|
||||
EXTRA_HELP=" users Show list of users created by cifsadmin"
|
||||
|
||||
users() {
|
||||
[ -f "$USER_DB" ] && cut -d ':' $USER_DB -f1 || \
|
||||
printf "No users available.\n"
|
||||
}
|
||||
|
||||
validate_cifsd_global() {
|
||||
uci_validate_section cifsd global global \
|
||||
'server_string:string' \
|
||||
'workgroup:string' \
|
||||
'netbios_name:string' \
|
||||
'interface:string' \
|
||||
'ipc_timeout:uinteger'
|
||||
}
|
||||
|
||||
validate_cifsd_share() {
|
||||
uci_validate_section cifsd share "${1}" \
|
||||
'name:string' \
|
||||
'comment:string' \
|
||||
'path:string' \
|
||||
'guest_ok:bool' \
|
||||
'read_only:bool' \
|
||||
'allow_hosts:list' \
|
||||
'deny_hosts:list' \
|
||||
'users:string' \
|
||||
'invalid_users:string' \
|
||||
'create_mask:string' \
|
||||
'dir_mask:string' \
|
||||
'max_connections:uinteger' \
|
||||
'veto_files:list'
|
||||
}
|
||||
|
||||
validate_cifsd_users() {
|
||||
uci_validate_section cifsd users "${1}" \
|
||||
'user:string' \
|
||||
'password:string' \
|
||||
'desc:string'
|
||||
}
|
||||
|
||||
load_cifsd_global() {
|
||||
local server_string
|
||||
local workgroup
|
||||
local netbios_name
|
||||
local ipc_timeout
|
||||
|
||||
validate_cifsd_global
|
||||
|
||||
echo -e "[global]" >> /var/etc/cifsd.conf
|
||||
[ -n "$server_string" ] && echo -e "\tserver string = $server_string" >> /var/etc/cifsd.conf
|
||||
[ -n "$workgroup" ] && echo -e "\tworkgroup = $workgroup" >> /var/etc/cifsd.conf
|
||||
[ -n "$netbios_name" ] && echo -e "\tnetbios name = $netbios_name" >> /var/etc/cifsd.conf
|
||||
[ -n "$ipc_timeout" ] && echo -e "\tipc timeout name = $ipc_timeout" >> /var/etc/cifsd.conf || \
|
||||
echo -e "\tipc timeout name = 8" >> /var/etc/cifsd.conf
|
||||
}
|
||||
|
||||
load_cifsd_share() {
|
||||
local name
|
||||
local comment
|
||||
local path
|
||||
local guest_ok
|
||||
local allow_hosts
|
||||
local deny_hosts
|
||||
local users
|
||||
local invalid_users
|
||||
local max_connections
|
||||
local veto_files
|
||||
local dir_mask
|
||||
local create_mask
|
||||
local read_only
|
||||
|
||||
validate_cifsd_share ${1}
|
||||
|
||||
if [ -z "$name" -o -z "$path" ]; then
|
||||
logread -t ${0} "Missing name or path."
|
||||
return
|
||||
fi
|
||||
|
||||
echo -e "\n[$name]\n\tpath = $path" >> /var/etc/cifsd.conf
|
||||
[ -n "$comment" ] && echo -e "\tcomment = $comment" >> /var/etc/cifsd.conf
|
||||
[ -n "$guest_ok" ] && echo -e "\tguest ok = $guest_ok" >> /var/etc/cifsd.conf
|
||||
[ -n "$allow_hosts" ] && echo -e "\tallow hosts = $allow_hosts" >> /var/etc/cifsd.conf
|
||||
[ -n "$deny_hosts" ] && echo -e "\tdeny hosts = $deny_hosts" >> /var/etc/cifsd.conf
|
||||
[ -n "$users" ] && echo -e "\tvalid users = $users" >> /var/etc/cifsd.conf
|
||||
[ -n "$invalid_users" ] && echo -e "\tinvalid users = $invalid_users" >> /var/etc/cifsd.conf
|
||||
[ -n "$max_connections" ] && echo -e "\tmax connections = $max_connections" >> /var/etc/cifsd.conf
|
||||
[ -n "$create_mask" ] && echo -e "\tcreate mask = $create_mask" >> /var/etc/cifsd.conf
|
||||
[ -n "$dir_mask" ] && echo -e "\tdirectory mask = $dir_mask" >> /var/etc/cifsd.conf
|
||||
|
||||
if [ -n "$read_only" ]; then
|
||||
echo -e "\tread only = $read_only" >> /var/etc/cifsd.conf
|
||||
if [ "${read_only}" -eq "0" ]; then
|
||||
echo -e "\twrite ok = 1" >> /var/etc/cifsd.conf
|
||||
fi
|
||||
else
|
||||
echo -e "\twrite ok = 1" >> /var/etc/cifsd.conf
|
||||
fi
|
||||
|
||||
[ -n "$veto_files" ] && echo -e "\tveto files = $veto_files" >> /var/etc/cifsd.conf
|
||||
}
|
||||
|
||||
load_cifsd_users() {
|
||||
local user
|
||||
local password
|
||||
local desc
|
||||
|
||||
validate_cifsd_users ${1}
|
||||
[ $(which ${CIFS_ADMIN}) ] || {
|
||||
logread -t ${0} "${CIFS_ADMIN} tools is not available"
|
||||
return;
|
||||
}
|
||||
|
||||
cifsadmin -a "${user}" -p "${password}"
|
||||
if [ "$?" -ne 0 ]; then
|
||||
logread -t ${0} "Failed to create/update ${user}"
|
||||
fi
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_config_trigger "config.change" "cifsd" /etc/init.d/cifsd restart
|
||||
}
|
||||
|
||||
init_config() {
|
||||
[ -f "/var/etc/cifsd.conf" ] && rm /var/etc/cifsd.conf
|
||||
|
||||
config_load cifsd
|
||||
load_cifsd_global
|
||||
|
||||
# Delete existing users
|
||||
[ -f "${USER_DB}" ] && {
|
||||
rm -f "${USER_DB}"
|
||||
}
|
||||
config_foreach load_cifsd_users users
|
||||
config_foreach load_cifsd_share share
|
||||
}
|
||||
|
||||
start_service() {
|
||||
. /lib/functions.sh
|
||||
init_config
|
||||
|
||||
[ ! "$(grep cifsd /proc/modules)" ] && modprobe cifsd
|
||||
procd_open_instance
|
||||
procd_set_param command /usr/bin/env LANG=en_US.UTF-8 $PROG -c /var/etc/cifsd.conf
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
killall cifsd
|
||||
# IPC timeout will kill the remaining processes.
|
||||
}
|
||||
73
cifsd/001-fix_implicit_declarations.patch
Normal file
73
cifsd/001-fix_implicit_declarations.patch
Normal file
@@ -0,0 +1,73 @@
|
||||
For some reason, fs.h on Inteno kernel is missing inode->i_mutex nesting subclasses for the lock validator
|
||||
which is triggering implicit declaration error. To workaround this hardcore use of mutex_lock by removing
|
||||
kernel version check.
|
||||
---
|
||||
--- a/vfs.c
|
||||
+++ b/vfs.c
|
||||
@@ -544,15 +544,9 @@ int cifsd_vfs_setattr(struct cifsd_work
|
||||
|
||||
attrs->ia_valid |= ATTR_CTIME;
|
||||
|
||||
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
|
||||
- inode_lock(inode);
|
||||
- err = notify_change(dentry, attrs, NULL);
|
||||
- inode_unlock(inode);
|
||||
-#else
|
||||
mutex_lock(&inode->i_mutex);
|
||||
err = notify_change(dentry, attrs, NULL);
|
||||
mutex_unlock(&inode->i_mutex);
|
||||
-#endif
|
||||
|
||||
if (update_size)
|
||||
put_write_access(inode);
|
||||
@@ -753,11 +747,8 @@ int cifsd_vfs_remove_file(char *name)
|
||||
if (!dir->d_inode)
|
||||
goto out;
|
||||
|
||||
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
|
||||
- inode_lock_nested(dir->d_inode, I_MUTEX_PARENT);
|
||||
-#else
|
||||
mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT);
|
||||
-#endif
|
||||
+
|
||||
dentry = lookup_one_len(last, dir, strlen(last));
|
||||
if (IS_ERR(dentry)) {
|
||||
err = PTR_ERR(dentry);
|
||||
@@ -783,11 +774,7 @@ int cifsd_vfs_remove_file(char *name)
|
||||
|
||||
dput(dentry);
|
||||
out_err:
|
||||
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
|
||||
- inode_unlock(dir->d_inode);
|
||||
-#else
|
||||
mutex_unlock(&dir->d_inode->i_mutex);
|
||||
-#endif
|
||||
out:
|
||||
path_put(&parent);
|
||||
return err;
|
||||
@@ -1302,11 +1289,8 @@ int cifsd_vfs_unlink(struct dentry *dir,
|
||||
int err = 0;
|
||||
|
||||
dget(dentry);
|
||||
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
|
||||
- inode_lock(dir->d_inode);
|
||||
-#else
|
||||
mutex_lock(&dir->d_inode->i_mutex);
|
||||
-#endif
|
||||
+
|
||||
if (!dentry->d_inode || !dentry->d_inode->i_nlink) {
|
||||
err = -ENOENT;
|
||||
goto out;
|
||||
@@ -1318,11 +1302,8 @@ int cifsd_vfs_unlink(struct dentry *dir,
|
||||
err = vfs_unlink(dir->d_inode, dentry, NULL);
|
||||
|
||||
out:
|
||||
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
|
||||
- inode_unlock(dir->d_inode);
|
||||
-#else
|
||||
mutex_unlock(&dir->d_inode->i_mutex);
|
||||
-#endif
|
||||
+
|
||||
dput(dentry);
|
||||
if (err)
|
||||
cifsd_debug("failed to delete, err %d\n", err);
|
||||
60
cifsd/Makefile
Normal file
60
cifsd/Makefile
Normal file
@@ -0,0 +1,60 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=cifsd
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/namjaejeon/cifsd.git
|
||||
PKG_SOURCE_DATE:=2019-03-05
|
||||
PKG_SOURCE_VERSION:=e1715ce125d55b125b1b58a6f1819ef8e54cc3ba
|
||||
PKG_MIRROR_HASH:=521585ebfda0ecc02372b1a38ebf762fbbcead6d0b754a47599a5bf6bfdb3fb6
|
||||
|
||||
PKG_MAINTAINER:=Andy Walsh <andy.walsh44+github@gmail.com>
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define KernelPackage/fs-cifsd
|
||||
SUBMENU:=Filesystems
|
||||
TITLE:=CIFS/SMB kernel server support
|
||||
FILES:=$(PKG_BUILD_DIR)/cifsd.$(LINUX_KMOD_SUFFIX)
|
||||
DEPENDS+= \
|
||||
+kmod-nls-base \
|
||||
+kmod-nls-utf8 \
|
||||
+kmod-crypto-md4 \
|
||||
+kmod-crypto-md5 \
|
||||
+kmod-crypto-hmac \
|
||||
+kmod-crypto-ecb \
|
||||
+kmod-crypto-des \
|
||||
+kmod-crypto-sha256 \
|
||||
+kmod-crypto-cmac \
|
||||
+kmod-crypto-sha512 \
|
||||
+kmod-crypto-aead \
|
||||
+kmod-crypto-ccm
|
||||
KCONFIG:= \
|
||||
CONFIG_KEYS=y \
|
||||
CONFIG_CRYPTO_ARC4=y
|
||||
endef
|
||||
|
||||
define KernelPackage/fs-cifsd/description
|
||||
Kernel module for a CIFS/SMBv2,3 fileserver.
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS+= -DCONFIG_CIFSD_ACL
|
||||
|
||||
MAKE_OPTS:=\
|
||||
ARCH="$(LINUX_KARCH)" \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
M="$(PKG_BUILD_DIR)"
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C "$(LINUX_DIR)" \
|
||||
$(MAKE_OPTS) \
|
||||
CFLAGS="$(TARGET_CFLAGS)" \
|
||||
CONFIG_CIFS_SERVER=m \
|
||||
modules
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,fs-cifsd))
|
||||
69
cifsd/patches/001-fix_implicit_declarations.patch
Normal file
69
cifsd/patches/001-fix_implicit_declarations.patch
Normal file
@@ -0,0 +1,69 @@
|
||||
--- a/vfs.c
|
||||
+++ b/vfs.c
|
||||
@@ -544,15 +544,9 @@ int cifsd_vfs_setattr(struct cifsd_work
|
||||
|
||||
attrs->ia_valid |= ATTR_CTIME;
|
||||
|
||||
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
|
||||
- inode_lock(inode);
|
||||
- err = notify_change(dentry, attrs, NULL);
|
||||
- inode_unlock(inode);
|
||||
-#else
|
||||
mutex_lock(&inode->i_mutex);
|
||||
err = notify_change(dentry, attrs, NULL);
|
||||
mutex_unlock(&inode->i_mutex);
|
||||
-#endif
|
||||
|
||||
if (update_size)
|
||||
put_write_access(inode);
|
||||
@@ -753,11 +747,8 @@ int cifsd_vfs_remove_file(char *name)
|
||||
if (!dir->d_inode)
|
||||
goto out;
|
||||
|
||||
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
|
||||
- inode_lock_nested(dir->d_inode, I_MUTEX_PARENT);
|
||||
-#else
|
||||
mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT);
|
||||
-#endif
|
||||
+
|
||||
dentry = lookup_one_len(last, dir, strlen(last));
|
||||
if (IS_ERR(dentry)) {
|
||||
err = PTR_ERR(dentry);
|
||||
@@ -783,11 +774,7 @@ int cifsd_vfs_remove_file(char *name)
|
||||
|
||||
dput(dentry);
|
||||
out_err:
|
||||
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
|
||||
- inode_unlock(dir->d_inode);
|
||||
-#else
|
||||
mutex_unlock(&dir->d_inode->i_mutex);
|
||||
-#endif
|
||||
out:
|
||||
path_put(&parent);
|
||||
return err;
|
||||
@@ -1302,11 +1289,8 @@ int cifsd_vfs_unlink(struct dentry *dir,
|
||||
int err = 0;
|
||||
|
||||
dget(dentry);
|
||||
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
|
||||
- inode_lock(dir->d_inode);
|
||||
-#else
|
||||
mutex_lock(&dir->d_inode->i_mutex);
|
||||
-#endif
|
||||
+
|
||||
if (!dentry->d_inode || !dentry->d_inode->i_nlink) {
|
||||
err = -ENOENT;
|
||||
goto out;
|
||||
@@ -1318,11 +1302,8 @@ int cifsd_vfs_unlink(struct dentry *dir,
|
||||
err = vfs_unlink(dir->d_inode, dentry, NULL);
|
||||
|
||||
out:
|
||||
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
|
||||
- inode_unlock(dir->d_inode);
|
||||
-#else
|
||||
mutex_unlock(&dir->d_inode->i_mutex);
|
||||
-#endif
|
||||
+
|
||||
dput(dentry);
|
||||
if (err)
|
||||
cifsd_debug("failed to delete, err %d\n", err);
|
||||
@@ -1,52 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=cmph
|
||||
PKG_VERSION:=2.0.2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=cmph-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=@SF/cmph/
|
||||
PKG_MD5SUM:=51ec5329b47774d251a96eaaafdb409e
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
|
||||
PKG_FIXUP:=autoreconf
|
||||
|
||||
PKG_LICENSE:=LGPLv2
|
||||
PKG_LICENSE_FILES:=LGPL-2
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=C Minimal Perfect Hashing library
|
||||
URL:=https://sourceforge.net/projects/cmph/
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
C Minimal Perfect Hashing (CMPH) library allows the creation of minimal perfect hash functions for large data sets.
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
$(call Build/Configure/Default)
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/src/cmph.h $(1)/usr/include/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/src/cmph_time.h $(1)/usr/include/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/src/cmph_types.h $(1)/usr/include/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/src/.libs/libcmph.a $(1)/usr/lib/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/.libs/libcmph.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/src/.libs/libcmph.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
|
||||
40
crashlog/Makefile
Normal file
40
crashlog/Makefile
Normal file
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# Copyright (C) 2019 iopsys Software Solutions AB
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=crashlog
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_RELEASE:=1
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=none
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/crashlog
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Handling kernel crash logs
|
||||
endef
|
||||
|
||||
define Package/crashlog/description
|
||||
Handling kernel crash logs.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(CP) ./files/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/crashlog/install
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,crashlog))
|
||||
BIN
crashlog/files/etc/dropbear/logid
Normal file
BIN
crashlog/files/etc/dropbear/logid
Normal file
Binary file not shown.
11
crashlog/files/etc/init.d/corelog
Executable file
11
crashlog/files/etc/init.d/corelog
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=01
|
||||
|
||||
start()
|
||||
{
|
||||
if [ -e /proc/sys/kernel/core_pattern ]
|
||||
then
|
||||
echo "|/sbin/logcore %e %s" > /proc/sys/kernel/core_pattern
|
||||
fi
|
||||
}
|
||||
55
crashlog/files/etc/init.d/crashlog
Executable file
55
crashlog/files/etc/init.d/crashlog
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
|
||||
send_log()
|
||||
{
|
||||
nr=$(db get hw.board.serial_number)
|
||||
hw=$(db get hw.board.model_name)
|
||||
fam=$(db get hw.board.iopVerFam)
|
||||
sw=$(db get hw.board.iopVersion)
|
||||
server=$(/sbin/uci get system.crashlog.server)
|
||||
|
||||
while true
|
||||
do
|
||||
scp -S /usr/sbin/logssh /proc/last_kmsg log@${server}:log/${fam}_${hw}_${sw}_${nr}
|
||||
if [ $? == 0 ]
|
||||
then
|
||||
break;
|
||||
fi
|
||||
# wait for another minute then try again
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
fill_in_default()
|
||||
{
|
||||
/sbin/uci add system log
|
||||
/sbin/uci rename system.@log[-1]=crashlog
|
||||
/sbin/uci set system.crashlog.enable=no
|
||||
/sbin/uci set system.crashlog.server="crashlog.iopsys.eu"
|
||||
/sbin/uci commit
|
||||
}
|
||||
|
||||
boot()
|
||||
{
|
||||
# is crashlog enabled ?
|
||||
enable=$(/sbin/uci get system.crashlog.enable)
|
||||
case $enable in
|
||||
0|no|NO|false|FALSE)
|
||||
exit 0
|
||||
;;
|
||||
"")
|
||||
fill_in_default
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
# is this boot a result from a crash ?
|
||||
reason=$(cat /etc/boot_reason)
|
||||
case $reason in
|
||||
HW|WD)
|
||||
send_log&
|
||||
;;
|
||||
esac
|
||||
}
|
||||
60
crashlog/files/sbin/logcore
Executable file
60
crashlog/files/sbin/logcore
Executable file
@@ -0,0 +1,60 @@
|
||||
#! /bin/sh
|
||||
|
||||
TMP_CORE=/tmp/new_core
|
||||
# first test if we can contact the log server.
|
||||
# if not abort directly the core file takes up memory
|
||||
alive()
|
||||
{
|
||||
ping -c1 $server
|
||||
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
# drain core file from kernel
|
||||
cat >/dev/null
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
fill_in_default()
|
||||
{
|
||||
/sbin/uci add system log
|
||||
/sbin/uci rename system.@log[-1]=corelog
|
||||
/sbin/uci set system.corelog.enable=no
|
||||
/sbin/uci set system.corelog.server="corelog.iopsys.eu"
|
||||
/sbin/uci commit
|
||||
}
|
||||
|
||||
# is corelog enabled ?
|
||||
enable=$(/sbin/uci get system.corelog.enable)
|
||||
case $enable in
|
||||
0|no|NO|false|FALSE)
|
||||
# drain core file from kernel
|
||||
cat >/dev/null
|
||||
exit 0
|
||||
;;
|
||||
"")
|
||||
fill_in_default
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
server=$(/sbin/uci get system.corelog.server)
|
||||
|
||||
alive
|
||||
|
||||
# dump out the core to disk we need this as scp needs a size before we send data
|
||||
# and this is the only way to know how much data there is
|
||||
cat >$TMP_CORE
|
||||
|
||||
# in case filesystem/memory is full at least kill the core in the kernel memory should give us some
|
||||
# more memory to work with. normally this would do nothing.
|
||||
cat >/dev/null
|
||||
|
||||
nr=$(db get hw.board.serial_number)
|
||||
hw=$(db get hw.board.model_name)
|
||||
fam=$(hw.board.iopVerFam)
|
||||
sw=$(db get hw.board.iopVersion)
|
||||
|
||||
scp -S /usr/sbin/logssh $TMP_CORE log@${server}:log/core_${1}_${2}_${fam}_${hw}_${sw}_${nr}
|
||||
rm $TMP_CORE
|
||||
|
||||
6
crashlog/files/usr/sbin/logssh
Executable file
6
crashlog/files/usr/sbin/logssh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
# we need to have the -y option to dropbear to not halt the scp when
|
||||
# transfering the log file to a new server for the first time.
|
||||
# since we already need this also put in the keyfile
|
||||
|
||||
ssh -y -i /etc/dropbear/logid $@
|
||||
42
crashlog/readme
Normal file
42
crashlog/readme
Normal file
@@ -0,0 +1,42 @@
|
||||
Install scp server.
|
||||
|
||||
Create a user account on a server and make sure it's possible to login to it
|
||||
using ssh.
|
||||
|
||||
For now the user has to be called "log"
|
||||
|
||||
USER is the user name of the account
|
||||
HOME is the user home directory.
|
||||
Both should be changed to the correct value in all following example commands.
|
||||
|
||||
create HOME/bin
|
||||
Put scp_upload in HOME/bin
|
||||
make it executable "chmod a+x HOME/bin/scp_upload"
|
||||
|
||||
create home/.ssh (observer the dot .shh)
|
||||
|
||||
create an empty file HOME/.ssh/authorized_keys
|
||||
|
||||
-------------------------------
|
||||
Now everyhting is setup for use but we have not added any clients.
|
||||
What we need is the public key for the clients.
|
||||
|
||||
For dropbear "dropbearkey -y -f files/etc/dropbear/logid" will generate the public key.
|
||||
|
||||
----------
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCwn9RaDAzxW1dTmIhXgFBnpi1lhj8xhYpCVQiPxxdk9IEmH8zjo4y9j3sPkqKOlRnkwjpZIpLEKBnpQTwVIMCU/AG7nDJX3OH9RfS9mLJQLfFL8HyGCyqDezFWldbyovhJZvdUeK4tAXJWv2W3OVHiz2L8IlncBgP/E9DJElsyhhQHsM96UE6tBkXsvXkoDbMSYXFcLbgiUwBKfmM2BF/aPDL45iznGur7/2j9v95PwJ0gtMu9jjNRq+pXCXhTh3bsnczm0MpZC1aiRc9nJAeGIMmhrf15E4jBKgTnrstzJxGVAdajKeR954KcNsS33cS2Wmui2YjmPbBXjqf1frzJ log@inteno
|
||||
----------
|
||||
|
||||
The public key should be just one line. Add that line to the
|
||||
HOME/.ssh/authorized_keys file on the scp server. Then add the follwoing as
|
||||
the first text on the same line. that is insert before the key data.
|
||||
|
||||
command="HOME/bin/scp_upload",no-port-forwarding,no-agent-forwarding,no-X11-forwarding
|
||||
|
||||
Do not forget to change HOME to the correct value for the server and there
|
||||
should be one space separating the key data and the above text.
|
||||
---------------------------------
|
||||
Now test to make sure that you can upload new files, not download files
|
||||
and not overwrite files from the client.
|
||||
|
||||
|
||||
53
crashlog/scp_upload
Normal file
53
crashlog/scp_upload
Normal file
@@ -0,0 +1,53 @@
|
||||
#! /bin/bash
|
||||
# authorized_keys command="/home/boxi/my_scp",no-port-forwarding,no-agent-forwarding,no-X11-forwarding
|
||||
|
||||
val=`expr match "$SSH_ORIGINAL_COMMAND" "scp"`
|
||||
if [ $val != 3 ]
|
||||
then
|
||||
echo "only scp is allowed for this rsa key"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#strip out "scp" as getopts barf on anything not an option
|
||||
|
||||
args=${SSH_ORIGINAL_COMMAND:3}
|
||||
|
||||
# we must set args to positional paramters otherwise it's next to impossible
|
||||
# to get to the rest of the line that is not arguments.
|
||||
|
||||
set -- $args
|
||||
while getopts "rftdvpq" Option
|
||||
do
|
||||
case $Option in
|
||||
r ) echo "recursive not allowed";exit 1;;
|
||||
f ) echo "reading files not allowed";exit 1;;
|
||||
t ) ;;
|
||||
d ) ;;
|
||||
v ) ;;
|
||||
p ) ;;
|
||||
q ) ;;
|
||||
* ) ;; # Default.
|
||||
esac
|
||||
done
|
||||
|
||||
shift $(($OPTIND - 1))
|
||||
|
||||
file="$*"
|
||||
dir=$(dirname "$file")
|
||||
|
||||
if [ "$dir" != "log" ]
|
||||
then
|
||||
echo "only allowed to write to log/"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# try to create uniq files
|
||||
EXTRA=$((0))
|
||||
while [ -e "${file}_${EXTRA}" ]
|
||||
do
|
||||
EXTRA=$((EXTRA +1))
|
||||
done
|
||||
|
||||
logger -t scp_upload "${SSH_ORIGINAL_COMMAND}_${EXTRA}"
|
||||
|
||||
exec ${SSH_ORIGINAL_COMMAND}_${EXTRA}
|
||||
@@ -1,64 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2020-2024 IOPSYS Software Solutions AB
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=csmngr
|
||||
PKG_VERSION:=1.0.2
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=5e50fe388fff29b08d895c1c580152cccfa290ad
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/csmngr.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
PKG_CONFIG_DEPENDS := \
|
||||
CONFIG_PACKAGE_libwifiutils \
|
||||
CONFIG_PACKAGE_libwifi
|
||||
|
||||
PKG_BUILD_DEPENDS := libwifi
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
||||
MAKE_PATH:=src
|
||||
|
||||
define Package/csmngr
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=WiFi channel selection manager
|
||||
DEPENDS:=+libwifiutils +libwifi +libuci +libubox +ubus +libnl-genl
|
||||
endef
|
||||
|
||||
define Package/csmngr/description
|
||||
WiFi Auto Channel Selection manager.
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-I$(STAGING_DIR)/usr/include \
|
||||
-I$(STAGING_DIR)/usr/include/libnl3 \
|
||||
-D_GNU_SOURCE
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
rsync -r --exclude=.* ~/git/csmngr/ $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/csmngr/install
|
||||
$(CP) ./files/* $(1)/
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/csmngr $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,csmngr))
|
||||
@@ -1,16 +0,0 @@
|
||||
if PACKAGE_ddnsmngr
|
||||
choice
|
||||
prompt "Select backend for dynamic DNS management"
|
||||
default DDNSMNGR_BACKEND_DDNSSCRIPT
|
||||
depends on PACKAGE_ddnsmngr
|
||||
help
|
||||
Select which package to use for dynamic DNS support
|
||||
|
||||
config DDNSMNGR_BACKEND_DDNSSCRIPT
|
||||
bool "Use ddns_script"
|
||||
|
||||
config DDNSMNGR_BACKEND_INADYN
|
||||
bool "Use inadyn"
|
||||
|
||||
endchoice
|
||||
endif
|
||||
@@ -1,79 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2024 IOPSYS
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ddnsmngr
|
||||
PKG_VERSION:=1.0.12
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/ddnsmngr.git
|
||||
PKG_SOURCE_VERSION:=44af9a7b3fec3929f8554af9633a5b8068189b48
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_CONFIG_DEPENDS:=CONFIG_DDNSMNGR_BACKEND_DDNSSCRIPT CONFIG_DDNSMNGR_BACKEND_INADYN
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(TOPDIR)/feeds/iopsys/bbfdm/bbfdm.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
TITLE:=Dynamic DNS manager
|
||||
DEPENDS:=+DDNSMNGR_BACKEND_DDNSSCRIPT:ddns-scripts +DDNSMNGR_BACKEND_INADYN:inadyn
|
||||
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
MAKE_PATH:=src
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
Manage dynamic DNS updation and provides Device.DynamicDNS. datamodel object based on TR181-2.16
|
||||
endef
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) -rf ~/git/ddnsmngr/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/etc/ddnsmngr/ddns
|
||||
$(INSTALL_DIR) $(1)/etc/ddnsmngr/servers
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ddnsmngr
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_DIR) $(1)/usr/libexec/rpcd
|
||||
$(INSTALL_DATA) ./files/etc/config/ddnsmngr $(1)/etc/config/ddnsmngr
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/01-ddns-config-migrate $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/init.d/ddnsmngr $(1)/etc/init.d/ddnsmngr
|
||||
ifeq ($(CONFIG_DDNSMNGR_BACKEND_DDNSSCRIPT),y)
|
||||
$(INSTALL_BIN) ./files/usr/lib/ddns_script/ddnsmngr_service.sh $(1)/usr/lib/ddnsmngr/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns-script/usr/lib/ddnsmngr/ddnsmngr_updater.sh $(1)/usr/lib/ddnsmngr/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/files/ddns-script/server/* $(1)/etc/ddnsmngr/servers
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns-script/usr/libexec/rpcd/ddnsmngr $(1)/usr/libexec/rpcd/ddnsmngr
|
||||
endif
|
||||
ifeq ($(CONFIG_DDNSMNGR_BACKEND_INADYN),y)
|
||||
$(INSTALL_BIN) ./files/usr/lib/inadyn/ddnsmngr_service.sh $(1)/usr/lib/ddnsmngr/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/files/inadyn/server/* $(1)/etc/ddnsmngr/servers
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/inadyn/usr/libexec/rpcd/ddnsmngr $(1)/usr/libexec/rpcd/ddnsmngr
|
||||
endif
|
||||
$(BBFDM_REGISTER_SERVICES) ./bbfdm_service.json $(1) $(PKG_NAME)
|
||||
$(BBFDM_INSTALL_MS_DM) $(PKG_BUILD_DIR)/src/libddnsmngr.so $(1) $(PKG_NAME)
|
||||
endef
|
||||
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"daemon": {
|
||||
"enable": "1",
|
||||
"service_name": "ddnsmngr",
|
||||
"unified_daemon": false,
|
||||
"services": [
|
||||
{
|
||||
"parent_dm": "Device.",
|
||||
"object": "DynamicDNS"
|
||||
}
|
||||
],
|
||||
"config": {
|
||||
"loglevel": "3"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
config ddnsmngr 'global'
|
||||
option configfile '/var/run/ddnsmngr/ddnsmngr.json'
|
||||
option ddns_dateformat '%F %R'
|
||||
option ddns_rundir '/var/run/ddnsmngr'
|
||||
option ddns_logdir '/var/log/ddnsmngr'
|
||||
option ddns_loglines '250'
|
||||
option upd_privateip '0'
|
||||
option use_curl '1'
|
||||
|
||||
config server 'ddns_server_1'
|
||||
option enabled '1'
|
||||
option service 'dynu.com'
|
||||
option name 'dynu.com'
|
||||
|
||||
config server 'ddns_server_2'
|
||||
option enabled '1'
|
||||
option service 'dyndns.org'
|
||||
option name 'dyndns.org'
|
||||
|
||||
config server 'ddns_server_3'
|
||||
option enabled '1'
|
||||
option service 'zoneedit.com'
|
||||
option name 'zoneedit.com'
|
||||
@@ -1,26 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=80
|
||||
STOP=10
|
||||
USE_PROCD=1
|
||||
|
||||
. /usr/lib/ddnsmngr/ddnsmngr_service.sh
|
||||
|
||||
start_service() {
|
||||
start_ddnsmngr_service
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
stop_ddnsmngr_service
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
sleep 1
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger ddnsmngr
|
||||
add_ddnsmngr_triggers
|
||||
}
|
||||
@@ -1,170 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
cl_id=1
|
||||
srv_id=1
|
||||
|
||||
function get_ddns_config_option() {
|
||||
local val
|
||||
|
||||
val="$(uci -q get ddns.${1}.${2})"
|
||||
|
||||
if [ -z "${val}" ] && [ -n "${3}" ]; then
|
||||
val="${3}"
|
||||
fi
|
||||
|
||||
echo "${val}"
|
||||
}
|
||||
|
||||
function config_supported_service() {
|
||||
if ! uci -q get ddnsmngr.global >/dev/null 2>&1; then
|
||||
uci -q set ddnsmngr.global="ddnsmngr"
|
||||
fi
|
||||
|
||||
servers=""
|
||||
|
||||
for i in $(find /etc/ddnsmngr/servers/ -name '*.json' | cut -d'/' -f 5 | sed "s/.json//")
|
||||
do
|
||||
if [ -z "${servers}" ]; then
|
||||
servers="${i}"
|
||||
else
|
||||
servers="${servers},${i}"
|
||||
fi
|
||||
done
|
||||
|
||||
uci -q set ddnsmngr.global.supported_services="${servers}"
|
||||
}
|
||||
|
||||
function migrate_service_section() {
|
||||
client_sec=""
|
||||
enabled="$(get_ddns_config_option ${1} enabled "0")"
|
||||
service_name="$(get_ddns_config_option ${1} service_name)"
|
||||
interface="$(get_ddns_config_option ${1} interface)"
|
||||
ip_network="$(get_ddns_config_option ${1} ip_network)"
|
||||
username="$(get_ddns_config_option ${1} username)"
|
||||
password="$(get_ddns_config_option ${1} password)"
|
||||
lookup_host="$(get_ddns_config_option ${1} lookup_host)"
|
||||
use_ipv6="$(get_ddns_config_option ${1} use_ipv6 "0")"
|
||||
force_ipversion="$(get_ddns_config_option ${1} force_ipversion "0")"
|
||||
use_https="$(get_ddns_config_option ${1} use_https "0")"
|
||||
force_dnstcp="$(get_ddns_config_option ${1} force_dnstcp "0")"
|
||||
|
||||
if [ -z "${service_name}" ]; then
|
||||
uci -q delete ddns."${1}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# check server file is present in device
|
||||
if [ ! -f "/etc/ddnsmngr/servers/${service_name}.json" ]; then
|
||||
uci -q delete ddns."${1}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Check if client section is already added for this service
|
||||
clients=$(uci -q show ddnsmngr | grep "=client")
|
||||
client_count=$(echo "${clients}" | wc -l)
|
||||
|
||||
tmp=0
|
||||
while [ $tmp -lt $client_count ]
|
||||
do
|
||||
mngr_serv="$(uci -q get ddnsmngr.@client[$tmp].service_name)"
|
||||
mngr_intf="$(uci -q get ddnsmngr.@client[$tmp].interface)"
|
||||
mngr_netw="$(uci -q get ddnsmngr.@client[$tmp].ip_network)"
|
||||
mngr_user="$(uci -q get ddnsmngr.@client[$tmp].username)"
|
||||
mngr_ipv6="$(uci -q get ddnsmngr.@client[$tmp].use_ipv6)"
|
||||
mngr_forceip="$(uci -q get ddnsmngr.@client[$tmp].force_ipversion)"
|
||||
mngr_https="$(uci -q get ddnsmngr.@client[$tmp].use_https)"
|
||||
mngr_dnstcp="$(uci -q get ddnsmngr.@client[$tmp].force_dnstcp)"
|
||||
|
||||
[ -z "${mngr_ipv6}" ] && mngr_ipv6="0"
|
||||
[ -z "${mngr_forceip}" ] && mngr_forceip="0"
|
||||
[ -z "${mngr_https}" ] && mngr_https="0"
|
||||
[ -z "${mngr_dnstcp}" ] && mngr_dnstcp="0"
|
||||
|
||||
if [ "${mngr_serv}" == "${service_name}" ] && [ "${mngr_intf}" == "${interface}" ] && \
|
||||
[ "${mngr_netw}" == "${ip_network}" ] && [ "${mngr_user}" == "${username}" ] && \
|
||||
[ "${mngr_ipv6}" == "${use_ipv6}" ] && [ "${mngr_forceip}" == "${force_ipversion}" ] && \
|
||||
[ "${mngr_https}" == "${use_https}" ] && [ "${mngr_dnstcp}" == "${force_dnstcp}" ]; then
|
||||
break
|
||||
fi
|
||||
|
||||
tmp=$(( tmp + 1 ))
|
||||
done
|
||||
|
||||
if [ $tmp -ne $client_count ]; then
|
||||
i=0
|
||||
for client in $clients; do
|
||||
if [ $i -eq $tmp ]; then
|
||||
client_sec="$(echo $client | cut -d'=' -f 1 | cut -d'.' -f 2)"
|
||||
break
|
||||
fi
|
||||
i=$(( i + 1 ))
|
||||
done
|
||||
|
||||
if [ $enabled -eq 1 ]; then
|
||||
uci -q set ddnsmngr."${client_sec}".enabled="1"
|
||||
fi
|
||||
else
|
||||
client_sec=ddns_mig_client_"${cl_id}"
|
||||
|
||||
uci -q set ddnsmngr."${client_sec}"="client"
|
||||
uci -q set ddnsmngr."${client_sec}".enabled="${enabled}"
|
||||
uci -q set ddnsmngr."${client_sec}".service_name="${service_name}"
|
||||
uci -q set ddnsmngr."${client_sec}".interface="${interface}"
|
||||
uci -q set ddnsmngr."${client_sec}".ip_network="${ip_network}"
|
||||
uci -q set ddnsmngr."${client_sec}".username="${username}"
|
||||
uci -q set ddnsmngr."${client_sec}".password="${password}"
|
||||
uci -q set ddnsmngr."${client_sec}".use_ipv6="${use_ipv6}"
|
||||
uci -q set ddnsmngr."${client_sec}".force_ipversion="${force_ipversion}"
|
||||
uci -q set ddnsmngr."${client_sec}".use_https="${use_https}"
|
||||
uci -q set ddnsmngr."${client_sec}".force_dnstcp="${force_dnstcp}"
|
||||
|
||||
cl_id=$(( cl_id + 1 ))
|
||||
|
||||
# add server section if not added
|
||||
servers=$(uci -q show ddnsmngr | grep "service=\'${service_name}\'")
|
||||
if [ -z "${servers}" ]; then
|
||||
server_sec=ddns_mig_server_"${srv_id}"
|
||||
uci -q set ddnsmngr."${server_sec}"="server"
|
||||
uci -q set ddnsmngr."${server_sec}".enabled="1"
|
||||
uci -q set ddnsmngr."${server_sec}".service="${service_name}"
|
||||
uci -q set ddnsmngr."${server_sec}".name="${service_name}"
|
||||
|
||||
srv_id=$(( srv_id + 1 ))
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# if lookup_host is set then add host section
|
||||
if [ -n "${lookup_host}" ] && [ -n "${client_sec}" ]; then
|
||||
# check number of hosts present for this client
|
||||
host_count=$(uci -q show ddnsmngr | grep "dm_parent=\'${client_sec}\'" | wc -l)
|
||||
host_ix=$(( host_count + 1 ))
|
||||
host_sec="${client_sec}"_host_"${host_ix}"
|
||||
|
||||
uci -q set ddnsmngr."${host_sec}"="host"
|
||||
uci -q set ddnsmngr."${host_sec}".enabled="${enabled}"
|
||||
uci -q set ddnsmngr."${host_sec}".lookup_host="${lookup_host}"
|
||||
uci -q set ddnsmngr."${host_sec}".dm_parent="${client_sec}"
|
||||
fi
|
||||
|
||||
uci -q delete ddns."${1}"
|
||||
}
|
||||
|
||||
function migrate_ddns_config() {
|
||||
if [ ! -f "/etc/config/ddnsmngr" ]; then
|
||||
# Create ddnsmngr config file
|
||||
touch /etc/config/ddnsmngr
|
||||
fi
|
||||
|
||||
config_supported_service
|
||||
|
||||
config_load ddns
|
||||
config_foreach migrate_service_section service
|
||||
|
||||
uci -q commit ddns
|
||||
uci -q commit ddnsmngr
|
||||
}
|
||||
|
||||
migrate_ddns_config
|
||||
@@ -1,169 +0,0 @@
|
||||
#! /bin/sh
|
||||
|
||||
RUNDIR="/var/run/ddnsmngr"
|
||||
LOGDIR="/var/log/ddnsmngr"
|
||||
PROG="/usr/lib/ddnsmngr/ddnsmngr_updater.sh"
|
||||
CONFIGFILE="/var/run/ddnsmngr/ddnsmngr.json"
|
||||
CLIENT_INTFS=""
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
log() {
|
||||
echo "$*"|logger -t ddnsmngr.init -p debug
|
||||
}
|
||||
|
||||
validate_host_section() {
|
||||
uci_validate_section ddnsmngr host "${1}" \
|
||||
'enabled:bool:0' \
|
||||
'lookup_host:string' \
|
||||
'dm_parent:string'
|
||||
}
|
||||
|
||||
validate_client_section() {
|
||||
uci_validate_section ddnsmngr client "${1}" \
|
||||
'enabled:bool:0' \
|
||||
'service_name:string' \
|
||||
'interface:string' \
|
||||
'ip_network:string' \
|
||||
'username:string' \
|
||||
'password:string' \
|
||||
'use_https:bool:0' \
|
||||
'force_dnstcp:bool:0' \
|
||||
'use_ipv6:bool:0' \
|
||||
'force_ipversion:bool:0'
|
||||
}
|
||||
|
||||
add_object() {
|
||||
local enabled lookup_host dm_parent use_ipv6 force_ipversion proc_info_file
|
||||
local service_name interface ip_network username password use_https force_dnstcp
|
||||
|
||||
validate_host_section "${1}" || {
|
||||
log "Validation of host section failed"
|
||||
return 0
|
||||
}
|
||||
|
||||
if [ "${enabled}" -ne 1 ] || [ -z "${dm_parent}" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
validate_client_section "${dm_parent}" || {
|
||||
log "Validation of client section failed"
|
||||
return 0
|
||||
}
|
||||
|
||||
if [ "${enabled}" -ne 1 ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
service_name=$(uci -q get ddnsmngr.${dm_parent}.service_name)
|
||||
if [ -z "${service_name}" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
service_section=$(uci -q show ddnsmngr | grep "service=\'${service_name}\'" | cut -d'.' -f 2 | head -1)
|
||||
if [ -z "${service_section}" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
service_enabled=$(uci -q get ddnsmngr.${service_section}.enabled)
|
||||
if [ "${service_enabled}" -ne 1 ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
json_add_object
|
||||
json_add_string "interface" "${interface}"
|
||||
json_add_string "service_name" "${service_name}"
|
||||
json_add_string "username" "${username}"
|
||||
json_add_string "password" "${password}"
|
||||
json_add_string "lookup_host" "${lookup_host}"
|
||||
json_add_string "ip_network" "${ip_network}"
|
||||
json_add_string "proc_info_file" "${1}"
|
||||
json_add_string "use_ipv6" "${use_ipv6}"
|
||||
json_add_string "force_ipversion" "${force_ipversion}"
|
||||
json_add_string "use_https" "${use_https}"
|
||||
json_add_string "force_dnstcp" "${force_dnstcp}"
|
||||
json_close_object
|
||||
|
||||
if [ -z "${interface}" ]; then
|
||||
if [ "${use_ipv6}" -eq 0 ]; then
|
||||
interface="wan"
|
||||
else
|
||||
interface="wan6"
|
||||
fi
|
||||
fi
|
||||
|
||||
for intf in $CLIENT_INTFS; do
|
||||
if [ "${intf}" == "${interface}" ]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
CLIENT_INTFS="${CLIENT_INTFS} ${interface}"
|
||||
}
|
||||
|
||||
start_ddnsmngr_service() {
|
||||
run_dir=$(uci -q get ddnsmngr.global.ddns_rundir)
|
||||
log_dir=$(uci -q get ddnsmngr.global.ddns_logdir)
|
||||
|
||||
if [ -n "${run_dir}" ]; then
|
||||
RUNDIR="${run_dir}"
|
||||
fi
|
||||
|
||||
if [ -n "${log_dir}" ]; then
|
||||
LOGDIR="${log_dir}"
|
||||
fi
|
||||
|
||||
mkdir -p "${RUNDIR}"
|
||||
mkdir -p "${LOGDIR}"
|
||||
|
||||
conf_file=$(uci -q get ddnsmngr.global.configfile)
|
||||
if [ -n "${conf_file}" ]; then
|
||||
CONFIGFILE="${conf_file}"
|
||||
fi
|
||||
|
||||
touch "${CONFIGFILE}"
|
||||
|
||||
if [ ! -f "${CONFIGFILE}" ]; then
|
||||
log "Can not create ${CONFIGFILE}, exit"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
json_init
|
||||
json_add_array "services"
|
||||
|
||||
config_load ddnsmngr
|
||||
config_foreach add_object host
|
||||
|
||||
json_close_array
|
||||
json_dump > "${CONFIGFILE}"
|
||||
|
||||
procd_open_instance ddnsmngr
|
||||
procd_set_param command "$PROG"
|
||||
procd_append_param command -c "${CONFIGFILE}"
|
||||
procd_append_param command -- start
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
stop_ddnsmngr_service() {
|
||||
conf_file=$(uci -q get ddnsmngr.global.configfile)
|
||||
if [ -n "${conf_file}" ]; then
|
||||
CONFIGFILE="${conf_file}"
|
||||
fi
|
||||
|
||||
if [ ! -f "${CONFIGFILE}" ]; then
|
||||
log "${CONFIGFILE} not found, can't stop services if running any"
|
||||
fi
|
||||
|
||||
"$PROG" -c "${CONFIGFILE}" -- stop
|
||||
return 0
|
||||
}
|
||||
|
||||
add_ddnsmngr_triggers() {
|
||||
procd_open_trigger
|
||||
for intf in $CLIENT_INTFS; do
|
||||
# No need to handle other ifevents like ifupdate etc
|
||||
procd_add_interface_trigger "interface.*.up" $intf /etc/init.d/ddnsmngr restart
|
||||
procd_add_interface_trigger "interface.*.down" $intf /etc/init.d/ddnsmngr restart
|
||||
done
|
||||
procd_close_trigger
|
||||
}
|
||||
@@ -1,311 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
PROG="/usr/sbin/inadyn"
|
||||
CONFIGPATH="/tmp/inadyn_config"
|
||||
PIDPATH="/etc/inadyn_pid"
|
||||
CLIENT_INTFS=""
|
||||
CONFIG_FILES=""
|
||||
SERVER_PATH="/etc/ddnsmngr/servers"
|
||||
|
||||
FORMAT="custom [SECTION] {\n\tusername\t= [USER]\n\tpassword\t= [PWD]\n\tddns-server\t= [SERV]\n\tddns-path\t= [URI]\n\tssl\t\t= [SSL]\n\thostname\t= [NAME]\n\tcheckip-command\t= [CMD]\n\tddns-response\t= [RESPONSES]\n}"
|
||||
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
log() {
|
||||
echo "$*"|logger -t ddnsmngr.init -p debug
|
||||
}
|
||||
|
||||
get_service_data() {
|
||||
local provider="$1"
|
||||
shift
|
||||
local dir="$1"
|
||||
shift
|
||||
local ipv6="$1"
|
||||
shift
|
||||
|
||||
local name data url answer script
|
||||
|
||||
[ $# -ne 2 ] && {
|
||||
return 1
|
||||
}
|
||||
|
||||
[ -f "${dir}/${provider}.json" ] || {
|
||||
eval "$1=\"\""
|
||||
eval "$2=\"\""
|
||||
return 1
|
||||
}
|
||||
|
||||
json_load_file "${dir}/${provider}.json"
|
||||
json_get_var name "name"
|
||||
if [ "$ipv6" -eq "1" ]; then
|
||||
json_select "ipv6"
|
||||
else
|
||||
json_select "ipv4"
|
||||
fi
|
||||
json_get_var data "url"
|
||||
json_get_var answer "answer"
|
||||
json_select ".."
|
||||
json_cleanup
|
||||
|
||||
response=""
|
||||
if [ -n "${answer}" ]; then
|
||||
answer=$(echo "${answer}" | sed 's/|/ /g')
|
||||
for ans in $answer; do
|
||||
if [ -z "${response}" ]; then
|
||||
response="${ans}"
|
||||
else
|
||||
response="${response}, ${ans}"
|
||||
fi
|
||||
done
|
||||
response="{ ${response} }"
|
||||
fi
|
||||
|
||||
eval "$1=\"$data\""
|
||||
eval "$2=\"$response\""
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
generate_inadyn_config() {
|
||||
json_load "${1}"
|
||||
json_get_var service_name service_name
|
||||
json_get_var use_ipv6 use_ipv6
|
||||
json_get_var interface interface
|
||||
json_get_var username username
|
||||
json_get_var password password
|
||||
json_get_var host lookup_host
|
||||
json_get_var conf_file config_file
|
||||
json_get_var conf_dir config_dir
|
||||
json_get_var server_address server_address
|
||||
json_cleanup
|
||||
|
||||
if [ -z "${service_name}" ] || [ -z "${host}" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -z "${conf_file}" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -z "${conf_dir}" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# First look into custom path to load the url otherwise default path
|
||||
get_service_data "${service_name}" "${SERVER_PATH}" "${use_ipv6}" server_url server_answer
|
||||
|
||||
if [ -z "${server_url}" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Need to pick proto, server address and request uri separately from the url
|
||||
# format http://[server_address]/[update_Request_uri]
|
||||
proto=$(echo $server_url | cut -d':' -f 1)
|
||||
serv=$(echo $server_url | cut -d'/' -f 3 | cut -d'@' -f 2)
|
||||
uri=${server_url#*$serv}
|
||||
|
||||
if [ -z $proto ] || [ -z $serv ] || [ -z $uri ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
path=$(echo "$uri" | sed 's/&/\\&/g')
|
||||
update_uri=$(echo $path | sed -e "s#\[DOMAIN\]#%h#g" -e "s#\[PASSWORD\]#%p#g" \
|
||||
-e "s#\[USERNAME\]#%u#g" -e "s#\[IP\]#%i#g")
|
||||
|
||||
if [ -z "${interface}" ]; then
|
||||
if [ "${use_ipv6}" -eq 0 ]; then
|
||||
interface="wan"
|
||||
else
|
||||
interface="wan6"
|
||||
fi
|
||||
fi
|
||||
|
||||
# now get the physical interface name
|
||||
intf=$(ifstatus "${interface}" | jsonfilter -e '@.device')
|
||||
if [ -z "${intf}" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# command to get ip of the interface
|
||||
if [ "${use_ipv6}" -eq 0 ]; then
|
||||
get_ip="\"ifstatus ${interface} | jsonfilter -e '@[\\\\\"ipv4-address\\\\\"][0].address'\""
|
||||
else
|
||||
get_ip="\"ifstatus ${interface} | jsonfilter -e '@[\\\\\"ipv6-address\\\\\"][0].address'\""
|
||||
fi
|
||||
|
||||
if [ "${proto}" = "http" ]; then
|
||||
ssl="false"
|
||||
else
|
||||
ssl="true"
|
||||
fi
|
||||
|
||||
inadyn_ver=$(inadyn -v)
|
||||
user_agent="inadyn/${inadyn_ver}"
|
||||
|
||||
config_file="${conf_dir}/${conf_file}"
|
||||
touch "${config_file}"
|
||||
|
||||
echo "iface = ${intf}" > "${config_file}"
|
||||
echo "period = 600" >> "${config_file}"
|
||||
echo "user-agent = ${user_agent}" >> "${config_file}"
|
||||
|
||||
if [ "${use_ipv6}" -eq 1 ]; then
|
||||
echo "allow-ipv6 = true" >> "${config_file}"
|
||||
fi
|
||||
|
||||
if [ -z "${password}" ]; then
|
||||
FORMAT=$(echo "${FORMAT}" | sed 's/\\tpassword\\t= \[PWD\]\\n//g')
|
||||
fi
|
||||
|
||||
if [ -z "${server_answer}" ]; then
|
||||
FORMAT=$(echo "${FORMAT}" | sed 's/\\tddns-response\\t= \[RESPONSES\]\\n//g')
|
||||
fi
|
||||
|
||||
config=$(echo $FORMAT | sed -e "s#\[SECTION\]#$conf_file#g" -e "s#\[PWD\]#$password#g" \
|
||||
-e "s#\[USER\]#$username#g" -e "s#\[SERV\]#$serv#g" \
|
||||
-e "s#\[URI\]#\"$update_uri\"#g" -e "s#\[SSL\]#$ssl#g" \
|
||||
-e "s#\[NAME\]#$host#g" -e "s#\[CMD\]#$get_ip#g" \
|
||||
-e "s#\[RESPONSES\]#$server_answer#g")
|
||||
|
||||
echo -e "\n\n${config}" >> "${config_file}"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
validate_host_section() {
|
||||
uci_validate_section ddnsmngr host "${1}" \
|
||||
'enabled:bool:0' \
|
||||
'lookup_host:string' \
|
||||
'dm_parent:string'
|
||||
}
|
||||
|
||||
validate_client_section() {
|
||||
uci_validate_section ddnsmngr client "${1}" \
|
||||
'enabled:bool:0' \
|
||||
'service_name:string' \
|
||||
'interface:string' \
|
||||
'ip_network:string' \
|
||||
'username:string' \
|
||||
'password:string' \
|
||||
'use_https:bool:0' \
|
||||
'force_dnstcp:bool:0' \
|
||||
'use_ipv6:bool:0' \
|
||||
'force_ipversion:bool:0'
|
||||
}
|
||||
|
||||
add_object() {
|
||||
local enabled lookup_host dm_parent use_ipv6 force_ipversion
|
||||
local service_name interface ip_network username password use_https force_dnstcp
|
||||
|
||||
validate_host_section "${1}" || {
|
||||
log "Validation of host section failed"
|
||||
return
|
||||
}
|
||||
|
||||
if [ "${enabled}" -ne 1 ] || [ -z "${dm_parent}" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
validate_client_section "${dm_parent}" || {
|
||||
log "Validation of client section failed"
|
||||
return
|
||||
}
|
||||
|
||||
if [ "${enabled}" -ne 1 ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
service_name=$(uci -q get ddnsmngr.${dm_parent}.service_name)
|
||||
if [ -z "${service_name}" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
service_section=$(uci show ddnsmngr | grep "service=\'${service_name}\'" | cut -d'.' -f 2 | head -1)
|
||||
if [ -z "${service_section}" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
service_enabled=$(uci -q get ddnsmngr.${service_section}.enabled)
|
||||
if [ "${service_enabled}" -ne 1 ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
json_init
|
||||
json_add_string "interface" "${interface}"
|
||||
json_add_string "service_name" "${service_name}"
|
||||
json_add_string "username" "${username}"
|
||||
json_add_string "password" "${password}"
|
||||
json_add_string "lookup_host" "${lookup_host}"
|
||||
json_add_string "ip_network" "${ip_network}"
|
||||
json_add_string "use_ipv6" "${use_ipv6}"
|
||||
json_add_string "force_ipversion" "${force_ipversion}"
|
||||
json_add_string "use_https" "${use_https}"
|
||||
json_add_string "force_dnstcp" "${force_dnstcp}"
|
||||
json_add_string "config_file" "${1}"
|
||||
json_add_string "config_dir" "${CONFIGPATH}"
|
||||
|
||||
json_str=$(json_dump)
|
||||
json_cleanup
|
||||
|
||||
generate_inadyn_config "${json_str}"
|
||||
|
||||
if [ "$?" -ne 0 ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
CONFIG_FILES="${CONFIG_FILES} ${1}"
|
||||
|
||||
if [ -z "${interface}" ]; then
|
||||
if [ "${use_ipv6}" -eq 0 ]; then
|
||||
interface="wan"
|
||||
else
|
||||
interface="wan6"
|
||||
fi
|
||||
fi
|
||||
|
||||
for intf in $CLIENT_INTFS; do
|
||||
if [ "${intf}" == "${interface}" ]; then
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
CLIENT_INTFS="${CLIENT_INTFS} ${interface}"
|
||||
}
|
||||
|
||||
start_ddnsmngr_service() {
|
||||
rm -rf $CONFIGPATH
|
||||
mkdir $CONFIGPATH
|
||||
mkdir -p $PIDPATH
|
||||
|
||||
config_load ddnsmngr
|
||||
config_foreach add_object host
|
||||
|
||||
i=1
|
||||
for conf in $CONFIG_FILES; do
|
||||
instance="ddnsmngr_${i}"
|
||||
i=$(( i + 1 ))
|
||||
|
||||
procd_open_instance $instance
|
||||
procd_set_param command "$PROG"
|
||||
procd_append_param command -f "${CONFIGPATH}/${conf}"
|
||||
procd_append_param command -l debug
|
||||
procd_append_param command -P "${PIDPATH}/${conf}"
|
||||
procd_append_param command -n -C
|
||||
procd_close_instance
|
||||
done
|
||||
}
|
||||
|
||||
stop_ddnsmngr_service() {
|
||||
rm -rf $CONFIGPATH
|
||||
return 0
|
||||
}
|
||||
|
||||
add_ddnsmngr_triggers() {
|
||||
procd_open_trigger
|
||||
for intf in $CLIENT_INTFS; do
|
||||
# No need to handle other ifevents like ifupdate etc
|
||||
procd_add_interface_trigger "interface.*.up" $intf /etc/init.d/ddnsmngr restart
|
||||
done
|
||||
procd_close_trigger
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
menu "Configuration"
|
||||
|
||||
config DECOLLECTOR_EASYMESH_VERSION
|
||||
int "Support Easymesh version"
|
||||
default 6
|
||||
|
||||
endmenu
|
||||
@@ -1,81 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2021-2024 IOPSYS Software Solutions AB
|
||||
# Copyright (C) 2025 Genexis AB
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=decollector
|
||||
PKG_VERSION:=6.2.1.8
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=b7e294d7c610adfd80cf40a0628c189695dc5156
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/decollector.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@genexis.eu>
|
||||
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/decollector
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=WiFi DataElements Collector Proxy
|
||||
DEPENDS:=+libuci +libubox +ubus +libpthread +libnl-genl \
|
||||
+libeasy +libwifiutils +libieee1905 +ieee1905-map-plugin
|
||||
endef
|
||||
|
||||
define Package/decollector/description
|
||||
It implements the WiFi DataElements Agent as defined in the Wi-Fi Alliance's
|
||||
DataElements specification.
|
||||
endef
|
||||
|
||||
|
||||
define Package/decollector/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
ifneq (,$(findstring ALPHA,$(CONFIG_VERSION_CODE)))
|
||||
MAKE_FLAGS += DEBUG=1
|
||||
endif
|
||||
|
||||
ifneq (,$(findstring BETA,$(CONFIG_VERSION_CODE)))
|
||||
MAKE_FLAGS += DEBUG=1
|
||||
endif
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-I$(STAGING_DIR)/usr/include \
|
||||
-I$(STAGING_DIR)/usr/include/libnl3 \
|
||||
-D_GNU_SOURCE
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
rsync -r --exclude=.* ~/git/decollector/ $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
MAKE_PATH:=src
|
||||
|
||||
TARGET_CFLAGS += -DEASYMESH_VERSION=$(CONFIG_DECOLLECTOR_EASYMESH_VERSION)
|
||||
|
||||
EXECS := \
|
||||
$(if $(CONFIG_PACKAGE_decollector),decollector)
|
||||
|
||||
MAKE_FLAGS += EXECS="$(EXECS)"
|
||||
|
||||
define Package/decollector/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) ./files/decollector.init $(1)/etc/init.d/decollector
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/decollector $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,decollector))
|
||||
@@ -1,43 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=98
|
||||
STOP=11
|
||||
|
||||
USE_PROCD=1
|
||||
PROG=/usr/sbin/decollector
|
||||
|
||||
service_running() {
|
||||
ubus -t 2 wait_for ieee1905 ieee1905.map
|
||||
}
|
||||
|
||||
start_service() {
|
||||
sleep 3
|
||||
[ -e "/etc/config/mapcontroller" ] && {
|
||||
local en
|
||||
|
||||
config_load mapcontroller
|
||||
config_get en controller enabled "0"
|
||||
config_get collect_int controller de_collect_interval
|
||||
|
||||
[ -n "$collect_int" -a $collect_int -lt 30 ] && collect_int=""
|
||||
|
||||
[ $en -gt 0 ] && {
|
||||
procd_open_instance
|
||||
procd_set_param command "$PROG" "-d" "${collect_int:+-t $collect_int}"
|
||||
#procd_set_param stdout 1
|
||||
#procd_set_param stderr 1
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger mapcontroller
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
if PACKAGE_dectmngr
|
||||
|
||||
menu "Configuration"
|
||||
|
||||
config ENABLE_LINE_SETTINGS_EXTENSION
|
||||
bool "Enable Line Settings List extension "
|
||||
default y
|
||||
|
||||
endmenu
|
||||
|
||||
endif
|
||||
@@ -1,18 +1,23 @@
|
||||
#
|
||||
# Copyright (C) 2020 iopsys Software Solutions AB
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dectmngr
|
||||
PKG_RELEASE:=3
|
||||
PKG_VERSION:=3.7.10
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=1.0
|
||||
|
||||
LOCAL_DEV=0
|
||||
LOCAL_DEV=1
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/dectmngr.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=1f851980a6ba616df54f79930225f8bcd563b711
|
||||
PKG_MIRROR_HASH:=skip
|
||||
PKG_SOURCE_VERSION:=2c8990fd5275d469e8ab6c7a99e17fe0a56052ea
|
||||
endif
|
||||
|
||||
PKG_LICENSE:=PROPRIETARY
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
RSTRIP:=true
|
||||
@@ -28,44 +33,36 @@ include $(INCLUDE_DIR)/package.mk
|
||||
define Package/$(PKG_NAME)
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=DECT Manager
|
||||
DEPENDS:= +libubox +ubus +uci +libxml2 +libjson-c +gpiod-tools +voicemngr
|
||||
DEPENDS:= +libubox +ubus +libpicoevent
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
DECT manager is a daemon that provides UBUS RPC objects and sends UBUS events for communication with the DECT chip.
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
rsync -av --exclude=.* ~/git/voip/dectmngr/* $(PKG_BUILD_DIR)/
|
||||
$(CP) -r src/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-Wall \
|
||||
-Werror \
|
||||
-I$(STAGING_DIR)/usr/include/libxml2
|
||||
|
||||
ifeq ($(CONFIG_ENABLE_LINE_SETTINGS_EXTENSION),y)
|
||||
TARGET_CFLAGS += -DENABLE_LINE_SETTINGS_EXTENSION
|
||||
endif
|
||||
MAKE_FLAGS += \
|
||||
CFLAGS+="-Wall"
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/etc/dspg
|
||||
$(INSTALL_DIR) $(1)/lib/upgrade/keep.d
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/etc/dect/
|
||||
$(INSTALL_DIR) $(1)/etc/config/
|
||||
$(INSTALL_DIR) $(1)/etc/init.d/
|
||||
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/app/dectmngr $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/test/testout/dectmngr $(1)/usr/sbin/
|
||||
$(STRIP) $(1)/usr/sbin/dectmngr
|
||||
ifeq ($(CONFIG_TARGET_airoha),)
|
||||
$(CP) ./firmware/common/* $(1)/etc/dspg/
|
||||
endif
|
||||
$(CP) ./files/etc/* $(1)/etc/
|
||||
$(INSTALL_DATA) ./files/lib/upgrade/keep.d/dect $(1)/lib/upgrade/keep.d/dect
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/test/testout/libdect.so $(1)/usr/lib/
|
||||
$(STRIP) $(1)/usr/lib/libdect.so
|
||||
#$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/target.bin $(1)/etc/dect/
|
||||
#$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/dect $(1)/etc/init.d/
|
||||
#$(CP) ./files/dect.config $(1)/etc/config/dect
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
|
||||
BIN
dectmngr/files/DCX81_fw_c/MOD/USB/DCX81_MOD_USB.BOOTLOADER.bin
Executable file
BIN
dectmngr/files/DCX81_fw_c/MOD/USB/DCX81_MOD_USB.BOOTLOADER.bin
Executable file
Binary file not shown.
BIN
dectmngr/files/DCX81_fw_c/MOD/USB/DCX81_MOD_USB.BOOTLOADER.elf
Executable file
BIN
dectmngr/files/DCX81_fw_c/MOD/USB/DCX81_MOD_USB.BOOTLOADER.elf
Executable file
Binary file not shown.
2515
dectmngr/files/DCX81_fw_c/MOD/USB/DCX81_MOD_USB.BOOTLOADER.lst
Executable file
2515
dectmngr/files/DCX81_fw_c/MOD/USB/DCX81_MOD_USB.BOOTLOADER.lst
Executable file
File diff suppressed because it is too large
Load Diff
BIN
dectmngr/files/DCX81_fw_c/MOD/USB/DCX81_MOD_USB.ITCM
Executable file
BIN
dectmngr/files/DCX81_fw_c/MOD/USB/DCX81_MOD_USB.ITCM
Executable file
Binary file not shown.
BIN
dectmngr/files/DCX81_fw_c/MOD/USB/DCX81_MOD_USB.ITCM_L
Executable file
BIN
dectmngr/files/DCX81_fw_c/MOD/USB/DCX81_MOD_USB.ITCM_L
Executable file
Binary file not shown.
BIN
dectmngr/files/DCX81_fw_c/MOD/USB/DCX81_MOD_USB.bin
Executable file
BIN
dectmngr/files/DCX81_fw_c/MOD/USB/DCX81_MOD_USB.bin
Executable file
Binary file not shown.
BIN
dectmngr/files/DCX81_fw_c/MOD/USB/DCX81_MOD_USB.elf
Executable file
BIN
dectmngr/files/DCX81_fw_c/MOD/USB/DCX81_MOD_USB.elf
Executable file
Binary file not shown.
36
dectmngr/files/DCX81_fw_c/MOD/USB/DCX81_MOD_USB.info
Executable file
36
dectmngr/files/DCX81_fw_c/MOD/USB/DCX81_MOD_USB.info
Executable file
File diff suppressed because one or more lines are too long
19754
dectmngr/files/DCX81_fw_c/MOD/USB/DCX81_MOD_USB.lst
Executable file
19754
dectmngr/files/DCX81_fw_c/MOD/USB/DCX81_MOD_USB.lst
Executable file
File diff suppressed because it is too large
Load Diff
4
dectmngr/files/DCX81_fw_c/MOD/USB/DCX81_MOD_USB.md5
Executable file
4
dectmngr/files/DCX81_fw_c/MOD/USB/DCX81_MOD_USB.md5
Executable file
@@ -0,0 +1,4 @@
|
||||
9c5962fc5bdef309d15cf76dd2678297 out4/Images/PRODUCT_IOPSYS/DCX81_fw_c/MOD/USB/DCX81_MOD_USB.ITCM
|
||||
17d4a7e4021c6089104c28c228245df2 out4/Images/PRODUCT_IOPSYS/DCX81_fw_c/MOD/USB/DCX81_MOD_USB.ITCM_L
|
||||
d32e2a3dd05f4d1933eac77cfff091ba out4/Images/PRODUCT_IOPSYS/DCX81_fw_c/MOD/USB/DCX81_MOD_USB.bin
|
||||
477bfa4e91914db4c0078b31a6cdf208 out4/Images/PRODUCT_IOPSYS/DCX81_fw_c/MOD/USB/DCX81_MOD_USB.BOOTLOADER.bin
|
||||
1
dectmngr/files/DCX81_fw_c/MOD/USB/DCX81_MOD_USB_EEPROM_MD5_SIG.md5
Executable file
1
dectmngr/files/DCX81_fw_c/MOD/USB/DCX81_MOD_USB_EEPROM_MD5_SIG.md5
Executable file
@@ -0,0 +1 @@
|
||||
{0xee,0xb7,0x3c,0x8f,0x44,0xe1,0xad,0x87,0x53,0xc8,0x57,0x4e,0x08,0x6d,0x87,0x9f}
|
||||
984
dectmngr/files/DCX81_fw_c/MOD/USB/DCX81_MOD_USB_EEPROM_Map.htm
Executable file
984
dectmngr/files/DCX81_fw_c/MOD/USB/DCX81_MOD_USB_EEPROM_Map.htm
Executable file
@@ -0,0 +1,984 @@
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
|
||||
<title>EEPROM map </title>
|
||||
|
||||
<style>
|
||||
|
||||
<!--
|
||||
|
||||
th {
|
||||
|
||||
font-size: 12px;
|
||||
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
|
||||
font-style: bold;
|
||||
|
||||
}
|
||||
|
||||
td {
|
||||
|
||||
font-size: 10px;
|
||||
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
|
||||
}
|
||||
|
||||
body {
|
||||
|
||||
background-color: #FFFFFF;
|
||||
|
||||
}
|
||||
|
||||
-->
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>EEPROM map bsd02eep.h-GIT</h1>
|
||||
|
||||
|
||||
<table border="2" cellspacing="2" width="100%" rules="both" align="center" style=" font-size: 10px;
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
background-color: #C9FFDA;
|
||||
border-collapse: collapse;
|
||||
border: 5px solid white">
|
||||
<tbody>
|
||||
<tr style=" font-size: 12px;
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
font-style: bold;
|
||||
background-color: #78FF95"><td>Name</td><td align="center">Offset</td><td>Comment</td><td width="100">Default</td></tr>
|
||||
<tr><td>SD02_RESERVED1[4]</td><td align="center">0(0x0)</td><td> L4 RESERVED1 </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_RESERVED2[5]</td><td align="center">4(0x4)</td><td> L5 RESERVED2 </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_SUB_GFSK[10]</td><td align="center">9(0x9)</td><td> L10 </td><td width="100">0x80,0x80,0x80,0x80,0x80,
|
||||
|
||||
0x80,0x80,0x80,0x80,0x80,
|
||||
</td></tr>
|
||||
<tr><td>SD02_PREAM_NORMAL</td><td align="center">19(0x13)</td><td> L1 </td><td width="100">0x65,
|
||||
</td></tr>
|
||||
<tr><td>SD02_TEST_FLAGS</td><td align="center">20(0x14)</td><td> L1 If set: bit 0: BMP Driver Recover disabled
|
||||
bit 1: Watchdog not enabled
|
||||
bit 3: disable activity led </td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_EMC_MODEL[3]</td><td align="center">21(0x15)</td><td> L3 EMC number and model, transfered in MODEL_ID IE </td><td width="100">0x0F,0xEB,0x02,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RVREF</td><td align="center">24(0x18)</td><td> L1 </td><td width="100">0x1F,
|
||||
</td></tr>
|
||||
<tr><td>SD02_TEST_MODE</td><td align="center">25(0x19)</td><td> L1 Enter TBR6/10 </td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RXTUN</td><td align="center">26(0x1A)</td><td> L1 FR </td><td width="100">0x70,
|
||||
</td></tr>
|
||||
<tr><td>SD02_AUXBGPROG</td><td align="center">27(0x1B)</td><td> L1 AUXBGPROG (Bandgap calibration value) </td><td width="100">0x66,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RVDDC</td><td align="center">28(0x1C)</td><td> L1 </td><td width="100">0x97,
|
||||
</td></tr>
|
||||
<tr><td>SD02_POWER_CONTROL</td><td align="center">29(0x1D)</td><td> L1 Power Control: nibble usage (0xsw) where s is ARM clock speed and w the number of
|
||||
pflash waitstates.
|
||||
Note: For ICELP, the default ARM clock
|
||||
speed is 64 (96MHz and 4 wait states).
|
||||
Note: For VegaOne s is used as an index to
|
||||
recommended clock settings (see
|
||||
VegaOne_AHB_PLLDIV[16] in file
|
||||
cdr17tim.c).
|
||||
For VegaOne: bit 3 is used to select if flash
|
||||
running in syncrounous (asyncronous = 0
|
||||
syncronous = 1)</td><td width="100">0x2,
|
||||
</td></tr>
|
||||
<tr><td>SD02_WDCT_HOP_CONTROL</td><td align="center">30(0x1E)</td><td> L1 </td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_WDCT_QUAL_CONTROL</td><td align="center">31(0x1F)</td><td> L1 WDCT Quality Control: When the most significant bit of this byte is
|
||||
set to 1, the hop sequence of 19 and frequency
|
||||
substitution can be disabled.</td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_US_DECT</td><td align="center">32(0x20)</td><td> L1 </td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_MAX_USABLE_RSSI</td><td align="center">33(0x21)</td><td> L1 </td><td width="100">0x78,
|
||||
</td></tr>
|
||||
<tr><td>SD02_LOWER_RSSI_LIMIT</td><td align="center">34(0x22)</td><td> L1 </td><td width="100">0x50,
|
||||
</td></tr>
|
||||
<tr><td>SD02_V22_VOL_HIGH</td><td align="center">35(0x23)</td><td> L1 V22 Volume Low - Sidetone </td><td width="100">0x01,
|
||||
</td></tr>
|
||||
<tr><td>SD02_V22_VOL_LOW</td><td align="center">36(0x24)</td><td> L1 V22 Volume High - Sidetone </td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_DSP_CID_THRES</td><td align="center">37(0x25)</td><td> L1 CID Threshold</td><td width="100">0x51,
|
||||
</td></tr>
|
||||
<tr><td>SD02_DSP_PATCH[50]</td><td align="center">38(0x26)</td><td> L50 DSP patch area 8 entries, each defines a flexible value for 1
|
||||
DSP parameter.
|
||||
Structure:
|
||||
1st Word: DSP instance (low, high byte)
|
||||
2nd Word: offset (low, high byte)
|
||||
3rd Word: value (low, high byte)</td><td width="100">0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
</td></tr>
|
||||
<tr><td>SD02_ARM_PATCH[40]</td><td align="center">88(0x58)</td><td> L40: 0=unused ARM patch area (5 entries): 5 X 2 X4 Bytes to modify any 30 bit ARM
|
||||
address location after protocol stack initialisation:
|
||||
1st Word: address (big endian)
|
||||
2nd Word: value (big endian)
|
||||
The 2 MSBits of the address define the
|
||||
write access type:
|
||||
00: Word access (u32)
|
||||
01: Halfword access (u16)
|
||||
10: Byte access (u8) </td><td width="100">0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,
|
||||
</td></tr>
|
||||
<tr><td>SD02_DSP_CLOCK</td><td align="center">128(0x80)</td><td> L1 </td><td width="100">0x02,
|
||||
</td></tr>
|
||||
<tr><td>SD02_FWROM_BOARDER</td><td align="center">129(0x81)</td><td> L1 </td><td width="100">0x1D,
|
||||
</td></tr>
|
||||
<tr><td>SD02_PORBGCFG</td><td align="center">130(0x82)</td><td> L1 PORBGCFG (POR calibration value) </td><td width="100">0xC0,
|
||||
</td></tr>
|
||||
<tr><td>SD02_FPTR</td><td align="center">131(0x83)</td><td> L1 MSB used to enable/disable use of this parameter 0=enable </td><td width="100">0xFF,
|
||||
</td></tr>
|
||||
<tr><td>SD02_FULL_POWER</td><td align="center">132(0x84)</td><td> DTPC Full Power </td><td width="100">0x7F,
|
||||
</td></tr>
|
||||
<tr><td>SD02_LOW_POWER</td><td align="center">133(0x85)</td><td> DTPC Low(medium) Power </td><td width="100">0xC4,
|
||||
</td></tr>
|
||||
<tr><td>SD02_LOWEST_POWER</td><td align="center">134(0x86)</td><td> DTPC Lowest Power</td><td width="100">0x03,
|
||||
</td></tr>
|
||||
<tr><td>SD02_AEC_LSP_ATTEN_RANGE[2]</td><td align="center">135(0x87)</td><td> L2 AEC_lsp_atten_range For all AEC parameters see User Manual
|
||||
Vega-Family ARM DSP RELEASE V7.5
|
||||
(or higher)</td><td width="100">0x00, 0x08,
|
||||
</td></tr>
|
||||
<tr><td>SD02_AEC_NLMS_ERL[2]</td><td align="center">137(0x89)</td><td> L2 </td><td width="100">0x40, 0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_AEC_X_CLIP[2]</td><td align="center">139(0x8B)</td><td> L2 </td><td width="100">0x0F, 0x1F,
|
||||
</td></tr>
|
||||
<tr><td>SD02_AEC_ECHO_RATIO[2]</td><td align="center">141(0x8D)</td><td> L2 </td><td width="100">0x00, 0x01,
|
||||
</td></tr>
|
||||
<tr><td>SD02_AEC_DENS_GAMMA_E_HIGH[2]</td><td align="center">143(0x8F)</td><td> L2 </td><td width="100">0xCC, 0x01,
|
||||
</td></tr>
|
||||
<tr><td>SD02_AEC_DENS_GAMMA_E_LOW[2]</td><td align="center">145(0x91)</td><td> L2 </td><td width="100">0x80, 0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_AEC_DENS_GAMMA_E_DT[2]</td><td align="center">147(0x93)</td><td> L2 </td><td width="100">0x66, 0x01,
|
||||
</td></tr>
|
||||
<tr><td>SD02_AEC_DENS_GAMMA_N[2]</td><td align="center">149(0x95)</td><td> L2 </td><td width="100">0x00, 0x01,
|
||||
</td></tr>
|
||||
<tr><td>SD02_AEC_DENS_TAIL_ALPHA[2]</td><td align="center">151(0x97)</td><td> L2 </td><td width="100">0x66, 0x66,
|
||||
</td></tr>
|
||||
<tr><td>SD02_AEC_DENS_TAIL_PORTION[2]</td><td align="center">153(0x99)</td><td> L2 </td><td width="100">0xD7, 0x03,
|
||||
</td></tr>
|
||||
<tr><td>SD02_AEC_DENS_NL_ATTEN[2]</td><td align="center">155(0x9B)</td><td> L2 </td><td width="100">0x00, 0x08,
|
||||
</td></tr>
|
||||
<tr><td>SD02_AEC_DENS_CNI_LEVEL[2]</td><td align="center">157(0x9D)</td><td> L2 </td><td width="100">0x00, 0x20,
|
||||
</td></tr>
|
||||
<tr><td>SD02_AEC_MODE[2]</td><td align="center">159(0x9F)</td><td> L2 </td><td width="100">0xF7, 0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_AEC_ECHO_PATH_DELAY[2]</td><td align="center">161(0xA1)</td><td> L2 </td><td width="100">0x00, 0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_DTPC_ENABLE</td><td align="center">163(0xA3)</td><td></td><td width="100">0x01,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RSSI_TIMER</td><td align="center">164(0xA4)</td><td></td><td width="100">0x64,
|
||||
</td></tr>
|
||||
<tr><td>SD02_DRPC_RSSI_THRESH</td><td align="center">165(0xA5)</td><td></td><td width="100">0x80,
|
||||
</td></tr>
|
||||
<tr><td>SD02_DRPC_RSSI_CORRECT</td><td align="center">166(0xA6)</td><td></td><td width="100">0x1C,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RVR2C_INIT</td><td align="center">167(0xA7)</td><td> L1 </td><td width="100">0x40,
|
||||
</td></tr>
|
||||
<tr><td>SD02_FI_TRIG_GPIO</td><td align="center">168(0xA8)</td><td> L1 </td><td width="100">0x0,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RF19APU_SUPPORT_FCC</td><td align="center">169(0xA9)</td><td> L1 </td><td width="100">0x0,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RF19APU_TC_DELAY</td><td align="center">170(0xAA)</td><td> L1 </td><td width="100">0x3,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RF19APU_GAP_DELAY</td><td align="center">171(0xAB)</td><td> L1 </td><td width="100">0x8,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RF19APU_GAP_DELAY_FADOFF</td><td align="center">172(0xAC)</td><td> L1 </td><td width="100">0xA,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RF19APU_TRSSI_DELAY</td><td align="center">173(0xAD)</td><td> L1 </td><td width="100">0x25,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RF19APU_TRSSI_DELAY_FADOFF</td><td align="center">174(0xAE)</td><td> L1 </td><td width="100">0x13,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RF19APU_DEVIATION</td><td align="center">175(0xAF)</td><td> L1 </td><td width="100">0x13,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RF19APU_ATEST</td><td align="center">176(0xB0)</td><td> L1 </td><td width="100">0xF,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RF19APU_DTEST</td><td align="center">177(0xB1)</td><td> L1 </td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RF19APU_PA2_COMP</td><td align="center">178(0xB2)</td><td> L1 </td><td width="100">0x3C,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RF19APU_PA_ON</td><td align="center">179(0xB3)</td><td> L1 </td><td width="100">0x33,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RF19APU_GAIN</td><td align="center">180(0xB4)</td><td> L1 </td><td width="100">0x0,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RF19APU_MLSE</td><td align="center">181(0xB5)</td><td>L1 Bit Meaning 0 MLSE active
|
||||
1 Dynamic MLSE active
|
||||
2 MLSE CLK Polarity
|
||||
3 MLSE deviation 0 <20> 288, 1 <20> 360
|
||||
4 4 bit field giving MLSE delay in bits
|
||||
5 If set to 0 <20> delay defaults to 9
|
||||
6 <20>
|
||||
7 <20>
|
||||
</td><td width="100">0x1,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RF19APU_KCALOVR</td><td align="center">182(0xB6)</td><td>L1 </td><td width="100">0x0,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RF19APU_KCALOVR_LINEAR</td><td align="center">183(0xB7)</td><td>L1 Linear KCAL correction, 4 LSB A factor (KCALOVR_A) 4 MSB B factor (KCALOVR_B)</td><td width="100">0x88,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RF19APU_BEACON_LP</td><td align="center">184(0xB8)</td><td>L1 Bit0 - Enable. Bit1-7 - Value of power when HS on cradle</td><td width="100">0xC1,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RF19APU_GENERIC_ADD1[2]</td><td align="center">185(0xB9)</td><td> L2 </td><td width="100">0x00,0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RF19APU_GENERIC_ADD2[2]</td><td align="center">187(0xBB)</td><td> L2 </td><td width="100">0x00,0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RF19APU_GENERIC_ADD3[2]</td><td align="center">189(0xBD)</td><td> L2 </td><td width="100">0x00,0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RF19APU_GENERIC_ADD4[2]</td><td align="center">191(0xBF)</td><td> L2 </td><td width="100">0x00,0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RF19APU_GENERIC_CONTROL</td><td align="center">193(0xC1)</td><td>L1 bit [1:0] = control of SD02_RF19APU_GENERIC_ADD1
|
||||
bit [3:2] = control of SD02_RF19APU_GENERIC_ADD2
|
||||
bit [5:4] = control of
|
||||
SD02_RF19APU_GENERIC_ADD3
|
||||
bit [7:6] = control of SD02_RF19APU_GENERIC_ADD4
|
||||
|
||||
for each of the above:
|
||||
if 0 (or 3): use the appropriate register as RF indirect mapping 0~256
|
||||
if 1: use the appropriate register as direct space mapping 0 <20> 104
|
||||
if 2: use the appropriate register as analog indirect space mapping 0 <20> 69
|
||||
</td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_FNR_N_LOW[2]</td><td align="center">194(0xC2)</td><td> L2 FNR SD02_FNR_N_LOW </td><td width="100">0x00,0x01,
|
||||
</td></tr>
|
||||
<tr><td>SD02_FNR_N_HIGH[2]</td><td align="center">196(0xC4)</td><td> L2 FNR SD02_FNR_N_HIGH </td><td width="100">0x40,0x01,
|
||||
</td></tr>
|
||||
<tr><td>SD02_FNR_NR_LIMIT[2]</td><td align="center">198(0xC6)</td><td> L2 FNR SD02_FNR_NR_LIMIT </td><td width="100">0x00,0x28,
|
||||
</td></tr>
|
||||
<tr><td>SD02_FNR_spDETCC[2]</td><td align="center">200(0xC8)</td><td> L2 FNR SD02_FNR_spDETCC </td><td width="100">0x00,0x02,
|
||||
</td></tr>
|
||||
<tr><td>SD02_FNR_Ton_detect[2]</td><td align="center">202(0xCA)</td><td> L2 FNR SD02_FNR_Ton_detect </td><td width="100">0x00,0x06,
|
||||
</td></tr>
|
||||
<tr><td>SD02_CR_OPTIONS</td><td align="center">204(0xCC)</td><td> L1 - Bit 0-1: Codec preferred (0-G726,1-G727,other reserved)
|
||||
Bit 2: Action in Normal - unused
|
||||
Bit 3: Action in Protected - unused
|
||||
Bit 4: Opt G726 - activate improved - unused
|
||||
Bit 5-6: Mode (0-Auto,1-Normal,2-Protected,3-Reserved) - not relevant in FT
|
||||
Bit 7: Enable/Disable.
|
||||
</td><td width="100">0x81,
|
||||
</td></tr>
|
||||
<tr><td>SD02_CR_SB_PATT</td><td align="center">205(0xCD)</td><td>L1 - Padding option for SB (i.e. nibble) either 4 bits or 8 bitsfor WB codecs </td><td width="100">0xFF,
|
||||
</td></tr>
|
||||
<tr><td>SD02_CR_FB_PATT</td><td align="center">206(0xCE)</td><td>L1 - Padding option for FB (i.e. all frame) either 4 bits or 8 bits for WB codecs </td><td width="100">0xFF,
|
||||
</td></tr>
|
||||
<tr><td>SD02_CR_START_MUTE_NR</td><td align="center">207(0xCF)</td><td>L1 - Number of errors to start full frame mute </td><td width="100">0x1E,
|
||||
</td></tr>
|
||||
<tr><td>SD02_CR_STOP_MUTE_NR</td><td align="center">208(0xD0)</td><td>L1 - Number of errors to stop full frame mute </td><td width="100">0x0F,
|
||||
</td></tr>
|
||||
<tr><td>SD02_CR_DECAY[2]</td><td align="center">209(0xD1)</td><td>L2 - First Byte - Decay MSB, Second byte : Decay LSB (in Q12) </td><td width="100">0x0F,
|
||||
|
||||
0xD4,
|
||||
</td></tr>
|
||||
<tr><td>SD02_CR_SATURATION</td><td align="center">211(0xD3)</td><td>L1 - Saturation value for FB filter </td><td width="100">0x28,
|
||||
</td></tr>
|
||||
<tr><td>SD02_CR_MSG</td><td align="center">212(0xD4)</td><td>L1 - Nr of Frames before msg mute/unmute </td><td width="100">0x1E,
|
||||
</td></tr>
|
||||
<tr><td>SD02_CONTROL</td><td align="center">213(0xD5)</td><td>L1 - Enable Clock Divider Selection</td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_CLK_DIV[3]</td><td align="center">214(0xD6)</td><td>L3 - Clock Divider Setting </td><td width="100">0x00,0x00,0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_CLK_SEL[2]</td><td align="center">217(0xD9)</td><td>L2 - Clock Selection </td><td width="100">0x00,0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_AHB_PLL_SETTING_LOW[4]</td><td align="center">219(0xDB)</td><td>L4 - AHB PLL LOW Setting </td><td width="100">0x00,0x00,0x00,0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_AHB_PLL_SETTING_MED[4]</td><td align="center">223(0xDF)</td><td>L4 - AHB PLL MED Setting </td><td width="100">0x00,0x00,0x00,0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_AHB_PLL_SETTING_HIGH[4]</td><td align="center">227(0xE3)</td><td>L4 - AHB PLL HIGH Setting </td><td width="100">0x00,0x00,0x00,0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_CP_FEATURES</td><td align="center">231(0xE7)</td><td>L1 - CP features Setting </td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_CP_CONFIGURATION_OFFSET</td><td align="center">232(0xE8)</td><td>Bit 0: If set, SYPO alignment is offset by 1 slot,Bit 2: Dummy Merge to first traffic</td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_CP_ULE_FLAGS</td><td align="center">233(0xE9)</td><td> L1 - Phase 1: 0x2, Phase 1.2: 0x6 ,Phase 2: 0xA, Phase 3: 0xE</td><td width="100">0x0A,
|
||||
</td></tr>
|
||||
<tr><td>SD02_DUMMY_BEARER_THRES_ADAPT_THRESH</td><td align="center">234(0xEA)</td><td></td><td width="100">0x58,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RF19APUZ_EXT_LNA</td><td align="center">235(0xEB)</td><td>L1 - CP features Setting </td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RFIC_SELECTION</td><td align="center">236(0xEC)</td><td>L1 - CP features Setting </td><td width="100">0x01,
|
||||
</td></tr>
|
||||
<tr><td>SD02_UNUSED_210</td><td align="center">237(0xED)</td><td> L1 </td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_PHS_SCAN_PARAM</td><td align="center">238(0xEE)</td><td> JDECT parameters: RSSI threshold for PHS detection. PHS scan every 10 seconds. </td><td width="100">0x0C,
|
||||
</td></tr>
|
||||
<tr><td>SD02_JDECT_LEVEL1_M82</td><td align="center">239(0xEF)</td><td> minus 82 dBm RSSI threshold for Japan regulation </td><td width="100">0x0B,
|
||||
</td></tr>
|
||||
<tr><td>SD02_JDECT_LEVEL2_M62</td><td align="center">240(0xF0)</td><td> minus 62 dBm RSSI threshold for Japan regulation </td><td width="100">0x11,
|
||||
</td></tr>
|
||||
<tr><td>SD02_JDECT_CERTAINTY_PARAM</td><td align="center">241(0xF1)</td><td> PHS detection Certainty parameters.(upper nibble reduces miss detection. lower nibble reduces false alaram) </td><td width="100">0x55,
|
||||
</td></tr>
|
||||
<tr><td>SD02_ULE_DUMMY_TRAF_THRESH</td><td align="center">242(0xF2)</td><td>L1 - Threshold for dummy traffic bearer merge</td><td width="100">0x03,
|
||||
</td></tr>
|
||||
<tr><td>SD02_PWR_ADC_INPUT</td><td align="center">243(0xF3)</td><td> L1 Input source of the Auxiliary A/D </td><td width="100">0x0E,
|
||||
</td></tr>
|
||||
<tr><td>SD02_PWR_POR_INPUT</td><td align="center">244(0xF4)</td><td> L1 Input source of the POR A/D </td><td width="100">0x16,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RES_FACTOR</td><td align="center">245(0xF5)</td><td> L1 Resistor Factor on AUX input </td><td width="100">0x02,
|
||||
</td></tr>
|
||||
<tr><td>SD02_UART_DELAY_TIMER</td><td align="center">246(0xF6)</td><td>L1 - Selects the timer in 10 msec to delay UART</td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_V21_VOL_HIGH</td><td align="center">247(0xF7)</td><td>L2 SD02_V21_VOL_HIGH </td><td width="100">0x01,
|
||||
</td></tr>
|
||||
<tr><td>SD02_V21_VOL_LOW</td><td align="center">248(0xF8)</td><td>L2 SD02_V21_VOL_LOW </td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_PRODUCTION_TEST_RSSI_THRESH_DOWNLINK</td><td align="center">249(0xF9)</td><td>L1 SD02_PRODUCTION_TEST_RSSI_THRESH_DOWNLINK </td><td width="100">0x88,
|
||||
</td></tr>
|
||||
<tr><td>SD02_PRODUCTION_TEST_RSSI_THRESH_UPLINK</td><td align="center">250(0xFA)</td><td>L1 SD02_PRODUCTION_TEST_RSSI_THRESH_UPLINK </td><td width="100">0x88,
|
||||
</td></tr>
|
||||
<tr><td>SD02_FIXED_CARRIER_OFFSET</td><td align="center">251(0xFB)</td><td>L1 SD02_FIXED_CARRIER_OFFSET - Bit(0..5) : Carrier to use ,
|
||||
Bit(6) : Enable fixed PM carrier ,
|
||||
Bit(7) : Seta fixed carrier [bit(0..4)] in RF file. When using this option you MUST set PP+FP with the same carrier.
|
||||
</td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_TEMP_MEASURE_TIME</td><td align="center">252(0xFC)</td><td>L1 SD02_TEMP_MEASURE_TIME. bit 0-1 temperature measurement period for VCAL. 2 bits for 4 values 0,1,2,3 == 5,1,2,3 minutes. default value == 0
|
||||
</td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>FNCA_DRV_UNUSED</td><td align="center">253(0xFD)</td><td> <----------- unused </td><td width="100">0xCC,</td></tr>
|
||||
<tr><td>SD02_SMS_FW_VERSION[6]</td><td align="center">253(0xFD)</td><td> L6 </td><td width="100">0xCC,0x21,0x10,0x20,0x03,0xCC,
|
||||
</td></tr>
|
||||
<tr><td>SD02_SMS_SMTE_RESOURCES</td><td align="center">259(0x103)</td><td> L1 </td><td width="100">0x11,
|
||||
</td></tr>
|
||||
<tr><td>SD02_SMS_BREAK_SMS_CALL</td><td align="center">260(0x104)</td><td> L1 </td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_SMS_SUBADDR_MASK[2]</td><td align="center">261(0x105)</td><td> L2 </td><td width="100">0x00,0x03,
|
||||
</td></tr>
|
||||
<tr><td>SD02_SMS_MIN_BYTES_FREE</td><td align="center">263(0x107)</td><td> L1 </td><td width="100">0x28,
|
||||
</td></tr>
|
||||
<tr><td>SD02_SMS_SMSC_OFFHOOK</td><td align="center">264(0x108)</td><td> L1 </td><td width="100">0x14,
|
||||
</td></tr>
|
||||
<tr><td>SD02_SMS_SMSC_ESTABLISH</td><td align="center">265(0x109)</td><td> L1 </td><td width="100">0x14,
|
||||
</td></tr>
|
||||
<tr><td>SD02_SMS_HACK_CODE</td><td align="center">266(0x10A)</td><td> L1 </td><td width="100">0x10,
|
||||
</td></tr>
|
||||
<tr><td>SD02_SMS_TIMER_T2[2]</td><td align="center">267(0x10B)</td><td> L2 </td><td width="100">0x02,0xF8,
|
||||
</td></tr>
|
||||
<tr><td>SD02_SMS_TIMER_T3[2]</td><td align="center">269(0x10D)</td><td> L2 </td><td width="100">0x02,0xEE,
|
||||
</td></tr>
|
||||
<tr><td>SD02_SMS_TIMER_T6[2]</td><td align="center">271(0x10F)</td><td> L2 </td><td width="100">0x00,0x14,
|
||||
</td></tr>
|
||||
<tr><td>SD02_SMS_TIMER_T10</td><td align="center">273(0x111)</td><td> L1 </td><td width="100">0x0A,
|
||||
</td></tr>
|
||||
<tr><td>SD02_SMS_TIMER_T10BIS</td><td align="center">274(0x112)</td><td> L1 </td><td width="100">0x35,
|
||||
</td></tr>
|
||||
<tr><td>SD02_SMS_FSK_FREQ0[2]</td><td align="center">275(0x113)</td><td> L2 </td><td width="100">0x00,0x15,
|
||||
</td></tr>
|
||||
<tr><td>SD02_SMS_FSK_FREQ1[2]</td><td align="center">277(0x115)</td><td> L2 </td><td width="100">0x00,0x0D,
|
||||
</td></tr>
|
||||
<tr><td>SD02_SMS_FSK_CIT_VOL[2]</td><td align="center">279(0x117)</td><td> L2 </td><td width="100">0x13,0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_SMS_FSK_TIMER_PREAM</td><td align="center">281(0x119)</td><td> L1 </td><td width="100">0x0D,
|
||||
</td></tr>
|
||||
<tr><td>SD02_SMS_PROT_RESP_TYPE</td><td align="center">282(0x11A)</td><td> L1 </td><td width="100">0x80,
|
||||
</td></tr>
|
||||
<tr><td>SD02_SMS_PROT_BEARER_CAP[20]</td><td align="center">283(0x11B)</td><td> L20 </td><td width="100">0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
</td></tr>
|
||||
<tr><td>SD02_SMS_PROT(k)[42]</td><td align="center">303(0x12F)</td><td> 21 * Nr_of_Protocols. Where 21 is the length of protocol. </td><td width="100">0x80,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0x80,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
</td></tr>
|
||||
<tr><td>SD02_SMS_SMSC_SETTINGS</td><td align="center">345(0x159)</td><td> L1 </td><td width="100">0x12,
|
||||
</td></tr>
|
||||
<tr><td>SD02_SMS_SMSC_VALIDITY_TIME</td><td align="center">346(0x15A)</td><td> L1 </td><td width="100">0x03,
|
||||
</td></tr>
|
||||
<tr><td>SD02_SMS_SMSC_EMAIL_SEP</td><td align="center">347(0x15B)</td><td> L1 Email Separator</td><td width="100">0x20,
|
||||
</td></tr>
|
||||
<tr><td>SD02_SMS_SMSC_OPERATOR</td><td align="center">348(0x15C)</td><td> L1 </td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_SMS_SMSC_UNUSED[2]</td><td align="center">349(0x15D)</td><td> L2 </td><td width="100">0x00,0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_SMS_SMSC_INC_NUM[8]</td><td align="center">351(0x15F)</td><td> L8 </td><td width="100">0x04,0x21,0x1F,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,
|
||||
</td></tr>
|
||||
<tr><td>SD02_SMS_SMSC_OUT_NUM[8]</td><td align="center">359(0x167)</td><td> L8 </td><td width="100">0x42,0x11,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,
|
||||
</td></tr>
|
||||
<tr><td>SD02_SMS_SMSC_EMAIL_NUM[8]</td><td align="center">367(0x16F)</td><td> L8 </td><td width="100">0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,
|
||||
</td></tr>
|
||||
<tr><td>SD02_SMS_SMSC(i)[90]</td><td align="center">375(0x177)</td><td> SMSC area end SMSC * 30. Where 30 is the length of data for one SMSC </td><td width="100">0x01,
|
||||
|
||||
0x03,
|
||||
|
||||
0x20,
|
||||
|
||||
0x00,
|
||||
|
||||
0x00,0x00,
|
||||
|
||||
0x01,0x93,0x01,0x0F,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0x01,0x93,0x01,0x0F,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0x08,0x00,0xF0,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0x01,
|
||||
|
||||
0x03,
|
||||
|
||||
0x20,
|
||||
|
||||
0x00,
|
||||
|
||||
0x00,0x00,
|
||||
|
||||
0x20,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0x20,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0x01,
|
||||
|
||||
0x03,
|
||||
|
||||
0x20,
|
||||
|
||||
0x05,
|
||||
|
||||
0x00,0x00,
|
||||
|
||||
0x01,0x90,0x01,0x50,
|
||||
|
||||
0x4F,0xFF,0xFF,0xFF,
|
||||
|
||||
0x01,0x90,0x01,0x50,
|
||||
|
||||
0x4F,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,
|
||||
|
||||
0xFF,0xFF,0xFF,0xFF,
|
||||
</td></tr>
|
||||
<tr><td>SD02_ACV10_VOLUME[2]</td><td align="center">465(0x1D1)</td><td> L2 ACV10 Volume Control for SPK 2 bytes </td><td width="100">0x08,0x00,
|
||||
</td></tr>
|
||||
<tr><td>FNCA_SMS_UNUSED[2]</td><td align="center">467(0x1D3)</td><td> <----------- unused </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_CALL_BARRING[30]</td><td align="center">469(0x1D5)</td><td> L30 call barring data </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_MASTER_PIN[4]</td><td align="center">499(0x1F3)</td><td> L4 master mode pin code, reset value e.g. FF FF 15 90 </td><td width="100">0xFF,0xFF,0x15,0x90,
|
||||
</td></tr>
|
||||
<tr><td>SD02_AC[4]</td><td align="center">503(0x1F7)</td><td> L4 authentication code, e.g. FF FF 15 90</td><td width="100">0xFF,0xFF,0x00,0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RING_ON_OFF</td><td align="center">507(0x1FB)</td><td> L1 ring on/off enabled </td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_ULE_AC[4]</td><td align="center">508(0x1FC)</td><td> L4 ULE authentication code, e.g. FF FF 00 00</td><td width="100">0xFF,0xFF,0x00,0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_EEPROM0_END</td><td align="center">512(0x200)</td><td></td><td width="100"></td></tr>
|
||||
<tr><td>SD02_BOOT_DELAY</td><td align="center">513(0x201)</td><td> L1 Boot up delay in seconds </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_HAN_START_FILE_0[8514]</td><td align="center">514(0x202)</td><td><a href="bhanEepromDefaults.html">HAN EEPROM Block</a> </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_HAN_END_FILE_0</td><td align="center">9028(0x2344)</td><td> HAN EEPROM Block End</td><td width="100"></td></tr>
|
||||
<tr><td>SD02_ULE_SUB_IPUI[5]</td><td align="center">9029(0x2345)</td><td> L5 Data: IPUI </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_ULE_SUB_TPUI[3]</td><td align="center">9034(0x234A)</td><td> L3 Data: TPUI </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_ULE_SUB_DCK[16]</td><td align="center">9037(0x234D)</td><td> L16 Data: DCK </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_ULE_SUB_UAK[16]</td><td align="center">9053(0x235D)</td><td> L16 Data: UAK </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_ULE_SUB_AC[4]</td><td align="center">9069(0x236D)</td><td> L4 Data: authentication code AC </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_ULE_SUB_UAK_AUTH</td><td align="center">9073(0x2371)</td><td> L1 Data: UAK authorization </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_ULE_SUB_STATUS</td><td align="center">9074(0x2372)</td><td> L1 Data: status </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_ULE_SUB_HANDSET_NR</td><td align="center">9075(0x2373)</td><td> L1 Data: handset number </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_ULE_SUB_DCK_ASSIGNED[2]</td><td align="center">9076(0x2374)</td><td> L1 Data: DCK assigned </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_ULE_SUB_FEATURES</td><td align="center">9078(0x2376)</td><td> L1 CP Features </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_ULE_SUB_DEFCK[16]</td><td align="center">9079(0x2377)</td><td> L16 Data: Default Cipher Key </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_ULE_SUB_DEFCK_ASSIGNED</td><td align="center">9095(0x2387)</td><td> L1 Data: DefCK assigned </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_ULE_SUB_CCM_CK[16]</td><td align="center">9096(0x2388)</td><td> L16 Data: CCM Key for ULE </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_ULE_SUB_DLC_OPERATING_MODE</td><td align="center">9112(0x2398)</td><td> L1 ULE DLC operating mode </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_ULE_SUB_HL_FEATURES</td><td align="center">9113(0x2399)</td><td> L1 ULE HL features </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_ULE_SUB_RESERVED[4]</td><td align="center">9114(0x239A)</td><td> L4 Reserved for future use </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_ULE_SUB_NEXT_RX_SEQUENCE_NUMBER[3]</td><td align="center">9118(0x239E)</td><td> L3 RX Sequence number </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_ULE_SUB_NEXT_TX_SEQUENCE_NUMBER[3]</td><td align="center">9121(0x23A1)</td><td> L3 TX Sequence number </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_ULE_SUB_OVER_A_FIELD_NEXT_RX_SEQUENCE_NUMBER[3]</td><td align="center">9124(0x23A4)</td><td> L3 RX Sequence number </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_ULE_SUB_OVER_A_FIELD_NEXT_TX_SEQUENCE_NUMBER</td><td align="center">9127(0x23A7)</td><td> L3 TX Sequence number </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_ULE_SUB_LEN[13978]</td><td align="center">101(0x65)</td><td> End of first subscribtion </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_ULE_SUB_UNUSED[5]</td><td align="center">14079(0x36FF)</td><td> <----------- unused </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_MD5_SIGNATURE[16]</td><td align="center">14084(0x3704)</td><td> L16 16 bytes of MD5 signature</td><td width="100"></td></tr>
|
||||
<tr><td>SD02_MD5_END</td><td align="center">14100(0x3714)</td><td> L0</td><td width="100"></td></tr>
|
||||
<tr><td>SD02_MD5_UNUSED</td><td align="center">14093(0x370D)</td><td> <----------- unused </td><td width="100"></td></tr>
|
||||
<tr><td>FNCA_MMI_UNUSED[7]</td><td align="center">14093(0x370D)</td><td> <----------- unused </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_SUB_LAL</td><td align="center">14100(0x3714)</td><td> L1 </td><td width="100">0x24,
|
||||
</td></tr>
|
||||
<tr><td>SD02_SUB_Y</td><td align="center">14101(0x3715)</td><td> L1 </td><td width="100">0x24,
|
||||
</td></tr>
|
||||
<tr><td>SD02_DSP_CID_MARK_MODE</td><td align="center">14102(0x3716)</td><td> L1 DSP CID start state for mark mode - upper byte (Bits 8-15) </td><td width="100">0x40,
|
||||
</td></tr>
|
||||
<tr><td>SD02_DSP_CID_SEIZURE_MODE</td><td align="center">14103(0x3717)</td><td> L1 DSP CID start state for seizure mode - upper byte (Bits 8-15) </td><td width="100">0x40,
|
||||
</td></tr>
|
||||
<tr><td>SD02_DSP_THP2_KI[2]</td><td align="center">14104(0x3718)</td><td> L2 DSP THP2 - ki - input scaling factor - Currently unused </td><td width="100">0x10,
|
||||
|
||||
0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_DSP_TXV[2]</td><td align="center">14106(0x371A)</td><td> L2 AUDIO TX volume control </td><td width="100">0x23,
|
||||
|
||||
0xBC,
|
||||
</td></tr>
|
||||
<tr><td>SD02_DSP_RXV[2]</td><td align="center">14108(0x371C)</td><td> L2 AUDIO RX volume control </td><td width="100">0x10,
|
||||
|
||||
0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_DSP_RLP[2]</td><td align="center">14110(0x371E)</td><td> L2 AUDIO RLP volume control </td><td width="100">0x20,
|
||||
|
||||
0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_AFE_AFELGC1</td><td align="center">14112(0x3720)</td><td> L1 AFE gains </td><td width="100">0x23,
|
||||
</td></tr>
|
||||
<tr><td>SD02_AFE_AFEMSGC1_NORMAL</td><td align="center">14113(0x3721)</td><td> L1 AFE gains normal mode </td><td width="100">0x32,
|
||||
</td></tr>
|
||||
<tr><td>SD02_MIN_RING_ON</td><td align="center">14114(0x3722)</td><td> min. DAEV_RING_ON </td><td width="100">2,
|
||||
</td></tr>
|
||||
<tr><td>SD02_MIN_RING_OFF</td><td align="center">14115(0x3723)</td><td> min. DAEV_RING_OFF </td><td width="100">3,
|
||||
</td></tr>
|
||||
<tr><td>SD02_MIN_DTMF_ON</td><td align="center">14116(0x3724)</td><td> min. DAEV_DTMF_ON </td><td width="100">2,
|
||||
</td></tr>
|
||||
<tr><td>SD02_MIN_DTMF_OFF</td><td align="center">14117(0x3725)</td><td> min. DAEV_DTMF_OFF </td><td width="100">3,
|
||||
</td></tr>
|
||||
<tr><td>SD02_MIN_CPDS_ON</td><td align="center">14118(0x3726)</td><td> min. DAEV_CPDS_ON </td><td width="100">2,
|
||||
</td></tr>
|
||||
<tr><td>SD02_MIN_CPDS_OFF</td><td align="center">14119(0x3727)</td><td> min. DAEV_CPDS_OFF </td><td width="100">2,
|
||||
</td></tr>
|
||||
<tr><td>SD02_MIN_CPDB_ON</td><td align="center">14120(0x3728)</td><td> min. DAEV_CPDB_ON </td><td width="100">4,
|
||||
</td></tr>
|
||||
<tr><td>SD02_MIN_CPDB_OFF</td><td align="center">14121(0x3729)</td><td> min. DAEV_CPDB_OFF </td><td width="100">4,
|
||||
</td></tr>
|
||||
<tr><td>SD02_MIN_FXD1_ON</td><td align="center">14122(0x372A)</td><td> min. DAEV_FXD1_ON </td><td width="100">3,
|
||||
</td></tr>
|
||||
<tr><td>SD02_MIN_FXD1_OFF</td><td align="center">14123(0x372B)</td><td> min. DAEV_FXD1_OFF </td><td width="100">1,
|
||||
</td></tr>
|
||||
<tr><td>SD02_MIN_FXD2_ON</td><td align="center">14124(0x372C)</td><td> min. DAEV_FXD2_ON </td><td width="100">3,
|
||||
</td></tr>
|
||||
<tr><td>SD02_MIN_FXD2_OFF</td><td align="center">14125(0x372D)</td><td> min. DAEV_FXD2_OFF </td><td width="100">1,
|
||||
</td></tr>
|
||||
<tr><td>SD02_MIN_GTD1_ON</td><td align="center">14126(0x372E)</td><td> min. DAEV_GTD1_ON </td><td width="100">3,
|
||||
</td></tr>
|
||||
<tr><td>SD02_MIN_GTD1_OFF</td><td align="center">14127(0x372F)</td><td> min. DAEV_GTD1_OFF </td><td width="100">1,
|
||||
</td></tr>
|
||||
<tr><td>SD02_MIN_CAS_ON</td><td align="center">14128(0x3730)</td><td> min. DAEV_CAS_ON </td><td width="100">2,
|
||||
</td></tr>
|
||||
<tr><td>SD02_MIN_CAS_OFF</td><td align="center">14129(0x3731)</td><td> min. DAEV_CAS_OFF </td><td width="100">3,
|
||||
</td></tr>
|
||||
<tr><td>SD02_MIN_CAS_REQUIRED</td><td align="center">14130(0x3732)</td><td> min. DAEV_CAS_REQUIRED </td><td width="100">0x60,
|
||||
</td></tr>
|
||||
<tr><td>SD02_DTMF_ON</td><td align="center">14131(0x3733)</td><td> min. DTMF tone on duration </td><td width="100">40,
|
||||
</td></tr>
|
||||
<tr><td>SD02_DTMF_OFF</td><td align="center">14132(0x3734)</td><td> min. pause after DTMF </td><td width="100">40,
|
||||
</td></tr>
|
||||
<tr><td>SD02_DIAL_PAUSE</td><td align="center">14133(0x3735)</td><td> min. dial pause </td><td width="100">125,
|
||||
</td></tr>
|
||||
<tr><td>SD02_DTMF_VOL_LOW</td><td align="center">14134(0x3736)</td><td> V6dB low DTMF frequency </td><td width="100">0x40,
|
||||
</td></tr>
|
||||
<tr><td>SD02_DTMF_VOL_LOW_HIGH</td><td align="center">14135(0x3737)</td><td> V6dB low DTMF frequency high </td><td width="100">0x24,
|
||||
</td></tr>
|
||||
<tr><td>SD02_DTMF_VOL_HIGH</td><td align="center">14136(0x3738)</td><td> V6dB high DTMF frequency </td><td width="100">0xB0,
|
||||
</td></tr>
|
||||
<tr><td>SD02_DTMF_VOL_HIGH_HIGH</td><td align="center">14137(0x3739)</td><td> V6dB high DTMF frequency high </td><td width="100">0x2D,
|
||||
</td></tr>
|
||||
<tr><td>SD02_PULSE_MAKE_LENGTH</td><td align="center">14138(0x373A)</td><td> L1 PSTN:dialPULSE </td><td width="100">40,
|
||||
</td></tr>
|
||||
<tr><td>SD02_PULSE_BREAK_LENGTH</td><td align="center">14139(0x373B)</td><td> L1 PSTN:dialPULSE </td><td width="100">60,
|
||||
</td></tr>
|
||||
<tr><td>SD02_PULSE_IDP_LENGTH</td><td align="center">14140(0x373C)</td><td> L1 PSTN:dialPULSE </td><td width="100">80,
|
||||
</td></tr>
|
||||
<tr><td>SD02_LCURRENT_CYCLE</td><td align="center">14141(0x373D)</td><td> L1 PSTN:PCA1070 </td><td width="100">50,
|
||||
</td></tr>
|
||||
<tr><td>SD02_LCURRENT_IDP</td><td align="center">14142(0x373E)</td><td> L1 PSTN:PCA1070 </td><td width="100">32,
|
||||
</td></tr>
|
||||
<tr><td>SD02_PAUSE_LENGTH</td><td align="center">14143(0x373F)</td><td> L1 PSTN/AUDIO:dial</td><td width="100">30,
|
||||
</td></tr>
|
||||
<tr><td>SD02_FLASH_LENGTH</td><td align="center">14144(0x3740)</td><td> L1 PSTN:dial </td><td width="100">10,
|
||||
</td></tr>
|
||||
<tr><td>SD02_EARTH_LENGTH</td><td align="center">14145(0x3741)</td><td> L1 PSTN:dial </td><td width="100">40,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RING_MIN</td><td align="center">14146(0x3742)</td><td> L1 PSTN:ringer </td><td width="100">18,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RING_MAX</td><td align="center">14147(0x3743)</td><td> L1 PSTN:ringer </td><td width="100">50,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RON_DETECT</td><td align="center">14148(0x3744)</td><td> L1 PSTN:ringer </td><td width="100">9,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RON_HOLD</td><td align="center">14149(0x3745)</td><td> L1 PSTN:ringer </td><td width="100">20,
|
||||
</td></tr>
|
||||
<tr><td>SD02_ROFF_DETECT</td><td align="center">14150(0x3746)</td><td> L1 PSTN:ringer </td><td width="100">11,
|
||||
</td></tr>
|
||||
<tr><td>SD02_ROFF_HOLD</td><td align="center">14151(0x3747)</td><td> L1 PSTN:ringer </td><td width="100">25,
|
||||
</td></tr>
|
||||
<tr><td>SD02_LIF_CURR_LO</td><td align="center">14152(0x3748)</td><td> L1 PSTN:l.current </td><td width="100">0,
|
||||
</td></tr>
|
||||
<tr><td>SD02_LIF_CURR_HI</td><td align="center">14153(0x3749)</td><td> L1 +1 </td><td width="100">0xFF,
|
||||
</td></tr>
|
||||
<tr><td>SD02_WETTING_TIME</td><td align="center">14154(0x374A)</td><td> L1 Wetting Pulse </td><td width="100">0x01,
|
||||
</td></tr>
|
||||
<tr><td>SD02_DTMF_D_TIME</td><td align="center">14155(0x374B)</td><td> L1 DTMF-D for CAS </td><td width="100">0x23,
|
||||
</td></tr>
|
||||
<tr><td>SD02_STUTTER_CYCLES</td><td align="center">14156(0x374C)</td><td> L1 # of Stutter </td><td width="100">0x0A,
|
||||
</td></tr>
|
||||
<tr><td>SD02_CID_DET_ENBL_TIME</td><td align="center">14157(0x374D)</td><td> L1 CID detection 100ms steps </td><td width="100">38,
|
||||
</td></tr>
|
||||
<tr><td>SD02_FSK_START_TIME</td><td align="center">14158(0x374E)</td><td> L1 CID-2 detection </td><td width="100">0xE0,
|
||||
</td></tr>
|
||||
<tr><td>SD02_FSK_OFFHOOK_TIME[2]</td><td align="center">14159(0x374F)</td><td> L2 CID-2 detection </td><td width="100">0xAD,
|
||||
|
||||
0x03,
|
||||
</td></tr>
|
||||
<tr><td>SD02_AFE_AFEMSGC1_HF</td><td align="center">14161(0x3751)</td><td> L1 AFE gains for Handsfree </td><td width="100">0x32,
|
||||
</td></tr>
|
||||
<tr><td>SD02_AFE_AFEMSGC2</td><td align="center">14162(0x3752)</td><td> L1 AFE gains </td><td width="100">0x51,
|
||||
</td></tr>
|
||||
<tr><td>SD02_EAR_VOL_TAB[10]</td><td align="center">14163(0x3753)</td><td> L10 10 volume values for polyphonic ringing (increasing order)</td><td width="100">0x02,0x03,0x04,0x06,0x08,
|
||||
|
||||
0x09,0x0A,0x0B,0x0c,0x0d,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RVBC1C_VAL</td><td align="center">14173(0x375D)</td><td> L1 Codec 1 (In base Spk) control </td><td width="100">0xC0,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RVBC1G_VAL</td><td align="center">14174(0x375E)</td><td> L1 Codec 1 (In base Spk) gain </td><td width="100">0x4F,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RVBC1C_VAL_HF</td><td align="center">14175(0x375F)</td><td> L1 Codec 1 (In base Spk) control for HF</td><td width="100">0xC0,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RVBC1G_VAL_HF</td><td align="center">14176(0x3760)</td><td> L1 Codec 1 (In base Spk) gain for HF</td><td width="100">0x4F,
|
||||
</td></tr>
|
||||
<tr><td>SD02_WBE_ENABLE</td><td align="center">14177(0x3761)</td><td> L1 WBE_FT Enable </td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RVDDC_FIX_ENABLE</td><td align="center">14178(0x3762)</td><td> L1 ENABLE/DISABLE Patch for RVDCDC HW bug</td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_INBAND_TONE_SELECT</td><td align="center">14179(0x3763)</td><td> L1 Select country for inband tone </td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_DRV_UNUSED</td><td align="center">14180(0x3764)</td><td> <----------- unused </td><td width="100">0xFF,</td></tr>
|
||||
<tr><td>SD02_ALLOC_LINE1[2]</td><td align="center">14180(0x3764)</td><td>handset allocation (see Protocol Interface) bitwise per handset: 1 = handset allocated;
|
||||
(0xFF 0xFF indicates Collective ringing) for
|
||||
each of the next 3 lines</td><td width="100">0xFF,0xFF,
|
||||
</td></tr>
|
||||
<tr><td>SD02_ALLOC_LINE2[2]</td><td align="center">14182(0x3766)</td><td></td><td width="100">0xFF,0xFF,
|
||||
</td></tr>
|
||||
<tr><td>SD02_ALLOC_LINE3[2]</td><td align="center">14184(0x3768)</td><td></td><td width="100">0xFF,0xFF,
|
||||
</td></tr>
|
||||
<tr><td>SD02_HS_TYPE_CATIQ30</td><td align="center">14186(0x376A)</td><td> Tells HS is CatIQ30 capable implemented for Max 8 HS only </td><td width="100">0x0,
|
||||
</td></tr>
|
||||
<tr><td>SD02_WB_TYPE_HSNR[2]</td><td align="center">14187(0x376B)</td><td> PT WB capability storage Note:For CAT-IQ builds user should not modify this location</td><td width="100">0,0,
|
||||
</td></tr>
|
||||
<tr><td>SD02_WB_LINE_TYPE</td><td align="center">14189(0x376D)</td><td> FT Line TYPE storgare(2= G711WB, 1 = WB , 0 =NB) </td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_WB_LINE_SUB_TYPE</td><td align="center">14190(0x376E)</td><td> FT WB Line Sub Type ( 0 = G722 WB, 1 = G711 WB) </td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_DH_MIX_RATIO</td><td align="center">14191(0x376F)</td><td></td><td width="100">0xFF,
|
||||
</td></tr>
|
||||
<tr><td>SD02_NEMO_PTS[2]</td><td align="center">14192(0x3770)</td><td> Two Bytes are used</td><td width="100">0xFF,0xFF,
|
||||
</td></tr>
|
||||
<tr><td>SD02_SPK_SLOT_TYPE</td><td align="center">14194(0x3772)</td><td> Slot type for SPK phone</td><td width="100">0x02,
|
||||
</td></tr>
|
||||
<tr><td>SD02_MAX_NUM_ACT_CALLS_PT</td><td align="center">14195(0x3773)</td><td> Maximum nmber of active calls of 1 PT.</td><td width="100">0x03,
|
||||
</td></tr>
|
||||
<tr><td>SD02_NEMO_DISABLED</td><td align="center">14196(0x3774)</td><td> bit 7 is used for permanent NEMo disable </td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_HS_TYPE_CATIQ20[2]</td><td align="center">14197(0x3775)</td><td> L2: Two bytes for CAT-iq 2.0 Handset </td><td width="100">0x00,
|
||||
|
||||
0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_FP_CUSTOM_FEATURES</td><td align="center">14199(0x3777)</td><td> Bit-0: INL 0-enable/1-disable, Bit-1: 0-conf,trfr enable/1-conf,trfr disable</td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_ENCRYPT_STATUS</td><td align="center">14200(0x3778)</td><td> L1: Encryption enable/disable</td><td width="100">0x01,
|
||||
</td></tr>
|
||||
<tr><td>SD02_MM_CAPABILITIES[10]</td><td align="center">14201(0x3779)</td><td> L10: MM Capabilities for each Handset.FTEEP_NUM_SUB/SD09_MAX_NUM_SUB is hard coded as 10 </td><td width="100">0x00,0x00,0x00,0x00,
|
||||
|
||||
0x00,0x00,0x00,0x00,
|
||||
|
||||
0x00,0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_ARBITRARY_TPUI[3]</td><td align="center">14211(0x3783)</td><td> L3 : 3 bytes to store arbitrary TPUI</td><td width="100">0x00,0x00,0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_HS_TYPE_CATIQ21[2]</td><td align="center">14214(0x3786)</td><td> L2: Two bytes for CAT-iq 2.1 Handset </td><td width="100">0x00,0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_INTERFERENCE_DETECTION_MEASUREMENT_INTERVAL</td><td align="center">14216(0x3788)</td><td> L1: Interference Detection Measurement Interval </td><td width="100">60,
|
||||
</td></tr>
|
||||
<tr><td>SD02_INTERFERENCE_DETECTION_NOISE_INTERVAL</td><td align="center">14217(0x3789)</td><td> L1: Interference Detection Noise Interval </td><td width="100">30,
|
||||
</td></tr>
|
||||
<tr><td>SD02_INTERFERENCE_DETECTION_CONFIG1</td><td align="center">14218(0x378A)</td><td> L1: Interference Detection config1, bit 0-7: Active Carriers Mask, carriers 1-8 </td><td width="100">0xFF,
|
||||
</td></tr>
|
||||
<tr><td>SD02_INTERFERENCE_DETECTION_CONFIG2</td><td align="center">14219(0x378B)</td><td> L1: Interference Detection config2, bit 0-1: Active Carriers Mask, carriers 9-10; bit7: 1-Enable/0-Disable Interference Detection alg.</td><td width="100">0x83,
|
||||
</td></tr>
|
||||
<tr><td>SD02_INTERFERENCE_DETECTION_TRAFFIC_SLOTS_IN_FRAME</td><td align="center">14220(0x378C)</td><td> L1: Interference Detection Traffic Slots In Frame </td><td width="100">0x03,
|
||||
</td></tr>
|
||||
<tr><td>SD02_INTERFERENCE_DETECTION_INTERFERENCE_LEVEL</td><td align="center">14221(0x378D)</td><td> L1: Interference Detection Interference Level </td><td width="100">0x98,
|
||||
</td></tr>
|
||||
<tr><td>SD02_NEMO_CONTROL</td><td align="center">14222(0x378E)</td><td> L1: MSB enables HM00_NEMO_DUMMY_USE_RSSI_FOR_IF_CHECK, others are for extending NEMO WA bearer time </td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>FCAC_HLP_END</td><td align="center">14223(0x378F)</td><td> </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_RINGER_EXPIRY</td><td align="center">14223(0x378F)</td><td> L1 FTMI:X line </td><td width="100">45,
|
||||
</td></tr>
|
||||
<tr><td>SD02_LINE_EXPIRY</td><td align="center">14224(0x3790)</td><td> L1 FTMI:release </td><td width="100">85,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RINGER_MELODY</td><td align="center">14225(0x3791)</td><td> L1 FTMI:ringer </td><td width="100">9,
|
||||
</td></tr>
|
||||
<tr><td>SD02_RINGER_VOLUME</td><td align="center">14226(0x3792)</td><td> L1 FTMI:ringer </td><td width="100">3,
|
||||
</td></tr>
|
||||
<tr><td>SD02_DIAL_MODI</td><td align="center">14227(0x3793)</td><td> L1 FTMI:dtmf/reca</td><td width="100">0xD3,
|
||||
</td></tr>
|
||||
<tr><td>SD02_DLT_CTRL</td><td align="center">14228(0x3794)</td><td> L1 FTMI:dialTone </td><td width="100">0x3A,
|
||||
</td></tr>
|
||||
<tr><td>SD02_TONDET_SEL</td><td align="center">14229(0x3795)</td><td> L1 FTMI:ena/disa enable tone detection features: 0x80: DTAS
|
||||
0x40: RPAS
|
||||
0x41: RPASFR
|
||||
0x20: MFCR</td><td width="100">0x80+0x41+0x20,
|
||||
</td></tr>
|
||||
<tr><td>SD02_LRMS_SUPPORT[2]</td><td align="center">14230(0x3796)</td><td> L2 FTMI:LRMS sup. 1 Bit per handset. 1 indicates LMRS support
|
||||
of the according handset.</td><td width="100">0x00, 0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_SMS1_PLUS_SUPPORT[2]</td><td align="center">14232(0x3798)</td><td> L2 FTMI:SMS1_PLUS sup. 1 Bit per handset. 1 indicates SMS1+ support
|
||||
of the according handset.</td><td width="100">0x00, 0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_COUNTRY_IDENTIFICATION</td><td align="center">14234(0x379A)</td><td> L1 FTMMS </td><td width="100">0x01,
|
||||
</td></tr>
|
||||
<tr><td>SD02_SMS_TP_MR</td><td align="center">14235(0x379B)</td><td> L1 FTMMS </td><td width="100">0xfd,
|
||||
</td></tr>
|
||||
<tr><td>SD02_DTAM_RING</td><td align="center">14236(0x379C)</td><td> DTAM: ringtones </td><td width="100">0x5,
|
||||
</td></tr>
|
||||
<tr><td>SD02_PREF_LINE[9]</td><td align="center">14237(0x379D)</td><td> L9 FTMI:ogo line, up to 9 </td><td width="100">0x00,0x00,0x00,0x00,0x00,
|
||||
|
||||
0x00,0x00,0x00,0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_PRIOR_HS[30]</td><td align="center">14246(0x37A6)</td><td> L2 FTMI:inc line, up to 3 incoming prioritized HS line 1
|
||||
ring count of prior. HS line 1
|
||||
incoming prioritized HS line 2
|
||||
ring count of prior. HS line 2
|
||||
incoming prioritized HS line 3
|
||||
ring count of prior. HS line 3</td><td width="100">0x00,
|
||||
|
||||
0x00,
|
||||
|
||||
0x00,
|
||||
|
||||
0x00,
|
||||
|
||||
0x00,
|
||||
|
||||
0x00,
|
||||
|
||||
0x00,
|
||||
|
||||
0x00,
|
||||
|
||||
0x00,
|
||||
|
||||
0x00,
|
||||
|
||||
0x00,
|
||||
|
||||
0x00,
|
||||
|
||||
0x00,
|
||||
|
||||
0x00,
|
||||
|
||||
0x00,
|
||||
|
||||
0x00,
|
||||
|
||||
0x00,
|
||||
|
||||
0x00,
|
||||
|
||||
0x00,
|
||||
|
||||
0x00,
|
||||
|
||||
0x00,
|
||||
|
||||
0x00,
|
||||
|
||||
0x00,
|
||||
|
||||
0x00,
|
||||
|
||||
0x00,
|
||||
|
||||
0x00,
|
||||
|
||||
0x00,
|
||||
|
||||
0x00,
|
||||
|
||||
0x00,
|
||||
|
||||
0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_BLINDCALL_TIM1</td><td align="center">14276(0x37C4)</td><td> Blind call transfer timeout 1 </td><td width="100">0x1E,
|
||||
</td></tr>
|
||||
<tr><td>SD02_BLINDCALL_TIM2</td><td align="center">14277(0x37C5)</td><td> Blind call transfer timeout 2 </td><td width="100">0x1E,
|
||||
</td></tr>
|
||||
<tr><td>SD02_PARKED_TIM</td><td align="center">14278(0x37C6)</td><td> Parked line timeout </td><td width="100">0x3c,
|
||||
</td></tr>
|
||||
<tr><td>SD02_OVERLAP_SEND_TIM</td><td align="center">14279(0x37C7)</td><td> Overlap sending timer </td><td width="100">0x4,
|
||||
</td></tr>
|
||||
<tr><td>SD02_DTAM_ENABLE</td><td align="center">14280(0x37C8)</td><td> DTAM: ON/OFF </td><td width="100">0x1,
|
||||
</td></tr>
|
||||
<tr><td>SD02_DTAM_ICM_CR</td><td align="center">14281(0x37C9)</td><td> DTAM: codRates ICM </td><td width="100">0xFF,
|
||||
</td></tr>
|
||||
<tr><td>SD02_DTAM_OGM_CR</td><td align="center">14282(0x37CA)</td><td> DTAM: codRates OGM </td><td width="100">0xFF,
|
||||
</td></tr>
|
||||
<tr><td>SD02_DTAM_PILL_CR</td><td align="center">14283(0x37CB)</td><td> DTAM: codRates Pill</td><td width="100">0xFF,
|
||||
</td></tr>
|
||||
<tr><td>SD02_EARVOL</td><td align="center">14284(0x37CC)</td><td> EAR Vol </td><td width="100">0x05,
|
||||
</td></tr>
|
||||
<tr><td>SD02_BS_CALL_SCREENING</td><td align="center">14285(0x37CD)</td><td> L1 Call Screening Enable/disable</td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_EMC_COMPLIANT[2]</td><td align="center">14286(0x37CE)</td><td> L2 stores the compliant of PT's i.e. whether EMC is equal </td><td width="100">0x00, 0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_LU10_RN_UPDATE</td><td align="center">14288(0x37D0)</td><td> L1 Enable/disable update RN=SN+1 </td><td width="100">0x05,
|
||||
</td></tr>
|
||||
<tr><td>SD02_MMI_DECT_SECURITY</td><td align="center">14289(0x37D1)</td><td> L1 DECT SECURITY LEVEL </td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_CR_PREFERRED_CODEC</td><td align="center">14290(0x37D2)</td><td> L1 holds the preferred codec for CR </td><td width="100">0x01,
|
||||
</td></tr>
|
||||
<tr><td>SD02_PAD_OPT_NORMAL</td><td align="center">14291(0x37D3)</td><td> L1 holds the Normal action for CR: 0- nothing 1 - Mute</td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_PAD_OPT_PROTECTED</td><td align="center">14292(0x37D4)</td><td> L1 holds the Protected action for CR: 0- nothing 1 - Mute</td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_CR_ACTION_ADPCM</td><td align="center">14293(0x37D5)</td><td> L1 holds the ADPCM action for 0- nothing 1 - Improved</td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_CLEARANGE_ENABLE</td><td align="center">14294(0x37D6)</td><td> L1 Enable CR feature </td><td width="100">0x01,
|
||||
</td></tr>
|
||||
<tr><td>SD02_REPEATER_TYPE</td><td align="center">14295(0x37D7)</td><td> L1 Hold the Repeater Type GAP,CAT-iq.NEMO </td><td width="100">0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_ULE_MULTICAST_ENC_PARAMS[53]</td><td align="center">14296(0x37D8)</td><td> L48 ULE Multicast enc. parameter: 2x (CCM key, sequence number, Multicast ID) </td><td width="100">0x00,0x00,0x00,0x00,0x00,
|
||||
|
||||
0x00,0x00,0x00,0x00,0x00,
|
||||
|
||||
0x00,0x00,0x00,0x00,0x00,
|
||||
|
||||
0x00,0x00,0x00,0x00,0x00,
|
||||
|
||||
0x00,0x00,0x00,0x00,0x00,
|
||||
|
||||
0x00,0x00,0x00,0x00,0x00,
|
||||
|
||||
0x00,0x00,0x00,0x00,0x00,
|
||||
|
||||
0x00,0x00,0x00,0x00,0x00,
|
||||
|
||||
0x00,0x00,0x00,0x00,0x00,
|
||||
|
||||
0x00,0x00,0x00,
|
||||
|
||||
0xFF,
|
||||
|
||||
0x0,
|
||||
|
||||
0x0,
|
||||
|
||||
0x0, 0x00,
|
||||
</td></tr>
|
||||
<tr><td>SD02_DECT_SETTINGS_OFFSET</td><td align="center">14349(0x380D)</td><td> DECT settings List Offset </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_DSSL_CLOCK_MASTER</td><td align="center">14349(0x380D)</td><td> L1 </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_DSSL_BASE_RESET</td><td align="center">14350(0x380E)</td><td> L1 </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_DSSL_FW_VERSION[38]</td><td align="center">14351(0x380F)</td><td> L8 </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_DSSL_EEP_VERSION[38]</td><td align="center">14389(0x3835)</td><td> L8 </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_DSSL_HW_VERSION[38]</td><td align="center">14427(0x385B)</td><td> L8 </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_DSSL_NEW_PIN[4]</td><td align="center">14465(0x3881)</td><td> L4 </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_DSSL_EMISSION_MODE</td><td align="center">14469(0x3885)</td><td> L1 </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_DSSL_IP_TYPE</td><td align="center">14470(0x3886)</td><td> L1 </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_DSSL_IP_VALUE[17]</td><td align="center">14471(0x3887)</td><td> L17 </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_DSSL_IP_SUBNET_MASK[17]</td><td align="center">14488(0x3898)</td><td> L17 </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_DSSL_IP_GATEWAY[17]</td><td align="center">14505(0x38A9)</td><td> L17 </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_DSSL_IP_DNS_SERVER[17]</td><td align="center">14522(0x38BA)</td><td> L17 </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_DSSL_FP_POWER_LEVEL</td><td align="center">14539(0x38CB)</td><td> L1 </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_LINE_SETTINGS_OFFSET[75]</td><td align="center">14540(0x38CC)</td><td> Line Settings List Offset </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_INL_DATA_OFFSET[375]</td><td align="center">14615(0x3917)</td><td> Internal Name List Offset </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_SUPTD_LIST_OFFSET[22]</td><td align="center">14990(0x3A8E)</td><td> Supported List Offset</td><td width="100"></td></tr>
|
||||
<tr><td>SD02_BSNAME_LEN</td><td align="center">15012(0x3AA4)</td><td> L1 </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_BSNAME[19]</td><td align="center">15013(0x3AA5)</td><td> L13 Bytes of data MAX </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_SUB_IPUI[5]</td><td align="center">15032(0x3AB8)</td><td> L5 Data: IPUI </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_SUB_TPUI[3]</td><td align="center">15037(0x3ABD)</td><td> L3 Data: TPUI </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_SUB_DCK[16]</td><td align="center">15040(0x3AC0)</td><td> L16 Data: DCK </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_SUB_UAK[16]</td><td align="center">15056(0x3AD0)</td><td> L16 Data: UAK </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_SUB_AC[4]</td><td align="center">15072(0x3AE0)</td><td> L4 Data: authentication code AC </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_SUB_UAK_AUTH</td><td align="center">15076(0x3AE4)</td><td> L1 Data: UAK authorization </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_SUB_STATUS</td><td align="center">15077(0x3AE5)</td><td> L1 Data: status </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_SUB_HANDSET_NR</td><td align="center">15078(0x3AE6)</td><td> L1 Data: handset number </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_SUB_DCK_ASSIGNED</td><td align="center">15079(0x3AE7)</td><td> L1 Data: DCK assigned </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_SUB_CK_LEN</td><td align="center">15080(0x3AE8)</td><td> L1 Data: Cipher Key Length </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_SUB_FEATURES</td><td align="center">15081(0x3AE9)</td><td> L1 Data: Handset ULE feature support </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_SUB_LEN[15032]</td><td align="center">50(0x32)</td><td> End of first subscribtion </td><td width="100"></td></tr>
|
||||
<tr><td>FNCA_SUB(i)[250]</td><td align="center">15082(0x3AEA)</td><td> This place is reserved for the rest of the HS and includes all perameters:SD02_SUB_IPUI-SD02_SUB_DCK_ASSIGNED (40Byte x Number of handsets)</td><td width="100"></td></tr>
|
||||
<tr><td>SD02_SUB_UNUSED[6]</td><td align="center">15332(0x3BE4)</td><td> <----------- unused </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_SUB_EX_DEFCK[16]</td><td align="center">15338(0x3BEA)</td><td> L16 Data: Default Cipher Key </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_SUB_EX_DEFCK_ASSIGNED</td><td align="center">15354(0x3BFA)</td><td> L1 Data: DefCK assigned </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_SUB_EX_LEN[15338]</td><td align="center">17(0x11)</td><td> End of first subscribtion </td><td width="100"></td></tr>
|
||||
<tr><td>FNCA_SUB_EX(i)[85]</td><td align="center">15355(0x3BFB)</td><td> This place is reserved for the rest of the HS and includes all perameters:SD02_SUB_IPUI-SD02_SUB_DCK_ASSIGNED (40Byte x Number of handsets)</td><td width="100"></td></tr>
|
||||
<tr><td>SD02_SUB_EX_UNUSED[4]</td><td align="center">15440(0x3C50)</td><td> <----------- unused </td><td width="100"></td></tr>
|
||||
<tr><td>SD02_SUB_RFPI</td><td align="center">15444(0x3C54)</td><td> L5 RFPI </td><td width="100"></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3>EEPROM SIZE = 32768</h3>
|
||||
|
||||
<h6>*All non exists values on default are zero upon EEPROM reset</h6>
|
||||
|
||||
109
dectmngr/files/DCX81_fw_c/MOD/USB/bhanEepromDefaults.html
Executable file
109
dectmngr/files/DCX81_fw_c/MOD/USB/bhanEepromDefaults.html
Executable file
File diff suppressed because one or more lines are too long
1968
dectmngr/files/config/dg400prime-5.3-kernel.config
Normal file
1968
dectmngr/files/config/dg400prime-5.3-kernel.config
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user