Jeff Thompson | 47eecfc | 2013-07-07 22:56:46 -0700 | [diff] [blame] | 1 | /** |
| 2 | * @author: Jeff Thompson |
| 3 | * See COPYING for copyright and distribution information. |
Jeff Thompson | b7f9556 | 2013-07-03 18:36:42 -0700 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #ifndef NDN_INTEREST_H |
| 7 | #define NDN_INTEREST_H |
| 8 | |
| 9 | #include "Name.h" |
| 10 | |
| 11 | #ifdef __cplusplus |
| 12 | extern "C" { |
| 13 | #endif |
| 14 | |
Jeff Thompson | ba70f8c | 2013-07-08 15:34:20 -0700 | [diff] [blame] | 15 | enum { |
| 16 | ndn_Interest_CHILD_SELECTOR_LEFT = 0, |
| 17 | ndn_Interest_CHILD_SELECTOR_RIGHT = 1, |
| 18 | ndn_Interest_ANSWER_CONTENT_STORE = 1, |
| 19 | ndn_Interest_ANSWER_GENERATED = 2, |
| 20 | ndn_Interest_ANSWER_STALE = 4, // Stale answer OK |
| 21 | ndn_Interest_MARK_STALE = 16, // Must have scope 0. Michael calls this a "hack" |
| 22 | |
| 23 | ndn_Interest_DEFAULT_ANSWER_ORIGIN_KIND = ndn_Interest_ANSWER_CONTENT_STORE | ndn_Interest_ANSWER_GENERATED |
| 24 | }; |
| 25 | |
Jeff Thompson | b7f9556 | 2013-07-03 18:36:42 -0700 | [diff] [blame] | 26 | struct ndn_Interest { |
| 27 | struct ndn_Name name; |
Jeff Thompson | b7f9556 | 2013-07-03 18:36:42 -0700 | [diff] [blame] | 28 | int minSuffixComponents; /**< -1 for none */ |
Jeff Thompson | f2e5e28 | 2013-07-08 15:26:16 -0700 | [diff] [blame] | 29 | int maxSuffixComponents; /**< -1 for none */ |
Jeff Thompson | b7f9556 | 2013-07-03 18:36:42 -0700 | [diff] [blame] | 30 | unsigned char *publisherPublicKeyDigest; /**< pointer to pre-allocated buffer. 0 for none */ |
Jeff Thompson | 88ab5dd | 2013-07-07 20:47:46 -0700 | [diff] [blame] | 31 | unsigned int publisherPublicKeyDigestLength; /**< length of publisherPublicKeyDigest. 0 for none */ |
Jeff Thompson | b7f9556 | 2013-07-03 18:36:42 -0700 | [diff] [blame] | 32 | // TODO: implement exclude |
| 33 | int childSelector; /**< -1 for none */ |
| 34 | int answerOriginKind; /**< -1 for none */ |
| 35 | int scope; /**< -1 for none */ |
| 36 | int interestLifetime; /**< milliseconds. -1 for none */ |
| 37 | unsigned char *nonce; /**< pointer to pre-allocated buffer. 0 for none */ |
Jeff Thompson | 88ab5dd | 2013-07-07 20:47:46 -0700 | [diff] [blame] | 38 | unsigned int nonceLength; /**< length of nonce. 0 for none */ |
Jeff Thompson | b7f9556 | 2013-07-03 18:36:42 -0700 | [diff] [blame] | 39 | }; |
| 40 | |
| 41 | static inline void ndn_Interest_init(struct ndn_Interest *self, struct ndn_NameComponent *nameComponents, unsigned int maxNameComponents) |
| 42 | { |
| 43 | ndn_Name_init(&self->name, nameComponents, maxNameComponents); |
Jeff Thompson | b7f9556 | 2013-07-03 18:36:42 -0700 | [diff] [blame] | 44 | self->minSuffixComponents = -1; |
Jeff Thompson | f2e5e28 | 2013-07-08 15:26:16 -0700 | [diff] [blame] | 45 | self->maxSuffixComponents = -1; |
Jeff Thompson | b7f9556 | 2013-07-03 18:36:42 -0700 | [diff] [blame] | 46 | self->publisherPublicKeyDigest = 0; |
Jeff Thompson | 462618c | 2013-07-08 15:22:15 -0700 | [diff] [blame] | 47 | self->publisherPublicKeyDigestLength = 0; |
Jeff Thompson | b7f9556 | 2013-07-03 18:36:42 -0700 | [diff] [blame] | 48 | // TODO: implement exclude |
| 49 | self->childSelector = -1; |
| 50 | self->answerOriginKind = -1; |
| 51 | self->scope = -1; |
| 52 | self->interestLifetime = -1; |
Jeff Thompson | 462618c | 2013-07-08 15:22:15 -0700 | [diff] [blame] | 53 | self->nonce = 0; |
| 54 | self->nonceLength = 0; |
Jeff Thompson | b7f9556 | 2013-07-03 18:36:42 -0700 | [diff] [blame] | 55 | } |
| 56 | |
| 57 | #ifdef __cplusplus |
| 58 | } |
| 59 | #endif |
| 60 | |
| 61 | #endif |
| 62 | |