Steve DiBenedetto | 471c060 | 2014-02-18 12:32:00 -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_LOCAL_CONTROL_HEADER_MANAGER_HPP |
| 8 | #define NFD_MGMT_LOCAL_CONTROL_HEADER_MANAGER_HPP |
| 9 | |
| 10 | #include "common.hpp" |
| 11 | #include "face/face.hpp" |
| 12 | #include "mgmt/app-face.hpp" |
| 13 | #include "mgmt/manager-base.hpp" |
| 14 | |
| 15 | namespace nfd { |
| 16 | |
Steve DiBenedetto | 2c2b889 | 2014-02-27 11:46:48 -0700 | [diff] [blame] | 17 | const std::string CONTROL_HEADER_PRIVILEGE = "control-header"; // config file privilege name |
| 18 | |
Steve DiBenedetto | 471c060 | 2014-02-18 12:32:00 -0700 | [diff] [blame] | 19 | class LocalControlHeaderManager : public ManagerBase |
| 20 | { |
| 21 | public: |
| 22 | LocalControlHeaderManager(function<shared_ptr<Face>(FaceId)> getFace, |
Steve DiBenedetto | 2c2b889 | 2014-02-27 11:46:48 -0700 | [diff] [blame] | 23 | shared_ptr<InternalFace> face); |
Steve DiBenedetto | 471c060 | 2014-02-18 12:32:00 -0700 | [diff] [blame] | 24 | |
| 25 | void |
| 26 | onLocalControlHeaderRequest(const Interest& request); |
| 27 | |
Steve DiBenedetto | 2c2b889 | 2014-02-27 11:46:48 -0700 | [diff] [blame] | 28 | void |
| 29 | onCommandValidated(const shared_ptr<const Interest>& command); |
| 30 | |
Steve DiBenedetto | 471c060 | 2014-02-18 12:32:00 -0700 | [diff] [blame] | 31 | private: |
| 32 | function<shared_ptr<Face>(FaceId)> m_getFace; |
| 33 | |
| 34 | static const Name COMMAND_PREFIX; // /localhost/nfd/control-header |
| 35 | |
| 36 | // number of components in an invalid, but not malformed, unsigned command. |
Steve DiBenedetto | 2c2b889 | 2014-02-27 11:46:48 -0700 | [diff] [blame] | 37 | // (/localhost/nfd/control-header + control-module + verb) = 5 |
Steve DiBenedetto | 471c060 | 2014-02-18 12:32:00 -0700 | [diff] [blame] | 38 | static const size_t COMMAND_UNSIGNED_NCOMPS; |
| 39 | |
| 40 | // number of components in a valid signed Interest. |
Steve DiBenedetto | 2c2b889 | 2014-02-27 11:46:48 -0700 | [diff] [blame] | 41 | // UNSIGNED_NCOMPS + 4 command Interest components = 9 |
Steve DiBenedetto | 471c060 | 2014-02-18 12:32:00 -0700 | [diff] [blame] | 42 | static const size_t COMMAND_SIGNED_NCOMPS; |
| 43 | }; |
| 44 | |
| 45 | } // namespace nfd |
| 46 | |
| 47 | #endif // NFD_MGMT_LOCAL_CONTROL_HEADER_MANAGER_HPP |
| 48 | |
| 49 | |
| 50 | |