/**
* 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.
+ * @param[in] endpoint network endpoint description.
+ * @param[in] isConnected Whether keepalive message needs to be sent.
* @see Callback must be registered using CATCPSetKeepAliveCallback().
*/
-typedef void (*CATCPConnectionHandleCallback)(const char *addr, uint16_t port, bool isConnected);
+typedef void (*CATCPConnectionHandleCallback)(const CAEndpoint_t *endpoint, bool isConnected);
/**
* set error callback to notify error in TCP adapter.
}
}
-static void CATCPConnectionHandler(const char *addr, uint16_t port, bool isConnected)
+static void CATCPConnectionHandler(const CAEndpoint_t *endpoint, bool isConnected)
{
- CAEndpoint_t endpoint = { .adapter = CA_ADAPTER_TCP,
- .port = port };
- OICStrcpy(endpoint.addr, sizeof(endpoint.addr), addr);
-
// Pass the changed connection status to RI Layer for keepalive.
if (g_connKeepAliveCallback)
{
- g_connKeepAliveCallback(&endpoint, isConnected);
+ g_connKeepAliveCallback(endpoint, isConnected);
}
// Pass the changed connection status to CAUtil.
if (g_connectionChangeCallback)
{
- g_connectionChangeCallback(&endpoint, isConnected);
+ g_connectionChangeCallback(endpoint, isConnected);
}
}
return NULL;
}
memcpy(svritem->sep.endpoint.addr, endpoint->addr, sizeof(svritem->sep.endpoint.addr));
+ svritem->sep.endpoint.adapter = endpoint->adapter;
svritem->sep.endpoint.port = endpoint->port;
svritem->sep.endpoint.flags = endpoint->flags;
svritem->sep.endpoint.interface = endpoint->interface;
// pass the connection information to CA Common Layer.
if (g_connectionCallback)
{
- g_connectionCallback(svritem->sep.endpoint.addr, svritem->sep.endpoint.port, true);
+ g_connectionCallback(&(svritem->sep.endpoint), true);
}
return svritem;
// pass the connection information to CA Common Layer.
if (g_connectionCallback)
{
- g_connectionCallback(svritem->sep.endpoint.addr, svritem->sep.endpoint.port, false);
+ g_connectionCallback(&(svritem->sep.endpoint), false);
}
OICFree(svritem);