Merge branch '1.3-rel' (9cff398) into 'master' 37/22837/3
authorGeorge Nash <george.nash@intel.com>
Fri, 13 Oct 2017 22:13:09 +0000 (15:13 -0700)
committerGeorge Nash <george.nash@intel.com>
Fri, 20 Oct 2017 21:32:33 +0000 (14:32 -0700)
Relates-to:
https://gerrit.iotivity.org/gerrit/22743/
https://gerrit.iotivity.org/gerrit/22231/
https://gerrit.iotivity.org/gerrit/22621/
https://gerrit.iotivity.org/gerrit/22785/
https://gerrit.iotivity.org/gerrit/22703/
https://gerrit.iotivity.org/gerrit/22739/
https://gerrit.iotivity.org/gerrit/22793/
https://gerrit.iotivity.org/gerrit/22719/
https://gerrit.iotivity.org/gerrit/22777/
https://gerrit.iotivity.org/gerrit/22599/
https://gerrit.iotivity.org/gerrit/22329/
https://gerrit.iotivity.org/gerrit/22789/
https://gerrit.iotivity.org/gerrit/22741/
https://gerrit.iotivity.org/gerrit/22715/
https://gerrit.iotivity.org/gerrit/21945/
https://gerrit.iotivity.org/gerrit/22737/
https://gerrit.iotivity.org/gerrit/22725/
https://gerrit.iotivity.org/gerrit/22327/

Conflicts:
  resource/csdk/connectivity/src/bt_le_adapter/caleadapter.c
  resource/csdk/security/src/pstatresource.c
  resource/csdk/stack/src/ocobserve.c
  resource/include/StringConstants.h
  resource/unittests/OCExceptionTest.cpp
  service/coap-http-proxy/unittests/CoAPHttpUnitTest.cpp
  service/resource-container/unittests/SConscript

Bug: https://jira.iotivity.org/browse/IOT-2453
Change-Id: I8a378b98876e916a3940fc707f3bfad1afcbf9c6
Signed-off-by: George Nash <george.nash@intel.com>
30 files changed:
1  2 
build_common/linux/SConscript
resource/csdk/connectivity/common/inc/cacommonutil.h
resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c
resource/csdk/connectivity/src/bt_le_adapter/caleadapter.c
resource/csdk/connectivity/test/ssladapter_test.cpp
resource/csdk/include/octypes.h
resource/csdk/resource-directory/src/internal/rd_database.c
resource/csdk/resource-directory/src/rd_server.c
resource/csdk/resource-directory/unittests/rdtests.cpp
resource/csdk/security/provisioning/sample/provisioningclient.c
resource/csdk/security/provisioning/sample/sampleserver_mfg.cpp
resource/csdk/security/provisioning/src/ocprovisioningmanager.c
resource/csdk/security/provisioning/src/ownershiptransfermanager.c
resource/csdk/security/provisioning/src/oxmpreconfpin.c
resource/csdk/security/provisioning/src/oxmrandompin.c
resource/csdk/security/src/credresource.c
resource/csdk/security/src/deviceonboardingstate.c
resource/csdk/security/src/pstatresource.c
resource/csdk/stack/octbstack_product_secured.def
resource/csdk/stack/samples/linux/SimpleClientServer/ocserver.cpp
resource/csdk/stack/src/occollection.c
resource/csdk/stack/src/ocobserve.c
resource/csdk/stack/src/ocpayload.c
resource/csdk/stack/src/ocresource.c
resource/csdk/stack/src/ocstack.c
resource/csdk/stack/test/stacktests.cpp
resource/provisioning/examples/provisioningclient.cpp
service/coap-http-proxy/unittests/CoAPHttpUnitTest.cpp
service/easy-setup/enrollee/src/resourcehandler.c
service/resource-container/unittests/SConscript

@@@ -4,13 -4,11 +4,16 @@@
  #
  ##
  import os
