blob: 0769fa0a1c6b24d96db90bf979d551bec85133c1 [file] [log] [blame]
Jeff Thompson990599b2013-08-27 15:14:25 -07001/**
2 * @author: Jeff Thompson
3 * See COPYING for copyright and distribution information.
4 */
5
6#ifndef NDN_FORWARDING_ENTRY_H
7#define NDN_FORWARDING_ENTRY_H
8
9#include "name.h"
10#include "publisher-public-key-digest.h"
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16/**
17 * An ndn_ForwardingEntry holds fields for a ForwardingEntry which is used to register a prefix with a hub.
18 */
19struct ndn_ForwardingEntry {
20 unsigned char *action; /**< pointer to pre-allocated buffer. 0 for none. */
21 unsigned int actionLength; /**< length of action. 0 for none. */
22 struct ndn_Name prefix;
23 struct ndn_PublisherPublicKeyDigest publisherPublicKeyDigest;
24 int faceId; /**< -1 for none. */
25 int forwardingFlags; /**< -1 for none. */
26 int freshnessSeconds; /**< -1 for none. */
27};
28
29/**
30 * Initialize an ndn_ForwardingEntry struct with the pre-allocated prefixNameComponents,
31 * and defaults for all the values.
32 * @param self pointer to the ndn_Interest struct
33 * @param prefixNameComponents the pre-allocated array of ndn_NameComponent
34 * @param maxPrefixNameComponents the number of elements in the allocated prefixNameComponents array
35 */
Jeff Thompsond1427fb2013-08-29 17:20:32 -070036static inline void ndn_ForwardingEntry_initialize
Jeff Thompson990599b2013-08-27 15:14:25 -070037 (struct ndn_ForwardingEntry *self, struct ndn_NameComponent *prefixNameComponents, unsigned int maxPrefixNameComponents)
38{
39 self->action = 0;
40 self->actionLength = 0;
Jeff Thompsond1427fb2013-08-29 17:20:32 -070041 ndn_Name_initialize(&self->prefix, prefixNameComponents, maxPrefixNameComponents);
42 ndn_PublisherPublicKeyDigest_initialize(&self->publisherPublicKeyDigest);
Jeff Thompson990599b2013-08-27 15:14:25 -070043 self->faceId = -1;
44 self->forwardingFlags = -1;
45 self->freshnessSeconds = -1;
46}
47
48#ifdef __cplusplus
49}
50#endif
51
52#endif