21 #ifndef NDN_INTEREST_H
22 #define NDN_INTEREST_H
24 #include <ndn-cpp/c/interest-types.h>
26 #include "publisher-public-key-digest.h"
27 #include "key-locator.h"
40 static __inline
void ndn_ExcludeEntry_initialize(
struct ndn_ExcludeEntry *
self, ndn_ExcludeType type,
const uint8_t *component,
size_t componentLength)
43 ndn_NameComponent_initialize(&self->component, component, componentLength);
52 ndn_ExcludeEntry_setFromExcludeEntry
66 self->entries = entries;
67 self->maxEntries = maxEntries;
99 ndn_Exclude_appendComponent
100 (
struct ndn_Exclude *
self,
const uint8_t* component,
size_t componentLength);
110 ndn_Exclude_setFromExclude
124 static __inline
void ndn_Interest_initialize
127 size_t maxKeyNameComponents)
129 ndn_Name_initialize(&self->name, nameComponents, maxNameComponents);
130 self->minSuffixComponents = -1;
131 self->maxSuffixComponents = -1;
132 ndn_PublisherPublicKeyDigest_initialize(&self->publisherPublicKeyDigest);
133 ndn_Exclude_initialize(&self->exclude, excludeEntries, maxExcludeEntries);
134 self->childSelector = -1;
135 self->answerOriginKind = -1;
137 self->interestLifetimeMilliseconds = -1.0;
138 ndn_Blob_initialize(&self->nonce, 0, 0);
139 ndn_KeyLocator_initialize(&self->keyLocator, keyNameComponents, maxKeyNameComponents);
148 static __inline
int ndn_Interest_getMustBeFresh(
const struct ndn_Interest *
self)
150 if (self->answerOriginKind < 0)
153 return (self->answerOriginKind & ndn_Interest_ANSWER_STALE) == 0 ? 1 : 0;
164 ndn_Interest_setMustBeFresh(
struct ndn_Interest *
self,
int mustBeFresh)
166 if (self->answerOriginKind < 0) {
170 self->answerOriginKind = ndn_Interest_ANSWER_STALE;
175 self->answerOriginKind &= ~ndn_Interest_ANSWER_STALE;
178 self->answerOriginKind |= ndn_Interest_ANSWER_STALE;
189 static __inline ndn_Error
190 ndn_Interest_setFromInterest
197 return NDN_ERROR_success;
199 if ((error = ndn_Name_setFromName(&self->name, &other->name)))
204 if ((error = ndn_Exclude_setFromExclude(&self->exclude, &other->exclude)))
208 self->scope = other->
scope;
210 ndn_Blob_setFromBlob(&self->nonce, &other->
nonce);
211 if ((error = ndn_KeyLocator_setFromKeyLocator
212 (&self->keyLocator, &other->keyLocator)))
215 return NDN_ERROR_success;
An ndn_ExcludeEntry holds an ndn_ExcludeType, and if it is a COMPONENT, it holds a pointer to the com...
Definition: interest-types.h:40
int childSelector
-1 for none
Definition: interest-types.h:79
struct ndn_Blob nonce
The blob whose value is a pointer to a pre-allocated buffer.
Definition: interest-types.h:83
ndn_Milliseconds interestLifetimeMilliseconds
-1.0 for none
Definition: interest-types.h:82
An ndn_Interest holds an ndn_Name and other fields for an interest.
Definition: interest-types.h:70
int scope
-1 for none
Definition: interest-types.h:81
struct ndn_PublisherPublicKeyDigest publisherPublicKeyDigest
Definition: interest-types.h:76
int minSuffixComponents
-1 for none
Definition: interest-types.h:72
An ndn_Exclude holds an array of ndn_ExcludeEntry.
Definition: interest-types.h:48
Copyright (C) 2015 Regents of the University of California.
Definition: name-types.h:33
int answerOriginKind
-1 for none.
Definition: interest-types.h:80
int maxSuffixComponents
-1 for none
Definition: interest-types.h:73