keepalive for coap over tcp
[platform/upstream/iotivity.git] / resource / csdk / connectivity / inc / catcpinterface.h
index 4040067..38efb00 100644 (file)
@@ -63,6 +63,16 @@ typedef void (*CATCPErrorHandleCallback)(const CAEndpoint_t *endpoint, const voi
                                          uint32_t dataLength, CAResult_t result);
 
 /**
+  * Callback to notify connection information in the TCP adapter.
+  *
+  * @param[in]  addr    connected device address.
+  * @param[in]  port    connected port info.
+  * @param[in]  isConnected    Whether keepalive message needs to be sent.
+  * @see  Callback must be registered using CATCPSetKeepAliveCallback().
+ */
+typedef void (*CATCPKeepAliveHandleCallback)(const char *addr, uint16_t port, bool isConnected);
+
+/**
  * set error callback to notify error in TCP adapter.
  *
  * @param[in]  errorHandleCallback Callback function to notify the error
@@ -71,6 +81,14 @@ typedef void (*CATCPErrorHandleCallback)(const CAEndpoint_t *endpoint, const voi
 void CATCPSetErrorHandler(CATCPErrorHandleCallback errorHandleCallback);
 
 /**
+ * set keepalive callback to notify connection information in TCP adapter.
+ *
+ * @param[in]  keepaliveHandler Callback function to notify the connection information.
+ * in the TCP adapter.
+ */
+void CATCPSetKeepAliveCallback(CATCPKeepAliveHandleCallback keepaliveHandler);
+
+/**
  * Start TCP server.
  *
  * @param   threadPool   Thread pool for managing Unicast server threads.