27 BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Data>));
 
   31 static_assert(std::is_base_of<tlv::Error, Data::Error>::value,
 
   32               "Data::Error must inherit from tlv::Error");
 
   44 template<encoding::Tag TAG>
 
   56   size_t totalLength = 0;
 
   59   if (!wantUnsignedPortionOnly) {
 
   60     if (!m_signatureInfo) {
 
   61       NDN_THROW(
Error(
"Requested wire format, but Data has not been signed"));
 
   80   if (!wantUnsignedPortionOnly) {
 
   81     totalLength += encoder.prependVarNumber(totalLength);
 
   82     totalLength += encoder.prependVarNumber(
tlv::Data);
 
   88 Data::wireEncode<encoding::EncoderTag>(
EncodingBuffer&, 
bool) 
const;
 
   96   size_t totalLength = encoder.
size();
 
   98   totalLength += encoder.appendVarNumber(signature.size());
 
   99   totalLength += encoder.appendBytes(signature);
 
  101   encoder.prependVarNumber(totalLength);
 
  148   m_signatureInfo = {};
 
  149   m_signatureValue = {};
 
  153   for (++element; element != m_wire.
elements_end(); ++element) {
 
  154     switch (element->type()) {
 
  156         if (lastElement >= 2) {
 
  164         if (lastElement >= 3) {
 
  167         m_content = *element;
 
  172         if (lastElement >= 4) {
 
  180         if (lastElement >= 5) {
 
  183         m_signatureValue = *element;
 
  198   if (!m_signatureInfo) {
 
  201   if (!m_signatureValue.
isValid()) {
 
  209   if (m_fullName.
empty()) {
 
  211       NDN_THROW(
Error(
"Cannot compute full name because Data has no wire encoding (not signed)"));
 
  230   if (name != m_name) {
 
  240   m_metaInfo = metaInfo;
 
  249     NDN_THROW(std::invalid_argument(
"Content block must be valid"));
 
  274   if (value == 
nullptr && length != 0) {
 
  275     NDN_THROW(std::invalid_argument(
"Content buffer cannot be nullptr"));
 
  284   if (value == 
nullptr) {
 
  285     NDN_THROW(std::invalid_argument(
"Content buffer cannot be nullptr"));
 
  304   m_signatureInfo = 
info;
 
  312   if (value == 
nullptr) {
 
  313     NDN_THROW(std::invalid_argument(
"SignatureValue buffer cannot be nullptr"));
 
  338   if (type != m_metaInfo.
getType()) {
 
  378   os << 
"Name: " << data.
getName() << 
"\n" 
Represents a TLV element of the NDN packet format.
 
const uint8_t * wire() const
Return a raw pointer to the beginning of the encoded wire.
 
element_const_iterator find(uint32_t type) const
Find the first sub-element of the specified TLV-TYPE.
 
uint32_t type() const
Return the TLV-TYPE of the Block.
 
size_t size() const
Return the size of the encoded wire, i.e.
 
bool hasWire() const noexcept
Check if the Block contains a fully encoded wire representation.
 
bool isValid() const noexcept
Check if the Block is valid.
 
void encode()
Encode sub-elements into TLV-VALUE.
 
Buffer::const_iterator value_begin() const
Get begin iterator of TLV-VALUE.
 
element_const_iterator elements_end() const
Equivalent to elements().end()
 
element_const_iterator elements_begin() const
Equivalent to elements().begin()
 
void reset() noexcept
Reset the Block to a default-constructed state.
 
void parse() const
Parse TLV-VALUE into sub-elements.
 
size_t value_size() const noexcept
Return the size of TLV-VALUE, aka TLV-LENGTH.
 
Represents a Data packet.
 
int32_t getSignatureType() const noexcept
Get 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 & setSignatureValue(ConstBufferPtr value)
Set SignatureValue.
 
Data(const Name &name=Name())
Construct an unsigned Data packet with given name and empty Content.
 
const MetaInfo & getMetaInfo() const noexcept
Get MetaInfo.
 
void resetWire()
Clear wire encoding and cached FullName.
 
Data & setFreshnessPeriod(time::milliseconds freshnessPeriod)
 
const Block & wireEncode() const
Encode into a Block.
 
const Name & getFullName() const
Get full name including implicit digest.
 
Data & setFinalBlock(optional< name::Component > finalBlockId)
 
bool hasContent() const noexcept
Return whether this Data has a Content element.
 
const SignatureInfo & getSignatureInfo() const noexcept
Get SignatureInfo.
 
const Name & getName() const noexcept
Get name.
 
const Block & getSignatureValue() const noexcept
Get SignatureValue.
 
Data & setSignatureInfo(const SignatureInfo &info)
Set SignatureInfo.
 
Data & setName(const Name &name)
Set name.
 
const Block & getContent() const noexcept
Get the Content element.
 
Data & setContentType(uint32_t type)
 
Data & setMetaInfo(const MetaInfo &metaInfo)
Set MetaInfo.
 
Data & unsetContent()
Remove the Content element.
 
Represents an absolute name.
 
bool empty() const
Checks if the name is empty, i.e.
 
Name & appendImplicitSha256Digest(ConstBufferPtr digest)
Append an ImplicitSha256Digest component.
 
void clear()
Remove all components.
 
size_t wireEncode(EncodingImpl< TAG > &encoder) const
Fast encoding or block size estimation.
 
void wireDecode(const Block &wire)
Decode name from wire encoding.
 
Represents a SignatureInfo or InterestSignatureInfo TLV element.
 
size_t wireEncode(EncodingImpl< TAG > &encoder, Type type=Type::Data) const
Fast encoding or block size estimation.
 
void wireDecode(const Block &wire, Type type=Type::Data)
Decode from wire format.
 
a concept check for TLV abstraction with .wireDecode method and constructible from Block
 
a concept check for TLV abstraction with .wireEncode method
 
a concept check for TLV abstraction with .wireEncode method
 
ConstBufferPtr computeDigest()
Finalize and return the digest based on all previously supplied inputs.
 
EncodingImpl< EstimatorTag > EncodingEstimator
 
Block makeBinaryBlock(uint32_t type, span< const uint8_t > value)
Create a TLV block copying the TLV-VALUE from a byte range.
 
EncodingImpl< EncoderTag > EncodingBuffer
 
size_t prependBlock(EncodingImpl< TAG > &encoder, const Block &block)
Prepend a TLV element.
 
std::string to_string(const errinfo_stacktrace &x)
 
boost::chrono::milliseconds milliseconds
 
constexpr bool isCriticalType(uint32_t type)
Determine whether a TLV-TYPE is "critical" for evolvability purpose.
 
SignatureTypeValue
SignatureType values.
 
shared_ptr< const Buffer > ConstBufferPtr
 
bool operator==(const Data &lhs, const Data &rhs)
 
std::ostream & operator<<(std::ostream &os, const Data &data)