multicast-discovery.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26 #ifndef NFD_TOOLS_NDN_AUTOCONFIG_MULTICAST_DISCOVERY_HPP
27 #define NFD_TOOLS_NDN_AUTOCONFIG_MULTICAST_DISCOVERY_HPP
28 
29 #include "base.hpp"
30 
31 #include <ndn-cxx/security/validator-null.hpp>
32 
33 namespace ndn {
34 namespace tools {
35 namespace autoconfig {
36 
52 class MulticastDiscovery : public Base
53 {
54 public:
59  MulticastDiscovery(Face& face, KeyChain& keyChain, const NextStageCallback& nextStageOnFailure);
60 
61  virtual void
62  start() override;
63 
64 private:
65  void
66  registerHubDiscoveryPrefix(const ConstBufferPtr& buffer);
67 
68  void
69  onRegisterSuccess();
70 
71  void
72  onRegisterFailure(const nfd::ControlResponse& response);
73 
74  void
75  setStrategy();
76 
77  void
78  onSetStrategyFailure(const nfd::ControlResponse& response);
79 
80  // Start to look for a hub (NDN hub discovery first stage)
81  void
82  requestHubData();
83 
84  void
85  onSuccess(Data& data);
86 
87 private:
88  size_t nRequestedRegs;
89  size_t nFinishedRegs;
90 
91  ndn::ValidatorNull m_validator;
92 };
93 
94 } // namespace autoconfig
95 } // namespace tools
96 } // namespace ndn
97 
98 #endif // NFD_TOOLS_NDN_AUTOCONFIG_MULTICAST_DISCOVERY_HPP
Copyright (c) 2014-2016, Regents of the University of California, Arizona Board of Regents...
Definition: nfd.hpp:35
virtual void start() override
Start the stage.
std::function< void(const std::string &)> NextStageCallback
Callback to be called when the stage fails.
Definition: base.hpp:61
Base class for discovery stages.
Definition: base.hpp:45
MulticastDiscovery(Face &face, KeyChain &keyChain, const NextStageCallback &nextStageOnFailure)
Create multicast discovery stage.