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.");
// note: This function is used in unit test hence not declared static,
OicSecAcl_t* CBORPayloadToAcl(const uint8_t *cborPayload, const size_t size)
{
- if (NULL == cborPayload)
+ if (NULL == cborPayload || 0 == size)
{
return NULL;
}
ehRet = (payload ? OC_EH_OK : OC_EH_ERROR);
// Send response payload to request originator
- SendSRMCBORResponse(ehRequest, ehRet, payload, size);
+ if (OC_STACK_OK != SendSRMResponse(ehRequest, ehRet, payload, size))
+ {
+ ehRet = OC_EH_ERROR;
+ OIC_LOG(ERROR, TAG, "SendSRMResponse failed for HandleACLGetRequest");
+ }
+ OICFree(payload);
OIC_LOG_V(DEBUG, TAG, "%s RetVal %d", __func__, ehRet);
return ehRet;
OCEntityHandlerResult ehRet = OC_EH_ERROR;
// Convert CBOR into ACL data and update to SVR buffers. This will also validate the ACL data received.
- uint8_t *payload = ((OCSecurityPayload *) ehRequest->payload)->securityData1;
+ uint8_t *payload = ((OCSecurityPayload *) ehRequest->payload)->securityData;
size_t size = ((OCSecurityPayload *) ehRequest->payload)->payloadSize;
if (payload)
{
}
// Send payload to request originator
- SendSRMCBORResponse(ehRequest, ehRet, NULL, 0);
+ if (OC_STACK_OK != SendSRMResponse(ehRequest, ehRet, NULL, 0))
+ {
+ ehRet = OC_EH_ERROR;
+ OIC_LOG(ERROR, TAG, "SendSRMResponse failed in HandleACLPostRequest");
+ }
OIC_LOG_V(DEBUG, TAG, "%s RetVal %d", __func__, ehRet);
return ehRet;
exit:
// Send payload to request originator
- SendSRMCBORResponse(ehRequest, ehRet, NULL, 0);
+ if (OC_STACK_OK != SendSRMResponse(ehRequest, ehRet, NULL, 0))
+ {
+ ehRet = OC_EH_ERROR;
+ OIC_LOG(ERROR, TAG, "SendSRMResponse failed in HandleACLDeleteRequest");
+ }
return ehRet;
}
default:
ehRet = OC_EH_ERROR;
- SendSRMCBORResponse(ehRequest, ehRet, NULL, 0);
+ SendSRMResponse(ehRequest, ehRet, NULL, 0);
}
}