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 Data & | toData (KeyChain &keyChain, const ndn::security::SigningInfo &si=KeyChain::getDefaultSigningInfo(), optional< uint64_t > version=nullopt) const |
Create a Data packet representing the prefix announcement, if it does not exist. More... | |
const Name & | getAnnouncedName () const |
Return announced name. More... | |
PrefixAnnouncement & | setAnnouncedName (Name name) |
Set announced name. More... | |
time::milliseconds | getExpiration () const |
Return relative expiration period. More... | |
PrefixAnnouncement & | setExpiration (time::milliseconds expiration) |
Set relative expiration period. More... | |
optional< security::ValidityPeriod > | getValidityPeriod () const |
Return absolute validity period. More... | |
PrefixAnnouncement & | setValidityPeriod (optional< security::ValidityPeriod > validity) |
Set absolute validity period. More... | |
A prefix announcement object that represents an application's intent of registering a prefix toward itself.
Definition at line 33 of file prefix-announcement.hpp.
|
default |
Construct an empty prefix announcement.
|
explicit |
Decode a prefix announcement from Data.
tlv::Error | the Data is not a prefix announcement. |
Definition at line 33 of file prefix-announcement.cpp.
References ndn::tlv::ContentType_PrefixAnn, ndn::Block::elements(), ndn::Block::elements_end(), ndn::tlv::nfd::ExpirationPeriod, ndn::Block::find(), ndn::Block::get(), ndn::Name::getPrefix(), ndn::tlv::isCriticalType(), ndn::KEYWORD_PA_COMP, ndn::Block::parse(), ndn::encoding::readNonNegativeInteger(), ndn::Name::size(), ndn::to_string(), and ndn::tlv::ValidityPeriod.
|
inline |
Get the Data representing the prefix announcement, if available.
Definition at line 59 of file prefix-announcement.hpp.
Referenced by nfd::rib::RibManager::slAnnounce().
const Data & ndn::PrefixAnnouncement::toData | ( | KeyChain & | keyChain, |
const ndn::security::SigningInfo & | si = KeyChain::getDefaultSigningInfo() , |
||
optional< uint64_t > | version = nullopt |
||
) | const |
Create a Data packet representing the prefix announcement, if it does not exist.
keyChain | KeyChain to sign the Data. |
si | signing parameters. |
version | version number in Data name; if nullopt, use current Unix timestamp (in milliseconds) as the version number. |
Definition at line 68 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, ndn::KEYWORD_PA_COMP, ndn::encoding::makeNonNegativeIntegerBlock(), ndn::time::system_clock::now(), ndn::Block::push_back(), ndn::security::v2::KeyChain::sign(), and ndn::time::toUnixTimestamp().
|
inline |
Return announced name.
Definition at line 79 of file prefix-announcement.hpp.
Referenced by ndn::operator<<(), ndn::operator==(), and nfd::rib::RibManager::slAnnounce().
PrefixAnnouncement & ndn::PrefixAnnouncement::setAnnouncedName | ( | Name | name | ) |
Set announced name.
Definition at line 94 of file prefix-announcement.cpp.
Referenced by nfd::rib::RibEntry::getPrefixAnnouncement().
|
inline |
Return relative expiration period.
Definition at line 93 of file prefix-announcement.hpp.
Referenced by nfd::rib::computeExpiration(), ndn::operator<<(), and ndn::operator==().
PrefixAnnouncement & ndn::PrefixAnnouncement::setExpiration | ( | time::milliseconds | expiration | ) |
Set relative expiration period.
std::invalid_argument | expiration period is negative. |
Definition at line 102 of file prefix-announcement.cpp.
Referenced by nfd::rib::RibEntry::getPrefixAnnouncement().
|
inline |
Return absolute validity period.
Definition at line 108 of file prefix-announcement.hpp.
Referenced by nfd::rib::computeExpiration(), ndn::operator<<(), and ndn::operator==().
PrefixAnnouncement & ndn::PrefixAnnouncement::setValidityPeriod | ( | optional< security::ValidityPeriod > | validity | ) |
Set absolute validity period.
Definition at line 113 of file prefix-announcement.cpp.