Public Member Functions | List of all members
ndn::Interest Class Reference

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

#include <interest.hpp>

Public Member Functions

DEPRECATED_IN_NDN_CPP Interest (const Name &name, int minSuffixComponents, int maxSuffixComponents, const PublisherPublicKeyDigest &publisherPublicKeyDigest, const Exclude &exclude, int childSelector, int answerOriginKind, int scope, Milliseconds interestLifetimeMilliseconds, const Blob &nonce)
 Create a new Interest for the given name and values. More...
 
DEPRECATED_IN_NDN_CPP Interest (const Name &name, int minSuffixComponents, int maxSuffixComponents, const PublisherPublicKeyDigest &publisherPublicKeyDigest, const Exclude &exclude, int childSelector, int answerOriginKind, int scope, Milliseconds interestLifetimeMilliseconds)
 Create a new Interest with the given name and values, and "none" for the nonce and keyLocator. More...
 
DEPRECATED_IN_NDN_CPP Interest (const Name &name, int minSuffixComponents, int maxSuffixComponents, const KeyLocator &keyLocator, const Exclude &exclude, int childSelector, int answerOriginKind, int scope, Milliseconds interestLifetimeMilliseconds)
 Create a new Interest with the given name and values, and "none" for the nonce. More...
 
 Interest (const Name &name, Milliseconds interestLifetimeMilliseconds)
 Create a new Interest with the given name and interest lifetime and "none" for other values. More...
 
 Interest (const Name &name)
 Create a new Interest with the given name and "none" for other values. More...
 
 Interest (const Interest &interest)
 
 Interest ()
 Create a new Interest with an empty name and "none" for all values.
 
Interestoperator= (const Interest &interest)
 
SignedBlob wireEncode (WireFormat &wireFormat=*WireFormat::getDefaultWireFormat()) const
 Encode this Interest for a particular wire format. More...
 
void wireDecode (const Blob &input, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat())
 Decode the input using a particular wire format and update this Interest. More...
 
void wireDecode (const uint8_t *input, size_t inputLength, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat())
 Decode the input using a particular wire format and update this Interest. More...
 
void wireDecode (const std::vector< uint8_t > &input, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat())
 Decode the input using a particular wire format and update this Interest. More...
 
std::string toUri () const
 Encode the name according to the "NDN URI Scheme". More...
 
void get (struct ndn_Interest &interestStruct) const
 Set the interestStruct to point to the components in this interest, without copying any memory. More...
 
NamegetName ()
 
const NamegetName () const
 
int getMinSuffixComponents () const
 
int getMaxSuffixComponents () const
 
PublisherPublicKeyDigest &DEPRECATED_IN_NDN_CPP getPublisherPublicKeyDigest ()
 
const PublisherPublicKeyDigest &DEPRECATED_IN_NDN_CPP getPublisherPublicKeyDigest () const
 
const KeyLocatorgetKeyLocator () const
 
KeyLocatorgetKeyLocator ()
 
ExcludegetExclude ()
 
const ExcludegetExclude () const
 
int getChildSelector () const
 
int DEPRECATED_IN_NDN_CPP getAnswerOriginKind () const
 
bool getMustBeFresh () const
 Return true if the content must be fresh. More...
 
int getScope () const
 
Milliseconds getInterestLifetimeMilliseconds () const
 
const BlobgetNonce () const
 Return the nonce value from the incoming interest. More...
 
void set (const struct ndn_Interest &interestStruct)
 Clear this interest, and set the values by copying from the interest struct. More...
 
InterestsetName (const Name &name)
 Set the interest name. More...
 
InterestsetMinSuffixComponents (int minSuffixComponents)
 Set the min suffix components count. More...
 
InterestsetMaxSuffixComponents (int maxSuffixComponents)
 Set the max suffix components count. More...
 
InterestsetChildSelector (int childSelector)
 Set the child selector. More...
 
Interest &DEPRECATED_IN_NDN_CPP setAnswerOriginKind (int answerOriginKind)
 
InterestsetMustBeFresh (bool mustBeFresh)
 Set the MustBeFresh flag. More...
 
InterestsetScope (int scope)
 Set the interest scope. More...
 
InterestsetInterestLifetimeMilliseconds (Milliseconds interestLifetimeMilliseconds)
 Set the interest lifetime. More...
 
Interest &DEPRECATED_IN_NDN_CPP setNonce (const Blob &nonce)
 
InterestsetKeyLocator (const KeyLocator &keyLocator)
 Set this interest to use a copy of the given KeyLocator object. More...
 
InterestsetExclude (const Exclude &exclude)
 Set this interest to use a copy of the given Exclude object. More...
 
bool matchesName (const Name &name) const
 Check if this Interest's name matches the given name (using Name::match) and the given name also conforms to the interest selectors. More...
 
const SignedBlobgetDefaultWireEncoding () const
 Return a reference to the defaultWireEncoding, which was encoded with getDefaultWireEncodingFormat(). More...
 
