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())
 Create a new Data with the given name and empty Content. More...
 
 Data (const Block &wire)
 Create from wire encoding. More...
 
template<encoding::Tag TAG>
size_t wireEncode (EncodingImpl< TAG > &encoder, bool wantUnsignedPortionOnly=false) const
 Fast encoding or block size estimation. More...
 
const BlockwireEncode (EncodingBuffer &encoder, const Block &signatureValue) const
 Finalize Data packet encoding with the specified SignatureValue. More...
 
const BlockwireEncode () const
 Encode to a wire format. More...
 
void wireDecode (const Block &wire)
 Decode from the wire format. More...
 
bool hasWire () const
 Check if already has wire. 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)
 
const time::milliseconds & getFreshnessPeriod () const
 
DatasetFreshnessPeriod (const time::milliseconds &freshnessPeriod)
 
const name::ComponentgetFinalBlockId () const
 
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: