All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ndn::Interest Class Reference

An Interest holds a Name and other fields for an interest. More...

#include <interest.hpp>

Inheritance diagram for ndn::Interest:
[legend]
Collaboration diagram for ndn::Interest:
[legend]

Public Member Functions

 Interest ()
 Create a new Interest with an empty name and "none" for all values. More...
 
 Interest (const Name &name)
 Create a new Interest with the given name and "none" for other values. More...
 
 Interest (const Name &name, const time::milliseconds &interestLifetime)
 Create a new Interest with the given name and interest lifetime and "none" for other values. More...
 
 Interest (const Name &name, const Selectors &selectors, int scope, const time::milliseconds &interestLifetime, uint32_t nonce=0)
 
 Interest (const Name &name, int minSuffixComponents, int maxSuffixComponents, const Exclude &exclude, int childSelector, bool mustBeFresh, int scope, const time::milliseconds &interestLifetime, uint32_t nonce=0)
 Create a new Interest for the given name and values. More...
 
 Interest (const Block &wire)
 Create from wire encoding. More...
 
template<bool T>
size_t wireEncode (EncodingImpl< T > &block) 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 hasSelectors () const
 
bool hasGuiders () const
 
bool matchesName (const Name &name) const
 Check if Interest name matches the given name (using ndn_Name_match) and the given name also conforms to the interest selectors. More...
 
bool matchesData (const Data &data) const
 Determines whether this Interest can be satisfied by data. More...
 
const NamegetName () const
 
InterestsetName (const Name &name)
 
const SelectorsgetSelectors () const
 
InterestsetSelectors (const Selectors &selectors)
 
int getScope () const
 
InterestsetScope (int scope)
 
const time::milliseconds & getInterestLifetime () const
 
InterestsetInterestLifetime (const time::milliseconds &interestLifetime)
 
const uint32_t & getNonce () const
 Get Interest's nonce. More...
 
InterestsetNonce (uint32_t nonce)
 
nfd::LocalControlHeadergetLocalControlHeader ()
 
const nfd::LocalControlHeadergetLocalControlHeader () const
 
uint64_t getIncomingFaceId () const
 
InterestsetIncomingFaceId (uint64_t incomingFaceId)
 
uint64_t getNextHopFaceId () const
 
InterestsetNextHopFaceId (uint64_t nextHopFaceId)
 
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
 

Friends

class nfd::LocalControlHeader
 

Detailed Description

An Interest holds a Name and other fields for an interest.

Definition at line 24 of file interest.hpp.

Constructor & Destructor Documentation

ndn::Interest::Interest ( )
inline

Create a new Interest with an empty name and "none" for all values.

Definition at line 30 of file interest.hpp.

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

Create a new Interest with the given name and "none" for other values.

Parameters
nameThe name for the interest.

Definition at line 42 of file interest.hpp.

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

Create a new Interest with the given name and interest lifetime and "none" for other values.

Parameters
nameThe name for the interest.
interestLifetimeMillisecondsThe interest lifetime in time::milliseconds, or -1 for none.

Definition at line 55 of file interest.hpp.

ndn::Interest::Interest ( const Name name,
const Selectors selectors,
int  scope,
const time::milliseconds &  interestLifetime,
uint32_t  nonce = 0 
)
inline

Definition at line 63 of file interest.hpp.

ndn::Interest::Interest ( const Name name,
int  minSuffixComponents,
int  maxSuffixComponents,
const Exclude exclude,
int  childSelector,
bool  mustBeFresh,
int  scope,
const time::milliseconds &  interestLifetime,
uint32_t  nonce = 0 
)
inline

Create a new Interest for the given name and values.

Parameters
name
minSuffixComponents
maxSuffixComponents
exclude
childSelector
mustBeFresh
scope
interestLifetime
nonce
Deprecated:
Interest().setX(...).setY(...) or use the overload taking Selectors

Definition at line 91 of file interest.hpp.

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

