Represents a Data packet. More...
#include <data.hpp>
Inheritance diagram for ndn::Data:
Collaboration diagram for ndn::Data:Classes | |
| class | Error |
Public Member Functions | |
| Data (const Name &name=Name()) | |
Construct an unsigned Data packet with given name and empty Content. More... | |
| Data (const Block &wire) | |
Construct a Data packet by decoding from wire. More... | |
| uint64_t | getCongestionMark () const |
| get the value of the CongestionMark tag More... | |
| const Block & | getContent () const |
| Get Content. More... | |
| uint32_t | getContentType () const |
| const optional< name::Component > & | getFinalBlock () const |
| name::Component | getFinalBlockId () const |
| time::milliseconds | getFreshnessPeriod () const |
| const Name & | getFullName () const |
| Get full name including implicit digest. More... | |
| const MetaInfo & | getMetaInfo () const |
| Get MetaInfo. More... | |
| const Name & | getName () const |
| Get name. More... | |
| const Signature & | getSignature () const |
| Get Signature. More... | |
| template<typename T > | |
| shared_ptr< T > | getTag () const |
| get a tag item More... | |
| bool | hasWire () const |
| Check if this instance has cached wire encoding. More... | |
| template<typename T > | |
| void | removeTag () const |
| remove tag item More... | |
| void | setCongestionMark (uint64_t mark) |
| set the CongestionMark tag to the specified value More... | |
| Data & | setContent (const Block &block) |
| Set Content from a block. More... | |
| Data & | setContent (const uint8_t *value, size_t valueSize) |
| Copy Content value from raw buffer. More... | |
| Data & | setContent (ConstBufferPtr value) |
| Set Content from wire buffer. More... | |
| Data & | setContentType (uint32_t type) |
| Data & | setFinalBlock (optional< name::Component > finalBlockId) |
| Data & | setFinalBlockId (const name::Component &finalBlockId) |
| Data & | setFreshnessPeriod (time::milliseconds freshnessPeriod) |
| Data & | setMetaInfo (const MetaInfo &metaInfo) |
| Set MetaInfo. More... | |
| Data & | setName (const Name &name) |
| Set name. More... | |
| Data & | setSignature (const Signature &signature) |
| Set Signature. More... | |
| Data & | setSignatureValue (const Block &value) |
| Set SignatureValue. More... | |
| template<typename T > | |
| void | setTag (shared_ptr< T > tag) const |
| set a tag item More... | |
| void | wireDecode (const Block &wire) |
Decode from wire in NDN Packet Format v0.2 or v0.3. More... | |
| template<encoding::Tag TAG> | |
| size_t | wireEncode (EncodingImpl< TAG > &encoder, bool wantUnsignedPortionOnly=false) const |
Prepend wire encoding to encoder in NDN Packet Format v0.2. More... | |
| const Block & | wireEncode (EncodingBuffer &encoder, const Block &signatureValue) const |
| Finalize Data packet encoding with the specified SignatureValue. More... | |
| const Block & | wireEncode () const |
Encode to a Block. More... | |
Protected Member Functions | |
| void | resetWire () |
| Clear wire encoding and cached FullName. More... | |
|
explicit |
Construct a Data packet by decoding from wire.
| wire | tlv::Data element as defined in NDN Packet Format v0.2 or v0.3. It may be signed or unsigned. |
Data::shared_from_this(), Data must be created using make_shared. Otherwise, shared_from_this() will trigger undefined behavior.
|
inherited |
get the value of the CongestionMark tag
Definition at line 28 of file packet-base.cpp.
| const Block & ndn::Data::getContent | ( | ) | const |
|
inline |
| name::Component ndn::Data::getFinalBlockId | ( | ) | const |
getFinalBlock
|
inline |
| const Name & ndn::Data::getFullName | ( | ) | const |
|
inline |
|
inline |
|
inherited |
get a tag item
| T | type of the tag, which must be a subclass of ndn::Tag |
| nullptr | if no Tag of type T is stored |
Definition at line 66 of file tag-host.hpp.
|
inline |
|
inherited |
remove tag item
Definition at line 93 of file tag-host.hpp.
|
protected |
|
inherited |
set the CongestionMark tag to the specified value
Definition at line 41 of file packet-base.cpp.
| Data & ndn::Data::setContent | ( | const uint8_t * | value, |
| size_t | valueSize | ||
| ) |
| Data & ndn::Data::setContent | ( | ConstBufferPtr | value | ) |
| Data & ndn::Data::setFinalBlock | ( | optional< name::Component > | finalBlockId | ) |
| Data & ndn::Data::setFinalBlockId | ( | const name::Component & | finalBlockId | ) |
setFinalBlock | Data & ndn::Data::setFreshnessPeriod | ( | time::milliseconds | freshnessPeriod | ) |
|
inherited |
set a tag item
| T | type of the tag, which must be a subclass of ndn::Tag |
Definition at line 79 of file tag-host.hpp.
| void ndn::Data::wireDecode | ( | const Block & | wire | ) |
| size_t ndn::Data::wireEncode | ( | EncodingImpl< TAG > & | encoder, |
| bool | wantUnsignedPortionOnly = false |
||
| ) | const |
Prepend wire encoding to encoder in NDN Packet Format v0.2.
| encoder | EncodingEstimator or EncodingBuffer instance |
| wantUnsignedPortionOnly | If true, only prepends Name, MetaInfo, Content, and SignatureInfo to encoder, but omit SignatureValue and outmost Type-Length of Data element. This is intended to be used with wireEncode(encoder, signatureValue). |
| Error | SignatureBits are not provided and wantUnsignedPortionOnly is false. |
| const Block & ndn::Data::wireEncode | ( | EncodingBuffer & | encoder, |
| const Block & | signatureValue | ||
| ) | const |
Finalize Data packet encoding with the specified SignatureValue.
| encoder | EncodingBuffer containing Name, MetaInfo, Content, and SignatureInfo, but without SignatureValue or outmost Type-Length of Data element |
| signatureValue | SignatureValue element |
This method is intended to be used in concert with Data::wireEncode(encoder, true)
| const Block & ndn::Data::wireEncode | ( | ) | const |