Merge remote-tracking branch 'origin/master' into notification-service
authorcc <ch79.cho@samsung.com>
Thu, 8 Sep 2016 01:29:09 +0000 (10:29 +0900)
committercc <ch79.cho@samsung.com>
Thu, 8 Sep 2016 01:30:07 +0000 (10:30 +0900)
Change-Id: I46af88cce1a821841baa1fe3f5226537ae1eb83b
Signed-off-by: cc <ch79.cho@samsung.com>
45 files changed:
android/android_api/base/build.gradle
android/android_api/base/jni/JniOcProvisioning.cpp
auto_build.py
build_common/SConscript
build_common/android/SConscript
extlibs/gtest/SConscript
iotivity.pc.in
resource/c_common/ocrandom/test/SConscript
resource/csdk/SConscript
resource/csdk/connectivity/build/tizen/packaging/com.oic.ca.spec
resource/csdk/connectivity/src/SConscript
resource/csdk/connectivity/src/adapter_util/ca_adapter_net_tls.c
resource/csdk/logger/include/logger.h
resource/csdk/security/SConscript
resource/csdk/security/include/internal/doxmresource.h [changed mode: 0755->0644]
resource/csdk/security/include/internal/provisioningdatabasemanager.h [moved from resource/csdk/security/provisioning/include/internal/provisioningdatabasemanager.h with 100% similarity]
resource/csdk/security/provisioning/SConscript
resource/csdk/security/provisioning/sample/SConscript
resource/csdk/security/provisioning/sample/provisioningclient.c
resource/csdk/security/src/directpairing.c
resource/csdk/security/src/doxmresource.c
resource/csdk/security/src/provisioningdatabasemanager.c [moved from resource/csdk/security/provisioning/src/provisioningdatabasemanager.c with 100% similarity]
resource/csdk/stack/samples/tizen/SimpleClientServer/packaging/com.oic.ri.sample.spec
resource/csdk/stack/samples/tizen/build/packaging/com.oic.ri.spec
resource/provisioning/examples/SConscript
resource/src/InProcClientWrapper.cpp
resource/src/SConscript
service/easy-setup/mediator/richsdk/SConscript
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/jni/JniEasySetup.cpp
service/easy-setup/mediator/richsdk/android/SConscript
service/easy-setup/mediator/richsdk/src/EnrolleeSecurity.cpp
service/easy-setup/mediator/richsdk/src/EnrolleeSecurity.h
service/easy-setup/mediator/richsdk/src/RemoteEnrollee.cpp
service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/SConscript
service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/SConscript
service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/packaging/com.oic.es.sample.spec
service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/assets/oic_svr_db_client.dat [changed mode: 0644->0755]
service/easy-setup/sampleapp/mediator/android/SConscript
service/easy-setup/sampleapp/mediator/linux/richsdk_sample/oic_svr_db_client.dat [changed mode: 0644->0755]
service/resource-container/src/Configuration.cpp
service/resource-container/unittests/ResourceContainerTest.cpp
service/resource-container/unittests/ResourceContainerTestSimulator.h
service/resource-encapsulation/examples/android/RESampleClientApp/app/build.gradle
service/resource-encapsulation/examples/android/RESampleServerApp/app/build.gradle
tools/tizen/iotivity.spec

index 4ea654c..29a2cb5 100755 (executable)
@@ -41,7 +41,7 @@ android {
         minSdkVersion 21\r
         targetSdkVersion 21\r
         versionCode 1\r
-        versionName "1.1.1"\r
+        versionName "1.2.0"\r
         buildConfigField 'int', 'SECURED', SECURED\r
         buildConfigField 'int', 'WITH_CLOUD', WITH_CLOUD\r
         buildConfigField "int", 'WITH_MQ_PUB', WITH_MQ_PUB\r
index 52d5bc9..d11205b 100644 (file)
@@ -93,7 +93,7 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcProvisioning_ownershipTransferCB
             }
             else
             {
-                result = OC_STACK_ERROR;
+                result = OC_STACK_INVALID_CALLBACK;
             }
         }
 
index d17e800..2471a61 100644 (file)
@@ -414,8 +414,8 @@ elif arg_num == 2:
         unit_tests()
 
     elif str(sys.argv[1]) == "linux":
-        build_all("true", "")
-        build_all("false", "")
+        build_linux("true", "")
+        build_linux("false", "")
 
     elif str(sys.argv[1]) == "linux_unsecured":
         build_linux_unsecured("true", "")
index 59a063f..f71d250 100644 (file)
@@ -6,6 +6,8 @@
 import os
 import platform
 