WireFormatgetDefaultWireEncodingFormat () const
 Get the WireFormat which is used by getDefaultWireEncoding(). More...
 
uint64_t getChangeCount () const
 Get the change count, which is incremented each time this object (or a child object) is changed. More...
 

Detailed Description

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

Constructor & Destructor Documentation

ndn::Interest::Interest ( const Name name,
int  minSuffixComponents,
int  maxSuffixComponents,
const PublisherPublicKeyDigest publisherPublicKeyDigest,
const Exclude exclude,
int  childSelector,
int  answerOriginKind,
int  scope,
Milliseconds  interestLifetimeMilliseconds,
const Blob nonce 
)

Create a new Interest for the given name and values.

Deprecated:
This constructor sets the nonce which is deprecated because you should let let the wire encoder generate a random nonce internally before sending the interest. This has PublisherPublicKeyDigest. Use KeyLocator. This also has answerOriginKind. Use setMustBeFresh().
ndn::Interest::Interest ( const Name name,
int  minSuffixComponents,
int  maxSuffixComponents,
const PublisherPublicKeyDigest publisherPublicKeyDigest,
const Exclude exclude,
int  childSelector,
int  answerOriginKind,
int  scope,
Milliseconds  interestLifetimeMilliseconds 
)

Create a new Interest with the given name and values, and "none" for the nonce and keyLocator.

Deprecated:
This has PublisherPublicKeyDigest. Use KeyLocator. This also has answerOriginKind. Use setMustBeFresh().
ndn::Interest::Interest ( const Name name,
int  minSuffixComponents,
int  maxSuffixComponents,
const KeyLocator keyLocator,
const Exclude exclude,
int  childSelector,
int  answerOriginKind,
int  scope,
Milliseconds  interestLifetimeMilliseconds 
)

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

Deprecated:
This has answerOriginKind. Use setMustBeFresh().
ndn::Interest::Interest ( const Name name,
Milliseconds  interestLifetimeMilliseconds 
)
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 milliseconds, or -1 for none.
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.

Member Function Documentation

void ndn::Interest::get ( struct ndn_Interest & interestStruct  ) const

Set the interestStruct to point to the components in this interest, without copying any memory.

WARNING: The resulting pointers in interestStruct are invalid after a further use of this object which could reallocate memory.

Parameters
interestStructa C ndn_Interest struct where the name components array is already allocated.
int ndn::Interest::getAnswerOriginKind ( ) const
Deprecated:
Use getMustBeFresh.
uint64_t ndn::Interest::getChangeCount ( ) const
inline

Get the change count, which is incremented each time this object (or a child object) is changed.

Returns
The change count.
const SignedBlob& ndn::Interest::getDefaultWireEncoding ( ) const
inline

Return a reference to the defaultWireEncoding, which was encoded with getDefaultWireEncodingFormat().

The SignedBlob may have a null pointer.

WireFormat* ndn::Interest::getDefaultWireEncodingFormat ( ) const
inline

Get the WireFormat which is used by getDefaultWireEncoding().

Returns
The WireFormat, which is only meaningful if the getDefaultWireEncoding() does not have a null pointer.
bool ndn::Interest::getMustBeFresh ( ) const
inline

Return true if the content must be fresh.

The default is true.

Returns
true if must be fresh, otherwise false.
const Blob& ndn::Interest::getNonce ( ) const
inline

Return the nonce value from the incoming interest.

If you change any of the fields in this Interest object, then the nonce value is cleared.

Returns
PublisherPublicKeyDigest& DEPRECATED_IN_NDN_CPP ndn::Interest::getPublisherPublicKeyDigest ( )
inline
Deprecated:
. The Interest publisherPublicKeyDigest is deprecated. If you need a publisher public key digest, set the keyLocator keyLocatorType to KEY_LOCATOR_DIGEST and set its key data to the digest.
const PublisherPublicKeyDigest& DEPRECATED_IN_NDN_CPP ndn::Interest::getPublisherPublicKeyDigest ( ) const
inline
Deprecated:
. The Interest publisherPublicKeyDigest is deprecated. If you need a publisher public key digest, set the keyLocator keyLocatorType to KEY_LOCATOR_DIGEST and set its key data to the digest.
bool ndn::Interest::matchesName ( const Name name) const

Check if this Interest's name matches the given name (using Name::match) and the given name also conforms to the interest selectors.

Parameters
nameThe name to check.
Returns
True if the name and interest selectors match, otherwise false.
void ndn::Interest::set ( const struct ndn_Interest & interestStruct  )

Clear this interest, and set the values by copying from the interest struct.

Parameters
interestStructa C ndn_Interest struct
Interest & ndn::Interest::setAnswerOriginKind ( int  answerOriginKind)
Deprecated:
Use setMustBeFresh.
Interest& ndn::Interest::setChildSelector ( int  childSelector)
inline

Set the child selector.

