21 #ifndef NDN_INTEREST_H
22 #define NDN_INTEREST_H
24 #include <ndn-cpp/c/interest-types.h>
26 #include "key-locator.h"
39 static __inline
void ndn_ExcludeEntry_initialize(
struct ndn_ExcludeEntry *
self, ndn_ExcludeType type,
const uint8_t *component,
size_t componentLength)
42 ndn_NameComponent_initialize(&self->component, component, componentLength);
51 ndn_ExcludeEntry_setFromExcludeEntry
65 self->entries = entries;
66 self->maxEntries = maxEntries;
98 ndn_Exclude_appendComponent
99 (
struct ndn_Exclude *
self,
const uint8_t* component,
size_t componentLength);
109 ndn_Exclude_setFromExclude
123 static __inline
void ndn_Interest_initialize
126 size_t maxKeyNameComponents)
128 ndn_Name_initialize(&self->name, nameComponents, maxNameComponents);
129 self->minSuffixComponents = -1;
130 self->maxSuffixComponents = -1;
131 ndn_Exclude_initialize(&self->exclude, excludeEntries, maxExcludeEntries);
132 self->childSelector = -1;
133 self->mustBeFresh = 1;
134 self->interestLifetimeMilliseconds = -1.0;
135 ndn_Blob_initialize(&self->nonce, 0, 0);
136 ndn_KeyLocator_initialize(&self->keyLocator, keyNameComponents, maxKeyNameComponents);
137 ndn_Blob_initialize(&self->linkWireEncoding, 0, 0);
138 self->selectedDelegationIndex = -1;
146 static __inline
int ndn_Interest_getMustBeFresh(
const struct ndn_Interest *
self)
148 return self->mustBeFresh;
159 ndn_Interest_setMustBeFresh(
struct ndn_Interest *
self,
int mustBeFresh)
161 self->mustBeFresh = (mustBeFresh ? 1 : 0);
171 static __inline ndn_Error
172 ndn_Interest_setFromInterest
179 return NDN_ERROR_success;
181 if ((error = ndn_Name_setFromName(&self->name, &other->name)))
185 if ((error = ndn_Exclude_setFromExclude(&self->exclude, &other->exclude)))
190 ndn_Blob_setFromBlob(&self->nonce, &other->
nonce);
191 if ((error = ndn_KeyLocator_setFromKeyLocator
192 (&self->keyLocator, &other->keyLocator)))
197 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:39
int mustBeFresh
bool.
Definition: interest-types.h:68
int childSelector
-1 for none
Definition: interest-types.h:67
int selectedDelegationIndex
-1 for none
Definition: interest-types.h:72
struct ndn_Blob nonce
The blob whose value is a pointer to a pre-allocated buffer.
Definition: interest-types.h:70
ndn_Milliseconds interestLifetimeMilliseconds
-1.0 for none
Definition: interest-types.h:69
An ndn_Interest holds an ndn_Name and other fields for an interest.
Definition: interest-types.h:61
int minSuffixComponents
-1 for none
Definition: interest-types.h:63
An ndn_Exclude holds an array of ndn_ExcludeEntry.
Definition: interest-types.h:47
Copyright (C) 2015-2016 Regents of the University of California.
Definition: name-types.h:33
struct ndn_Blob linkWireEncoding
The link whose value is a pointer to a pre-allocated buffer.
Definition: interest-types.h:71
int maxSuffixComponents
-1 for none
Definition: interest-types.h:64