blob: 7c878b9c719c306b90a114610861fd01aec16734 [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
11#include "c/forwarding-flags.h"
12
13namespace 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 */
20class ForwardingFlags : public ndn_ForwardingFlags {
21public:
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 Thompson83bf07e2013-11-19 11:46:18 -080085 * @param active true to set the flag, false to clear it.
Jeff Thompson1f8a31a2013-09-30 16:18:47 -070086 */
Jeff Thompson83bf07e2013-11-19 11:46:18 -080087 void setActive(bool active) { this->active = active ? 1 : 0; }
Jeff Thompson1f8a31a2013-09-30 16:18:47 -070088
89 /**
90 * Set the value of the "childInherit" flag
Jeff Thompson83bf07e2013-11-19 11:46:18 -080091 * @param childInherit true to set the flag, false to clear it.
Jeff Thompson1f8a31a2013-09-30 16:18:47 -070092 */
Jeff Thompson83bf07e2013-11-19 11:46:18 -080093 void setChildInherit(bool childInherit) { this->childInherit = childInherit ? 1 : 0; }
Jeff Thompson1f8a31a2013-09-30 16:18:47 -070094
95 /**
96 * Set the value of the "advertise" flag
Jeff Thompson83bf07e2013-11-19 11:46:18 -080097 * @param advertise true to set the flag, false to clear it.
Jeff Thompson1f8a31a2013-09-30 16:18:47 -070098 */
Jeff Thompson83bf07e2013-11-19 11:46:18 -080099 void setAdvertise(bool advertise) { this->advertise = advertise ? 1 : 0; }
Jeff Thompson1f8a31a2013-09-30 16:18:47 -0700100
101 /**
102 * Set the value of the "last" flag
Jeff Thompson83bf07e2013-11-19 11:46:18 -0800103 * @param last true to set the flag, false to clear it.
Jeff Thompson1f8a31a2013-09-30 16:18:47 -0700104 */
Jeff Thompson83bf07e2013-11-19 11:46:18 -0800105 void setLast(bool last) { this->last = last ? 1 : 0; }
Jeff Thompson1f8a31a2013-09-30 16:18:47 -0700106
107 /**
108 * Set the value of the "capture" flag
Jeff Thompson83bf07e2013-11-19 11:46:18 -0800109 * @param capture true to set the flag, false to clear it.
Jeff Thompson1f8a31a2013-09-30 16:18:47 -0700110 */
Jeff Thompson83bf07e2013-11-19 11:46:18 -0800111 void setCapture(bool capture) { this->capture = capture ? 1 : 0; }
Jeff Thompson1f8a31a2013-09-30 16:18:47 -0700112
113 /**
114 * Set the value of the "local" flag
Jeff Thompson83bf07e2013-11-19 11:46:18 -0800115 * @param local true to set the flag, false to clear it.
Jeff Thompson1f8a31a2013-09-30 16:18:47 -0700116 */
Jeff Thompson83bf07e2013-11-19 11:46:18 -0800117 void setLocal(bool local) { this->local = local ? 1 : 0; }
Jeff Thompson1f8a31a2013-09-30 16:18:47 -0700118
119 /**
120 * Set the value of the "tap" flag
Jeff Thompson83bf07e2013-11-19 11:46:18 -0800121 * @param tap true to set the flag, false to clear it.
Jeff Thompson1f8a31a2013-09-30 16:18:47 -0700122 */
Jeff Thompson83bf07e2013-11-19 11:46:18 -0800123 void setTap(bool tap) { this->tap = tap ? 1 : 0; }
Jeff Thompson1f8a31a2013-09-30 16:18:47 -0700124
125 /**
126 * Set the value of the "captureOk" flag
Jeff Thompson83bf07e2013-11-19 11:46:18 -0800127 * @param captureOk true to set the flag, false to clear it.
Jeff Thompson1f8a31a2013-09-30 16:18:47 -0700128 */
Jeff Thompson83bf07e2013-11-19 11:46:18 -0800129 void setCaptureOk(bool captureOk) { this->captureOk = captureOk ? 1 : 0; }
Jeff Thompson1f8a31a2013-09-30 16:18:47 -0700130};
131
132}
133
134#endif