Commit b98fcc1d authored by Sachin Agrawal's avatar Sachin Agrawal Committed by Erich Keane

Fix Discovery Payload parsing for Secure Port

Discovery response with CBOR was not parsing Secure Port info
in Policy Node.

Change-Id: I8db9e38dc08c3153ab62d58c8ac6fe6872eede7c
Signed-off-by: default avatarSachin Agrawal <sachin.agrawal@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1650Reviewed-by: default avatarErich Keane <erich.keane@intel.com>
Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
parent bfa83c91
......@@ -279,30 +279,27 @@ static OCStackResult OCParseDiscoveryPayload(OCPayload** outPayload, CborValue*
// Policy
{
CborValue policyMap;
err = err || cbor_value_map_find_value(&curVal, OC_RSRVD_POLICY, &policyMap);
err = err || cbor_value_map_find_value(&curVal, OC_RSRVD_POLICY, &policyMap);
// Bitmap
CborValue val;
err= err | cbor_value_map_find_value(&policyMap, OC_RSRVD_BITMAP, &val);
err = err || cbor_value_map_find_value(&policyMap, OC_RSRVD_BITMAP, &val);
uint64_t temp = 0;
err = err || cbor_value_get_uint64(&val, &temp);
err = err || cbor_value_get_uint64(&val, &temp);
resource->bitmap = (uint8_t)temp;
// Secure Flag
err= err | cbor_value_map_find_value(&policyMap, OC_RSRVD_SECURE, &val);
err = err || cbor_value_map_find_value(&policyMap, OC_RSRVD_SECURE, &val);
if(cbor_value_is_valid(&val))
{
err = err || cbor_value_get_boolean(&val, &(resource->secure));
err = err || cbor_value_get_boolean(&val, &(resource->secure));
// Port
err = err || cbor_value_map_find_value(&policyMap, OC_RSRVD_SECURE, &val);
if(cbor_value_is_valid(&val) && cbor_value_is_map(&val))
CborValue port;
err = err || cbor_value_map_find_value(&policyMap, OC_RSRVD_HOSTING_PORT,
&port);
if(cbor_value_is_valid(&port))
{
CborValue port;
cbor_value_map_find_value(&val, OC_RSRVD_HOSTING_PORT, &port);
if(cbor_value_is_valid(&port))
{
err = err || cbor_value_get_uint64(&val, &temp);
resource->port = (uint16_t)temp;
}
err = err || cbor_value_get_uint64(&port, &temp);
resource->port = (uint16_t)temp;
}
}
}
......
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