NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
tcp-transport.cpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26
#include "
tcp-transport.hpp
"
27
28
namespace
nfd
{
29
namespace
face
{
30
31
NFD_LOG_INCLASS_TEMPLATE_SPECIALIZATION_DEFINE
(
StreamTransport
, TcpTransport::protocol,
32
"TcpTransport"
);
33
34
TcpTransport::TcpTransport
(protocol::socket&& socket,
ndn::nfd::FacePersistency
persistency)
35
:
StreamTransport
(
std
::move(socket))
36
{
37
this->setLocalUri(FaceUri(m_socket.local_endpoint()));
38
this->setRemoteUri(FaceUri(m_socket.remote_endpoint()));
39
40
if
(m_socket.local_endpoint().address().is_loopback() &&
41
m_socket.remote_endpoint().address().is_loopback())
42
this->setScope(
ndn::nfd::FACE_SCOPE_LOCAL
);
43
else
44
this->setScope(
ndn::nfd::FACE_SCOPE_NON_LOCAL
);
45
46
this->setPersistency(persistency);
47
this->setLinkType(
ndn::nfd::LINK_TYPE_POINT_TO_POINT
);
48
this->setMtu(
MTU_UNLIMITED
);
49
50
NFD_LOG_FACE_INFO
(
"Creating transport"
);
51
}
52
53
void
54
TcpTransport::beforeChangePersistency(
ndn::nfd::FacePersistency
newPersistency)
55
{
56
if
(newPersistency ==
ndn::nfd::FACE_PERSISTENCY_PERMANENT
) {
57
BOOST_THROW_EXCEPTION(
58
std::invalid_argument(
"TcpTransport does not support FACE_PERSISTENCY_PERMANENT"
));
59
}
60
}
61
62
}
// namespace face
63
}
// namespace nfd
tcp-transport.hpp
nfd::face::StreamTransport
StreamTransport
Definition:
tcp-transport.cpp:31
ndn::nfd::FACE_PERSISTENCY_PERMANENT
face is permanent
Definition:
nfd-constants.hpp:59
ndn::nfd::FACE_SCOPE_NON_LOCAL
face is non-local
Definition:
nfd-constants.hpp:38
nfd::face::MTU_UNLIMITED
const ssize_t MTU_UNLIMITED
indicates the transport has no limit on payload size
Definition:
transport.hpp:95
ndn::nfd::LINK_TYPE_POINT_TO_POINT
link is point-to-point
Definition:
nfd-constants.hpp:71
std
STL namespace.
nfd::face::StreamTransport
Implements Transport for stream-based protocols.
Definition:
stream-transport.hpp:42
ndn::nfd::FacePersistency
FacePersistency
Definition:
nfd-constants.hpp:49
NFD_LOG_FACE_INFO
#define NFD_LOG_FACE_INFO(msg)
Log a message at INFO level.
Definition:
face-log.hpp:80
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
nfd::face::TcpTransport
TcpTransport
Definition:
tcp-transport.cpp:31
NFD_LOG_INCLASS_TEMPLATE_SPECIALIZATION_DEFINE
#define NFD_LOG_INCLASS_TEMPLATE_SPECIALIZATION_DEFINE(cls, specialization, name)
Definition:
logger.hpp:46
face
ndn::nfd::FACE_SCOPE_LOCAL
face is local
Definition:
nfd-constants.hpp:41
ndnSIM
NFD
daemon
face
tcp-transport.cpp
Generated on Sat Nov 12 2016 16:02:54 for ndnSIM by
1.8.12