*
* *****************************************************************/
+#include "iotivity_config.h"
#include <stdlib.h>
#include <string.h>
-#if HAVE_STRINGS_H
+#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#include "ocstack.h"
#include "oic_malloc.h"
#include "oic_string.h"
-#include "logger.h"
#include "payload_logging.h"
#include "ocpayload.h"
+#include "ocpayloadcbor.h"
#include "cainterface.h"
#include "ocserverrequest.h"
#include "resourcemanager.h"
#include "securevirtualresourcetypes.h"
#include "srmutility.h"
-#define TAG "SEC-VER"
+#define TAG "OIC_SEC_VER"
/** Default cbor payload size. This value is increased in case of CborErrorOutOfMemory.
* The value of payload size is increased until reaching belox max cbor size. */
if (CborNoError == cborEncoderResult)
{
- *size = encoder.ptr - outPayload;
+ *size = cbor_encoder_get_buffer_size(&encoder, outPayload);
*payload = outPayload;
ret = OC_STACK_OK;
}
OIC_LOG(DEBUG, TAG, "Memory getting reallocated.");
// reallocate and try again!
OICFree(outPayload);
+ outPayload = NULL;
// Since the allocated initial memory failed, double the memory.
- cborLen += encoder.ptr - encoder.end;
+ cborLen += cbor_encoder_get_buffer_size(&encoder, encoder.end);
OIC_LOG_V(DEBUG, TAG, "Ver reallocation size : %zd.", cborLen);
cborEncoderResult = CborNoError;
ret = VerToCBORPayload(ver, payload, &cborLen);
{
OCStackResult ret = OC_STACK_ERROR;
- OICStrcpy(gVer.secv, MAX_VERSION_LEN, SECURITY_VERSION);
+ OICStrcpy(gVer.secv, OIC_SEC_MAX_VER_LEN, SECURITY_VERSION);
//Read device id from doxm
OicUuid_t deviceID = {.id={0}};