Create from wire encoding.

Definition at line 111 of file interest.hpp.

Member Function Documentation

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

Definition at line 384 of file interest.hpp.

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

Definition at line 368 of file interest.hpp.

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

Definition at line 280 of file interest.hpp.

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

Definition at line 230 of file interest.hpp.

nfd::LocalControlHeader& ndn::Interest::getLocalControlHeader ( )
inline

Definition at line 266 of file interest.hpp.

const nfd::LocalControlHeader& ndn::Interest::getLocalControlHeader ( ) const
inline

Definition at line 272 of file interest.hpp.

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

Definition at line 336 of file interest.hpp.

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

Definition at line 320 of file interest.hpp.

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

Definition at line 400 of file interest.hpp.

const Name& ndn::Interest::getName ( ) const
inline

Definition at line 182 of file interest.hpp.

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

Definition at line 298 of file interest.hpp.

const 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

Const reference needed for C decoding

Definition at line 17 of file interest.cpp.

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

Definition at line 352 of file interest.hpp.

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

Definition at line 214 of file interest.hpp.

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

Definition at line 198 of file interest.hpp.

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

Definition at line 457 of file interest.hpp.

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

Definition at line 451 of file interest.hpp.

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

Check if already has wire.

Definition at line 586 of file interest.hpp.

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

Determines whether this Interest can be satisfied by data.

This method considers Name, MinSuffixComponents, MaxSuffixComponents, PublisherPublicKeyLocator, and Exclude. This method does not consider ChildSelector and MustBeFresh.

Todo:
recognize implicit digest component

Definition at line 54 of file interest.cpp.

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

Check if Interest name matches the given name (using ndn_Name_match) and the given name also conforms to the interest selectors.

Parameters
selfA pointer to the ndn_Interest struct.
nameA pointer to the name to check.
Returns
1 if the name and interest selectors match, 0 otherwise.

Definition at line 27 of file interest.cpp.

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

Definition at line 421 of file interest.hpp.

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

Definition at line 415 of file interest.hpp.

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

Definition at line 390 of file interest.hpp.

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

Definition at line 374 of file interest.hpp.

Interest& ndn::Interest::setIncomingFaceId ( uint64_t  incomingFaceId)
inline

Definition at line 286 of file interest.hpp.

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

Definition at line 236 of file interest.hpp.

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

Definition at line 342 of file interest.hpp.

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

Definition at line 326 of file interest.hpp.

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

Definition at line 406 of file interest.hpp.

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

Definition at line 188 of file interest.hpp.

Interest& ndn::Interest::setNextHopFaceId ( uint64_t  nextHopFaceId)
inline

Definition at line 304 of file interest.hpp.

Interest& ndn::Interest::setNonce ( uint32_t  nonce)
inline

Definition at line 256 of file interest.hpp.

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

Definition at line 358 of file interest.hpp.

Interest& ndn::Interest::setScope ( int  scope)
inline

Definition at line 220 of file interest.hpp.

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

Definition at line 204 of file interest.hpp.

std::string ndn::Interest::toUri ( ) const
inline

Encode the name according to the "NDN URI Scheme".

If there are interest selectors, append "?" and added the selectors as a query string. For example "/test/name?ndn.ChildSelector=1".

Returns
The URI string.

Definition at line 443 of file interest.hpp.

void ndn::Interest::wireDecode ( const Block wire)
inline

Decode from the wire format.

Definition at line 528 of file interest.hpp.

template<bool T>
size_t ndn::Interest::wireEncode ( EncodingImpl< T > &  block) const
inline

Fast encoding or block size estimation.

Definition at line 466 of file interest.hpp.

const Block & ndn::Interest::wireEncode ( ) const
inline

Encode to a wire format.

Definition at line 512 of file interest.hpp.

Friends And Related Function Documentation

friend class nfd::LocalControlHeader
friend

Definition at line 436 of file interest.hpp.