blob: 52f5a949f9c4bb4d9f65917384de4bebc5efe35f [file] [log] [blame]
Jeff Thompson47eecfc2013-07-07 22:56:46 -07001/**
2 * @author: Jeff Thompson
3 * See COPYING for copyright and distribution information.
Jeff Thompsonb7f95562013-07-03 18:36:42 -07004 */
5
6#ifndef NDN_INTEREST_H
7#define NDN_INTEREST_H
8
9#include "Name.h"
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15struct ndn_Interest {
16 struct ndn_Name name;
Jeff Thompsonb7f95562013-07-03 18:36:42 -070017 int minSuffixComponents; /**< -1 for none */
Jeff Thompsonf2e5e282013-07-08 15:26:16 -070018 int maxSuffixComponents; /**< -1 for none */
Jeff Thompsonb7f95562013-07-03 18:36:42 -070019 unsigned char *publisherPublicKeyDigest; /**< pointer to pre-allocated buffer. 0 for none */
Jeff Thompson88ab5dd2013-07-07 20:47:46 -070020 unsigned int publisherPublicKeyDigestLength; /**< length of publisherPublicKeyDigest. 0 for none */
Jeff Thompsonb7f95562013-07-03 18:36:42 -070021 // TODO: implement exclude
22 int childSelector; /**< -1 for none */
23 int answerOriginKind; /**< -1 for none */
24 int scope; /**< -1 for none */
25 int interestLifetime; /**< milliseconds. -1 for none */
26 unsigned char *nonce; /**< pointer to pre-allocated buffer. 0 for none */
Jeff Thompson88ab5dd2013-07-07 20:47:46 -070027 unsigned int nonceLength; /**< length of nonce. 0 for none */
Jeff Thompsonb7f95562013-07-03 18:36:42 -070028};
29
30static inline void ndn_Interest_init(struct ndn_Interest *self, struct ndn_NameComponent *nameComponents, unsigned int maxNameComponents)
31{
32 ndn_Name_init(&self->name, nameComponents, maxNameComponents);
Jeff Thompsonb7f95562013-07-03 18:36:42 -070033 self->minSuffixComponents = -1;
Jeff Thompsonf2e5e282013-07-08 15:26:16 -070034 self->maxSuffixComponents = -1;
Jeff Thompsonb7f95562013-07-03 18:36:42 -070035 self->publisherPublicKeyDigest = 0;
Jeff Thompson462618c2013-07-08 15:22:15 -070036 self->publisherPublicKeyDigestLength = 0;
Jeff Thompsonb7f95562013-07-03 18:36:42 -070037 // TODO: implement exclude
38 self->childSelector = -1;
39 self->answerOriginKind = -1;
40 self->scope = -1;
41 self->interestLifetime = -1;
Jeff Thompson462618c2013-07-08 15:22:15 -070042 self->nonce = 0;
43 self->nonceLength = 0;
Jeff Thompsonb7f95562013-07-03 18:36:42 -070044}
45
46#ifdef __cplusplus
47}
48#endif
49
50#endif
51