+project_version = '1.2.0'
+
 # Map of host os and allowed target os (host: allowed target os)
 host_target_map = {
                'linux': ['linux', 'android', 'arduino', 'yocto', 'tizen'],
@@ -73,7 +75,6 @@ else:
        logging_default = (release_mode == False)
 
 
-
 ######################################################################
 # Common build options (release, target os, target arch)
 ######################################################################
@@ -307,30 +308,31 @@ Export('env')
 ######################################################################
 pc_file = env.get('SRC_DIR') + '/iotivity.pc.in'
 
-if env.get('ROUTING') == 'GW':
-       routing_define = 'ROUTING_GATEWAY'
-elif env.get('ROUTING') == 'EP':
-       routing_define = 'ROUTING_EP'
-
 user_prefix = env.get('PREFIX')
 user_lib = env.get('LIB_INSTALL_DIR')
+
+if not user_prefix:
+    user_prefix = env.get('BUILD_DIR').encode('string_escape')
+
 if not user_lib:
-       user_lib = '$${prefix}/lib'
-
-if user_prefix:
-       pc_vars = {'\@PREFIX\@': user_prefix,
-                               '\@EXEC_PREFIX\@':user_prefix,
-                               '\@VERSION\@': '1.1.1',
-                               '\@LIB_INSTALL_DIR\@': user_lib,
-                               '\@ROUTING_DEFINE\@': routing_define
-                               }
-else:
-       pc_vars = {'\@PREFIX\@': env.get('BUILD_DIR').encode('string_escape'),
-                               '\@EXEC_PREFIX\@': env.get('BUILD_DIR').encode('string_escape'),
-                               '\@VERSION\@': '1.1.1',
-                               '\@LIB_INSTALL_DIR\@': user_lib,
-                               '\@ROUTING_DEFINE\@': routing_define
-                               }
+    user_lib = '$${prefix}/lib'
+
+defines = []
+if env.get('LOGGING'):
+    defines.append('-DTB_LOG=1')
+
+if env.get('ROUTING') == 'GW':
+    defines.append('-DROUTING_GATEWAY=1')
+elif env.get('ROUTING') == 'EP':
+    defines.append('-DROUTING_EP=1')
+
+pc_vars = {
+    '\@VERSION\@': project_version,
+    '\@PREFIX\@': user_prefix,
+    '\@EXEC_PREFIX\@': user_prefix,
+    '\@LIB_INSTALL_DIR\@': user_lib,
+    '\@DEFINES\@': " ".join(defines)
+}
 
 env.Substfile(pc_file, SUBST_DICT = pc_vars)
 
index 20d7c38..fa45866 100644 (file)
@@ -221,8 +221,10 @@ env.AppendUnique(LIBPATH = [src_dir + '/resource/csdk/connectivity/lib/android']
 env.AppendUnique(LIBS = ['log', 'coap'])
 
 if env.get('SECURED') == '1':
+       env.SConscript('#extlibs/tinydtls/SConscript')
        env.AppendUnique(LIBS = ['tinydtls'])
        if env.get('WITH_TCP'):
+               env.SConscript('#extlibs/mbedtls/SConscript')
                env.AppendUnique(LIBS = ['mbedtls','mbedx509','mbedcrypto'])
 
 # From android-5 (API > 20), all application must be built with flags '-fPIE' '-pie'.
index d29c324..9e17973 100644 (file)
@@ -1,3 +1,4 @@
+# -*- mode: python; python-indent-offset: 4; indent-tabs-mode: nil -*-
 ##
 # 'googletest' script to check if Google Unit Test library is installed.
 # If not, get it and install it
@@ -17,7 +18,7 @@ gtest_dir      = os.path.join(src_dir, 'extlibs', 'gtest', 'gtest-1.7.0')
 gtest_lib_dir = os.path.join(gtest_dir,'lib')
 gtest_dotlib_dir =  os.path.join(gtest_lib_dir, '.libs')
 gtest_zip_file = os.path.join(src_dir, 'extlibs', 'gtest', 'gtest-1.7.0.zip')
-gtest_url      = 'https://googletest.googlecode.com/files/gtest-1.7.0.zip'
+gtest_url = 'http://pkgs.fedoraproject.org/repo/pkgs/gtest/gtest-1.7.0.zip/2d6ec8ccdf5c46b05ba54a9fd1d130d7/gtest-1.7.0.zip'
 
 if target_os in targets_need_gtest:
        print '*** Checking for installation of google unit test 1.7.0 ***'
index 59bd6b5..7bf7c45 100644 (file)
@@ -18,4 +18,4 @@ Cflags: -I${includedir}/resource \
                        -I${svcincludedir}/resource-hosting \
                        -I${svcincludedir}/resource-directory \
                        -I${svcincludedir}/things-manager \
-                       -D@ROUTING_DEFINE@
+                       @DEFINES@
index d6ac4dc..5158cfe 100644 (file)
@@ -37,7 +37,8 @@ randomtest_env.PrependUnique(CPPPATH = [
 
 randomtest_env.AppendUnique(LIBPATH = [randomtest_env.get('BUILD_DIR')])
 randomtest_env.PrependUnique(LIBS = ['octbstack',
-                                    'uuid'])
+                                     'connectivity_abstraction',
+                                     'uuid'])
 
 if target_os in ['linux']:
     randomtest_env.AppendUnique(LIBS = ['m'])
index 7aa175e..a9d6c0d 100644 (file)
@@ -118,6 +118,8 @@ else:
 
 if target_os in ['tizen', 'linux']:
        liboctbstack_env.ParseConfig("pkg-config --cflags --libs uuid")
+if target_os in ['tizen']:
+       liboctbstack_env.ParseConfig('pkg-config --cflags --libs sqlite3')
 
 if target_os == 'arduino':
        liboctbstack_env.AppendUnique(CPPDEFINES = ['NDEBUG', 'WITH_ARDUINO'])
@@ -175,6 +177,11 @@ if with_tcp == True:
 
 liboctbstack_src.extend(env['cbor_files'])
 
+# Insert a hack for Arduino, whose compiler may not support all defines expected
+# by tinycbor
+if target_os in ['arduino']:
+       liboctbstack_env.AppendUnique(CPPDEFINES = ['INT64_MAX=0x7FFFFFFFFFFFFFFF'])
+
 if target_os in ['windows', 'msys_nt']:
        # Avoid a name conflict with the octbstack.lib target of the SharedLibrary.
        static_liboctbstack = liboctbstack_env.StaticLibrary('octbstack_static', liboctbstack_src)
index 70b52d1..1fd3468 100644 (file)
@@ -6,7 +6,7 @@
 
 
 Name: com-oic-ca
-Version:    1.1.1
+Version:    1.2.0
 Release:    0
 Summary: Tizen oicca application
 URL: http://slp-source.sec.samsung.net
index 6063875..16d654c 100644 (file)
@@ -81,7 +81,8 @@ if ((secured == '1') and (with_tcp == True)):
                env.SConscript(os.path.join(root_dir, tls_path + '/SConscript'))
                env.AppendUnique(CPPPATH = [os.path.join(root_dir, tls_path + '/' + tls_headers_path)])
        else:
-               env.SConscript('#' + tls_path + '/SConscript')
+               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_tls.c')])
 
index faade61..36f0234 100644 (file)
@@ -339,12 +339,32 @@ static int recvTls(void * tep, unsigned char * data, size_t dataLen)
     return (int)retLen;
 }
 
-//TODO add description
+/**
+ * Parse chain of X.509 certificates.
+ *
+ * @param[out] crt     container for X.509 certificates
+ * @param[in]  data    buffer with X.509 certificates. Certificates may be in either in PEM
+                       or DER format in a jumble. Each PEM certificate must be NULL-terminated.
+ * @param[in]  buflen  buffer length
+ *
+ * @return  0 on success, -1 on error
+ */
 static int parseChain(mbedtls_x509_crt * crt, const unsigned char * buf, int buflen)
 {
     VERIFY_NON_NULL_RET(crt, NET_TLS_TAG, "Param crt is NULL" , -1);
     VERIFY_NON_NULL_RET(buf, NET_TLS_TAG, "Param buf is NULL" , -1);
 
+    char pemCertHeader[] = {
+        0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x43, 0x45, 0x52,
+        0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d
+    };
+    char pemCertFooter[] = {
+        0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x45, 0x4e, 0x44, 0x20, 0x43, 0x45, 0x52, 0x54, 0x49,
+        0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x00
+    };
+    size_t pemCertHeaderLen = sizeof(pemCertHeader);
+    size_t pemCertFooterLen = sizeof(pemCertFooter);
+
     int pos = 0;
     int len = 0;
     int ret = 0;
@@ -355,7 +375,7 @@ static int parseChain(mbedtls_x509_crt * crt, const unsigned char * buf, int buf
             len = (((int) buf[pos+2]) << 8) | buf[pos+3];
             if (pos + len < buflen)
             {
-                ret = mbedtls_x509_crt_parse_der(crt, buf+pos, len+4);
+                ret = mbedtls_x509_crt_parse_der(crt, buf+pos, len + 4); 
                 if( 0 != ret)
                 {
                     OIC_LOG_V(ERROR, NET_TLS_TAG, "mbedtls_x509_crt_parse returned -0x%x", -ret);
@@ -364,6 +384,19 @@ static int parseChain(mbedtls_x509_crt * crt, const unsigned char * buf, int buf
             }
             pos += len + 4;
         }
+        else if (0 == memcmp(buf + pos, pemCertHeader, pemCertHeaderLen))
+        {
+            void * endPos = NULL;
+            endPos = memmem(&(buf[pos]), buflen - pos, pemCertFooter, pemCertFooterLen);
+            if (NULL == endPos)
+            {
+                OIC_LOG(ERROR, NET_TLS_TAG, "Error: end of PEM certificate not found.");
+                return -1;
+            }
+            len = (char*)endPos - ((char*)(buf + pos)) + pemCertFooterLen;
+            ret = mbedtls_x509_crt_parse(crt, buf, len);
+            pos += len;
+        }
         else
         {
              OIC_LOG_V(ERROR, NET_TLS_TAG, "mbedtls_x509_crt_parse returned -0x%x", -ret);
index 0b42ead..7ccb51c 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef LOGGER_H_
 #define LOGGER_H_
 
-#define IOTIVITY_VERSION "1.1.1"
+#define IOTIVITY_VERSION "1.2.0"
 
 #include <stdint.h>
 #include <stdio.h>
index 4952d83..2e5e55e 100644 (file)
@@ -111,8 +111,14 @@ libocsrm_src = [
        OCSRM_SRC + 'directpairing.c'
        ]
 
-if env.get('SECURED') == '1':
-       libocsrm_src  = libocsrm_src + [OCSRM_SRC + 'oxmpincommon.c', OCSRM_SRC + 'pbkdf2.c']
+if libocsrm_env.get('SECURED') == '1':
+       if target_os in ['tizen']:
+               libocsrm_env.ParseConfig('pkg-config --cflags --libs sqlite3')
+       else:
+               libocsrm_env.AppendUnique(CPPPATH = ['../../../extlibs/sqlite3'])
+               libocsrm_src = libocsrm_src + ['../../../extlibs/sqlite3/sqlite3.c']
+       libocsrm_src = libocsrm_src + [OCSRM_SRC + 'provisioningdatabasemanager.c']
+       libocsrm_src = libocsrm_src + [OCSRM_SRC + 'oxmpincommon.c', OCSRM_SRC + 'pbkdf2.c']
 
 if target_os in ['windows', 'msys_nt']:
        libocsrm_src  = libocsrm_src + [OCSRM_SRC + 'strptime.c']
old mode 100755 (executable)
new mode 100644 (file)
index f63a2b1..fb8843f
@@ -87,6 +87,14 @@ OCStackResult DoxmToCBORPayload(const OicSecDoxm_t * doxm, uint8_t **cborPayload
 OCStackResult GetDoxmDeviceID(OicUuid_t *deviceID);
 
 /**
+ * This method changes the SRM device ID for this device.
+ * This api will update device Id iff device is in unowned state.
+ * @return ::OC_STACK_OK for Success, otherwise some error value.
+ */
+OCStackResult SetDoxmDeviceID(const OicUuid_t *deviceID);
+
+
+/**
  * Gets the OicUuid_t value for the owner of this device.
  *
  * @param devownerid a pointer to be assigned to the devownerid property
index 96d59f3..7587370 100644 (file)
@@ -101,8 +101,7 @@ provisioning_src = [
        'src/secureresourceprovider.c',
        'src/ocprovisioningmanager.c',
        'src/oxmjustworks.c',
-       'src/oxmrandompin.c',
-       'src/provisioningdatabasemanager.c' ]
+       'src/oxmrandompin.c' ]
 
 if target_os != 'tizen':
        provisioning_src = provisioning_src + [root_dir+'/extlibs/sqlite3/sqlite3.c' ]
index 23818ff..731d45f 100644 (file)
@@ -82,6 +82,7 @@ provisioning_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
 
 if target_os == 'tizen':
     provisioning_env.AppendUnique(CPPDEFINES = ['__TIZEN__'])
+    provisioning_env.ParseConfig('pkg-config --cflags --libs sqlite3')
 
 ######################################################################
 # Source files and Targets
index b0454ee..e3f5cad 100644 (file)
@@ -596,7 +596,7 @@ static int provisionCred(void)
 
     // display the CRED-provisioned result
     printf("   > Provisioned Selected Pairwise Crendentials\n");
-    printf("   > Please Check Device's Status for the Linked Result, with [33] Menu\n");
+    printf("   > Please Check Device's Status for the Linked Result, with [34] Menu\n");
 
     return 0;
 }
index e7ef882..f4db381 100644 (file)
@@ -253,8 +253,14 @@ bool DPGenerateQuery(bool isSecure,
 \r
     switch(connType & CT_MASK_ADAPTER)\r
     {\r
+// @todo: Remove this ifdef. On Arduino, CT_ADAPTER_TCP resolves to the same value\r
+// as CT_ADAPTER_IP, resulting in a compiler error.\r
+#ifdef WITH_TCP\r
+#ifndef WITH_ARDUINO\r
         case CT_ADAPTER_TCP:\r
             prefix = (isSecure == true) ? QPREFIX_COAPS_TCP : QPREFIX_COAP_TCP;\r
+#endif\r
+#endif\r
         case CT_ADAPTER_IP:\r
             switch(connType & CT_MASK_FLAGS & ~CT_FLAG_SECURE)\r
             {\r
index 9aac585..ab17d77 100644 (file)
@@ -49,6 +49,8 @@
 #include "credresource.h"
 #include "srmutility.h"
 #include "pinoxmcommon.h"
+#include "pmtypes.h"
+#include "provisioningdatabasemanager.h"
 
 #define TAG  "SRM-DOXM"
 
@@ -1205,6 +1207,88 @@ OCStackResult GetDoxmDeviceID(OicUuid_t *deviceID)
     return OC_STACK_ERROR;
 }
 
+OCStackResult SetDoxmDeviceID(const OicUuid_t *deviceID)
+{
+    bool isPT = false;
+
+    if(NULL == deviceID)
+    {
+        return OC_STACK_INVALID_PARAM;
+    }
+    if(NULL == gDoxm)
+    {
+        OIC_LOG(ERROR, TAG, "Doxm resource is not initialized.");
+        return OC_STACK_NO_RESOURCE;
+    }
+
+    //Check the device's OTM state
+
+#ifdef __WITH_DTLS__
+    //for PT.
+    if(true == gDoxm->owned &&
+       memcmp(gDoxm->deviceID.id, gDoxm->owner.id, sizeof(gDoxm->owner.id)) == 0)
+    {
+        OCUuidList_t* ownedDevices = NULL;
+        size_t* ownedDevNum = 0;
+
+        if(OC_STACK_OK == PDMGetOwnedDevices(&ownedDevices, &ownedDevNum))
+        {
+            OCUuidList_t* temp1 = NULL;
+            OCUuidList_t* temp2 = NULL;
+            LL_FOREACH_SAFE(ownedDevices, temp1, temp2)
+            {
+                LL_DELETE(ownedDevices, temp1);
+                OICFree(temp1);
+            }
+
+            if(0 != ownedDevNum)
+            {
+                OIC_LOG(ERROR, TAG, "This device has ownership for other device.");
+                OIC_LOG(ERROR, TAG, "Device UUID cannot be changed to guarantee the reliability of the connection.");
+                return OC_STACK_ERROR;
+            }
+        }
+
+        isPT = true;
+    }
+    //for normal device.
+    else if(true == gDoxm->owned)
+    {
+        OIC_LOG(ERROR, TAG, "This device owned by owner's device.");
+        OIC_LOG(ERROR, TAG, "Device UUID cannot be changed to guarantee the reliability of the connection.");
+        return OC_STACK_ERROR;
+    }
+#endif //__WITH_DTLS
+
+    //Save the previous UUID
+    OicUuid_t tempUuid;
+    memcpy(tempUuid.id, gDoxm->deviceID.id, sizeof(tempUuid.id));
+
+    //Change the UUID
+    memcpy(gDoxm->deviceID.id, deviceID->id, sizeof(deviceID->id));
+    if(isPT)
+    {
+        memcpy(gDoxm->owner.id, deviceID->id, sizeof(deviceID->id));
+        memcpy(gDoxm->rownerID.id, deviceID->id, sizeof(deviceID->id));
+    }
+
+    //Update PS
+    if(!UpdatePersistentStorage(gDoxm))
+    {
+        //revert UUID in case of update error
+        memcpy(gDoxm->deviceID.id, tempUuid.id, sizeof(tempUuid.id));
+        if(isPT)
+        {
+            memcpy(gDoxm->owner.id, tempUuid.id, sizeof(tempUuid.id));
+            memcpy(gDoxm->rownerID.id, tempUuid.id, sizeof(tempUuid.id));
+        }
+
+        OIC_LOG(ERROR, TAG, "Failed to update persistent storage");
+        return OC_STACK_ERROR;
+    }
+    return OC_STACK_OK;
+}
+
 OCStackResult GetDoxmDevOwnerId(OicUuid_t *devownerid)
 {
     OCStackResult retVal = OC_STACK_ERROR;
index 63b90e2..3054430 100644 (file)
@@ -3,7 +3,7 @@
 %{!?VERBOSE: %define VERBOSE 1}
 
 Name: com-oic-ri-sample
-Version:    1.1.1
+Version:    1.2.0
 Release:    0
 Summary: Tizen adapter interfacesample application
 URL: http://slp-source.sec.samsung.net
index 2bc78f8..f86c4c6 100644 (file)
@@ -5,7 +5,7 @@
 %{!?VERBOSE: %define VERBOSE 1}
 
 Name: com-oic-ri
-Version:    1.1.1
+Version:    1.2.0
 Release:    0
 Summary: Tizen oicri application
 URL: http://slp-source.sec.samsung.net
index 09f2057..f873a93 100644 (file)
@@ -84,6 +84,9 @@ if target_os in ['android']:
 if target_os in ['darwin', 'ios']:
        examples_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
 
+if target_os == 'tizen':
+    examples_env.AppendUnique(CPPDEFINES = ['__TIZEN__'])
+
 
 ######################################################################
 # Source files and Targets
index e077f01..b5b2b37 100644 (file)
@@ -339,6 +339,7 @@ namespace OC
             return OC_STACK_DELETE_TRANSACTION;
         }
 
+        std::string resourceURI = clientResponse->resourceUri;
         if (clientResponse->result != OC_STACK_OK)
         {
             oclog() << "listenMQCallback(): failed to create resource. clientResponse: "
@@ -346,7 +347,7 @@ namespace OC
                     << std::flush;
 
             std::thread exec(context->callback, clientResponse->result,
-                             std::string(clientResponse->resourceUri), nullptr);
+                             resourceURI, nullptr);
             exec.detach();
 
             return OC_STACK_DELETE_TRANSACTION;
@@ -369,7 +370,7 @@ namespace OC
             for (auto resource : container.Resources())
             {
                 std::thread exec(context->callback, clientResponse->result,
-                                 std::string(clientResponse->resourceUri), resource);
+                                 resourceURI, resource);
                 exec.detach();
             }
         }
index cdf7d7c..301e7df 100644 (file)
@@ -67,6 +67,7 @@ if target_os == 'android':
 
 if target_os == 'tizen':
        oclib_env.AppendUnique(CPPDEFINES = ['__TIZEN__'])
+       oclib_env.ParseConfig('pkg-config --cflags --libs sqlite3')
 
 if target_os in ['linux'] and oclib_env.get('SIMULATOR', False):
     oclib_env.Append( RPATH = oclib_env.Literal('\\$$ORIGIN'))
index 77f4a1e..6f14d86 100644 (file)
@@ -101,6 +101,7 @@ if target_os in ['android','linux']:
                easy_setup_env.AppendUnique(CPPPATH = [
                        env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include',
                        env.get('SRC_DIR') + '/resource/csdk/connectivity/api/',
+                       env.get('SRC_DIR') + '/resource/csdk/security/include/internal',
                        env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include/internal',
                        env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include/oxm'])
                if env.get('WITH_TCP') == True:
index cae9ec5..6d2216d 100755 (executable)
@@ -54,6 +54,12 @@ Java_org_iotivity_service_easysetup_mediator_EasySetup_nativeCreateRemoteEnrolle
     try
     {
         nativeRemoteEnrollee = EasySetup::getInstance()->createRemoteEnrollee(jniOcResource->getOCResource());
+        if (!nativeRemoteEnrollee)
+        {
+            ES_LOGE("Failed to create RemoteEnrollee object.");
+            return NULL;
+        }
+
         //create the java object
         jRemoteEnrollee = env->NewObject(g_cls_RemoteEnrollee, g_mid_RemoteEnrollee_ctor);
         if (!jRemoteEnrollee)
index 7078def..551f4a4 100755 (executable)
@@ -77,3 +77,4 @@ cmdBuildEasysetup=jdk_env.Gradle(target="EasySetupCore/objs",
 
 Depends(cmdBuildEasysetup, env.get('baseAAR'))
 
+env.AppendUnique(easysetupAAR = cmdBuildEasysetup)
\ No newline at end of file
index da65cb1..1c9703b 100755 (executable)
@@ -329,6 +329,13 @@ namespace OIC
             return false;
         }
 
+
+        std::string EnrolleeSecurity::getUUID() const
+        {
+            return m_ocResource->sid();
+        };
+
+#if defined(__WITH_DTLS__) && defined(__WITH_TLS__)
         void EnrolleeSecurity::provisionSecurityForCloudServer(
             std::string cloudUuid, int credId)
         {
@@ -461,11 +468,6 @@ namespace OIC
             return res;
         }
 
-        std::string EnrolleeSecurity::getUUID() const
-        {
-            return m_ocResource->sid();
-        };
-
         OicSecAcl_t* EnrolleeSecurity::createAcl(const OicUuid_t cloudUuid)
         {
             // allocate memory for |acl| struct
@@ -565,5 +567,6 @@ namespace OIC
             }
             m_cond.notify_all();
         }
+#endif //defined(__WITH_DTLS__) && defined(__WITH_TLS__)
     }
 }
index 8ab91ed..26b50f8 100644 (file)
@@ -57,8 +57,6 @@ namespace OIC
                 const SecurityPinCb securityPinCb,
                 const SecProvisioningDbPathCb secProvisioningDbPathCb);
             void provisionOwnership();
-            void provisionSecurityForCloudServer(
-                std::string cloudUuid, int credId);
             std::string getUUID() const;
 
         private:
@@ -73,13 +71,6 @@ namespace OIC
             std::atomic<bool>  aclResult;
             std::atomic<bool>  certResult;
 
-            ESResult performCertProvisioningForCloudServer(
-                std::shared_ptr< OC::OCSecureResource > ownedDevice,
-                int credId);
-            ESResult performACLProvisioningForCloudServer(
-                std::shared_ptr< OC::OCSecureResource > ownedDevice,
-                std::string& cloudUuid);
-
             std::shared_ptr< OC::OCSecureResource > m_securedResource;
             std::shared_ptr< OC::OCSecureResource > findEnrolleeSecurityResource(
                 OC::DeviceList_t &list);
@@ -90,10 +81,22 @@ namespace OIC
             void convertUUIDToString(const uint8_t uuid[UUID_SIZE],
                                                 std::string& uuidString);
             void convertStringToUUID(OicUuid_t& uuid, const std::string uuidString);
-            OicSecAcl_t* createAcl(const OicUuid_t cloudUuid);
 
+#if defined(__WITH_DTLS__) && defined(__WITH_TLS__)
+        public:
+            void provisionSecurityForCloudServer(
+                std::string cloudUuid, int credId);
+        private:
+            ESResult performCertProvisioningForCloudServer(
+                std::shared_ptr< OC::OCSecureResource > ownedDevice,
+                int credId);
+            ESResult performACLProvisioningForCloudServer(
+                std::shared_ptr< OC::OCSecureResource > ownedDevice,
+                std::string& cloudUuid);
+            OicSecAcl_t* createAcl(const OicUuid_t cloudUuid);
             void ACLProvisioningCb(PMResultList_t *result, int hasError);
             void CertProvisioningCb(PMResultList_t *result, int hasError);
+#endif //defined(__WITH_DTLS__) && defined(__WITH_TLS__)
         };
     }
 }
index 2bb1792..aa266fd 100755 (executable)
@@ -345,11 +345,6 @@ namespace OIC
         {
             ESResult result = ES_ERROR;
 
-            if (m_cloudResource != nullptr)
-            {
-                throw ESBadRequestException ("Already created");
-            }
-
             result = discoverResource();
 
             if (result == ES_ERROR)
@@ -437,7 +432,7 @@ namespace OIC
                 m_cloudPropProvStatusCb(provStatus);
                 return;
             }
-#endif
+#endif //defined(__WITH_DTLS__) && defined(__WITH_TLS__)
 
             if (m_cloudResource == nullptr)
             {
index b20dc4e..76a902b 100644 (file)
@@ -77,7 +77,8 @@ help_vars.Add(EnumVariable('SECURED', 'Build with DTLS', '0', allowed_values=('0
 help_vars.Add(BoolVariable('UPLOAD', 'Upload binary ? (For Arduino)', require_upload))
 help_vars.Add(EnumVariable('ROUTING', 'Enable routing', 'EP', allowed_values=('GW', 'EP')))
 help_vars.Add(EnumVariable('BUILD_SAMPLE', 'Build with sample', 'ON', allowed_values=('ON', 'OFF')))
-
+help_vars.Add(BoolVariable('WITH_TCP', 'Build with TCP adapter', False))
+help_vars.Add(BoolVariable('WITH_CLOUD', 'Build including AccountManager class and Cloud Client sample', False))
 help_vars.AddVariables(('DEVICE_NAME', 'Network display name for device', 'OIC-DEVICE', None, None),)
 
 #ES_TARGET_ENROLLEE is for specifying what is our target enrollee (Arduino or rest of platforms which support Multicast)
index 1038ff1..149f05f 100644 (file)
@@ -19,7 +19,8 @@ with_cloud = env.get('WITH_CLOUD')
 print "Given Transport is %s" % transport
 print "Given OS is %s" % target_os
 print "Given es_target_enrollee is %s" % es_target_enrollee
-
+print "Given tcp option is %s" % with_tcp
+print "Given cloud option is %s" %with_cloud
 
 if target_os == 'tizen':
        command = "sh service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/gbsbuild.sh %s %s %s %s %s %s %s %s" % (transport, secured, routing, release_mode, logging, es_target_enrollee, with_tcp, with_cloud)
index dda4b40..41d14d9 100644 (file)
@@ -3,7 +3,7 @@
 %{!?VERBOSE: %define VERBOSE 1}
 
 Name: com-oic-es-sample
-Version:    1.1.1
+Version:    1.2.0
 Release:    0
 Summary: Tizen adapter interfacesample application
 URL: http://slp-source.sec.samsung.net
old mode 100644 (file)
new mode 100755 (executable)
index 3f800e7..6f5b6f6
Binary files a/service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/assets/oic_svr_db_client.dat and b/service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/assets/oic_svr_db_client.dat differ
index 54d9624..021902c 100644 (file)
@@ -75,4 +75,4 @@ jdk_env['BUILD_DIR'] = env.get('BUILD_DIR')
 cmdBuildEasysetupApp=jdk_env.Gradle(target="EasySetup/app/apk", 
     source="EasySetup/app/src/main/java/org/iotivity/service/easysetup/EasysetupActivity.java")
 
-Depends(cmdBuildEasysetupApp, env.get('baseAAR'))
\ No newline at end of file
+Depends(cmdBuildEasysetupApp, env.get('easysetupAAR'))
\ No newline at end of file
old mode 100644 (file)
new mode 100755 (executable)
index 3f800e7..6f5b6f6
Binary files a/service/easy-setup/sampleapp/mediator/linux/richsdk_sample/oic_svr_db_client.dat and b/service/easy-setup/sampleapp/mediator/linux/richsdk_sample/oic_svr_db_client.dat differ
index c1dd082..7fcd077 100644 (file)
@@ -23,6 +23,7 @@
 #include <stdexcept>
 #include <utility>
 #include "InternalTypes.h"
+#include <string.h>
 
 #define CONTAINER_TAG "RESOURCE_CONTAINER"
 #define DISCOVER_TAG "DISCOVER_RESOURCE_UNIT"
index 48825cc..6739f82 100644 (file)
@@ -707,29 +707,28 @@ class DiscoverResourceUnitTest: public TestWithMock
 
 TEST_F(DiscoverResourceUnitTest, startDiscover)
 {
-    std::string type = "Resource.Container";
+    std::string type = "resource.container";
     std::string attributeName = "TestResourceContainer";
 
     m_pDiscoverResourceUnit->startDiscover(
         DiscoverResourceUnit::DiscoverResourceInfo("", type, attributeName), m_updatedCB);
 
-    std::chrono::milliseconds interval(400);
+    std::chrono::milliseconds interval(ResourceContainerTestSimulator::DEFAULT_WAITTIME);
     std::this_thread::sleep_for(interval);
 }
 
 TEST_F(DiscoverResourceUnitTest, onUpdateCalled)
 {
-    std::string type = "Resource.Container";
+    std::string type = "resource.container";
     std::string attributeName = "TestResourceContainer";
 
     m_pDiscoverResourceUnit->startDiscover(
         DiscoverResourceUnit::DiscoverResourceInfo("", type, attributeName), m_updatedCB);
 
-    std::chrono::milliseconds interval(400);
+    std::chrono::milliseconds interval(ResourceContainerTestSimulator::DEFAULT_WAITTIME);
     std::this_thread::sleep_for(interval);
 
     testObject->ChangeAttributeValue();
-
 }
 
 namespace
index 40d1370..5d6ccd0 100644 (file)
@@ -41,6 +41,8 @@ class ResourceContainerTestSimulator
         RCSResourceObject::Ptr server;
         RCSRemoteResourceObject::Ptr remoteResource;
 
+        static constexpr int DEFAULT_WAITTIME = 3000;
+
     private:
         std::mutex mutexForDiscovery;
 
@@ -60,7 +62,7 @@ class ResourceContainerTestSimulator
               RESOURCEURI("/a/TempHumSensor/Container"),
               RESOURCETYPE("resource.container"),
               RESOURCEINTERFACE("oic.if.baseline"),
-              ATTR_KEY("Temperature"),
+              ATTR_KEY("TestResourceContainer"),
               ATTR_VALUE(0)
         { }
 
@@ -115,7 +117,7 @@ class ResourceContainerTestSimulator
         }
         void waitForDiscovery()
         {
-            std::chrono::milliseconds interval(100);
+            std::chrono::milliseconds interval(DEFAULT_WAITTIME);
             while (true)
             {
                 if (mutexForDiscovery.try_lock())
@@ -180,7 +182,7 @@ class ResourceContainerTestSimulator
 
         void ChangeAttributeValue()
         {
-            std::chrono::milliseconds interval(100);
+            std::chrono::milliseconds interval(DEFAULT_WAITTIME);
             if (server != nullptr)
                 server->setAttribute(ATTR_KEY, ATTR_VALUE + 10);
             std::this_thread::sleep_for(interval);
@@ -188,7 +190,7 @@ class ResourceContainerTestSimulator
 
         void ChangeResourceState()
         {
-            std::chrono::milliseconds interval(400);
+            std::chrono::milliseconds interval(DEFAULT_WAITTIME);
             if (server != nullptr)
                 server = nullptr;
             std::this_thread::sleep_for(interval);
index 923ee3b..48c699f 100644 (file)
@@ -23,5 +23,5 @@ dependencies {
     compile fileTree(dir: 'libs', include: ['*.jar'])
 
     compile(name:'iotivity-armeabi-service-release', ext:'aar')
-    compile(name:'iotivity-armeabi-base-release', ext:'aar')
+    compile(name:'iotivity-base-armeabi-release', ext:'aar')
 }
index 30a16ff..1f64223 100644 (file)
@@ -23,5 +23,5 @@ dependencies {
     compile fileTree(dir: 'libs', include: ['*.jar'])
 
     compile(name:'iotivity-armeabi-service-release', ext:'aar')
-    compile(name:'iotivity-armeabi-base-release', ext:'aar')
+    compile(name:'iotivity-base-armeabi-release', ext:'aar')
 }
index 9a82719..1730a1e 100644 (file)
@@ -1,5 +1,5 @@
 Name: iotivity
-Version: 1.1.1
+Version: 1.2.0
 Release: 0
 Summary: IoT Connectivity sponsored by the OCF
 Group: Network & Connectivity/Other