Feature #2566
closedImplement Face.setInterestFilter
100%
Description
There should be at least two forms of this method:
// atomic set interest filter (only internal face dispatch)
Id
ndn::Face::setInterestFilter(InterestFilter interestFilter, OnInterest onInterest);
// combined register prefix + set interest filter
Id
ndn::Face::setInterestFilter(InterestFilter interestFilter, OnInterest onInterest,
RegisterPrefixSuccessCallback onSuccess,
RegisterPrefixFailureCallback onFailure,
uint64_t flags)
Updated by Jeff Burke over 9 years ago
- Project changed from jndn to NDN-CCL
Could you explain why?
Moving to NDN-CCL unless there is a reason to only look at this in jNDN.
Updated by Alex Afanasyev over 9 years ago
One form (2) is a convenience method to do prefix registration and setting up dispatch.
Form (1) is just to set up dispatch. In several applications (NLSR as an example), application needs to just register one prefix with NFD. How specific interests are handled is determined by the dispatch mechanism inside Face.
Updated by Anonymous over 9 years ago
(a question from a related issue) Should setInterestFilter follow the behavior of child inherit and capture which were provided in the flags to registerPrefix?
Updated by Alex Afanasyev over 9 years ago
My opinion is that it shouldn't. These are flags for RIB/FIB. The application dispatch can always use InterestFilter to specify precisely what kind of names the callback should receive.
Updated by Anonymous over 9 years ago
unsetInterestFilter(const RegisteredPrefixId* registeredPrefixId) seems to do the same thing as unregisterPrefix(const RegisteredPrefixId* registeredPrefixId, ...). Why is unsetInterestFilter(const RegisteredPrefixId* registeredPrefixId) necessary?
https://github.com/named-data/ndn-cxx/blob/a8659ff5709a27404e69e85e0fd27823c4abc76d/src/face.hpp#L438
https://github.com/named-data/ndn-cxx/blob/a8659ff5709a27404e69e85e0fd27823c4abc76d/src/face.hpp#L465
Updated by Alex Afanasyev over 9 years ago
This form of unsetInterestFilter is a convenience alias for unregisterPrefix. It also matches convenience version of setInterestFilter that combines prefix registration and setting up callback dispatch.
Updated by Anonymous over 9 years ago
"Longest prefix match" question: The ndn-cxx function processInterestFilters calls every callback which matches.
https://github.com/named-data/ndn-cxx/blob/c759a20046bce82a83c7956d3a28739b0be1f982/src/detail/face-impl.hpp#L87
This means I can set a callback for prefix /a/b and another for prefix /a/b/c. And when the library gets an interest with name /a/b/c/d it will call both callbacks without doing any "longest prefix match" to prefer only the callback for /a/b/c. Is that right?
Updated by Alex Afanasyev over 9 years ago
In my opinion, this is correct and desired behavior.
Updated by Anonymous over 9 years ago
- Status changed from New to In Progress
See the jNDN branch issue/2566-setInterestFilter. See the updates to the CHANGELOG:
https://github.com/named-data/jndn/commit/4b90a94670ceb6c3ea4a3ffcf8ec756a8d0ae340#diff-d3bb3391c79904494c60ee2ac2f33070
Changes
- http://redmine.named-data.net/issues/2566 In Face, added setInterestFilter. In registerPrefix, make the onInterest callback optional.
- http://redmine.named-data.net/issues/2579 Added callback type OnInterestCallback to use in registerPrefix and setInterest filter instead of OnInterest. The new callback is passed the Face so that you can supply the Data with face.putData().
- Face: Changed the OnInterest callback to pass interestFilterId instead of registeredPrefixId. (You should use OnInterestCallback instead of the deprecated OnInterest.)
- examples: Changed examples to use OnInterestCallback instead of OnInterest.
Deprecated
- In Face, deprecated registerPrefix where onInterest is type OnInterest. Use the registerPrefix where onInterest is OnInterestCallback so you can call face.putData().
Updated by Anonymous over 9 years ago
Merged the jNDN branch issue/2566-setInterestFilter into master.
The same changes to the other libraries are in progress.
Updated by Anonymous over 9 years ago
- Status changed from In Progress to Closed
- % Done changed from 80 to 100
Updated in all libraries.