Routine ParseResources (ocstack/src/ocpayloadparse.c) contains the
following code, which seems to set the sid fld of the discovery payload
based on the anchor.  But the sid (i.e. "di") fld is not part of the OCF
1.0.0 discovery resource.  So I think this should be removed, or
conditionalized for only OIC 1.1.0 support.

Plus I'm not even sure the logic of this routine is sound wrt the sid fld.

Comments?

Gregg

char* anchorPrefix =  "ocf://";
        // Parse di from anchor
        if (!resource->anchor || strncmp(resource->anchor, anchorPrefix,
strlen(anchorPrefix)))
        {
            OIC_LOG_V(ERROR, TAG, "Ignore unrecognized anchor %s",
resource->anchor);
            OCDiscoveryResourceDestroy(resource);
        }
        else
        {
            char *di = OICStrdup(resource->anchor + strlen(anchorPrefix));
            VERIFY_PARAM_NON_NULL(TAG, di, "Failed to duplicating di");

            char *slash = strchr(di, '/');
            if (slash)
            {
                *slash = '\0';
            }
            OCDiscoveryPayload **temp = outPayload;

           while (*temp)
            {
                if (!(*temp)->sid)
                {
                    (*temp)->sid = di;
                    OCDiscoveryPayloadAddNewResource(*temp, resource);
                    break;
                }
                else if (!strcmp((*temp)->sid, di))
                {
                    OCDiscoveryPayloadAddNewResource(*temp, resource);
                    OICFree(di);
                    break;
                }
                temp = &(*temp)->next;
            }
            if (!*temp)
            {
                *temp = OCDiscoveryPayloadCreate();
                VERIFY_PARAM_NON_NULL(TAG, *temp, "Failed error
initializing discovery payload");
                (*temp)->sid = di;
                OCDiscoveryPayloadAddNewResource(*temp, resource);
            }
        }

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#10145): 
https://lists.iotivity.org/g/iotivity-dev/message/10145
Mute This Topic: https://lists.iotivity.org/mt/29344075/21656
Group Owner: iotivity-dev+ow...@lists.iotivity.org
Unsubscribe: https://lists.iotivity.org/g/iotivity-dev/unsub  
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to