22 #ifndef NDN_INTEREST_HPP 23 #define NDN_INTEREST_HPP 31 #include <boost/logic/tribool.hpp> 50 using tlv::Error::Error;
70 template<encoding::Tag TAG>
164 s_defaultCanBePrefix = canBePrefix;
191 m_isCanBePrefixSet =
true;
225 return m_forwardingHint;
241 template<
typename Modifier>
245 modifier(m_forwardingHint);
255 return static_cast<bool>(m_nonce);
281 return m_interestLifetime;
293 return !m_parameters.
empty();
342 return !m_selectors.
empty();
356 m_selectors = selectors;
444 template<encoding::Tag TAG>
450 template<encoding::Tag TAG>
468 #ifdef NDN_CXX_HAVE_TESTS 472 static bool s_errorIfCanBePrefixUnset;
473 #endif // NDN_CXX_HAVE_TESTS 476 static boost::logic::tribool s_defaultCanBePrefix;
480 mutable bool m_isCanBePrefixSet;
481 mutable optional<uint32_t> m_nonce;
482 time::milliseconds m_interestLifetime;
486 mutable Block m_wire;
502 return !(lhs == rhs);
507 #endif // NDN_INTEREST_HPP
int getMinSuffixComponents() const
const Block & wireEncode() const
Encode to a Block.
bool hasWire() const
Check if the Block has fully encoded wire.
Copyright (c) 2011-2015 Regents of the University of California.
int getChildSelector() const
Interest & modifyForwardingHint(const Modifier &modifier)
Modify ForwardingHint in-place.
const Selectors & getSelectors() const
Interest & setMustBeFresh(bool mustBeFresh)
Add or remove MustBeFresh element.
Selectors & setMustBeFresh(bool mustBeFresh)
std::string toUri() const
Return a URI-like string that represents the Interest.
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 matchesInterest(const Interest &other) const
Check if Interest matches other interest.
bool matchesName(const Name &name) const
Check if Interest, including selectors, matches the given name.
Represents a TLV element of NDN packet format.
Represents an Interest packet.
bool operator!=(const Data &lhs, const Data &rhs)
bool getMustBeFresh() const
int getChildSelector() const
Selectors & setMaxSuffixComponents(int maxSuffixComponents)
bool hasNonce() const
Check if the Nonce element is present.
Selectors & setExclude(const Exclude &exclude)
Selectors & setChildSelector(int childSelector)
set ChildSelector
int getMaxSuffixComponents() const
bool empty() const
Check if the Block is empty.
Selectors & setMinSuffixComponents(int minSuffixComponents)
const KeyLocator & getPublisherPublicKeyLocator() const
const KeyLocator & getPublisherPublicKeyLocator() const
Interest & setExclude(const Exclude &exclude)
Interest & setChildSelector(int childSelector)
Interest & setName(const Name &name)
uint32_t getNonce() const
Get nonce value.
const Block & getParameters() const
Interest & setNonce(uint32_t nonce)
Set nonce value.
Interest & setPublisherPublicKeyLocator(const KeyLocator &keyLocator)
base class to allow simple management of packet tags
Abstraction implementing Interest selectors.
Interest & setMinSuffixComponents(int minSuffixComponents)
friend bool operator==(const Interest &lhs, const Interest &rhs)
bool matchesData(const Data &data) const
Check if Interest can be satisfied by data.
Interest & setMaxSuffixComponents(int maxSuffixComponents)
void reset()
Reset wire buffer of the element.
static void setDefaultCanBePrefix(bool canBePrefix)
Declare the default CanBePrefix setting of the application.
Represents an absolute name.
bool getCanBePrefix() const
Check whether the CanBePrefix element is present.
bool hasParameters() const
const Exclude & getExclude() const
bool hasWire() const
Check if this instance has cached wire encoding.
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(Exclude)
Interest & setSelectors(const Selectors &selectors)
void wireDecode(const Block &wire)
Decode from wire in NDN Packet Format v0.2 or v0.3.
int getMaxSuffixComponents() const
int getMinSuffixComponents() const
const Exclude & getExclude() const
time::milliseconds getInterestLifetime() const
const DelegationList & getForwardingHint() const
represents a list of Delegations
bool operator==(const Data &lhs, const Data &rhs)
Interest & setForwardingHint(const DelegationList &value)
bool getMustBeFresh() const
Check whether the MustBeFresh element is present.
Interest & setInterestLifetime(time::milliseconds lifetime)
Set Interest's lifetime.
const time::milliseconds DEFAULT_INTEREST_LIFETIME
default value for InterestLifetime
Interest & unsetParameters()
Remove the Parameters element from this Interest.
Represents a Data packet.
represents an error in TLV encoding or decoding
Represents Exclude selector in NDN Interest.
Selectors & setPublisherPublicKeyLocator(const KeyLocator &keyLocator)
bool hasSelectors() const
Check if Interest has any selector present.
const Name & getName() const
Interest & setCanBePrefix(bool canBePrefix)
Add or remove CanBePrefix element.
Interest & setParameters(const Block ¶meters)
Set parameters from a Block.
shared_ptr< const Buffer > ConstBufferPtr