blob: 0769fa0a1c6b24d96db90bf979d551bec85133c1 [file] [log] [blame]
/**
* @author: Jeff Thompson
* See COPYING for copyright and distribution information.
*/
#ifndef NDN_FORWARDING_ENTRY_H
#define NDN_FORWARDING_ENTRY_H
#include "name.h"
#include "publisher-public-key-digest.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* An ndn_ForwardingEntry holds fields for a ForwardingEntry which is used to register a prefix with a hub.
*/
struct ndn_ForwardingEntry {
unsigned char *action; /**< pointer to pre-allocated buffer. 0 for none. */
unsigned int actionLength; /**< length of action. 0 for none. */
struct ndn_Name prefix;
struct ndn_PublisherPublicKeyDigest publisherPublicKeyDigest;
int faceId; /**< -1 for none. */
int forwardingFlags; /**< -1 for none. */
int freshnessSeconds; /**< -1 for none. */
};
/**
* Initialize an ndn_ForwardingEntry struct with the pre-allocated prefixNameComponents,
* and defaults for all the values.
* @param self pointer to the ndn_Interest struct
* @param prefixNameComponents the pre-allocated array of ndn_NameComponent
* @param maxPrefixNameComponents the number of elements in the allocated prefixNameComponents array
*/
static inline void ndn_ForwardingEntry_initialize
(struct ndn_ForwardingEntry *self, struct ndn_NameComponent *prefixNameComponents, unsigned int maxPrefixNameComponents)
{
self->action = 0;
self->actionLength = 0;
ndn_Name_initialize(&self->prefix, prefixNameComponents, maxPrefixNameComponents);
ndn_PublisherPublicKeyDigest_initialize(&self->publisherPublicKeyDigest);
self->faceId = -1;
self->forwardingFlags = -1;
self->freshnessSeconds = -1;
}
#ifdef __cplusplus
}
#endif
#endif