#include <string.h>
#include "oic_malloc.h"
#include "ocpayload.h"
+#include "ocpayloadcbor.h"
#include "payload_logging.h"
#include "psinterface.h"
#include "resourcemanager.h"
#include "srmutility.h"
#include "amaclresource.h"
-#define TAG "SRM-AMACL"
+#define TAG "OIC_SRM_AMACL"
/** 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. */
}
}
-static size_t OicSecAmaclCount(const OicSecAmacl_t *secAmacl)
-{
- size_t size = 0;
- for (const OicSecAmacl_t *amacl = secAmacl; amacl; amacl = amacl->next)
- {
- size++;
- }
- return size;
-}
-
OCStackResult AmaclToCBORPayload(const OicSecAmacl_t *amaclS, uint8_t **cborPayload,
size_t *cborSize)
{
if (CborNoError == cborEncoderResult)
{
*cborPayload = outPayload;
- *cborSize = encoder.ptr - outPayload;
+ *cborSize = cbor_encoder_get_buffer_size(&encoder, outPayload);
ret = OC_STACK_OK;
}
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);
cborEncoderResult = CborNoError;
ret = AmaclToCBORPayload(amaclS, cborPayload, &cborLen);
if (OC_STACK_OK == ret)
{
OCStackResult ret = OCCreateResource(&gAmaclHandle,
OIC_RSRC_TYPE_SEC_AMACL,
- OIC_MI_DEF,
+ OC_RSRVD_INTERFACE_DEFAULT,
OIC_RSRC_AMACL_URI,
AmaclEntityHandler,
NULL,