35 :
Face(FaceUri(
"internal://"), FaceUri(
"internal://"), true)
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 throw Error(
"Internal face cannot be closed");
139 m_interestFilters[filter] = onInterest;
#define NFD_LOG_DEBUG(expression)
EventEmitter< Data > onReceiveData
fires when a Data is received
InternalFace-related error.
virtual void sendData(const Data &data)
send a Data
virtual void put(const Data &data)
EventEmitter< Interest > onSendInterest
fires when an Interest is sent out
virtual void setInterestFilter(const Name &filter, OnInterest onInterest)
#define NFD_LOG_INFO(expression)
EventEmitter< Data > onSendData
fires when a Data is sent out
EventId schedule(const time::nanoseconds &after, const std::function< void()> &event)
schedule an event
#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.