Namespace-based Scope Control¶
NFD performs scope control of Interest and Data according to their namespace.
The localhost scope limits propagation to the applications on the originating host.
Interest and Data packets under prefix
ndn:/localhost are restricted by these rules:
- Interest can come from and go to local faces only.
- Data can come from and go to local faces only.
Whether a face is considered "local" for scope control purpose is determined by the face implementation.
FaceScope attribute indicates whether a face is local or non-local.
Generally, the following faces are local:
- internal face for NFD Management
- UNIX-domain socket face
- TCP face whose remote address is a loopback address
- WebSocket face whose remote address is a loopback address
A local process may connect as non-local by establishing a TCP or WebSocket connection to the IP address of a non-loopback NIC of the local machine.
Since this IP address is not a loopback address, the face would be non-local.
This is desirable in scenarios such as a protocol translator.
The localhop scope limits propagation to no further than the next node. This scope is applied to
Interest packets are restricted by these rules:
- If an Interest is received from a local face, it can be forwarded to a non-local face.
- If an Interest is received from a non-local face, it cannot be forwarded to a non-local face.
- In either case the Interest can be forwarded to a local face.
- PIT entry can be satisfied by Data from any source.
Data packets are unrestricted.
The localhop scope allows an Interest packet to travel only one hop from the consumer host, but a Data packet may travel multiple hops from the producer host.
Suppose we have three hosts A-B-C in a linear topology, B can retrieve a Data under /localhop namespace from C, and this Data is cached in B's ContentStore.
Later A sends an Interest to B; although B cannot forward this Interest to C, the cached Data can satisfy the Interest and would be returned to A.