Alexander Afanasyev | efe3ab2 | 2014-02-19 14:57:50 -0800 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /** |
| 3 | * Copyright (C) 2014 Regents of the University of California. |
| 4 | * See COPYING for copyright and distribution information. |
| 5 | */ |
| 6 | |
Alexander Afanasyev | 26c24d2 | 2014-03-20 09:31:21 -0700 | [diff] [blame] | 7 | #ifndef NDN_MANAGEMENT_NRD_CONTROLLER_HPP |
| 8 | #define NDN_MANAGEMENT_NRD_CONTROLLER_HPP |
Alexander Afanasyev | efe3ab2 | 2014-02-19 14:57:50 -0800 | [diff] [blame] | 9 | |
| 10 | #include "controller.hpp" |
Obaid | 6e7f5f1 | 2014-03-11 14:46:10 -0500 | [diff] [blame] | 11 | #include "../util/command-interest-generator.hpp" |
Alexander Afanasyev | efe3ab2 | 2014-02-19 14:57:50 -0800 | [diff] [blame] | 12 | |
| 13 | namespace ndn { |
| 14 | namespace nrd { |
| 15 | |
| 16 | class PrefixRegOptions; |
| 17 | |
| 18 | class Controller : public ndn::Controller |
| 19 | { |
| 20 | public: |
| 21 | typedef function<void(const PrefixRegOptions&)> CommandSucceedCallback; |
| 22 | |
| 23 | /** |
| 24 | * @brief Construct ndnd::Control object |
| 25 | */ |
| 26 | Controller(Face& face); |
| 27 | |
| 28 | virtual void |
| 29 | selfRegisterPrefix(const Name& prefixToRegister, |
| 30 | const SuccessCallback& onSuccess, |
| 31 | const FailCallback& onFail); |
| 32 | |
| 33 | virtual void |
| 34 | selfDeregisterPrefix(const Name& prefixToRegister, |
| 35 | const SuccessCallback& onSuccess, |
| 36 | const FailCallback& onFail); |
| 37 | |
Obaid | 6e7f5f1 | 2014-03-11 14:46:10 -0500 | [diff] [blame] | 38 | void |
| 39 | registerPrefix(const PrefixRegOptions& options, |
| 40 | const CommandSucceedCallback& onSuccess, |
| 41 | const FailCallback& onFail); |
| 42 | |
| 43 | void |
| 44 | unregisterPrefix(const PrefixRegOptions& options, |
| 45 | const CommandSucceedCallback& onSuccess, |
| 46 | const FailCallback& onFail); |
| 47 | |
| 48 | void |
| 49 | advertisePrefix(const PrefixRegOptions& options, |
| 50 | const CommandSucceedCallback& onSuccess, |
| 51 | const FailCallback& onFail); |
| 52 | |
| 53 | void |
| 54 | withdrawPrefix(const PrefixRegOptions& options, |
| 55 | const CommandSucceedCallback& onSuccess, |
| 56 | const FailCallback& onFail); |
| 57 | |
Alexander Afanasyev | efe3ab2 | 2014-02-19 14:57:50 -0800 | [diff] [blame] | 58 | protected: |
| 59 | void |
| 60 | startCommand(const std::string& command, |
| 61 | const PrefixRegOptions& options, |
| 62 | const CommandSucceedCallback& onSuccess, |
| 63 | const FailCallback& onFailure); |
| 64 | |
| 65 | private: |
| 66 | void |
Alexander Afanasyev | efe3ab2 | 2014-02-19 14:57:50 -0800 | [diff] [blame] | 67 | processCommandResponse(Data& data, |
| 68 | const CommandSucceedCallback& onSuccess, |
| 69 | const FailCallback& onFail); |
| 70 | |
| 71 | protected: |
| 72 | Face& m_face; |
Obaid | 6e7f5f1 | 2014-03-11 14:46:10 -0500 | [diff] [blame] | 73 | CommandInterestGenerator m_commandInterestGenerator; |
Alexander Afanasyev | efe3ab2 | 2014-02-19 14:57:50 -0800 | [diff] [blame] | 74 | }; |
| 75 | |
| 76 | } // namespace nrd |
| 77 | } // namespace ndn |
| 78 | |
Alexander Afanasyev | 26c24d2 | 2014-03-20 09:31:21 -0700 | [diff] [blame] | 79 | #endif // NDN_MANAGEMENT_NRD_CONTROLLER_HPP |