+ import subprocess
+ from distutils.version import StrictVersion
  Import('env')
  
 +# Test Coverage Flags and Library (if RELEASE=0)
 +if not env.get('RELEASE'):
 +    env.AppendUnique(LIBS=['gcov'])
 +    env.AppendUnique(CCFLAGS=['--coverage', '-fPIC', '-O0'])
 +
  # Add the default lib directory
  build_dir = env.get('BUILD_DIR')
  env.AppendUnique(LIBPATH=[build_dir])
@@@ -1481,8 -1480,120 +1481,120 @@@ static void CALEServerSendDataThread(vo
       }
      else
      {
 -        OIC_LOG(DEBUG, CALEADAPTER_TAG, "Server Sending Multicast data");
 +        OIC_LOG(DEBUG, CALEADAPTER_TAG, "Server Sending Multicast Data");
+ #if defined(__TIZEN__)
+         // @todo
+         // tizen ble should also disabled when Tizen 3.0 is updated.
+         result = CAUpdateCharacteristicsToAllGattClients(dataSegment, length);
+         if (CA_STATUS_OK != result)
+         {
+             OIC_LOG_V(ERROR, CALEADAPTER_TAG, "Update characteristics failed, result [%d]",
+                       result);
+             CALEErrorHandler(NULL, bleData->data, bleData->dataLen, result);
+             return;
+         }
+         result = CAGenerateHeader(dataHeader,
+                                   CA_BLE_PACKET_NOT_START,
+                                   g_localBLESourcePort,
+                                   secureFlag,
+                                   CA_BLE_MULTICAST_PORT);
+         if (CA_STATUS_OK != result)
+         {
+             OIC_LOG_V(ERROR, CALEADAPTER_TAG,
+                       "CAGenerateHeader failed, result [%d]", result);
+             if (g_errorHandler)
+             {
+                 g_errorHandler(bleData->remoteEndpoint, bleData->data, bleData->dataLen, result);
+             }
+             return;
+         }
+         OIC_LOG_V(DEBUG,
+                   CALEADAPTER_TAG,
+                   "Server Sent Multicast First Data - data length [%zu]",
+                   length);
+         for (index = 0; index < iter; index++)
+         {
+             // Send the remaining header.
+             result = CAMakeRemainDataSegment(dataSegment,
+                                              CA_BLE_NORMAL_SEGMENT_PAYLOAD_SIZE,
+                                              bleData->data,
+                                              bleData->dataLen,
+                                              index,
+                                              dataHeader);
+             if (CA_STATUS_OK != result)
+             {
+                 OIC_LOG_V(ERROR, CALEADAPTER_TAG,
+                             "Making data segment failed, result [%d]", result);
+                 if (g_errorHandler)
+                 {
+                     g_errorHandler(bleData->remoteEndpoint, bleData->data, bleData->dataLen, result);
+                 }
+                 return;
+             }
+             result = CAUpdateCharacteristicsToAllGattClients(
+                          dataSegment,
+                          CA_SUPPORTED_BLE_MTU_SIZE);
+             if (CA_STATUS_OK != result)
+             {
+                 OIC_LOG_V(ERROR, CALEADAPTER_TAG, "Update characteristics failed, result [%d]",
+                           result);
+                 CALEErrorHandler(NULL, bleData->data, bleData->dataLen, result);
+                 return;
+             }
+             OIC_LOG_V(DEBUG,
+                       CALEADAPTER_TAG,
+                       "Server Sent Multicast %d Data - data length [%zu]",
+                       index + 1,
+                       CA_SUPPORTED_BLE_MTU_SIZE);
+         }
+         if (remainingLen && (totalLength > CA_SUPPORTED_BLE_MTU_SIZE))
+         {
+             // send the last segment of the data (Ex: 22 bytes of 622
+             // bytes of data when MTU is 200)
+             result = CAMakeRemainDataSegment(dataSegment,
+                                              remainingLen,
+                                              bleData->data,
+                                              bleData->dataLen,
+                                              index,
+                                              dataHeader);
+             if (CA_STATUS_OK != result)
+             {
+                 OIC_LOG_V(ERROR, CALEADAPTER_TAG,
+                             "Making data segment failed, result [%d]", result);
+                 if (g_errorHandler)
+                 {
+                     g_errorHandler(bleData->remoteEndpoint, bleData->data, bleData->dataLen, result);
+                 }
+                 return;
+             }
+             result = CAUpdateCharacteristicsToAllGattClients(
+                          dataSegment,
+                          remainingLen + CA_BLE_HEADER_SIZE);
+             if (CA_STATUS_OK != result)
+             {
+                 OIC_LOG_V(ERROR, CALEADAPTER_TAG, "Update characteristics failed, result [%d]",
+                           result);
+                 CALEErrorHandler(NULL, bleData->data, bleData->dataLen, result);
+                 return;
+             }
+             OIC_LOG_V(DEBUG,
+                       CALEADAPTER_TAG,
+                       "Server Sent Multicast Last Data - data length [%" PRIuPTR "]",
+                       remainingLen + CA_BLE_HEADER_SIZE);
+         }
+ #else
          OIC_LOG(DEBUG, CALEADAPTER_TAG, "BLE Multicast is not supported");
+ #endif
      }
  
      OIC_LOG(DEBUG, CALEADAPTER_TAG, "OUT - CALEServerSendDataThread");
