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 namespace face {
34 
38 {
39 public:
40  static const std::string&
41  getId();
42 
45  void
47  FaceSystem::ConfigContext& context) override;
48 
51  void
52  createFace(const FaceUri& uri,
53  ndn::nfd::FacePersistency persistency,
54  bool wantLocalFieldsEnabled,
55  const FaceCreatedCallback& onCreated,
56  const FaceCreationFailedCallback& onFailure) override;
57 
70  shared_ptr<WebSocketChannel>
71  createChannel(const websocket::Endpoint& localEndpoint);
72 
79  shared_ptr<WebSocketChannel>
80  createChannel(const std::string& localIp, const std::string& localPort);
81 
82  std::vector<shared_ptr<const Channel>>
83  getChannels() const override;
84 
85 private:
92  shared_ptr<WebSocketChannel>
93  findChannel(const websocket::Endpoint& endpoint) const;
94 
95 private:
96  std::map<websocket::Endpoint, shared_ptr<WebSocketChannel>> m_channels;
97 };
98 
99 } // namespace face
100 } // namespace nfd
101 
102 #endif // NFD_DAEMON_FACE_WEBSOCKET_FACTORY_HPP
protocol factory for WebSocket
std::vector< shared_ptr< const Channel > > getChannels() const override
context for processing a config section in ProtocolFactory
Definition: face-system.hpp:77
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
boost::optional< const ConfigSection & > OptionalConfigSection
an optional config file section
Definition: config-file.hpp:41
shared_ptr< WebSocketChannel > createChannel(const websocket::Endpoint &localEndpoint)
Create WebSocket-based channel using websocket::Endpoint.
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
provide support for an underlying protocol
void createFace(const FaceUri &uri, ndn::nfd::FacePersistency persistency, bool wantLocalFieldsEnabled, const FaceCreatedCallback &onCreated, const FaceCreationFailedCallback &onFailure) override
unicast face creation is not supported and will always fail
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
void processConfig(OptionalConfigSection configSection, FaceSystem::ConfigContext &context) override
process face_system.websocket config section
static const std::string & getId()