NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
face-query-filter.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013-2018 Regents of the University of California.
4  *
5  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
6  *
7  * ndn-cxx library is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License as published by the Free Software
9  * Foundation, either version 3 of the License, or (at your option) any later version.
10  *
11  * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
12  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13  * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14  *
15  * You should have received copies of the GNU General Public License and GNU Lesser
16  * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
17  * <http://www.gnu.org/licenses/>.
18  *
19  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
20  */
21 
22 #ifndef NDN_MGMT_NFD_FACE_QUERY_FILTER_HPP
23 #define NDN_MGMT_NFD_FACE_QUERY_FILTER_HPP
24 
27 
28 namespace ndn {
29 namespace nfd {
30 
37 {
38 public:
39  class Error : public tlv::Error
40  {
41  public:
42  using tlv::Error::Error;
43  };
44 
46 
47  explicit
48  FaceQueryFilter(const Block& block);
49 
52  template<encoding::Tag TAG>
53  size_t
54  wireEncode(EncodingImpl<TAG>& encoder) const;
55 
58  const Block&
59  wireEncode() const;
60 
63  void
64  wireDecode(const Block& wire);
65 
68  bool
69  empty() const;
70 
71 public: // getters & setters
72  bool
73  hasFaceId() const
74  {
75  return !!m_faceId;
76  }
77 
78  uint64_t
79  getFaceId() const
80  {
81  BOOST_ASSERT(this->hasFaceId());
82  return *m_faceId;
83  }
84 
86  setFaceId(uint64_t faceId);
87 
89  unsetFaceId();
90 
91  bool
92  hasUriScheme() const
93  {
94  return !m_uriScheme.empty();
95  }
96 
97  const std::string&
98  getUriScheme() const
99  {
100  BOOST_ASSERT(this->hasUriScheme());
101  return m_uriScheme;
102  }
103 
105  setUriScheme(const std::string& uriScheme);
106 
108  unsetUriScheme();
109 
110  bool
111  hasRemoteUri() const
112  {
113  return !m_remoteUri.empty();
114  }
115 
116  const std::string&
117  getRemoteUri() const
118  {
119  BOOST_ASSERT(this->hasRemoteUri());
120  return m_remoteUri;
121  }
122 
124  setRemoteUri(const std::string& remoteUri);
125 
127  unsetRemoteUri();
128 
129  bool
130  hasLocalUri() const
131  {
132  return !m_localUri.empty();
133  }
134 
135  const std::string&
136  getLocalUri() const
137  {
138  BOOST_ASSERT(this->hasLocalUri());
139  return m_localUri;
140  }
141 
143  setLocalUri(const std::string& localUri);
144 
146  unsetLocalUri();
147 
148  bool
149  hasFaceScope() const
150  {
151  return !!m_faceScope;
152  }
153 
154  FaceScope
155  getFaceScope() const
156  {
157  BOOST_ASSERT(this->hasFaceScope());
158  return *m_faceScope;
159  }
160 
162  setFaceScope(FaceScope faceScope);
163 
165  unsetFaceScope();
166 
167  bool
169  {
170  return !!m_facePersistency;
171  }
172 
175  {
176  BOOST_ASSERT(this->hasFacePersistency());
177  return *m_facePersistency;
178  }
179 
181  setFacePersistency(FacePersistency facePersistency);
182 
185 
186  bool
187  hasLinkType() const
188  {
189  return !!m_linkType;
190  }
191 
192  LinkType
193  getLinkType() const
194  {
195  BOOST_ASSERT(this->hasLinkType());
196  return *m_linkType;
197  }
198 
200  setLinkType(LinkType linkType);
201 
203  unsetLinkType();
204 
205 private:
206  optional<uint64_t> m_faceId;
207  std::string m_uriScheme;
208  std::string m_remoteUri;
209  std::string m_localUri;
210  optional<FaceScope> m_faceScope;
211  optional<FacePersistency> m_facePersistency;
212  optional<LinkType> m_linkType;
213 
214  mutable Block m_wire;
215 };
216 
218 
219 bool
220 operator==(const FaceQueryFilter& a, const FaceQueryFilter& b);
221 
222 inline bool
224 {
225  return !(a == b);
226 }
227 
228 std::ostream&
229 operator<<(std::ostream& os, const FaceQueryFilter& filter);
230 
231 } // namespace nfd
232 } // namespace ndn
233 
234 #endif // NDN_MGMT_NFD_FACE_QUERY_FILTER_HPP
ndn::nfd::FaceQueryFilter::getFaceId
uint64_t getFaceId() const
Definition: face-query-filter.hpp:79
ndn::nfd::FaceQueryFilter::setLinkType
FaceQueryFilter & setLinkType(LinkType linkType)
Definition: face-query-filter.cpp:277
ndn::nfd::NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(ChannelStatus)
ndn::nfd::FaceQueryFilter::getUriScheme
const std::string & getUriScheme() const
Definition: face-query-filter.hpp:98
ndn::nfd::operator<<
std::ostream & operator<<(std::ostream &os, FaceScope faceScope)
Definition: nfd-constants.cpp:36
ndn::nfd::FaceQueryFilter::wireDecode
void wireDecode(const Block &wire)
decode FaceQueryFilter
Definition: face-query-filter.cpp:105
ndn::nfd::FaceQueryFilter::getFaceScope
FaceScope getFaceScope() const
Definition: face-query-filter.hpp:155
ndn::nfd::FaceQueryFilter::hasFaceScope
bool hasFaceScope() const
Definition: face-query-filter.hpp:149
ndn::nfd::FaceQueryFilter::hasLinkType
bool hasLinkType() const
Definition: face-query-filter.hpp:187
ndn::nfd::FaceQueryFilter::wireEncode
const Block & wireEncode() const
encode FaceQueryFilter
Definition: face-query-filter.cpp:89
ndn::nfd::FaceQueryFilter::unsetFaceId
FaceQueryFilter & unsetFaceId()
Definition: face-query-filter.cpp:195
block.hpp
ndn::nfd::FaceQueryFilter::unsetUriScheme
FaceQueryFilter & unsetUriScheme()
Definition: face-query-filter.cpp:211
ndn::nfd::LinkType
LinkType
Definition: nfd-constants.hpp:57
ndn::nfd::FaceQueryFilter::setUriScheme
FaceQueryFilter & setUriScheme(const std::string &uriScheme)
Definition: face-query-filter.cpp:203
ndn::nfd::FacePersistency
FacePersistency
Definition: nfd-constants.hpp:45
ndn::nfd::FaceQueryFilter::hasFacePersistency
bool hasFacePersistency() const
Definition: face-query-filter.hpp:168
ndn::nfd::FaceQueryFilter::setFaceId
FaceQueryFilter & setFaceId(uint64_t faceId)
Definition: face-query-filter.cpp:187
ndn::nfd::FaceQueryFilter::hasLocalUri
bool hasLocalUri() const
Definition: face-query-filter.hpp:130
ndn::nfd::FaceQueryFilter::hasUriScheme
bool hasUriScheme() const
Definition: face-query-filter.hpp:92
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
ndn::nfd::FaceQueryFilter::hasRemoteUri
bool hasRemoteUri() const
Definition: face-query-filter.hpp:111
ndn::nfd::FaceQueryFilter::getLocalUri
const std::string & getLocalUri() const
Definition: face-query-filter.hpp:136
ndn::tlv::nfd::FaceQueryFilter
@ FaceQueryFilter
Definition: tlv-nfd.hpp:73
ndn::nfd::FaceQueryFilter::setFaceScope
FaceQueryFilter & setFaceScope(FaceScope faceScope)
Definition: face-query-filter.cpp:245
ndn::nfd::FaceQueryFilter::Error
Definition: face-query-filter.hpp:40
ndn::nfd::FaceQueryFilter::setRemoteUri
FaceQueryFilter & setRemoteUri(const std::string &remoteUri)
Definition: face-query-filter.cpp:217
ndn::nfd::FaceQueryFilter::getLinkType
LinkType getLinkType() const
Definition: face-query-filter.hpp:193
ndn::nfd::FaceQueryFilter::setFacePersistency
FaceQueryFilter & setFacePersistency(FacePersistency facePersistency)
Definition: face-query-filter.cpp:261
ndn::nfd::FaceQueryFilter::getFacePersistency
FacePersistency getFacePersistency() const
Definition: face-query-filter.hpp:174
ndn::nfd::FaceQueryFilter::getRemoteUri
const std::string & getRemoteUri() const
Definition: face-query-filter.hpp:117
ndn::encoding::EncodingImpl
Definition: encoding-buffer-fwd.hpp:36
ndn::nfd::FaceQueryFilter::unsetRemoteUri
FaceQueryFilter & unsetRemoteUri()
Definition: face-query-filter.cpp:225
ndn::nfd::FaceQueryFilter::unsetFacePersistency
FaceQueryFilter & unsetFacePersistency()
Definition: face-query-filter.cpp:269
ndn::nfd::FaceQueryFilter::unsetFaceScope
FaceQueryFilter & unsetFaceScope()
Definition: face-query-filter.cpp:253
ndn::nfd::FaceQueryFilter::setLocalUri
FaceQueryFilter & setLocalUri(const std::string &localUri)
Definition: face-query-filter.cpp:231
ndn::nfd::FaceQueryFilter::FaceQueryFilter
FaceQueryFilter()
ndn::Block
Represents a TLV element of NDN packet format.
Definition: block.hpp:43
ndn::nfd::operator!=
bool operator!=(const ChannelStatus &a, const ChannelStatus &b)
Definition: channel-status.hpp:81
ndn::nfd::operator==
bool operator==(const ChannelStatus &a, const ChannelStatus &b)
Definition: channel-status.cpp:97
ndn::nfd::FaceQueryFilter::empty
bool empty() const
Definition: face-query-filter.cpp:175
ndn::tlv::Error
represents an error in TLV encoding or decoding
Definition: tlv.hpp:53
nfd-constants.hpp
ndn::nfd::FaceScope
FaceScope
Definition: nfd-constants.hpp:34
ndn::tlv::Error::Error
Error(const char *expectedType, uint32_t actualType)
Definition: tlv.cpp:27
ndn::nfd::FaceQueryFilter::hasFaceId
bool hasFaceId() const
Definition: face-query-filter.hpp:73
ndn::nfd::FaceQueryFilter
represents Face Query Filter
Definition: face-query-filter.hpp:37
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-strategy-choice-helper.hpp:34
ndn::nfd::FaceQueryFilter::unsetLocalUri
FaceQueryFilter & unsetLocalUri()
Definition: face-query-filter.cpp:239
ndn::nfd::FaceQueryFilter::unsetLinkType
FaceQueryFilter & unsetLinkType()
Definition: face-query-filter.cpp:285