blob: c5bd7bf9d2d373daf065e8e4fc392775fd30980e [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
7#ifndef NDN_MANAGEMENT_NFD_CONTROLLER_HPP
8#define NDN_MANAGEMENT_NFD_CONTROLLER_HPP
9
10#include "controller.hpp"
11#include "../security/key-chain.hpp"
12
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
38protected:
39 void
40 startCommand(const std::string& command,
41 const PrefixRegOptions& options,
42 const CommandSucceedCallback& onSuccess,
43 const FailCallback& onFailure);
44
45private:
46 void
47 recordSelfRegisteredFaceId(const PrefixRegOptions& entry,
48 const SuccessCallback& onSuccess);
49
50 void
51 processCommandResponse(Data& data,
52 const CommandSucceedCallback& onSuccess,
53 const FailCallback& onFail);
54
55protected:
56 Face& m_face;
57 KeyChain m_keyChain;
58 uint64_t m_faceId; // internal face ID (needed for prefix de-registration)
59};
60
61} // namespace nrd
62} // namespace ndn
63
64#endif // NDN_MANAGEMENT_NFD_CONTROLLER_HPP