OCStackResult ret = OC_STACK_ERROR;
CborError cborEncoderResult = CborNoError;
OicSecAcl_t *acl = (OicSecAcl_t *)secAcl;
- CborEncoder encoder = { {.ptr = NULL }, .end = 0 };
- CborEncoder aclMap = { {.ptr = NULL }, .end = 0 };
- CborEncoder aclListMap = { {.ptr = NULL }, .end = 0 };
- CborEncoder acesArray = { {.ptr = NULL }, .end = 0 };
+ CborEncoder encoder;
+ CborEncoder aclMap;
+ CborEncoder aclListMap;
+ CborEncoder acesArray;
uint8_t *outPayload = NULL;
size_t cborLen = *size;
*size = 0;
while (acl)
{
- CborEncoder oicSecAclMap = { {.ptr = NULL }, .end = 0, .added = 0, .flags = 0 };
+ CborEncoder oicSecAclMap;
// ACL Map size - Number of mandatory items
uint8_t aclMapSize = ACL_ACES_MAP_SIZE;
size_t inLen = 0;
// Resources
{
- CborEncoder resources = { {.ptr = NULL }, .end = 0, .added = 0, .flags = 0 };
+ CborEncoder resources;
cborEncoderResult = cbor_encode_text_string(&oicSecAclMap, OIC_JSON_RESOURCES_NAME,
strlen(OIC_JSON_RESOURCES_NAME));
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Resource Name Tag.");
for (size_t i = 0; i < acl->resourcesLen; i++)
{
- CborEncoder rMap = { {.ptr = NULL }, .end = 0 };
+ CborEncoder rMap;
cborEncoderResult = cbor_encoder_create_map(&resources, &rMap, ACL_RESOURCE_MAP_SIZE);
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding Resource Map.");
*cborSize = 0;
*cborPayload = NULL;
- CborEncoder encoder = { {.ptr = NULL }, .end = 0 };
- CborEncoder amaclMap = { {.ptr = NULL }, .end = 0 };
+ CborEncoder encoder;
+ CborEncoder amaclMap;
int64_t cborEncoderResult = CborNoError;
- CborEncoder rsrcMap = { {.ptr = NULL }, .end = 0 };
- CborEncoder rlistArray = { {.ptr = NULL }, .end = 0 };
- CborEncoder amss = { {.ptr = NULL }, .end = 0 };
+ CborEncoder rsrcMap;
+ CborEncoder rlistArray;
+ CborEncoder amss;
char *stRowner = NULL;
const OicSecAmacl_t *amacl = amaclS;
for (size_t i = 0; i < amacl->resourcesLen; i++)
{
// TODO : Need to create rMap structure based on RAML spec.
- CborEncoder rMap = { {.ptr = NULL }, .end = 0 };
+ CborEncoder rMap;
cborEncoderResult = cbor_encoder_create_map(&rlistArray, &rMap, AMACL_RLIST_MAP_SIZE);
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding RLIST Map.");
*cborSize = 0;
*cborPayload = NULL;
const OicSecCred_t *cred = credS;
- CborEncoder encoder = { {.ptr = NULL }, .end = 0 };
- CborEncoder credArray = { {.ptr = NULL }, .end = 0 };
- CborEncoder credRootMap = { {.ptr = NULL }, .end = 0 };
+ CborEncoder encoder;
+ CborEncoder credArray;
+ CborEncoder credRootMap;
if (0 == cborLen)
{
while (cred)
{
- CborEncoder credMap = { {.ptr = NULL }, .end = 0, .added = 0, .flags = 0 };
+ CborEncoder credMap;
size_t mapSize = CRED_MAP_SIZE;
char *subject = NULL;
if (cred->period)
//PublicData -- Not Mandatory
if (SIGNED_ASYMMETRIC_KEY == cred->credType && cred->publicData.data)
{
- CborEncoder publicMap = { {.ptr = NULL }, .end = 0, .added = 0, .flags = 0 };
+ CborEncoder publicMap;
const size_t publicMapSize = 2;
cborEncoderResult = cbor_encode_text_string(&credMap, OIC_JSON_PUBLICDATA_NAME,
//PrivateData -- Not Mandatory
if(cred->privateData.data)
{
- CborEncoder privateMap = { {.ptr = NULL }, .end = 0, .added = 0, .flags = 0 };
+ CborEncoder privateMap;
const size_t privateMapSize = 2;
cborEncoderResult = cbor_encode_text_string(&credMap, OIC_JSON_PRIVATEDATA_NAME,
OCStackResult ret = OC_STACK_ERROR;
- CborEncoder encoder = { {.ptr = NULL }, .end = 0 };
- CborEncoder crlMap = { {.ptr = NULL }, .end = 0 };
+ CborEncoder encoder;
+ CborEncoder crlMap;
CborError cborEncoderResult = CborNoError;
OCStackResult ret = OC_STACK_ERROR;
- CborEncoder encoder = { {.ptr = NULL }, .end = 0 };
- CborEncoder doxmMap = { {.ptr = NULL }, .end = 0 };
+ CborEncoder encoder;
+ CborEncoder doxmMap;
char* strUuid = NULL;
int64_t cborEncoderResult = CborNoError;
//OxmType -- Not Mandatory
if (doxm->oxmTypeLen > 0)
{
- CborEncoder oxmType = { {.ptr = NULL }, .end = 0, .added = 0, .flags = 0 };
+ CborEncoder oxmType;
cborEncoderResult = cbor_encode_text_string(&doxmMap, OIC_JSON_OXM_TYPE_NAME,
strlen(OIC_JSON_OXM_TYPE_NAME));
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding oxmType Tag.");
//Oxm -- Not Mandatory
if (doxm->oxmLen > 0)
{
- CborEncoder oxm = { {.ptr = NULL }, .end = 0, .added = 0, .flags = 0 };
+ CborEncoder oxm;
cborEncoderResult = cbor_encode_text_string(&doxmMap, OIC_JSON_OXMS_NAME,
strlen(OIC_JSON_OXMS_NAME));
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding oxmName Tag.");
OCStackResult ret = OC_STACK_ERROR;
- CborEncoder encoder = { {.ptr = NULL }, .end = 0 };
- CborEncoder dpairMap = { {.ptr = NULL }, .end = 0 };
+ CborEncoder encoder;
+ CborEncoder dpairMap;
int64_t cborEncoderResult = CborNoError;
uint8_t mapSize = DPAIR_MAP_SIZE;
*payload = NULL;
OCStackResult ret = OC_STACK_ERROR;
- CborEncoder encoder = { {.ptr = NULL}, .end = 0};
- CborEncoder pconfMap = { {.ptr = NULL}, .end = 0};
+ CborEncoder encoder;
+ CborEncoder pconfMap;
int64_t cborEncoderResult = CborNoError;
uint8_t mapSize = PCONF_MAP_SIZE;
//PRM type -- Not Mandatory
if(pconf->prmLen > 0)
{
- CborEncoder prm = { {.ptr = NULL }, .end = 0 };
+ CborEncoder prm;
cborEncoderResult = cbor_encode_text_string(&pconfMap, OIC_JSON_PRM_NAME,
strlen(OIC_JSON_PRM_NAME));
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Convert Pconf PRM NAME");
if (pconf->pdacls)
{
OicSecPdAcl_t *pdacl = pconf->pdacls;
- CborEncoder pdAclArray = {{.ptr = NULL }, .end = 0 };
+ CborEncoder pdAclArray;
cborEncoderResult = cbor_encode_text_string(&pconfMap, OIC_JSON_PDACL_NAME,
strlen(OIC_JSON_PDACL_NAME));
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed to create OIC_JSON_PDACL_NAME");
while(pdacl)
{
- CborEncoder pdAclMap = { {.ptr = NULL }, .end = 0, .added = 0, .flags = 0 };
+ CborEncoder pdAclMap;
// PDACL Map size - Number of mandatory items
uint8_t aclMapSize = 2;
strlen(OIC_JSON_RESOURCES_NAME));
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed to encode resource result");
- CborEncoder resources = { {.ptr = NULL }, .end = 0, .added = 0, .flags = 0 };
+ CborEncoder resources;
cborEncoderResult = cbor_encoder_create_array(&pdAclMap, &resources,
pdacl->resourcesLen);
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed to create resource array");
for (size_t i = 0; i < pdacl->resourcesLen; i++)
{
- CborEncoder rMap = { {.ptr = NULL }, .end = 0 };
+ CborEncoder rMap;
cborEncoderResult = cbor_encoder_create_map(&resources, &rMap,
PCONF_RESOURCE_MAP_SIZE);
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding Resource Map.");
// Period -- Not Mandatory
if (pdacl->periods)
{
- CborEncoder period = { {.ptr = NULL }, .end = 0, .added = 0, .flags = 0 };
+ CborEncoder period;
cborEncoderResult = cbor_encode_text_string(&pdAclMap, OIC_JSON_PERIODS_NAME,
strlen(OIC_JSON_PERIODS_NAME));
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed to encode period value");
// Period -- Not Mandatory
if(0 != pdacl->prdRecrLen && pdacl->recurrences)
{
- CborEncoder recurrences = { {.ptr = NULL }, .end = 0, .added = 0, .flags = 0 };
+ CborEncoder recurrences;
cborEncoderResult = cbor_encode_text_string(&pdAclMap, OIC_JSON_RECURRENCES_NAME,
strlen(OIC_JSON_RECURRENCES_NAME));
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult,"Failed to encode recurrences");
//There may not be paired devices if it did not pairing before
if (pconf->pddevs && 0 < pconf->pddevLen)
{
- CborEncoder pddev = { {.ptr = NULL }, .end = 0, .added = 0, .flags = 0 };
+ CborEncoder pddev;
cborEncoderResult = cbor_encode_text_string(&pconfMap, OIC_JSON_PDDEV_LIST_NAME,
strlen(OIC_JSON_PDDEV_LIST_NAME));
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed to encode pddev");
OCStackResult ret = OC_STACK_ERROR;
- CborEncoder encoder = { {.ptr = NULL }, .end = 0 };
- CborEncoder pstatMap = { {.ptr = NULL }, .end = 0 };
+ CborEncoder encoder;
+ CborEncoder pstatMap;
char* strUuid = NULL;
int64_t cborEncoderResult = CborNoError;
int64_t cborEncoderResult = CborNoError;
OCStackResult ret = OC_STACK_ERROR;
- CborEncoder encoder = { {.ptr = NULL }, .end = 0 };
- CborEncoder svcArray = { {.ptr = NULL }, .end = 0 };
+ CborEncoder encoder;
+ CborEncoder svcArray;
uint8_t *outPayload = (uint8_t *)OICCalloc(1, cborLen);
VERIFY_NON_NULL(TAG, outPayload, ERROR);
while (svc)
{
- CborEncoder svcMap = {{.ptr = NULL }, .end = 0 };
- CborEncoder owners = {{.ptr = NULL }, .end = 0 };
+ CborEncoder svcMap;
+ CborEncoder owners;
cborEncoderResult = cbor_encoder_create_map(&svcArray, &svcMap, SVC_MAP_SIZE);
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed to Create SVC Map.");
OCStackResult ret = OC_STACK_ERROR;
- CborEncoder encoder = { {.ptr = NULL }, .end = 0 };
- CborEncoder verMap = { {.ptr = NULL }, .end = 0 };
+ CborEncoder encoder;
+ CborEncoder verMap;
int64_t cborEncoderResult = CborNoError;
uint8_t mapSize = VER_MAP_SIZE;
DeleteCredList(cred);
}
- CborEncoder encoder = { {.ptr = NULL }, .end = 0 };
+ CborEncoder encoder;
size_t cborSize = aclCborSize + pstatCborSize + doxmCborSize + svcCborSize + credCborSize + amaclCborSize;
printf("Total Cbor Size : %zd\n", cborSize);
uint8_t *outPayload = (uint8_t *)OICCalloc(1, cborSize);
VERIFY_NON_NULL(TAG, outPayload, ERROR);
cbor_encoder_init(&encoder, outPayload, cborSize, 0);
- CborEncoder map = { {.ptr = NULL }, .end = 0 };
+ CborEncoder map;
CborError cborEncoderResult = cbor_encoder_create_map(&encoder, &map, CborIndefiniteLength);
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Creating Main Map.");
if (aclCborSize > 0)