blob: 416850c9586e2114dfed1ac67eec47cdae32bd18 [file] [log] [blame]
Steve DiBenedetto5b433982014-01-29 17:14:27 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
Alexander Afanasyev9bcbc7c2014-04-06 19:37:37 -07003 * Copyright (c) 2014 Regents of the University of California,
4 * Arizona Board of Regents,
5 * Colorado State University,
6 * University Pierre & Marie Curie, Sorbonne University,
7 * Washington University in St. Louis,
8 * Beijing Institute of Technology
9 *
10 * This file is part of NFD (Named Data Networking Forwarding Daemon).
11 * See AUTHORS.md for complete list of NFD authors and contributors.
12 *
13 * NFD is free software: you can redistribute it and/or modify it under the terms
14 * of the GNU General Public License as published by the Free Software Foundation,
15 * either version 3 of the License, or (at your option) any later version.
16 *
17 * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
18 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
19 * PURPOSE. See the GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License along with
22 * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
23 **/
Steve DiBenedetto5b433982014-01-29 17:14:27 -070024
25#ifndef NFD_MGMT_INTERNAL_FACE_HPP
26#define NFD_MGMT_INTERNAL_FACE_HPP
27
28#include "face/face.hpp"
29#include "app-face.hpp"
30
Steve DiBenedetto2c2b8892014-02-27 11:46:48 -070031#include "command-validator.hpp"
32
Steve DiBenedetto5b433982014-01-29 17:14:27 -070033namespace nfd {
34
35class InternalFace : public Face, public AppFace
36{
37public:
Alexander Afanasyeva0a10fb2014-02-13 19:56:15 -080038 /**
39 * \brief InternalFace-related error
40 */
Junxiao Shi16d1b7d2014-03-27 21:29:09 -070041 class Error : public Face::Error
Alexander Afanasyeva0a10fb2014-02-13 19:56:15 -080042 {
Junxiao Shi16d1b7d2014-03-27 21:29:09 -070043 public:
44 explicit
45 Error(const std::string& what)
46 : Face::Error(what)
47 {
48 }
Alexander Afanasyeva0a10fb2014-02-13 19:56:15 -080049 };
Steve DiBenedetto5b433982014-01-29 17:14:27 -070050
Steve DiBenedetto3970c892014-01-31 23:31:13 -070051 InternalFace();
Steve DiBenedetto5b433982014-01-29 17:14:27 -070052
Steve DiBenedetto2c2b8892014-02-27 11:46:48 -070053 CommandValidator&
54 getValidator();
55
56 virtual
57 ~InternalFace();
58
Steve DiBenedetto5b433982014-01-29 17:14:27 -070059 // Overridden Face methods for forwarder
60
61 virtual void
62 sendInterest(const Interest& interest);
63
64 virtual void
65 sendData(const Data& data);
66
Alexander Afanasyeva0a10fb2014-02-13 19:56:15 -080067 virtual void
68 close();
69
Steve DiBenedetto5b433982014-01-29 17:14:27 -070070 // Methods implementing AppFace interface. Do not invoke from forwarder.
71
72 virtual void
73 setInterestFilter(const Name& filter,
74 OnInterest onInterest);
75
76 virtual void
77 put(const Data& data);
78
Steve DiBenedetto5b433982014-01-29 17:14:27 -070079private:
Junxiao Shi16d1b7d2014-03-27 21:29:09 -070080 void
81 processInterest(const Interest& interest);
Steve DiBenedetto5b433982014-01-29 17:14:27 -070082
Junxiao Shi16d1b7d2014-03-27 21:29:09 -070083private:
Steve DiBenedetto5b433982014-01-29 17:14:27 -070084 std::map<Name, OnInterest> m_interestFilters;
Steve DiBenedetto2c2b8892014-02-27 11:46:48 -070085 CommandValidator m_validator;
Steve DiBenedetto5b433982014-01-29 17:14:27 -070086};
87
Steve DiBenedetto2c2b8892014-02-27 11:46:48 -070088inline CommandValidator&
89InternalFace::getValidator()
90{
91 return m_validator;
92}
93
94
Steve DiBenedetto5b433982014-01-29 17:14:27 -070095} // namespace nfd
96
97#endif //NFD_MGMT_INTERNAL_FACE_HPP