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

A prefix announcement object that represents an application's intent of registering a prefix toward itself. More...

#include <prefix-announcement.hpp>

Classes

class  Error
 

Public Member Functions

 PrefixAnnouncement ()
 Construct an empty prefix announcement. More...
 
 PrefixAnnouncement (Data data)
 Decode a prefix announcement from Data. More...
 
const optional< Data > & getData () const
 Get the Data representing the prefix announcement, if available. More...
 
const DatatoData (KeyChain &keyChain, const ndn::security::SigningInfo &si=security::SigningInfo(), optional< uint64_t > version=nullopt) const
 Create a Data packet representing the prefix announcement, if it does not exist. More...
 
const NamegetAnnouncedName () const
 Return announced name. More...
 
PrefixAnnouncementsetAnnouncedName (Name name)
 Set announced name. More...
 
time::milliseconds getExpiration () const
 Return relative expiration period. More...
 
PrefixAnnouncementsetExpiration (time::milliseconds expiration)
 Set relative expiration period. More...
 
optional< security::ValidityPeriodgetValidityPeriod () const
 Return absolute validity period. More...
 
PrefixAnnouncementsetValidityPeriod (optional< security::ValidityPeriod > validity)
 Set absolute validity period. More...
 

Static Public Member Functions

static const name::ComponentgetKeywordComponent ()
 Returns the well-known keyword name component used for prefix announcements (32=PA) More...
 

Detailed Description

A prefix announcement object that represents an application's intent of registering a prefix toward itself.

See also
https://redmine.named-data.net/projects/nfd/wiki/PrefixAnnouncement

Definition at line 36 of file prefix-announcement.hpp.

Constructor & Destructor Documentation

◆ PrefixAnnouncement() [1/2]

ndn::PrefixAnnouncement::PrefixAnnouncement ( )
default

Construct an empty prefix announcement.

Postcondition
getData() == nullopt
getAnnouncedName() == "/"
getExpiration() == 0_ms

◆ PrefixAnnouncement() [2/2]

Member Function Documentation

◆ getData()

const optional<Data>& ndn::PrefixAnnouncement::getData ( ) const
inline

Get the Data representing the prefix announcement, if available.

Definition at line 62 of file prefix-announcement.hpp.

References ndn::security::v2::KeyChain, nonstd::optional_lite::nullopt, toData(), and websocketpp::http::parser::state::version.

Referenced by nfd::RibManager::slAnnounce().

◆ toData()

const Data & ndn::PrefixAnnouncement::toData ( KeyChain &  keyChain,
const ndn::security::SigningInfo si = security::SigningInfo(),
optional< uint64_t >  version = nullopt 
) const

Create a Data packet representing the prefix announcement, if it does not exist.

Parameters
keyChainKeyChain to sign the Data.
sisigning parameters.
versionversion number in Data name; if nullopt, use current Unix timestamp (in milliseconds) as the version number.
Postcondition
getData() == the returned Data

Definition at line 70 of file prefix-announcement.cpp.

References ndn::Name::append(), ndn::Name::appendSegment(), ndn::Name::appendVersion(), ndn::tlv::Content, ndn::tlv::ContentType_PrefixAnn, ndn::Block::encode(), ndn::tlv::nfd::ExpirationPeriod, getKeywordComponent(), ndn::encoding::makeNonNegativeIntegerBlock(), ndn::time::system_clock::now(), ndn::Block::push_back(), and ndn::time::toUnixTimestamp().

Referenced by getData().

◆ getAnnouncedName()

const Name& ndn::PrefixAnnouncement::getAnnouncedName ( ) const
inline

Return announced name.

Definition at line 82 of file prefix-announcement.hpp.

References setAnnouncedName().

Referenced by ndn::operator<<(), ndn::operator==(), and nfd::RibManager::slAnnounce().

◆ setAnnouncedName()

PrefixAnnouncement & ndn::PrefixAnnouncement::setAnnouncedName ( Name  name)

Set announced name.

Postcondition
getData() == nullopt

Definition at line 96 of file prefix-announcement.cpp.

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

Referenced by getAnnouncedName(), and nfd::rib::RibEntry::getPrefixAnnouncement().

◆ getExpiration()

time::milliseconds ndn::PrefixAnnouncement::getExpiration ( ) const
inline

Return relative expiration period.

Definition at line 96 of file prefix-announcement.hpp.

References setExpiration().

Referenced by nfd::rib::computeExpiration(), ndn::operator<<(), and ndn::operator==().

◆ setExpiration()

PrefixAnnouncement & ndn::PrefixAnnouncement::setExpiration ( time::milliseconds  expiration)

Set relative expiration period.

Exceptions
std::invalid_argumentexpiration period is negative.
Postcondition
getData() == nullopt

Definition at line 104 of file prefix-announcement.cpp.

References NDN_THROW.

Referenced by getExpiration(), and nfd::rib::RibEntry::getPrefixAnnouncement().

◆ getValidityPeriod()

optional<security::ValidityPeriod> ndn::PrefixAnnouncement::getValidityPeriod ( ) const
inline

Return absolute validity period.

Definition at line 111 of file prefix-announcement.hpp.

References getKeywordComponent(), ndn::operator==(), and setValidityPeriod().

Referenced by nfd::rib::computeExpiration(), ndn::operator<<(), and ndn::operator==().

◆ setValidityPeriod()

PrefixAnnouncement & ndn::PrefixAnnouncement::setValidityPeriod ( optional< security::ValidityPeriod validity)

Set absolute validity period.

Postcondition
getData() == nullopt

Definition at line 115 of file prefix-announcement.cpp.

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

Referenced by getValidityPeriod().

◆ getKeywordComponent()

const name::Component & ndn::PrefixAnnouncement::getKeywordComponent ( )
static

Returns the well-known keyword name component used for prefix announcements (32=PA)

Definition at line 123 of file prefix-announcement.cpp.

References ndn::tlv::KeywordNameComponent.

Referenced by getValidityPeriod(), PrefixAnnouncement(), and toData().


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