blob: aa788a91dd1646e606a1edfc0674441b3910e9d0 [file] [log] [blame]
Alexander Afanasyeve289b532014-02-09 22:14:44 -08001/* -*- 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 Afanasyeve289b532014-02-09 22:14:44 -080010#include "controller.hpp"
11
Alexander Afanasyeve289b532014-02-09 22:14:44 -080012#include "../security/key-chain.hpp"
13
14namespace ndn {
15
Alexander Afanasyeve289b532014-02-09 22:14:44 -080016namespace nfd {
17
18class FibManagementOptions;
19
20class Controller : public ndn::Controller
21{
22public:
23 typedef function<void(const FibManagementOptions&)> FibCommandSucceedCallback;
24
25 /**
26 * @brief Construct ndnd::Control object
27 */
Alexander Afanasyev0222fba2014-02-09 23:16:02 -080028 Controller(Face& face);
Alexander Afanasyeve289b532014-02-09 22:14:44 -080029
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);
45private:
46 void
47 recordSelfRegisteredFaceId(const FibManagementOptions& entry,
48 const SuccessCallback& onSuccess);
49
50 // void
Alexander Afanasyev0222fba2014-02-09 23:16:02 -080051 // processFaceActionResponse(Data& data,
Alexander Afanasyeve289b532014-02-09 22:14:44 -080052 // const FaceOperationSucceedCallback& onSuccess,
53 // const FailCallback& onFail);
54
55 void
Alexander Afanasyev0222fba2014-02-09 23:16:02 -080056 processFibCommandResponse(Data& data,
Alexander Afanasyeve289b532014-02-09 22:14:44 -080057 const FibCommandSucceedCallback& onSuccess,
58 const FailCallback& onFail);
59
60private:
Alexander Afanasyev0222fba2014-02-09 23:16:02 -080061 Face& m_face;
Alexander Afanasyeve289b532014-02-09 22:14:44 -080062 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