Represents an Interest packet. More...
#include <interest.hpp>
Classes | |
class | Error |
Public Member Functions | |
Interest (const Name &name=Name(), time::milliseconds lifetime=DEFAULT_INTEREST_LIFETIME) | |
Construct an Interest with given name and lifetime . More... | |
Interest (const Block &wire) | |
Construct an Interest by decoding from wire . More... | |
bool | getCanBePrefix () const |
Check whether the CanBePrefix element is present. More... | |
int | getChildSelector () const |
uint64_t | getCongestionMark () const |
get the value of the CongestionMark tag More... | |
const Exclude & | getExclude () const |
const DelegationList & | getForwardingHint () const |
time::milliseconds | getInterestLifetime () const |
int | getMaxSuffixComponents () const |
int | getMinSuffixComponents () const |
bool | getMustBeFresh () const |
Check whether the MustBeFresh element is present. More... | |
const Name & | getName () const |
uint32_t | getNonce () const |
Get nonce value. More... | |
const KeyLocator & | getPublisherPublicKeyLocator () const |
const Selectors & | getSelectors () const |
template<typename T > | |
shared_ptr< T > | getTag () const |
get a tag item More... | |
bool | hasNonce () const |
Check if the Nonce element is present. More... | |
bool | hasSelectors () const |
Check if Interest has any selector present. More... | |
bool | hasWire () const |
Check if this instance has cached wire encoding. 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... | |
bool | matchesName (const Name &name) const |
Check if Interest, including selectors, matches the given name . More... | |
template<typename Modifier > | |
Interest & | modifyForwardingHint (const Modifier &modifier) |
Modify ForwardingHint in-place. More... | |
void | refreshNonce () |
Change nonce value. More... | |
template<typename T > | |
void | removeTag () const |
remove tag item More... | |
Interest & | setCanBePrefix (bool canBePrefix) |
Add or remove CanBePrefix element. More... | |
Interest & | setChildSelector (int childSelector) |
void | setCongestionMark (uint64_t mark) |
set the CongestionMark tag to the specified value More... | |
Interest & | setExclude (const Exclude &exclude) |
Interest & | setForwardingHint (const DelegationList &value) |
Interest & | setInterestLifetime (time::milliseconds lifetime) |
Set Interest's lifetime. More... | |
Interest & | setMaxSuffixComponents (int maxSuffixComponents) |
Interest & | setMinSuffixComponents (int minSuffixComponents) |
Interest & | setMustBeFresh (bool mustBeFresh) |
Add or remove MustBeFresh element. More... | |
Interest & | setName (const Name &name) |
Interest & | setNonce (uint32_t nonce) |
Set nonce value. More... | |
Interest & | setPublisherPublicKeyLocator (const KeyLocator &keyLocator) |
Interest & | setSelectors (const Selectors &selectors) |
template<typename T > | |
void | setTag (shared_ptr< T > tag) const |
set a tag item More... | |
std::string | toUri () const |
Return a URI-like string that represents the Interest. More... | |
void | wireDecode (const Block &wire) |
Decode from wire in NDN Packet Format v0.2 or v0.3. More... | |
template<encoding::Tag TAG> | |
size_t | wireEncode (EncodingImpl< TAG > &encoder) const |
Prepend wire encoding to encoder in NDN Packet Format v0.2. More... | |
const Block & | wireEncode () const |
Encode to a Block . More... | |
Represents an Interest packet.
Definition at line 42 of file interest.hpp.
|
explicit |
Construct an Interest with given name
and lifetime
.
std::invalid_argument | lifetime is negative |
Interest::shared_from_this()
, Interest must be created using make_shared
. Otherwise, shared_from_this()
will trigger undefined behavior. Definition at line 38 of file interest.cpp.
|
explicit |
Construct an Interest by decoding from wire
.
Interest::shared_from_this()
, Interest must be created using make_shared
. Otherwise, shared_from_this()
will trigger undefined behavior. Definition at line 47 of file interest.cpp.
|
inline |
Check whether the CanBePrefix element is present.
This is a getter for the CanBePrefix element as defined in NDN Packet Format v0.3. In this implementation, it is mapped to the closest v0.2 semantics: MaxSuffixComponents=1 means CanBePrefix is absent.
Definition at line 157 of file interest.hpp.
|
inline |
Definition at line 364 of file interest.hpp.
|
inherited |
get the value of the CongestionMark tag
Definition at line 28 of file packet-base.cpp.
|
inline |
Definition at line 348 of file interest.hpp.
|
inline |
Definition at line 205 of file interest.hpp.
|
inline |
Definition at line 261 of file interest.hpp.
|
inline |
Definition at line 316 of file interest.hpp.
|
inline |
Definition at line 300 of file interest.hpp.
|
inline |
Check whether the MustBeFresh element is present.
This is a getter for the MustBeFresh element as defined in NDN Packet Format v0.3. In this implementation, it is mapped to the closest v0.2 semantics and appears as MustBeFresh element under Selectors.
Definition at line 184 of file interest.hpp.
|
inline |
Definition at line 137 of file interest.hpp.
uint32_t ndn::Interest::getNonce | ( | ) | const |
Get nonce value.
If nonce was not present, it is added and assigned a random value.
Definition at line 445 of file interest.cpp.
|
inline |
Definition at line 332 of file interest.hpp.
|
inline |
Definition at line 284 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.
|
inline |
Check if the Nonce element is present.
Definition at line 235 of file interest.hpp.
|
inline |
Check if Interest has any selector present.
Definition at line 277 of file interest.hpp.
|
inline |
Check if this instance has cached wire encoding.
Definition at line 93 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 351 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 435 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 324 of file interest.cpp.
|
inline |
Modify ForwardingHint in-place.
Modifier | a unary function that accepts DelegationList& |
This is equivalent to, but more efficient (avoids copying) than:
Definition at line 225 of file interest.hpp.
void ndn::Interest::refreshNonce | ( | ) |
Change nonce value.
If the Nonce element is present, the new nonce value will differ from the old value. If the Nonce element is not present, this method does nothing.
Definition at line 462 of file interest.cpp.
|
inlineinherited |
remove tag item
Definition at line 94 of file tag-host.hpp.
|
inline |
Add or remove CanBePrefix element.
canBePrefix | whether CanBePrefix element should be present. |
This is a setter for the CanBePrefix element as defined in NDN Packet Format v0.3. In this implementation, it is mapped to the closest v0.2 semantics: MaxSuffixComponents=1 means CanBePrefix is absent.
Definition at line 170 of file interest.hpp.
|
inline |
Definition at line 371 of file interest.hpp.
|
inherited |
set the CongestionMark tag to the specified value
Definition at line 41 of file packet-base.cpp.
Definition at line 355 of file interest.hpp.
Interest & ndn::Interest::setForwardingHint | ( | const DelegationList & | value | ) |
Definition at line 487 of file interest.cpp.
Interest & ndn::Interest::setInterestLifetime | ( | time::milliseconds | lifetime | ) |
Set Interest's lifetime.
std::invalid_argument | lifetime is negative |
Definition at line 476 of file interest.cpp.
|
inline |
Definition at line 323 of file interest.hpp.
|
inline |
Definition at line 307 of file interest.hpp.
|
inline |
Add or remove MustBeFresh element.
mustBeFresh | whether MustBeFresh element should be present. |
This is a setter for the MustBeFresh element as defined in NDN Packet Format v0.3. In this implementation, it is mapped to the closest v0.2 semantics and appears as MustBeFresh element under Selectors.
Definition at line 197 of file interest.hpp.
Definition at line 143 of file interest.hpp.
Interest & ndn::Interest::setNonce | ( | uint32_t | nonce | ) |
Set nonce value.
Definition at line 454 of file interest.cpp.
|
inline |
Definition at line 339 of file interest.hpp.
Definition at line 291 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.
std::string ndn::Interest::toUri | ( | ) | const |
void ndn::Interest::wireDecode | ( | const Block & | wire | ) |
Decode from wire
in NDN Packet Format v0.2 or v0.3.
Definition at line 119 of file interest.cpp.
size_t ndn::Interest::wireEncode | ( | EncodingImpl< TAG > & | encoder | ) | const |
Prepend wire encoding to encoder
in NDN Packet Format v0.2.
Definition at line 56 of file interest.cpp.
const Block & ndn::Interest::wireEncode | ( | ) | const |
Encode to a Block
.
Normally, this function encodes to NDN Packet Format v0.2. However, if this instance has cached wire encoding (hasWire()
is true), the cached encoding is returned and it might be in v0.3 format.
Definition at line 103 of file interest.cpp.