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 | |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 11 | namespace ndn { |
| 12 | |
| 13 | /** |
| 14 | * A ForwardingFlags object holds the flags which specify how the forwarding daemon should forward an interest for |
| 15 | * a registered prefix. We use a separate ForwardingFlags object to retain future compatibility if the daemon forwarding |
| 16 | * bits are changed, amended or deprecated. |
| 17 | */ |
Alexander Afanasyev | 895b2f3 | 2014-01-03 13:24:52 -0800 | [diff] [blame^] | 18 | class ForwardingFlags { |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 19 | public: |
| 20 | /** |
| 21 | * Create a new ForwardingFlags with "active" and "childInherit" set and all other flags cleared. |
| 22 | */ |
| 23 | ForwardingFlags() |
Alexander Afanasyev | 895b2f3 | 2014-01-03 13:24:52 -0800 | [diff] [blame^] | 24 | : active_(true) |
| 25 | , childInherit_(true) |
| 26 | , advertise_(false) |
| 27 | , last_(false) |
| 28 | , capture_(false) |
| 29 | , local_(false) |
| 30 | , tap_(false) |
| 31 | , captureOk_(false) |
| 32 | |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 33 | { |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Get the value of the "active" flag. |
| 38 | * @return true if the flag is set, false if it is cleared. |
| 39 | */ |
Alexander Afanasyev | 895b2f3 | 2014-01-03 13:24:52 -0800 | [diff] [blame^] | 40 | bool getActive() const { return active_; } |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 41 | |
| 42 | /** |
| 43 | * Get the value of the "childInherit" flag. |
| 44 | * @return true if the flag is set, false if it is cleared. |
| 45 | */ |
Alexander Afanasyev | 895b2f3 | 2014-01-03 13:24:52 -0800 | [diff] [blame^] | 46 | bool getChildInherit() const { return childInherit_; } |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 47 | |
| 48 | /** |
| 49 | * Get the value of the "advertise" flag. |
| 50 | * @return true if the flag is set, false if it is cleared. |
| 51 | */ |
Alexander Afanasyev | 895b2f3 | 2014-01-03 13:24:52 -0800 | [diff] [blame^] | 52 | bool getAdvertise() const { return advertise_; } |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 53 | |
| 54 | /** |
| 55 | * Get the value of the "last" flag. |
| 56 | * @return true if the flag is set, false if it is cleared. |
| 57 | */ |
Alexander Afanasyev | 895b2f3 | 2014-01-03 13:24:52 -0800 | [diff] [blame^] | 58 | bool getLast() const { return last_; } |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 59 | |
| 60 | /** |
| 61 | * Get the value of the "capture" flag. |
| 62 | * @return true if the flag is set, false if it is cleared. |
| 63 | */ |
Alexander Afanasyev | 895b2f3 | 2014-01-03 13:24:52 -0800 | [diff] [blame^] | 64 | bool getCapture() const { return capture_; } |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 65 | |
| 66 | /** |
| 67 | * Get the value of the "local" flag. |
| 68 | * @return true if the flag is set, false if it is cleared. |
| 69 | */ |
Alexander Afanasyev | 895b2f3 | 2014-01-03 13:24:52 -0800 | [diff] [blame^] | 70 | bool getLocal() const { return local_; } |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 71 | |
| 72 | /** |
| 73 | * Get the value of the "tap" flag. |
| 74 | * @return true if the flag is set, false if it is cleared. |
| 75 | */ |
Alexander Afanasyev | 895b2f3 | 2014-01-03 13:24:52 -0800 | [diff] [blame^] | 76 | bool getTap() const { return tap_; } |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 77 | |
| 78 | /** |
| 79 | * Get the value of the "captureOk" flag. |
| 80 | * @return true if the flag is set, false if it is cleared. |
| 81 | */ |
Alexander Afanasyev | 895b2f3 | 2014-01-03 13:24:52 -0800 | [diff] [blame^] | 82 | bool getCaptureOk() const { return captureOk_; } |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 83 | |
| 84 | /** |
| 85 | * Set the value of the "active" flag |
Jeff Thompson | 83bf07e | 2013-11-19 11:46:18 -0800 | [diff] [blame] | 86 | * @param active true to set the flag, false to clear it. |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 87 | */ |
Alexander Afanasyev | 895b2f3 | 2014-01-03 13:24:52 -0800 | [diff] [blame^] | 88 | void setActive(bool active) { this->active_ = active; } |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 89 | |
| 90 | /** |
| 91 | * Set the value of the "childInherit" flag |
Jeff Thompson | 83bf07e | 2013-11-19 11:46:18 -0800 | [diff] [blame] | 92 | * @param childInherit true to set the flag, false to clear it. |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 93 | */ |
Alexander Afanasyev | 895b2f3 | 2014-01-03 13:24:52 -0800 | [diff] [blame^] | 94 | void setChildInherit(bool childInherit) { this->childInherit_ = childInherit; } |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 95 | |
| 96 | /** |
| 97 | * Set the value of the "advertise" flag |
Jeff Thompson | 83bf07e | 2013-11-19 11:46:18 -0800 | [diff] [blame] | 98 | * @param advertise true to set the flag, false to clear it. |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 99 | */ |
Alexander Afanasyev | 895b2f3 | 2014-01-03 13:24:52 -0800 | [diff] [blame^] | 100 | void setAdvertise(bool advertise) { this->advertise_ = advertise; } |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 101 | |
| 102 | /** |
| 103 | * Set the value of the "last" flag |
Jeff Thompson | 83bf07e | 2013-11-19 11:46:18 -0800 | [diff] [blame] | 104 | * @param last true to set the flag, false to clear it. |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 105 | */ |
Alexander Afanasyev | 895b2f3 | 2014-01-03 13:24:52 -0800 | [diff] [blame^] | 106 | void setLast(bool last) { this->last_ = last; } |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 107 | |
| 108 | /** |
| 109 | * Set the value of the "capture" flag |
Jeff Thompson | 83bf07e | 2013-11-19 11:46:18 -0800 | [diff] [blame] | 110 | * @param capture true to set the flag, false to clear it. |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 111 | */ |
Alexander Afanasyev | 895b2f3 | 2014-01-03 13:24:52 -0800 | [diff] [blame^] | 112 | void setCapture(bool capture) { this->capture_ = capture; } |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 113 | |
| 114 | /** |
| 115 | * Set the value of the "local" flag |
Jeff Thompson | 83bf07e | 2013-11-19 11:46:18 -0800 | [diff] [blame] | 116 | * @param local true to set the flag, false to clear it. |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 117 | */ |
Alexander Afanasyev | 895b2f3 | 2014-01-03 13:24:52 -0800 | [diff] [blame^] | 118 | void setLocal(bool local) { this->local_ = local; } |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 119 | |
| 120 | /** |
| 121 | * Set the value of the "tap" flag |
Jeff Thompson | 83bf07e | 2013-11-19 11:46:18 -0800 | [diff] [blame] | 122 | * @param tap true to set the flag, false to clear it. |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 123 | */ |
Alexander Afanasyev | 895b2f3 | 2014-01-03 13:24:52 -0800 | [diff] [blame^] | 124 | void setTap(bool tap) { this->tap_ = tap; } |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 125 | |
| 126 | /** |
| 127 | * Set the value of the "captureOk" flag |
Jeff Thompson | 83bf07e | 2013-11-19 11:46:18 -0800 | [diff] [blame] | 128 | * @param captureOk true to set the flag, false to clear it. |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 129 | */ |
Alexander Afanasyev | 895b2f3 | 2014-01-03 13:24:52 -0800 | [diff] [blame^] | 130 | void setCaptureOk(bool captureOk) { this->captureOk_ = captureOk; } |
| 131 | |
| 132 | private: |
| 133 | bool active_; |
| 134 | bool childInherit_; |
| 135 | bool advertise_; |
| 136 | bool last_; |
| 137 | bool capture_; |
| 138 | bool local_; |
| 139 | bool tap_; |
| 140 | bool captureOk_; |
Jeff Thompson | 1f8a31a | 2013-09-30 16:18:47 -0700 | [diff] [blame] | 141 | }; |
| 142 | |
| 143 | } |
| 144 | |
| 145 | #endif |