Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /** |
| 3 | * Copyright (C) 2013 Regents of the University of California. |
| 4 | * @author: Jeff Thompson <jefft0@remap.ucla.edu> |
| 5 | * See COPYING for copyright and distribution information. |
| 6 | */ |
| 7 | |
| 8 | #ifndef NDN_FORWARDING_FLAGS_HPP |
Jeff Thompson | e589c3f | 2013-10-12 17:30:50 -0700 | [diff] [blame] | 9 | #define NDN_FORWARDING_FLAGS_HPP |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 10 | |
| 11 | #include "c/forwarding-flags.h" |
| 12 | |
| 13 | namespace ndn { |
| 14 | |
| 15 | /** |
| 16 | * A ForwardingFlags object holds the flags which specify how the forwarding daemon should forward an interest for |
| 17 | * a registered prefix. We use a separate ForwardingFlags object to retain future compatibility if the daemon forwarding |
| 18 | * bits are changed, amended or deprecated. |
| 19 | */ |
| 20 | class ForwardingFlags : public ndn_ForwardingFlags { |
| 21 | public: |
| 22 | /** |
| 23 | * Create a new ForwardingFlags with "active" and "childInherit" set and all other flags cleared. |
| 24 | */ |
| 25 | ForwardingFlags() |
| 26 | { |
| 27 | ndn_ForwardingFlags_initialize(this); |
| 28 | } |
| 29 | |
| 30 | ForwardingFlags(const struct ndn_ForwardingFlags &forwardingFlagsStruct) |
| 31 | : ndn_ForwardingFlags(forwardingFlagsStruct) |
| 32 | { |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Get the value of the "active" flag. |
| 37 | * @return true if the flag is set, false if it is cleared. |
| 38 | */ |
| 39 | bool getActive() const { return active; } |
| 40 | |
| 41 | /** |
| 42 | * Get the value of the "childInherit" flag. |
| 43 | * @return true if the flag is set, false if it is cleared. |
| 44 | */ |
| 45 | bool getChildInherit() const { return childInherit; } |
| 46 | |
| 47 | /** |
| 48 | * Get the value of the "advertise" flag. |
| 49 | * @return true if the flag is set, false if it is cleared. |
| 50 | */ |
| 51 | bool getAdvertise() const { return advertise; } |
| 52 | |
| 53 | /** |
| 54 | * Get the value of the "last" flag. |
| 55 | * @return true if the flag is set, false if it is cleared. |
| 56 | */ |
| 57 | bool getLast() const { return last; } |
| 58 | |
| 59 | /** |
| 60 | * Get the value of the "capture" flag. |
| 61 | * @return true if the flag is set, false if it is cleared. |
| 62 | */ |
| 63 | bool getCapture() const { return capture; } |
| 64 | |
| 65 | /** |
| 66 | * Get the value of the "local" flag. |
| 67 | * @return true if the flag is set, false if it is cleared. |
| 68 | */ |
| 69 | bool getLocal() const { return local; } |
| 70 | |
| 71 | /** |
| 72 | * Get the value of the "tap" flag. |
| 73 | * @return true if the flag is set, false if it is cleared. |
| 74 | */ |
| 75 | bool getTap() const { return tap; } |
| 76 | |
| 77 | /** |
| 78 | * Get the value of the "captureOk" flag. |
| 79 | * @return true if the flag is set, false if it is cleared. |
| 80 | */ |
| 81 | bool getCaptureOk() const { return captureOk; } |
| 82 | |
| 83 | /** |
| 84 | * Set the value of the "active" flag |
Jeff Thompson | 83bf07e | 2013-11-19 11:46:18 -0800 | [diff] [blame] | 85 | * @param active true to set the flag, false to clear it. |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 86 | */ |
Jeff Thompson | 83bf07e | 2013-11-19 11:46:18 -0800 | [diff] [blame] | 87 | void setActive(bool active) { this->active = active ? 1 : 0; } |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 88 | |
| 89 | /** |
| 90 | * Set the value of the "childInherit" flag |
Jeff Thompson | 83bf07e | 2013-11-19 11:46:18 -0800 | [diff] [blame] | 91 | * @param childInherit true to set the flag, false to clear it. |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 92 | */ |
Jeff Thompson | 83bf07e | 2013-11-19 11:46:18 -0800 | [diff] [blame] | 93 | void setChildInherit(bool childInherit) { this->childInherit = childInherit ? 1 : 0; } |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 94 | |
| 95 | /** |
| 96 | * Set the value of the "advertise" flag |
Jeff Thompson | 83bf07e | 2013-11-19 11:46:18 -0800 | [diff] [blame] | 97 | * @param advertise true to set the flag, false to clear it. |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 98 | */ |
Jeff Thompson | 83bf07e | 2013-11-19 11:46:18 -0800 | [diff] [blame] | 99 | void setAdvertise(bool advertise) { this->advertise = advertise ? 1 : 0; } |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 100 | |
| 101 | /** |
| 102 | * Set the value of the "last" flag |
Jeff Thompson | 83bf07e | 2013-11-19 11:46:18 -0800 | [diff] [blame] | 103 | * @param last true to set the flag, false to clear it. |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 104 | */ |
Jeff Thompson | 83bf07e | 2013-11-19 11:46:18 -0800 | [diff] [blame] | 105 | void setLast(bool last) { this->last = last ? 1 : 0; } |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 106 | |
| 107 | /** |
| 108 | * Set the value of the "capture" flag |
Jeff Thompson | 83bf07e | 2013-11-19 11:46:18 -0800 | [diff] [blame] | 109 | * @param capture true to set the flag, false to clear it. |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 110 | */ |
Jeff Thompson | 83bf07e | 2013-11-19 11:46:18 -0800 | [diff] [blame] | 111 | void setCapture(bool capture) { this->capture = capture ? 1 : 0; } |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 112 | |
| 113 | /** |
| 114 | * Set the value of the "local" flag |
Jeff Thompson | 83bf07e | 2013-11-19 11:46:18 -0800 | [diff] [blame] | 115 | * @param local true to set the flag, false to clear it. |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 116 | */ |
Jeff Thompson | 83bf07e | 2013-11-19 11:46:18 -0800 | [diff] [blame] | 117 | void setLocal(bool local) { this->local = local ? 1 : 0; } |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 118 | |
| 119 | /** |
| 120 | * Set the value of the "tap" flag |
Jeff Thompson | 83bf07e | 2013-11-19 11:46:18 -0800 | [diff] [blame] | 121 | * @param tap true to set the flag, false to clear it. |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 122 | */ |
Jeff Thompson | 83bf07e | 2013-11-19 11:46:18 -0800 | [diff] [blame] | 123 | void setTap(bool tap) { this->tap = tap ? 1 : 0; } |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 124 | |
| 125 | /** |
| 126 | * Set the value of the "captureOk" flag |
Jeff Thompson | 83bf07e | 2013-11-19 11:46:18 -0800 | [diff] [blame] | 127 | * @param captureOk true to set the flag, false to clear it. |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 128 | */ |
Jeff Thompson | 83bf07e | 2013-11-19 11:46:18 -0800 | [diff] [blame] | 129 | void setCaptureOk(bool captureOk) { this->captureOk = captureOk ? 1 : 0; } |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 130 | }; |
| 131 | |
| 132 | } |
| 133 | |
| 134 | #endif |