NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
ndn::Link Class Reference

represents a Link object More...

#include <link.hpp>

Inheritance diagram for ndn::Link:
Collaboration diagram for ndn::Link:

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 DelegationListgetDelegationList () 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 BlockwireEncode (EncodingBuffer &encoder, const Block &signatureValue) const
 Finalize Data packet encoding with the specified SignatureValue. More...
 
const BlockwireEncode () 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 NamegetFullName () const
 Get full name including implicit digest. More...
 
const NamegetName () const
 Get name. More...
 
DatasetName (const Name &name)
 Set name. More...
 
const MetaInfogetMetaInfo () const
 Get MetaInfo. More...
 
DatasetMetaInfo (const MetaInfo &metaInfo)
 Set MetaInfo. More...
 
const BlockgetContent () const
 Get Content. More...
 
DatasetContent (const Block &block)
 Set Content from a block. More...
 
DatasetContent (const uint8_t *value, size_t valueSize)
 Copy Content value from raw buffer. More...
 
DatasetContent (const ConstBufferPtr &value)
 Set Content from wire buffer. More...
 
const SignaturegetSignature () const
 Get Signature. More...
 
DatasetSignature (const Signature &signature)
 Set Signature. More...
 
DatasetSignatureValue (const Block &value)
 Set SignatureValue. More...
 
uint32_t getContentType () const
 
DatasetContentType (uint32_t type)
 
time::milliseconds getFreshnessPeriod () const
 
DatasetFreshnessPeriod (time::milliseconds freshnessPeriod)
 
const optional< name::Component > & getFinalBlock () const
 
DatasetFinalBlock (optional< name::Component > finalBlockId)
 
NDN_CXX_DEPRECATED name::Component getFinalBlockId () const
 
NDN_CXX_DEPRECATED DatasetFinalBlockId (const 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...
 

Detailed Description

represents a Link object

Definition at line 32 of file link.hpp.

Constructor & Destructor Documentation

◆ Link() [1/3]

ndn::Link::Link ( )
default

Create an empty Link object.

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>();

◆ Link() [2/3]

ndn::Link::Link ( const Block wire,
bool  wantSort = true 
)
explicit

Decode a Link object from a Block.

Parameters
wirea TLV block
wantSortif 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().

◆ Link() [3/3]

ndn::Link::Link ( const Name name,
std::initializer_list< Delegation dels = {} 
)
explicit

Create a Link object with the given name and delegations.

Parameters
nameA reference to the name of the redirected namespace
delsDelegations 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);

Definition at line 40 of file link.cpp.

Member Function Documentation

◆ wireDecode()

void ndn::Link::wireDecode ( const Block wire,
bool  wantSort = true 
)

Decode from the wire format.

Parameters
wirea TLV block
wantSortif 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::DelegationList::wireDecode(), and ndn::Data::wireDecode().

Referenced by Link().

◆ getDelegationList()

const DelegationList& ndn::Link::getDelegationList ( ) const
inline

Get the delegations.

Definition at line 88 of file link.hpp.

◆ setDelegationList()

void ndn::Link::setDelegationList ( const DelegationList dels)

Set the delegations.

Note
This is more efficient than multiple addDelegation and removeDelegation invocations.

Definition at line 79 of file link.cpp.

◆ addDelegation()

void ndn::Link::addDelegation ( uint32_t  preference,
const Name name 
)

Add a delegation in the format of <Name, Preference>

Parameters
preferenceThe preference of the delegation to be added
nameThe name of the delegation to be added
Note
If a delegation with name exists, its preference will be updated

Definition at line 86 of file link.cpp.

References ndn::DelegationList::INS_REPLACE, and ndn::DelegationList::insert().

◆ removeDelegation()

bool ndn::Link::removeDelegation ( const Name name)

Remove a delegation whose name is name.

Parameters
nameThe name of the delegation to be removed
Returns
true if delegation is removed, otherwise false

Definition at line 93 of file link.cpp.

References ndn::DelegationList::erase().


The documentation for this class was generated from the following files: