Add CAcloseSslConnectionFreeEndpoint method
[platform/upstream/iotivity.git] / resource / csdk / connectivity / api / casecurityinterface.h
index 166bba6..117ab18 100644 (file)
@@ -73,7 +73,23 @@ typedef enum
     CA_SSL_EKCB_DTLS = 1
 }CASslEkcbProtocol_t;
 
-typedef OCStackResult (*UserConfirmNoCertCallback)(void * ctx);
+/**
+ *@enum CACertificateVerificationStatus_t
+ * type of certificate status info to be used when invoking
+ * certificate verification status info callback
+ */
+typedef enum
+{
+    CA_CERTIFICATE_VERIFY_SUCCESS_MUTUAL = 0,
+    CA_CERTIFICATE_VERIFY_NO_CERT,
+    CA_CERTIFICATE_VERIFY_FAILED
+} CACertificateVerificationStatus_t;
+
+/**
+ * Callback function type for certificate verification status.
+ * @param[in]   status      Certificate verification status info.
+ */
+typedef void (*CertificateVerificationCallback_t)(CACertificateVerificationStatus_t status);
 
 /**
  * This internal callback is used by CA layer to
@@ -308,6 +324,17 @@ CAResult_t CAinitiateSslHandshake(const CAEndpoint_t *endpoint);
 CAResult_t CAcloseSslConnection(const CAEndpoint_t *endpoint);
 
 /**
+ * Close the DTLS session and free endpoint.
+ *
+ * @param[in] endpoint  information of network address;
+ *            CAcloseSslConnectionWrapper takes ownership of endpoint
+ *
+ * @retval  ::CA_STATUS_OK    Successful.
+ * @retval  ::CA_STATUS_FAILED Operation failed.
+ */
+CAResult_t CAcloseSslConnectionFreeEndpoint(CAEndpoint_t *endpoint);
+
+/**
  * Close the TLS session using UUID
  *
  * @param[in] identity  UUID of target device
@@ -357,7 +384,15 @@ typedef void (*SslExportKeysCallback_t)(const unsigned char* masterSecret,
 CAResult_t CASetSslExportKeysCallback(SslExportKeysCallback_t exportKeysCb,
                                       CASslEkcbProtocol_t protocol, CASslEkcbRole_t role);
 
-void CAsetNoCertConfirmCallback(UserConfirmNoCertCallback noCertCallback);
+/**
+ * API to set certificate verification callback.
+ */
+void CAsetCertificateVerificationCallback(CertificateVerificationCallback_t noCertCallback);
+
+/**
+ * API to unset certificate verification callback.
+ */
+void CAunsetCertificateVerificationCallback();
 
 #endif //__WITH_TLS__ or __WITH_DTLS__