Steve DiBenedetto | 5b43398 | 2014-01-29 17:14:27 -0700 | [diff] [blame] | 1 | /* -*- 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 | #ifndef NFD_MGMT_INTERNAL_FACE_HPP |
| 8 | #define NFD_MGMT_INTERNAL_FACE_HPP |
| 9 | |
| 10 | #include "face/face.hpp" |
| 11 | #include "app-face.hpp" |
| 12 | |
Steve DiBenedetto | 2c2b889 | 2014-02-27 11:46:48 -0700 | [diff] [blame^] | 13 | #include "command-validator.hpp" |
| 14 | |
Steve DiBenedetto | 5b43398 | 2014-01-29 17:14:27 -0700 | [diff] [blame] | 15 | namespace nfd { |
| 16 | |
| 17 | class InternalFace : public Face, public AppFace |
| 18 | { |
| 19 | public: |
Alexander Afanasyev | a0a10fb | 2014-02-13 19:56:15 -0800 | [diff] [blame] | 20 | /** |
| 21 | * \brief InternalFace-related error |
| 22 | */ |
| 23 | struct Error : public Face::Error |
| 24 | { |
| 25 | Error(const std::string& what) : Face::Error(what) {} |
| 26 | }; |
Steve DiBenedetto | 5b43398 | 2014-01-29 17:14:27 -0700 | [diff] [blame] | 27 | |
Steve DiBenedetto | 3970c89 | 2014-01-31 23:31:13 -0700 | [diff] [blame] | 28 | InternalFace(); |
Steve DiBenedetto | 5b43398 | 2014-01-29 17:14:27 -0700 | [diff] [blame] | 29 | |
Steve DiBenedetto | 2c2b889 | 2014-02-27 11:46:48 -0700 | [diff] [blame^] | 30 | CommandValidator& |
| 31 | getValidator(); |
| 32 | |
| 33 | virtual |
| 34 | ~InternalFace(); |
| 35 | |
Steve DiBenedetto | 5b43398 | 2014-01-29 17:14:27 -0700 | [diff] [blame] | 36 | // Overridden Face methods for forwarder |
| 37 | |
| 38 | virtual void |
| 39 | sendInterest(const Interest& interest); |
| 40 | |
| 41 | virtual void |
| 42 | sendData(const Data& data); |
| 43 | |
Alexander Afanasyev | a0a10fb | 2014-02-13 19:56:15 -0800 | [diff] [blame] | 44 | virtual void |
| 45 | close(); |
| 46 | |
Steve DiBenedetto | 5b43398 | 2014-01-29 17:14:27 -0700 | [diff] [blame] | 47 | // Methods implementing AppFace interface. Do not invoke from forwarder. |
| 48 | |
| 49 | virtual void |
| 50 | setInterestFilter(const Name& filter, |
| 51 | OnInterest onInterest); |
| 52 | |
| 53 | virtual void |
| 54 | put(const Data& data); |
| 55 | |
Steve DiBenedetto | 5b43398 | 2014-01-29 17:14:27 -0700 | [diff] [blame] | 56 | private: |
| 57 | |
Steve DiBenedetto | 5b43398 | 2014-01-29 17:14:27 -0700 | [diff] [blame] | 58 | std::map<Name, OnInterest> m_interestFilters; |
Steve DiBenedetto | 2c2b889 | 2014-02-27 11:46:48 -0700 | [diff] [blame^] | 59 | CommandValidator m_validator; |
Steve DiBenedetto | 5b43398 | 2014-01-29 17:14:27 -0700 | [diff] [blame] | 60 | }; |
| 61 | |
Steve DiBenedetto | 2c2b889 | 2014-02-27 11:46:48 -0700 | [diff] [blame^] | 62 | inline CommandValidator& |
| 63 | InternalFace::getValidator() |
| 64 | { |
| 65 | return m_validator; |
| 66 | } |
| 67 | |
| 68 | |
Steve DiBenedetto | 5b43398 | 2014-01-29 17:14:27 -0700 | [diff] [blame] | 69 | } // namespace nfd |
| 70 | |
| 71 | #endif //NFD_MGMT_INTERNAL_FACE_HPP |