Commit 3af16693 authored by Kishen Maloor's avatar Kishen Maloor

Fix discovery responses from multi-device servers

Signed-off-by: Kishen Maloor's avatarKishen Maloor <kishen.maloor@intel.com>
parent f914258e
Pipeline #103 failed with stage
in 82 minutes and 41 seconds
......@@ -31,7 +31,7 @@
static bool
filter_resource(oc_resource_t *resource, oc_request_t *request,
const char *anchor, CborEncoder *links)
const char *anchor, CborEncoder *links, size_t device_index)
{
if (!oc_filter_resource_by_rt(resource, request)) {
return false;
......@@ -72,7 +72,7 @@ filter_resource(oc_resource_t *resource, oc_request_t *request,
// eps
oc_rep_set_array(link, eps);
oc_endpoint_t *eps = oc_connectivity_get_endpoints(resource->device);
oc_endpoint_t *eps = oc_connectivity_get_endpoints(device_index);
while (eps != NULL) {
/* If this resource has been explicitly tagged as SECURE on the
* application layer, skip all coap:// endpoints, and only include
......@@ -119,64 +119,64 @@ process_device_resources(CborEncoder *links, oc_request_t *request,
oc_concat_strings(&anchor, "ocf://", uuid);
if (filter_resource(oc_core_get_resource_by_index(OCF_P, 0), request,
oc_string(anchor), links))
oc_string(anchor), links, device_index))
matches++;
if (filter_resource(oc_core_get_resource_by_index(OCF_D, device_index),
request, oc_string(anchor), links))
request, oc_string(anchor), links, device_index))
matches++;
if (filter_resource(
oc_core_get_resource_by_index(OCF_INTROSPECTION_WK, device_index),
request, oc_string(anchor), links))
request, oc_string(anchor), links, device_index))
matches++;
if (oc_get_con_res_announced() &&
filter_resource(oc_core_get_resource_by_index(OCF_CON, device_index),
request, oc_string(anchor), links))
request, oc_string(anchor), links, device_index))
matches++;
#ifdef OC_MNT
if (filter_resource(oc_core_get_resource_by_index(OCF_MNT, device_index),
request, oc_string(anchor), links))
request, oc_string(anchor), links, device_index))
matches++;
#endif /* OC_MNT */
#ifdef OC_SOFTWARE_UPDATE
if (filter_resource(
oc_core_get_resource_by_index(OCF_SW_UPDATE, device_index), request,
oc_string(anchor), links))
oc_string(anchor), links, device_index))
matches++;
#endif /* OC_SOFTWARE_UPDATE */
#ifdef OC_SECURITY
if (filter_resource(oc_core_get_resource_by_index(OCF_SEC_DOXM, device_index),
request, oc_string(anchor), links))
request, oc_string(anchor), links, device_index))
matches++;
if (filter_resource(
oc_core_get_resource_by_index(OCF_SEC_PSTAT, device_index), request,
oc_string(anchor), links))
oc_string(anchor), links, device_index))
matches++;
if (filter_resource(oc_core_get_resource_by_index(OCF_SEC_ACL, device_index),
request, oc_string(anchor), links))
request, oc_string(anchor), links, device_index))
matches++;
if (filter_resource(oc_core_get_resource_by_index(OCF_SEC_CRED, device_index),
request, oc_string(anchor), links))
request, oc_string(anchor), links, device_index))
matches++;
if (filter_resource(oc_core_get_resource_by_index(OCF_SEC_SP, device_index),
request, oc_string(anchor), links))
request, oc_string(anchor), links, device_index))
matches++;
#ifdef OC_PKI
if (filter_resource(oc_core_get_resource_by_index(OCF_SEC_CSR, device_index),
request, oc_string(anchor), links))
request, oc_string(anchor), links, device_index))
matches++;
if (filter_resource(
oc_core_get_resource_by_index(OCF_SEC_ROLES, device_index), request,
oc_string(anchor), links))
oc_string(anchor), links, device_index))
matches++;
#endif /* OC_PKI */
#endif /* OC_SECURITY */
......@@ -184,7 +184,7 @@ process_device_resources(CborEncoder *links, oc_request_t *request,
#if defined(OC_CLIENT) && defined(OC_SERVER) && defined(OC_CLOUD)
if (filter_resource(
oc_core_get_resource_by_index(OCF_COAPCLOUDCONF, device_index), request,
oc_string(anchor), links))
oc_string(anchor), links, device_index))
matches++;
#endif /* OC_CLIENT && OC_SERVER && OC_CLOUD */
......@@ -195,7 +195,8 @@ process_device_resources(CborEncoder *links, oc_request_t *request,
!(resource->properties & OC_DISCOVERABLE))
continue;
if (filter_resource(resource, request, oc_string(anchor), links))
if (filter_resource(resource, request, oc_string(anchor), links,
device_index))
matches++;
}
......@@ -207,7 +208,7 @@ process_device_resources(CborEncoder *links, oc_request_t *request,
continue;
if (filter_resource((oc_resource_t *)collection, request, oc_string(anchor),
links))
links, device_index))
matches++;
}
#endif /* OC_COLLECTIONS */
......
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