Move CASetSecureEndpointUuid APIs 31/215631/1
authorJaehong Jo <jaehong.jo@samsung.com>
Wed, 18 Sep 2019 08:08:55 +0000 (17:08 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Mon, 14 Oct 2019 00:57:14 +0000 (09:57 +0900)
Since this API is used externally,
moved it to the cautil header instead of the security header.

https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/577
(cherry-picked from 991775c94943140fd72ee564f142aee55df058ac)

Change-Id: I5d3221dcdb69d720fbd77bcbda878c2b20cba9dc
Signed-off-by: Jaehong Jo <jaehong.jo@samsung.com>
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
resource/csdk/connectivity/api/casecurityinterface.h
resource/csdk/connectivity/api/cautilinterface.h
resource/csdk/connectivity/src/caconnectivitymanager.c
resource/csdk/connectivity/util/src/cautilinterface.c

index 264bac8..5e628d4 100644 (file)
@@ -119,16 +119,6 @@ typedef int (*CAgetPskCredentialsHandler)(CADtlsPskCredType_t type,
  */
 const CASecureEndpoint_t *CAGetSecureEndpointData(const CAEndpoint_t *peer);
 #endif //MULTIPLE_OWNER
-
-/**
- * API to set a secure endpoint identity with uuid
- *
- * @param[in] peer peer information includs IP address and port
- * @param[in] uuid UUID of target device
- *
- * @return  ::CA_STATUS_OK or appropriate error code
- */
-CAResult_t CASetSecureEndpointUuid(const CAEndpoint_t *peer, const char *uuid);
 #endif
 
 /**
index 1b14968..563c781 100644 (file)
@@ -435,6 +435,17 @@ CAResult_t CAUtilTCPDisconnectSession(const char *address,
  */
 void CAUtilSkipTCPCloseOnInterfaceDown(bool state);
 
+
+/**
+ * Set a secure endpoint identity with uuid.
+ *
+ * @param[in]   peer     peer information includs IP address and port.
+ * @param[in]   uuid     UUID of target device.
+ *
+ * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
+ */
+CAResult_t CASetSecureEndpointUuid(const CAEndpoint_t *peer, const char *uuid);
+
 CAResult_t CAUtilStartGattServer();
 CAResult_t CAUtilStopGattServer();
 
index a3e8f41..bd5df0e 100755 (executable)
@@ -161,20 +161,6 @@ const CASecureEndpoint_t *CAGetSecureEndpointData(const CAEndpoint_t *peer)
 }
 #endif //MULTIPLE_OWNER
 
-CAResult_t CASetSecureEndpointUuid(const CAEndpoint_t *peer, const char *uuid)
-{
-    OIC_LOG(DEBUG, TAG, "IN CASetSecureEndpointUuid");
-
-    if (!g_isInitialized)
-    {
-        OIC_LOG(DEBUG, TAG, "CA is not initialized");
-        return CA_STATUS_NOT_INITIALIZED;
-    }
-
-    OIC_LOG(DEBUG, TAG, "OUT CASetSecureEndpointUuid");
-    return SetCASecureEndpointUuid(peer, uuid);
-}
-
 CAResult_t CAregisterSslHandshakeCallback(CAErrorCallback tlsHandshakeCallback)
 {
     OIC_LOG(DEBUG, TAG, "CAregisterSslHandshakeCallback");
index 5321cd4..0a03b11 100644 (file)
@@ -28,6 +28,9 @@
 #ifdef TCP_ADAPTER
 #include "catcpadapter.h"
 #endif
+#if defined(__WITH_DTLS__) || defined(__WITH_TLS__)
+#include "ca_adapter_net_ssl.h"
+#endif
 
 #define TAG "OIC_CA_COMMON_UTILS"
 
@@ -492,6 +495,19 @@ void CAUtilSkipTCPCloseOnInterfaceDown(bool state)
 #endif
 }
 
+CAResult_t CASetSecureEndpointUuid(const CAEndpoint_t *peer, const char *uuid)
+{
+    OIC_LOG(DEBUG, TAG, "CASetSecureEndpointUuid");
+#if defined(__WITH_DTLS__) || defined(__WITH_TLS__)
+    return SetCASecureEndpointUuid(peer, uuid);
+#else
+    (void) peer;
+    (void) uuid;
+    OIC_LOG(DEBUG, TAG, "it is not supported");
+    return CA_NOT_SUPPORTED;
+#endif
+}
+
 CAResult_t CAUtilStartGattServer()
 {
        OIC_LOG(DEBUG, TAG, "CAUtilStartGattServer");