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

represents an Interest packet More...

#include <interest.hpp>

Inheritance diagram for ndn::Interest:
Collaboration diagram for ndn::Interest:

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 BlockwireEncode () 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 LinkgetLink () 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 NamegetName () const
 
InterestsetName (const Name &name)
 
const time::milliseconds & getInterestLifetime () const
 
InterestsetInterestLifetime (const time::milliseconds &interestLifetime)
 
bool hasNonce () const
 Check if Nonce set. More...
 
uint32_t getNonce () const
 Get Interest's nonce. More...
 
InterestsetNonce (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 SelectorsgetSelectors () const
 
InterestsetSelectors (const Selectors &selectors)
 
int getMinSuffixComponents () const
 
InterestsetMinSuffixComponents (int minSuffixComponents)
 
int getMaxSuffixComponents () const
 
InterestsetMaxSuffixComponents (int maxSuffixComponents)
 
const KeyLocatorgetPublisherPublicKeyLocator () const
 
InterestsetPublisherPublicKeyLocator (const KeyLocator &keyLocator)
 
const ExcludegetExclude () const
 
InterestsetExclude (const Exclude &exclude)
 
int getChildSelector () const
 
InterestsetChildSelector (int childSelector)
 
int getMustBeFresh () const
 
InterestsetMustBeFresh (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...
 

Detailed Description

represents an Interest packet

Definition at line 45 of file interest.hpp.

Constructor & Destructor Documentation

§ Interest() [1/4]

ndn::Interest::Interest ( )

Create a new Interest with an empty name (ndn:/)

Warning
In certain contexts that use Interest::shared_from_this(), Interest must be created using make_shared. Otherwise, .shared_from_this() will throw an exception.

Definition at line 36 of file interest.cpp.

Referenced by ndn::Interest::Error::Error().

§ Interest() [2/4]

ndn::Interest::Interest ( const Name name)

Create a new Interest with the given name.

Parameters
nameThe name for the interest.
Note
This constructor allows implicit conversion from Name.
Warning
In certain contexts that use Interest::shared_from_this(), Interest must be created using make_shared. Otherwise, .shared_from_this() will throw an exception.

Definition at line 42 of file interest.cpp.

§ Interest() [3/4]

ndn::Interest::Interest ( const Name name,
const time::milliseconds &  interestLifetime 
)

Create a new Interest with the given name and interest lifetime.

Parameters
nameThe name for the interest.
interestLifetimeThe interest lifetime in time::milliseconds, or -1 for none.
Warning
In certain contexts that use Interest::shared_from_this(), Interest must be created using make_shared. Otherwise, .shared_from_this() will throw an exception.

Definition at line 49 of file interest.cpp.

§ Interest() [4/4]

ndn::Interest::Interest ( const Block wire)
explicit

Create from wire encoding.

Warning
In certain contexts that use Interest::shared_from_this(), Interest must be created using make_shared. Otherwise, .shared_from_this() will throw an exception.

Definition at line 56 of file interest.cpp.

References wireDecode().

Member Function Documentation

§ wireEncode() [1/2]

§ wireEncode() [2/2]

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==().

§ wireDecode()

§ hasWire()

bool ndn::Interest::hasWire ( ) const
inline

§ toUri()

std::string ndn::Interest::toUri ( ) const
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().

§ hasLink()

bool ndn::Interest::hasLink ( ) const

Check whether the Interest contains a Link object.

Returns
True if there is a link object, otherwise false

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().

§ getLink()

const Link & ndn::Interest::getLink ( ) const

Get the link object for this interest.

Returns
The link object if there is one contained in this interest
Exceptions
Interest::Errorif there is no link object contained in the interest
tlv::Errorif 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().

§ setLink()

void ndn::Interest::setLink ( const Block link)

Set the link object for this interest.

Parameters
linkThe link object that will be included in this interest (in wire format)
Postcondition
!hasSelectedDelegation()

Definition at line 382 of file interest.cpp.

References ndn::Block::hasWire(), ndn::Block::reset(), and unsetSelectedDelegation().

Referenced by hasWire().

§ unsetLink()

void ndn::Interest::unsetLink ( )

Delete the link object for this interest.

Postcondition
!hasLink()

Definition at line 394 of file interest.cpp.

References ndn::Block::reset(), and unsetSelectedDelegation().

Referenced by hasWire().

§ hasSelectedDelegation()

bool ndn::Interest::hasSelectedDelegation ( ) const

Check whether the Interest includes a selected delegation.

Returns
True if there is a selected delegation, otherwise false

Definition at line 403 of file interest.cpp.

References ndn::INVALID_SELECTED_DELEGATION_INDEX.

Referenced by getSelectedDelegation(), hasWire(), nfd::Forwarder::startProcessNack(), and wireEncode().

§ getSelectedDelegation()

Name ndn::Interest::getSelectedDelegation ( ) const

Get the name of the selected delegation.

Returns
The name of the selected delegation
Exceptions
ErrorSelectedDelegation is not set.

Definition at line 409 of file interest.cpp.

References ndn::Link::getDelegationFromWire(), and hasSelectedDelegation().

Referenced by hasWire(), and nfd::Forwarder::startProcessNack().

§ setSelectedDelegation() [1/2]

void ndn::Interest::setSelectedDelegation ( const Name delegationName)

Set the selected delegation.

Parameters
delegationNameThe name of the selected delegation
Exceptions
ErrorLink is not set.
std::invalid_argumentdelegationName does not exist in Link.

Definition at line 418 of file interest.cpp.

References ndn::Link::findDelegationFromWire(), ndn::INVALID_SELECTED_DELEGATION_INDEX, and ndn::Block::reset().

Referenced by hasWire().

§ setSelectedDelegation() [2/2]

void ndn::Interest::setSelectedDelegation ( size_t  delegationIndex)

Set the selected delegation.

Parameters
delegationIndexThe index of the selected delegation
Exceptions
ErrorLink is not set.
std::out_of_rangedelegationIndex is out of bound in Link.

Definition at line 431 of file interest.cpp.

References ndn::Block::reset().

§ unsetSelectedDelegation()

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().

§ matchesName()

bool ndn::Interest::matchesName ( const Name name) const

Check if Interest, including selectors, matches the given name.

Parameters
nameThe 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().

§ matchesData()

bool ndn::Interest::matchesData ( const Data data) const

§ getName()

§ setName()

Interest& ndn::Interest::setName ( const Name name)
inline

§ getInterestLifetime()

const time::milliseconds& ndn::Interest::getInterestLifetime ( ) const
inline

Definition at line 232 of file interest.hpp.

Referenced by ndn::operator<<(), nfd::pit::FaceRecord::update(), and wireEncode().

§ setInterestLifetime()

Interest& ndn::Interest::setInterestLifetime ( const time::milliseconds &  interestLifetime)
inline

Definition at line 238 of file interest.hpp.

Referenced by ndn::nfd::Controller::Controller().

§ hasNonce()

bool ndn::Interest::hasNonce ( ) const
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().

§ getNonce()

uint32_t ndn::Interest::getNonce ( ) const

§ setNonce()

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().

§ 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().

§ DEPRECATED() [1/6]

ndn::Interest::DEPRECATED ( lp::LocalControlHeaderFacade   getLocalControlHeader())
Deprecated:
use getTag and setTag with lp::IncomingFaceIdTag, lp::NextHopFaceIdTag

Referenced by hasNonce().

§ DEPRECATED() [2/6]

ndn::Interest::DEPRECATED ( const lp::LocalControlHeaderFacade getLocalControlHeader()  const)

§ DEPRECATED() [3/6]

ndn::Interest::DEPRECATED ( uint64_t getIncomingFaceId()  const)

§ DEPRECATED() [4/6]

ndn::Interest::DEPRECATED ( Interest setIncomingFaceIduint64_t incomingFaceId)

§ DEPRECATED() [5/6]

ndn::Interest::DEPRECATED ( uint64_t getNextHopFaceId()  const)

§ DEPRECATED() [6/6]

ndn::Interest::DEPRECATED ( Interest setNextHopFaceIduint64_t nextHopFaceId)

§ hasSelectors()

bool ndn::Interest::hasSelectors ( ) const
inline
Returns
true if Interest has any selector present

Definition at line 322 of file interest.hpp.

Referenced by wireEncode().

§ getSelectors()

const Selectors& ndn::Interest::getSelectors ( ) const
inline

Definition at line 328 of file interest.hpp.

Referenced by nfd::Pit::Pit(), and wireEncode().

§ setSelectors()

Interest& ndn::Interest::setSelectors ( const Selectors selectors)
inline

Definition at line 334 of file interest.hpp.

§ getMinSuffixComponents()

int ndn::Interest::getMinSuffixComponents ( ) const
inline

Definition at line 342 of file interest.hpp.

Referenced by matchesData(), matchesName(), and ndn::operator<<().

§ setMinSuffixComponents()

Interest& ndn::Interest::setMinSuffixComponents ( int  minSuffixComponents)
inline

Definition at line 348 of file interest.hpp.

References setMinSuffixComponents().

Referenced by setMinSuffixComponents().

§ getMaxSuffixComponents()

int ndn::Interest::getMaxSuffixComponents ( ) const
inline

Definition at line 356 of file interest.hpp.

Referenced by matchesData(), matchesName(), and ndn::operator<<().

§ setMaxSuffixComponents()

Interest& ndn::Interest::setMaxSuffixComponents ( int  maxSuffixComponents)
inline

Definition at line 362 of file interest.hpp.

References setMaxSuffixComponents().

Referenced by setMaxSuffixComponents().

§ getPublisherPublicKeyLocator()

const KeyLocator& ndn::Interest::getPublisherPublicKeyLocator ( ) const
inline

Definition at line 370 of file interest.hpp.

Referenced by matchesData().

§ setPublisherPublicKeyLocator()

Interest& ndn::Interest::setPublisherPublicKeyLocator ( const KeyLocator keyLocator)
inline

Definition at line 376 of file interest.hpp.

References setPublisherPublicKeyLocator().

Referenced by setPublisherPublicKeyLocator().

§ getExclude()

const Exclude& ndn::Interest::getExclude ( ) const
inline

Definition at line 384 of file interest.hpp.

Referenced by matchesData(), matchesName(), and ndn::operator<<().

§ setExclude()

Interest& ndn::Interest::setExclude ( const Exclude exclude)
inline

Definition at line 390 of file interest.hpp.

References setExclude().

Referenced by setExclude().

§ getChildSelector()

int ndn::Interest::getChildSelector ( ) const
inline

§ setChildSelector()

Interest& ndn::Interest::setChildSelector ( int  childSelector)
inline

§ getMustBeFresh()

int ndn::Interest::getMustBeFresh ( ) const
inline

§ setMustBeFresh()

Interest& ndn::Interest::setMustBeFresh ( bool  mustBeFresh)
inline

§ operator==()

bool ndn::Interest::operator== ( const Interest other) const
inline

Definition at line 427 of file interest.hpp.

References wireEncode().

§ operator!=()

bool ndn::Interest::operator!= ( const Interest other) const
inline

Definition at line 433 of file interest.hpp.

References ndn::operator<<().


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