blob: be82fee8e9e4b88c912a32df6e692037d1cc53b4 [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 */
36static inline void ndn_ForwardingEntry_init
37 (struct ndn_ForwardingEntry *self, struct ndn_NameComponent *prefixNameComponents, unsigned int maxPrefixNameComponents)
38{
39 self->action = 0;
40 self->actionLength = 0;
41 ndn_Name_init(&self->prefix, prefixNameComponents, maxPrefixNameComponents);
42 ndn_PublisherPublicKeyDigest_init(&self->publisherPublicKeyDigest);
43 self->faceId = -1;
44 self->forwardingFlags = -1;
45 self->freshnessSeconds = -1;
46}
47
48#ifdef __cplusplus
49}
50#endif
51
52#endif