22 #ifndef NDN_INTEREST_HPP 23 #define NDN_INTEREST_HPP 31 #include <boost/logic/tribool.hpp> 59 Interest(
const Name& name =
Name(), time::milliseconds lifetime = DEFAULT_INTEREST_LIFETIME);
70 template<encoding::Tag TAG>
92 return m_wire.hasWire();
164 s_defaultCanBePrefix = canBePrefix;
176 return m_selectors.getMaxSuffixComponents() != 1;
191 m_isCanBePrefixSet =
true;
204 return m_selectors.getMustBeFresh();
225 return m_forwardingHint;
241 template<
typename Modifier>
245 modifier(m_forwardingHint);
255 return m_nonce.has_value();
281 return m_interestLifetime;
293 return !m_parameters.empty();
345 return !m_selectors.empty();
359 m_selectors = selectors;
368 return m_selectors.getMinSuffixComponents();
384 return m_selectors.getMaxSuffixComponents();
400 return m_selectors.getPublisherPublicKeyLocator();
416 return m_selectors.getExclude();
432 return m_selectors.getChildSelector();
447 template<encoding::Tag TAG>
449 encode02(EncodingImpl<TAG>& encoder)
const;
453 template<encoding::Tag TAG>
455 encode03(EncodingImpl<TAG>& encoder)
const;
471 #ifdef NDN_CXX_HAVE_TESTS 475 static bool s_errorIfCanBePrefixUnset;
476 #endif // NDN_CXX_HAVE_TESTS 479 static boost::logic::tribool s_defaultCanBePrefix;
483 mutable bool m_isCanBePrefixSet;
484 mutable optional<uint32_t> m_nonce;
485 time::milliseconds m_interestLifetime;
489 mutable Block m_wire;
505 return !(lhs == rhs);
510 #endif // NDN_INTEREST_HPP
int getMinSuffixComponents() const
int getMaxSuffixComponents() const
const Name & getName() const
bool matchesName(const Name &name) const
Check if Interest, including selectors, matches the given name.
Interest & modifyForwardingHint(const Modifier &modifier)
Modify ForwardingHint in-place.
Interest & setMustBeFresh(bool mustBeFresh)
Add or remove MustBeFresh element.
const Block & getApplicationParameters() const
void refreshNonce()
Change nonce value.
std::ostream & operator<<(std::ostream &os, const Data &data)
Interest(const Name &name=Name(), time::milliseconds lifetime=DEFAULT_INTEREST_LIFETIME)
Construct an Interest with given name and lifetime.
bool hasWire() const
Check if this instance has cached wire encoding.
bool hasSelectors() const
Check if Interest has any selector present.
const Block & wireEncode() const
Encode to a Block.
Interest & setApplicationParameters(const Block ¶meters)
Set ApplicationParameters from a Block.
Represents a TLV element of NDN packet format.
Represents an Interest packet.
bool operator!=(const Data &lhs, const Data &rhs)
std::string toUri() const
Return a URI-like string that represents the Interest.
#define NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(ClassName)
int getChildSelector() const
uint32_t getNonce() const
Get nonce value.
bool getCanBePrefix() const
Check whether the CanBePrefix element is present.
const Selectors & getSelectors() const
Interest & setExclude(const Exclude &exclude)
Interest & setChildSelector(int childSelector)
Interest & setName(const Name &name)
Interest & setNonce(uint32_t nonce)
Set nonce value.
Interest & setPublisherPublicKeyLocator(const KeyLocator &keyLocator)
base class to allow simple management of packet tags
const Exclude & getExclude() const
Abstraction implementing Interest selectors.
Interest & setMinSuffixComponents(int minSuffixComponents)
friend bool operator==(const Interest &lhs, const Interest &rhs)
Interest & setMaxSuffixComponents(int maxSuffixComponents)
static void setDefaultCanBePrefix(bool canBePrefix)
Declare the default CanBePrefix setting of the application.
Represents an absolute name.
bool matchesData(const Data &data) const
Check if Interest can be satisfied by data.
Interest & setSelectors(const Selectors &selectors)
void wireDecode(const Block &wire)
Decode from wire in NDN Packet Format v0.2 or v0.3.
bool matchesInterest(const Interest &other) const
Check if Interest matches other interest.
const DelegationList & getForwardingHint() const
represents a list of Delegations
Interest & setForwardingHint(const DelegationList &value)
Interest & setInterestLifetime(time::milliseconds lifetime)
Set Interest's lifetime.
const KeyLocator & getPublisherPublicKeyLocator() const
const time::milliseconds DEFAULT_INTEREST_LIFETIME
default value for InterestLifetime
time::milliseconds getInterestLifetime() const
Interest & unsetApplicationParameters()
Remove the ApplicationParameters element from this Interest.
Represents a Data packet.
util::scheduler::EventId deprecated
bool getMustBeFresh() const
Check whether the MustBeFresh element is present.
bool hasApplicationParameters() const
Error(const char *expectedType, uint32_t actualType)
represents an error in TLV encoding or decoding
Represents Exclude selector in NDN Interest.
Interest & setCanBePrefix(bool canBePrefix)
Add or remove CanBePrefix element.
shared_ptr< const Buffer > ConstBufferPtr
bool hasNonce() const
Check if the Nonce element is present.