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 | |
| 10 | #include "name.h" |
| 11 | #include "publisher-public-key-digest.h" |
| 12 | |
| 13 | #ifdef __cplusplus |
| 14 | extern "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 | */ |
| 20 | struct 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 Thompson | d1427fb | 2013-08-29 17:20:32 -0700 | [diff] [blame] | 37 | static inline void ndn_ForwardingEntry_initialize |
Jeff Thompson | 990599b | 2013-08-27 15:14:25 -0700 | [diff] [blame] | 38 | (struct ndn_ForwardingEntry *self, struct ndn_NameComponent *prefixNameComponents, unsigned int maxPrefixNameComponents) |
| 39 | { |
| 40 | self->action = 0; |
| 41 | self->actionLength = 0; |
Jeff Thompson | d1427fb | 2013-08-29 17:20:32 -0700 | [diff] [blame] | 42 | ndn_Name_initialize(&self->prefix, prefixNameComponents, maxPrefixNameComponents); |
| 43 | ndn_PublisherPublicKeyDigest_initialize(&self->publisherPublicKeyDigest); |
Jeff Thompson | 990599b | 2013-08-27 15:14:25 -0700 | [diff] [blame] | 44 | self->faceId = -1; |
| 45 | self->forwardingFlags = -1; |
| 46 | self->freshnessSeconds = -1; |
| 47 | } |
| 48 | |
| 49 | #ifdef __cplusplus |
| 50 | } |
| 51 | #endif |
| 52 | |
| 53 | #endif |