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 
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
const ssize_t MTU_UNLIMITED
indicates the transport has no limit on payload size
Definition: transport.hpp:95
STL namespace.
Implements Transport for stream-based protocols.
#define NFD_LOG_FACE_INFO(msg)
Log a message at INFO level.
Definition: face-log.hpp:80
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
#define NFD_LOG_INCLASS_TEMPLATE_SPECIALIZATION_DEFINE(cls, specialization, name)
Definition: logger.hpp:46