//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#include "iotivity_config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
+#ifdef HAVE_WINDOWS_H
+#include <windows.h>
+#endif
#include <stdint.h>
#include <sstream>
#include <iostream>
+#include <getopt.h>
#include "ocstack.h"
#include "logger.h"
#include "payload_logging.h"
#include "oic_malloc.h"
#include "oic_string.h"
+#include "common.h"
#define MAX_IP_ADDR_ST_SZ 16 //string size of "155.255.255.255" (15 + 1)
#define MAX_PORT_ST_SZ 6 //string size of "65535" (5 + 1)
cbData.context = (void*)DEFAULT_CONTEXT_VALUE;
cbData.cd = NULL;
- ret = OCDoResource(NULL, method, query.str().c_str(), dest,
- (method == OC_REST_PUT || method == OC_REST_POST) ? putPayload() : NULL,
- CT_DEFAULT, qos, &cbData, options, numOptions);
+ OCPayload* payload = (method == OC_REST_PUT || method == OC_REST_POST) ? putPayload() : NULL;
+
+ ret = OCDoRequest(NULL, method, query.str().c_str(), dest,
+ payload, CT_DEFAULT, qos, &cbData, options, numOptions);
+
+ OCPayloadDestroy(payload);
if (ret != OC_STACK_OK)
{
cbData.context = (void*)DEFAULT_CONTEXT_VALUE;
cbData.cd = NULL;
- ret = OCDoResource(NULL, OC_REST_DISCOVER, queryUri, 0, 0, CT_DEFAULT,
- OC_LOW_QOS, &cbData, NULL, 0);
+ ret = OCDoRequest(NULL, OC_REST_DISCOVER, queryUri, 0, 0, CT_DEFAULT,
+ OC_LOW_QOS, &cbData, NULL, 0);
if (ret != OC_STACK_OK)
{
OIC_LOG(ERROR, TAG, "OCStack resource error");