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:
46 
47 protected:
48  bool
49  canChangePersistencyToImpl(ndn::nfd::FacePersistency newPersistency) const final;
50 
51  void
53 
54  void
55  doClose() final;
56 
57  void
58  handleError(const boost::system::error_code& error) final;
59 
62  reconnect();
63 
65  handleReconnect(const boost::system::error_code& error);
66 
68  handleReconnectTimeout();
69 
73  static time::milliseconds s_initialReconnectWait;
74 
77  static time::milliseconds s_maxReconnectWait;
78 
81  static float s_reconnectWaitMultiplier;
82 
83 private:
84  typename protocol::endpoint m_remoteEndpoint;
85 
88  scheduler::ScopedEventId m_reconnectEvent;
89 
92  time::milliseconds m_nextReconnectWait;
93 };
94 
95 } // namespace face
96 } // namespace nfd
97 
98 #endif // NFD_DAEMON_FACE_TCP_TRANSPORT_HPP
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition: common.hpp:40
void afterChangePersistency(ndn::nfd::FacePersistency oldPersistency) final
invoked after the persistency has been changed
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.
boost::posix_time::time_duration milliseconds(long duration)
Definition: asio.hpp:117
#define VIRTUAL_WITH_TESTS
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:59
void handleError(const boost::system::error_code &error) final
bool canChangePersistencyToImpl(ndn::nfd::FacePersistency newPersistency) const final
invoked by canChangePersistencyTo to perform the check
#define PROTECTED_WITH_TESTS_ELSE_PRIVATE
Definition: common.hpp:41
Catch-all error for socket component errors that don&#39;t fit in other categories.
Definition: base.hpp:83
#define FINAL_UNLESS_WITH_TESTS
Definition: common.hpp:42