@@@ -1783,10 -1894,125 +1895,124 @@@ static void CALEClientSendDataThread(vo
      }
      else
      {
-         OIC_LOG(DEBUG, CALEADAPTER_TAG, "Client Sending Multicast data");
+ #if defined(__TIZEN__)
+         // @todo
+         // tizen ble should also disabled when Tizen 3.0 is updated.
+         //Sending Mulitcast Data
+         // Send the first segment with the header.
+         OIC_LOG(DEBUG, CALEADAPTER_TAG, "Client Sending Multicast Data");
+         result = CAUpdateCharacteristicsToAllGattServers(dataSegment, length);
+         if (CA_STATUS_OK != result)
+         {
+             OIC_LOG_V(ERROR, CALEADAPTER_TAG,
+                       "Update characteristics (all) failed, result [%d]", result);
+             CALEErrorHandler(NULL, bleData->data, bleData->dataLen, result);
+             return;
+         }
+         result = CAGenerateHeader(dataHeader,
+                                   CA_BLE_PACKET_NOT_START,
+                                   g_localBLESourcePort,
+                                   secureFlag,
+                                   0);
+         if (CA_STATUS_OK != result)
+         {
+             OIC_LOG_V(ERROR, CALEADAPTER_TAG,
+                       "CAGenerateHeader failed, result [%d]", result);
+             if (g_errorHandler)
+             {
+                 g_errorHandler(bleData->remoteEndpoint, bleData->data, bleData->dataLen, result);
+             }
+             return;
+         }
+         OIC_LOG_V(DEBUG,
+                   CALEADAPTER_TAG,
+                   "Client Sent Multicast First Data - data length [%zu]",
+                   length);
+         for (index = 0; index < iter; index++)
+         {
+             // Send the remaining header.
+             result = CAMakeRemainDataSegment(dataSegment,
+                                              CA_BLE_NORMAL_SEGMENT_PAYLOAD_SIZE,
+                                              bleData->data,
+                                              bleData->dataLen,
+                                              index,
+                                              dataHeader);
+             if (CA_STATUS_OK != result)
+             {
+                 OIC_LOG_V(ERROR, CALEADAPTER_TAG,
+                             "Making data segment failed, result [%d]", result);
+                 if (g_errorHandler)
+                 {
+                     g_errorHandler(bleData->remoteEndpoint, bleData->data, bleData->dataLen, result);
+                 }
+                 return;
+             }
+             result = CAUpdateCharacteristicsToAllGattServers(
+                          dataSegment,
+                          CA_SUPPORTED_BLE_MTU_SIZE);
+             if (CA_STATUS_OK != result)
+             {
+                 OIC_LOG_V(ERROR, CALEADAPTER_TAG, "Update characteristics failed, result [%d]",
+                           result);
+                 CALEErrorHandler(NULL, bleData->data, bleData->dataLen, result);
+                 return;
+             }
+             OIC_LOG_V(DEBUG,
+                       CALEADAPTER_TAG,
+                       "Client Sent Multicast %d Data - data length [%zu]",
+                       index + 1,
+                       CA_SUPPORTED_BLE_MTU_SIZE);
+         }
+         if (remainingLen && (totalLength > CA_SUPPORTED_BLE_MTU_SIZE))
+         {
+             // send the last segment of the data (Ex: 22 bytes of 622
+             // bytes of data when MTU is 200)
+             result = CAMakeRemainDataSegment(dataSegment,
+                                              remainingLen,
+                                              bleData->data,
+                                              bleData->dataLen,
+                                              index,
+                                              dataHeader);
+             if (CA_STATUS_OK != result)
+             {
+                 OIC_LOG_V(ERROR, CALEADAPTER_TAG,
+                             "Making data segment failed, result [%d]", result);
+                 if (g_errorHandler)
+                 {
+                     g_errorHandler(bleData->remoteEndpoint, bleData->data, bleData->dataLen, result);
+                 }
+                 return;
+             }
+             result =
+                 CAUpdateCharacteristicsToAllGattServers(
+                     dataSegment,
+                     remainingLen + CA_BLE_HEADER_SIZE);
+             if (CA_STATUS_OK != result)
+             {
+                 OIC_LOG_V(ERROR, CALEADAPTER_TAG,
+                           "Update characteristics (all) failed, result [%d]", result);
+                 CALEErrorHandler(NULL, bleData->data, bleData->dataLen, result);
+                 return;
+             }
+             OIC_LOG_V(DEBUG,
+                       CALEADAPTER_TAG,
+                       "Client Sent Multicast Last Data - data length [%" PRIuPTR "]",
+                       remainingLen + CA_BLE_HEADER_SIZE);
+         }
+ #else
          OIC_LOG(DEBUG, CALEADAPTER_TAG, "BLE Multicast is not supported");
 -#endif
      }
