blob: de64325a7faa12958cc05775cecd2f53e7e1843e [file] [log] [blame]
Alexander Afanasyevefe3ab22014-02-19 14:57:50 -08001/* -*- 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 Afanasyev26c24d22014-03-20 09:31:21 -07007#ifndef NDN_MANAGEMENT_NRD_CONTROLLER_HPP
8#define NDN_MANAGEMENT_NRD_CONTROLLER_HPP
Alexander Afanasyevefe3ab22014-02-19 14:57:50 -08009
10#include "controller.hpp"
Obaid6e7f5f12014-03-11 14:46:10 -050011#include "../util/command-interest-generator.hpp"
Alexander Afanasyevefe3ab22014-02-19 14:57:50 -080012
13namespace ndn {
14namespace nrd {
15
16class PrefixRegOptions;
17
18class Controller : public ndn::Controller
19{
20public:
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
Obaid6e7f5f12014-03-11 14:46:10 -050038 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 Afanasyevefe3ab22014-02-19 14:57:50 -080058protected:
59 void
60 startCommand(const std::string& command,
61 const PrefixRegOptions& options,
62 const CommandSucceedCallback& onSuccess,
63 const FailCallback& onFailure);
64
65private:
66 void
Alexander Afanasyevefe3ab22014-02-19 14:57:50 -080067 processCommandResponse(Data& data,
68 const CommandSucceedCallback& onSuccess,
69 const FailCallback& onFail);
70
71protected:
72 Face& m_face;
Obaid6e7f5f12014-03-11 14:46:10 -050073 CommandInterestGenerator m_commandInterestGenerator;
Alexander Afanasyevefe3ab22014-02-19 14:57:50 -080074};
75
76} // namespace nrd
77} // namespace ndn
78
Alexander Afanasyev26c24d22014-03-20 09:31:21 -070079#endif // NDN_MANAGEMENT_NRD_CONTROLLER_HPP