Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 1 | /** |
| 2 | * Copyright (C) 2013 Regents of the University of California. |
| 3 | * @author: Jeff Thompson <jefft0@remap.ucla.edu> |
| 4 | * See COPYING for copyright and distribution information. |
| 5 | */ |
| 6 | |
| 7 | #ifndef NDN_FORWARDING_FLAGS_H |
Jeff Thompson | e589c3f | 2013-10-12 17:30:50 -0700 | [diff] [blame] | 8 | #define NDN_FORWARDING_FLAGS_H |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 9 | |
Jeff Thompson | e589c3f | 2013-10-12 17:30:50 -0700 | [diff] [blame] | 10 | #ifdef __cplusplus |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 11 | extern "C" { |
| 12 | #endif |
| 13 | |
| 14 | /** |
| 15 | * An ndn_ForwardingFlags object holds the flags which specify how the forwarding daemon should forward an interest for |
| 16 | * a registered prefix. We use a separate ForwardingFlags object to retain future compatibility if the daemon forwarding |
| 17 | * bits are changed, amended or deprecated. |
| 18 | */ |
| 19 | struct ndn_ForwardingFlags { |
| 20 | int active; /**< 1 if the flag is set, 0 if cleared. */ |
| 21 | int childInherit; |
| 22 | int advertise; |
| 23 | int last; |
| 24 | int capture; |
| 25 | int local; |
| 26 | int tap; |
| 27 | int captureOk; |
| 28 | }; |
| 29 | |
| 30 | /** |
| 31 | * Initialize an ndn_ForwardingFlags struct with the default with "active" and "childInherit" set and all other flags cleared. |
| 32 | * @param self A pointer to the ndn_ForwardingFlags struct. |
| 33 | */ |
| 34 | void ndn_ForwardingFlags_initialize(struct ndn_ForwardingFlags *self); |
| 35 | |
| 36 | /** |
| 37 | * Get an integer with the bits set according to the flags as used by the ForwardingEntry message. |
| 38 | * @param self A pointer to the ndn_ForwardingFlags struct. |
| 39 | * @return An integer with the bits set. |
| 40 | */ |
| 41 | int ndn_ForwardingFlags_getForwardingEntryFlags(struct ndn_ForwardingFlags *self); |
| 42 | |
| 43 | /** |
| 44 | * Set the flags according to the bits in forwardingEntryFlags as used by the ForwardingEntry message. |
| 45 | * @param self A pointer to the ndn_ForwardingFlags struct. |
| 46 | * @param flags An integer with the bits set. |
| 47 | */ |
| 48 | void ndn_ForwardingFlags_setForwardingEntryFlags(struct ndn_ForwardingFlags *self, int forwardingEntryFlags); |
| 49 | |
| 50 | |
Jeff Thompson | e589c3f | 2013-10-12 17:30:50 -0700 | [diff] [blame] | 51 | #ifdef __cplusplus |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 52 | } |
| 53 | #endif |
| 54 | |
| 55 | #endif |