|
NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
|
API Documentation
|
Go to the documentation of this file.
22 #ifndef NDN_INTEREST_HPP
23 #define NDN_INTEREST_HPP
30 #include <boost/logic/tribool.hpp>
71 template<encoding::Tag TAG>
149 s_defaultCanBePrefix = canBePrefix;
157 return m_canBePrefix;
166 m_canBePrefix = canBePrefix;
168 m_isCanBePrefixSet =
true;
177 return m_mustBeFresh;
186 m_mustBeFresh = mustBeFresh;
194 return m_forwardingHint;
210 template<
typename Modifier>
214 modifier(m_forwardingHint);
224 return m_nonce.has_value();
250 return m_interestLifetime;
275 return !m_parameters.empty();
281 if (m_parameters.empty())
284 return m_parameters.front();
338 return s_autoCheckParametersDigest;
344 s_autoCheckParametersDigest = b;
359 setApplicationParametersInternal(
Block parameters);
362 computeParametersDigest()
const;
372 addOrReplaceParametersDigestComponent();
381 findParametersDigestComponent(
const Name&
name);
383 #ifdef NDN_CXX_HAVE_TESTS
386 static bool s_errorIfCanBePrefixUnset;
387 #endif // NDN_CXX_HAVE_TESTS
390 static boost::logic::tribool s_defaultCanBePrefix;
391 static bool s_autoCheckParametersDigest;
395 mutable optional<uint32_t> m_nonce;
396 time::milliseconds m_interestLifetime;
397 optional<uint8_t> m_hopLimit;
398 mutable bool m_isCanBePrefixSet =
false;
399 bool m_canBePrefix =
true;
400 bool m_mustBeFresh =
false;
408 std::vector<Block> m_parameters;
410 mutable Block m_wire;
420 #endif // NDN_INTEREST_HPP
uint32_t getNonce() const
Get nonce value.
Interest & setMustBeFresh(bool mustBeFresh)
Add or remove MustBeFresh element.
bool getCanBePrefix() const noexcept
Check whether the CanBePrefix element is present.
std::string toUri() const
Return a URI-like string that represents the Interest.
static void setDefaultCanBePrefix(bool canBePrefix)
Declare the default CanBePrefix setting of the application.
static void setAutoCheckParametersDigest(bool b)
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(Interest)
Interest & setInterestLifetime(time::milliseconds lifetime)
Set the Interest's lifetime.
Interest & unsetApplicationParameters()
Remove the ApplicationParameters element from this Interest.
const Block & wireEncode() const
Encode into a Block according to NDN Packet Format v0.3.
static bool getAutoCheckParametersDigest()
void reset() noexcept
Reset the Block to a default-constructed state.
bool getMustBeFresh() const noexcept
Check whether the MustBeFresh element is present.
Interest & setApplicationParameters(const Block ¶meters)
Set ApplicationParameters from a Block.
void refreshNonce()
Change nonce value.
Interest & setHopLimit(optional< uint8_t > hopLimit)
Set the Interest's hop limit.
bool hasWire() const
Check if this instance has cached wire encoding.
Represents an absolute name.
#define NDN_CXX_NODISCARD
Interest & setCanBePrefix(bool canBePrefix)
Add or remove CanBePrefix element.
Interest(const Name &name=Name(), time::milliseconds lifetime=DEFAULT_INTEREST_LIFETIME)
Construct an Interest with given name and lifetime.
const DelegationList & getForwardingHint() const noexcept
Represents an Interest packet.
const time::milliseconds DEFAULT_INTEREST_LIFETIME
default value for InterestLifetime
represents a list of Delegations
Represents a Data packet.
bool matchesData(const Data &data) const
Check if Interest can be satisfied by data.
time::milliseconds getInterestLifetime() const noexcept
Interest & setForwardingHint(const DelegationList &value)
bool hasApplicationParameters() const noexcept
bool hasNonce() const noexcept
Check if the Nonce element is present.
Interest & setName(const Name &name)
Set the Interest's name.
Represents a TLV element of NDN packet format.
optional< uint8_t > getHopLimit() const noexcept
std::ostream & operator<<(std::ostream &os, const Data &data)
bool hasWire() const noexcept
Check if the Block contains a fully encoded wire representation.
Block getApplicationParameters() const
const Name & getName() const noexcept
Interest & modifyForwardingHint(const Modifier &modifier)
Modify ForwardingHint in-place.
base class to allow simple management of packet tags
represents an error in TLV encoding or decoding
Interest & setNonce(uint32_t nonce)
Set nonce value.
Error(const char *expectedType, uint32_t actualType)
bool isParametersDigestValid() const
Check if the ParametersSha256DigestComponent in the name is valid.
shared_ptr< const Buffer > ConstBufferPtr
bool matchesInterest(const Interest &other) const
Check if this Interest matches other.
Copyright (c) 2011-2015 Regents of the University of California.
void wireDecode(const Block &wire)
Decode from wire according to NDN Packet Format v0.3.