Project

General

Profile

Actions

Feature #2566

closed

Implement Face.setInterestFilter

Added by Alex Afanasyev about 9 years ago. Updated almost 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Start date:
Due date:
% Done:

100%

Estimated time:

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)
Actions #1

Updated by Jeff Burke about 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.

Actions #2

Updated by Alex Afanasyev about 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.

Actions #3

Updated by Anonymous about 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?

Actions #4

Updated by Alex Afanasyev about 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.

Actions #5

Updated by Jeff Burke about 9 years ago

  • Assignee set to Anonymous
Actions #6

Updated by Anonymous about 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

Actions #7

Updated by Alex Afanasyev about 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.

Actions #8

Updated by Anonymous about 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?

Actions #9

Updated by Alex Afanasyev about 9 years ago

In my opinion, this is correct and desired behavior.

Actions #10

Updated by Anonymous about 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().
Actions #11

Updated by Anonymous about 9 years ago

Merged the jNDN branch issue/2566-setInterestFilter into master.

The same changes to the other libraries are in progress.

Actions #12

Updated by Anonymous almost 9 years ago

  • % Done changed from 0 to 80

Updated NDN-CPP and PyNDN.

Actions #13

Updated by Anonymous almost 9 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 80 to 100

Updated in all libraries.

Actions

Also available in: Atom PDF