Commit 24866974 authored by Madan Lanka's avatar Madan Lanka Committed by Gerrit Code Review

Merge "Merge branch 'master' into extended-easysetup" into extended-easysetup

parents b7da1bc1 cd34db38
......@@ -185,8 +185,11 @@ OCStackResult CBORPayloadToCrl(const uint8_t *cborPayload, const size_t size,
cborFindResult = cbor_value_map_find_value(&crlCbor, OIC_CBOR_CRL_ID, &crlMap);
if (CborNoError == cborFindResult && cbor_value_is_integer(&crlMap))
{
cborFindResult = cbor_value_get_int(&crlMap, (int *) &crl->CrlId);
int CrlId;
cborFindResult = cbor_value_get_int(&crlMap, &CrlId);
VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding CrlId.");
crl->CrlId = (uint16_t)CrlId;
}
cborFindResult = cbor_value_map_find_value(&crlCbor, OIC_CBOR_CRL_THIS_UPDATE, &crlMap);
......
......@@ -394,8 +394,11 @@ static OCStackResult CBORPayloadToDoxmBin(const uint8_t *cborPayload, size_t siz
int i = 0;
while (cbor_value_is_valid(&oxm) && cbor_value_is_integer(&oxm))
{
cborFindResult = cbor_value_get_int(&oxm, (int *) &doxm->oxm[i++]);
int tmp;
cborFindResult = cbor_value_get_int(&oxm, &tmp);
VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding oxmName Value")
doxm->oxm[i++] = (OicSecOxm_t)tmp;
cborFindResult = cbor_value_advance(&oxm);
VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing oxmName.")
}
......@@ -421,8 +424,11 @@ static OCStackResult CBORPayloadToDoxmBin(const uint8_t *cborPayload, size_t siz
cborFindResult = cbor_value_map_find_value(&doxmCbor, OIC_JSON_OXM_SEL_NAME, &doxmMap);
if (CborNoError == cborFindResult && cbor_value_is_integer(&doxmMap))
{
cborFindResult = cbor_value_get_int(&doxmMap, (int *) &doxm->oxmSel);
int oxmSel;
cborFindResult = cbor_value_get_int(&doxmMap, &oxmSel);
VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding Sel Name Value.")
doxm->oxmSel = (OicSecOxm_t)oxmSel;
}
else // PUT/POST JSON may not have oxmsel so set it to the gDoxm->oxmSel
{
......@@ -433,8 +439,11 @@ static OCStackResult CBORPayloadToDoxmBin(const uint8_t *cborPayload, size_t siz
cborFindResult = cbor_value_map_find_value(&doxmCbor, OIC_JSON_SUPPORTED_CRED_TYPE_NAME, &doxmMap);
if (CborNoError == cborFindResult && cbor_value_is_integer(&doxmMap))
{
cborFindResult = cbor_value_get_int(&doxmMap, (int *) &doxm->sct);
int sct;
cborFindResult = cbor_value_get_int(&doxmMap, &sct);
VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding Sct Name Value.")
doxm->sct = (OicSecCredType_t)sct;
if (roParsed)
{
......
......@@ -308,8 +308,11 @@ OCStackResult CBORPayloadToDpair(const uint8_t *cborPayload, size_t size,
type = cbor_value_get_type(&dpairMap);
if (0 == strcmp(OIC_JSON_SPM_NAME, name) && cbor_value_is_integer(&dpairMap))
{
cborFindResult = cbor_value_get_int(&dpairMap, (int *) &dpair->spm);
int spm;
cborFindResult = cbor_value_get_int(&dpairMap, &spm);
VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding SPM Value");
dpair->spm = (OicSecPrm_t)spm;
}
if (0 == strcmp(OIC_JSON_PDEVICE_ID_NAME, name))
......
......@@ -505,8 +505,11 @@ OCStackResult CBORPayloadToPconf(const uint8_t *cborPayload, size_t size, OicSec
while (cbor_value_is_valid(&prm) && cbor_value_is_integer(&prm))
{
cborFindResult = cbor_value_get_int(&prm, (int *)&pconf->prm[i++]);
int prm_val;
cborFindResult = cbor_value_get_int(&prm, &prm_val);
VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed to get value");
pconf->prm[i++] = (OicSecPrm_t)prm_val;
cborFindResult = cbor_value_advance(&prm);
VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed to advance value");
}
......
......@@ -314,8 +314,11 @@ static OCStackResult CBORPayloadToPstatBin(const uint8_t *cborPayload, const siz
cborFindResult = cbor_value_map_find_value(&pstatCbor, OIC_JSON_CM_NAME, &pstatMap);
if (CborNoError == cborFindResult && cbor_value_is_integer(&pstatMap))
{
cborFindResult = cbor_value_get_int(&pstatMap, (int *) &pstat->cm);
int cm;
cborFindResult = cbor_value_get_int(&pstatMap, &cm);
VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding CM.");
pstat->cm = (OicSecDpm_t)cm;
}
else
{
......@@ -326,8 +329,11 @@ static OCStackResult CBORPayloadToPstatBin(const uint8_t *cborPayload, const siz
cborFindResult = cbor_value_map_find_value(&pstatCbor, OIC_JSON_TM_NAME, &pstatMap);
if (CborNoError == cborFindResult && cbor_value_is_integer(&pstatMap))
{
cborFindResult = cbor_value_get_int(&pstatMap, (int *) &pstat->tm);
int tm;
cborFindResult = cbor_value_get_int(&pstatMap, &tm);
VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding TM.");
pstat->tm = (OicSecDpm_t)tm;
}
else
{
......@@ -338,8 +344,11 @@ static OCStackResult CBORPayloadToPstatBin(const uint8_t *cborPayload, const siz
cborFindResult = cbor_value_map_find_value(&pstatCbor, OIC_JSON_OM_NAME, &pstatMap);
if (CborNoError == cborFindResult && cbor_value_is_integer(&pstatMap))
{
cborFindResult = cbor_value_get_int(&pstatMap, (int *) &pstat->om);
int om;
cborFindResult = cbor_value_get_int(&pstatMap, &om);
VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding OM.");
pstat->om = (OicSecDpom_t)om;
}
else
{
......@@ -350,10 +359,13 @@ static OCStackResult CBORPayloadToPstatBin(const uint8_t *cborPayload, const siz
cborFindResult = cbor_value_map_find_value(&pstatCbor, OIC_JSON_SM_NAME, &pstatMap);
if (CborNoError == cborFindResult && cbor_value_is_integer(&pstatMap))
{
int sm;
pstat->smLen = 1;
pstat->sm = (OicSecDpom_t*)OICCalloc(pstat->smLen, sizeof(OicSecDpom_t));
cborFindResult = cbor_value_get_int(&pstatMap, (int *) &pstat->sm[0]);
cborFindResult = cbor_value_get_int(&pstatMap, &sm);
VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding SM.");
pstat->sm[0] = (OicSecDpom_t)sm;
if (roParsed)
{
......
......@@ -241,8 +241,11 @@ OCStackResult CBORPayloadToSVC(const uint8_t *cborPayload, size_t size,
// Service Type
if (0 == strcmp(OIC_JSON_SERVICE_TYPE, name) && cbor_value_is_integer(&svcMap))
{
cborFindResult = cbor_value_get_int(&svcMap, (int *) &svc->svct);
int svct;
cborFindResult = cbor_value_get_int(&svcMap, &svct);
VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed to Find SVCT.");
svc->svct = (OicSecSvcType_t)svct;
}
// Owners -- Mandatory
......
......@@ -290,6 +290,8 @@ static OCStackResult OCParseDiscoveryPayload(OCPayload **outPayload, CborValue *
while (cbor_value_is_map(&resourceMap))
{
int bitmap;
resource = (OCResourcePayload *)OICCalloc(1, sizeof(OCResourcePayload));
VERIFY_PARAM_NON_NULL(TAG, resource, "Failed allocating resource payload");
......@@ -322,8 +324,9 @@ static OCStackResult OCParseDiscoveryPayload(OCPayload **outPayload, CborValue *
// Bitmap
err = cbor_value_map_find_value(&policyMap, OC_RSRVD_BITMAP, &curVal);
VERIFY_CBOR_SUCCESS(TAG, err, "to find bitmap tag");
err = cbor_value_get_int(&curVal, (int *)&resource->bitmap);
err = cbor_value_get_int(&curVal, &bitmap);
VERIFY_CBOR_SUCCESS(TAG, err, "to find bitmap value");
resource->bitmap = (uint8_t)bitmap;
// Secure Flag
err = cbor_value_map_find_value(&policyMap, OC_RSRVD_SECURE, &curVal);
......@@ -339,8 +342,11 @@ static OCStackResult OCParseDiscoveryPayload(OCPayload **outPayload, CborValue *
VERIFY_CBOR_SUCCESS(TAG, err, "to find port tag");
if (cbor_value_is_valid(&curVal))
{
err = cbor_value_get_int(&curVal, (int *)&resource->port);
int port;
err = cbor_value_get_int(&curVal, &port);
VERIFY_CBOR_SUCCESS(TAG, err, "to find port value");
resource->port = (uint16_t)port;
}
#ifdef TCP_ADAPTER
......@@ -348,8 +354,11 @@ static OCStackResult OCParseDiscoveryPayload(OCPayload **outPayload, CborValue *
err = cbor_value_map_find_value(&policyMap, OC_RSRVD_TCP_PORT, &curVal);
if (cbor_value_is_valid(&curVal))
{
err = cbor_value_get_int(&curVal, (int *)&resource->tcpPort);
int tcpPort;
err = cbor_value_get_int(&curVal, &tcpPort);
VERIFY_CBOR_SUCCESS(TAG, err, "to find tcp port value");
resource->tcpPort = (uint16_t)tcpPort;
}
#endif
......@@ -1213,6 +1222,7 @@ static OCStackResult OCParsePresencePayload(OCPayload **outPayload, CborValue *r
{
CborValue curVal;
uint64_t temp = 0;
uint8_t trigger;
// Sequence Number
CborError err = cbor_value_map_find_value(rootValue, OC_RSRVD_NONCE, &curVal);
......@@ -1232,8 +1242,9 @@ static OCStackResult OCParsePresencePayload(OCPayload **outPayload, CborValue *r
// Trigger
err = cbor_value_map_find_value(rootValue, OC_RSRVD_TRIGGER, &curVal);
VERIFY_CBOR_SUCCESS(TAG, err, "Failed finding trigger tag");
err = cbor_value_get_simple_type(&curVal, (uint8_t *)&payload->trigger);
err = cbor_value_get_simple_type(&curVal, &trigger);
VERIFY_CBOR_SUCCESS(TAG, err, "Failed finding trigger value");
payload->trigger = (OCPresenceTrigger)trigger;
// Resource type name
err = cbor_value_map_find_value(rootValue, OC_RSRVD_RESOURCE_TYPE, &curVal);
......
......@@ -25,11 +25,14 @@
// For POSIX.1-2001 base specification,
// Refer http://pubs.opengroup.org/onlinepubs/009695399/
#define _POSIX_C_SOURCE 200112L
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#ifdef WITH_STRING_H
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef WITH_STRING_H
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment