tcp-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_TCP_FACTORY_HPP
27 #define NFD_DAEMON_FACE_TCP_FACTORY_HPP
28 
29 #include "protocol-factory.hpp"
30 #include "tcp-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 
49  void
50  createFace(const FaceUri& uri,
51  ndn::nfd::FacePersistency persistency,
52  bool wantLocalFieldsEnabled,
53  const FaceCreatedCallback& onCreated,
54  const FaceCreationFailedCallback& onFailure) override;
55 
71  shared_ptr<TcpChannel>
72  createChannel(const tcp::Endpoint& localEndpoint);
73 
82  shared_ptr<TcpChannel>
83  createChannel(const std::string& localIp, const std::string& localPort);
84 
85  std::vector<shared_ptr<const Channel>>
86  getChannels() const override;
87 
89  void
90  prohibitEndpoint(const tcp::Endpoint& endpoint);
91 
92  void
93  prohibitAllIpv4Endpoints(uint16_t port);
94 
95  void
96  prohibitAllIpv6Endpoints(uint16_t port);
97 
98 private:
105  shared_ptr<TcpChannel>
106  findChannel(const tcp::Endpoint& localEndpoint) const;
107 
108 private:
109  std::map<tcp::Endpoint, shared_ptr<TcpChannel>> m_channels;
110 
112  std::set<tcp::Endpoint> m_prohibitedEndpoints;
113 };
114 
115 } // namespace face
116 } // namespace nfd
117 
118 #endif // NFD_DAEMON_FACE_TCP_FACTORY_HPP
shared_ptr< TcpChannel > createChannel(const tcp::Endpoint &localEndpoint)
Create TCP-based channel using tcp::Endpoint.
static const std::string & getId()
Definition: tcp-factory.cpp:38
protocol factory for TCP over IPv4 and IPv6
Definition: tcp-factory.hpp:37
std::vector< shared_ptr< const Channel > > getChannels() const override
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.
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::asio::ip::tcp::endpoint Endpoint
Definition: tcp-channel.hpp:35
void processConfig(OptionalConfigSection configSection, FaceSystem::ConfigContext &context) override
process face_system.tcp config section
Definition: tcp-factory.cpp:45
boost::optional< const ConfigSection & > OptionalConfigSection
an optional config file section
Definition: config-file.hpp:41
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
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition: common.hpp:40
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