22 #ifndef NDN_CXX_INTEREST_HPP 
   23 #define NDN_CXX_INTEREST_HPP 
   34 #include <boost/endian/conversion.hpp> 
   35 #include <boost/logic/tribool.hpp> 
   58   class Nonce final : 
public std::array<uint8_t, 4>
 
   60     using Base = std::array<uint8_t, 4>;
 
   68       boost::endian::native_to_big_inplace(n);
 
   69       std::memcpy(data(), &n, 
sizeof(n));
 
   72     Nonce(uint8_t n1, uint8_t n2, uint8_t n3, uint8_t n4) noexcept
 
   87       return static_cast<const Base&
>(lhs) == 
static_cast<const Base&
>(rhs);
 
   93       return static_cast<const Base&
>(lhs) != 
static_cast<const Base&
>(rhs);
 
  123   template<encoding::Tag TAG>
 
  201     s_defaultCanBePrefix = canBePrefix;
 
  209     return m_canBePrefix;
 
  218     m_canBePrefix = canBePrefix;
 
  228     return m_mustBeFresh;
 
  237     m_mustBeFresh = mustBeFresh;
 
  245     return m_forwardingHint;
 
  256     return m_nonce.has_value();
 
  284     return m_interestLifetime;
 
  312     return !m_parameters.empty();
 
  325     if (m_parameters.empty())
 
  328       return m_parameters.front();
 
  371   [[deprecated(
"use the overload that takes a span<>")]]
 
  443     return s_autoCheckParametersDigest;
 
  449     s_autoCheckParametersDigest = b;
 
  464   setApplicationParametersInternal(
Block parameters);
 
  467   computeParametersDigest() 
const;
 
  477   addOrReplaceParametersDigestComponent();
 
  486   findParametersDigestComponent(
const Name& name);
 
  488   std::vector<Block>::const_iterator
 
  489   findFirstParameter(uint32_t type) 
const;
 
  492   static boost::logic::tribool s_defaultCanBePrefix;
 
  493   static bool s_autoCheckParametersDigest;
 
  496   std::vector<Name> m_forwardingHint;
 
  497   mutable optional<Nonce> m_nonce;
 
  499   optional<uint8_t> m_hopLimit;
 
  500   bool m_canBePrefix = 
false;
 
  501   bool m_mustBeFresh = 
false;
 
  509   std::vector<Block> m_parameters;
 
  511   mutable Block m_wire;
 
#define NDN_CXX_NODISCARD
 
Represents a TLV element of the NDN packet format.
 
bool hasWire() const noexcept
Check if the Block contains a fully encoded wire representation.
 
void reset() noexcept
Reset the Block to a default-constructed state.
 
Represents a Data packet.
 
Nonce(uint32_t n) noexcept
 
friend bool operator!=(const Nonce &lhs, const Nonce &rhs) noexcept
 
Nonce(uint8_t n1, uint8_t n2, uint8_t n3, uint8_t n4) noexcept
 
friend std::ostream & operator<<(std::ostream &os, const Nonce &nonce)
 
friend bool operator==(const Nonce &lhs, const Nonce &rhs) noexcept
 
Represents an Interest packet.
 
static void setDefaultCanBePrefix(bool canBePrefix)
Declare the default CanBePrefix setting of the application.
 
Interest & setMustBeFresh(bool mustBeFresh)
Add or remove MustBeFresh element.
 
static void setAutoCheckParametersDigest(bool b)
 
void wireDecode(const Block &wire)
Decode from wire.
 
Interest(const Name &name=Name(), time::milliseconds lifetime=DEFAULT_INTEREST_LIFETIME)
Construct an Interest with given name and lifetime.
 
const Name & getName() const noexcept
 
Block getApplicationParameters() const
Get the ApplicationParameters.
 
Interest & setHopLimit(optional< uint8_t > hopLimit)
Set the Interest's hop limit.
 
Nonce getNonce() const
Get nonce value.
 
span< const Name > getForwardingHint() const noexcept
 
bool matchesInterest(const Interest &other) const
Check if this Interest matches other.
 
Interest & setSignatureValue(ConstBufferPtr value)
Set the InterestSignatureValue.
 
bool hasApplicationParameters() const noexcept
Return whether this Interest has any ApplicationParameters.
 
time::milliseconds getInterestLifetime() const noexcept
 
bool matchesData(const Data &data) const
Check if Interest can be satisfied by data.
 
bool getMustBeFresh() const noexcept
Check whether the MustBeFresh element is present.
 
Block getSignatureValue() const
Get the InterestSignatureValue.
 
InputBuffers extractSignedRanges() const
Extract ranges of Interest covered by the signature in Packet Specification v0.3.
 
bool hasNonce() const noexcept
Check if the Nonce element is present.
 
bool getCanBePrefix() const noexcept
Check whether the CanBePrefix element is present.
 
void refreshNonce()
Change nonce value.
 
optional< uint8_t > getHopLimit() const noexcept
 
Interest & setCanBePrefix(bool canBePrefix)
Add or remove CanBePrefix element.
 
bool isSigned() const noexcept
Return whether the Interest is signed.
 
optional< SignatureInfo > getSignatureInfo() const
Get the InterestSignatureInfo.
 
Interest & unsetApplicationParameters()
Remove the ApplicationParameters element from this Interest.
 
bool isParametersDigestValid() const
Check if the ParametersSha256DigestComponent in the name is valid.
 
Interest & setName(const Name &name)
Set the Interest's name.
 
Interest & setSignatureInfo(const SignatureInfo &info)
Set the InterestSignatureInfo.
 
Interest & setApplicationParameters(const Block &block)
Set ApplicationParameters from a Block.
 
Interest & setForwardingHint(std::vector< Name > value)
 
std::string toUri() const
Return a URI-like string that represents the Interest.
 
static bool getAutoCheckParametersDigest()
 
Interest & setNonce(optional< Nonce > nonce)
Set the Interest's nonce.
 
const Block & wireEncode() const
Encode into a Block.
 
bool hasWire() const noexcept
Check if this instance has cached wire encoding.
 
Interest & setInterestLifetime(time::milliseconds lifetime)
Set the Interest's lifetime.
 
Represents an absolute name.
 
base class to allow simple management of packet tags
 
Represents a SignatureInfo or InterestSignatureInfo TLV element.
 
represents an error in TLV encoding or decoding
 
Error(const char *expectedType, uint32_t actualType)
 
#define NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(ClassName)
 
boost::chrono::milliseconds milliseconds
 
void printHex(std::ostream &os, uint64_t num, bool wantUpperCase)
Output the hex representation of num to the output stream os.
 
shared_ptr< const Buffer > ConstBufferPtr
 
const time::milliseconds DEFAULT_INTEREST_LIFETIME
default value for InterestLifetime
 
std::ostream & operator<<(std::ostream &os, const Data &data)