env.AppendUnique(CCFLAGS = ['-Wextra', '-fPIC'])
env.AppendUnique(LIBS = ['dl', 'pthread'])
-env.AppendUnique(CCFLAGS = ['-D__TIZEN__', '-D_GNU_SOURCE', '-DTIZEN_DEBUG_ENABLE'])
+env.AppendUnique(CCFLAGS = ['-D__TIZEN__', '-D_GNU_SOURCE', '-DTIZEN_DEBUG_ENABLE','-fstack-protector-strong','-Wl,-z,relro','-D_FORTIFY_SOURCE=2'])
env.ParseConfig("pkg-config dlog --cflags --libs")
if env.get('OIC_SUPPORT_TIZEN_TRACE') == 'True':
env.ParseConfig("pkg-config ttrace --cflags --libs")
+http://suprem.sec.samsung.net/jira/browse/CONPRO-1163
+
+commit_info_2017-12-14.txt
+
+commit_id: c9b22a75b21235bbf7174a40f2f658b9becd1117
+----------------------------------------------------------------------------------------------------------------------------------
http://suprem.sec.samsung.net/jira/browse/CONPRO-1155
commit_info_2017-12-06.txt
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,
"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;
}
CALEADAPTER_TAG,
"CALEClientSendNegotiationMessage has failed, result [%d]",
res);
- if (g_errorHandler)
+ if (g_errorHandler)
{
g_errorHandler(bleData->remoteEndpoint,
bleData->data,
CALEADAPTER_TAG,
"Update characteristics failed, result [%d]",
result);
- if (g_errorHandler)
+ if (g_errorHandler)
{
g_errorHandler(bleData->remoteEndpoint, bleData->data, bleData->dataLen, result);
}
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__);
- 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);
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);
+ CAResult_t res = CA_STATUS_OK;
if (g_networkPacketReceivedCallback)
{
OIC_LOG_V(DEBUG, CALEADAPTER_TAG,
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
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!");
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 (context_event_loop)
{
- OIC_LOG_V(DEBUG, TAG, "g_eventLoop context %x", context_event_loop);
+ OIC_LOG_V(DEBUG, TAG, "g_eventLoop context %p", (void *)context_event_loop);
g_main_context_wakeup(context_event_loop);
// Kill g main loops and kill threads.
if (BT_ERROR_NONE != ret)
{
- OIC_LOG_V(ERROR, TAG, "bt_gatt_disconnect Failed with ret value [%d] ",
+ OIC_LOG_V(ERROR, TAG, "bt_gatt_disconnect Failed with ret value [%s] ",
CALEGetErrorMsg(ret));
return CA_STATUS_FAILED;
}
#include "oic_string.h"
#include "oic_malloc.h"
#include "caleutil.h"
+#include "caadapterutils.h"
/**
* Logging tag for module name
if (context_event_loop)
{
- OIC_LOG_V(DEBUG, TAG, "g_eventLoop context %x", context_event_loop);
+ OIC_LOG_V(DEBUG, TAG, "g_eventLoop context %p", (void *)context_event_loop);
g_main_context_wakeup(context_event_loop);
// Kill g main loops and kill threads
VERIFY_NON_NULL(svcPath, TAG, "svcPath");
- OIC_LOG_V(DEBUG, TAG, "svcPath:%s", svcPath);
+ OIC_LOG_V(DEBUG, TAG, "svcPath: %s", (char *)svcPath);
int ret = bt_gatt_server_register_service(g_gattServer, svcPath);
if (0 != ret)
{
CAResult_t res = CAQueueingThreadClearContextData(&g_sendThread,
CAClearQueueEndpointDataContext,
- info);
+ (void *)info);
if (CA_STATUS_OK != res)
{
OIC_LOG(ERROR, TAG, "Could not clear the send queue");
}
size_t payloadLen = (pdu->data) ? (unsigned char *) pdu->hdr + pdu->length - pdu->data : 0;
- OIC_LOG_V(INFO, ANALYZER_TAG, "CoAP Message Full Size = [%lu]", pdu->length);
+ OIC_LOG_V(INFO, ANALYZER_TAG, "CoAP Message Full Size = [%u]", pdu->length);
OIC_LOG(INFO, ANALYZER_TAG, "CoAP Header (+ 0xFF)");
OIC_LOG_BUFFER(INFO, ANALYZER_TAG, (const uint8_t *) pdu->transport_hdr,
pdu->length - payloadLen);
- OIC_LOG_V(INFO, ANALYZER_TAG, "CoAP Header size = [%lu]", pdu->length - payloadLen);
+ OIC_LOG_V(INFO, ANALYZER_TAG, "CoAP Header size = [%" PRIuPTR "]", (size_t) pdu->length - payloadLen);
OIC_LOG_V(INFO, ANALYZER_TAG, "CoAP Payload");
OIC_LOG_BUFFER(INFO_PRIVATE, ANALYZER_TAG, pdu->data, payloadLen);
- OIC_LOG_V(INFO, ANALYZER_TAG, "CoAP Payload Size = [%lu]", payloadLen);
+ OIC_LOG_V(INFO, ANALYZER_TAG, "CoAP Payload Size = [%" PRIuPTR "]", payloadLen);
OIC_LOG(INFO, ANALYZER_TAG, "=================================================");
// samsung log
if (NULL != data->remoteEndpoint)
{
int i = 0;
- while (NULL != data->remoteEndpoint->addr[i])
+ while (data->remoteEndpoint->addr[i])
{
g_headerBuffer[g_headerIndex++] = data->remoteEndpoint->addr[i];
i++;
if (info->resourceUri)
{
size_t i = 0;
- while (NULL != info->resourceUri[i])
+ while (info->resourceUri[i])
{
g_headerBuffer[g_headerIndex++] = info->resourceUri[i];
i++;
#include "caadapterutils.h"
#ifdef __WITH_DTLS__
#include "ca_adapter_net_ssl.h"
+#ifdef WITH_TCP
+#include "catcpinterface.h"
#endif
+#endif
+
#include "octhread.h"
#include "uarraylist.h"
#include "caremotehandler.h"
}
#ifdef __WITH_DTLS__
+#ifdef WITH_TCP
+ CATCPCloseInProgressConnections();
+#endif
OIC_LOG(DEBUG, TAG, "close all ssl session");
CAcloseSslConnectionAll(CA_ADAPTER_IP);
#endif
CAResult_t CATCPDisconnectSession(const CAEndpoint_t *endpoint)
{
- CAResult_t res = CA_STATUS_OK;
+ CAResult_t res = CAQueueingThreadClearContextData(g_sendQueueHandle,
+ CAClearQueueEndpointDataContext,
+ endpoint);
+ if (CA_STATUS_OK != res)
+ {
+ OIC_LOG(ERROR, TAG, "failed to clear context data");
+ }
+
#ifdef __WITH_TLS__
res = CAcloseSslConnection(endpoint);
if (CA_STATUS_OK != res)
{
OIC_LOG(ERROR, TAG, "failed to close TLS session");
- res = CAQueueingThreadClearContextData(g_sendQueueHandle,
- CAClearQueueEndpointDataContext,
- endpoint);
- if (CA_STATUS_OK != res)
- {
- OIC_LOG(ERROR, TAG, "failed to clear context data");
- }
-
return res;
}
#endif
OIC_LOG(ERROR, TAG, "failed to close TCP session");
}
- res = CAQueueingThreadClearContextData(g_sendQueueHandle,
- CAClearQueueEndpointDataContext,
- endpoint);
- if (CA_STATUS_OK != res)
- {
- OIC_LOG(ERROR, TAG, "failed to clear context data");
- }
-
return res;
}
{
if (CA_STATUS_OK != CATCPDisconnectSession(&svritem->sep.endpoint))
{
+ CASearchAndDeleteTCPSession(&svritem->sep.endpoint);
OIC_LOG(ERROR, TAG, "Failed to disconnect TCP session");
}
- CASearchAndDeleteTCPSession(&svritem->sep.endpoint);
return;
}
}
#define TAG "OIC_CA_MANAGER_TZ_LE"
-static CAAdapterStateChangedCB g_adapterStateCB = NULL;
-static CAConnectionStateChangedCB g_connStateCB = NULL;
-
-static void CAManagerAdapterMonitorHandler(const CAEndpoint_t *info, CANetworkStatus_t status);
-static void CAManagerConnectionMonitorHandler(CATransportAdapter_t adapter,
- const char *remoteAddress, bool connected);
-
void CASetLENetworkMonitorCallbacks(CAAdapterStateChangedCB adapterStateCB,
CAConnectionStateChangedCB connStateCB)
{
static const uint16_t S_LINE_BUFFER_SIZE = (50 * 2) + 50 + 1; // Show 50 bytes, 2 chars/byte, spaces between bytes, null termination
#endif //defined(_MSC_VER)
-#ifdef __ANDROID__
+#if defined(__ANDROID__) || defined(__TIZEN__)
#elif defined __linux__ || defined __APPLE__ || defined _WIN32 || defined(__TIZENRT__)
static oc_log_level LEVEL_XTABLE[] = {OC_LOG_DEBUG, OC_LOG_INFO,
OC_LOG_WARNING, OC_LOG_ERROR, OC_LOG_FATAL};
OIC_LOG_V(level, PL_TAG, "\t\t%s: NULL", val->name);
break;
case OCREP_PROP_INT:
- OIC_LOG_V(level, PL_TAG, "\t\t%s(int):%zd", val->name, val->i);
+ OIC_LOG_V(level, PL_TAG, "\t\t%s(int):%" PRId64, val->name, val->i);
break;
case OCREP_PROP_DOUBLE:
OIC_LOG_V(level, PL_TAG, "\t\t%s(double):%f", val->name, val->d);
OIC_LOG(level, PL_TAG, "\t\t Values:");
for (size_t i = 0; i < val->arr.dimensions[0]; i++)
{
- OIC_LOG_V(level, PL_TAG, "\t\t\t %zd", val->arr.iArray[i]);
+ OIC_LOG_V(level, PL_TAG, "\t\t\t %" PRId64, val->arr.iArray[i]);
}
break;
case OCREP_PROP_DOUBLE:
*/
static void OCDefaultConnectionStateChangedHandler(const CAEndpoint_t *info, bool isConnected);
-/**
- * Register network monitoring callback.
- * Network status changes are delivered these callback.
- * @param adapterHandler Adapter state monitoring callback.
- * @param connectionHandler Connection state monitoring callback.
- */
-static void OCSetNetworkMonitorHandler(CAAdapterStateChangedCB adapterHandler,
- CAConnectionStateChangedCB connectionHandler);
-
//-----------------------------------------------------------------------------
// Internal functions
//-----------------------------------------------------------------------------
}
else
{
+ OICFree((void *)response.resourceUri);
response.resourceUri = OICStrdup(cbNode->requestUri);
}
}
}
}
-void OCSetNetworkMonitorHandler(CAAdapterStateChangedCB adapterHandler,
- CAConnectionStateChangedCB connectionHandler)
-{
- OIC_LOG(DEBUG, TAG, "OCSetNetworkMonitorHandler");
- g_adapterHandler = adapterHandler;
- g_connectionHandler = connectionHandler;
-}
-
OCStackResult OCGetDeviceId(OCUUIdentity *deviceId)
{
OicUuid_t oicUuid;
notification_env.AppendUnique(CPPDEFINES = ['__TIZEN__'])
# notification_env.ParseConfig('pkg-config --cflags --libs sqlite3')
-if target_os == 'ios':
- if 'CLIENT' in notification_env.get('RD_MODE'):
- notification_env.AppendUnique(CPPDEFINES = ['RD_CLIENT'])
+if 'CLIENT' in notification_env.get('RD_MODE'):
+ notification_env.AppendUnique(CPPDEFINES = ['RD_CLIENT'])
if env.get('WITH_CLOUD') == True:
notification_env.AppendUnique(CPPDEFINES = ['WITH_CLOUD'])
NSResult NSPublishResourceToCloud(char *serverAddress)
{
-
NS_LOG(DEBUG, "NSPublishResourceToCloud - IN");
NS_LOG_V(INFO_PRIVATE, "Remote Server Address: %s", serverAddress);
#include "logger.h"
#include "OCPlatform.h"
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
#define LOG_TAG "RCSResourceObject"
namespace