replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / resource / csdk / connectivity / inc / caadapterinterface.h
index a750291..f9999a8 100644 (file)
@@ -59,6 +59,17 @@ typedef CAResult_t (*CAAdapterStart)();
 typedef CAResult_t (*CAAdapterStartListeningServer)();
 
 /**
+ * Stopping listening server to not receive multicast search requests
+ * Transport Specific Behavior:
+ * WIFI/ETH Stops multicast server on  all available IPs. This is required for the
+ * thin device that call this function once all local resources are pushed to the
+ * resource directory.
+ * @return ::CA_STATUS_OK or ::CA_STATUS_FAILED
+ * ERROR CODES (::CAResult_t error codes in cacommon.h).
+ */
+typedef CAResult_t (*CAAdapterStopListeningServer)();
+
+/**
  * for starting discovery servers for receiving multicast advertisements
  * Transport Specific Behavior:
  * WIFI/ETH Starts multicast server on all available IPs and defined port
@@ -77,10 +88,12 @@ typedef CAResult_t (*CAAdapterStartDiscoveryServer)();
  * reference uri and connectivity type) to which the unicast data has to be sent.
  * @param[in]   data            Data which required to be sent.
  * @param[in]   dataLen         Size of data to be sent.
+ * @param[in]   dataType        Data type which is REQUEST or RESPONSE.
  * @return The number of bytes sent on the network. Return value equal to -1 indicates error.
  */
 typedef int32_t (*CAAdapterSendUnicastData)(const CAEndpoint_t *endpoint,
-                                            const void *data, uint32_t dataLen);
+                                            const void *data, uint32_t dataLen,
+                                            CADataType_t dataType);
 
 /**
  * Sends Multicast data to the endpoint using the adapter connectivity.
@@ -88,22 +101,24 @@ typedef int32_t (*CAAdapterSendUnicastData)(const CAEndpoint_t *endpoint,
  * @param[in]   endpoint        Remote Endpoint information (like ipaddress , port,
  * @param[in]   data            Data which required to be sent.
  * @param[in]   dataLen         Size of data to be sent.
+ * @param[in]   dataType        Data type which is REQUEST or RESPONSE.
  * @return The number of bytes sent on the network. Return value equal to -1 indicates error.
  */
 typedef int32_t (*CAAdapterSendMulticastData)(const CAEndpoint_t *endpoint,
-        const void *data, uint32_t dataLen);
+                                              const void *data, uint32_t dataLen,
+                                              CADataType_t dataType);
 
 /**
  * Get Network Information.
  * @param[out]   info           Local connectivity information structures
  * @param[out]   size           Number of local connectivity structures.
- * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h)
+ * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
  */
 typedef CAResult_t (*CAAdapterGetNetworkInfo)(CAEndpoint_t **info, uint32_t *size);
 
 /**
  * Read Synchronous API callback.
- * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h)
+ * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
  */
 typedef CAResult_t (*CAAdapterReadData)();
 
@@ -134,6 +149,9 @@ typedef struct
     /** Listening Server function address. */
     CAAdapterStartListeningServer startListenServer;
 
+    /** Stops receiving the multicast traffic. */
+    CAAdapterStopListeningServer stopListenServer;
+
     /** Discovery Server function address. **/
     CAAdapterStartDiscoveryServer startDiscoveryServer;
 
@@ -155,33 +173,39 @@ typedef struct
     /** Terminate function address stored in this pointer. **/
     CAAdapterTerminate terminate;
 
+    /** Type of transport adapter. **/
+    CATransportAdapter_t cType;
 } CAConnectivityHandler_t;
 
 /**
  * This will be used during the registration of adapters call backs to the common logic.
- * @see ::CAConnectivityHandler_t , ::CATransportAdapter_t
+ * @see ::CAConnectivityHandler_t
  */
-typedef void (*CARegisterConnectivityCallback)(CAConnectivityHandler_t handler,
-        CATransportAdapter_t cType);
+typedef void (*CARegisterConnectivityCallback)(CAConnectivityHandler_t handler);
 
 /**
  * This will be used during the receive of network requests and response.
+ * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
  * @see SendUnicastData(), SendMulticastData()
  */
-typedef void (*CANetworkPacketReceivedCallback)(const CASecureEndpoint_t *sep,
-                                            const void *data, uint32_t dataLen);
+typedef CAResult_t (*CANetworkPacketReceivedCallback)(const CASecureEndpoint_t *sep,
+                                                      const void *data, size_t dataLen);
 
 /**
  * This will be used to notify network changes to the connectivity common logic layer.
- * @see SendUnicastData(), SendMulticastData()
  */
-typedef void (*CANetworkChangeCallback)(const CAEndpoint_t *info, CANetworkStatus_t status);
+typedef void (*CAAdapterChangeCallback)(CATransportAdapter_t adapter, CANetworkStatus_t status);
+
+/**
+ * This will be used to notify connection changes to the connectivity common logic layer.
+ */
+typedef void (*CAConnectionChangeCallback)(const CAEndpoint_t *info, bool isConnected);
 
 /**
  * This will be used to notify error result to the connectivity common logic layer.
  */
 typedef void (*CAErrorHandleCallback)(const CAEndpoint_t *endpoint,
-                                      const void *data, uint32_t dataLen,
+                                      const void *data, size_t dataLen,
                                       CAResult_t result);
 
 #ifdef __cplusplus
@@ -190,3 +214,4 @@ typedef void (*CAErrorHandleCallback)(const CAEndpoint_t *endpoint,
 
 #endif  /* CA_ADAPTER_INTERFACE_H_ */
 
+