--
++#endif
      OIC_LOG(DEBUG, CALEADAPTER_TAG, "OUT - CABLEClientSendDataThread");
  }
  
Simple merge
@@@ -458,18 -472,19 +458,19 @@@ ResourceObserver* GetObserverUsingId(OC
  {
      ResourceObserver *out = NULL;
  
-     if (observeId)
 -    LL_FOREACH (g_serverObsList, out)
++    LL_FOREACH (resource->observersHead, out)
      {
-         LL_FOREACH (resource->observersHead, out)
+         if (out->observeId == observeId)
          {
-             if (out->observeId == observeId)
-             {
-                 return out;
-             }
-             CheckTimedOutObserver(out, resource);
+             return out;
          }
 -        CheckTimedOutObserver(out);
++        CheckTimedOutObserver(out, resource);
+     }
+     if (!out)
+     {
+         OIC_LOG(INFO, TAG, "Observer node not found!!");
      }
-     OIC_LOG(INFO, TAG, "Observer node not found!!");
      return NULL;
  }
  
Simple merge
Simple merge
Simple merge
@@@ -25,6 -25,7 +25,7 @@@
  #include "oic_string.h"
  #include "oic_malloc.h"
  #include "cautilinterface.h"
 -#include "payload_logging.h"
++#include "experimental/payload_logging.h"
  
  /**
   * @var ES_RH_TAG
@@@ -50,10 -52,9 +50,7 @@@ if lib_env.get('RELEASE')
  else:
      lib_env.AppendUnique(CCFLAGS=['-g'])
  
- if lib_env.get('LOGGING'):
-     lib_env.AppendUnique(CPPDEFINES=['TB_LOG'])
  
 -# Add third party libraries
 -SConscript(src_dir + '/service/third_party_libs.scons', 'lib_env')
  container_gtest_env = lib_env.Clone()
  
  if int(containerJavaSupport):