blob: 0c3fe3b4db48d0c5a7ebf5a27d8379405c7ceb51 [file] [log] [blame]
Steve DiBenedetto5b433982014-01-29 17:14:27 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (C) 2014 Named Data Networking Project
4 * See COPYING for copyright and distribution information.
5 */
6
7#include "internal-face.hpp"
8
9namespace nfd {
10
Steve DiBenedetto3970c892014-01-31 23:31:13 -070011NFD_LOG_INIT("InternalFace");
12
13InternalFace::InternalFace()
Steve DiBenedetto5b433982014-01-29 17:14:27 -070014{
15
16}
17
18void
19InternalFace::sendInterest(const Interest& interest)
20{
Steve DiBenedetto3970c892014-01-31 23:31:13 -070021 const Name& interestName(interest.getName());
22 NFD_LOG_DEBUG("received Interest: " << interestName);
Steve DiBenedetto5b433982014-01-29 17:14:27 -070023
Steve DiBenedetto3970c892014-01-31 23:31:13 -070024 size_t nComps = interestName.size();
25 for (size_t i = 0; i < nComps; i++)
Steve DiBenedetto5b433982014-01-29 17:14:27 -070026 {
Steve DiBenedetto3970c892014-01-31 23:31:13 -070027 Name prefix(interestName.getPrefix(nComps - i));
28 std::map<Name, OnInterest>::const_iterator filter =
29 m_interestFilters.find(prefix);
30
31 if (filter != m_interestFilters.end())
32 {
33 NFD_LOG_DEBUG("found Interest filter for " << prefix);
34 filter->second(interestName, interest);
35 }
36 else
37 {
38 NFD_LOG_DEBUG("no Interest filter found for " << prefix);
39 }
Steve DiBenedetto5b433982014-01-29 17:14:27 -070040 }
41 //Drop Interest
42}
43
44void
45InternalFace::sendData(const Data& data)
46{
47
48}
49
50void
51InternalFace::setInterestFilter(const Name& filter,
52 OnInterest onInterest)
53{
Steve DiBenedetto3970c892014-01-31 23:31:13 -070054 NFD_LOG_INFO("registering callback for " << filter);
55 m_interestFilters[filter] = onInterest;
Steve DiBenedetto5b433982014-01-29 17:14:27 -070056}
57
58void
59InternalFace::put(const Data& data)
60{
61 onReceiveData(data);
62}
63
64InternalFace::~InternalFace()
65{
66
67}
68
69} // namespace nfd