Steve DiBenedetto | 5b43398 | 2014-01-29 17:14:27 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
Alexander Afanasyev | 7bbe80c | 2014-07-10 20:07:16 -0700 | [diff] [blame] | 3 | * 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 Afanasyev | 9bcbc7c | 2014-04-06 19:37:37 -0700 | [diff] [blame] | 10 | * |
| 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 Afanasyev | 7bbe80c | 2014-07-10 20:07:16 -0700 | [diff] [blame] | 24 | */ |
Steve DiBenedetto | 5b43398 | 2014-01-29 17:14:27 -0700 | [diff] [blame] | 25 | |
Alexander Afanasyev | 613e2a9 | 2014-04-15 13:36:58 -0700 | [diff] [blame] | 26 | #ifndef NFD_DAEMON_MGMT_INTERNAL_FACE_HPP |
| 27 | #define NFD_DAEMON_MGMT_INTERNAL_FACE_HPP |
Steve DiBenedetto | 5b43398 | 2014-01-29 17:14:27 -0700 | [diff] [blame] | 28 | |
| 29 | #include "face/face.hpp" |
| 30 | #include "app-face.hpp" |
| 31 | |
Steve DiBenedetto | 2c2b889 | 2014-02-27 11:46:48 -0700 | [diff] [blame] | 32 | #include "command-validator.hpp" |
| 33 | |
Steve DiBenedetto | 5b43398 | 2014-01-29 17:14:27 -0700 | [diff] [blame] | 34 | namespace nfd { |
| 35 | |
| 36 | class InternalFace : public Face, public AppFace |
| 37 | { |
| 38 | public: |
Alexander Afanasyev | a0a10fb | 2014-02-13 19:56:15 -0800 | [diff] [blame] | 39 | /** |
| 40 | * \brief InternalFace-related error |
| 41 | */ |
Junxiao Shi | 16d1b7d | 2014-03-27 21:29:09 -0700 | [diff] [blame] | 42 | class Error : public Face::Error |
Alexander Afanasyev | a0a10fb | 2014-02-13 19:56:15 -0800 | [diff] [blame] | 43 | { |
Junxiao Shi | 16d1b7d | 2014-03-27 21:29:09 -0700 | [diff] [blame] | 44 | public: |
| 45 | explicit |
| 46 | Error(const std::string& what) |
| 47 | : Face::Error(what) |
| 48 | { |
| 49 | } |
Alexander Afanasyev | a0a10fb | 2014-02-13 19:56:15 -0800 | [diff] [blame] | 50 | }; |
Steve DiBenedetto | 5b43398 | 2014-01-29 17:14:27 -0700 | [diff] [blame] | 51 | |
Steve DiBenedetto | 3970c89 | 2014-01-31 23:31:13 -0700 | [diff] [blame] | 52 | InternalFace(); |
Steve DiBenedetto | 5b43398 | 2014-01-29 17:14:27 -0700 | [diff] [blame] | 53 | |
Steve DiBenedetto | 2c2b889 | 2014-02-27 11:46:48 -0700 | [diff] [blame] | 54 | CommandValidator& |
| 55 | getValidator(); |
| 56 | |
| 57 | virtual |
| 58 | ~InternalFace(); |
| 59 | |
Steve DiBenedetto | 5b43398 | 2014-01-29 17:14:27 -0700 | [diff] [blame] | 60 | // 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 Afanasyev | a0a10fb | 2014-02-13 19:56:15 -0800 | [diff] [blame] | 68 | virtual void |
| 69 | close(); |
| 70 | |
Steve DiBenedetto | 5b43398 | 2014-01-29 17:14:27 -0700 | [diff] [blame] | 71 | // 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 DiBenedetto | 5b43398 | 2014-01-29 17:14:27 -0700 | [diff] [blame] | 80 | private: |
Junxiao Shi | 16d1b7d | 2014-03-27 21:29:09 -0700 | [diff] [blame] | 81 | void |
Alexander Afanasyev | 7bbe80c | 2014-07-10 20:07:16 -0700 | [diff] [blame] | 82 | processInterest(const shared_ptr<const Interest>& interest); |
Steve DiBenedetto | 5b43398 | 2014-01-29 17:14:27 -0700 | [diff] [blame] | 83 | |
Junxiao Shi | 16d1b7d | 2014-03-27 21:29:09 -0700 | [diff] [blame] | 84 | private: |
Steve DiBenedetto | 5b43398 | 2014-01-29 17:14:27 -0700 | [diff] [blame] | 85 | std::map<Name, OnInterest> m_interestFilters; |
Steve DiBenedetto | 2c2b889 | 2014-02-27 11:46:48 -0700 | [diff] [blame] | 86 | CommandValidator m_validator; |
Steve DiBenedetto | 5b43398 | 2014-01-29 17:14:27 -0700 | [diff] [blame] | 87 | }; |
| 88 | |
Steve DiBenedetto | 2c2b889 | 2014-02-27 11:46:48 -0700 | [diff] [blame] | 89 | inline CommandValidator& |
| 90 | InternalFace::getValidator() |
| 91 | { |
| 92 | return m_validator; |
| 93 | } |
| 94 | |
| 95 | |
Steve DiBenedetto | 5b43398 | 2014-01-29 17:14:27 -0700 | [diff] [blame] | 96 | } // namespace nfd |
| 97 | |
Alexander Afanasyev | 613e2a9 | 2014-04-15 13:36:58 -0700 | [diff] [blame] | 98 | #endif // NFD_DAEMON_MGMT_INTERNAL_FACE_HPP |