represents an Interest packet More...
#include <interest.hpp>
Classes | |
class | Error |
Public Member Functions | |
Interest () | |
Create a new Interest with an empty name (ndn:/ ) More... | |
Interest (const Name &name) | |
Create a new Interest with the given name. More... | |
Interest (const Name &name, const time::milliseconds &interestLifetime) | |
Create a new Interest with the given name and interest lifetime. More... | |
Interest (const Block &wire) | |
Create from wire encoding. More... | |
template<encoding::Tag TAG> | |
size_t | wireEncode (EncodingImpl< TAG > &encoder) const |
Fast encoding or block size estimation. More... | |
const Block & | wireEncode () const |
Encode to a wire format. More... | |
void | wireDecode (const Block &wire) |
Decode from the wire format. More... | |
bool | hasWire () const |
Check if already has wire. More... | |
std::string | toUri () const |
Encode the name according to the NDN URI Scheme. More... | |
bool | hasLink () const |
Check whether the Interest contains a Link object. More... | |
Link | getLink () const |
Get the link object for this interest. More... | |
void | setLink (const Block &link) |
Set the link object for this interest. More... | |
void | unsetLink () |
Reset the wire format of the given interest and the contained link. More... | |
bool | hasSelectedDelegation () const |
Check whether the Interest includes a selected delegation. More... | |
Name | getSelectedDelegation () const |
Get the name of the selected delegation. More... | |
void | setSelectedDelegation (const Name &delegationName) |
Set the selected delegation. More... | |
void | setSelectedDelegation (size_t delegationIndex) |
Set the selected delegation. More... | |
void | unsetSelectedDelegation () |
Unset the selected delegation. More... | |
bool | matchesName (const Name &name) const |
Check if Interest, including selectors, matches the given name . More... | |
bool | matchesData (const Data &data) const |
Check if Interest can be satisfied by data . More... | |
const Name & | getName () const |
Interest & | setName (const Name &name) |
const time::milliseconds & | getInterestLifetime () const |
Interest & | setInterestLifetime (const time::milliseconds &interestLifetime) |
bool | hasNonce () const |
Check if Nonce set. More... | |
uint32_t | getNonce () const |
Get Interest's nonce. More... | |
Interest & | setNonce (uint32_t nonce) |
Set Interest's nonce. More... | |
void | refreshNonce () |
Refresh nonce. More... | |
nfd::LocalControlHeader & | getLocalControlHeader () |
const nfd::LocalControlHeader & | getLocalControlHeader () const |
uint64_t | getIncomingFaceId () const |
Interest & | setIncomingFaceId (uint64_t incomingFaceId) |
uint64_t | getNextHopFaceId () const |
Interest & | setNextHopFaceId (uint64_t nextHopFaceId) |
bool | hasSelectors () const |
const Selectors & | getSelectors () const |
Interest & | setSelectors (const Selectors &selectors) |
int | getMinSuffixComponents () const |
Interest & | setMinSuffixComponents (int minSuffixComponents) |
int | getMaxSuffixComponents () const |
Interest & | setMaxSuffixComponents (int maxSuffixComponents) |
const KeyLocator & | getPublisherPublicKeyLocator () const |
Interest & | setPublisherPublicKeyLocator (const KeyLocator &keyLocator) |
const Exclude & | getExclude () const |
Interest & | setExclude (const Exclude &exclude) |
int | getChildSelector () const |
Interest & | setChildSelector (int childSelector) |
int | getMustBeFresh () const |
Interest & | setMustBeFresh (bool mustBeFresh) |
bool | operator== (const Interest &other) const |
bool | operator!= (const Interest &other) const |
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... | |
Friends | |
class | nfd::LocalControlHeader |
represents an Interest packet
Definition at line 45 of file interest.hpp.
ndn::Interest::Interest | ( | ) |
Create a new Interest with an empty name (ndn:/
)
make_shared
. Otherwise, .shared_from_this() will throw an exception. Definition at line 36 of file interest.cpp.
Referenced by ndn::Interest::Error::Error().
ndn::Interest::Interest | ( | const Name & | name | ) |
Create a new Interest with the given name.
name | The name for the interest. |
make_shared
. Otherwise, .shared_from_this() will throw an exception. Definition at line 42 of file interest.cpp.
ndn::Interest::Interest | ( | const Name & | name, |
const time::milliseconds & | interestLifetime | ||
) |
Create a new Interest with the given name and interest lifetime.
name | The name for the interest. |
interestLifetime | The interest lifetime in time::milliseconds, or -1 for none. |
make_shared
. Otherwise, .shared_from_this() will throw an exception. Definition at line 49 of file interest.cpp.
|
explicit |
Create from wire encoding.
make_shared
. Otherwise, .shared_from_this() will throw an exception. Definition at line 56 of file interest.cpp.
References wireDecode().
size_t ndn::Interest::wireEncode | ( | EncodingImpl< TAG > & | encoder | ) | const |
Fast encoding or block size estimation.
Definition at line 217 of file interest.cpp.
References ndn::DEFAULT_INTEREST_LIFETIME, getInterestLifetime(), getName(), getNonce(), getSelectors(), hasLink(), hasSelectedDelegation(), hasSelectors(), ndn::tlv::Interest, ndn::tlv::InterestLifetime, ndn::encoding::prependNonNegativeIntegerBlock(), ndn::tlv::SelectedDelegation, ndn::Selectors::wireEncode(), and ndn::Name::wireEncode().
Referenced by operator==(), nfd::MulticastUdpFace::sendInterest(), nfd::DatagramFace< Protocol, Addressing >::sendInterest(), nfd::WebSocketFace::sendInterest(), and nfd::EthernetFace::sendInterest().
const Block & ndn::Interest::wireEncode | ( | ) | const |
Encode to a wire format.
Definition at line 277 of file interest.cpp.
References ndn::Block::hasWire(), and wireDecode().
Referenced by ndn::Interest::Error::Error(), and operator==().
void ndn::Interest::wireDecode | ( | const Block & | wire | ) |
Decode from the wire format.
Definition at line 295 of file interest.cpp.
References ndn::Link::countDelegationsFromWire(), ndn::tlv::Data, ndn::DEFAULT_INTEREST_LIFETIME, ndn::Block::elements_end(), ndn::Block::find(), ndn::Block::get(), hasLink(), ndn::tlv::Interest, ndn::tlv::InterestLifetime, ndn::tlv::Name, ndn::tlv::Nonce, ndn::Block::parse(), ndn::encoding::readNonNegativeInteger(), ndn::tlv::SelectedDelegation, ndn::tlv::Selectors, ndn::Block::type(), ndn::Selectors::wireDecode(), and ndn::Name::wireDecode().
Referenced by ndn::Interest::Error::Error(), Interest(), and wireEncode().
|
inline |
Check if already has wire.
Definition at line 110 of file interest.hpp.
References getLink(), getSelectedDelegation(), hasLink(), hasSelectedDelegation(), matchesData(), matchesName(), setLink(), setSelectedDelegation(), toUri(), unsetLink(), and unsetSelectedDelegation().
|
inline |
Encode the name according to the NDN URI Scheme.
If there are interest selectors, this method will append "?" and add the selectors as a query string. For example, "/test/name?ndn.ChildSelector=1"
Definition at line 456 of file interest.hpp.
Referenced by hasWire().
bool ndn::Interest::hasLink | ( | ) | const |
Check whether the Interest contains a Link object.
Definition at line 361 of file interest.cpp.
References ndn::Block::hasWire().
Referenced by getLink(), hasWire(), wireDecode(), and wireEncode().
Link ndn::Interest::getLink | ( | ) | const |
Get the link object for this interest.
Interest::Error | if there is no link object contained in the interest |
Definition at line 369 of file interest.cpp.
References hasLink().
Referenced by hasWire().
void ndn::Interest::setLink | ( | const Block & | link | ) |
Set the link object for this interest.
link | The link object that will be included in this interest (in wire format) |
Definition at line 379 of file interest.cpp.
References ndn::Block::hasWire(), ndn::Block::reset(), and unsetSelectedDelegation().
Referenced by hasWire().
void ndn::Interest::unsetLink | ( | ) |
Reset the wire format of the given interest and the contained link.
Definition at line 390 of file interest.cpp.
References ndn::Block::reset(), and unsetSelectedDelegation().
Referenced by hasWire().
bool ndn::Interest::hasSelectedDelegation | ( | ) | const |
Check whether the Interest includes a selected delegation.
Definition at line 398 of file interest.cpp.
References ndn::INVALID_SELECTED_DELEGATION_INDEX.
Referenced by getSelectedDelegation(), hasWire(), and wireEncode().
Name ndn::Interest::getSelectedDelegation | ( | ) | const |
Get the name of the selected delegation.
Error | SelectedDelegation is not set. |
Definition at line 408 of file interest.cpp.
References ndn::Link::getDelegationFromWire(), and hasSelectedDelegation().
Referenced by hasWire().
void ndn::Interest::setSelectedDelegation | ( | const Name & | delegationName | ) |
Set the selected delegation.
delegationName | The name of the selected delegation |
Definition at line 417 of file interest.cpp.
References ndn::Link::findDelegationFromWire(), ndn::INVALID_SELECTED_DELEGATION_INDEX, and ndn::Block::reset().
Referenced by hasWire().
void ndn::Interest::setSelectedDelegation | ( | size_t | delegationIndex | ) |
Set the selected delegation.
delegation | The index of the selected delegation |
Definition at line 430 of file interest.cpp.
References ndn::Block::reset().
void ndn::Interest::unsetSelectedDelegation | ( | ) |
Unset the selected delegation.
Definition at line 440 of file interest.cpp.
References ndn::INVALID_SELECTED_DELEGATION_INDEX, and ndn::Block::reset().
Referenced by hasWire(), setLink(), and unsetLink().
bool ndn::Interest::matchesName | ( | const Name & | name | ) | const |
Check if Interest, including selectors, matches the given name
.
name | The name to be matched. If this is a Data name, it shall contain the implicit digest component |
Definition at line 105 of file interest.cpp.
References ndn::Exclude::empty(), getExclude(), getMaxSuffixComponents(), getMinSuffixComponents(), ndn::Exclude::isExcluded(), ndn::Name::isPrefixOf(), and ndn::Name::size().
Referenced by hasWire().
bool ndn::Interest::matchesData | ( | const Data & | data | ) | const |
Check if Interest can be satisfied by data
.
This method considers Name, MinSuffixComponents, MaxSuffixComponents, PublisherPublicKeyLocator, and Exclude. This method does not consider ChildSelector and MustBeFresh.
Definition at line 132 of file interest.cpp.
References ndn::Block::elements_end(), ndn::KeyLocator::empty(), ndn::Exclude::empty(), ndn::Block::find(), ndn::Name::get(), getExclude(), ndn::Data::getFullName(), ndn::Signature::getInfo(), getMaxSuffixComponents(), getMinSuffixComponents(), ndn::Data::getName(), getPublisherPublicKeyLocator(), ndn::Data::getSignature(), ndn::Exclude::isExcluded(), ndn::name::Component::isImplicitSha256Digest(), ndn::Name::isPrefixOf(), ndn::tlv::KeyLocator, ndn::Name::size(), and ndn::KeyLocator::wireEncode().
Referenced by nfd::cs::Entry::canSatisfy(), hasWire(), and ndn::util::InMemoryStorage::selectChild().
|
inline |
Definition at line 216 of file interest.hpp.
Referenced by ndn::mgmt::Dispatcher::addStatusDataset(), nfd::fw::ClientControlStrategy::afterReceiveInterest(), ndn::security::conf::KeyLocatorChecker::check(), ndn::security::conf::CustomizedChecker::check(), ndn::security::conf::FixedSignerChecker::check(), ndn::ValidatorConfig::checkPolicy(), ndn::CommandInterestValidator::checkPolicy(), nfd::rib::RibManager::enableLocalControlHeader(), ndn::Face::expressInterest(), nfd::cs::Cs::find(), ndn::util::InMemoryStorage::find(), ndn::security::KeyChain::importIdentity(), nfd::Pit::insert(), ndn::security::conf::Filter::match(), nfd::FaceManager::onFaceRequest(), nfd::FibManager::onFibRequest(), nfd::StrategyChoiceManager::onStrategyChoiceRequest(), ndn::Validator::onTimeout(), ndn::operator<<(), nfd::Face::Impl::processInterestFilters(), ndn::mgmt::StatusDatasetContext::reject(), ndn::mgmt::Dispatcher::removeTopPrefix(), ndn::util::InMemoryStorage::selectChild(), nfd::rib::RibManager::setConfigFile(), ndn::mgmt::StatusDatasetContext::setPrefix(), ndn::security::KeyChain::signWithSha256(), ndn::mgmt::StatusDatasetContext::StatusDatasetContext(), ndn::Validator::verifySignature(), wireEncode(), and nfd::Forwarder::~Forwarder().
Definition at line 222 of file interest.hpp.
Referenced by ndn::util::SegmentFetcher::fetch(), ndn::security::KeyChain::importIdentity(), and ndn::security::KeyChain::signWithSha256().
|
inline |
Definition at line 230 of file interest.hpp.
Referenced by ndn::operator<<(), nfd::pit::FaceRecord::update(), and wireEncode().
|
inline |
Definition at line 236 of file interest.hpp.
Referenced by ndn::nfd::Controller::Controller().
|
inline |
Check if Nonce set.
Definition at line 246 of file interest.hpp.
References getNonce(), refreshNonce(), and setNonce().
Referenced by ndn::operator<<(), and refreshNonce().
uint32_t ndn::Interest::getNonce | ( | ) | const |
Get Interest's nonce.
If nonce was not set before this call, it will be automatically assigned to a random value
Definition at line 62 of file interest.cpp.
References ndn::random::generateWord32(), ndn::Block::hasWire(), ndn::encoding::readNonNegativeInteger(), ndn::Block::value(), and ndn::Block::value_size().
Referenced by hasNonce(), ndn::operator<<(), refreshNonce(), nfd::pit::FaceRecord::update(), wireEncode(), and nfd::Forwarder::~Forwarder().
Interest & ndn::Interest::setNonce | ( | uint32_t | nonce | ) |
Set Interest's nonce.
If wire format already exists, this call simply replaces nonce in the existing wire format, without resetting and recreating it.
Definition at line 76 of file interest.cpp.
References ndn::Block::hasWire(), ndn::encoding::makeBinaryBlock(), ndn::tlv::Nonce, ndn::Block::reset(), ndn::Block::value(), and ndn::Block::value_size().
Referenced by nfd::compare_pickInterest(), hasNonce(), and refreshNonce().
void ndn::Interest::refreshNonce | ( | ) |
Refresh nonce.
It's guaranteed that new nonce value differs from the existing one.
If nonce is already set, it will be updated to a different random value. If nonce is not set, this method does nothing.
Definition at line 91 of file interest.cpp.
References ndn::random::generateWord32(), getNonce(), hasNonce(), and setNonce().
Referenced by ndn::util::SegmentFetcher::fetch(), and hasNonce().
|
inline |
Definition at line 278 of file interest.hpp.
Referenced by nfd::fw::ClientControlStrategy::afterReceiveInterest(), getIncomingFaceId(), getNextHopFaceId(), setIncomingFaceId(), and setNextHopFaceId().
|
inline |
Definition at line 284 of file interest.hpp.
|
inline |
Definition at line 290 of file interest.hpp.
References ndn::nfd::LocalControlHeader::getIncomingFaceId(), and getLocalControlHeader().
Referenced by nfd::FaceManager::onFaceRequest().
|
inline |
Definition at line 296 of file interest.hpp.
References getLocalControlHeader(), and ndn::nfd::LocalControlHeader::setIncomingFaceId().
|
inline |
Definition at line 304 of file interest.hpp.
References getLocalControlHeader(), and ndn::nfd::LocalControlHeader::getNextHopFaceId().
Referenced by nfd::fw::ClientControlStrategy::afterReceiveInterest().
|
inline |
Definition at line 310 of file interest.hpp.
References getLocalControlHeader(), and ndn::nfd::LocalControlHeader::setNextHopFaceId().
|
inline |
Definition at line 322 of file interest.hpp.
Referenced by wireEncode().
|
inline |
Definition at line 328 of file interest.hpp.
Referenced by nfd::Pit::insert(), and wireEncode().
Definition at line 334 of file interest.hpp.
|
inline |
Definition at line 342 of file interest.hpp.
Referenced by matchesData(), matchesName(), and ndn::operator<<().
|
inline |
Definition at line 348 of file interest.hpp.
References setMinSuffixComponents().
Referenced by setMinSuffixComponents().
|
inline |
Definition at line 356 of file interest.hpp.
Referenced by matchesData(), matchesName(), and ndn::operator<<().
|
inline |
Definition at line 362 of file interest.hpp.
References setMaxSuffixComponents().
Referenced by setMaxSuffixComponents().
|
inline |
Definition at line 370 of file interest.hpp.
Referenced by matchesData().
|
inline |
Definition at line 376 of file interest.hpp.
References setPublisherPublicKeyLocator().
Referenced by setPublisherPublicKeyLocator().
|
inline |
Definition at line 384 of file interest.hpp.
Referenced by matchesData(), matchesName(), and ndn::operator<<().
|
inline |
Definition at line 398 of file interest.hpp.
Referenced by nfd::cs::Cs::find(), ndn::operator<<(), and ndn::util::InMemoryStorage::selectChild().
|
inline |
Definition at line 404 of file interest.hpp.
References setChildSelector().
Referenced by nfd::rib::RibManager::enableLocalControlHeader(), ndn::util::SegmentFetcher::fetch(), and setChildSelector().
|
inline |
Definition at line 412 of file interest.hpp.
Referenced by nfd::cs::Entry::canSatisfy(), nfd::insertNonceToDnl(), and ndn::operator<<().
|
inline |
Definition at line 418 of file interest.hpp.
References setMustBeFresh().
Referenced by nfd::rib::RibManager::enableLocalControlHeader(), ndn::util::SegmentFetcher::fetch(), and setMustBeFresh().
|
inline |
Definition at line 427 of file interest.hpp.
References wireEncode().
|
inline |
Definition at line 433 of file interest.hpp.
|
friend |
Definition at line 449 of file interest.hpp.