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