NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
websocket-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_WEBSOCKET_FACTORY_HPP
27 #define NFD_DAEMON_FACE_WEBSOCKET_FACTORY_HPP
28 
29 #include "protocol-factory.hpp"
30 #include "websocket-channel.hpp"
31 
32 namespace nfd {
33 
35 {
36 public:
41  {
42  public:
43  explicit
44  Error(const std::string& what)
45  : ProtocolFactory::Error(what)
46  {
47  }
48  };
49 
64  shared_ptr<WebSocketChannel>
65  createChannel(const websocket::Endpoint& localEndpoint);
66 
75  shared_ptr<WebSocketChannel>
76  createChannel(const std::string& localIp, const std::string& localPort);
77 
78 public: // from ProtocolFactory
79  virtual void
80  createFace(const FaceUri& uri,
81  ndn::nfd::FacePersistency persistency,
82  const FaceCreatedCallback& onCreated,
83  const FaceCreationFailedCallback& onConnectFailed) DECL_OVERRIDE;
84 
85  virtual std::vector<shared_ptr<const Channel>>
86  getChannels() const DECL_OVERRIDE;
87 
88 private:
95  shared_ptr<WebSocketChannel>
96  findChannel(const websocket::Endpoint& endpoint) const;
97 
98 private:
99  std::map<websocket::Endpoint, shared_ptr<WebSocketChannel>> m_channels;
100 };
101 
102 } // namespace nfd
103 
104 #endif // NFD_DAEMON_FACE_WEBSOCKET_FACTORY_HPP
virtual void createFace(const FaceUri &uri, ndn::nfd::FacePersistency persistency, const FaceCreatedCallback &onCreated, const FaceCreationFailedCallback &onConnectFailed) 1
Try to create Face using the supplied FaceUri.
function< void(const std::string &reason)> FaceCreationFailedCallback
Prototype for the callback that is invoked when the face fails to be created.
Definition: channel.hpp:44
Base class for all exceptions thrown by protocol factories.
represents the underlying protocol and address used by a Face
Definition: face-uri.hpp:44
shared_ptr< WebSocketChannel > createChannel(const websocket::Endpoint &localEndpoint)
Create WebSocket-based channel using websocket::Endpoint.
Exception of WebSocketFactory.
#define DECL_OVERRIDE
expands to &#39;override&#39; if compiler supports &#39;override&#39; specifier, otherwise expands to nothing ...
Definition: common.hpp:50
Error(const std::string &what)
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
Abstract base class for all protocol factories.
function< void(const shared_ptr< Face > &newFace)> FaceCreatedCallback
Prototype for the callback that is invoked when the face is created (as a response to incoming connec...
Definition: channel.hpp:38
virtual std::vector< shared_ptr< const Channel > > getChannels() const 1
boost::asio::ip::tcp::endpoint Endpoint