Represents a LinkObject
TLV element.
More...
#include <ndn-cxx/link.hpp>
Classes | |
class | Error |
Public Member Functions | |
Link () | |
Create an empty Link object. More... | |
Link (const Block &wire) | |
Decode a Link object from a Block. More... | |
Link (const Name &name, std::initializer_list< Name > delegations={}) | |
Create a Link object with the given name and delegations. More... | |
bool | addDelegation (const Name &name) |
Append a delegation at the end. More... | |
InputBuffers | extractSignedRanges () const |
Extract ranges of Data covered by the signature. More... | |
uint64_t | getCongestionMark () const |
Get the value of the CongestionMark tag. More... | |
const Block & | getContent () const noexcept |
Get the Content element. More... | |
uint32_t | getContentType () const noexcept |
Return the value of ContentType . More... | |
span< const Name > | getDelegationList () const |
Get the delegations. More... | |
const std::optional< name::Component > & | getFinalBlock () const noexcept |
Return the value of FinalBlockId . More... | |
time::milliseconds | getFreshnessPeriod () const noexcept |
Return the value of FreshnessPeriod . More... | |
const Name & | getFullName () const |
Get the full name (including implicit digest). More... | |
std::optional< KeyLocator > | getKeyLocator () const noexcept |
Get the KeyLocator element. More... | |
const MetaInfo & | getMetaInfo () const noexcept |
Get the MetaInfo element. More... | |
const Name & | getName () const noexcept |
Get the Data name. More... | |
const SignatureInfo & | getSignatureInfo () const noexcept |
Get the SignatureInfo element. More... | |
int32_t | getSignatureType () const noexcept |
Get the SignatureType . More... | |
const Block & | getSignatureValue () const noexcept |
Get the SignatureValue element. More... | |
template<typename T > | |
std::shared_ptr< T > | getTag () const |
Get a tag item. More... | |
bool | hasContent () const noexcept |
Return whether this Data has a Content element. More... | |
bool | hasWire () const noexcept |
Check if this instance has cached wire encoding. More... | |
bool | removeDelegation (const Name &name) |
Remove a delegation whose name is name . More... | |
template<typename T > | |
void | removeTag () const |
Remove a 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 (ConstBufferPtr value) |
Set Content from a shared buffer. More... | |
Data & | setContent (span< const uint8_t > value) |
Set Content by copying from a contiguous sequence of bytes. More... | |
Data & | setContent (std::nullptr_t)=delete |
Data & | setContent (std::string_view value) |
Set Content by copying from a string. More... | |
Data & | setContentType (uint32_t type) |
Set the ContentType . More... | |
void | setDelegationList (std::vector< Name > delegations) |
Set the delegations. More... | |
Data & | setFinalBlock (std::optional< name::Component > finalBlockId) |
Set the FinalBlockId . More... | |
Data & | setFreshnessPeriod (time::milliseconds freshnessPeriod) |
Set the FreshnessPeriod . More... | |
Data & | setMetaInfo (const MetaInfo &metaInfo) |
Set the MetaInfo element. More... | |
Data & | setName (const Name &name) |
Set the Data name. More... | |
Data & | setSignatureInfo (const SignatureInfo &info) |
Set the SignatureInfo element. More... | |
Data & | setSignatureValue (ConstBufferPtr value) |
Set SignatureValue from a shared buffer. More... | |
Data & | setSignatureValue (span< const uint8_t > value) |
Set SignatureValue by copying from a contiguous sequence of bytes. More... | |
Data & | setSignatureValue (std::nullptr_t)=delete |
template<typename T > | |
void | setTag (std::shared_ptr< T > tag) const |
Set (add or replace) a tag item. More... | |
Data & | unsetContent () |
Remove the Content element. More... | |
void | wireDecode (const Block &wire) |
Decode from the wire format. More... | |
const Block & | wireEncode () const |
Encode into a Block. More... | |
const Block & | wireEncode (EncodingBuffer &encoder, span< const uint8_t > signature) const |
Finalize Data packet encoding with the specified signature. More... | |
template<encoding::Tag TAG> | |
size_t | wireEncode (EncodingImpl< TAG > &encoder, bool wantUnsignedPortionOnly=false) const |
Prepend wire encoding to encoder . More... | |
Protected Member Functions | |
void | resetWire () |
Clear wire encoding and cached FullName. More... | |
Represents a LinkObject
TLV element.
|
default |
|
explicit |
Create a Link object with the given name and delegations.
name | A reference to the name of the redirected namespace |
delegations | Delegations in payload |
Note that in certain contexts that use Link::shared_from_this(), Link must be created using make_shared
:
shared_ptr<Link> link = make_shared<Link>(name, delegations);
bool ndn::Link::addDelegation | ( | const Name & | name | ) |
|
inherited |
Extract ranges of Data covered by the signature.
|
inherited |
Get the value of the CongestionMark tag.
Definition at line 28 of file packet-base.cpp.
|
inlinenoexceptinherited |
Get the Content
element.
If the element is not present (hasContent() == false), an invalid Block will be returned.
The value of the returned Content Block (if valid) can be accessed through
|
inlinenoexceptinherited |
Return the value of ContentType
.
If the ContentType
element is not present, returns tlv::ContentType_Blob.
|
inline |
|
inlinenoexceptinherited |
|
inlinenoexceptinherited |
Return the value of FreshnessPeriod
.
If the FreshnessPeriod
element is not present, returns DEFAULT_FRESHNESS_PERIOD. If the FreshnessPeriod
value is not representable in the return type, it's clamped to the nearest representable value.
|
inherited |
|
inlinenoexceptinherited |
Get the KeyLocator
element.
|
inlinenoexceptinherited |
|
inlinenoexceptinherited |
|
inlinenoexceptinherited |
Get the SignatureInfo
element.
|
inlinenoexceptinherited |
Get the SignatureType
.
|
inlinenoexceptinherited |
|
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 72 of file tag-host.hpp.
|
inlinenoexceptinherited |
|
inlinenoexceptinherited |
bool ndn::Link::removeDelegation | ( | const Name & | name | ) |
|
inherited |
Remove a tag item.
T | type of the tag, which must be a subclass of ndn::Tag |
Definition at line 98 of file tag-host.hpp.
|
protectedinherited |
|
inherited |
Set the CongestionMark tag to the specified value.
Definition at line 41 of file packet-base.cpp.
Set Content
from a Block.
block | TLV element to be used as Content; must be valid |
If the block's TLV-TYPE is tlv::Content, it will be used directly as this Data's Content element. Otherwise, the block will be nested into a Content element.
|
inherited |
|
inherited |
|
deleteinherited |
|
inherited |
|
inherited |
Set the ContentType
.
type | A number defined in tlv::ContentTypeValue |
void ndn::Link::setDelegationList | ( | std::vector< Name > | delegations | ) |
|
inherited |
|
inherited |
|
inherited |
Set the SignatureInfo
element.
This is a low-level function that should not normally be called directly by applications. Instead, provide a SignatureInfo to the SigningInfo object passed to KeyChain::sign().
|
inherited |
Set SignatureValue
from a shared buffer.
value | buffer containing the TLV-VALUE of the SignatureValue; must not be null |
This is a low-level function that should not normally be called directly by applications. Instead, use KeyChain::sign() to sign the packet.
|
inherited |
Set SignatureValue
by copying from a contiguous sequence of bytes.
value | buffer from which the TLV-VALUE of the SignatureValue will be copied |
This is a low-level function that should not normally be called directly by applications. Instead, use KeyChain::sign() to sign the packet.
|
deleteinherited |
|
inherited |
Set (add or replace) a tag item.
T | type of the tag, which must be a subclass of ndn::Tag |
Definition at line 84 of file tag-host.hpp.
|
inherited |
Remove the Content
element.
void ndn::Link::wireDecode | ( | const Block & | wire | ) |
|
inherited |
|
inherited |
Finalize Data packet encoding with the specified signature.
encoder | EncodingBuffer containing Name, MetaInfo, Content, and SignatureInfo, but without SignatureValue and the outermost Type-Length of the Data element. |
signature | Raw signature bytes, without TLV Type and Length; this will become the TLV-VALUE of the SignatureValue element added to the packet. |
This method is intended to be used in concert with wireEncode(encoder, true)
, e.g.:
|
inherited |
Prepend wire encoding to encoder
.
encoder | EncodingEstimator or EncodingBuffer instance. |
wantUnsignedPortionOnly | If true, prepend only Name, MetaInfo, Content, and SignatureInfo to encoder , but omit SignatureValue and the outermost TLV Type and Length of the Data element. This is intended to be used with wireEncode(EncodingBuffer&, span<const uint8_t>) const. |
Error | Signature is not present and wantUnsignedPortionOnly is false. |