22 #ifndef NDN_INTEREST_HPP
23 #define NDN_INTEREST_HPP
26 #include "key-locator.hpp"
27 #include "lite/interest-lite.hpp"
28 #include "encoding/wire-format.hpp"
29 #include "util/signed-blob.hpp"
30 #include "util/change-counter.hpp"
31 #include "exclude.hpp"
46 : name_(name), getNonceChangeCount_(0), changeCount_(0), getDefaultWireEncodingChangeCount_(0)
49 interestLifetimeMilliseconds_ = interestLifetimeMilliseconds;
57 : name_(name), getNonceChangeCount_(0), changeCount_(0), getDefaultWireEncodingChangeCount_(0)
63 : name_(interest.name_), minSuffixComponents_(interest.minSuffixComponents_),
64 maxSuffixComponents_(interest.maxSuffixComponents_),
65 keyLocator_(interest.keyLocator_), exclude_(interest.exclude_),
66 childSelector_(interest.childSelector_),
67 mustBeFresh_(interest.mustBeFresh_),
68 interestLifetimeMilliseconds_(interest.interestLifetimeMilliseconds_),
69 nonce_(interest.nonce_), getNonceChangeCount_(0), changeCount_(0)
71 setDefaultWireEncoding
79 : getNonceChangeCount_(0), changeCount_(0), getDefaultWireEncodingChangeCount_(0)
122 (
const uint8_t *input,
size_t inputLength,
136 wireDecode(&input[0], input.size(), wireFormat);
169 getName() {
return name_.get(); }
172 getName()
const {
return name_.get(); }
175 getMinSuffixComponents()
const {
return minSuffixComponents_; }
178 getMaxSuffixComponents()
const {
return maxSuffixComponents_; }
181 getKeyLocator()
const {
return keyLocator_.get(); }
184 getKeyLocator() {
return keyLocator_.get(); }
187 getExclude() {
return exclude_.get(); }
190 getExclude()
const {
return exclude_.get(); }
193 getChildSelector()
const {
return childSelector_; }
203 getInterestLifetimeMilliseconds()
const {
return interestLifetimeMilliseconds_; }
246 minSuffixComponents_ = minSuffixComponents;
260 maxSuffixComponents_ = maxSuffixComponents;
273 childSelector_ = childSelector;
287 mustBeFresh_ = mustBeFresh;
301 interestLifetimeMilliseconds_ = interestLifetimeMilliseconds;
330 keyLocator_ = keyLocator;
371 const_cast<Interest*
>(
this)->defaultWireEncodingFormat_ = 0;
375 return defaultWireEncoding_;
394 bool changed = name_.checkChanged();
395 changed = keyLocator_.checkChanged() || changed;
396 changed = exclude_.checkChanged() || changed;
400 ++
const_cast<Interest*
>(
this)->changeCount_;
409 minSuffixComponents_ = -1;
410 maxSuffixComponents_ = -1;
413 interestLifetimeMilliseconds_ = -1.0;
417 setDefaultWireEncoding
418 (
const SignedBlob& defaultWireEncoding,
419 WireFormat *defaultWireEncodingFormat)
421 defaultWireEncoding_ = defaultWireEncoding;
422 defaultWireEncodingFormat_ = defaultWireEncodingFormat;
428 ChangeCounter<Name> name_;
429 int minSuffixComponents_;
430 int maxSuffixComponents_;
431 ChangeCounter<KeyLocator> keyLocator_;
432 ChangeCounter<Exclude> exclude_;
437 uint64_t getNonceChangeCount_;
438 SignedBlob defaultWireEncoding_;
439 WireFormat *defaultWireEncodingFormat_;
440 uint64_t getDefaultWireEncodingChangeCount_;
441 uint64_t changeCount_;
const SignedBlob & getDefaultWireEncoding() const
Return a reference to the defaultWireEncoding, which was encoded with getDefaultWireEncodingFormat()...
Definition: interest.hpp:365
double Milliseconds
A time interval represented as the number of milliseconds.
Definition: common.hpp:111
Copyright (C) 2013-2016 Regents of the University of California.
Definition: common.hpp:35
Interest & setInterestLifetimeMilliseconds(Milliseconds interestLifetimeMilliseconds)
Set the interest lifetime.
Definition: interest.hpp:299
Interest & setKeyLocator(const KeyLocator &keyLocator)
Set this interest to use a copy of the given KeyLocator object.
Definition: interest.hpp:328
uint64_t getChangeCount() const
Get the change count, which is incremented each time this object (or a child object) is changed...
Definition: interest.hpp:391
An InterestLite holds a NameLite and other fields for an interest.
Definition: interest-lite.hpp:35
Interest & setMustBeFresh(bool mustBeFresh)
Set the MustBeFresh flag.
Definition: interest.hpp:285
Interest & setMinSuffixComponents(int minSuffixComponents)
Set the min suffix components count.
Definition: interest.hpp:244
An Exclude holds a vector of Exclude::Entry.
Definition: exclude.hpp:33
Interest(const Name &name)
Create a new Interest with the given name and "none" for other values.
Definition: interest.hpp:56
Interest(const Name &name, Milliseconds interestLifetimeMilliseconds)
Create a new Interest with the given name and interest lifetime and "none" for other values...
Definition: interest.hpp:45
void set(const InterestLite &interestLite)
Clear this interest, and set the values by copying from interestLite.
Definition: interest.cpp:63
const Blob & getNonce() const
Return the nonce value from the incoming interest.
Definition: interest.hpp:211
A Name holds an array of Name::Component and represents an NDN name.
Definition: name.hpp:40
void wireDecode(const Blob &input, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat())
Decode the input using a particular wire format and update this Interest.
Definition: interest.cpp:103
Interest & setChildSelector(int childSelector)
Set the child selector.
Definition: interest.hpp:271
A Blob holds a pointer to an immutable byte array implemented as const std::vector.
Definition: blob.hpp:42
An Interest holds a Name and other fields for an interest.
Definition: interest.hpp:38
std::string toUri() const
Encode the name according to the "NDN URI Scheme".
Definition: interest.cpp:138
Interest & setExclude(const Exclude &exclude)
Set this interest to use a copy of the given Exclude object.
Definition: interest.hpp:344
Interest()
Create a new Interest with an empty name and "none" for all values.
Definition: interest.hpp:78
void wireDecode(const std::vector< uint8_t > &input, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat())
Decode the input using a particular wire format and update this Interest.
Definition: interest.hpp:134
Interest & setName(const Name &name)
Set the interest name.
Definition: interest.hpp:230
Interest & setMaxSuffixComponents(int maxSuffixComponents)
Set the max suffix components count.
Definition: interest.hpp:258
bool matchesName(const Name &name) const
Check if this Interest's name matches the given name (using Name::match) and the given name also conf...
Definition: interest.cpp:172
A SignedBlob extends Blob to keep the offsets of a signed portion (e.g., the bytes of Data packet)...
Definition: signed-blob.hpp:34
Interest &DEPRECATED_IN_NDN_CPP setNonce(const Blob &nonce)
Definition: interest.hpp:310
WireFormat * getDefaultWireEncodingFormat() const
Get the WireFormat which is used by getDefaultWireEncoding().
Definition: interest.hpp:384
Definition: key-locator.hpp:35
bool getMustBeFresh() const
Return true if the content must be fresh.
Definition: interest.hpp:200
SignedBlob wireEncode(WireFormat &wireFormat=*WireFormat::getDefaultWireFormat()) const
Encode this Interest for a particular wire format.
Definition: interest.cpp:82