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 | |
| 10 | #include "../common.hpp" |
| 11 | #include "controller.hpp" |
| 12 | |
| 13 | #include "../name.hpp" |
| 14 | #include "../interest.hpp" |
| 15 | #include "../data.hpp" |
| 16 | #include "../security/key-chain.hpp" |
| 17 | |
| 18 | namespace ndn { |
| 19 | |
| 20 | class Name; |
| 21 | |
| 22 | namespace nfd { |
| 23 | |
| 24 | class FibManagementOptions; |
| 25 | |
| 26 | class Controller : public ndn::Controller |
| 27 | { |
| 28 | public: |
| 29 | typedef function<void(const FibManagementOptions&)> FibCommandSucceedCallback; |
| 30 | |
| 31 | /** |
| 32 | * @brief Construct ndnd::Control object |
| 33 | */ |
| 34 | Controller(Node& face); |
| 35 | |
| 36 | virtual void |
| 37 | selfRegisterPrefix(const Name& prefixToRegister, |
| 38 | const SuccessCallback& onSuccess, |
| 39 | const FailCallback& onFail); |
| 40 | |
| 41 | virtual void |
| 42 | selfDeregisterPrefix(const Name& prefixToRegister, |
| 43 | const SuccessCallback& onSuccess, |
| 44 | const FailCallback& onFail); |
| 45 | |
| 46 | void |
| 47 | startFibCommand(const std::string& command, |
| 48 | const FibManagementOptions& options, |
| 49 | const FibCommandSucceedCallback& onSuccess, |
| 50 | const FailCallback& onFailure); |
| 51 | private: |
| 52 | void |
| 53 | recordSelfRegisteredFaceId(const FibManagementOptions& entry, |
| 54 | const SuccessCallback& onSuccess); |
| 55 | |
| 56 | // void |
| 57 | // processFaceActionResponse(const shared_ptr<Data>& data, |
| 58 | // const FaceOperationSucceedCallback& onSuccess, |
| 59 | // const FailCallback& onFail); |
| 60 | |
| 61 | void |
| 62 | processFibCommandResponse(const shared_ptr<Data>& data, |
| 63 | const FibCommandSucceedCallback& onSuccess, |
| 64 | const FailCallback& onFail); |
| 65 | |
| 66 | private: |
| 67 | Node& m_face; |
| 68 | KeyChain m_keyChain; |
| 69 | uint64_t m_faceId; // internal face ID (needed for prefix de-registration) |
| 70 | }; |
| 71 | |
| 72 | } // namespace nfd |
| 73 | } // namespace ndn |
| 74 | |
| 75 | #endif // NDN_MANAGEMENT_NFD_CONTROL_HPP |