21 class Data :
public enable_shared_from_this<Data>
24 class Error :
public std::runtime_error
29 : std::runtime_error(what)
126 const time::milliseconds&
160 setContent(
const uint8_t* content,
size_t contentLength);
214 mutable Block m_content;
217 mutable Block m_wire;
244 size_t totalLength = 0;
254 if (!unsignedPortion && !m_signature)
256 throw Error(
"Requested wire format, but data packet has not been signed yet");
259 if (!unsignedPortion)
277 if (!unsignedPortion)
279 totalLength += block.prependVarNumber (totalLength);
280 totalLength += block.prependVarNumber (
Tlv::Data);
368 m_metaInfo = metaInfo;
384 inline const time::milliseconds&
413 if (m_content.
empty())
459 m_signature = signature;
474 return m_localControlHeader;
480 return m_localControlHeader;
519 return !(*
this == other);
525 os <<
"Name: " << data.
getName() <<
"\n";
Error(const std::string &what)
bool empty() const
Check if the Block is empty.
void wireDecode(const Block &wire)
Decode from the wire format.
void setContentType(uint32_t type)
Data()
Create an empty Data object.
uint32_t getContentType() const
element_const_iterator find(uint32_t type) const
void setInfo(const Block &info)
void setMetaInfo(const MetaInfo &metaInfo)
Set metaInfo to a copy of the given MetaInfo.
Class representing wire element of the NDN packet.
const Block & getValue() const
void setFreshnessPeriod(const time::milliseconds &freshnessPeriod)
const MetaInfo & getMetaInfo() const
bool operator!=(const Data &other) const
const Name & getName() const
element_const_iterator elements_end() const
ptr_lib::shared_ptr< const Buffer > ConstBufferPtr
size_t prependBlock(EncodingImpl< P > &encoder, const Block &block)
void setValue(const Block &value)
void setContent(const uint8_t *content, size_t contentLength)
Set the content to a copy of the data in the vector.
void setIncomingFaceId(uint64_t incomingFaceId)
const name::Component & getFinalBlockId() const
const Block & get(uint32_t type) const
Get the first subelement of the requested type.
element_container::const_iterator element_const_iterator
void reset()
Reset wire buffer of the element.
A Name holds an array of Name::Component and represents an NDN name.
size_t value_size() const
const Block & wireEncode() const
Encode to a wire format.
Data(const Block &wire)
Create a new Data object from wire encoding.
size_t wireEncode(EncodingImpl< T > &block) const
Fast encoding or block size estimation.
void parse() const
Parse wire buffer into subblocks.
const Signature & getSignature() const
Component holds a read-only name component value.
const Block & getInfo() const
void encode()
Encode subblocks into wire buffer.
void setSignatureValue(const Block &value)
uint64_t getIncomingFaceId() const
const Block & getContent() const
Get content Block.
bool operator==(const Data &other) const
Block dataBlock(uint32_t type, const char *data, size_t dataSize)
bool hasWire() const
Check if the Block has fully encoded wire.
void setName(const Name &name)
Set name to a copy of the given Name.
std::ostream & operator<<(std::ostream &os, const Data &data)
void wireDecode(const Block &wire)
void setSignature(const Signature &signature)
Set the signature to a copy of the given signature.
bool hasWire() const
Check if already has wire.
nfd::LocalControlHeader & getLocalControlHeader()
Class representing wire element of the NDN packet.
void setFinalBlockId(const name::Component &finalBlockId)
const time::milliseconds & getFreshnessPeriod() const
A Signature is storage for the signature-related information (info and value) in a Data packet...