47 bind(&InternalFace::processInterest,
this, interest.shared_from_this()));
51 InternalFace::processInterest(
const shared_ptr<const Interest>& interest)
53 if (m_interestFilters.size() == 0)
59 const Name& interestName(interest->getName());
62 std::map<Name, OnInterest>::const_iterator filter =
63 m_interestFilters.lower_bound(interestName);
79 if (filter == m_interestFilters.end() && filter != m_interestFilters.begin())
84 if (filter->first.isPrefixOf(interestName))
86 NFD_LOG_DEBUG(
"found Interest filter for " << filter->first <<
" (before end match)");
87 filter->second(interestName, *interest);
91 NFD_LOG_DEBUG(
"no Interest filter found for " << interestName <<
" (before end)");
94 else if (filter->first == interestName)
96 NFD_LOG_DEBUG(
"found Interest filter for " << filter->first <<
" (exact match)");
97 filter->second(interestName, *interest);
99 else if (filter != m_interestFilters.begin())
105 if (filter->first.isPrefixOf(interestName))
107 NFD_LOG_DEBUG(
"found Interest filter for " << filter->first <<
" (previous match)");
108 filter->second(interestName, *interest);
112 NFD_LOG_DEBUG(
"no Interest filter found for " << interestName <<
" (previous)");
117 NFD_LOG_DEBUG(
"no Interest filter found for " << interestName <<
" (begin)");
131 BOOST_THROW_EXCEPTION(
Error(
"Internal face cannot be closed"));
139 m_interestFilters[filter] = onInterest;
#define NFD_LOG_DEBUG(expression)
signal::Signal< Face, Interest > onSendInterest
fires when an Interest is sent out
represents the underlying protocol and address used by a Face
InternalFace-related error.
virtual void sendData(const Data &data)
send a Data
virtual void put(const Data &data)
signal::Signal< Face, Data > onReceiveData
fires when a Data is received
represents an Interest packet
signal::Signal< Face, Data > onSendData
fires when a Data is sent out
virtual void setInterestFilter(const Name &filter, OnInterest onInterest)
#define emitSignal(...)
(implementation detail)
#define NFD_LOG_INFO(expression)
Copyright (c) 2011-2015 Regents of the University of California.
EventId schedule(const time::nanoseconds &after, const std::function< void()> &event)
schedule an event
Name abstraction to represent an absolute name.
#define NFD_LOG_INIT(name)
virtual void sendInterest(const Interest &interest)
send an Interest
function< void(const Name &, const Interest &)> OnInterest
virtual void close()
Close the face.