You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The draft-ietf-core-resource-directory-09 adds a Resource Directory (RD) to CoAP. It adds a number of resources such as rd.core-lookup which should be findable through WK/C but also a number of resources such as rd.core-lookup/res which probably should not. Remote resources added to the RD almost certainly should not be findable from WK/C. I suggest the following changes to resource.py to add another attribute to a resource. There should be no changes required to existing programs. This conforms to RFC 6690 Section 4 " It is, however, up to the application which links are included and how they are organized."
def add_resource(self, path, resource, dont_add_to_WKC=False):
# Parameter dont_add_to_WKC is to make resource invisible to WKC
# Default is visible
self._resources[tuple(path)] = resource
if dont_add_to_WKC:
# set a new attribute on the resource
resource.dont_add_to_WKC = True
and
def get_resources_as_linkheader(self):
import link_header
links = []
for path, resource in self._resources.items():
# skip resources with dont_add_to_WKC set
if hasattr(resource, 'dont_add_to_WKC'):
continue
if hasattr(resource, "get_link_description"):
details = resource.get_link_description()
else:
details = {}
lh = link_header.Link('/' + '/'.join(path), **details)
links.append(lh)
return link_header.LinkHeader(links)
Called by
# visible to WK/C, standard use
root.add_resource(('rd-lookup',),
ResourceDirectoryLookup(resource_directory))
# not visible to WKC
root.add_resource(('rd-lookup','res'),
ResourceDirectoryLookupResources(resource_directory),
True)
The text was updated successfully, but these errors were encountered:
good point, i'll add something. (probably it'll be called .hidden or
similar, and come with a more explicit interface in terms of
inheritance).
if you are working on rd, be sure to check out the recent ``rd`` branch,
which contains an implementation of the resource directory. (my
rd-lookup/* resources are actually still visible, but it did not occur
to me to hide them since most whoever is looking for a compact lookup
would ?rt=core.rd* anyway, and their presence makes the rd easier to use
with rd-agnostic gui tools like copper).
The draft-ietf-core-resource-directory-09 adds a Resource Directory (RD) to CoAP. It adds a number of resources such as rd.core-lookup which should be findable through WK/C but also a number of resources such as rd.core-lookup/res which probably should not. Remote resources added to the RD almost certainly should not be findable from WK/C. I suggest the following changes to resource.py to add another attribute to a resource. There should be no changes required to existing programs. This conforms to RFC 6690 Section 4 " It is, however, up to the application which links are included and how they are organized."
and
Called by
The text was updated successfully, but these errors were encountered: