NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
tcp-transport.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_TRANSPORT_HPP
27 #define NFD_DAEMON_FACE_TCP_TRANSPORT_HPP
28 
29 #include "stream-transport.hpp"
30 #include "core/scheduler.hpp"
31 
32 namespace nfd {
33 namespace face {
34 
42 class TcpTransport FINAL_UNLESS_WITH_TESTS : public StreamTransport<boost::asio::ip::tcp>
43 {
44 public:
45  TcpTransport(protocol::socket&& socket, ndn::nfd::FacePersistency persistency);
46 
47 protected:
48  void
50 
51  void
52  doClose() final;
53 
54  void
55  handleError(const boost::system::error_code& error) final;
56 
59  reconnect();
60 
62  handleReconnect(const boost::system::error_code& error);
63 
65  handleReconnectTimeout();
66 
70  static time::milliseconds s_initialReconnectWait;
71 
74  static time::milliseconds s_maxReconnectWait;
75 
78  static float s_reconnectWaitMultiplier;
79 
80 private:
81  typename protocol::endpoint m_remoteEndpoint;
82 
85  scheduler::ScopedEventId m_reconnectEvent;
86 
89  time::milliseconds m_nextReconnectWait;
90 };
91 
92 } // namespace face
93 } // namespace nfd
94 
95 #endif // NFD_DAEMON_FACE_TCP_TRANSPORT_HPP
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition: common.hpp:40
void doClose() final
performs Transport specific operations to close the transport
TcpTransport(protocol::socket &&socket, ndn::nfd::FacePersistency persistency)
A Transport that communicates on a connected TCP socket.
#define VIRTUAL_WITH_TESTS
Copyright (c) 2014-2016, Regents of the University of California, Arizona Board of Regents...
Definition: common.hpp:38
Implements Transport for stream-based protocols.
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
cancels an event automatically upon destruction
Definition: scheduler.hpp:57
void handleError(const boost::system::error_code &error) final
void beforeChangePersistency(ndn::nfd::FacePersistency newPersistency) final
invoked before persistency is changed
#define PROTECTED_WITH_TESTS_ELSE_PRIVATE
Definition: common.hpp:41
#define FINAL_UNLESS_WITH_TESTS
Definition: common.hpp:42