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 
33 namespace nfd {
34 
36 {
37 public:
41  struct Error : public ProtocolFactory::Error
42  {
43  Error(const std::string& what) : ProtocolFactory::Error(what) {}
44  };
45 
46  explicit
47  TcpFactory(const std::string& defaultPort = "6363");
48 
66  shared_ptr<TcpChannel>
67  createChannel(const tcp::Endpoint& localEndpoint);
68 
77  shared_ptr<TcpChannel>
78  createChannel(const std::string& localIp, const std::string& localPort);
79 
80  // from ProtocolFactory
81 
82  virtual void
83  createFace(const FaceUri& uri,
84  ndn::nfd::FacePersistency persistency,
85  const FaceCreatedCallback& onCreated,
86  const FaceConnectFailedCallback& onConnectFailed) DECL_OVERRIDE;
87 
88  virtual std::list<shared_ptr<const Channel> >
89  getChannels() const;
90 
92 
93  void
94  prohibitEndpoint(const tcp::Endpoint& endpoint);
95 
96  void
97  prohibitAllIpv4Endpoints(const uint16_t port);
98 
99  void
100  prohibitAllIpv6Endpoints(const uint16_t port);
101 
110  shared_ptr<TcpChannel>
111  findChannel(const tcp::Endpoint& localEndpoint);
112 
114  typedef std::map< tcp::Endpoint, shared_ptr<TcpChannel> > ChannelMap;
115  ChannelMap m_channels;
116 
117  std::string m_defaultPort;
118 
119  std::set<tcp::Endpoint> m_prohibitedEndpoints;
120 };
121 
122 } // namespace nfd
123 
124 #endif // NFD_DAEMON_FACE_TCP_FACTORY_HPP
function< void(const std::string &reason)> FaceConnectFailedCallback
Prototype for the callback that is called when face is failed to get created.
represents the underlying protocol and address used by a Face
Definition: face-uri.hpp:44
Exception of TcpFactory.
Definition: tcp-factory.hpp:41
#define DECL_OVERRIDE
expands to &#39;override&#39; if compiler supports this feature, otherwise expands to nothing ...
Definition: common.hpp:49
TcpFactory(const std::string &defaultPort="6363")
Definition: tcp-factory.cpp:41
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:38
boost::asio::ip::tcp::endpoint Endpoint
Definition: tcp-channel.hpp:35
Base class for all exceptions thrown by channel factories.
virtual std::list< shared_ptr< const Channel > > getChannels() const
Error(const std::string &what)
Definition: tcp-factory.hpp:43
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition: common.hpp:39
function< void(const shared_ptr< Face > &newFace)> FaceCreatedCallback
Prototype for the callback called when face is created (as a response to incoming connection or after...
shared_ptr< TcpChannel > createChannel(const tcp::Endpoint &localEndpoint)
Create TCP-based channel using tcp::Endpoint.
Definition: tcp-factory.cpp:96
virtual void createFace(const FaceUri &uri, ndn::nfd::FacePersistency persistency, const FaceCreatedCallback &onCreated, const FaceConnectFailedCallback &onConnectFailed) 1
Try to create Face using the supplied FaceUri.