|
NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
|
API Documentation
|
Go to the documentation of this file.
29 #if defined(__linux__)
30 #include <linux/sockios.h>
31 #include <sys/ioctl.h>
39 time::milliseconds TcpTransport::s_initialReconnectWait = 1_s;
40 time::milliseconds TcpTransport::s_maxReconnectWait = 5_min;
41 float TcpTransport::s_reconnectWaitMultiplier = 2.0f;
47 , m_remoteEndpoint(m_socket.remote_endpoint())
48 , m_nextReconnectWait(s_initialReconnectWait)
68 #if defined(__linux__)
70 if (ioctl(
m_socket.native_handle(), SIOCOUTQNSD, &nsd) < 0) {
71 NFD_LOG_FACE_WARN(
"Failed to obtain send queue length from socket: " << std::strerror(errno));
109 boost::system::error_code ec;
121 TcpTransport::reconnect()
137 #
if BOOST_VERSION >= 107000
146 m_reconnectEvent =
getScheduler().schedule(m_nextReconnectWait,
147 [
this] { this->handleReconnectTimeout(); });
148 m_socket.async_connect(m_remoteEndpoint, [
this] (
const auto& e) { this->handleReconnect(e); });
152 TcpTransport::handleReconnect(
const boost::system::error_code& error)
157 error == boost::asio::error::operation_aborted) {
167 m_reconnectEvent.
cancel();
168 m_nextReconnectWait = s_initialReconnectWait;
177 TcpTransport::handleReconnectTimeout()
180 boost::system::error_code error;
184 m_nextReconnectWait =
185 std::min(time::duration_cast<time::milliseconds>(m_nextReconnectWait * s_reconnectWaitMultiplier),
195 m_reconnectEvent.
cancel();
ssize_t getSendQueueLength() final
void cancel()
Cancel the operation.
@ CLOSED
the transport is closed, and can be safely deallocated
void resetReceiveBuffer()
void post(const std::function< void()> &callback)
const ssize_t MTU_UNLIMITED
indicates the transport has no limit on payload size
void setRemoteUri(const FaceUri &uri)
@ LINK_TYPE_POINT_TO_POINT
link is point-to-point
represents the underlying protocol and address used by a Face
@ FACE_PERSISTENCY_PERMANENT
face is permanent
bool canChangePersistencyToImpl(ndn::nfd::FacePersistency newPersistency) const final
invoked by canChangePersistencyTo to perform the check
void setScope(ndn::nfd::FaceScope scope)
NFD_LOG_MEMBER_INIT_SPECIALIZED((DatagramTransport< boost::asio::ip::udp, Multicast >), MulticastUdpTransport)
void setState(TransportState newState)
set transport state
@ DOWN
the transport is temporarily down, and is being recovered
#define NFD_LOG_FACE_DEBUG(msg)
Log a message at DEBUG level.
size_t getSendQueueBytes() const
ndn::nfd::FacePersistency getPersistency() const
detail::SimulatorIo & getGlobalIoService()
Returns the global io_service instance for the calling thread.
@ CLOSING
the transport is being closed gracefully, either by the peer or by a call to close()
Copyright (c) 2011-2015 Regents of the University of California.
void doClose() override
performs Transport specific operations to close the transport
void afterChangePersistency(ndn::nfd::FacePersistency oldPersistency) final
invoked after the persistency has been changed
virtual void handleError(const boost::system::error_code &error)
#define NFD_LOG_FACE_TRACE(msg)
Log a message at TRACE level.
Scheduler & getScheduler()
Returns the global Scheduler instance for the calling thread.
void setLinkType(ndn::nfd::LinkType linkType)
void handleError(const boost::system::error_code &error) final
@ UP
the transport is up and can transmit packets
A Transport that communicates on a connected TCP socket.
protocol::socket m_socket
void setPersistency(ndn::nfd::FacePersistency newPersistency)
changes face persistency setting
@ FAILED
the transport is being closed due to a failure
TransportState getState() const
TcpTransport(protocol::socket &&socket, ndn::nfd::FacePersistency persistency, ndn::nfd::FaceScope faceScope)
void doClose() final
performs Transport specific operations to close the transport
#define NFD_LOG_FACE_WARN(msg)
Log a message at WARN level.
void setLocalUri(const FaceUri &uri)