#include "oic_malloc.h"
#include "oic_string.h"
#include "logger.h"
-#include "pdu.h"
+#include <coap/pdu.h>
#include "ocpayload.h"
#include "uarraylist.h"
#include "CoapHttpParser.h"
#include "CoapHttpMap.h"
+#if defined (__TIZENRT__)
+#include <apps/netutils/cJSON.h>
+#else
#include "cJSON.h"
+#endif
#define TAG "CHPHandler"
return g_isCHProxyInitialized;
}
-OCStackResult CHPInitialize()
+OCStackResult CHPInitialize(bool secure)
{
- OIC_LOG(DEBUG, TAG, "CHPInitialize IN");
+ OIC_LOG_V(DEBUG, TAG, "%s IN", __func__);
if (g_isCHProxyInitialized)
{
OIC_LOG(DEBUG, TAG, "CH Proxy already initialized");
return result;
}
+ uint8_t prop = OC_ACTIVE | OC_DISCOVERABLE | OC_SLOW;
+ if(secure)
+ {
+ prop |= OC_SECURE;
+ }
result = OCCreateResource(&g_proxyHandle,
CHP_RESOURCE_TYPE_NAME,
CHP_RESOURCE_INTF_NAME,
OC_RSRVD_PROXY_URI,
CHPEntityHandler,
NULL,
- OC_ACTIVE | OC_DISCOVERABLE | OC_SLOW);
+ prop);
if (OC_STACK_OK != result)
{
}
g_isCHProxyInitialized = true;
- OIC_LOG(DEBUG, TAG, "CHPInitialize OUT");
+ OIC_LOG_V(DEBUG, TAG, "%s OUT", __func__);
return OC_STACK_OK;
}
OCStackResult CHPTerminate()
{
- OIC_LOG(DEBUG, TAG, "CHPTerminate IN");
+ OIC_LOG_V(DEBUG, TAG, "%s IN", __func__);
OCStackResult result = CHPParserTerminate();
if (OC_STACK_OK != result)
{
g_proxyHandle = NULL;
g_isCHProxyInitialized = false;
return result;
- OIC_LOG(DEBUG, TAG, "CHPTerminate OUT");
+ OIC_LOG_V(DEBUG, TAG, "%s OUT", __func__);
}
static void CHPGetProxyURI(OCHeaderOption* options, uint8_t *numOptions, char* uri,
size_t uriLength)
{
- OIC_LOG(DEBUG, TAG, "CHPGetProxyURI IN");
+ OIC_LOG_V(DEBUG, TAG, "%s IN", __func__);
if (!uri || uriLength <= 0)
{
OIC_LOG (INFO, TAG, "Invalid uri buffer");
}
}
- OIC_LOG(DEBUG, TAG, "CHPGetProxyURI OUT");
+ OIC_LOG_V(DEBUG, TAG, "%s OUT", __func__);
return;
}
OCEntityHandlerRequest* entityHandlerRequest,
void* callbackParam)
{
- OIC_LOG_V(INFO, TAG, "Proxy request received");
+ OIC_LOG(INFO, TAG, "Proxy request received");
UNUSED(callbackParam);
if (!g_isCHProxyInitialized)
void CHPHandleHttpResponse(const HttpResponse_t *httpResponse, void *context)
{
- OIC_LOG(DEBUG, TAG, "CHPHandleHttpResponse IN");
+ OIC_LOG_V(DEBUG, TAG, "%s IN", __func__);
if (!httpResponse || !context)
{
OIC_LOG(ERROR, TAG, "Invalid arguements");
}
//OICFree(coapResponseInfo.info.payload);
- OIC_LOG(DEBUG, TAG, "CHPHandleHttpResponse OUT");
+ OIC_LOG_V(DEBUG, TAG, "%s OUT", __func__);
}
OCStackResult CHPHandleOCFRequest(const OCEntityHandlerRequest* requestInfo,