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... | |
const 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 () |
Delete the link object for this interest. 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... | |
DEPRECATED (lp::LocalControlHeaderFacade getLocalControlHeader()) | |
DEPRECATED (const lp::LocalControlHeaderFacade getLocalControlHeader() const) | |
DEPRECATED (uint64_t getIncomingFaceId() const) | |
DEPRECATED (Interest &setIncomingFaceId(uint64_t incomingFaceId)) | |
DEPRECATED (uint64_t getNextHopFaceId() const) | |
DEPRECATED (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... | |
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 nfd::face::GenericLinkService::GenericLinkService(), and operator==().
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::INVALID_SELECTED_DELEGATION_INDEX, 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 454 of file interest.hpp.
Referenced by hasWire().
bool ndn::Interest::hasLink | ( | ) | const |
Check whether the Interest contains a Link object.
Definition at line 364 of file interest.cpp.
References ndn::Block::hasWire().
Referenced by getLink(), hasWire(), nfd::Forwarder::startProcessInterest(), nfd::Forwarder::startProcessNack(), wireDecode(), and wireEncode().
const Link & ndn::Interest::getLink | ( | ) | const |
Get the link object for this interest.
Interest::Error | if there is no link object contained in the interest |
tlv::Error | if the incorporated link object is malformed |
Definition at line 370 of file interest.cpp.
References hasLink().
Referenced by hasWire(), nfd::Forwarder::startProcessInterest(), and nfd::Forwarder::startProcessNack().
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 382 of file interest.cpp.
References ndn::Block::hasWire(), ndn::Block::reset(), and unsetSelectedDelegation().
Referenced by hasWire().
void ndn::Interest::unsetLink | ( | ) |
Delete the link object for this interest.
Definition at line 394 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 403 of file interest.cpp.
References ndn::INVALID_SELECTED_DELEGATION_INDEX.
Referenced by getSelectedDelegation(), hasWire(), nfd::Forwarder::startProcessNack(), and wireEncode().
Name ndn::Interest::getSelectedDelegation | ( | ) | const |
Get the name of the selected delegation.
Error | SelectedDelegation is not set. |
Definition at line 409 of file interest.cpp.
References ndn::Link::getDelegationFromWire(), and hasSelectedDelegation().
Referenced by hasWire(), and nfd::Forwarder::startProcessNack().
void ndn::Interest::setSelectedDelegation | ( | const Name & | delegationName | ) |
Set the selected delegation.
delegationName | The name of the selected delegation |
Definition at line 418 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.
delegationIndex | The index of the selected delegation |
Definition at line 431 of file interest.cpp.
References ndn::Block::reset().
void ndn::Interest::unsetSelectedDelegation | ( | ) |
Unset the selected delegation.
Definition at line 441 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 218 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(), ndn::util::DummyClientFace::DummyClientFace(), nfd::rib::RibManager::enableLocalControlHeader(), ndn::util::SegmentFetcher::fetch(), nfd::cs::Cs::find(), ndn::util::InMemoryStorage::find(), nfd::ForwarderStatusManager::ForwarderStatusManager(), ndn::security::KeyChain::getDefaultKeyParamsForIdentity(), ndn::security::conf::Filter::match(), ndn::Validator::onTimeout(), ndn::operator<<(), nfd::Pit::Pit(), nfd::ManagerBase::registerNotificationStream(), ndn::mgmt::Dispatcher::removeTopPrefix(), ndn::util::InMemoryStorage::selectChild(), nfd::FaceManager::setConfigFile(), nfd::rib::RibManager::setConfigFile(), ndn::mgmt::StatusDatasetContext::setPrefix(), ndn::security::KeyChain::signWithSha256(), nfd::Forwarder::startProcessInterest(), nfd::Forwarder::startProcessNack(), ndn::mgmt::StatusDatasetContext::StatusDatasetContext(), ndn::Validator::verifySignature(), and wireEncode().
Definition at line 224 of file interest.hpp.
Referenced by ndn::util::SegmentFetcher::fetch(), ndn::security::KeyChain::getDefaultKeyParamsForIdentity(), and ndn::security::KeyChain::signWithSha256().
|
inline |
Definition at line 232 of file interest.hpp.
Referenced by ndn::operator<<(), nfd::pit::FaceRecord::update(), and wireEncode().
|
inline |
Definition at line 238 of file interest.hpp.
Referenced by ndn::nfd::Controller::Controller().
|
inline |
Check if Nonce set.
Definition at line 248 of file interest.hpp.
References DEPRECATED(), getNonce(), refreshNonce(), and setNonce().
Referenced by ndn::util::SegmentFetcher::fetch(), 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::OutRecord::setIncomingNack(), nfd::Forwarder::startProcessNack(), nfd::pit::FaceRecord::update(), and wireEncode().
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 hasNonce(), refreshNonce(), and nfd::Forwarder::startProcessNack().
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().
ndn::Interest::DEPRECATED | ( | lp::LocalControlHeaderFacade | getLocalControlHeader() | ) |
Referenced by hasNonce().
ndn::Interest::DEPRECATED | ( | const lp::LocalControlHeaderFacade getLocalControlHeader() | const | ) |
ndn::Interest::DEPRECATED | ( | uint64_t getIncomingFaceId() | const | ) |
ndn::Interest::DEPRECATED | ( | Interest & | setIncomingFaceIduint64_t incomingFaceId | ) |
ndn::Interest::DEPRECATED | ( | uint64_t getNextHopFaceId() | const | ) |
ndn::Interest::DEPRECATED | ( | Interest & | setNextHopFaceIduint64_t nextHopFaceId | ) |
|
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::Pit(), 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(), ndn::operator<<(), and ndn::util::InMemoryStorage::selectChild().
|
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.
References ndn::operator<<().