22 #ifndef NDN_CXX_DATA_HPP 23 #define NDN_CXX_DATA_HPP 73 template<encoding::Tag TAG>
112 return m_wire.hasWire();
157 return m_content.isValid();
195 setContent(
const uint8_t* value,
size_t length);
216 [[deprecated(
"use getSignatureInfo and getSignatureValue")]]
224 [[deprecated(
"use setSignatureInfo and setSignatureValue")]]
233 return m_signatureInfo;
253 return m_signatureValue;
279 return m_metaInfo.getType();
288 return m_metaInfo.getFreshnessPeriod();
294 const optional<name::Component>&
297 return m_metaInfo.getFinalBlock();
310 return m_signatureInfo.getSignatureType();
318 return m_signatureInfo.hasKeyLocator() ? make_optional(m_signatureInfo.getKeyLocator()) : nullopt;
333 Block m_signatureValue;
335 mutable Block m_wire;
336 mutable Name m_fullName;
340 extern template size_t 341 Data::wireEncode<encoding::EncoderTag>(
EncodingBuffer&, bool)
const;
343 extern template size_t 356 return !(lhs == rhs);
361 #endif // NDN_CXX_DATA_HPP const Block & wireEncode() const
Encode into a Block.
Data & setContentType(uint32_t type)
Represents a SignatureInfo or InterestSignatureInfo TLV element.
void wireDecode(const Block &wire)
Decode from wire.
Data & setSignatureValue(ConstBufferPtr value)
Set SignatureValue.
Data & setSignature(const Signature &signature)
Set Signature.
Data & setName(const Name &name)
Set name.
std::ostream & operator<<(std::ostream &os, const Data &data)
Data(const Name &name=Name())
Construct an unsigned Data packet with given name and empty Content.
Data & setContent(const Block &block)
Set Content from a Block.
void resetWire()
Clear wire encoding and cached FullName.
Represents a TLV element of the NDN packet format.
optional< KeyLocator > getKeyLocator() const noexcept
Get KeyLocator.
bool operator!=(const Data &lhs, const Data &rhs)
const Block & getSignatureValue() const noexcept
Get SignatureValue.
bool hasWire() const noexcept
Check if this instance has cached wire encoding.
int32_t getSignatureType() const noexcept
Get SignatureType.
Data & setSignatureInfo(const SignatureInfo &info)
Set SignatureInfo.
InputBuffers extractSignedRanges() const
Extract ranges of Data covered by the signature.
base class to allow simple management of packet tags
const Name & getName() const noexcept
Get name.
Represents an absolute name.
const MetaInfo & getMetaInfo() const noexcept
Get MetaInfo.
const Name & getFullName() const
Get full name including implicit digest.
Data & setFreshnessPeriod(time::milliseconds freshnessPeriod)
Data & setFinalBlock(optional< name::Component > finalBlockId)
const Block & getContent() const noexcept
Get the Content element.
Data & unsetContent()
Remove the Content element.
bool operator==(const Data &lhs, const Data &rhs)
Data & setMetaInfo(const MetaInfo &metaInfo)
Set MetaInfo.
time::milliseconds getFreshnessPeriod() const
Represents a Data packet.
bool hasContent() const noexcept
Return whether this Data has a Content element.
uint32_t getContentType() const
const optional< name::Component > & getFinalBlock() const
Signature getSignature() const
Get Signature.
EncodingImpl< EncoderTag > EncodingBuffer
Error(const char *expectedType, uint32_t actualType)
represents an error in TLV encoding or decoding
EncodingImpl< EstimatorTag > EncodingEstimator
const SignatureInfo & getSignatureInfo() const noexcept
Get SignatureInfo.
Holds SignatureInfo and SignatureValue in a Data packet.
shared_ptr< const Buffer > ConstBufferPtr