Alexander Afanasyev | e289b53 | 2014-02-09 22:14:44 -0800 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /** |
| 3 | * Copyright (C) 2013 Regents of the University of California. |
| 4 | * See COPYING for copyright and distribution information. |
| 5 | */ |
| 6 | |
| 7 | #ifndef NDN_MANAGEMENT_NFD_CONTROL_HPP |
| 8 | #define NDN_MANAGEMENT_NFD_CONTROL_HPP |
| 9 | |
Alexander Afanasyev | e289b53 | 2014-02-09 22:14:44 -0800 | [diff] [blame] | 10 | #include "controller.hpp" |
| 11 | |
Alexander Afanasyev | e289b53 | 2014-02-09 22:14:44 -0800 | [diff] [blame] | 12 | #include "../security/key-chain.hpp" |
| 13 | |
| 14 | namespace ndn { |
| 15 | |
Alexander Afanasyev | e289b53 | 2014-02-09 22:14:44 -0800 | [diff] [blame] | 16 | namespace nfd { |
| 17 | |
| 18 | class FibManagementOptions; |
| 19 | |
| 20 | class Controller : public ndn::Controller |
| 21 | { |
| 22 | public: |
| 23 | typedef function<void(const FibManagementOptions&)> FibCommandSucceedCallback; |
| 24 | |
| 25 | /** |
| 26 | * @brief Construct ndnd::Control object |
| 27 | */ |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame^] | 28 | Controller(Face& face); |
Alexander Afanasyev | e289b53 | 2014-02-09 22:14:44 -0800 | [diff] [blame] | 29 | |
| 30 | virtual void |
| 31 | selfRegisterPrefix(const Name& prefixToRegister, |
| 32 | const SuccessCallback& onSuccess, |
| 33 | const FailCallback& onFail); |
| 34 | |
| 35 | virtual void |
| 36 | selfDeregisterPrefix(const Name& prefixToRegister, |
| 37 | const SuccessCallback& onSuccess, |
| 38 | const FailCallback& onFail); |
| 39 | |
| 40 | void |
| 41 | startFibCommand(const std::string& command, |
| 42 | const FibManagementOptions& options, |
| 43 | const FibCommandSucceedCallback& onSuccess, |
| 44 | const FailCallback& onFailure); |
| 45 | private: |
| 46 | void |
| 47 | recordSelfRegisteredFaceId(const FibManagementOptions& entry, |
| 48 | const SuccessCallback& onSuccess); |
| 49 | |
| 50 | // void |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame^] | 51 | // processFaceActionResponse(Data& data, |
Alexander Afanasyev | e289b53 | 2014-02-09 22:14:44 -0800 | [diff] [blame] | 52 | // const FaceOperationSucceedCallback& onSuccess, |
| 53 | // const FailCallback& onFail); |
| 54 | |
| 55 | void |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame^] | 56 | processFibCommandResponse(Data& data, |
Alexander Afanasyev | e289b53 | 2014-02-09 22:14:44 -0800 | [diff] [blame] | 57 | const FibCommandSucceedCallback& onSuccess, |
| 58 | const FailCallback& onFail); |
| 59 | |
| 60 | private: |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame^] | 61 | Face& m_face; |
Alexander Afanasyev | e289b53 | 2014-02-09 22:14:44 -0800 | [diff] [blame] | 62 | KeyChain m_keyChain; |
| 63 | uint64_t m_faceId; // internal face ID (needed for prefix de-registration) |
| 64 | }; |
| 65 | |
| 66 | } // namespace nfd |
| 67 | } // namespace ndn |
| 68 | |
| 69 | #endif // NDN_MANAGEMENT_NFD_CONTROL_HPP |