Jeff Thompson | b7f9556 | 2013-07-03 18:36:42 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Author: Jeff Thompson |
| 3 | * |
| 4 | * BSD license, See the LICENSE file for more information. |
| 5 | */ |
| 6 | |
| 7 | #ifndef NDN_INTEREST_H |
| 8 | #define NDN_INTEREST_H |
| 9 | |
| 10 | #include "Name.h" |
| 11 | |
| 12 | #ifdef __cplusplus |
| 13 | extern "C" { |
| 14 | #endif |
| 15 | |
| 16 | struct ndn_Interest { |
| 17 | struct ndn_Name name; |
| 18 | int maxSuffixComponents; /**< -1 for none */ |
| 19 | int minSuffixComponents; /**< -1 for none */ |
| 20 | unsigned char *publisherPublicKeyDigest; /**< pointer to pre-allocated buffer. 0 for none */ |
Jeff Thompson | 88ab5dd | 2013-07-07 20:47:46 -0700 | [diff] [blame^] | 21 | unsigned int publisherPublicKeyDigestLength; /**< length of publisherPublicKeyDigest. 0 for none */ |
Jeff Thompson | b7f9556 | 2013-07-03 18:36:42 -0700 | [diff] [blame] | 22 | // TODO: implement exclude |
| 23 | int childSelector; /**< -1 for none */ |
| 24 | int answerOriginKind; /**< -1 for none */ |
| 25 | int scope; /**< -1 for none */ |
| 26 | int interestLifetime; /**< milliseconds. -1 for none */ |
| 27 | unsigned char *nonce; /**< pointer to pre-allocated buffer. 0 for none */ |
Jeff Thompson | 88ab5dd | 2013-07-07 20:47:46 -0700 | [diff] [blame^] | 28 | unsigned int nonceLength; /**< length of nonce. 0 for none */ |
Jeff Thompson | b7f9556 | 2013-07-03 18:36:42 -0700 | [diff] [blame] | 29 | }; |
| 30 | |
| 31 | static inline void ndn_Interest_init(struct ndn_Interest *self, struct ndn_NameComponent *nameComponents, unsigned int maxNameComponents) |
| 32 | { |
| 33 | ndn_Name_init(&self->name, nameComponents, maxNameComponents); |
| 34 | self->maxSuffixComponents = -1; |
| 35 | self->minSuffixComponents = -1; |
| 36 | self->publisherPublicKeyDigest = 0; |
| 37 | // TODO: implement exclude |
| 38 | self->childSelector = -1; |
| 39 | self->answerOriginKind = -1; |
| 40 | self->scope = -1; |
| 41 | self->interestLifetime = -1; |
| 42 | self->nonce = 0; /**< length of nonce */ |
| 43 | } |
| 44 | |
| 45 | #ifdef __cplusplus |
| 46 | } |
| 47 | #endif |
| 48 | |
| 49 | #endif |
| 50 | |