Public Member Functions | List of all members
ndn::Link Class Reference

The Link class extends Data and represents a Link instance where the Data content is an encoded delegation set. More...

#include <link.hpp>

Inheritance diagram for ndn::Link:
ndn::Data

Public Member Functions

 Link ()
 Create a Link with default values and where the list of delegations is empty and the meta info type is LINK.
 
 Link (const Name &name)
 Create a Link with the given name and default values and where the list of delegations is empty and the meta info type is LINK. More...
 
 Link (const Data &data)
 Create a Link, copying values from the other Data object. More...
 
virtual void wireDecode (const Blob &input, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat())
 Override to call the base class wireDecode then populate the list of delegations from the content. More...
 
LinkaddDelegation (int preference, const Name &name, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat())
 Add a new delegation to the list of delegations, sorted by preference number then by name. More...
 
bool removeDelegation (const Name &name, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat())
 Remove every delegation with the given name. More...
 
const DelegationSetgetDelegations () const
 Get the list of delegation for read only. More...
 
- Public Member Functions inherited from ndn::Data
 Data ()
 Create a new Data object with default values and where the signature is a blank Sha256WithRsaSignature.
 
 Data (const Name &name)
 Create a new Data object with the given name and default values and where the signature is a blank Sha256WithRsaSignature. More...
 
 Data (const Data &data)
 The copy constructor: Create a deep copy of the given data object, including a clone of the signature object. More...
 
virtual ~Data ()
 The virtual destructor.
 
Dataoperator= (const Data &data)
 The assignment operator: Copy fields and make a clone of the signature. More...
 
SignedBlob wireEncode (WireFormat &wireFormat=*WireFormat::getDefaultWireFormat()) const
 Encode this Data for a particular wire format. More...
 
void wireDecode (const uint8_t *input, size_t inputLength, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat())
 Decode the input using a particular wire format and update this Data. More...
 
void wireDecode (const std::vector< uint8_t > &input, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat())
 Decode the input using a particular wire format and update this Data. More...
 
void get (DataLite &dataLite) const
 Set dataLite to point to the values in this Data object, without copying any memory. More...
 
void set (const DataLite &dataLite)
 Clear this data object, and set the values by copying from dataLite. More...
 
const SignaturegetSignature () const
 
SignaturegetSignature ()
 
const NamegetName () const
 
NamegetName ()
 
const MetaInfogetMetaInfo () const
 
MetaInfogetMetaInfo ()
 
const BlobgetContent () const
 
uint64_t getIncomingFaceId () const
 Get the incoming face ID according to the incoming packet header. More...
 
const SignedBlobgetDefaultWireEncoding () const
 Return a reference to the defaultWireEncoding, which was encoded with getDefaultWireEncodingFormat(). More...
 
WireFormatgetDefaultWireEncodingFormat () const
 Get the WireFormat which is used by getDefaultWireEncoding(). More...
 
DatasetSignature (const Signature &signature)
 Set the signature to a copy of the given signature. More...
 
virtual DatasetName (const Name &name)
 Set name to a copy of the given Name. More...
 
DatasetMetaInfo (const MetaInfo &metaInfo)
 Set metaInfo to a copy of the given MetaInfo. More...
 
DatasetContent (const std::vector< uint8_t > &content)
 Set the content to a copy of the data in the vector. More...
 
DatasetContent (const uint8_t *content, size_t contentLength)
 
DatasetContent (const Blob &content)
 
DatasetLpPacket (const ptr_lib::shared_ptr< LpPacket > &lpPacket)
 An internal library method to set the LpPacket for an incoming packet. More...
 
uint64_t getChangeCount () const
 Get the change count, which is incremented each time this object (or a child object) is changed. More...
 

Detailed Description

The Link class extends Data and represents a Link instance where the Data content is an encoded delegation set.

The format is defined in "link.pdf" attached to Redmine issue http://redmine.named-data.net/issues/2587 .

Constructor & Destructor Documentation

ndn::Link::Link ( const Name name)
inline

Create a Link with the given name and default values and where the list of delegations is empty and the meta info type is LINK.

Parameters
nameThe name which is copied.
ndn::Link::Link ( const Data data)

Create a Link, copying values from the other Data object.

If the content can be decoded using the default wire encoding, then update the list of delegations.

Parameters
dataThe Data object to copy values from.

Member Function Documentation

Link& ndn::Link::addDelegation ( int  preference,
const Name name,
WireFormat wireFormat = *WireFormat::getDefaultWireFormat() 
)
inline

Add a new delegation to the list of delegations, sorted by preference number then by name.

Re-encode this object's content using the given wireFormat.

Parameters
preferenceThe preference number.
nameThe delegation name. This makes a copy of the name. If there is already a delegation with the same name, this updates its preference.
wireFormat(optional) A WireFormat object used to encode this DelegationSet. If omitted, use WireFormat::getDefaultWireFormat().
Returns
This Link so that you can chain calls to update values.
const DelegationSet& ndn::Link::getDelegations ( ) const
inline

Get the list of delegation for read only.

Returns
The list of delegation for read only. To modify it, call Link::addDelegation, etc.
bool ndn::Link::removeDelegation ( const Name name,
WireFormat wireFormat = *WireFormat::getDefaultWireFormat() 
)
inline

Remove every delegation with the given name.

Re-encode this object's content using the given wireFormat.

Parameters
nameThen name to match the name of the delegation(s) to be removed.
wireFormat(optional) A WireFormat object used to encode this DelegationSet. If omitted, use WireFormat::getDefaultWireFormat().
Returns
True if a delegation was removed, otherwise false.
void ndn::Link::wireDecode ( const Blob input,
WireFormat wireFormat = *WireFormat::getDefaultWireFormat() 
)
virtual

Override to call the base class wireDecode then populate the list of delegations from the content.

Parameters
inputThe input byte array to be decoded as an immutable Blob.
wireFormat(optional) A WireFormat object used to decode the input. If omitted, use WireFormat::getDefaultWireFormat().

Reimplemented from ndn::Data.


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