Parameters
childSelectorThe child selector. If not specified, set to -1.
Returns
This Interest so that you can chain calls to update values.
Interest& ndn::Interest::setExclude ( const Exclude exclude)
inline

Set this interest to use a copy of the given Exclude object.

Note
You can also call getExclude and change the exclude entries directly.
Parameters
excludeThe Exclude object. This makes a copy of the object. If no exclude is specified, set to a new default Exclude(), or to an Exclude with size() 0.
Returns
This Interest so that you can chain calls to update values.
Interest& ndn::Interest::setInterestLifetimeMilliseconds ( Milliseconds  interestLifetimeMilliseconds)
inline

Set the interest lifetime.

Parameters
interestLifetimeMillisecondsThe interest lifetime in milliseconds. If not specified, set to -1.
Returns
This Interest so that you can chain calls to update values.
Interest& ndn::Interest::setKeyLocator ( const KeyLocator keyLocator)
inline

Set this interest to use a copy of the given KeyLocator object.

Note
You can also call getKeyLocator and change the key locator directly.
Parameters
keyLocatorThe KeyLocator object. This makes a copy of the object. If no key locator is specified, set to a new default KeyLocator(), or to a KeyLocator with an unspecified type.
Returns
This Interest so that you can chain calls to update values.
Interest& ndn::Interest::setMaxSuffixComponents ( int  maxSuffixComponents)
inline

Set the max suffix components count.

Parameters
maxSuffixComponentsThe max suffix components count. If not specified, set to -1.
Returns
This Interest so that you can chain calls to update values.
Interest& ndn::Interest::setMinSuffixComponents ( int  minSuffixComponents)
inline

Set the min suffix components count.

Parameters
minSuffixComponentsThe min suffix components count. If not specified, set to -1.
Returns
This Interest so that you can chain calls to update values.
Interest& ndn::Interest::setMustBeFresh ( bool  mustBeFresh)
inline

Set the MustBeFresh flag.

Parameters
mustBeFreshTrue if the content must be fresh, otherwise false. If you do not set this flag, the default value is true.
Returns
This Interest so that you can chain calls to update values.
Interest& ndn::Interest::setName ( const Name name)
inline

Set the interest name.

Note
You can also call getName and change the name values directly.
Parameters
nameThe interest name. This makes a copy of the name.
Returns
This Interest so that you can chain calls to update values.
Interest& DEPRECATED_IN_NDN_CPP ndn::Interest::setNonce ( const Blob nonce)
inline
Deprecated:
You should let the wire encoder generate a random nonce internally before sending the interest.
Interest& ndn::Interest::setScope ( int  scope)
inline

Set the interest scope.

Parameters
scopeThe interest scope. If not specified, set to -1.
Returns
This Interest so that you can chain calls to update values.
string ndn::Interest::toUri ( ) const

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

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

Returns
The URI string.
Note
This is an experimental feature. See the API docs for more detail at http://named-data.net/doc/ndn-ccl-api/interest.html#interest-touri-method .
void ndn::Interest::wireDecode ( const Blob input,
WireFormat wireFormat = *WireFormat::getDefaultWireFormat() 
)

Decode the input using a particular wire format and update this Interest.

If wireFormat is the default wire format, also set the defaultWireEncoding to another pointer to the input Blob.

Parameters
inputThe input byte array to be decoded as an immutable Blob.
wireFormat(optional) A WireFormat object used to decode the input. If omitted, use WireFormat::getDefaultWireFormat().
void ndn::Interest::wireDecode ( const uint8_t *  input,
size_t  inputLength,
WireFormat wireFormat = *WireFormat::getDefaultWireFormat() 
)

Decode the input using a particular wire format and update this Interest.

If wireFormat is the default wire format, also set the defaultWireEncoding field to a copy of the input. (To not copy the input, see wireDecode(Blob).)

Parameters
inputThe input byte array to be decoded.
inputLengthThe length of input.
wireFormat(optional) A WireFormat object used to decode the input. If omitted, use WireFormat::getDefaultWireFormat().
void ndn::Interest::wireDecode ( const std::vector< uint8_t > &  input,
WireFormat wireFormat = *WireFormat::getDefaultWireFormat() 
)
inline

Decode the input using a particular wire format and update this Interest.

If wireFormat is the default wire format, also set the defaultWireEncoding field to a copy of the input. (To not copy the input, see wireDecode(Blob).)

Parameters
inputThe input byte array to be decoded.
wireFormat(optional) A WireFormat object used to decode the input. If omitted, use WireFormat::getDefaultWireFormat().
SignedBlob ndn::Interest::wireEncode ( WireFormat wireFormat = *WireFormat::getDefaultWireFormat()) const

Encode this Interest for a particular wire format.

If wireFormat is the default wire format, also set the defaultWireEncoding field to the encoded result. Even though this is const, if wireFormat is the default wire format we update the defaultWireEncoding.

Parameters
wireFormat(optional) A WireFormat object used to encode this Interest. If omitted, use WireFormat::getDefaultWireFormat().
Returns
The encoded byte array.

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