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 | |
| 13 | namespace nfd { |
| 14 | |
| 15 | class InternalFace : public Face, public AppFace |
| 16 | { |
| 17 | public: |
Alexander Afanasyev | a0a10fb | 2014-02-13 19:56:15 -0800 | [diff] [blame] | 18 | /** |
| 19 | * \brief InternalFace-related error |
| 20 | */ |
| 21 | struct Error : public Face::Error |
| 22 | { |
| 23 | Error(const std::string& what) : Face::Error(what) {} |
| 24 | }; |
Steve DiBenedetto | 5b43398 | 2014-01-29 17:14:27 -0700 | [diff] [blame] | 25 | |
Steve DiBenedetto | 3970c89 | 2014-01-31 23:31:13 -0700 | [diff] [blame] | 26 | InternalFace(); |
Steve DiBenedetto | 5b43398 | 2014-01-29 17:14:27 -0700 | [diff] [blame] | 27 | |
| 28 | // Overridden Face methods for forwarder |
| 29 | |
| 30 | virtual void |
| 31 | sendInterest(const Interest& interest); |
| 32 | |
| 33 | virtual void |
| 34 | sendData(const Data& data); |
| 35 | |
Alexander Afanasyev | a0a10fb | 2014-02-13 19:56:15 -0800 | [diff] [blame] | 36 | virtual void |
| 37 | close(); |
| 38 | |
Alexander Afanasyev | 93ce75e | 2014-02-18 19:45:34 -0800 | [diff] [blame^] | 39 | /** \brief Get whether face is connected to a local app |
| 40 | * |
| 41 | * Always true for a InternalFace. |
| 42 | */ |
| 43 | virtual bool |
| 44 | isLocal() const; |
| 45 | |
Steve DiBenedetto | 5b43398 | 2014-01-29 17:14:27 -0700 | [diff] [blame] | 46 | // Methods implementing AppFace interface. Do not invoke from forwarder. |
| 47 | |
| 48 | virtual void |
| 49 | setInterestFilter(const Name& filter, |
| 50 | OnInterest onInterest); |
| 51 | |
| 52 | virtual void |
| 53 | put(const Data& data); |
| 54 | |
| 55 | virtual |
| 56 | ~InternalFace(); |
| 57 | |
| 58 | private: |
| 59 | |
| 60 | // void |
| 61 | // onConfig(ConfigFile::Node section, bool isDryRun); |
| 62 | |
| 63 | std::map<Name, OnInterest> m_interestFilters; |
Steve DiBenedetto | 5b43398 | 2014-01-29 17:14:27 -0700 | [diff] [blame] | 64 | }; |
| 65 | |
| 66 | } // namespace nfd |
| 67 | |
| 68 | #endif //NFD_MGMT_INTERNAL_FACE_HPP |