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:
49  shared_ptr<WebSocketChannel>
50  createChannel(const websocket::Endpoint& localEndpoint);
51 
58  shared_ptr<WebSocketChannel>
59  createChannel(const std::string& localIp, const std::string& localPort);
60 
61 public: // from ProtocolFactory
62  virtual void
63  createFace(const FaceUri& uri,
64  ndn::nfd::FacePersistency persistency,
65  bool wantLocalFieldsEnabled,
66  const FaceCreatedCallback& onCreated,
67  const FaceCreationFailedCallback& onFailure) override;
68 
69  virtual std::vector<shared_ptr<const Channel>>
70  getChannels() const override;
71 
72 private:
79  shared_ptr<WebSocketChannel>
80  findChannel(const websocket::Endpoint& endpoint) const;
81 
82 private:
83  std::map<websocket::Endpoint, shared_ptr<WebSocketChannel>> m_channels;
84 };
85 
86 } // namespace nfd
87 
88 #endif // NFD_DAEMON_FACE_WEBSOCKET_FACTORY_HPP
shared_ptr< WebSocketChannel > createChannel(const websocket::Endpoint &localEndpoint)
Create WebSocket-based channel using websocket::Endpoint.
virtual std::vector< shared_ptr< const Channel > > getChannels() const override
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
Definition: algorithm.hpp:32
virtual void createFace(const FaceUri &uri, ndn::nfd::FacePersistency persistency, bool wantLocalFieldsEnabled, const FaceCreatedCallback &onCreated, const FaceCreationFailedCallback &onFailure) override
Try to create Face using the supplied FaceUri.
function< void(uint32_t status, const std::string &reason)> FaceCreationFailedCallback
Prototype for the callback that is invoked when the face fails to be created.
Definition: channel.hpp:44
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
boost::asio::ip::tcp::endpoint Endpoint
Abstract base class for all protocol factories.