NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
protocol-factory.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26 #ifndef NFD_DAEMON_FACE_PROTOCOL_FACTORY_HPP
27 #define NFD_DAEMON_FACE_PROTOCOL_FACTORY_HPP
28 
29 #include "face.hpp"
30 
31 namespace nfd {
32 
33 class Channel;
34 
40 typedef function<void(const shared_ptr<Face>& newFace)> FaceCreatedCallback;
41 
46 typedef function<void(const std::string& reason)> FaceConnectFailedCallback;
47 
48 
50 {
51 public:
55  struct Error : public std::runtime_error
56  {
57  Error(const std::string& what) : std::runtime_error(what) {}
58  };
59 
67  virtual void
68  createFace(const FaceUri& uri,
69  const FaceCreatedCallback& onCreated,
70  const FaceConnectFailedCallback& onConnectFailed) = 0;
71 
72  virtual std::list<shared_ptr<const Channel> >
73  getChannels() const = 0;
74 
75 };
76 
77 } // namespace nfd
78 
79 #endif // NFD_DAEMON_FACE_PROTOCOL_FACTORY_HPP
function< void(const std::string &reason)> FaceConnectFailedCallback
Prototype for the callback that is called when face is failed to get created.
virtual void createFace(const FaceUri &uri, const FaceCreatedCallback &onCreated, const FaceConnectFailedCallback &onConnectFailed)=0
Try to create Face using the supplied Face URI.
Error(const std::string &what)
Base class for all exceptions thrown by channel factories.
virtual std::list< shared_ptr< const Channel > > getChannels() const =0
function< void(const shared_ptr< Face > &newFace)> FaceCreatedCallback
Prototype for the callback called when face is created (as a response to incoming connection or after...