#include "catcpadapterutils_eth.h"
#include "catcpinterface.h"
-#include "pdu.h"
+#include <coap/pdu.h>
#include "caadapterutils.h"
-#include "camutex.h"
+#include "octhread.h"
#include "oic_malloc.h"
#include "oic_string.h"
OIC_LOG(DEBUG, TAG, "OUT");
}
+void CATCPSetConnectionChangedCallback(CATCPConnectionHandleCallback connHandler)
+{
+ return;
+}
+
void CATCPSetErrorHandler(CATCPErrorHandleCallback errorHandleCallback)
{
return;
if (!isHeaderChecked && totalReceivedLen)
{
- coap_transport_type transport;
+ coap_transport_t transport;
size_t headerLen;
CAGetTCPHeaderDetails(recvBuffer, &transport, &headerLen);
if (totalReceivedLen >= headerLen)
if (totalLen == totalReceivedLen)
{
CASecureEndpoint_t ep =
- {.endpoint = {.adapter = CA_ADAPTER_TCP, .port = tcpClientPort}};
+ {.endpoint = {.adapter = CA_ADAPTER_TCP,
+ .flags = CA_DEFAULT_FLAGS,
+ .port = tcpClientPort}};
IPAddress clientIP = tcpClientIP;
int ret = snprintf(ep.endpoint.addr, sizeof(ep.endpoint.addr), "%d.%d.%d.%d",
return CA_NOT_SUPPORTED;
}
-static void sendData(const CAEndpoint_t *endpoint,
- const void *data, size_t dlen)
+static ssize_t sendData(const CAEndpoint_t *endpoint,
+ const void *data, size_t dlen)
{
uint16_t port = endpoint->port;
uint8_t ipAddr[4] = { 0 };
&parsedPort) != CA_STATUS_OK)
{
OIC_LOG(ERROR, TAG, "parse fail");
- return;
+ return -1;
}
if (dlen > 65535) // Max value for uint16_t
{
// This will never happen as max buffer size we are dealing with is COAP_MAX_PDU_SIZE
OIC_LOG(ERROR, TAG, "Size exceeded");
- return;
+ return -1;
}
uint32_t ret = send(g_unicastSocket, (const uint8_t *)data, (uint16_t)dlen);
}
OIC_LOG(DEBUG, TAG, "OUT");
+ return ret;
}
-void CATCPSendData(CAEndpoint_t *endpoint, const void *data, uint32_t datalen,
- bool isMulticast)
+ssize_t CATCPSendData(CAEndpoint_t *endpoint, const void *data, size_t datalen)
{
VERIFY_NON_NULL_VOID(endpoint, TAG, "endpoint is NULL");
VERIFY_NON_NULL_VOID(data, TAG, "data is NULL");
- if (!isMulticast)
+ if (caglobals.tcp.ipv4tcpenabled && (endpoint->adapter & CA_ADAPTER_TCP))
{
- if (caglobals.tcp.ipv4tcpenabled && (endpoint->adapter & CA_ADAPTER_TCP))
- {
- sendData(endpoint, data, datalen);
- }
+ return sendData(endpoint, data, datalen);
}
-}
\ No newline at end of file
+ return -1;
+}