NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
interest-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-2021 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_CXX_INTEREST_FILTER_HPP
23
#define NDN_CXX_INTEREST_FILTER_HPP
24
25
#include "
ndn-cxx/name.hpp
"
26
27
namespace
ndn
{
28
29
class
RegexPatternListMatcher;
30
35
class
InterestFilter
36
{
37
public
:
38
class
Error
:
public
std::runtime_error
39
{
40
public
:
41
using
std::runtime_error::runtime_error;
42
};
43
51
InterestFilter
(
const
Name
& prefix);
52
61
InterestFilter
(
const
char
* prefixUri);
62
71
InterestFilter
(
const
std::string& prefixUri);
72
91
InterestFilter
(
const
Name
& prefix,
const
std::string& regexFilter);
92
98
operator
const
Name
&()
const
;
99
103
bool
104
doesMatch
(
const
Name
&
name
)
const
;
105
106
const
Name
&
107
getPrefix
()
const
108
{
109
return
m_prefix;
110
}
111
112
bool
113
hasRegexFilter
()
const
114
{
115
return
m_regexFilter !=
nullptr
;
116
}
117
118
const
RegexPatternListMatcher
&
119
getRegexFilter
()
const
120
{
121
return
*m_regexFilter;
122
}
123
126
NDN_CXX_NODISCARD
bool
127
allowsLoopback
()
const
128
{
129
return
m_allowsLoopback;
130
}
131
137
InterestFilter
&
138
allowLoopback
(
bool
wantLoopback)
139
{
140
m_allowsLoopback = wantLoopback;
141
return
*
this
;
142
}
143
144
private
:
145
Name
m_prefix;
146
shared_ptr<RegexPatternListMatcher> m_regexFilter;
147
bool
m_allowsLoopback =
true
;
148
};
149
150
std::ostream&
151
operator<<
(std::ostream& os,
const
InterestFilter
& filter);
152
153
}
// namespace ndn
154
155
#endif // NDN_CXX_INTEREST_FILTER_HPP
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::InterestFilter::getPrefix
const Name & getPrefix() const
Definition:
interest-filter.hpp:107
ndn::InterestFilter::allowLoopback
InterestFilter & allowLoopback(bool wantLoopback)
Set whether Interest loopback is allowed.
Definition:
interest-filter.hpp:138
ndn::RegexPatternListMatcher
Definition:
regex-pattern-list-matcher.hpp:31
ndn::operator<<
std::ostream & operator<<(std::ostream &os, const Data &data)
Definition:
data.cpp:376
ndn::InterestFilter
declares the set of Interests a producer can serve, which starts with a name prefix, plus an optional regular expression
Definition:
interest-filter.hpp:35
ndn::InterestFilter::allowsLoopback
NDN_CXX_NODISCARD bool allowsLoopback() const
Get whether Interest loopback is allowed.
Definition:
interest-filter.hpp:127
ndn::InterestFilter::doesMatch
bool doesMatch(const Name &name) const
Check if specified Interest name matches the filter.
Definition:
interest-filter.cpp:58
ndn::InterestFilter::getRegexFilter
const RegexPatternListMatcher & getRegexFilter() const
Definition:
interest-filter.hpp:119
NDN_CXX_NODISCARD
#define NDN_CXX_NODISCARD
Definition:
backports.hpp:68
ndn::Name
Represents an absolute name.
Definition:
name.hpp:41
ndn::InterestFilter::hasRegexFilter
bool hasRegexFilter() const
Definition:
interest-filter.hpp:113
ndn::InterestFilter::InterestFilter
InterestFilter(const Name &prefix)
Construct an InterestFilter to match Interests by prefix.
Definition:
interest-filter.cpp:27
name.hpp
ndn::name
Definition:
name-component-types.hpp:33
ndn::InterestFilter::Error
Definition:
interest-filter.hpp:38
ndnSIM
ndn-cxx
ndn-cxx
interest-filter.hpp
Generated on Fri May 6 2022 12:34:12 for ndnSIM by
1.8.13