blob: c35676fbaf75cf5a255016f5b48c47bf533a7c5e [file] [log] [blame]
Steve DiBenedetto5b433982014-01-29 17:14:27 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
Alexander Afanasyev7bbe80c2014-07-10 20:07:16 -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 * The University of Memphis
Alexander Afanasyev9bcbc7c2014-04-06 19:37:37 -070010 *
11 * This file is part of NFD (Named Data Networking Forwarding Daemon).
12 * See AUTHORS.md for complete list of NFD authors and contributors.
13 *
14 * NFD is free software: you can redistribute it and/or modify it under the terms
15 * of the GNU General Public License as published by the Free Software Foundation,
16 * either version 3 of the License, or (at your option) any later version.
17 *
18 * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
19 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
20 * PURPOSE. See the GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License along with
23 * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
Alexander Afanasyev7bbe80c2014-07-10 20:07:16 -070024 */
Steve DiBenedetto5b433982014-01-29 17:14:27 -070025
Alexander Afanasyev613e2a92014-04-15 13:36:58 -070026#ifndef NFD_DAEMON_MGMT_INTERNAL_FACE_HPP
27#define NFD_DAEMON_MGMT_INTERNAL_FACE_HPP
Steve DiBenedetto5b433982014-01-29 17:14:27 -070028
29#include "face/face.hpp"
30#include "app-face.hpp"
31
Steve DiBenedetto2c2b8892014-02-27 11:46:48 -070032#include "command-validator.hpp"
33
Steve DiBenedetto5b433982014-01-29 17:14:27 -070034namespace nfd {
35
36class InternalFace : public Face, public AppFace
37{
38public:
Alexander Afanasyeva0a10fb2014-02-13 19:56:15 -080039 /**
40 * \brief InternalFace-related error
41 */
Junxiao Shi16d1b7d2014-03-27 21:29:09 -070042 class Error : public Face::Error
Alexander Afanasyeva0a10fb2014-02-13 19:56:15 -080043 {
Junxiao Shi16d1b7d2014-03-27 21:29:09 -070044 public:
45 explicit
46 Error(const std::string& what)
47 : Face::Error(what)
48 {
49 }
Alexander Afanasyeva0a10fb2014-02-13 19:56:15 -080050 };
Steve DiBenedetto5b433982014-01-29 17:14:27 -070051
Steve DiBenedetto3970c892014-01-31 23:31:13 -070052 InternalFace();
Steve DiBenedetto5b433982014-01-29 17:14:27 -070053
Steve DiBenedetto2c2b8892014-02-27 11:46:48 -070054 CommandValidator&
55 getValidator();
56
57 virtual
58 ~InternalFace();
59
Steve DiBenedetto5b433982014-01-29 17:14:27 -070060 // Overridden Face methods for forwarder
61
62 virtual void
63 sendInterest(const Interest& interest);
64
65 virtual void
66 sendData(const Data& data);
67
Alexander Afanasyeva0a10fb2014-02-13 19:56:15 -080068 virtual void
69 close();
70
Steve DiBenedetto5b433982014-01-29 17:14:27 -070071 // Methods implementing AppFace interface. Do not invoke from forwarder.
72
73 virtual void
74 setInterestFilter(const Name& filter,
75 OnInterest onInterest);
76
77 virtual void
78 put(const Data& data);
79
Steve DiBenedetto5b433982014-01-29 17:14:27 -070080private:
Junxiao Shi16d1b7d2014-03-27 21:29:09 -070081 void
Alexander Afanasyev7bbe80c2014-07-10 20:07:16 -070082 processInterest(const shared_ptr<const Interest>& interest);
Steve DiBenedetto5b433982014-01-29 17:14:27 -070083
Junxiao Shi16d1b7d2014-03-27 21:29:09 -070084private:
Steve DiBenedetto5b433982014-01-29 17:14:27 -070085 std::map<Name, OnInterest> m_interestFilters;
Steve DiBenedetto2c2b8892014-02-27 11:46:48 -070086 CommandValidator m_validator;
Steve DiBenedetto5b433982014-01-29 17:14:27 -070087};
88
Steve DiBenedetto2c2b8892014-02-27 11:46:48 -070089inline CommandValidator&
90InternalFace::getValidator()
91{
92 return m_validator;
93}
94
95
Steve DiBenedetto5b433982014-01-29 17:14:27 -070096} // namespace nfd
97
Alexander Afanasyev613e2a92014-04-15 13:36:58 -070098#endif // NFD_DAEMON_MGMT_INTERNAL_FACE_HPP