NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
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 "common.hpp"
30 
31 namespace nfd {
32 
33 class Channel;
34 class Face;
35 
41 typedef function<void(const shared_ptr<Face>& newFace)> FaceCreatedCallback;
42 
47 typedef function<void(const std::string& reason)> FaceConnectFailedCallback;
48 
49 
51 {
52 public:
56  struct Error : public std::runtime_error
57  {
58  Error(const std::string& what) : std::runtime_error(what) {}
59  };
60 
69  virtual void
70  createFace(const FaceUri& uri,
71  ndn::nfd::FacePersistency persistency,
72  const FaceCreatedCallback& onCreated,
73  const FaceConnectFailedCallback& onConnectFailed) = 0;
74 
75  virtual std::list<shared_ptr<const Channel>>
76  getChannels() const = 0;
77 };
78 
79 } // namespace nfd
80 
81 #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 std::list< shared_ptr< const Channel > > getChannels() const =0
represents the underlying protocol and address used by a Face
Definition: face-uri.hpp:44
STL namespace.
Error(const std::string &what)
represents a face
Definition: face.hpp:57
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:38
Base class for all exceptions thrown by channel factories.
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...
virtual void createFace(const FaceUri &uri, ndn::nfd::FacePersistency persistency, const FaceCreatedCallback &onCreated, const FaceConnectFailedCallback &onConnectFailed)=0
Try to create Face using the supplied FaceUri.