NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
selectors.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NDN_SELECTORS_HPP
23 #define NDN_SELECTORS_HPP
24 
25 #include "common.hpp"
26 #include "key-locator.hpp"
27 #include "exclude.hpp"
28 
29 namespace ndn {
30 
34 class Selectors
35 {
36 public:
37  class Error : public tlv::Error
38  {
39  public:
40  explicit
41  Error(const std::string& what)
42  : tlv::Error(what)
43  {
44  }
45  };
46 
47  Selectors();
48 
52  explicit
53  Selectors(const Block& wire);
54 
55  bool
56  empty() const;
57 
61  template<encoding::Tag TAG>
62  size_t
63  wireEncode(EncodingImpl<TAG>& encoder) const;
64 
68  const Block&
69  wireEncode() const;
70 
74  void
75  wireDecode(const Block& wire);
76 
77 public: // getters & setters
78  int
80  {
81  return m_minSuffixComponents;
82  }
83 
84  Selectors&
85  setMinSuffixComponents(int minSuffixComponents);
86 
87  int
89  {
90  return m_maxSuffixComponents;
91  }
92 
93  Selectors&
94  setMaxSuffixComponents(int maxSuffixComponents);
95 
96  const KeyLocator&
98  {
99  return m_publisherPublicKeyLocator;
100  }
101 
102  Selectors&
103  setPublisherPublicKeyLocator(const KeyLocator& keyLocator);
104 
105  const Exclude&
106  getExclude() const
107  {
108  return m_exclude;
109  }
110 
111  Selectors&
112  setExclude(const Exclude& exclude);
113 
114  int
116  {
117  return m_childSelector;
118  }
119 
120  Selectors&
121  setChildSelector(int childSelector);
122 
123  int
125  {
126  return m_mustBeFresh;
127  }
128 
129  Selectors&
130  setMustBeFresh(bool mustBeFresh);
131 
132 public: // EqualityComparable concept
133  bool
134  operator==(const Selectors& other) const;
135 
136  bool
137  operator!=(const Selectors& other) const
138  {
139  return !this->operator==(other);
140  }
141 
142 private:
143  int m_minSuffixComponents;
144  int m_maxSuffixComponents;
145  KeyLocator m_publisherPublicKeyLocator;
146  Exclude m_exclude;
147  int m_childSelector;
148  bool m_mustBeFresh;
149 
150  mutable Block m_wire;
151 };
152 
153 } // namespace ndn
154 
155 #endif // NDN_SELECTORS_HPP
void wireDecode(const Block &wire)
Decode the input from wire format.
Definition: selectors.cpp:135
int getMinSuffixComponents() const
Definition: selectors.hpp:79
Copyright (c) 2011-2015 Regents of the University of California.
Selectors & setMustBeFresh(bool mustBeFresh)
Definition: selectors.cpp:223
bool empty() const
Definition: selectors.cpp:49
int getMustBeFresh() const
Definition: selectors.hpp:124
Class representing a wire element of NDN-TLV packet format.
Definition: block.hpp:43
Copyright (c) 2013-2015 Regents of the University of California.
int getChildSelector() const
Definition: selectors.hpp:115
Selectors & setMaxSuffixComponents(int maxSuffixComponents)
Definition: selectors.cpp:191
Selectors & setExclude(const Exclude &exclude)
Definition: selectors.cpp:207
Selectors & setChildSelector(int childSelector)
Definition: selectors.cpp:215
Error(const std::string &what)
Definition: selectors.hpp:41
Selectors & setMinSuffixComponents(int minSuffixComponents)
Definition: selectors.cpp:183
const KeyLocator & getPublisherPublicKeyLocator() const
Definition: selectors.hpp:97
bool operator!=(const Selectors &other) const
Definition: selectors.hpp:137
const Block & wireEncode() const
Encode to a wire format.
Definition: selectors.cpp:119
Abstraction implementing Interest selectors.
Definition: selectors.hpp:34
bool operator==(const Selectors &other) const
Definition: selectors.cpp:231
int getMaxSuffixComponents() const
Definition: selectors.hpp:88
const Exclude & getExclude() const
Definition: selectors.hpp:106
represents an error in TLV encoding or decoding
Definition: tlv.hpp:50
Class to represent Exclude component in NDN interests.
Definition: exclude.hpp:38
Selectors & setPublisherPublicKeyLocator(const KeyLocator &keyLocator)
Definition: selectors.cpp:199