blob: e0b91a94646318e23a1201a8f4b98997ad8e088b [file] [log] [blame]
Jeff Thompson1f8a31a2013-09-30 16:18:47 -07001/* -*- 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 Thompsone589c3f2013-10-12 17:30:50 -07009#define NDN_FORWARDING_FLAGS_HPP
Jeff Thompson1f8a31a2013-09-30 16:18:47 -070010
Jeff Thompson1f8a31a2013-09-30 16:18:47 -070011namespace 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 Afanasyev895b2f32014-01-03 13:24:52 -080018class ForwardingFlags {
Jeff Thompson1f8a31a2013-09-30 16:18:47 -070019public:
20 /**
21 * Create a new ForwardingFlags with "active" and "childInherit" set and all other flags cleared.
22 */
23 ForwardingFlags()
Alexander Afanasyev895b2f32014-01-03 13:24:52 -080024 : 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 Thompson1f8a31a2013-09-30 16:18:47 -070033 {
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 Afanasyev895b2f32014-01-03 13:24:52 -080040 bool getActive() const { return active_; }
Jeff Thompson1f8a31a2013-09-30 16:18:47 -070041
42 /**
43 * Get the value of the "childInherit" flag.
44 * @return true if the flag is set, false if it is cleared.
45 */
Alexander Afanasyev895b2f32014-01-03 13:24:52 -080046 bool getChildInherit() const { return childInherit_; }
Jeff Thompson1f8a31a2013-09-30 16:18:47 -070047
48 /**
49 * Get the value of the "advertise" flag.
50 * @return true if the flag is set, false if it is cleared.
51 */
Alexander Afanasyev895b2f32014-01-03 13:24:52 -080052 bool getAdvertise() const { return advertise_; }
Jeff Thompson1f8a31a2013-09-30 16:18:47 -070053
54 /**
55 * Get the value of the "last" flag.
56 * @return true if the flag is set, false if it is cleared.
57 */
Alexander Afanasyev895b2f32014-01-03 13:24:52 -080058 bool getLast() const { return last_; }
Jeff Thompson1f8a31a2013-09-30 16:18:47 -070059
60 /**
61 * Get the value of the "capture" flag.
62 * @return true if the flag is set, false if it is cleared.
63 */
Alexander Afanasyev895b2f32014-01-03 13:24:52 -080064 bool getCapture() const { return capture_; }
Jeff Thompson1f8a31a2013-09-30 16:18:47 -070065
66 /**
67 * Get the value of the "local" flag.
68 * @return true if the flag is set, false if it is cleared.
69 */
Alexander Afanasyev895b2f32014-01-03 13:24:52 -080070 bool getLocal() const { return local_; }
Jeff Thompson1f8a31a2013-09-30 16:18:47 -070071
72 /**
73 * Get the value of the "tap" flag.
74 * @return true if the flag is set, false if it is cleared.
75 */
Alexander Afanasyev895b2f32014-01-03 13:24:52 -080076 bool getTap() const { return tap_; }
Jeff Thompson1f8a31a2013-09-30 16:18:47 -070077
78 /**
79 * Get the value of the "captureOk" flag.
80 * @return true if the flag is set, false if it is cleared.
81 */
Alexander Afanasyev895b2f32014-01-03 13:24:52 -080082 bool getCaptureOk() const { return captureOk_; }
Jeff Thompson1f8a31a2013-09-30 16:18:47 -070083
84 /**
85 * Set the value of the "active" flag
Jeff Thompson83bf07e2013-11-19 11:46:18 -080086 * @param active true to set the flag, false to clear it.
Jeff Thompson1f8a31a2013-09-30 16:18:47 -070087 */
Alexander Afanasyev895b2f32014-01-03 13:24:52 -080088 void setActive(bool active) { this->active_ = active; }
Jeff Thompson1f8a31a2013-09-30 16:18:47 -070089
90 /**
91 * Set the value of the "childInherit" flag
Jeff Thompson83bf07e2013-11-19 11:46:18 -080092 * @param childInherit true to set the flag, false to clear it.
Jeff Thompson1f8a31a2013-09-30 16:18:47 -070093 */
Alexander Afanasyev895b2f32014-01-03 13:24:52 -080094 void setChildInherit(bool childInherit) { this->childInherit_ = childInherit; }
Jeff Thompson1f8a31a2013-09-30 16:18:47 -070095
96 /**
97 * Set the value of the "advertise" flag
Jeff Thompson83bf07e2013-11-19 11:46:18 -080098 * @param advertise true to set the flag, false to clear it.
Jeff Thompson1f8a31a2013-09-30 16:18:47 -070099 */
Alexander Afanasyev895b2f32014-01-03 13:24:52 -0800100 void setAdvertise(bool advertise) { this->advertise_ = advertise; }
Jeff Thompson1f8a31a2013-09-30 16:18:47 -0700101
102 /**
103 * Set the value of the "last" flag
Jeff Thompson83bf07e2013-11-19 11:46:18 -0800104 * @param last true to set the flag, false to clear it.
Jeff Thompson1f8a31a2013-09-30 16:18:47 -0700105 */
Alexander Afanasyev895b2f32014-01-03 13:24:52 -0800106 void setLast(bool last) { this->last_ = last; }
Jeff Thompson1f8a31a2013-09-30 16:18:47 -0700107
108 /**
109 * Set the value of the "capture" flag
Jeff Thompson83bf07e2013-11-19 11:46:18 -0800110 * @param capture true to set the flag, false to clear it.
Jeff Thompson1f8a31a2013-09-30 16:18:47 -0700111 */
Alexander Afanasyev895b2f32014-01-03 13:24:52 -0800112 void setCapture(bool capture) { this->capture_ = capture; }
Jeff Thompson1f8a31a2013-09-30 16:18:47 -0700113
114 /**
115 * Set the value of the "local" flag
Jeff Thompson83bf07e2013-11-19 11:46:18 -0800116 * @param local true to set the flag, false to clear it.
Jeff Thompson1f8a31a2013-09-30 16:18:47 -0700117 */
Alexander Afanasyev895b2f32014-01-03 13:24:52 -0800118 void setLocal(bool local) { this->local_ = local; }
Jeff Thompson1f8a31a2013-09-30 16:18:47 -0700119
120 /**
121 * Set the value of the "tap" flag
Jeff Thompson83bf07e2013-11-19 11:46:18 -0800122 * @param tap true to set the flag, false to clear it.
Jeff Thompson1f8a31a2013-09-30 16:18:47 -0700123 */
Alexander Afanasyev895b2f32014-01-03 13:24:52 -0800124 void setTap(bool tap) { this->tap_ = tap; }
Jeff Thompson1f8a31a2013-09-30 16:18:47 -0700125
126 /**
127 * Set the value of the "captureOk" flag
Jeff Thompson83bf07e2013-11-19 11:46:18 -0800128 * @param captureOk true to set the flag, false to clear it.
Jeff Thompson1f8a31a2013-09-30 16:18:47 -0700129 */
Alexander Afanasyev895b2f32014-01-03 13:24:52 -0800130 void setCaptureOk(bool captureOk) { this->captureOk_ = captureOk; }
131
132private:
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 Thompson1f8a31a2013-09-30 16:18:47 -0700141};
142
143}
144
145#endif