22 #include "../helper/ndn-stack-helper.hpp" 24 #include "../utils/ndn-ns3-packet-tag.hpp" 26 #include <ndn-cxx/encoding/block.hpp> 27 #include <ndn-cxx/interest.hpp> 28 #include <ndn-cxx/data.hpp> 30 NS_LOG_COMPONENT_DEFINE(
"ndn.NetDeviceTransport");
36 const Ptr<NetDevice>& netDevice,
37 const std::string& localUri,
38 const std::string& remoteUri,
42 : m_netDevice(netDevice)
52 NS_LOG_FUNCTION(
this <<
"Creating an ndnSIM transport instance for netDevice with URI" 55 NS_ASSERT_MSG(m_netDevice != 0,
"NetDeviceFace needs to be assigned a valid NetDevice");
57 m_node->RegisterProtocolHandler(MakeCallback(&NetDeviceTransport::receiveFromNetDevice,
this),
64 NS_LOG_FUNCTION_NOARGS();
68 NetDeviceTransport::doClose()
70 NS_LOG_FUNCTION(
this <<
"Closing transport for netDevice with URI" 78 NetDeviceTransport::doSend(
Packet&& packet)
80 NS_LOG_FUNCTION(
this <<
"Sending packet from netDevice with URI" 86 Ptr<ns3::Packet> ns3Packet = Create<ns3::Packet>();
87 ns3Packet->AddHeader(header);
90 m_netDevice->Send(ns3Packet, m_netDevice->GetBroadcast(),
96 NetDeviceTransport::receiveFromNetDevice(Ptr<NetDevice> device,
97 Ptr<const ns3::Packet> p,
99 const Address& from,
const Address& to,
100 NetDevice::PacketType packetType)
102 NS_LOG_FUNCTION(device << p << protocol << from << to << packetType);
105 Ptr<ns3::Packet> packet = p->Copy();
108 packet->RemoveHeader(header);
112 this->
receive(std::move(nfdPacket));
void setPersistency(ndn::nfd::FacePersistency newPersistency)
changes face persistency setting
Copyright (c) 2011-2015 Regents of the University of California.
static const uint16_t ETHERNET_FRAME_TYPE
Ethernet Frame Type of Ndn.
void setRemoteUri(const FaceUri &uri)
Ptr< NetDevice > GetNetDevice() const
stores a packet along with the remote endpoint
FaceUri getLocalUri() const
void setLinkType(ndn::nfd::LinkType linkType)
NetDeviceTransport(Ptr< Node > node, const Ptr< NetDevice > &netDevice, const std::string &localUri, const std::string &remoteUri,::ndn::nfd::FaceScope scope=::ndn::nfd::FACE_SCOPE_NON_LOCAL,::ndn::nfd::FacePersistency persistency=::ndn::nfd::FACE_PERSISTENCY_PERSISTENT,::ndn::nfd::LinkType linkType=::ndn::nfd::LINK_TYPE_POINT_TO_POINT)
void setScope(ndn::nfd::FaceScope scope)
the transport is closed, and can be safely deallocated
Copyright (c) 2011-2015 Regents of the University of California.
void setLocalUri(const FaceUri &uri)
void setState(TransportState newState)
set transport state
void receive(Packet &&packet)
receive a link-layer packet