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

Class for RDR-style metadata encoding/decoding. More...

#include <metadata-object.hpp>

Classes

class  Error
 

Public Member Functions

 MetadataObject ()
 Create an empty metadata object. More...
 
 MetadataObject (const Data &data)
 Construct a metadata object by decoding of the given Data packet. More...
 
Data makeData (Name discoveryInterestName, KeyChain &keyChain, const ndn::security::SigningInfo &si=KeyChain::getDefaultSigningInfo(), optional< uint64_t > version=nullopt, time::milliseconds freshnessPeriod=10_ms) const
 Create a Data packet representing this metadata object. More...
 
const NamegetVersionedName () const
 Return the versioned name (i.e., the name inside the content) More...
 
MetadataObjectsetVersionedName (const Name &name)
 Set the versioned name. More...
 

Static Public Member Functions

static bool isValidName (const Name &name)
 Check whether name can be a valid metadata name. More...
 
static Interest makeDiscoveryInterest (Name name)
 Generate a discovery interest packet based on name. More...
 

Detailed Description

Class for RDR-style metadata encoding/decoding.

The interest and data packets dealing with metadata (called "discovery interest" and "metadata", respectively) follow a specific format.

See also
https://redmine.named-data.net/projects/ndn-tlv/wiki/RDR

Realtime Data Retrieval (RDR) is a protocol for discovering the latest version number of a given data collection. There are two names in an RDR metadata object:

  • the versioned name is a prefix of the data collection, and generally contains a version component. It appears in the Content element of the metadata object.
  • the metadata name is the name of the metadata object itself, and includes a keyword name component 32=metadata, as well as version and segment components.

Definition at line 45 of file metadata-object.hpp.

Constructor & Destructor Documentation

◆ MetadataObject() [1/2]

ndn::MetadataObject::MetadataObject ( )
default

Create an empty metadata object.

◆ MetadataObject() [2/2]

ndn::MetadataObject::MetadataObject ( const Data data)
explicit

Construct a metadata object by decoding of the given Data packet.

Exceptions
tlv::Errorthe Data is not a valid metadata packet

Definition at line 35 of file metadata-object.cpp.

References ndn::tlv::ContentType_Blob, ndn::Block::get(), ndn::Data::getContent(), ndn::Data::getContentType(), ndn::Data::getName(), isValidName(), ndn::tlv::Name, ndn::Block::parse(), ndn::Name::toUri(), and ndn::Name::wireDecode().

Member Function Documentation

◆ makeData()

Data ndn::MetadataObject::makeData ( Name  discoveryInterestName,
KeyChain keyChain,
const ndn::security::SigningInfo si = KeyChain::getDefaultSigningInfo(),
optional< uint64_t >  version = nullopt,
time::milliseconds  freshnessPeriod = 10_ms 
) const

Create a Data packet representing this metadata object.

Parameters
discoveryInterestNamethe discovery Interest's name, which must end with a keyword name component 32=metadata
keyChainKeyChain to sign the Data
sisigning parameters
versionversion number of metadata packet; if nullopt, use current Unix timestamp (in milliseconds) as the version number
freshnessPeriodfreshness period of metadata packet
Exceptions
tlv::ErrordiscoveryInterestName is not valid

Definition at line 54 of file metadata-object.cpp.

References ndn::Name::appendSegment(), ndn::Name::appendVersion(), ndn::Name::empty(), ndn::KEYWORD_METADATA_COMP, ndn::Data::setContent(), ndn::Data::setFreshnessPeriod(), ndn::security::v2::KeyChain::sign(), ndn::Name::toUri(), and ndn::Name::wireEncode().

◆ getVersionedName()

const Name& ndn::MetadataObject::getVersionedName ( ) const
inline

Return the versioned name (i.e., the name inside the content)

Definition at line 90 of file metadata-object.hpp.

◆ setVersionedName()

MetadataObject & ndn::MetadataObject::setVersionedName ( const Name name)

Set the versioned name.

Any metadata packet carries a versioned name in its payload where it shows the name and the latest version of a data stream. For instance, /ndn/test/FD%97%47%1E%6C is a versioned name that shows the latest version of /ndn/test.

Definition at line 76 of file metadata-object.cpp.

◆ isValidName()

bool ndn::MetadataObject::isValidName ( const Name name)
static

Check whether name can be a valid metadata name.

Definition at line 83 of file metadata-object.cpp.

References ndn::KEYWORD_METADATA_COMP.

Referenced by MetadataObject().

◆ makeDiscoveryInterest()

Interest ndn::MetadataObject::makeDiscoveryInterest ( Name  name)
static

Generate a discovery interest packet based on name.

Parameters
nameprefix of data collection

Definition at line 90 of file metadata-object.cpp.

References ndn::tlv::Interest, and ndn::KEYWORD_METADATA_COMP.


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