projects
/
platform
/
upstream
/
iotivity.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update snapshot(2017-12-14)
[platform/upstream/iotivity.git]
/
resource
/
csdk
/
connectivity
/
src
/
bt_le_adapter
/
caleadapter.c
diff --git
a/resource/csdk/connectivity/src/bt_le_adapter/caleadapter.c
b/resource/csdk/connectivity/src/bt_le_adapter/caleadapter.c
index
6c9d09e
..
5f4904c
100755
(executable)
--- a/
resource/csdk/connectivity/src/bt_le_adapter/caleadapter.c
+++ b/
resource/csdk/connectivity/src/bt_le_adapter/caleadapter.c
@@
-170,7
+170,7
@@
static CANetworkPacketReceivedCallback g_networkPacketReceivedCallback = NULL;
static CAErrorHandleCallback g_errorHandler = NULL;
#ifdef __WITH_DTLS__
static CAErrorHandleCallback g_errorHandler = NULL;
#ifdef __WITH_DTLS__
-static
void
CALESecureReceiveDataCB(const CASecureEndpoint_t *endpoint,
+static
CAResult_t
CALESecureReceiveDataCB(const CASecureEndpoint_t *endpoint,
const void *data, size_t dataLength);
static ssize_t CALESecureSendDataCB(CAEndpoint_t *endpoint,
const void *data, size_t dataLength);
static ssize_t CALESecureSendDataCB(CAEndpoint_t *endpoint,
@@
-1245,8
+1245,8
@@
static void CALEServerSendDataThread(void *threadData)
"CAGenerateVariableForFragmentation failed, result [%d]", result);
if (g_errorHandler)
{
"CAGenerateVariableForFragmentation failed, result [%d]", result);
if (g_errorHandler)
{
- g_errorHandler(bleData->remoteEndpoint, bleData->data, bleData->dataLen, result);
- }
+ g_errorHandler(bleData->remoteEndpoint, bleData->data, bleData->dataLen, result);
+ }
return;
}
return;
}
@@
-1519,7
+1519,7
@@
static void CALEClientSendDataThread(void *threadData)
CALEADAPTER_TAG,
"CALEClientSendNegotiationMessage has failed, result [%d]",
res);
CALEADAPTER_TAG,
"CALEClientSendNegotiationMessage has failed, result [%d]",
res);
- if (g_errorHandler)
+ if (g_errorHandler)
{
g_errorHandler(bleData->remoteEndpoint,
bleData->data,
{
g_errorHandler(bleData->remoteEndpoint,
bleData->data,
@@
-1725,7
+1725,7
@@
static void CALEClientSendDataThread(void *threadData)
CALEADAPTER_TAG,
"Update characteristics failed, result [%d]",
result);
CALEADAPTER_TAG,
"Update characteristics failed, result [%d]",
result);
- if (g_errorHandler)
+ if (g_errorHandler)
{
g_errorHandler(bleData->remoteEndpoint, bleData->data, bleData->dataLen, result);
}
{
g_errorHandler(bleData->remoteEndpoint, bleData->data, bleData->dataLen, result);
}
@@
-2653,13
+2653,13
@@
static ssize_t CALESecureSendDataCB(CAEndpoint_t *endpoint, const void *data, si
return ret;
}
return ret;
}
-
void
CALESecureReceiveDataCB(const CASecureEndpoint_t *sep, const void *data,
+
CAResult_t
CALESecureReceiveDataCB(const CASecureEndpoint_t *sep, const void *data,
size_t dataLen)
{
OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "%s", __func__);
size_t dataLen)
{
OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "%s", __func__);
- VERIFY_NON_NULL
_VOID
(sep, CALEADAPTER_TAG, "sep is NULL");
- VERIFY_NON_NULL
_VOID
(data, CALEADAPTER_TAG, "data is NULL");
+ VERIFY_NON_NULL(sep, CALEADAPTER_TAG, "sep is NULL");
+ VERIFY_NON_NULL(data, CALEADAPTER_TAG, "data is NULL");
OIC_LOG_V(DEBUG, CALEADAPTER_TAG,
"Secure Data Receive - decrypted datalen = %d", dataLen);
OIC_LOG_V(DEBUG, CALEADAPTER_TAG,
"Secure Data Receive - decrypted datalen = %d", dataLen);
@@
-2667,11
+2667,12
@@
void CALESecureReceiveDataCB(const CASecureEndpoint_t *sep, const void *data,
if (dataLen <= 0)
{
OIC_LOG(ERROR, CALEADAPTER_TAG, "incorrect dataLen, derecypt fail !");
if (dataLen <= 0)
{
OIC_LOG(ERROR, CALEADAPTER_TAG, "incorrect dataLen, derecypt fail !");
- return;
+ return
CA_STATUS_INVALID_PARAM
;
}
OIC_LOG_BUFFER(DEBUG, CALEADAPTER_TAG, data, dataLen);
}
OIC_LOG_BUFFER(DEBUG, CALEADAPTER_TAG, data, dataLen);
+ CAResult_t res = CA_STATUS_OK;
if (g_networkPacketReceivedCallback)
{
OIC_LOG_V(DEBUG, CALEADAPTER_TAG,
if (g_networkPacketReceivedCallback)
{
OIC_LOG_V(DEBUG, CALEADAPTER_TAG,
@@
-2679,8
+2680,13
@@
void CALESecureReceiveDataCB(const CASecureEndpoint_t *sep, const void *data,
sep->endpoint.flags, sep->endpoint.flags);
OIC_LOG(DEBUG, CALEADAPTER_TAG,
"[CALESecureReceiveDataCB] Received data up !");
sep->endpoint.flags, sep->endpoint.flags);
OIC_LOG(DEBUG, CALEADAPTER_TAG,
"[CALESecureReceiveDataCB] Received data up !");
- g_networkPacketReceivedCallback(sep, data, dataLen);
+ res = g_networkPacketReceivedCallback(sep, data, dataLen);
+ if (CA_STATUS_OK != res)
+ {
+ OIC_LOG_V(ERROR, CALEADAPTER_TAG, "Error parsing CoAP data, res = %d", res);
+ }
}
}
+ return res;
}
#endif
}
#endif
@@
-3002,7
+3008,7
@@
static int32_t CASendLEUnicastData(const CAEndpoint_t *endpoint,
g_dataType = dataType;
oc_mutex_unlock(g_bleIsServerMutex);
g_dataType = dataType;
oc_mutex_unlock(g_bleIsServerMutex);
- result = CAencryptSsl(endpoint, data, dataLen);
+ result = CAencryptSsl(endpoint,
(void *)
data, dataLen);
if (CA_STATUS_OK != result)
{
OIC_LOG(ERROR, CALEADAPTER_TAG, "caadapternetdtlsencrypt failed!");
if (CA_STATUS_OK != result)
{
OIC_LOG(ERROR, CALEADAPTER_TAG, "caadapternetdtlsencrypt failed!");
@@
-3044,7
+3050,7
@@
static int32_t CASendLEUnicastData(const CAEndpoint_t *endpoint,
g_dataType = dataType;
oc_mutex_unlock(g_bleIsServerMutex);
g_dataType = dataType;
oc_mutex_unlock(g_bleIsServerMutex);
- result = CAencryptSsl(endpoint, data, dataLen);
+ result = CAencryptSsl(endpoint,
(void *)
data, dataLen);
if (CA_STATUS_OK != result)
{
OIC_LOG(ERROR, CALEADAPTER_TAG, "caadapternetdtlsencrypt failed!");
if (CA_STATUS_OK != result)
{
OIC_LOG(ERROR, CALEADAPTER_TAG, "caadapternetdtlsencrypt failed!");