replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / resource / csdk / connectivity / inc / caadapternetdtls.h
index 1ef7fb6..cbe19db 100644 (file)
 
 #include "dtls.h"
 #include "uarraylist.h"
-#include "camutex.h"
+#include "octhread.h"
 #include "caadapterutils.h"
 #include "cainterface.h"
 #include "cacommon.h"
 
 /**
- * Currently DTLS supported adapters(2) WIFI and ETHENET for linux platform.
+ * Currently DTLS supported adapters(3) WIFI, ETHENET and BLE for linux platform.
  */
-#define MAX_SUPPORTED_ADAPTERS 2
+#define MAX_SUPPORTED_ADAPTERS 3
 
 typedef void (*CAPacketReceivedCallback)(const CASecureEndpoint_t *sep,
-                                         const void *data, uint32_t dataLength);
+                                         const void *data, size_t dataLength);
 
 typedef void (*CAPacketSendCallback)(CAEndpoint_t *endpoint,
-                                         const void *data, uint32_t dataLength);
+                                     const void *data, size_t dataLength);
 
 /**
  * Data structure for holding the send and recv callbacks.
@@ -89,6 +89,9 @@ typedef enum
 typedef struct
 {
     socklen_t size;                 /**< Size of address. */
+#ifdef _MSC_VER
+    __declspec(align(8))
+#endif
     union
     {
         struct sockaddr     sa;
@@ -123,10 +126,10 @@ void CADTLSSetAdapterCallbacks(CAPacketReceivedCallback recvCallback,
                                CATransportAdapter_t type);
 
 /**
- * Register callback to get DTLS PSK credentials.
- * @param[in]  credCallback    callback to get DTLS PSK credentials.
+ * Register callback to deliver the result of DTLS handshake
+ * @param[in] dtlsHandshakeCallback Callback to receive the result of DTLS handshake.
  */
-void CADTLSSetCredentialsCallback(CAGetDTLSPskCredentialsHandler credCallback);
+void CADTLSSetHandshakeCallback(CAErrorCallback dtlsHandshakeCallback);
 
 /**
  * Select the cipher suite for dtls handshake
@@ -247,6 +250,18 @@ CAResult_t CAAdapterNetDtlsDecrypt(const CASecureEndpoint_t *sep,
                                    uint8_t *data,
                                    uint32_t dataLen);
 
+
+/**
+ * API to get a secure connected peer information
+ * NOTE : This API use the mutex lock to access 'g_caDtlsContext',
+ *        Please do not invoke this API for internal function of dtls adapter
+ *
+ * @param[in] peer peer information includs IP address and port.
+ *
+ * @ return  secure connected peer information on success, otherwise NULL
+ */
+CASecureEndpoint_t *CAGetSecurePeerInfo(const CAEndpoint_t *peer);
+
 #endif /* CA_ADAPTER_NET_DTLS_H_ */