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)
 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...
 
void wireDecode (const Block &wire)
 Decode from the wire format. More...
 
span< const NamegetDelegationList () const
 Get the delegations. More...
 
void setDelegationList (std::vector< Name > delegations)
 Set the delegations. More...
 
bool addDelegation (const Name &name)
 Append a delegation at the end. 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. More...
 
const BlockwireEncode (EncodingBuffer &encoder, span< const uint8_t > signature) const
 Finalize Data packet encoding with the specified signature. More...
 
const BlockwireEncode () const
 Encode into a Block. More...
 
void wireDecode (const Block &wire)
 Decode from wire. More...
 
bool hasWire () const noexcept
 Check if this instance has cached wire encoding. More...
 
const NamegetFullName () const
 Get full name including implicit digest. More...
 
const NamegetName () const noexcept
 Get name. More...
 
DatasetName (const Name &name)
 Set name. More...
 
const MetaInfogetMetaInfo () const noexcept
 Get MetaInfo. More...
 
DatasetMetaInfo (const MetaInfo &metaInfo)
 Set MetaInfo. More...
 
bool hasContent () const noexcept
 Return whether this Data has a Content element. More...
 
const BlockgetContent () const noexcept
 Get the Content element. More...
 
DatasetContent (const Block &block)
 Set Content from a Block. More...
 
DatasetContent (span< const uint8_t > value)
 Set Content by copying from a contiguous sequence of bytes. More...
 
DatasetContent (const uint8_t *value, size_t length)
 Set Content by copying from a raw buffer. More...
 
DatasetContent (ConstBufferPtr value)
 Set Content from a shared buffer. More...
 
DataunsetContent ()
 Remove the Content element. More...
 
const SignatureInfogetSignatureInfo () const noexcept
 Get SignatureInfo. More...
 
DatasetSignatureInfo (const SignatureInfo &info)
 Set SignatureInfo. More...
 
const BlockgetSignatureValue () const noexcept
 Get SignatureValue. More...
 
DatasetSignatureValue (ConstBufferPtr value)
 Set SignatureValue. More...
 
InputBuffers extractSignedRanges () const
 Extract ranges of Data covered by the signature. 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)
 
int32_t getSignatureType () const noexcept
 Get SignatureType. More...
 
optional< KeyLocatorgetKeyLocator () const noexcept
 Get KeyLocator. More...
 
- 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 31 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)
explicit

Decode a Link object from a Block.

Parameters
wirea TLV block

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< Name delegations = {} 
)
explicit

Create a Link object with the given name and delegations.

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

Definition at line 40 of file link.cpp.

References ndn::tlv::Content, ndn::tlv::ContentType_Link, ndn::encoding::makeNestedBlock(), ndn::Data::setContent(), and ndn::Data::setContentType().

Member Function Documentation

◆ wireDecode()

void ndn::Link::wireDecode ( const Block wire)

Decode from the wire format.

Parameters
wirea TLV block

Definition at line 61 of file link.cpp.

References ndn::tlv::ContentType_Link, ndn::Data::getContent(), ndn::Data::getContentType(), ndn::tlv::isCriticalType(), ndn::tlv::Name, NDN_THROW, ndn::to_string(), and ndn::Data::wireDecode().

Referenced by Link().

◆ getDelegationList()

span<const Name> ndn::Link::getDelegationList ( ) const
inline

Get the delegations.

Definition at line 81 of file link.hpp.

References addDelegation(), removeDelegation(), and setDelegationList().

◆ setDelegationList()

void ndn::Link::setDelegationList ( std::vector< Name delegations)

Set the delegations.

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

Definition at line 85 of file link.cpp.

References nonstd::optional_lite::std11::move().

Referenced by getDelegationList().

◆ addDelegation()

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

Append a delegation at the end.

Parameters
nameDelegation name
Returns
true if delegation is added, false if same name already exists

Definition at line 92 of file link.cpp.

Referenced by getDelegationList().

◆ removeDelegation()

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

Remove a delegation whose name is name.

Parameters
nameDelegation name
Returns
true if delegation is removed, otherwise false

Definition at line 104 of file link.cpp.

Referenced by getDelegationList().


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