@ -1,313 +0,0 @@ | |||||
# | |||||
# Copyright (C) 2015 OpenWrt.org | |||||
# | |||||
# This is free software, licensed under the GNU General Public License v2. | |||||
# See /LICENSE for more information. | |||||
# | |||||
include $(TOPDIR)/rules.mk | |||||
PKG_NAME:=iotivity | |||||
PKG_VERSION:=1.2.1 | |||||
PKG_RELEASE:=2 | |||||
PKG_SOURCE:=${PKG_NAME}-${PKG_VERSION}.tar.gz | |||||
PKG_SOURCE_URL:=http://mirrors.kernel.org/${PKG_NAME}/${PKG_VERSION}/ | |||||
PKG_HASH:=7dcd9f0f48263c6b27a2c3d085dd7278b5c0feed1dfec8872a04899707fa23d8 | |||||
PKG_USE_MIPS16:=0 | |||||
PKG_BUILD_DEPENDS:=boost python/host scons/host | |||||
PKG_MAINTAINER:=Hauke Mehrtens <hauke.mehrtens@intel.com> | |||||
PKG_LICENSE:=Apache-2.0 | |||||
PKG_LICENSE_FILES:=LICENSE.md | |||||
PKG_CONFIG_DEPENDS := \ | |||||
CONFIG_PACKAGE_iotivity \ | |||||
CONFIG_PACKAGE_iotivity-cpp \ | |||||
CONFIG_PACKAGE_iotivity-resource-directory-lib \ | |||||
CONFIG_PACKAGE_iotivity-oic-middle \ | |||||
CONFIG_PACKAGE_iotivity-resource-container-lib \ | |||||
CONFIG_PACKAGE_iotivity-resource-container-sample \ | |||||
CONFIG_PACKAGE_iotivity-resource-container-hue \ | |||||
CONFIG_PACKAGE_iotivity-example-garage \ | |||||
CONFIG_PACKAGE_iotivity-example-simple \ | |||||
CONFIG_PACKAGE_iotivity_DEBUG \ | |||||
CONFIG_PACKAGE_iotivity_SECURE | |||||
include $(INCLUDE_DIR)/package.mk | |||||
include ../../devel/scons/scons.mk | |||||
define Package/iotivity | |||||
SECTION:=net | |||||
CATEGORY:=Network | |||||
DEPENDS:=@!USE_UCLIBC +libpthread +librt +libuuid +libsqlite3 +PACKAGE_iotivity_SECURE:libmbedtls | |||||
TITLE:=IoTivity C Library | |||||
URL:=https://www.iotivity.org | |||||
MENU:=1 | |||||
endef | |||||
define Package/iotivity/description | |||||
IoTivity is a framework for the Internet of Things based on the | |||||
Open Interconnect Consortium Specification. | |||||
endef | |||||
define Package/iotivity/config | |||||
if PACKAGE_iotivity | |||||
config PACKAGE_iotivity_DEBUG | |||||
bool "IoTivity with debug support" | |||||
help | |||||
Build IoTivity with debuging support. | |||||
config PACKAGE_iotivity_SECURE | |||||
bool "IoTivity with security support" | |||||
help | |||||
Activate security support. | |||||
config PACKAGE_iotivity_LOGGING | |||||
bool "IoTivity with logging support" | |||||
default y | |||||
help | |||||
Activate logging support. | |||||
This will make IoTivity write a lot of log messages to stdout. | |||||
endif | |||||
endef | |||||
define Package/iotivity-cpp | |||||
SECTION:=net | |||||
CATEGORY:=Network | |||||
DEPENDS:=+iotivity +libpthread +libstdcpp | |||||
TITLE:=IoTivity C++ Library | |||||
URL:=https://www.iotivity.org | |||||
endef | |||||
define Package/iotivity-cpp/description | |||||
IoTivity is a framework for the Internet of Things based on the | |||||
Open Interconnect Consortium Specification. | |||||
endef | |||||
define Package/iotivity-resource-directory-lib | |||||
SECTION:=net | |||||
CATEGORY:=Network | |||||
DEPENDS:=+iotivity +iotivity-cpp | |||||
TITLE:=IoTivity Resource Directory library | |||||
URL:=https://www.iotivity.org | |||||
endef | |||||
define Package/iotivity-oic-middle | |||||
SECTION:=net | |||||
CATEGORY:=Network | |||||
DEPENDS:=+iotivity +iotivity-cpp +iotivity-resource-directory-lib | |||||
TITLE:=IoTivity OIC Middle | |||||
URL:=https://www.iotivity.org | |||||
endef | |||||
define Package/iotivity-oic-middle/description | |||||
IoTivity OIC Middle | |||||
endef | |||||
define Package/iotivity-resource-container-lib | |||||
SECTION:=net | |||||
CATEGORY:=Network | |||||
DEPENDS:=+iotivity +iotivity-cpp +boost +boost-system +boost-thread +boost-date_time | |||||
TITLE:=IoTivity Resource Container library | |||||
URL:=https://www.iotivity.org | |||||
endef | |||||
define Package/iotivity-resource-container-sample | |||||
SECTION:=net | |||||
CATEGORY:=Network | |||||
DEPENDS:=+iotivity +iotivity-resource-container-lib | |||||
TITLE:=IoTivity Resource Container sample Application | |||||
URL:=https://www.iotivity.org | |||||
endef | |||||
define Package/iotivity-resource-container-hue | |||||
SECTION:=net | |||||
CATEGORY:=Network | |||||
DEPENDS:=+iotivity +iotivity-resource-container-lib +libcurl | |||||
TITLE:=IoTivity Resource Container Hue Bundle | |||||
URL:=https://www.iotivity.org | |||||
endef | |||||
define Package/iotivity-example-garage | |||||
SECTION:=net | |||||
CATEGORY:=Network | |||||
DEPENDS:=+iotivity +iotivity-cpp +iotivity-resource-directory-lib | |||||
TITLE:=IoTivity Garage example | |||||
URL:=https://www.iotivity.org | |||||
endef | |||||
define Package/iotivity-example-garage/description | |||||
An IoTivity example application | |||||
endef | |||||
define Package/iotivity-example-simple | |||||
SECTION:=net | |||||
CATEGORY:=Network | |||||
DEPENDS:=+iotivity +iotivity-cpp +iotivity-resource-directory-lib | |||||
TITLE:=IoTivity simple client + server | |||||
URL:=https://www.iotivity.org | |||||
endef | |||||
define Package/iotivity-example-simple/description | |||||
The IoTivity simple client and simple server exmaple | |||||
endef | |||||
PKG_TINYCBOR_NAME:=tinycbor | |||||
PKG_TINYCBOR_PROTO:=git | |||||
PKG_TINYCBOR_VERSION:=0.4 | |||||
PKG_TINYCBOR_SOURCE_VERSION:=a088996aa5f59b4f27f20fadad053d88bee357d4 | |||||
PKG_TINYCBOR_MIRROR_HASH:=77c600bd7362df8291148fa3d94ca780815ea2b74b817dca7565310ea0abff96 | |||||
PKG_TINYCBOR_SOURCE:=$(PKG_TINYCBOR_NAME)-$(PKG_TINYCBOR_VERSION).tar.bz2 | |||||
PKG_TINYCBOR_SOURCE_URL:=https://github.com/01org/tinycbor.git | |||||
PKG_TINYCBOR_SUBDIR:=$(PKG_TINYCBOR_NAME) | |||||
define Download/iotivity-tinycbor | |||||
FILE:=$(PKG_TINYCBOR_SOURCE) | |||||
URL:=$(PKG_TINYCBOR_SOURCE_URL) | |||||
MIRROR_HASH:=$(PKG_TINYCBOR_MIRROR_HASH) | |||||
PROTO:=$(PKG_TINYCBOR_PROTO) | |||||
VERSION:=$(PKG_TINYCBOR_SOURCE_VERSION) | |||||
SUBDIR:=$(PKG_TINYCBOR_SUBDIR) | |||||
endef | |||||
$(eval $(call Download,iotivity-tinycbor)) | |||||
EXTRA_CXXFLAGS += -std=gnu++11 | |||||
SCONS_OPTIONS += \ | |||||
TARGET_OS=linux \ | |||||
TARGET_TRANSPORT=IP \ | |||||
TARGET_ARCH=$(ARCH) \ | |||||
STAGING_DIR=$(STAGING_DIR) \ | |||||
WITH_ENV=true \ | |||||
octbstack oc \ | |||||
$(if $(CONFIG_PACKAGE_iotivity-oic-middle),examples) \ | |||||
$(if $(CONFIG_PACKAGE_iotivity-resource-container-lib),libResContainer) \ | |||||
$(if $(CONFIG_PACKAGE_iotivity-resource-container-sample),containersample) \ | |||||
$(if $(CONFIG_PACKAGE_iotivity-resource-container-hue),libHueBundle) \ | |||||
$(if $(CONFIG_PACKAGE_iotivity-example-garage),examples) \ | |||||
$(if $(CONFIG_PACKAGE_iotivity-example-simple),examples) \ | |||||
install | |||||
ifeq ($(CONFIG_PACKAGE_iotivity_DEBUG),y) | |||||
SCONS_OPTIONS += RELEASE=false | |||||
APP_OPTIM:=debug | |||||
else | |||||
SCONS_OPTIONS += RELEASE=true | |||||
APP_OPTIM:=release | |||||
endif | |||||
ifeq ($(CONFIG_PACKAGE_iotivity_SECURE),y) | |||||
SCONS_OPTIONS += SECURED=1 | |||||
else | |||||
SCONS_OPTIONS += SECURED=0 | |||||
endif | |||||
ifeq ($(CONFIG_PACKAGE_iotivity_LOGGING),y) | |||||
SCONS_OPTIONS += LOGGING=true | |||||
endif | |||||
ifneq ($(findstring c,$(OPENWRT_VERBOSE)),) | |||||
SCONS_OPTIONS += VERBOSE=true | |||||
endif | |||||
define Build/Prepare | |||||
$(call Build/Prepare/Default) | |||||
$(TAR) -C $(PKG_BUILD_DIR)/extlibs/tinycbor/ -xjf $(DL_DIR)/$(PKG_TINYCBOR_SOURCE) | |||||
endef | |||||
define Build/Configure | |||||
(cd $(PKG_BUILD_DIR); \ | |||||
$(SCONS_VARS) \ | |||||
python2.7 $(STAGING_DIR_HOSTPKG)/bin/scons \ | |||||
$(SCONS_OPTIONS) \ | |||||
) | |||||
endef | |||||
define Package/iotivity/install | |||||
$(INSTALL_DIR) $(1)/usr/lib | |||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/libconnectivity_abstraction.so $(1)/usr/lib/ | |||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboctbstack.so $(1)/usr/lib/ | |||||
ifeq ($(CONFIG_PACKAGE_iotivity_SECURE),y) | |||||
$(INSTALL_DIR) $(1)/etc/iotivity/ | |||||
$(INSTALL_DATA) ./files/etc/iotivity/oic_svr_db.cbor $(1)/etc/iotivity/ | |||||
endif | |||||
endef | |||||
define Package/iotivity-cpp/install | |||||
$(INSTALL_DIR) $(1)/usr/lib | |||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboc.so $(1)/usr/lib/ | |||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboc_logger.so $(1)/usr/lib/ | |||||
endef | |||||
define Package/iotivity-resource-directory-lib/install | |||||
$(INSTALL_DIR) $(1)/usr/lib | |||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/libresource_directory.so $(1)/usr/lib/ | |||||
endef | |||||
define Package/iotivity-oic-middle/install | |||||
$(INSTALL_DIR) $(1)/usr/bin | |||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/examples/OICMiddle/OICMiddle $(1)/usr/bin/ | |||||
endef | |||||
define Package/iotivity-resource-container-lib/install | |||||
$(INSTALL_DIR) $(1)/usr/lib | |||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/librcs_common.so $(1)/usr/lib/ | |||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/librcs_client.so $(1)/usr/lib/ | |||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/librcs_server.so $(1)/usr/lib/ | |||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/librcs_container.so $(1)/usr/lib/ | |||||
endef | |||||
define Package/iotivity-resource-container-sample/install | |||||
$(INSTALL_DIR) $(1)/usr/bin | |||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/service/resource-container/ContainerSample $(1)/usr/bin/ | |||||
endef | |||||
define Package/iotivity-resource-container-hue/install | |||||
$(INSTALL_DIR) $(1)/usr/lib | |||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/libHueBundle.so $(1)/usr/lib/ | |||||
endef | |||||
define Package/iotivity-example-garage/install | |||||
$(INSTALL_DIR) $(1)/usr/bin | |||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/resource/examples/garageclient $(1)/usr/bin/ | |||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/resource/examples/garageserver $(1)/usr/bin/ | |||||
endef | |||||
define Package/iotivity-example-simple/install | |||||
$(INSTALL_DIR) $(1)/usr/bin | |||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/resource/examples/simpleclient $(1)/usr/bin/ | |||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/resource/examples/simpleserver $(1)/usr/bin/ | |||||
endef | |||||
define Build/InstallDev | |||||
$(INSTALL_DIR) $(1)/usr/include | |||||
$(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/include $(1)/usr/include/iotivity | |||||
$(INSTALL_DIR) $(1)/usr/lib | |||||
$(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/libconnectivity_abstraction.so $(1)/usr/lib/ | |||||
$(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboctbstack.so $(1)/usr/lib/ | |||||
$(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboc.so $(1)/usr/lib/ | |||||
$(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboc_logger.so $(1)/usr/lib/ | |||||
$(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/libresource_directory.so $(1)/usr/lib/ | |||||
endef | |||||
$(eval $(call BuildPackage,iotivity)) | |||||
$(eval $(call BuildPackage,iotivity-cpp)) | |||||
$(eval $(call BuildPackage,iotivity-resource-directory-lib)) | |||||
$(eval $(call BuildPackage,iotivity-oic-middle)) | |||||
$(eval $(call BuildPackage,iotivity-resource-container-lib)) | |||||
$(eval $(call BuildPackage,iotivity-resource-container-sample)) | |||||
$(eval $(call BuildPackage,iotivity-resource-container-hue)) | |||||
$(eval $(call BuildPackage,iotivity-example-garage)) | |||||
$(eval $(call BuildPackage,iotivity-example-simple)) |
@ -1,2 +0,0 @@ | |||||
The file oic_svr_db.cbor in generated from the oic_svr_db.json with the | |||||
resource/csdk/security/tool/json2cbor.c tool. |
@ -1,101 +0,0 @@ | |||||
{ | |||||
"acl": { | |||||
"aclist": { | |||||
"aces": [ | |||||
{ | |||||
"subjectuuid": "*", | |||||
"resources": [ | |||||
{ | |||||
"href": "/oic/res", | |||||
"rel": "", | |||||
"rt": ["oic.wk.res"], | |||||
"if": ["oic.if.ll"] | |||||
}, | |||||
{ | |||||
"href": "/oic/d", | |||||
"rel": "", | |||||
"rt": ["oic.wk.d"], | |||||
"if": ["oic.if.baseline", "oic.if.r"] | |||||
}, | |||||
{ | |||||
"href": "/oic/p", | |||||
"rel": "", | |||||
"rt": ["oic.wk.p"], | |||||
"if": ["oic.if.baseline", "oic.if.r"] | |||||
}, | |||||
{ | |||||
"href": "/oic/sec/acl", | |||||
"rel": "", | |||||
"rt": ["oic.r.acl"], | |||||
"if": ["oic.if.baseline"] | |||||
} | |||||
], | |||||
"permission": 2 | |||||
}, | |||||
{ | |||||
"subjectuuid": "*", | |||||
"resources": [ | |||||
{ | |||||
"href": "/oic/sec/doxm", | |||||
"rel": "", | |||||
"rt": ["oic.r.doxm"], | |||||
"if": ["oic.if.baseline"] | |||||
}, | |||||
{ | |||||
"href": "/oic/sec/pstat", | |||||
"rel": "", | |||||
"rt": ["oic.r.pstat"], | |||||
"if": ["oic.if.baseline"] | |||||
} | |||||
], | |||||
"permission": 2 | |||||
}, | |||||
{ | |||||
"subjectuuid": "*", | |||||
"resources": [ | |||||
{ | |||||
"href": "*", | |||||
"rel": "", | |||||
"rt": ["oic.core"], | |||||
"if": ["oic.if.baseline"] | |||||
} | |||||
], | |||||
"permission": 7 | |||||
} | |||||
] | |||||
}, | |||||
"rowneruuid" : "31313131-3131-3131-3131-313131313131" | |||||
}, | |||||
"pstat": { | |||||
"isop": true, | |||||
"deviceuuid": "31313131-3131-3131-3131-313131313131", | |||||
"rowneruuid": "31313131-3131-3131-3131-313131313131", | |||||
"cm": 0, | |||||
"tm": 0, | |||||
"om": 4, | |||||
"sm": 4 | |||||
}, | |||||
"doxm": { | |||||
"oxms": [0], | |||||
"oxmsel": 0, | |||||
"sct": 1, | |||||
"owned": true, | |||||
"deviceuuid": "31313131-3131-3131-3131-313131313131", | |||||
"devowneruuid": "32323232-3232-3232-3232-323232323232", | |||||
"rowneruuid": "31313131-3131-3131-3131-313131313131" | |||||
}, | |||||
"cred": { | |||||
"creds": [ | |||||
{ | |||||
"credid": 1, | |||||
"subjectuuid": "32323232-3232-3232-3232-323232323232", | |||||
"credtype": 1, | |||||
"privatedata": { | |||||
"data": "AAAAAAAAAAAAAAAA", | |||||
"encoding": "oic.sec.encoding.raw" | |||||
} | |||||
} | |||||
], | |||||
"rowneruuid": "31313131-3131-3131-3131-313131313131" | |||||
} | |||||
} |
@ -1,141 +0,0 @@ | |||||
--- a/plugins/SConscript | |||||
+++ b/plugins/SConscript | |||||
@@ -35,7 +35,7 @@ if target_os not in ['android', 'arduino | |||||
SConscript(os.path.join('src', 'SConscript')) | |||||
- SConscript(os.path.join('unittests', 'SConscript')) | |||||
+# SConscript(os.path.join('unittests', 'SConscript')) | |||||
if build_sample == 'ON': | |||||
if target_os in ['linux']: | |||||
--- a/resource/SConscript | |||||
+++ b/resource/SConscript | |||||
@@ -78,7 +78,7 @@ if target_os in ['linux', 'windows']: | |||||
SConscript('csdk/stack/samples/linux/secure/SConscript') | |||||
# Build C/C++ unit tests | |||||
- SConscript('unit_tests.scons') | |||||
+ # SConscript('unit_tests.scons') | |||||
elif target_os == 'darwin': | |||||
env.Command('../../out/darwin/iotivity-csdk.framework',None,src_dir + '/tools/darwin/mkfwk_osx.sh') | |||||
--- a/resource/csdk/resource-directory/SConscript | |||||
+++ b/resource/csdk/resource-directory/SConscript | |||||
@@ -114,8 +114,3 @@ if 'SERVER' in rd_mode: | |||||
if target_os in ['linux']: | |||||
SConscript('samples/SConscript') | |||||
-###################################################################### | |||||
-# Build UnitTests of the Resource Directory | |||||
-################################################ ###################### | |||||
-if target_os in ['linux']: | |||||
- SConscript('unittests/SConscript') | |||||
--- a/service/coap-http-proxy/SConscript | |||||
+++ b/service/coap-http-proxy/SConscript | |||||
@@ -84,6 +84,3 @@ local_env.UserInstallTargetHeader('inclu | |||||
###################################################################### | |||||
if target_os in ['linux', 'tizen']: | |||||
SConscript('samples/SConscript') | |||||
- | |||||
-if target_os in ['linux']: | |||||
- SConscript('unittests/SConscript') | |||||
--- a/service/easy-setup/enrollee/SConscript | |||||
+++ b/service/easy-setup/enrollee/SConscript | |||||
@@ -123,7 +123,3 @@ if target_os == 'arduino': | |||||
if target_os in ['linux']: | |||||
SConscript('../sampleapp/enrollee/linux/SConscript') | |||||
- #Build UnitTestcases for Enrollee | |||||
- if enrollee_env.get('SECURED') == '0': | |||||
- SConscript('../enrollee/unittests/SConscript') | |||||
- | |||||
--- a/service/easy-setup/mediator/richsdk/SConscript | |||||
+++ b/service/easy-setup/mediator/richsdk/SConscript | |||||
@@ -163,11 +163,3 @@ if target_os in ['linux']: | |||||
if target_os in ['android']: | |||||
SConscript('../../sampleapp/mediator/android/SConscript') | |||||
- | |||||
-###################################################################### | |||||
-#Build UnitTestcases for Mediator[RichSDK] | |||||
-################################################ ###################### | |||||
-if env.get('SECURED') == '0': | |||||
- if target_os == 'linux': | |||||
- SConscript('unittests/SConscript') | |||||
- | |||||
--- a/service/resource-container/SConscript | |||||
+++ b/service/resource-container/SConscript | |||||
@@ -223,12 +223,6 @@ else: | |||||
lib_env = conf2.Finish() | |||||
###################################################################### | |||||
-# build resource container unit tests | |||||
-###################################################################### | |||||
-if target_os in ['linux']: | |||||
- SConscript('unittests/SConscript') | |||||
- | |||||
-###################################################################### | |||||
# Build Container Sample | |||||
###################################################################### | |||||
if target_os not in ['ios']: | |||||
--- a/service/resource-encapsulation/SConscript | |||||
+++ b/service/resource-encapsulation/SConscript | |||||
@@ -121,14 +121,5 @@ resourceClient_env.UserInstallTargetHead | |||||
###################################################################### | |||||
SConscript('examples/SConscript') | |||||
-###################################################################### | |||||
-# Build UnitTests Resource Client , resourceCache and resourceBroker and | |||||
-# DiscoveryManager | |||||
-################################################ ###################### | |||||
-if target_os in ['linux']: | |||||
- SConscript('unittests/SConscript') | |||||
- SConscript('src/resourceCache/unittests/SConscript') | |||||
- SConscript('src/resourceBroker/unittest/SConscript') | |||||
- | |||||
if target_os == 'android': | |||||
SConscript('android/SConscript') | |||||
--- a/service/resource-encapsulation/src/common/SConscript | |||||
+++ b/service/resource-encapsulation/src/common/SConscript | |||||
@@ -22,10 +22,10 @@ | |||||
# rcs_common (primitiveResource and expiryTimer) build script | |||||
## | |||||
import os | |||||
+Import('env') | |||||
# SConscript file for Local PKI google tests | |||||
-gtest_env = SConscript('#extlibs/gtest/SConscript') | |||||
-lib_env = gtest_env.Clone() | |||||
+lib_env = env.Clone() | |||||
# Add third party libraries | |||||
SConscript('#service/third_party_libs.scons', exports = 'lib_env') | |||||
--- a/service/resource-encapsulation/src/serverBuilder/SConscript | |||||
+++ b/service/resource-encapsulation/src/serverBuilder/SConscript | |||||
@@ -21,9 +21,11 @@ | |||||
## | |||||
# rcs_server (Server Builder) project build script | |||||
## | |||||
+import os | |||||
+Import('env') | |||||
+ | |||||
# SConscript file for Local PKI google tests | |||||
-gtest_env = SConscript('#extlibs/gtest/SConscript') | |||||
-lib_env = gtest_env.Clone() | |||||
+lib_env = env.Clone() | |||||
# Add third party libraries | |||||
SConscript('#service/third_party_libs.scons', exports = 'lib_env') | |||||
--- a/service/scene-manager/SConscript | |||||
+++ b/service/scene-manager/SConscript | |||||
@@ -100,9 +100,5 @@ scenemanager_env.UserInstallTargetHeader | |||||
scenemanager_env.UserInstallTargetHeader('include/RemoteScene.h', 'service/scene-manager', 'RemoteScene.h') | |||||
scenemanager_env.UserInstallTargetHeader('include/RemoteSceneAction.h', 'service/scene-manager', 'RemoteSceneAction.h') | |||||
-# Go to build Unit test | |||||
-if target_os in ['linux']: | |||||
- SConscript('unittests/SConscript') | |||||
- | |||||
# Go to build sample apps | |||||
SConscript('sampleapp/SConscript') |
@ -1,29 +0,0 @@ | |||||
From 51e26e002aa043435f94ac0f071066090d5c2de8 Mon Sep 17 00:00:00 2001 | |||||
From: Hauke Mehrtens <hauke@hauke-m.de> | |||||
Date: Mon, 22 Jun 2015 20:23:36 +0200 | |||||
Subject: [PATCH 5/5] do not chck for boost | |||||
Boost is not needed for every package just for some. | |||||
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> | |||||
--- | |||||
service/third_party_libs.scons | 8 -------- | |||||
1 file changed, 8 deletions(-) | |||||
--- a/service/third_party_libs.scons | |||||
+++ b/service/third_party_libs.scons | |||||
@@ -49,14 +49,6 @@ if target_os in ['linux']: | |||||
conf = Configure(lib_env) | |||||
- if target_os not in ['tizen'] and not conf.CheckLib('boost_thread', language='C++'): | |||||
- print 'Did not find boost_thread, exiting!' | |||||
- Exit(1) | |||||
- | |||||
- if target_os not in ['tizen'] and not conf.CheckLib('boost_system', language='C++'): | |||||
- print 'Did not find boost_system, exiting!' | |||||
- Exit(1) | |||||
- | |||||
lib_env = conf.Finish() | |||||
###################################################################### |
@ -1,44 +0,0 @@ | |||||
From dabd6597013e1df72b08621b466d136b8d25d110 Mon Sep 17 00:00:00 2001 | |||||
From: Philippe Coval <philippe.coval@osg.samsung.com> | |||||
Date: Thu, 29 Sep 2016 10:57:59 +0200 | |||||
Subject: [PATCH 20/23] linux: Add more architectures | |||||
This does not scale and this check should be removed. | |||||
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> | |||||
Author: Hauke Mehrtens <hauke@hauke-m.de> | |||||
Change-Id: Ibb271701904745ee4f5dd689c197228239c37262 | |||||
Origin: https://github.com/openwrt/packages/blob/master/net/iotivity/patches/021-add-some-more-architectures.patch | |||||
Signed-off-by: Philippe Coval <philippe.coval@osg.samsung.com> | |||||
Reviewed-on: https://gerrit.iotivity.org/gerrit/14575 | |||||
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org> | |||||
Reviewed-by: Nivedita Singhvi <niveditasinghvi@gmail.com> | |||||
Reviewed-by: Jaehong Jo <jaehong.jo@samsung.com> | |||||
Reviewed-by: Hauke Mehrtens <hauke.mehrtens@intel.com> | |||||
--- | |||||
build_common/SConscript | 2 +- | |||||
resource/csdk/connectivity/build/SConscript | 2 +- | |||||
2 files changed, 2 insertions(+), 2 deletions(-) | |||||
--- a/build_common/SConscript | |||||
+++ b/build_common/SConscript | |||||
@@ -18,7 +18,7 @@ host_target_map = { | |||||
# Map of os and allowed archs (os: allowed archs) | |||||
os_arch_map = { | |||||
- 'linux': ['x86', 'x86_64', 'arm', 'arm-v7a', 'armeabi-v7a', 'arm64'], | |||||
+ 'linux': ['x86', 'x86_64', 'arm', 'arm-v7a', 'armeabi-v7a', 'arm64', 'mips', 'mipsel', 'mips64', 'mips64el', 'i386', 'powerpc', 'sparc', 'aarch64'], | |||||
'tizen': ['x86', 'x86_64', 'arm', 'arm-v7a', 'armeabi-v7a', 'arm64'], | |||||
'android': ['x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'armeabi-v7a-hard', 'arm64-v8a'], | |||||
'windows': ['x86', 'amd64', 'arm'], | |||||
--- a/resource/csdk/connectivity/build/SConscript | |||||
+++ b/resource/csdk/connectivity/build/SConscript | |||||
@@ -14,7 +14,7 @@ host_target_map = { | |||||
# Map of os and allowed archs (os: allowed archs) | |||||
os_arch_map = { | |||||
- 'linux': ['x86', 'x86_64', 'arm', 'arm64'], | |||||
+ 'linux': ['x86', 'x86_64', 'arm', 'arm64', 'mips', 'mipsel', 'mips64', 'mips64el', 'i386', 'powerpc', 'sparc', 'aarch64'], | |||||
'tizen': ['x86', 'x86_64', 'arm', 'arm64'], | |||||
'android': ['x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'armeabi-v7a-hard', 'arm64-v8a'], | |||||
'windows': ['x86', 'amd64', 'arm'], |
@ -1,39 +0,0 @@ | |||||
From 792f68219b3ab4ff5238e3abc7aa1c68bfa4a22b Mon Sep 17 00:00:00 2001 | |||||
From: Hauke Mehrtens <hauke@hauke-m.de> | |||||
Date: Sat, 10 Dec 2016 18:15:32 +0100 | |||||
Subject: [PATCH 21/23] build: do not set TARGET_ARCH to default | |||||
This check is useless, scons already checks this and returns such an | |||||
error message: | |||||
Invalid value for option TARGET_ARCH: mips. Valid values are: ['x86', 'x86_64', 'arm', 'arm-v7a', 'armeabi-v7a', 'arm64'] | |||||
Change-Id: I3f7dd3b9fcae875ab20349203fb77537f24be763 | |||||
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> | |||||
--- | |||||
build_common/SConscript | 3 --- | |||||
resource/csdk/connectivity/build/SConscript | 2 -- | |||||
2 files changed, 5 deletions(-) | |||||
--- a/build_common/SConscript | |||||
+++ b/build_common/SConscript | |||||
@@ -54,9 +54,6 @@ if target_os == 'android': | |||||
else: | |||||
default_arch = platform.machine() | |||||
-if default_arch not in os_arch_map[target_os]: | |||||
- default_arch = os_arch_map[target_os][0].lower() | |||||
- | |||||
target_arch = ARGUMENTS.get('TARGET_ARCH', default_arch) # target arch | |||||
# True if binary needs to be installed on board. (Might need root permissions) | |||||
--- a/resource/csdk/connectivity/build/SConscript | |||||
+++ b/resource/csdk/connectivity/build/SConscript | |||||
@@ -40,8 +40,6 @@ if target_os not in host_target_map[host | |||||
Exit(1) | |||||
default_arch = platform.machine() | |||||
-if default_arch not in os_arch_map[target_os]: | |||||
- default_arch = os_arch_map[target_os][0].lower() | |||||
target_arch = ARGUMENTS.get('TARGET_ARCH', default_arch) # target arch | |||||
@ -1,57 +0,0 @@ | |||||
From 39b0c436c77555849da1e68cc8733c67183c291f Mon Sep 17 00:00:00 2001 | |||||
From: Hauke Mehrtens <hauke@hauke-m.de> | |||||
Date: Sat, 10 Dec 2016 18:35:04 +0100 | |||||
Subject: [PATCH 22/23] build: restrict compiler options to supported | |||||
architectures | |||||
For Linux we currently only support the following architectures: | |||||
'x86', 'x86_64', 'arm', 'arm-v7a', 'armeabi-v7a', 'arm64' | |||||
explicitly check for those architectures and also remove ARM hard float. | |||||
Change-Id: I7078530bc2a89b88c7049cc53e8bb3fbe5d75ca8 | |||||
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> | |||||
--- | |||||
build_common/linux/SConscript | 11 +++-------- | |||||
resource/csdk/connectivity/build/linux/SConscript | 11 +++-------- | |||||
2 files changed, 6 insertions(+), 16 deletions(-) | |||||
--- a/build_common/linux/SConscript | |||||
+++ b/build_common/linux/SConscript | |||||
@@ -30,14 +30,9 @@ if target_arch in ['x86']: | |||||
elif target_arch in ['x86_64']: | |||||
env.AppendUnique(CCFLAGS = ['-m64']) | |||||
env.AppendUnique(LINKFLAGS = ['-m64']) | |||||
-elif target_arch in ['arm'] or target_arch.find('v5') > 0: | |||||
+elif target_arch in ['arm']: | |||||
env.AppendUnique(CPPFLAGS = ['-march=armv5te']) | |||||
-elif target_arch.find('v7a-hard') > 0: | |||||
+elif target_arch in ['arm-v7a', 'armeabi-v7a']: | |||||
env.AppendUnique(CPPFLAGS = ['-march=armv7-a']) | |||||
- env.AppendUnique(CPPFLAGS = ['-mfloat-abi=hard']) | |||||
- env.AppendUnique(CCFLAGS = ['-mfloat-abi=hard']) | |||||
- env.AppendUnique(LINKFLAGS = ['-mfloat-abi=hard']) | |||||
-elif target_arch.find('v7a') > 0: | |||||
- env.AppendUnique(CPPFLAGS = ['-march=armv7-a']) | |||||
-elif target_arch.find('arm64') >= 0: | |||||
+elif target_arch.find('arm64') > 0: | |||||
env.AppendUnique(CPPFLAGS = ['-march=armv8-a']) | |||||
--- a/resource/csdk/connectivity/build/linux/SConscript | |||||
+++ b/resource/csdk/connectivity/build/linux/SConscript | |||||
@@ -29,14 +29,9 @@ if target_arch in ['x86']: | |||||
elif target_arch in ['x86_64']: | |||||
env.AppendUnique(CCFLAGS = ['-m64']) | |||||
env.AppendUnique(LINKFLAGS = ['-m64']) | |||||
-elif target_arch.find('v7a-hard') > 0: | |||||
- env.AppendUnique(CPPFLAGS = ['-march=armv7-a']) | |||||
- env.AppendUnique(CPPFLAGS = ['-mfloat-abi=hard']) | |||||
- env.AppendUnique(CCFLAGS = ['-mfloat-abi=hard']) | |||||
- env.AppendUnique(LINKFLAGS = ['-mfloat-abi=hard']) | |||||
-elif target_arch.find('v7a') > 0: | |||||
+elif target_arch in ['arm']: | |||||
+ env.AppendUnique(CPPFLAGS = ['-march=armv5te']) | |||||
+elif target_arch in ['arm-v7a', 'armeabi-v7a']: | |||||
env.AppendUnique(CPPFLAGS = ['-march=armv7-a']) | |||||
elif target_arch.find('arm64') > 0: | |||||
env.AppendUnique(CPPFLAGS = ['-march=armv8-a']) | |||||
-else: | |||||
- env.AppendUnique(CPPFLAGS = ['-march=armv5te']) |
@ -1,126 +0,0 @@ | |||||
From 5f9513eb341d520d10c48f8ba2bd145063405fdd Mon Sep 17 00:00:00 2001 | |||||
From: Hauke Mehrtens <hauke@hauke-m.de> | |||||
Date: Sat, 10 Dec 2016 18:08:05 +0100 | |||||
Subject: [PATCH 23/23] build: take compiler options from environment | |||||
This makes it possible to compile IoTivity with custom compiler | |||||
options. This way someone can use optimized compiler settings for the | |||||
target CPU. I want to use this in OpenWrt / LEDE to build specific | |||||
IoTivity binaries for each CPU architecture, there the build system | |||||
provides the matching compiler options. | |||||
Change-Id: I86772f73b81c41d7e96e51b434fd9e3b4992753a | |||||
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> | |||||
--- | |||||
build_common/SConscript | 25 +++++++++++++++++++++ | |||||
build_common/linux/SConscript | 27 ++++++++++++----------- | |||||
resource/csdk/connectivity/build/linux/SConscript | 27 ++++++++++++----------- | |||||
3 files changed, 53 insertions(+), 26 deletions(-) | |||||
--- a/build_common/SConscript | |||||
+++ b/build_common/SConscript | |||||
@@ -120,6 +120,7 @@ help_vars.Add(PathVariable('ANDROID_NDK' | |||||
help_vars.Add(PathVariable('ANDROID_HOME', 'Android SDK path', None, PathVariable.PathAccept)) | |||||
help_vars.Add(PathVariable('ANDROID_GRADLE', 'Gradle binary file', None, PathVariable.PathIsFile)) | |||||
help_vars.Add(EnumVariable('WITH_UPSTREAM_LIBCOAP', 'Use latest stable version of LibCoAP downloaded from github', default_with_upstream_libcoap, allowed_values=('0','1'))) | |||||
+help_vars.Add(BoolVariable('WITH_ENV', 'Use compiler options from environment', False)) | |||||
AddOption('--prefix', | |||||
dest='prefix', | |||||
@@ -153,6 +154,30 @@ else: | |||||
) | |||||
Help(help_vars.GenerateHelpText(env)) | |||||
+if env.get('WITH_ENV'): | |||||
+ env['ENV'] = os.environ | |||||
+ if 'CC' in os.environ: | |||||
+ env['CC'] = Split(os.environ['CC']) | |||||
+ print "using CC from environment: %s" % env['CC'] | |||||
+ if 'CXX' in os.environ: | |||||
+ env['CXX'] = Split(os.environ['CXX']) | |||||
+ print "using CXX from environment: %s" % env['CXX'] | |||||
+ if 'CFLAGS' in os.environ: | |||||
+ env['CFLAGS'] = Split(os.environ['CFLAGS']) | |||||
+ print "using CFLAGS from environment: %s" % env['CFLAGS'] | |||||
+ if 'CXXFLAGS' in os.environ: | |||||
+ env['CXXFLAGS'] = Split(os.environ['CXXFLAGS']) | |||||
+ print "using CXXFLAGS from environment: %s" % env['CXXFLAGS'] | |||||
+ if 'CCFLAGS' in os.environ: | |||||
+ env['CCFLAGS'] = Split(os.environ['CCFLAGS']) | |||||
+ print "using CCFLAGS from environment: %s" % env['CCFLAGS'] | |||||
+ if 'CPPFLAGS' in os.environ: | |||||
+ env['CPPFLAGS'] = Split(os.environ['CPPFLAGS']) | |||||
+ print "using CPPFLAGS from environment: %s" % env['CPPFLAGS'] | |||||
+ if 'LDFLAGS' in os.environ: | |||||
+ env['LINKFLAGS'] = Split(os.environ['LDFLAGS']) | |||||
+ print "using LDFLAGS/LINKFLAGS from environment: %s" % env['LINKFLAGS'] | |||||
+ | |||||
tc_set_msg = ''' | |||||
************************************ Warning ********************************** | |||||
* Enviornment variable TC_PREFIX/TC_PATH is set. It will change the default * | |||||
--- a/build_common/linux/SConscript | |||||
+++ b/build_common/linux/SConscript | |||||
@@ -23,16 +23,17 @@ env.AppendUnique(CCFLAGS = ['-Wall', '-W | |||||
env.AppendUnique(LIBS = ['dl', 'pthread', 'uuid']) | |||||
# Set arch flags that match best TARGET_ARCH variable | |||||
-target_arch = env.get('TARGET_ARCH') | |||||
-if target_arch in ['x86']: | |||||
- env.AppendUnique(CCFLAGS = ['-m32']) | |||||
- env.AppendUnique(LINKFLAGS = ['-m32']) | |||||
-elif target_arch in ['x86_64']: | |||||
- env.AppendUnique(CCFLAGS = ['-m64']) | |||||
- env.AppendUnique(LINKFLAGS = ['-m64']) | |||||
-elif target_arch in ['arm']: | |||||
- env.AppendUnique(CPPFLAGS = ['-march=armv5te']) | |||||
-elif target_arch in ['arm-v7a', 'armeabi-v7a']: | |||||
- env.AppendUnique(CPPFLAGS = ['-march=armv7-a']) | |||||
-elif target_arch.find('arm64') > 0: | |||||
- env.AppendUnique(CPPFLAGS = ['-march=armv8-a']) | |||||
+if not env.get('WITH_ENV'): | |||||
+ target_arch = env.get('TARGET_ARCH') | |||||
+ if target_arch in ['x86']: | |||||
+ env.AppendUnique(CCFLAGS = ['-m32']) | |||||
+ env.AppendUnique(LINKFLAGS = ['-m32']) | |||||
+ elif target_arch in ['x86_64']: | |||||
+ env.AppendUnique(CCFLAGS = ['-m64']) | |||||
+ env.AppendUnique(LINKFLAGS = ['-m64']) | |||||
+ elif target_arch in ['arm']: | |||||
+ env.AppendUnique(CPPFLAGS = ['-march=armv5te']) | |||||
+ elif target_arch in ['arm-v7a', 'armeabi-v7a']: | |||||
+ env.AppendUnique(CPPFLAGS = ['-march=armv7-a']) | |||||
+ elif target_arch.find('arm64') > 0: | |||||
+ env.AppendUnique(CPPFLAGS = ['-march=armv8-a']) | |||||
--- a/resource/csdk/connectivity/build/linux/SConscript | |||||
+++ b/resource/csdk/connectivity/build/linux/SConscript | |||||
@@ -22,16 +22,17 @@ env.AppendUnique(CCFLAGS = ['-Wall', '-f | |||||
env.AppendUnique(LIBS = ['dl', 'pthread']) | |||||
# Set arch flags | |||||
-target_arch = env.get('TARGET_ARCH') | |||||
-if target_arch in ['x86']: | |||||
- env.AppendUnique(CCFLAGS = ['-m32']) | |||||
- env.AppendUnique(LINKFLAGS = ['-m32']) | |||||
-elif target_arch in ['x86_64']: | |||||
- env.AppendUnique(CCFLAGS = ['-m64']) | |||||
- env.AppendUnique(LINKFLAGS = ['-m64']) | |||||
-elif target_arch in ['arm']: | |||||
- env.AppendUnique(CPPFLAGS = ['-march=armv5te']) | |||||
-elif target_arch in ['arm-v7a', 'armeabi-v7a']: | |||||
- env.AppendUnique(CPPFLAGS = ['-march=armv7-a']) | |||||
-elif target_arch.find('arm64') > 0: | |||||
- env.AppendUnique(CPPFLAGS = ['-march=armv8-a']) | |||||
+if not env.get('WITH_ENV'): | |||||
+ target_arch = env.get('TARGET_ARCH') | |||||
+ if target_arch in ['x86']: | |||||
+ env.AppendUnique(CCFLAGS = ['-m32']) | |||||
+ env.AppendUnique(LINKFLAGS = ['-m32']) | |||||
+ elif target_arch in ['x86_64']: | |||||
+ env.AppendUnique(CCFLAGS = ['-m64']) | |||||
+ env.AppendUnique(LINKFLAGS = ['-m64']) | |||||
+ elif target_arch in ['arm']: | |||||
+ env.AppendUnique(CPPFLAGS = ['-march=armv5te']) | |||||
+ elif target_arch in ['arm-v7a', 'armeabi-v7a']: | |||||
+ env.AppendUnique(CPPFLAGS = ['-march=armv7-a']) | |||||
+ elif target_arch.find('arm64') > 0: | |||||
+ env.AppendUnique(CPPFLAGS = ['-march=armv8-a']) |
@ -1,55 +0,0 @@ | |||||
--- a/service/resource-container/SConscript | |||||
+++ b/service/resource-container/SConscript | |||||
@@ -191,36 +191,22 @@ if target_os in ['linux', 'tizen', 'andr | |||||
# build hue sample bundle | |||||
###################################################################### | |||||
-conf2 = Configure(lib_env) | |||||
-if not conf2.CheckLib('curl'): | |||||
- print '''X | |||||
-*********************************** Error ************************************* | |||||
-* Cannot build hue sample. Please install libcurl. | |||||
-* Example (Ubuntu): | |||||
-* sudo apt-get install libcurl4-openssl-dev | |||||
-* sudo ldconfig | |||||
-* Hint: check with pkg-config --libs libcurl and clear scons cache. | |||||
-* Skipping hue sample build. | |||||
-******************************************************************************* | |||||
- ''' | |||||
-else: | |||||
- hue_resource_bundle_env = resource_container_env.Clone() | |||||
- hue_resource_bundle_env.AppendUnique(CCFLAGS = ['-fPIC']) | |||||
- | |||||
- HUE_RESOURCE_BUNDLE_DIR = 'examples/HueSampleBundle/' | |||||
- hue_resource_bundle_env.AppendUnique(CPPPATH = [ | |||||
- HUE_RESOURCE_BUNDLE_DIR + 'include', | |||||
- 'include/' | |||||
- ]) | |||||
- | |||||
- hue_resource_bundle_env.PrependUnique(LIBS = ['curl', 'rcs_container']) | |||||
- | |||||
- hue_resource_bundle_src = [ Glob(HUE_RESOURCE_BUNDLE_DIR + 'src/*.cpp')] | |||||
- | |||||
- HueBundle = hue_resource_bundle_env.SharedLibrary('HueBundle', hue_resource_bundle_src) | |||||
- hue_resource_bundle_env.InstallTarget(HueBundle, 'libHueBundle') | |||||
- hue_resource_bundle_env.UserInstallTargetLib(HueBundle, 'libHueBundle') | |||||
-lib_env = conf2.Finish() | |||||
+hue_resource_bundle_env = resource_container_env.Clone() | |||||
+hue_resource_bundle_env.AppendUnique(CCFLAGS = ['-fPIC']) | |||||
+ | |||||
+HUE_RESOURCE_BUNDLE_DIR = 'examples/HueSampleBundle/' | |||||
+hue_resource_bundle_env.AppendUnique(CPPPATH = [ | |||||
+ HUE_RESOURCE_BUNDLE_DIR + 'include', | |||||
+ 'include/' | |||||
+ ]) | |||||
+ | |||||
+hue_resource_bundle_env.PrependUnique(LIBS = ['curl', 'rcs_container']) | |||||
+ | |||||
+hue_resource_bundle_src = [ Glob(HUE_RESOURCE_BUNDLE_DIR + 'src/*.cpp')] | |||||
+ | |||||
+HueBundle = hue_resource_bundle_env.SharedLibrary('HueBundle', hue_resource_bundle_src) | |||||
+hue_resource_bundle_env.InstallTarget(HueBundle, 'libHueBundle') | |||||
+hue_resource_bundle_env.UserInstallTargetLib(HueBundle, 'libHueBundle') | |||||
###################################################################### | |||||
# Build Container Sample |
@ -1,27 +0,0 @@ | |||||
From 08b403572985a70fe5d652378e1cfa2b72ac6a3d Mon Sep 17 00:00:00 2001 | |||||
From: Philippe Coval <philippe.coval@osg.samsung.com> | |||||
Date: Fri, 9 Dec 2016 02:12:04 +0100 | |||||
Subject: [PATCH] linux: Use system sqlite3 | |||||
Problem was discovered on yocto | |||||
Change-Id: I5274bed9e4b7ddcdc1b17a265a1886cd78cb631f | |||||
Signed-off-by: Philippe Coval <philippe.coval@osg.samsung.com> | |||||
Reviewed-on: https://gerrit.iotivity.org/gerrit/15305 | |||||
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org> | |||||
Reviewed-by: Ziran Sun <ziran.sun@samsung.com> | |||||
--- | |||||
resource/csdk/SConscript | 2 +- | |||||
1 file changed, 1 insertion(+), 1 deletion(-) | |||||
--- a/resource/csdk/SConscript | |||||
+++ b/resource/csdk/SConscript | |||||
@@ -191,7 +191,7 @@ if with_tcp == True: | |||||
if 'SERVER' in rd_mode: | |||||
liboctbstack_src.append(OCTBSTACK_SRC + 'oicresourcedirectory.c') | |||||
- if target_os not in ['tizen']: | |||||
+ if target_os not in ['linux', 'tizen']: | |||||
liboctbstack_src.append('#extlibs/sqlite3/sqlite3.c') | |||||
if target_os in ['linux']: |
@ -1,54 +0,0 @@ | |||||
From d8cf30cb0abd5fa8f6282b490618204d683b625c Mon Sep 17 00:00:00 2001 | |||||
From: Hauke Mehrtens <hauke@hauke-m.de> | |||||
Date: Mon, 3 Oct 2016 21:00:28 +0200 | |||||
Subject: [PATCH 1/3] csdk: move OCEntityHandlerResponse from stack to heap | |||||
OCEntityHandlerResponse is over 50KByte and I got a stack overflow on MIPS | |||||
running on LEDE without this patch. Instead of storing | |||||
OCEntityHandlerResponse on the program stack, allocate some memory on | |||||
the heap and free it afterwards again. | |||||
This fixes one part of this issue for me: | |||||
https://jira.iotivity.org/browse/IOT-1374 | |||||
Change-Id: I365a5c7a34dce2dfb0897a20b57a13ba566748ec | |||||
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> | |||||
--- | |||||
resource/csdk/stack/src/ocresource.c | 24 +++++++++++++++++------- | |||||
1 file changed, 17 insertions(+), 7 deletions(-) | |||||
--- a/resource/csdk/stack/src/ocresource.c | |||||
+++ b/resource/csdk/stack/src/ocresource.c | |||||
@@ -774,15 +774,25 @@ static bool includeThisResourceInRespons | |||||
OCStackResult SendNonPersistantDiscoveryResponse(OCServerRequest *request, OCResource *resource, | |||||
OCPayload *discoveryPayload, OCEntityHandlerResult ehResult) | |||||
{ | |||||
- OCEntityHandlerResponse response = {0}; | |||||
+ OCEntityHandlerResponse *response = NULL; | |||||
+ OCStackResult result = OC_STACK_ERROR; | |||||
- response.ehResult = ehResult; | |||||
- response.payload = discoveryPayload; | |||||
- response.persistentBufferFlag = 0; | |||||
- response.requestHandle = (OCRequestHandle) request->requestId; | |||||
- response.resourceHandle = (OCResourceHandle) resource; | |||||
+ response = (OCEntityHandlerResponse *)OICCalloc(1, sizeof(*response)); | |||||
+ VERIFY_PARAM_NON_NULL(TAG, response, "Failed allocating OCEntityHandlerResponse"); | |||||
- return OCDoResponse(&response); | |||||
+ response->ehResult = ehResult; | |||||
+ response->payload = discoveryPayload; | |||||
+ response->persistentBufferFlag = 0; | |||||
+ response->requestHandle = (OCRequestHandle) request->requestId; | |||||
+ response->resourceHandle = (OCResourceHandle) resource; | |||||
+ | |||||
+ result = OCDoResponse(response); | |||||
+ | |||||
+ OICFree(response); | |||||
+ return result; | |||||
+ | |||||
+exit: | |||||
+ return OC_STACK_NO_MEMORY; | |||||
} | |||||
static OCStackResult EHRequest(OCEntityHandlerRequest *ehRequest, OCPayloadType type, |
@ -1,357 +0,0 @@ | |||||
From e8971dd4914c9d42938c4c885b4ac6d784d7e0ff Mon Sep 17 00:00:00 2001 | |||||
From: Hauke Mehrtens <hauke@hauke-m.de> | |||||
Date: Mon, 3 Oct 2016 23:22:36 +0200 | |||||
Subject: [PATCH 2/3] csdk: move OCClientResponse from stack to heap | |||||
OCClientResponse is about 50KByte and should not be stored on the | |||||
stack. On LEDE with MIPS, musl libc this causes a segmentation fault. | |||||
Moving this structure to the heap is the simple solution for this | |||||
problem, but this structure should be shrined. | |||||
There are probably more places were this is stored on the stack and | |||||
will cause problems. This fixes the other issue I saw in | |||||
https://jira.iotivity.org/browse/IOT-1374 | |||||
Change-Id: I45d8aee4a8151fea51d3318acb1eea61ce579060 | |||||
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> | |||||
--- | |||||
resource/csdk/stack/src/ocstack.c | 163 ++++++++++++++++++++++++-------------- | |||||
1 file changed, 102 insertions(+), 61 deletions(-) | |||||
--- a/resource/csdk/stack/src/ocstack.c | |||||
+++ b/resource/csdk/stack/src/ocstack.c | |||||
@@ -1042,7 +1042,7 @@ OCStackResult HandlePresenceResponse(con | |||||
OCStackApplicationResult cbResult = OC_STACK_DELETE_TRANSACTION; | |||||
ClientCB * cbNode = NULL; | |||||
char *resourceTypeName = NULL; | |||||
- OCClientResponse response = {.devAddr = {.adapter = OC_DEFAULT_ADAPTER}}; | |||||
+ OCClientResponse *response = NULL; | |||||
OCStackResult result = OC_STACK_ERROR; | |||||
uint32_t maxAge = 0; | |||||
int uriLen; | |||||
@@ -1057,15 +1057,23 @@ OCStackResult HandlePresenceResponse(con | |||||
return OC_STACK_ERROR; | |||||
} | |||||
- response.payload = NULL; | |||||
- response.result = OC_STACK_OK; | |||||
+ response = (OCClientResponse *)OICCalloc(1, sizeof(*response)); | |||||
+ if (!response) | |||||
+ { | |||||
+ OIC_LOG(ERROR, TAG, "Allocating memory for response failed"); | |||||
+ return OC_STACK_ERROR; | |||||
+ } | |||||
+ response->devAddr.adapter = OC_DEFAULT_ADAPTER; | |||||
- CopyEndpointToDevAddr(endpoint, &response.devAddr); | |||||
- FixUpClientResponse(&response); | |||||
+ response->payload = NULL; | |||||
+ response->result = OC_STACK_OK; | |||||
+ | |||||
+ CopyEndpointToDevAddr(endpoint, &response->devAddr); | |||||
+ FixUpClientResponse(response); | |||||
if (responseInfo->info.payload) | |||||
{ | |||||
- result = OCParsePayload(&response.payload, | |||||
+ result = OCParsePayload(&response->payload, | |||||
PAYLOAD_TYPE_PRESENCE, | |||||
responseInfo->info.payload, | |||||
responseInfo->info.payloadSize); | |||||
@@ -1075,15 +1083,15 @@ OCStackResult HandlePresenceResponse(con | |||||
OIC_LOG(ERROR, TAG, "Presence parse failed"); | |||||
goto exit; | |||||
} | |||||
- if(!response.payload || response.payload->type != PAYLOAD_TYPE_PRESENCE) | |||||
+ if(!response->payload || response->payload->type != PAYLOAD_TYPE_PRESENCE) | |||||
{ | |||||
OIC_LOG(ERROR, TAG, "Presence payload was wrong type"); | |||||
result = OC_STACK_ERROR; | |||||
goto exit; | |||||
} | |||||
- response.sequenceNumber = ((OCPresencePayload*)response.payload)->sequenceNumber; | |||||
- resourceTypeName = ((OCPresencePayload*)response.payload)->resourceType; | |||||
- maxAge = ((OCPresencePayload*)response.payload)->maxAge; | |||||
+ response->sequenceNumber = ((OCPresencePayload*)response->payload)->sequenceNumber; | |||||
+ resourceTypeName = ((OCPresencePayload*)response->payload)->resourceType; | |||||
+ maxAge = ((OCPresencePayload*)response->payload)->maxAge; | |||||
} | |||||
// check for unicast presence | |||||
@@ -1091,6 +1099,7 @@ OCStackResult HandlePresenceResponse(con | |||||
responseInfo->isMulticast); | |||||
if (uriLen < 0 || (size_t)uriLen >= sizeof (presenceUri)) | |||||
{ | |||||
+ OICFree(response); | |||||
return OC_STACK_INVALID_URI; | |||||
} | |||||
OIC_LOG(ERROR, TAG, "check for unicast presence"); | |||||
@@ -1118,7 +1127,7 @@ OCStackResult HandlePresenceResponse(con | |||||
if (presenceSubscribe) | |||||
{ | |||||
- if(cbNode->sequenceNumber == response.sequenceNumber) | |||||
+ if(cbNode->sequenceNumber == response->sequenceNumber) | |||||
{ | |||||
OIC_LOG(INFO, TAG, "No presence change"); | |||||
ResetPresenceTTL(cbNode, maxAge); | |||||
@@ -1129,7 +1138,7 @@ OCStackResult HandlePresenceResponse(con | |||||
if(maxAge == 0) | |||||
{ | |||||
OIC_LOG(INFO, TAG, "Stopping presence"); | |||||
- response.result = OC_STACK_PRESENCE_STOPPED; | |||||
+ response->result = OC_STACK_PRESENCE_STOPPED; | |||||
if(cbNode->presence) | |||||
{ | |||||
OICFree(cbNode->presence->timeOut); | |||||
@@ -1165,7 +1174,7 @@ OCStackResult HandlePresenceResponse(con | |||||
ResetPresenceTTL(cbNode, maxAge); | |||||
- cbNode->sequenceNumber = response.sequenceNumber; | |||||
+ cbNode->sequenceNumber = response->sequenceNumber; | |||||
} | |||||
} | |||||
else | |||||
@@ -1175,7 +1184,7 @@ OCStackResult HandlePresenceResponse(con | |||||
if (0 == maxAge) | |||||
{ | |||||
OIC_LOG(INFO, TAG, "Stopping presence"); | |||||
- response.result = OC_STACK_PRESENCE_STOPPED; | |||||
+ response->result = OC_STACK_PRESENCE_STOPPED; | |||||
} | |||||
} | |||||
@@ -1191,7 +1200,7 @@ OCStackResult HandlePresenceResponse(con | |||||
OIC_LOG(INFO, TAG, "Callback for presence"); | |||||
- cbResult = cbNode->callBack(cbNode->context, cbNode->handle, &response); | |||||
+ cbResult = cbNode->callBack(cbNode->context, cbNode->handle, response); | |||||
if (cbResult == OC_STACK_DELETE_TRANSACTION) | |||||
{ | |||||
@@ -1199,7 +1208,8 @@ OCStackResult HandlePresenceResponse(con | |||||
} | |||||
exit: | |||||
- OCPayloadDestroy(response.payload); | |||||
+ OCPayloadDestroy(response->payload); | |||||
+ OICFree(response); | |||||
return result; | |||||
} | |||||
@@ -1240,36 +1250,53 @@ void OCHandleResponse(const CAEndpoint_t | |||||
OIC_LOG(INFO, TAG, "Receiving A Timeout for this token"); | |||||
OIC_LOG(INFO, TAG, "Calling into application address space"); | |||||
- OCClientResponse response = | |||||
- {.devAddr = {.adapter = OC_DEFAULT_ADAPTER}}; | |||||
- CopyEndpointToDevAddr(endPoint, &response.devAddr); | |||||
- FixUpClientResponse(&response); | |||||
- response.resourceUri = responseInfo->info.resourceUri; | |||||
- memcpy(response.identity.id, responseInfo->info.identity.id, | |||||
- sizeof (response.identity.id)); | |||||
- response.identity.id_length = responseInfo->info.identity.id_length; | |||||
+ OCClientResponse *response = NULL; | |||||
+ | |||||
+ response = (OCClientResponse *)OICCalloc(1, sizeof(*response)); | |||||
+ if (!response) | |||||
+ { | |||||
+ OIC_LOG(ERROR, TAG, "Allocating memory for response failed"); | |||||
+ return; | |||||
+ } | |||||
+ | |||||
+ response->devAddr.adapter = OC_DEFAULT_ADAPTER; | |||||
+ CopyEndpointToDevAddr(endPoint, &response->devAddr); | |||||
+ FixUpClientResponse(response); | |||||
+ response->resourceUri = responseInfo->info.resourceUri; | |||||
+ memcpy(response->identity.id, responseInfo->info.identity.id, | |||||
+ sizeof (response->identity.id)); | |||||
+ response->identity.id_length = responseInfo->info.identity.id_length; | |||||
- response.result = CAResponseToOCStackResult(responseInfo->result); | |||||
+ response->result = CAResponseToOCStackResult(responseInfo->result); | |||||
cbNode->callBack(cbNode->context, | |||||
- cbNode->handle, &response); | |||||
+ cbNode->handle, response); | |||||
FindAndDeleteClientCB(cbNode); | |||||
+ OICFree(response); | |||||
} | |||||
else | |||||
{ | |||||
OIC_LOG(INFO, TAG, "This is a regular response, A client call back is found"); | |||||
OIC_LOG(INFO, TAG, "Calling into application address space"); | |||||
- OCClientResponse response = | |||||
- {.devAddr = {.adapter = OC_DEFAULT_ADAPTER}}; | |||||
- response.sequenceNumber = MAX_SEQUENCE_NUMBER + 1; | |||||
- CopyEndpointToDevAddr(endPoint, &response.devAddr); | |||||
- FixUpClientResponse(&response); | |||||
- response.resourceUri = responseInfo->info.resourceUri; | |||||
- memcpy(response.identity.id, responseInfo->info.identity.id, | |||||
- sizeof (response.identity.id)); | |||||
- response.identity.id_length = responseInfo->info.identity.id_length; | |||||
+ OCClientResponse *response = NULL; | |||||
- response.result = CAResponseToOCStackResult(responseInfo->result); | |||||
+ response = (OCClientResponse *)OICCalloc(1, sizeof(*response)); | |||||
+ if (!response) | |||||
+ { | |||||
+ OIC_LOG(ERROR, TAG, "Allocating memory for response failed"); | |||||
+ return; | |||||
+ } | |||||
+ | |||||
+ response->devAddr.adapter = OC_DEFAULT_ADAPTER; | |||||
+ response->sequenceNumber = MAX_SEQUENCE_NUMBER + 1; | |||||
+ CopyEndpointToDevAddr(endPoint, &response->devAddr); | |||||
+ FixUpClientResponse(response); | |||||
+ response->resourceUri = responseInfo->info.resourceUri; | |||||
+ memcpy(response->identity.id, responseInfo->info.identity.id, | |||||
+ sizeof (response->identity.id)); | |||||
+ response->identity.id_length = responseInfo->info.identity.id_length; | |||||
+ | |||||
+ response->result = CAResponseToOCStackResult(responseInfo->result); | |||||
if(responseInfo->info.payload && | |||||
responseInfo->info.payloadSize) | |||||
@@ -1359,21 +1386,23 @@ void OCHandleResponse(const CAEndpoint_t | |||||
{ | |||||
OIC_LOG_V(ERROR, TAG, "Unknown Payload type: %d %s", | |||||
cbNode->method, cbNode->requestUri); | |||||
+ OICFree(response); | |||||
return; | |||||
} | |||||
- if(OC_STACK_OK != OCParsePayload(&response.payload, | |||||
+ if(OC_STACK_OK != OCParsePayload(&response->payload, | |||||
type, | |||||
responseInfo->info.payload, | |||||
responseInfo->info.payloadSize)) | |||||
{ | |||||
OIC_LOG(ERROR, TAG, "Error converting payload"); | |||||
- OCPayloadDestroy(response.payload); | |||||
+ OCPayloadDestroy(response->payload); | |||||
+ OICFree(response); | |||||
return; | |||||
} | |||||
} | |||||
- response.numRcvdVendorSpecificHeaderOptions = 0; | |||||
+ response->numRcvdVendorSpecificHeaderOptions = 0; | |||||
if(responseInfo->info.numOptions > 0) | |||||
{ | |||||
int start = 0; | |||||
@@ -1391,19 +1420,20 @@ void OCHandleResponse(const CAEndpoint_t | |||||
observationOption = | |||||
(observationOption << 8) | optionData[i]; | |||||
} | |||||
- response.sequenceNumber = observationOption; | |||||
- response.numRcvdVendorSpecificHeaderOptions = responseInfo->info.numOptions - 1; | |||||
+ response->sequenceNumber = observationOption; | |||||
+ response->numRcvdVendorSpecificHeaderOptions = responseInfo->info.numOptions - 1; | |||||
start = 1; | |||||
} | |||||
else | |||||
{ | |||||
- response.numRcvdVendorSpecificHeaderOptions = responseInfo->info.numOptions; | |||||
+ response->numRcvdVendorSpecificHeaderOptions = responseInfo->info.numOptions; | |||||
} | |||||
- if(response.numRcvdVendorSpecificHeaderOptions > MAX_HEADER_OPTIONS) | |||||
+ if(response->numRcvdVendorSpecificHeaderOptions > MAX_HEADER_OPTIONS) | |||||
{ | |||||
OIC_LOG(ERROR, TAG, "#header options are more than MAX_HEADER_OPTIONS"); | |||||
- OCPayloadDestroy(response.payload); | |||||
+ OCPayloadDestroy(response->payload); | |||||
+ OICFree(response); | |||||
return; | |||||
} | |||||
@@ -1411,19 +1441,19 @@ void OCHandleResponse(const CAEndpoint_t | |||||
{ | |||||
if(&(responseInfo->info.options[i])) | |||||
{ | |||||
- memcpy (&(response.rcvdVendorSpecificHeaderOptions[i-start]), | |||||
+ memcpy (&(response->rcvdVendorSpecificHeaderOptions[i-start]), | |||||
&(responseInfo->info.options[i]), sizeof(OCHeaderOption)); | |||||
} | |||||
} | |||||
} | |||||
if (cbNode->method == OC_REST_OBSERVE && | |||||
- response.sequenceNumber > OC_OFFSET_SEQUENCE_NUMBER && | |||||
+ response->sequenceNumber > OC_OFFSET_SEQUENCE_NUMBER && | |||||
cbNode->sequenceNumber <= MAX_SEQUENCE_NUMBER && | |||||
- response.sequenceNumber <= cbNode->sequenceNumber) | |||||
+ response->sequenceNumber <= cbNode->sequenceNumber) | |||||
{ | |||||
OIC_LOG_V(INFO, TAG, "Received stale notification. Number :%d", | |||||
- response.sequenceNumber); | |||||
+ response->sequenceNumber); | |||||
} | |||||
else | |||||
{ | |||||
@@ -1432,13 +1462,13 @@ void OCHandleResponse(const CAEndpoint_t | |||||
char *targetUri = strstr(cbNode->requestUri, OC_RSRVD_RD_URI); | |||||
if (targetUri) | |||||
{ | |||||
- OCUpdateResourceInsWithResponse(cbNode->requestUri, &response); | |||||
+ OCUpdateResourceInsWithResponse(cbNode->requestUri, response); | |||||
} | |||||
#endif | |||||
OCStackApplicationResult appFeedback = cbNode->callBack(cbNode->context, | |||||
cbNode->handle, | |||||
- &response); | |||||
- cbNode->sequenceNumber = response.sequenceNumber; | |||||
+ response); | |||||
+ cbNode->sequenceNumber = response->sequenceNumber; | |||||
if (appFeedback == OC_STACK_DELETE_TRANSACTION) | |||||
{ | |||||
@@ -1459,7 +1489,8 @@ void OCHandleResponse(const CAEndpoint_t | |||||
CA_MSG_ACKNOWLEDGE, 0, NULL, NULL, 0, NULL, CA_RESPONSE_FOR_RES); | |||||
} | |||||
- OCPayloadDestroy(response.payload); | |||||
+ OCPayloadDestroy(response->payload); | |||||
+ OICFree(response); | |||||
} | |||||
return; | |||||
} | |||||
@@ -1585,16 +1616,26 @@ void HandleCAErrorResponse(const CAEndpo | |||||
errorInfo->info.tokenLength, NULL, NULL); | |||||
if (cbNode) | |||||
{ | |||||
- OCClientResponse response = { .devAddr = { .adapter = OC_DEFAULT_ADAPTER } }; | |||||
- CopyEndpointToDevAddr(endPoint, &response.devAddr); | |||||
- FixUpClientResponse(&response); | |||||
- response.resourceUri = errorInfo->info.resourceUri; | |||||
- memcpy(response.identity.id, errorInfo->info.identity.id, | |||||
- sizeof (response.identity.id)); | |||||
- response.identity.id_length = errorInfo->info.identity.id_length; | |||||
- response.result = CAResultToOCResult(errorInfo->result); | |||||
+ OCClientResponse *response = NULL; | |||||
+ | |||||
+ response = (OCClientResponse *)OICCalloc(1, sizeof(*response)); | |||||
+ if (!response) | |||||
+ { | |||||
+ OIC_LOG(ERROR, TAG, "Allocating memory for response failed"); | |||||
+ return; | |||||
+ } | |||||
+ | |||||
+ response->devAddr.adapter = OC_DEFAULT_ADAPTER; | |||||
+ CopyEndpointToDevAddr(endPoint, &response->devAddr); | |||||
+ FixUpClientResponse(response); | |||||
+ response->resourceUri = errorInfo->info.resourceUri; | |||||
+ memcpy(response->identity.id, errorInfo->info.identity.id, | |||||
+ sizeof (response->identity.id)); | |||||
+ response->identity.id_length = errorInfo->info.identity.id_length; | |||||
+ response->result = CAResultToOCResult(errorInfo->result); | |||||
- cbNode->callBack(cbNode->context, cbNode->handle, &response); | |||||
+ cbNode->callBack(cbNode->context, cbNode->handle, response); | |||||
+ OICFree(response); | |||||
} | |||||
ResourceObserver *observer = GetObserverUsingToken(errorInfo->info.token, |
@ -1,103 +0,0 @@ | |||||
From 7fb5b6a19b06dc5b0a7f32261551b206b1e6a563 Mon Sep 17 00:00:00 2001 | |||||
From: Hauke Mehrtens <hauke@hauke-m.de> | |||||
Date: Sun, 8 Jan 2017 19:24:26 +0100 | |||||
Subject: [PATCH 3/3] src: move OCClientResponse from stack to heap | |||||
OCClientResponse is about 50KByte and should not be stored on the | |||||
stack. On LEDE with MIPS, musl libc this causes a segmentation fault. | |||||
Moving this structure to the heap is the simple solution for this | |||||
problem, but this structure should be shrinked. | |||||
Change-Id: I7887f93450f45b8031fcdfffb9ee2214fc3d5dd2 | |||||
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> | |||||
--- | |||||
resource/src/InProcServerWrapper.cpp | 44 +++++++++++++++++++++--------------- | |||||
1 file changed, 26 insertions(+), 18 deletions(-) | |||||
--- a/resource/src/InProcServerWrapper.cpp | |||||
+++ b/resource/src/InProcServerWrapper.cpp | |||||
@@ -568,51 +568,58 @@ namespace OC | |||||
} | |||||
else | |||||
{ | |||||
- OCEntityHandlerResponse response; | |||||
+ OCEntityHandlerResponse *response = NULL; | |||||
+ | |||||
+ response = (OCEntityHandlerResponse *)OICCalloc(1, sizeof(*response)); | |||||
+ if (!response) { | |||||
+ result = OC_STACK_MALFORMED_RESPONSE; | |||||
+ throw OCException(OC::Exception::STR_NULL_RESPONSE, OC_STACK_MALFORMED_RESPONSE); | |||||
+ } | |||||
+ | |||||
// OCRepPayload* payLoad = pResponse->getPayload(); | |||||
HeaderOptions serverHeaderOptions = pResponse->getHeaderOptions(); | |||||
- response.requestHandle = pResponse->getRequestHandle(); | |||||
- response.resourceHandle = pResponse->getResourceHandle(); | |||||
- response.ehResult = pResponse->getResponseResult(); | |||||
+ response->requestHandle = pResponse->getRequestHandle(); | |||||
+ response->resourceHandle = pResponse->getResourceHandle(); | |||||
+ response->ehResult = pResponse->getResponseResult(); | |||||
- response.payload = reinterpret_cast<OCPayload*>(pResponse->getPayload()); | |||||
+ response->payload = reinterpret_cast<OCPayload*>(pResponse->getPayload()); | |||||
- response.persistentBufferFlag = 0; | |||||
+ response->persistentBufferFlag = 0; | |||||
- response.numSendVendorSpecificHeaderOptions = serverHeaderOptions.size(); | |||||
+ response->numSendVendorSpecificHeaderOptions = serverHeaderOptions.size(); | |||||
int i = 0; | |||||
for (auto it=serverHeaderOptions.begin(); it != serverHeaderOptions.end(); ++it) | |||||
{ | |||||
- response.sendVendorSpecificHeaderOptions[i].protocolID = OC_COAP_ID; | |||||
- response.sendVendorSpecificHeaderOptions[i].optionID = | |||||
+ response->sendVendorSpecificHeaderOptions[i].protocolID = OC_COAP_ID; | |||||
+ response->sendVendorSpecificHeaderOptions[i].optionID = | |||||
static_cast<uint16_t>(it->getOptionID()); | |||||
- response.sendVendorSpecificHeaderOptions[i].optionLength = | |||||
+ response->sendVendorSpecificHeaderOptions[i].optionLength = | |||||
(it->getOptionData()).length() + 1; | |||||
std::string optionData = it->getOptionData(); | |||||
std::copy(optionData.begin(), | |||||
optionData.end(), | |||||
- response.sendVendorSpecificHeaderOptions[i].optionData); | |||||
- response.sendVendorSpecificHeaderOptions[i].optionData[it->getOptionData().length()] | |||||
+ response->sendVendorSpecificHeaderOptions[i].optionData); | |||||
+ response->sendVendorSpecificHeaderOptions[i].optionData[it->getOptionData().length()] | |||||
= '\0'; | |||||
i++; | |||||
} | |||||
- if(OC_EH_RESOURCE_CREATED == response.ehResult) | |||||
+ if(OC_EH_RESOURCE_CREATED == response->ehResult) | |||||
{ | |||||
- pResponse->getNewResourceUri().copy(response.resourceUri, | |||||
- sizeof (response.resourceUri) - 1); | |||||
- response.resourceUri[pResponse->getNewResourceUri().length()] = '\0'; | |||||
+ pResponse->getNewResourceUri().copy(response->resourceUri, | |||||
+ sizeof (response->resourceUri) - 1); | |||||
+ response->resourceUri[pResponse->getNewResourceUri().length()] = '\0'; | |||||
} | |||||
if(cLock) | |||||
{ | |||||
std::lock_guard<std::recursive_mutex> lock(*cLock); | |||||
- result = OCDoResponse(&response); | |||||
+ result = OCDoResponse(response); | |||||
} | |||||
else | |||||
{ | |||||
- OICFree(response.payload); | |||||
+ OICFree(response->payload); | |||||
result = OC_STACK_ERROR; | |||||
} | |||||
@@ -620,6 +627,7 @@ namespace OC | |||||
{ | |||||
oclog() << "Error sending response\n"; | |||||
} | |||||
+ OICFree(response); | |||||
return result; | |||||
} | |||||
} |
@ -1,27 +0,0 @@ | |||||
From 261cf19bfa3dea10ed0f2ebbb2d945c19c9a2804 Mon Sep 17 00:00:00 2001 | |||||
From: Hauke Mehrtens <hauke@hauke-m.de> | |||||
Date: Sun, 4 Dec 2016 00:18:37 +0100 | |||||
Subject: [PATCH 5/7] ssl: fix compilation against non debug mbedtls | |||||
The function mbedtls_debug_set_threshold() is only available when | |||||
MBEDTLS_DEBUG_C is set. make the call depend on this condition. | |||||
Change-Id: I8158bc4c55b428167e36084e7a46359c269c5fc7 | |||||
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> | |||||
--- | |||||
resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c | 2 ++ | |||||
1 file changed, 2 insertions(+) | |||||
--- a/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c | |||||
+++ b/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c | |||||
@@ -1278,8 +1278,10 @@ static int InitConfig(mbedtls_ssl_config | |||||
#if !defined(NDEBUG) || defined(TB_LOG) | |||||
mbedtls_ssl_conf_dbg(conf, DebugSsl, NULL); | |||||
+#if defined(MBEDTLS_DEBUG_C) | |||||
mbedtls_debug_set_threshold(MBED_TLS_DEBUG_LEVEL); | |||||
#endif | |||||
+#endif | |||||
OIC_LOG_V(DEBUG, NET_SSL_TAG, "Out %s", __func__); | |||||
return 0; | |||||
} |
@ -1,35 +0,0 @@ | |||||
From cee085e0e62214603b9ae035d63fabca23c491bd Mon Sep 17 00:00:00 2001 | |||||
From: Hauke Mehrtens <hauke@hauke-m.de> | |||||
Date: Sun, 8 Jan 2017 01:39:35 +0100 | |||||
Subject: [PATCH 6/7] ssl: call mbedtls_version_get_string() only if available | |||||
The function mbedtls_version_get_string() is only available if | |||||
MBEDTLS_VERSION_C is set in the mbedtls configuration. Check this | |||||
before calling this function and print the mbedtls version this was | |||||
compiled against instead if mbedtls_version_get_string() is not | |||||
available. | |||||
This fixes a compile problem when MBEDTLS_VERSION_C is not set. | |||||
Change-Id: I54c2c2a3fc1f9d35afa475500e3db68420a1b54a | |||||
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> | |||||
--- | |||||
resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c | 4 ++++ | |||||
1 file changed, 4 insertions(+) | |||||
--- a/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c | |||||
+++ b/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c | |||||
@@ -1376,9 +1376,13 @@ CAResult_t CAinitSslAdapter() | |||||
/* Initialize TLS library | |||||
*/ | |||||
#if !defined(NDEBUG) || defined(TB_LOG) | |||||
+#ifdef MBEDTLS_VERSION_C | |||||
char version[MBED_TLS_VERSION_LEN]; | |||||
mbedtls_version_get_string(version); | |||||
OIC_LOG_V(INFO, NET_SSL_TAG, "mbed TLS version: %s", version); | |||||
+#else | |||||
+ OIC_LOG_V(INFO, NET_SSL_TAG, "mbed TLS version: %s", MBEDTLS_VERSION_STRING); | |||||
+#endif | |||||
#endif | |||||
/* Entropy settings |
@ -1,30 +0,0 @@ | |||||
From 3684ac3720f91dc131c1c61689395a69ae1865f9 Mon Sep 17 00:00:00 2001 | |||||
From: Hauke Mehrtens <hauke@hauke-m.de> | |||||
Date: Sun, 8 Jan 2017 20:31:18 +0100 | |||||
Subject: [PATCH 7/7] ssl: call mbedtls_ssl_conf_renegotiation() only if | |||||
available | |||||
The function mbedtls_ssl_conf_renegotiation() is only available if | |||||
MBEDTLS_SSL_RENEGOTIATION is set in the mbedtls configuration. Check this | |||||
before calling this function. | |||||
This fixes a compile problem when MBEDTLS_SSL_RENEGOTIATION is not set. | |||||
Change-Id: I69f15359d2dcaed1e4fe56fc7799737e38d6c2e7 | |||||
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> | |||||
--- | |||||
resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c | 2 ++ | |||||
1 file changed, 2 insertions(+) | |||||
--- a/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c | |||||
+++ b/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c | |||||
@@ -1273,7 +1273,9 @@ static int InitConfig(mbedtls_ssl_config | |||||
mbedtls_ssl_conf_rng(conf, mbedtls_ctr_drbg_random, &g_caSslContext->rnd); | |||||
mbedtls_ssl_conf_curves(conf, curve[ADAPTER_CURVE_SECP256R1]); | |||||
mbedtls_ssl_conf_min_version(conf, MBEDTLS_SSL_MAJOR_VERSION_3, MBEDTLS_SSL_MINOR_VERSION_3); | |||||
+#ifdef MBEDTLS_SSL_RENEGOTIATION | |||||
mbedtls_ssl_conf_renegotiation(conf, MBEDTLS_SSL_RENEGOTIATION_DISABLED); | |||||
+#endif | |||||
mbedtls_ssl_conf_authmode(conf, MBEDTLS_SSL_VERIFY_REQUIRED); | |||||
#if !defined(NDEBUG) || defined(TB_LOG) |
@ -1,44 +0,0 @@ | |||||
From 01796db0b166e720860eff200acabff410ba6979 Mon Sep 17 00:00:00 2001 | |||||
From: Hauke Mehrtens <hauke@hauke-m.de> | |||||
Date: Sun, 4 Dec 2016 00:15:21 +0100 | |||||
Subject: [PATCH 4/7] ssl: enable usage of patched mbed functions conditionally | |||||
Only activate support for the MBEDTLS_KEY_EXCHANGE_ECDH_ANON_ENABLED | |||||
cipher suite when this is actually available in mbedtls. | |||||
This makes it possible to compile IoTivity against a unpatched mbedtls | |||||
version. | |||||
Change-Id: Ic56d7faf7597cc5dc08f9d55be29dde898949609 | |||||
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> | |||||
--- | |||||
resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c | 4 ++++ | |||||
1 file changed, 4 insertions(+) | |||||
--- a/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c | |||||
+++ b/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c | |||||
@@ -237,7 +237,9 @@ int tlsCipher[ADAPTER_CIPHER_MAX][2] = | |||||
{ | |||||
{MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA, 0}, | |||||
{MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8, 0}, | |||||
+#ifdef MBEDTLS_TLS_ECDH_ANON_WITH_AES_128_CBC_SHA256 | |||||
{MBEDTLS_TLS_ECDH_ANON_WITH_AES_128_CBC_SHA256, 0}, | |||||
+#endif | |||||
{MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256, 0}, | |||||
{MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CCM, 0}, | |||||
{MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, 0} | |||||
@@ -1943,6 +1945,7 @@ CAResult_t CAsetTlsCipherSuite(const uin | |||||
g_caSslContext->cipher = ADAPTER_TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8; | |||||
break; | |||||
} | |||||
+#ifdef MBEDTLS_TLS_ECDH_ANON_WITH_AES_128_CBC_SHA256 | |||||
case MBEDTLS_TLS_ECDH_ANON_WITH_AES_128_CBC_SHA256: | |||||
{ | |||||
#ifdef __WITH_TLS__ | |||||
@@ -1960,6 +1963,7 @@ CAResult_t CAsetTlsCipherSuite(const uin | |||||
g_caSslContext->cipher = ADAPTER_TLS_ECDH_ANON_WITH_AES_128_CBC_SHA_256; | |||||
break; | |||||
} | |||||
+#endif | |||||
case MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256: | |||||
{ | |||||
#if 0 // PIN OTM |
@ -1,22 +0,0 @@ | |||||
Make it possible to use system mbedtls version | |||||
--- a/resource/csdk/connectivity/src/SConscript | |||||
+++ b/resource/csdk/connectivity/src/SConscript | |||||
@@ -73,16 +73,7 @@ if env.get('SECURED') == '1': | |||||
env.AppendUnique(CPPPATH = [src_dir + '/resource/csdk/security/include']) | |||||
env.AppendUnique(CPPDEFINES = ['__WITH_DTLS__']) | |||||
env.AppendUnique(CPPPATH = [os.path.join(root_dir, 'external/inc')]) | |||||
- tls_path = 'extlibs/mbedtls'; | |||||
- tls_headers_path = 'mbedtls/include'; | |||||
- if ca_os == 'tizen' and os.path.exists(root_dir + '/' + tls_path): | |||||
- env.SConscript(os.path.join(root_dir, tls_path + '/SConscript')) | |||||
- env.AppendUnique(CPPPATH = [os.path.join(root_dir, tls_path + '/' + tls_headers_path)]) | |||||
- else: | |||||
- if ca_os != 'android': | |||||
- env.SConscript('#' + tls_path + '/SConscript') | |||||
- env.AppendUnique(CPPPATH = ['#' + tls_path + '/' + tls_headers_path]) | |||||
- env.AppendUnique(CA_SRC = [os.path.join(ca_path, 'adapter_util/ca_adapter_net_ssl.c')]) | |||||
+ env.AppendUnique(CA_SRC = [os.path.join(ca_path, 'adapter_util/ca_adapter_net_ssl.c')]) | |||||
if ((secured == '1') and (with_tcp == True)): | |||||
env.AppendUnique(CPPDEFINES = ['__WITH_TLS__']) |
@ -1,31 +0,0 @@ | |||||
From df8360447163762c63994dcb07f9e69a5a365a1c Mon Sep 17 00:00:00 2001 | |||||
From: Hauke Mehrtens <hauke@hauke-m.de> | |||||
Date: Sun, 8 Jan 2017 22:01:57 +0100 | |||||
Subject: [PATCH 8/8] zigbee_wrapper: do not check for floating point | |||||
This makes the compile fail for soft float builds. In such builds the | |||||
double is still 64 bit long. | |||||
Change-Id: I45d3f19b49f5d23d2b65307738a362765c5ea1c2 | |||||
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> | |||||
--- | |||||
plugins/zigbee_wrapper/src/zigbee_wrapper.c | 8 -------- | |||||
1 file changed, 8 deletions(-) | |||||
--- a/plugins/zigbee_wrapper/src/zigbee_wrapper.c | |||||
+++ b/plugins/zigbee_wrapper/src/zigbee_wrapper.c | |||||
@@ -37,14 +37,6 @@ | |||||
#include <math.h> | |||||
#include <errno.h> | |||||
-// The following #define must be here under "math.h". | |||||
-// This ifdef ensures that "__STDC_IEC_559__" is defined. If it is defined, | |||||
-// then we are guaranteed that the 'double' type is 64-bit. Otherwise, the | |||||
-// compilation of this file should fail because we are no longer guaranteed. | |||||
-#ifndef __STDC_IEC_559__ | |||||
-#error "Requires IEEE 754 floating point!" | |||||
-#endif | |||||
- | |||||
#include "zigbee_wrapper.h" | |||||
#include "telegesis_wrapper.h" | |||||
#include "pluginlist.h" |
@ -1,32 +0,0 @@ | |||||
--- a/resource/csdk/connectivity/src/bt_le_adapter/linux/SConscript | |||||
+++ b/resource/csdk/connectivity/src/bt_le_adapter/linux/SConscript | |||||
@@ -73,7 +73,6 @@ env.AppendUnique( | |||||
# The Linux BLE adapter implementation uses GDBus to make D-Bus based | |||||
# method calls to BlueZ. Pull in the necessary dependencies. | |||||
-env.ParseConfig("pkg-config gio-unix-2.0 --cflags --libs") | |||||
# Set up commands to generate GDBus code from the D-Bus introspection | |||||
# XML. | |||||
--- a/resource/csdk/security/provisioning/sample/SConscript | |||||
+++ b/resource/csdk/security/provisioning/sample/SConscript | |||||
@@ -70,7 +70,6 @@ if target_os not in ['windows']: | |||||
if target_os not in ['msys_nt', 'windows']: | |||||
provisioning_env.AppendUnique(LIBS = ['dl', 'm']) | |||||
- provisioning_env.ParseConfig('pkg-config --libs glib-2.0'); | |||||
provisioning_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')]) | |||||
else: | |||||
provisioning_env.AppendUnique(LIBPATH = [os.path.join(env.get('BUILD_DIR'), 'resource', 'csdk')]) | |||||
--- a/resource/csdk/security/provisioning/SConscript | |||||
+++ b/resource/csdk/security/provisioning/SConscript | |||||
@@ -73,9 +73,6 @@ provisioning_env.PrependUnique(LIBS = [' | |||||
provisioning_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509','mbedcrypto']) | |||||
-if target_os not in ['msys_nt', 'windows', 'android', 'ios']: | |||||
- provisioning_env.ParseConfig('pkg-config --libs glib-2.0') | |||||
- | |||||
if target_os in ['windows', 'msys_nt']: | |||||
provisioning_env.AppendUnique(LIBS = ['ws2_32', 'advapi32', 'iphlpapi']) | |||||
@ -1,44 +0,0 @@ | |||||
From ce27d50b9c11386242487852f14b025ed6c67701 Mon Sep 17 00:00:00 2001 | |||||
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com> | |||||
Date: Wed, 19 Aug 2015 16:47:21 +0200 | |||||
Subject: [PATCH 14/14] examples: OICMiddle: try to load security | |||||
configuration by default | |||||
Load the security configuration from the default location by default. | |||||
When it is not found security will just not work. | |||||
Signed-off-by: Hauke Mehrtens <hauke.mehrtens@lantiq.com> | |||||
--- | |||||
examples/OICMiddle/OICMiddle.cpp | 9 ++++++++- | |||||
examples/OICMiddle/OICMiddle.h | 1 + | |||||
2 files changed, 9 insertions(+), 1 deletion(-) | |||||
--- a/examples/OICMiddle/OICMiddle.cpp | |||||
+++ b/examples/OICMiddle/OICMiddle.cpp | |||||
@@ -99,8 +99,15 @@ void Middle::startPlatform() | |||||
//std::string ipaddr = INADDR_ANY; | |||||
std::string ipaddr = "0.0.0.0"; | |||||
+ // Initialize Persistent Storage for SVR database | |||||
+ middle.ps.open = fopen; | |||||
+ middle.ps.read = fread; | |||||
+ middle.ps.write = fwrite; | |||||
+ middle.ps.close = fclose; | |||||
+ middle.ps.unlink = unlink; | |||||
+ | |||||
PlatformConfig cfg { ServiceType::InProc, ModeType::Both, | |||||
- ipaddr, port, QualityOfService::LowQos}; | |||||
+ ipaddr, port, QualityOfService::LowQos, &middle.ps}; | |||||
OC::OCPlatform::Configure(cfg); | |||||
} | |||||
--- a/examples/OICMiddle/OICMiddle.h | |||||
+++ b/examples/OICMiddle/OICMiddle.h | |||||
@@ -83,6 +83,7 @@ protected: | |||||
MiddleServer *m_server; | |||||
LineInput *m_lineInput; | |||||
RestInput *m_restInput; | |||||
+ OCPersistentStorage ps; | |||||
protected: | |||||
void startPlatform(); |
@ -1,58 +0,0 @@ | |||||
From 26c2798188497da22e0a70efebc47991dd755db2 Mon Sep 17 00:00:00 2001 | |||||
From: Philippe Coval <philippe.coval@osg.samsung.com> | |||||
Date: Wed, 28 Jun 2017 04:54:05 +0200 | |||||
Subject: [PATCH] resource: Include functional header for g++-7.1.0 | |||||
It was tested on yocto poky master on iotivity-1.2.1 (and later): | |||||
resource/include/OCUtilities.h: \ | |||||
In function 'OCStackResult OC::nil_guard(PtrT&&, FnT&&, ParamTs&& ...)': | |||||
resource/include/OCUtilities.h:85:21: \ | |||||
error: 'bind' is not a member of 'std' | |||||
return std::bind(fn, p, std::ref(params)...)(); | |||||
resource/include/OCApi.h: At global scope: | |||||
resource/include/OCApi.h:362:18: \ | |||||
error: 'function' in namespace 'std' does not name a template type | |||||
typedef std::function<void(std::shared_ptr<OCResource>)> FindCallback; | |||||
Change-Id: Ie1cab497c33fde394f77490a1d636eb36a563396 | |||||
Origin: https://gerrit.iotivity.org/gerrit/#/c/21069/ | |||||
Signed-off-by: Philippe Coval <philippe.coval@osg.samsung.com> | |||||
Reviewed-on: https://gerrit.iotivity.org/gerrit/21067 | |||||
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> | |||||
Tested-by: jenkins-iotivity <jenkins@iotivity.org> | |||||
--- | |||||
resource/include/OCApi.h | 2 -- | |||||
resource/include/OCUtilities.h | 1 + | |||||
2 files changed, 1 insertion(+), 2 deletions(-) | |||||
diff --git a/resource/include/OCApi.h b/resource/include/OCApi.h | |||||
index 4e14f29cc..af9721554 100644 | |||||
--- a/resource/include/OCApi.h | |||||
+++ b/resource/include/OCApi.h | |||||
@@ -27,9 +27,7 @@ | |||||
#include <map> | |||||
#include <memory> | |||||
#include <iterator> | |||||
-#if defined(_MSC_VER) | |||||
#include <functional> | |||||
-#endif | |||||
#include "octypes.h" | |||||
#include "OCHeaderOption.h" | |||||
diff --git a/resource/include/OCUtilities.h b/resource/include/OCUtilities.h | |||||
index 85039d0c1..f1c93045f 100644 | |||||
--- a/resource/include/OCUtilities.h | |||||
+++ b/resource/include/OCUtilities.h | |||||
@@ -26,6 +26,7 @@ | |||||
#include <memory> | |||||
#include <utility> | |||||
#include <exception> | |||||
+#include <functional> | |||||
#include <OCException.h> | |||||
#include <StringConstants.h> | |||||
-- | |||||
2.17.1 | |||||