22 #ifndef NDN_CXX_DATA_HPP
23 #define NDN_CXX_DATA_HPP
77 template<encoding::Tag TAG>
245 return m_signatureInfo;
267 return m_signatureValue;
304 [[nodiscard]] InputBuffers
341 const std::optional<name::Component>&
366 std::optional<KeyLocator>
388 Block m_signatureValue;
390 mutable Block m_wire;
391 mutable Name m_fullName;
395 extern template size_t
396 Data::wireEncode<encoding::EncoderTag>(
EncodingBuffer&,
bool)
const;
398 extern template size_t
411 return !(lhs == rhs);
Represents a TLV element of the NDN packet format.
bool hasWire() const noexcept
Check if the Block contains a fully encoded wire representation.
bool isValid() const noexcept
Check if the Block is valid.
Represents a Data packet.
int32_t getSignatureType() const noexcept
Get the SignatureType.
void wireDecode(const Block &wire)
Decode from wire.
InputBuffers extractSignedRanges() const
Extract ranges of Data covered by the signature.
Data & setContent(const Block &block)
Set Content from a Block.
Data(const Name &name=Name())
Construct an unsigned Data packet with given name and empty Content.
const MetaInfo & getMetaInfo() const noexcept
Get the MetaInfo element.
time::milliseconds getFreshnessPeriod() const noexcept
Return the value of FreshnessPeriod.
bool hasWire() const noexcept
Check if this instance has cached wire encoding.
void resetWire()
Clear wire encoding and cached FullName.
Data & setSignatureValue(std::nullptr_t)=delete
Data & setFreshnessPeriod(time::milliseconds freshnessPeriod)
Set the FreshnessPeriod.
const Block & wireEncode() const
Encode into a Block.
const Name & getFullName() const
Get the full name (including implicit digest).
const std::optional< name::Component > & getFinalBlock() const noexcept
Return the value of FinalBlockId.
bool hasContent() const noexcept
Return whether this Data has a Content element.
Data & setFinalBlock(std::optional< name::Component > finalBlockId)
Set the FinalBlockId.
Data & setSignatureValue(span< const uint8_t > value)
Set SignatureValue by copying from a contiguous sequence of bytes.
uint32_t getContentType() const noexcept
Return the value of ContentType.
const SignatureInfo & getSignatureInfo() const noexcept
Get the SignatureInfo element.
const Name & getName() const noexcept
Get the Data name.
const Block & getSignatureValue() const noexcept
Get the SignatureValue element.
Data & setSignatureInfo(const SignatureInfo &info)
Set the SignatureInfo element.
std::optional< KeyLocator > getKeyLocator() const noexcept
Get the KeyLocator element.
Data & setName(const Name &name)
Set the Data name.
Data & setContent(std::nullptr_t)=delete
const Block & getContent() const noexcept
Get the Content element.
Data & setContentType(uint32_t type)
Set the ContentType.
Data & setMetaInfo(const MetaInfo &metaInfo)
Set the MetaInfo element.
Data & unsetContent()
Remove the Content element.
Represents an absolute name.
Base class to allow simple management of packet tags.
Represents a SignatureInfo or InterestSignatureInfo TLV element.
int32_t getSignatureType() const noexcept
Get the SignatureType.
bool hasKeyLocator() const noexcept
Check if KeyLocator is present.
const KeyLocator & getKeyLocator() const
Get the KeyLocator element.
Represents an error in TLV encoding or decoding.
Error(const char *expectedType, uint32_t actualType)
EncodingImpl< EstimatorTag > EncodingEstimator
EncodingImpl< EncoderTag > EncodingBuffer
::boost::chrono::milliseconds milliseconds
bool operator!=(const Data &lhs, const Data &rhs)
bool operator==(const Data &lhs, const Data &rhs)
std::ostream & operator<<(std::ostream &os, const Data &data)
std::shared_ptr< const Buffer > ConstBufferPtr