NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
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 
35 {
36 public:
41  {
42  public:
43  explicit
44  Error(const std::string& what)
45  : ProtocolFactory::Error(what)
46  {
47  }
48  };
49 
67  shared_ptr<TcpChannel>
68  createChannel(const tcp::Endpoint& localEndpoint);
69 
78  shared_ptr<TcpChannel>
79  createChannel(const std::string& localIp, const std::string& localPort);
80 
81 public: // from ProtocolFactory
82  virtual void
83  createFace(const FaceUri& uri,
84  ndn::nfd::FacePersistency persistency,
85  const FaceCreatedCallback& onCreated,
86  const FaceCreationFailedCallback& onConnectFailed) DECL_OVERRIDE;
87 
88  virtual std::vector<shared_ptr<const Channel>>
89  getChannels() const DECL_OVERRIDE;
90 
92  void
93  prohibitEndpoint(const tcp::Endpoint& endpoint);
94 
95  void
96  prohibitAllIpv4Endpoints(uint16_t port);
97 
98  void
99  prohibitAllIpv6Endpoints(uint16_t port);
100 
101 private:
108  shared_ptr<TcpChannel>
109  findChannel(const tcp::Endpoint& localEndpoint) const;
110 
111 private:
112  std::map<tcp::Endpoint, shared_ptr<TcpChannel>> m_channels;
113 
115  std::set<tcp::Endpoint> m_prohibitedEndpoints;
116 };
117 
118 } // namespace nfd
119 
120 #endif // NFD_DAEMON_FACE_TCP_FACTORY_HPP
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
Exception of TcpFactory.
Definition: tcp-factory.hpp:40
#define DECL_OVERRIDE
expands to &#39;override&#39; if compiler supports &#39;override&#39; specifier, otherwise expands to nothing ...
Definition: common.hpp:50
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.
virtual std::vector< shared_ptr< const Channel > > getChannels() const 1
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
Abstract base class for all protocol factories.
boost::asio::ip::tcp::endpoint Endpoint
Definition: tcp-channel.hpp:35
Error(const std::string &what)
Definition: tcp-factory.hpp:44
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition: common.hpp:39
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
shared_ptr< TcpChannel > createChannel(const tcp::Endpoint &localEndpoint)
Create TCP-based channel using tcp::Endpoint.
Definition: tcp-factory.cpp:77