blob: 42ef9c670d8eba4b5cc58ed2c62ba856bd8297dd [file] [log] [blame]
Xuxiang Tian91018732016-08-17 16:24:47 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (c) 2011-2015 Regents of the University of California.
4 *
5 * This file is part of ndnSIM. See AUTHORS for complete list of ndnSIM authors and
6 * contributors.
7 *
8 * ndnSIM is free software: you can redistribute it and/or modify it under the terms
9 * of the GNU General Public License as published by the Free Software Foundation,
10 * either version 3 of the License, or (at your option) any later version.
11 *
12 * ndnSIM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
13 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * ndnSIM, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
18 **/
19
20#ifndef NDN_NULL_TRANSPORT_HPP
21#define NDN_NULL_TRANSPORT_HPP
22
23#include "ns3/ndnSIM/model/ndn-common.hpp"
24#include "ns3/ndnSIM/NFD/daemon/face/transport.hpp"
25
26namespace ns3 {
27namespace ndn {
28
29/**
30 * \ingroup ndn-face
31 * \brief Null transport (does nothing, just fulfills requirements of the interface)
32 */
33class NullTransport : public nfd::face::Transport
34{
35public:
36 NullTransport(const std::string& localUri, const std::string& remoteUri,
37 ::ndn::nfd::FaceScope scope = ::ndn::nfd::FACE_SCOPE_NON_LOCAL,
38 ::ndn::nfd::FacePersistency persistency = ::ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
39 ::ndn::nfd::LinkType linkType = ::ndn::nfd::LINK_TYPE_POINT_TO_POINT)
40 {
41 this->setLocalUri(FaceUri(localUri));
42 this->setRemoteUri(FaceUri(remoteUri));
43 this->setScope(scope);
44 this->setPersistency(persistency);
45 this->setLinkType(linkType);
46 // this->setMtu(udp::computeMtu(m_socket.local_endpoint())); // not sure what should be here
47 }
48
49private:
50 virtual void
51 beforeChangePersistency(::ndn::nfd::FacePersistency newPersistency)
52 {
53 }
54
55 virtual void
56 doClose()
57 {
58 this->setState(nfd::face::TransportState::CLOSED);
59 }
60
61 virtual void
62 doSend(Packet&& packet)
63 {
64 }
65};
66
67} // namespace ndn
68} // namespace ns3
69
70#endif // NDN_NULL_TRANSPORT_HPP