declares the set of Interests a producer can serve, which starts with a name prefix, plus an optional regular expression More...
#include <interest-filter.hpp>
Classes | |
class | Error |
Public Member Functions | |
InterestFilter (const Name &prefix) | |
Construct an InterestFilter to match Interests by prefix. More... | |
InterestFilter (const char *prefixUri) | |
Construct an InterestFilter to match Interests by prefix. More... | |
InterestFilter (const std::string &prefixUri) | |
Construct an InterestFilter to match Interests by prefix. More... | |
InterestFilter (const Name &prefix, const std::string ®exFilter) | |
Construct an InterestFilter to match Interests by prefix and regular expression. More... | |
operator const Name & () const | |
Implicit conversion to Name. More... | |
bool | doesMatch (const Name &name) const |
Check if specified Interest name matches the filter. More... | |
const Name & | getPrefix () const |
bool | hasRegexFilter () const |
const RegexPatternListMatcher & | getRegexFilter () const |
NDN_CXX_NODISCARD bool | allowsLoopback () const |
Get whether Interest loopback is allowed. More... | |
InterestFilter & | allowLoopback (bool wantLoopback) |
Set whether Interest loopback is allowed. More... | |
declares the set of Interests a producer can serve, which starts with a name prefix, plus an optional regular expression
Definition at line 35 of file interest-filter.hpp.
ndn::InterestFilter::InterestFilter | ( | const Name & | prefix | ) |
Construct an InterestFilter to match Interests by prefix.
This filter matches Interests whose name start with the given prefix.
Definition at line 27 of file interest-filter.cpp.
ndn::InterestFilter::InterestFilter | ( | const char * | prefixUri | ) |
Construct an InterestFilter to match Interests by prefix.
This filter matches Interests whose name start with the given prefix.
prefixUri | name prefix, interpreted as ndn URI |
Definition at line 32 of file interest-filter.cpp.
ndn::InterestFilter::InterestFilter | ( | const std::string & | prefixUri | ) |
Construct an InterestFilter to match Interests by prefix.
This filter matches Interests whose name start with the given prefix.
prefixUri | name prefix, interpreted as ndn URI |
Definition at line 37 of file interest-filter.cpp.
ndn::InterestFilter::InterestFilter | ( | const Name & | prefix, |
const std::string & | regexFilter | ||
) |
Construct an InterestFilter to match Interests by prefix and regular expression.
This filter matches Interests whose name start with the given prefix and the remaining components match the given regular expression. For example, the following InterestFilter:
InterestFilter("/hello", "<world><>+")
matches Interests whose name has prefix /hello
followed by component world
and has at least one more component after it, such as:
/hello/world/%21 /hello/world/x/y/z
Note that regular expression will need to match all components (e.g., there are implicit heading ^
and trailing $
symbols in the regular expression).
Definition at line 42 of file interest-filter.cpp.
ndn::InterestFilter::operator const Name & | ( | ) | const |
Implicit conversion to Name.
Name
rather than InterestFilter
, but this does not work if InterestFilter has regular expression. Definition at line 48 of file interest-filter.cpp.
References NDN_THROW.
bool ndn::InterestFilter::doesMatch | ( | const Name & | name | ) | const |
Check if specified Interest name matches the filter.
Definition at line 58 of file interest-filter.cpp.
References hasRegexFilter(), ndn::Name::isPrefixOf(), and ndn::Name::size().
Referenced by ndn::InterestFilterRecord::doesMatch().
|
inline |
Definition at line 107 of file interest-filter.hpp.
Referenced by ndn::operator<<(), and ndn::Face::setInterestFilter().
|
inline |
Definition at line 113 of file interest-filter.hpp.
Referenced by doesMatch(), and ndn::operator<<().
|
inline |
Definition at line 119 of file interest-filter.hpp.
Referenced by ndn::operator<<().
|
inline |
Get whether Interest loopback is allowed.
Definition at line 127 of file interest-filter.hpp.
Referenced by ndn::InterestFilterRecord::doesMatch().
|
inline |
Set whether Interest loopback is allowed.
wantLoopback | if true, this InterestFilter may receive Interests that are expressed locally on the same ndn::Face ; if false, this InterestFilter can only receive Interests received from the forwarder. The default is true. |
Definition at line 138 of file interest-filter.hpp.