NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: 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:
52  shared_ptr<TcpChannel>
53  createChannel(const tcp::Endpoint& localEndpoint);
54 
63  shared_ptr<TcpChannel>
64  createChannel(const std::string& localIp, const std::string& localPort);
65 
66 public: // from ProtocolFactory
67  virtual void
68  createFace(const FaceUri& uri,
69  ndn::nfd::FacePersistency persistency,
70  bool wantLocalFieldsEnabled,
71  const FaceCreatedCallback& onCreated,
72  const FaceCreationFailedCallback& onFailure) override;
73 
74  virtual std::vector<shared_ptr<const Channel>>
75  getChannels() const override;
76 
78  void
79  prohibitEndpoint(const tcp::Endpoint& endpoint);
80 
81  void
82  prohibitAllIpv4Endpoints(uint16_t port);
83 
84  void
85  prohibitAllIpv6Endpoints(uint16_t port);
86 
87 private:
94  shared_ptr<TcpChannel>
95  findChannel(const tcp::Endpoint& localEndpoint) const;
96 
97 private:
98  std::map<tcp::Endpoint, shared_ptr<TcpChannel>> m_channels;
99 
101  std::set<tcp::Endpoint> m_prohibitedEndpoints;
102 };
103 
104 } // namespace nfd
105 
106 #endif // NFD_DAEMON_FACE_TCP_FACTORY_HPP
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition: common.hpp:40
represents the underlying protocol and address used by a Face
Definition: face-uri.hpp:44
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
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
shared_ptr< TcpChannel > createChannel(const tcp::Endpoint &localEndpoint)
Create TCP-based channel using tcp::Endpoint.
Definition: tcp-factory.cpp:77
virtual std::vector< shared_ptr< const Channel > > getChannels() const override