7 #ifndef NDN_INTEREST_HPP
8 #define NDN_INTEREST_HPP
24 class Interest :
public enable_shared_from_this<Interest>
33 , m_interestLifetime(time::milliseconds::min())
46 , m_interestLifetime(time::milliseconds::min())
55 Interest(
const Name& name,
const time::milliseconds& interestLifetime)
59 , m_interestLifetime(interestLifetime)
66 const time::milliseconds& interestLifetime,
69 , m_selectors(selectors)
72 , m_interestLifetime(interestLifetime)
92 int minSuffixComponents,
int maxSuffixComponents,
97 const time::milliseconds& interestLifetime,
100 , m_selectors(minSuffixComponents, maxSuffixComponents, exclude, childSelector, mustBeFresh)
103 , m_interestLifetime(interestLifetime)
206 m_selectors = selectors;
229 const time::milliseconds&
232 return m_interestLifetime;
238 m_interestLifetime = interestLifetime;
268 return m_localControlHeader;
274 return m_localControlHeader;
423 return !(*
this == other);
429 mutable uint32_t m_nonce;
431 time::milliseconds m_interestLifetime;
433 mutable Block m_wire;
445 std::ostringstream os;
453 return !m_selectors.
empty();
459 return m_scope >= 0 ||
460 m_interestLifetime >= time::milliseconds::zero() ||
468 size_t totalLength = 0;
506 totalLength += block.prependVarNumber (totalLength);
523 m_wire = buffer.block();
541 throw Tlv::Error(
"Unexpected TLV number when decoding Interest");
594 #endif // NDN_INTEREST_HPP
void wireDecode(const Block &wire)
Decode the input from wire format.
int getMinSuffixComponents() const
int getMaxSuffixComponents() const
const nfd::LocalControlHeader & getLocalControlHeader() const
const Name & getName() const
bool operator==(const Interest &other) const
bool matchesName(const Name &name) const
Check if Interest name matches the given name (using ndn_Name_match) and the given name also conforms...
Interest & setMustBeFresh(bool mustBeFresh)
Interest(const Name &name, int minSuffixComponents, int maxSuffixComponents, const Exclude &exclude, int childSelector, bool mustBeFresh, int scope, const time::milliseconds &interestLifetime, uint32_t nonce=0)
Create a new Interest for the given name and values.
element_const_iterator find(uint32_t type) const
bool hasWire() const
Check if already has wire.
Selectors & setChildSelector(int childSelector)
bool hasSelectors() const
Interest & setScope(int scope)
Interest & setNonce(uint32_t nonce)
const Block & wireEncode() const
Encode to a wire format.
Class representing wire element of the NDN packet.
An Interest holds a Name and other fields for an interest.
size_t wireEncode(EncodingImpl< T > &block) const
Fast encoding or block size estimation.
uint64_t readNonNegativeInteger(const Block &block)
std::string toUri() const
Encode the name according to the "NDN URI Scheme".
const time::milliseconds & getInterestLifetime() const
int getChildSelector() const
Selectors & setPublisherPublicKeyLocator(const KeyLocator &keyLocator)
size_t wireEncode(EncodingImpl< T > &block) const
Fast encoding or block size estimation.
Interest(const Block &wire)
Create from wire encoding.
element_const_iterator elements_end() const
uint64_t getNextHopFaceId() const
const KeyLocator & getPublisherPublicKeyLocator() const
Interest()
Create a new Interest with an empty name and "none" for all values.
const Exclude & getExclude() const
const Selectors & getSelectors() const
int getMustBeFresh() const
int getChildSelector() const
const time::seconds DEFAULT_INTEREST_LIFETIME
Selectors & setMaxSuffixComponents(int maxSuffixComponents)
Interest & setExclude(const Exclude &exclude)
Interest & setChildSelector(int childSelector)
Interest & setName(const Name &name)
int getMustBeFresh() const
Interest & setPublisherPublicKeyLocator(const KeyLocator &keyLocator)
const Exclude & getExclude() const
Abstraction implementing Interest selectors.
Interest & setMinSuffixComponents(int minSuffixComponents)
uint64_t getIncomingFaceId() const
const Block & get(uint32_t type) const
Get the first subelement of the requested type.
element_container::const_iterator element_const_iterator
Interest(const Name &name)
Create a new Interest with the given name and "none" for other values.
Interest & setMaxSuffixComponents(int maxSuffixComponents)
Selectors & setMustBeFresh(bool mustBeFresh)
void reset()
Reset wire buffer of the element.
A Name holds an array of Name::Component and represents an NDN name.
bool matchesData(const Data &data) const
Determines whether this Interest can be satisfied by data.
size_t wireEncode(EncodingImpl< T > &block) const
Fast encoding or block size estimation.
void parse() const
Parse wire buffer into subblocks.
Interest & setSelectors(const Selectors &selectors)
Interest & setNextHopFaceId(uint64_t nextHopFaceId)
void wireDecode(const Block &wire)
Decode from the wire format.
Interest & setIncomingFaceId(uint64_t incomingFaceId)
Interest(const Name &name, const time::milliseconds &interestLifetime)
Create a new Interest with the given name and interest lifetime and "none" for other values...
bool operator!=(const Interest &other) const
int getMinSuffixComponents() const
bool hasWire() const
Check if the Block has fully encoded wire.
Selectors & setExclude(const Exclude &exclude)
const KeyLocator & getPublisherPublicKeyLocator() const
size_t prependNonNegativeIntegerBlock(EncodingImpl< P > &encoder, uint32_t type, uint64_t number)
helper methods
Selectors & setMinSuffixComponents(int minSuffixComponents)
std::ostream & operator<<(std::ostream &os, const Data &data)
void wireDecode(const Block &wire)
int getMaxSuffixComponents() const
Interest & setInterestLifetime(const time::milliseconds &interestLifetime)
Class representing wire element of the NDN packet.
Class to represent Exclude component in NDN interests.
const uint32_t & getNonce() const
Get Interest's nonce.
Interest(const Name &name, const Selectors &selectors, int scope, const time::milliseconds &interestLifetime, uint32_t nonce=0)
nfd::LocalControlHeader & getLocalControlHeader()