represents an Interest packet More...
#include <interest.hpp>
Data Structures | |
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... | |
bool | matchesInterest (const Interest &other) const |
Check if Interest matches other interest. 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... | |
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 |
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 42 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.
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.
|
inline |
Definition at line 367 of file interest.hpp.
|
inline |
Definition at line 353 of file interest.hpp.
|
inline |
Definition at line 240 of file interest.hpp.
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 378 of file interest.cpp.
|
inline |
Definition at line 325 of file interest.hpp.
|
inline |
Definition at line 311 of file interest.hpp.
|
inline |
Definition at line 381 of file interest.hpp.
|
inline |
Definition at line 226 of file interest.hpp.
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.
|
inline |
Definition at line 339 of file interest.hpp.
Name ndn::Interest::getSelectedDelegation | ( | ) | const |
Get the name of the selected delegation.
Error | SelectedDelegation is not set. |
Definition at line 417 of file interest.cpp.
|
inline |
Definition at line 297 of file interest.hpp.
|
inlineinherited |
get a tag item
T | type of the tag, which must be a subclass of ndn::Tag |
nullptr | if no Tag of type T is stored |
Definition at line 67 of file tag-host.hpp.
bool ndn::Interest::hasLink | ( | ) | const |
Check whether the Interest contains a Link object.
Definition at line 372 of file interest.cpp.
|
inline |
Check if Nonce set.
Definition at line 256 of file interest.hpp.
bool ndn::Interest::hasSelectedDelegation | ( | ) | const |
Check whether the Interest includes a selected delegation.
Definition at line 411 of file interest.cpp.
|
inline |
Definition at line 291 of file interest.hpp.
|
inline |
Check if already has wire.
Definition at line 107 of file interest.hpp.
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.
bool ndn::Interest::matchesInterest | ( | const Interest & | other | ) | const |
Check if Interest matches other
interest.
Interest matches other
if both have the same name, selectors, and link. Other fields (e.g., Nonce) may be different.
Definition at line 216 of file interest.cpp.
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.
|
inline |
Definition at line 402 of file interest.hpp.
|
inline |
Definition at line 396 of file interest.hpp.
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.
|
inlineinherited |
remove tag item
Definition at line 94 of file tag-host.hpp.
|
inline |
Definition at line 373 of file interest.hpp.
Definition at line 359 of file interest.hpp.
|
inline |
Definition at line 246 of file interest.hpp.
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 390 of file interest.cpp.
|
inline |
Definition at line 331 of file interest.hpp.
|
inline |
Definition at line 317 of file interest.hpp.
|
inline |
Definition at line 387 of file interest.hpp.
Definition at line 232 of file interest.hpp.
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.
|
inline |
Definition at line 345 of file interest.hpp.
void ndn::Interest::setSelectedDelegation | ( | const Name & | delegationName | ) |
Set the selected delegation.
delegationName | The name of the selected delegation |
Definition at line 426 of file interest.cpp.
void ndn::Interest::setSelectedDelegation | ( | size_t | delegationIndex | ) |
Set the selected delegation.
delegationIndex | The index of the selected delegation |
Definition at line 439 of file interest.cpp.
Definition at line 303 of file interest.hpp.
|
inlineinherited |
set a tag item
T | type of the tag, which must be a subclass of ndn::Tag |
Definition at line 80 of file tag-host.hpp.
|
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 423 of file interest.hpp.
void ndn::Interest::unsetLink | ( | ) |
Delete the link object for this interest.
Definition at line 402 of file interest.cpp.
void ndn::Interest::unsetSelectedDelegation | ( | ) |
Unset the selected delegation.
Definition at line 449 of file interest.cpp.
void ndn::Interest::wireDecode | ( | const Block & | wire | ) |
Decode from the wire format.
Definition at line 303 of file interest.cpp.
size_t ndn::Interest::wireEncode | ( | EncodingImpl< TAG > & | encoder | ) | const |
Fast encoding or block size estimation.
Definition at line 225 of file interest.cpp.
const Block & ndn::Interest::wireEncode | ( | ) | const |
Encode to a wire format.
Definition at line 285 of file interest.cpp.