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