represents a Link object More...
#include <link.hpp>
Classes | |
class | Error |
Public Member Functions | |
Link () | |
Create an empty Link object. More... | |
Link (const Block &wire, bool wantSort=true) | |
Decode a Link object from a Block. More... | |
Link (const Name &name, std::initializer_list< Delegation > dels={}) | |
Create a Link object with the given name and delegations. More... | |
void | wireDecode (const Block &wire, bool wantSort=true) |
Decode from the wire format. More... | |
const DelegationList & | getDelegationList () const |
Get the delegations. More... | |
void | setDelegationList (const DelegationList &dels) |
Set the delegations. More... | |
void | addDelegation (uint32_t preference, const Name &name) |
Add a delegation in the format of <Name, Preference> More... | |
bool | removeDelegation (const Name &name) |
Remove a delegation whose name is name . More... | |
Public Member Functions inherited from ndn::Data | |
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... | |
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... | |
void | wireDecode (const Block &wire) |
Decode from wire in NDN Packet Format v0.2 or v0.3. More... | |
bool | hasWire () const |
Check if this instance has cached wire encoding. More... | |
const Name & | getFullName () const |
Get full name including implicit digest. More... | |
const Name & | getName () const |
Get name. More... | |
Data & | setName (const Name &name) |
Set name. More... | |
const MetaInfo & | getMetaInfo () const |
Get MetaInfo. More... | |
Data & | setMetaInfo (const MetaInfo &metaInfo) |
Set MetaInfo. More... | |
const Block & | getContent () const |
Get Content. 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... | |
const Signature & | getSignature () const |
Get Signature. More... | |
Data & | setSignature (const Signature &signature) |
Set Signature. More... | |
Data & | setSignatureValue (const Block &value) |
Set SignatureValue. More... | |
uint32_t | getContentType () const |
Data & | setContentType (uint32_t type) |
time::milliseconds | getFreshnessPeriod () const |
Data & | setFreshnessPeriod (time::milliseconds freshnessPeriod) |
const optional< name::Component > & | getFinalBlock () const |
Data & | setFinalBlock (optional< name::Component > finalBlockId) |
Public Member Functions inherited from ndn::PacketBase | |
uint64_t | getCongestionMark () const |
get the value of the CongestionMark tag More... | |
void | setCongestionMark (uint64_t mark) |
set the CongestionMark tag to the specified value More... | |
Public Member Functions inherited from ndn::TagHost | |
template<typename T > | |
shared_ptr< T > | getTag () const |
get a tag item More... | |
template<typename T > | |
void | setTag (shared_ptr< T > tag) const |
set a tag item More... | |
template<typename T > | |
void | removeTag () const |
remove tag item More... | |
Additional Inherited Members | |
Protected Member Functions inherited from ndn::Data | |
void | resetWire () |
Clear wire encoding and cached FullName. More... | |
|
default |
|
explicit |
Decode a Link object from a Block.
wire | a TLV block |
wantSort | if false, relative order among delegations is preserved |
Note that in certain contexts that use Link::shared_from_this(), Link must be created using make_shared
:
shared_ptr<Link> linkObject = make_shared<Link>(block);
Definition at line 35 of file link.cpp.
References wireDecode().
|
explicit |
Create a Link object with the given name and delegations.
name | A reference to the name of the redirected namespace |
dels | 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, dels);
void ndn::Link::wireDecode | ( | const Block & | wire, |
bool | wantSort = true |
||
) |
Decode from the wire format.
wire | a TLV block |
wantSort | if false, relative order among delegations is preserved |
Definition at line 67 of file link.cpp.
References ndn::tlv::ContentType_Link, ndn::Data::getContent(), ndn::Data::getContentType(), NDN_THROW, ndn::to_string(), ndn::DelegationList::wireDecode(), and ndn::Data::wireDecode().
Referenced by Link().
|
inline |
void ndn::Link::setDelegationList | ( | const DelegationList & | dels | ) |
void ndn::Link::addDelegation | ( | uint32_t | preference, |
const Name & | name | ||
) |
Add a delegation in the format of <Name, Preference>
preference | The preference of the delegation to be added |
name | The name of the delegation to be added |
name
exists, its preference will be updated Definition at line 86 of file link.cpp.
References ndn::DelegationList::INS_REPLACE, and ndn::DelegationList::insert().
bool ndn::Link::removeDelegation | ( | const Name & | name | ) |
Remove a delegation whose name is name
.
name | The name of the delegation to be removed |
Definition at line 93 of file link.cpp.
References ndn::DelegationList::erase().