From d898890fa68c604dab4678e0d2148bc45edcef74 Mon Sep 17 00:00:00 2001 From: Tim Schubert Date: Sun, 21 Jun 2020 16:11:04 +0200 Subject: [PATCH] rename isl to mock --- helper/isl-helper.cc | 40 ++--- model/{isl-channel.cc => mock-channel.cc} | 62 +++---- model/{isl-channel.h => mock-channel.h} | 24 +-- .../{isl-net-device.cc => mock-net-device.cc} | 160 +++++++++--------- model/{isl-net-device.h => mock-net-device.h} | 64 +++---- wscript | 8 +- 6 files changed, 179 insertions(+), 179 deletions(-) rename model/{isl-channel.cc => mock-channel.cc} (71%) rename model/{isl-channel.h => mock-channel.h} (83%) rename model/{isl-net-device.cc => mock-net-device.cc} (78%) rename model/{isl-net-device.h => mock-net-device.h} (90%) diff --git a/helper/isl-helper.cc b/helper/isl-helper.cc index 3af9480..b64da3b 100644 --- a/helper/isl-helper.cc +++ b/helper/isl-helper.cc @@ -30,8 +30,8 @@ #include "ns3/names.h" #include "ns3/trace-helper.h" -#include "../model/isl-net-device.h" -#include "../model/isl-channel.h" +#include "../model/mock-net-device.h" +#include "../model/mock-channel.h" #include "isl-helper.h" namespace ns3 { @@ -41,8 +41,8 @@ NS_LOG_COMPONENT_DEFINE ("IslHelper"); IslHelper::IslHelper () { m_queueFactory.SetTypeId ("ns3::DropTailQueue"); - m_deviceFactory.SetTypeId ("ns3::IslNetDevice"); - m_channelFactory.SetTypeId ("ns3::IslChannel"); + m_deviceFactory.SetTypeId ("ns3::MockNetDevice"); + m_channelFactory.SetTypeId ("ns3::MockChannel"); } void @@ -79,12 +79,12 @@ IslHelper::EnablePcapInternal (std::string prefix, Ptr nd, bool promi // // All of the Pcap enable functions vector through here including the ones // that are wandering through all of devices on perhaps all of the nodes in - // the system. We can only deal with devices of type IslNetDevice. + // the system. We can only deal with devices of type MockNetDevice. // - Ptr device = nd->GetObject (); + Ptr device = nd->GetObject (); if (device == 0) { - NS_LOG_INFO ("IslHelper::EnablePcapInternal(): Device " << device << " not of type ns3::IslNetDevice"); + NS_LOG_INFO ("IslHelper::EnablePcapInternal(): Device " << device << " not of type ns3::MockNetDevice"); return; } @@ -102,7 +102,7 @@ IslHelper::EnablePcapInternal (std::string prefix, Ptr nd, bool promi Ptr file = pcapHelper.CreateFile (filename, std::ios::out, PcapHelper::DLT_PPP); - pcapHelper.HookDefaultSink (device, "PromiscSniffer", file); + pcapHelper.HookDefaultSink (device, "PromiscSniffer", file); } void @@ -115,13 +115,13 @@ IslHelper::EnableAsciiInternal ( // // All of the ascii enable functions vector through here including the ones // that are wandering through all of devices on perhaps all of the nodes in - // the system. We can only deal with devices of type IslNetDevice. + // the system. We can only deal with devices of type MockNetDevice. // - Ptr device = nd->GetObject (); + Ptr device = nd->GetObject (); if (device == 0) { NS_LOG_INFO ("IslHelper::EnableAsciiInternal(): Device " << device << - " not of type ns3::IslNetDevice"); + " not of type ns3::MockNetDevice"); return; } @@ -161,7 +161,7 @@ IslHelper::EnableAsciiInternal ( // // The MacRx trace source provides our "r" event. // - asciiTraceHelper.HookDefaultReceiveSinkWithoutContext (device, "MacRx", theStream); + asciiTraceHelper.HookDefaultReceiveSinkWithoutContext (device, "MacRx", theStream); // // The "+", '-', and 'd' events are driven by trace sources actually in the @@ -173,7 +173,7 @@ IslHelper::EnableAsciiInternal ( asciiTraceHelper.HookDefaultDequeueSinkWithoutContext > (queue, "Dequeue", theStream); // PhyRxDrop trace source for "d" event - asciiTraceHelper.HookDefaultDropSinkWithoutContext (device, "PhyRxDrop", theStream); + asciiTraceHelper.HookDefaultDropSinkWithoutContext (device, "PhyRxDrop", theStream); return; } @@ -194,23 +194,23 @@ IslHelper::EnableAsciiInternal ( uint32_t deviceid = nd->GetIfIndex (); std::ostringstream oss; - oss << "/NodeList/" << nd->GetNode ()->GetId () << "/DeviceList/" << deviceid << "/$ns3::IslNetDevice/MacRx"; + oss << "/NodeList/" << nd->GetNode ()->GetId () << "/DeviceList/" << deviceid << "/$ns3::MockNetDevice/MacRx"; Config::Connect (oss.str (), MakeBoundCallback (&AsciiTraceHelper::DefaultReceiveSinkWithContext, stream)); oss.str (""); - oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::IslNetDevice/TxQueue/Enqueue"; + oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::MockNetDevice/TxQueue/Enqueue"; Config::Connect (oss.str (), MakeBoundCallback (&AsciiTraceHelper::DefaultEnqueueSinkWithContext, stream)); oss.str (""); - oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::IslNetDevice/TxQueue/Dequeue"; + oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::MockNetDevice/TxQueue/Dequeue"; Config::Connect (oss.str (), MakeBoundCallback (&AsciiTraceHelper::DefaultDequeueSinkWithContext, stream)); oss.str (""); - oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::IslNetDevice/TxQueue/Drop"; + oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::MockNetDevice/TxQueue/Drop"; Config::Connect (oss.str (), MakeBoundCallback (&AsciiTraceHelper::DefaultDropSinkWithContext, stream)); oss.str (""); - oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::IslNetDevice/PhyRxDrop"; + oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::MockNetDevice/PhyRxDrop"; Config::Connect (oss.str (), MakeBoundCallback (&AsciiTraceHelper::DefaultDropSinkWithContext, stream)); } @@ -224,13 +224,13 @@ IslHelper::Install (NodeContainer c) NetDeviceContainer IslHelper::Install (std::vector > &nodes) { - Ptr channel = m_channelFactory.Create (); + Ptr channel = m_channelFactory.Create (); NetDeviceContainer container; for (Ptr node: nodes) { - Ptr dev = m_deviceFactory.Create (); + Ptr dev = m_deviceFactory.Create (); dev->SetAddress (Mac48Address::Allocate ()); node->AddDevice (dev); Ptr > queue = m_queueFactory.Create > (); diff --git a/model/isl-channel.cc b/model/mock-channel.cc similarity index 71% rename from model/isl-channel.cc rename to model/mock-channel.cc index 6708e0b..43d34e9 100644 --- a/model/isl-channel.cc +++ b/model/mock-channel.cc @@ -21,37 +21,37 @@ #include #include #include -#include "isl-channel.h" +#include "mock-channel.h" namespace ns3 { -NS_LOG_COMPONENT_DEFINE ("IslChannel"); +NS_LOG_COMPONENT_DEFINE ("MockChannel"); -NS_OBJECT_ENSURE_REGISTERED (IslChannel); +NS_OBJECT_ENSURE_REGISTERED (MockChannel); TypeId -IslChannel::GetTypeId (void) +MockChannel::GetTypeId (void) { - static TypeId tid = TypeId ("ns3::IslChannel") + static TypeId tid = TypeId ("ns3::MockChannel") .SetParent () .SetGroupName ("Leo") - .AddConstructor () + .AddConstructor () .AddAttribute ("PropagationDelay", "A propagation delay model for the channel.", PointerValue (), - MakePointerAccessor (&IslChannel::m_propagationDelay), + MakePointerAccessor (&MockChannel::m_propagationDelay), MakePointerChecker ()) .AddAttribute ("PropagationLoss", "A propagation loss model for the channel.", PointerValue (), - MakePointerAccessor (&IslChannel::m_propagationLoss), + MakePointerAccessor (&MockChannel::m_propagationLoss), MakePointerChecker ()) - .AddTraceSource ("TxRxIslChannel", + .AddTraceSource ("TxRxMockChannel", "Trace source indicating transmission of packet " - "from the IslChannel, used by the Animation " + "from the MockChannel, used by the Animation " "interface.", - MakeTraceSourceAccessor (&IslChannel::m_txrxIsl), - "ns3::IslChannel::TxRxAnimationCallback") + MakeTraceSourceAccessor (&MockChannel::m_txrxMock), + "ns3::MockChannel::TxRxAnimationCallback") ; return tid; } @@ -59,24 +59,24 @@ IslChannel::GetTypeId (void) // // By default, you get a channel that // has an "infitely" fast transmission speed and zero processing delay. -IslChannel::IslChannel() : Channel (), m_link (0) +MockChannel::MockChannel() : Channel (), m_link (0) { NS_LOG_FUNCTION_NOARGS (); } -IslChannel::~IslChannel() +MockChannel::~MockChannel() { } bool -IslChannel::Detach (uint32_t deviceId) +MockChannel::Detach (uint32_t deviceId) { NS_LOG_FUNCTION (this << deviceId); if (deviceId < m_link.size ()) { if (!m_link[deviceId]->IsLinkUp ()) { - NS_LOG_WARN ("IslChannel::Detach(): Device is already detached (" << deviceId << ")"); + NS_LOG_WARN ("MockChannel::Detach(): Device is already detached (" << deviceId << ")"); return false; } @@ -90,7 +90,7 @@ IslChannel::Detach (uint32_t deviceId) } int32_t -IslChannel::Attach (Ptr device) +MockChannel::Attach (Ptr device) { NS_LOG_FUNCTION (this << device); NS_ASSERT (device != 0); @@ -99,23 +99,23 @@ IslChannel::Attach (Ptr device) } std::size_t -IslChannel::GetNDevices (void) const +MockChannel::GetNDevices (void) const { NS_LOG_FUNCTION_NOARGS (); return m_link.size (); } Ptr -IslChannel::GetDevice (std::size_t i) const +MockChannel::GetDevice (std::size_t i) const { NS_LOG_FUNCTION_NOARGS (); return m_link[i]; } -bool IslChannel::Deliver ( +bool MockChannel::Deliver ( Ptr p, - Ptr src, - Ptr dst, + Ptr src, + Ptr dst, Time txTime) { Time delay = GetDelay (src, dst, txTime); @@ -125,13 +125,13 @@ bool IslChannel::Deliver ( { Simulator::ScheduleWithContext (dst->GetNode ()->GetId (), delay, - &IslNetDevice::Receive, + &MockNetDevice::Receive, dst, p->Copy (), src); // Call the tx anim callback on the net device - m_txrxIsl (p, src, dst, txTime, delay); + m_txrxMock (p, src, dst, txTime, delay); return true; } else @@ -143,7 +143,7 @@ bool IslChannel::Deliver ( } bool -IslChannel::TransmitStart ( +MockChannel::TransmitStart ( Ptr p, uint32_t srcId, Address destAddr, @@ -152,8 +152,8 @@ IslChannel::TransmitStart ( NS_LOG_FUNCTION (destAddr << this << p << srcId); NS_LOG_LOGIC ("UID is " << p->GetUid () << ")"); - Ptr src = m_link[srcId]; - Ptr dst = GetDevice (destAddr); + Ptr src = m_link[srcId]; + Ptr dst = GetDevice (destAddr); if (dst == nullptr) { @@ -171,7 +171,7 @@ IslChannel::TransmitStart ( } Time -IslChannel::GetDelay (Ptr src, Ptr dst, Time txTime) const +MockChannel::GetDelay (Ptr src, Ptr dst, Time txTime) const { NS_LOG_DEBUG ("Get delay from " << src << " to " << dst); @@ -184,10 +184,10 @@ IslChannel::GetDelay (Ptr src, Ptr dst, } // TODO optimize -Ptr -IslChannel::GetDevice (Address &addr) const +Ptr +MockChannel::GetDevice (Address &addr) const { - for (Ptr dev : m_link) + for (Ptr dev : m_link) { if (dev->GetAddress () == addr) { diff --git a/model/isl-channel.h b/model/mock-channel.h similarity index 83% rename from model/isl-channel.h rename to model/mock-channel.h index de0c8c8..81bc9de 100644 --- a/model/isl-channel.h +++ b/model/mock-channel.h @@ -30,11 +30,11 @@ #include "ns3/mobility-module.h" #include "ns3/propagation-delay-model.h" #include "ns3/propagation-loss-model.h" -#include "isl-net-device.h" +#include "mock-net-device.h" namespace ns3 { -class IslNetDevice; +class MockNetDevice; /** * \ingroup network @@ -47,20 +47,20 @@ class IslNetDevice; * A perfect channel with varariable delay (time-of-flight). * */ -class IslChannel : public Channel +class MockChannel : public Channel { public: static TypeId GetTypeId (void); - IslChannel (); - virtual ~IslChannel (); + MockChannel (); + virtual ~MockChannel (); /** * \brief Attach a device to the channel. * \param device Device to attach to the channel * \return Index of the device inside the devices list */ - int32_t Attach (Ptr device); + int32_t Attach (Ptr device); /** * \brief Detach a given netdevice from this channel @@ -77,18 +77,18 @@ protected: * \brief Get the delay associated with this channel * \returns Time delay */ - Time GetDelay (Ptr first, Ptr second, Time txTime) const; + Time GetDelay (Ptr first, Ptr second, Time txTime) const; private: - Ptr GetDevice (Address &addr) const; + Ptr GetDevice (Address &addr) const; TracedCallback, // Packet being transmitted Ptr, // Transmitting NetDevice Ptr, // Receiving NetDevice Time, // Amount of time to transmit the pkt Time // Last bit receive time (relative to now) - > m_txrxIsl; + > m_txrxMock; /** * \brief Propagation delay model to be used with this channel */ @@ -97,10 +97,10 @@ private: * \brief Propagation loss model to be used with this channel */ Ptr m_propagationLoss; - std::vector > m_link; + std::vector > m_link; - bool Deliver (Ptr p, Ptr src, Ptr dst, Time txTime); -}; // class IslChannel + bool Deliver (Ptr p, Ptr src, Ptr dst, Time txTime); +}; // class MockChannel } // namespace ns3 diff --git a/model/isl-net-device.cc b/model/mock-net-device.cc similarity index 78% rename from model/isl-net-device.cc rename to model/mock-net-device.cc index e8bf87d..0a7488f 100644 --- a/model/isl-net-device.cc +++ b/model/mock-net-device.cc @@ -27,46 +27,46 @@ #include "ns3/pointer.h" #include "ns3/net-device-queue-interface.h" #include "ns3/ppp-header.h" -#include "isl-channel.h" -#include "isl-net-device.h" +#include "mock-channel.h" +#include "mock-net-device.h" namespace ns3 { -NS_LOG_COMPONENT_DEFINE ("IslNetDevice"); +NS_LOG_COMPONENT_DEFINE ("MockNetDevice"); -NS_OBJECT_ENSURE_REGISTERED (IslNetDevice); +NS_OBJECT_ENSURE_REGISTERED (MockNetDevice); TypeId -IslNetDevice::GetTypeId (void) +MockNetDevice::GetTypeId (void) { - static TypeId tid = TypeId ("ns3::IslNetDevice") + static TypeId tid = TypeId ("ns3::MockNetDevice") .SetParent () .SetGroupName ("Leo") - .AddConstructor () + .AddConstructor () .AddAttribute ("Mtu", "The MAC-level Maximum Transmission Unit", UintegerValue (DEFAULT_MTU), - MakeUintegerAccessor (&IslNetDevice::SetMtu, - &IslNetDevice::GetMtu), + MakeUintegerAccessor (&MockNetDevice::SetMtu, + &MockNetDevice::GetMtu), MakeUintegerChecker ()) .AddAttribute ("Address", "The MAC address of this device.", Mac48AddressValue (Mac48Address ("ff:ff:ff:ff:ff:ff")), - MakeMac48AddressAccessor (&IslNetDevice::m_address), + MakeMac48AddressAccessor (&MockNetDevice::m_address), MakeMac48AddressChecker ()) .AddAttribute ("DataRate", "The default data rate for point to point links", DataRateValue (DataRate ("32768b/s")), - MakeDataRateAccessor (&IslNetDevice::m_bps), + MakeDataRateAccessor (&MockNetDevice::m_bps), MakeDataRateChecker ()) .AddAttribute ("ReceiveErrorModel", "The receiver error model used to simulate packet loss", PointerValue (), - MakePointerAccessor (&IslNetDevice::m_receiveErrorModel), + MakePointerAccessor (&MockNetDevice::m_receiveErrorModel), MakePointerChecker ()) .AddAttribute ("InterframeGap", "The time to wait between packet (frame) transmissions", TimeValue (Seconds (0.0)), - MakeTimeAccessor (&IslNetDevice::m_tInterframeGap), + MakeTimeAccessor (&MockNetDevice::m_tInterframeGap), MakeTimeChecker ()) // @@ -76,12 +76,12 @@ IslNetDevice::GetTypeId (void) .AddAttribute ("TxQueue", "A queue to use as the transmit queue in the device.", PointerValue (), - MakePointerAccessor (&IslNetDevice::m_queue), + MakePointerAccessor (&MockNetDevice::m_queue), MakePointerChecker > ()) .AddAttribute ("MobilityModel", "The mobility model of the device", PointerValue (), - MakePointerAccessor (&IslNetDevice::SetMobilityModel, - &IslNetDevice::GetMobilityModel), + MakePointerAccessor (&MockNetDevice::SetMobilityModel, + &MockNetDevice::GetMobilityModel), MakePointerChecker ()) // // Trace sources at the "top" of the net device, where packets transition @@ -90,33 +90,33 @@ IslNetDevice::GetTypeId (void) .AddTraceSource ("MacTx", "Trace source indicating a packet has arrived " "for transmission by this device", - MakeTraceSourceAccessor (&IslNetDevice::m_macTxTrace), + MakeTraceSourceAccessor (&MockNetDevice::m_macTxTrace), "ns3::Packet::TracedCallback") .AddTraceSource ("MacTxDrop", "Trace source indicating a packet has been dropped " "by the device before transmission", - MakeTraceSourceAccessor (&IslNetDevice::m_macTxDropTrace), + MakeTraceSourceAccessor (&MockNetDevice::m_macTxDropTrace), "ns3::Packet::TracedCallback") .AddTraceSource ("MacPromiscRx", "A packet has been received by this device, " "has been passed up from the physical layer " "and is being forwarded up the local protocol stack. " "This is a promiscuous trace,", - MakeTraceSourceAccessor (&IslNetDevice::m_macPromiscRxTrace), + MakeTraceSourceAccessor (&MockNetDevice::m_macPromiscRxTrace), "ns3::Packet::TracedCallback") .AddTraceSource ("MacRx", "A packet has been received by this device, " "has been passed up from the physical layer " "and is being forwarded up the local protocol stack. " "This is a non-promiscuous trace,", - MakeTraceSourceAccessor (&IslNetDevice::m_macRxTrace), + MakeTraceSourceAccessor (&MockNetDevice::m_macRxTrace), "ns3::Packet::TracedCallback") #if 0 // Not currently implemented for this device .AddTraceSource ("MacRxDrop", "Trace source indicating a packet was dropped " "before being forwarded up the stack", - MakeTraceSourceAccessor (&IslNetDevice::m_macRxDropTrace), + MakeTraceSourceAccessor (&MockNetDevice::m_macRxDropTrace), "ns3::Packet::TracedCallback") #endif // @@ -126,35 +126,35 @@ IslNetDevice::GetTypeId (void) .AddTraceSource ("PhyTxBegin", "Trace source indicating a packet has begun " "transmitting over the channel", - MakeTraceSourceAccessor (&IslNetDevice::m_phyTxBeginTrace), + MakeTraceSourceAccessor (&MockNetDevice::m_phyTxBeginTrace), "ns3::Packet::TracedCallback") .AddTraceSource ("PhyTxEnd", "Trace source indicating a packet has been " "completely transmitted over the channel", - MakeTraceSourceAccessor (&IslNetDevice::m_phyTxEndTrace), + MakeTraceSourceAccessor (&MockNetDevice::m_phyTxEndTrace), "ns3::Packet::TracedCallback") .AddTraceSource ("PhyTxDrop", "Trace source indicating a packet has been " "dropped by the device during transmission", - MakeTraceSourceAccessor (&IslNetDevice::m_phyTxDropTrace), + MakeTraceSourceAccessor (&MockNetDevice::m_phyTxDropTrace), "ns3::Packet::TracedCallback") #if 0 // Not currently implemented for this device .AddTraceSource ("PhyRxBegin", "Trace source indicating a packet has begun " "being received by the device", - MakeTraceSourceAccessor (&IslNetDevice::m_phyRxBeginTrace), + MakeTraceSourceAccessor (&MockNetDevice::m_phyRxBeginTrace), "ns3::Packet::TracedCallback") #endif .AddTraceSource ("PhyRxEnd", "Trace source indicating a packet has been " "completely received by the device", - MakeTraceSourceAccessor (&IslNetDevice::m_phyRxEndTrace), + MakeTraceSourceAccessor (&MockNetDevice::m_phyRxEndTrace), "ns3::Packet::TracedCallback") .AddTraceSource ("PhyRxDrop", "Trace source indicating a packet has been " "dropped by the device during reception", - MakeTraceSourceAccessor (&IslNetDevice::m_phyRxDropTrace), + MakeTraceSourceAccessor (&MockNetDevice::m_phyRxDropTrace), "ns3::Packet::TracedCallback") // @@ -165,18 +165,18 @@ IslNetDevice::GetTypeId (void) .AddTraceSource ("Sniffer", "Trace source simulating a non-promiscuous packet sniffer " "attached to the device", - MakeTraceSourceAccessor (&IslNetDevice::m_snifferTrace), + MakeTraceSourceAccessor (&MockNetDevice::m_snifferTrace), "ns3::Packet::TracedCallback") .AddTraceSource ("PromiscSniffer", "Trace source simulating a promiscuous packet sniffer " "attached to the device", - MakeTraceSourceAccessor (&IslNetDevice::m_promiscSnifferTrace), + MakeTraceSourceAccessor (&MockNetDevice::m_promiscSnifferTrace), "ns3::Packet::TracedCallback") ; return tid; } -IslNetDevice::IslNetDevice () +MockNetDevice::MockNetDevice () : m_txMachineState (READY), m_channel (0), @@ -186,13 +186,13 @@ IslNetDevice::IslNetDevice () NS_LOG_FUNCTION (this); } -IslNetDevice::~IslNetDevice () +MockNetDevice::~MockNetDevice () { NS_LOG_FUNCTION (this); } void -IslNetDevice::AddHeader (Ptr p, uint16_t protocolNumber) +MockNetDevice::AddHeader (Ptr p, uint16_t protocolNumber) { NS_LOG_FUNCTION (this << p << protocolNumber); PppHeader ppp; @@ -201,7 +201,7 @@ IslNetDevice::AddHeader (Ptr p, uint16_t protocolNumber) } bool -IslNetDevice::ProcessHeader (Ptr p, uint16_t& param) +MockNetDevice::ProcessHeader (Ptr p, uint16_t& param) { NS_LOG_FUNCTION (this << p << param); PppHeader ppp; @@ -211,7 +211,7 @@ IslNetDevice::ProcessHeader (Ptr p, uint16_t& param) } void -IslNetDevice::DoInitialize (void) +MockNetDevice::DoInitialize (void) { if (m_queueInterface) { @@ -228,7 +228,7 @@ IslNetDevice::DoInitialize (void) } void -IslNetDevice::NotifyNewAggregate (void) +MockNetDevice::NotifyNewAggregate (void) { NS_LOG_FUNCTION (this); if (m_queueInterface == 0) @@ -245,7 +245,7 @@ IslNetDevice::NotifyNewAggregate (void) } void -IslNetDevice::DoDispose () +MockNetDevice::DoDispose () { NS_LOG_FUNCTION (this); m_node = 0; @@ -258,21 +258,21 @@ IslNetDevice::DoDispose () } void -IslNetDevice::SetDataRate (DataRate bps) +MockNetDevice::SetDataRate (DataRate bps) { NS_LOG_FUNCTION (this); m_bps = bps; } void -IslNetDevice::SetInterframeGap (Time t) +MockNetDevice::SetInterframeGap (Time t) { NS_LOG_FUNCTION (this << t.GetSeconds ()); m_tInterframeGap = t; } bool -IslNetDevice::TransmitStart (Ptr p, const Address &dest) +MockNetDevice::TransmitStart (Ptr p, const Address &dest) { NS_LOG_FUNCTION (this << p); NS_LOG_LOGIC ("UID is " << p->GetUid () << ")"); @@ -291,7 +291,7 @@ IslNetDevice::TransmitStart (Ptr p, const Address &dest) Time txCompleteTime = txTime + m_tInterframeGap; NS_LOG_LOGIC ("Schedule TransmitCompleteEvent in " << txCompleteTime.GetSeconds () << "sec"); - Simulator::Schedule (txCompleteTime, &IslNetDevice::TransmitComplete, this, dest); + Simulator::Schedule (txCompleteTime, &MockNetDevice::TransmitComplete, this, dest); bool result = m_channel->TransmitStart (p, m_channelDevId, dest, txTime); if (result == false) @@ -302,7 +302,7 @@ IslNetDevice::TransmitStart (Ptr p, const Address &dest) } void -IslNetDevice::TransmitComplete (const Address &dest) +MockNetDevice::TransmitComplete (const Address &dest) { NS_LOG_FUNCTION (this); @@ -315,7 +315,7 @@ IslNetDevice::TransmitComplete (const Address &dest) NS_ASSERT_MSG (m_txMachineState == BUSY, "Must be BUSY if transmitting"); m_txMachineState = READY; - NS_ASSERT_MSG (m_currentPkt != 0, "IslNetDevice::TransmitComplete(): m_currentPkt zero"); + NS_ASSERT_MSG (m_currentPkt != 0, "MockNetDevice::TransmitComplete(): m_currentPkt zero"); m_phyTxEndTrace (m_currentPkt); m_currentPkt = 0; @@ -336,7 +336,7 @@ IslNetDevice::TransmitComplete (const Address &dest) } bool -IslNetDevice::Attach (Ptr ch) +MockNetDevice::Attach (Ptr ch) { NS_LOG_FUNCTION (this << &ch); @@ -354,21 +354,21 @@ IslNetDevice::Attach (Ptr ch) } void -IslNetDevice::SetQueue (Ptr > q) +MockNetDevice::SetQueue (Ptr > q) { NS_LOG_FUNCTION (this << q); m_queue = q; } void -IslNetDevice::SetReceiveErrorModel (Ptr em) +MockNetDevice::SetReceiveErrorModel (Ptr em) { NS_LOG_FUNCTION (this << em); m_receiveErrorModel = em; } void -IslNetDevice::Receive (Ptr packet, Ptr senderDevice) +MockNetDevice::Receive (Ptr packet, Ptr senderDevice) { NS_LOG_FUNCTION (this << packet); uint16_t protocol = 0; @@ -419,14 +419,14 @@ IslNetDevice::Receive (Ptr packet, Ptr senderDevice) } Ptr > -IslNetDevice::GetQueue (void) const +MockNetDevice::GetQueue (void) const { NS_LOG_FUNCTION (this); return m_queue; } void -IslNetDevice::NotifyLinkUp (void) +MockNetDevice::NotifyLinkUp (void) { NS_LOG_FUNCTION (this); m_linkUp = true; @@ -434,7 +434,7 @@ IslNetDevice::NotifyLinkUp (void) } void -IslNetDevice::NotifyLinkDown (void) +MockNetDevice::NotifyLinkDown (void) { NS_LOG_FUNCTION (this); m_linkUp = false; @@ -442,20 +442,20 @@ IslNetDevice::NotifyLinkDown (void) } void -IslNetDevice::SetIfIndex (const uint32_t index) +MockNetDevice::SetIfIndex (const uint32_t index) { NS_LOG_FUNCTION (this); m_ifIndex = index; } uint32_t -IslNetDevice::GetIfIndex (void) const +MockNetDevice::GetIfIndex (void) const { return m_ifIndex; } Ptr -IslNetDevice::GetChannel (void) const +MockNetDevice::GetChannel (void) const { return m_channel; } @@ -467,27 +467,27 @@ IslNetDevice::GetChannel (void) const // clients get and set the address, but simply ignore them. void -IslNetDevice::SetAddress (Address address) +MockNetDevice::SetAddress (Address address) { NS_LOG_FUNCTION (this << address); m_address = Mac48Address::ConvertFrom (address); } Address -IslNetDevice::GetAddress (void) const +MockNetDevice::GetAddress (void) const { return m_address; } bool -IslNetDevice::IsLinkUp (void) const +MockNetDevice::IsLinkUp (void) const { NS_LOG_FUNCTION (this); return m_linkUp; } void -IslNetDevice::AddLinkChangeCallback (Callback callback) +MockNetDevice::AddLinkChangeCallback (Callback callback) { NS_LOG_FUNCTION (this); m_linkChangeCallbacks.ConnectWithoutContext (callback); @@ -498,7 +498,7 @@ IslNetDevice::AddLinkChangeCallback (Callback callback) // all of the devices on the network. // bool -IslNetDevice::IsBroadcast (void) const +MockNetDevice::IsBroadcast (void) const { NS_LOG_FUNCTION (this); return true; @@ -510,49 +510,49 @@ IslNetDevice::IsBroadcast (void) const // broadcast address, so we make up something reasonable. // Address -IslNetDevice::GetBroadcast (void) const +MockNetDevice::GetBroadcast (void) const { NS_LOG_FUNCTION (this); return Mac48Address ("ff:ff:ff:ff:ff:ff"); } bool -IslNetDevice::IsMulticast (void) const +MockNetDevice::IsMulticast (void) const { NS_LOG_FUNCTION (this); return true; } Address -IslNetDevice::GetMulticast (Ipv4Address multicastGroup) const +MockNetDevice::GetMulticast (Ipv4Address multicastGroup) const { NS_LOG_FUNCTION (this); return Mac48Address ("01:00:5e:00:00:00"); } Address -IslNetDevice::GetMulticast (Ipv6Address addr) const +MockNetDevice::GetMulticast (Ipv6Address addr) const { NS_LOG_FUNCTION (this << addr); return Mac48Address ("33:33:00:00:00:00"); } bool -IslNetDevice::IsIsl (void) const +MockNetDevice::IsMock (void) const { NS_LOG_FUNCTION (this); return true; } bool -IslNetDevice::IsBridge (void) const +MockNetDevice::IsBridge (void) const { NS_LOG_FUNCTION (this); return false; } bool -IslNetDevice::Send ( +MockNetDevice::Send ( Ptr packet, const Address &dest, uint16_t protocolNumber) @@ -605,7 +605,7 @@ IslNetDevice::Send ( } bool -IslNetDevice::SendFrom (Ptr packet, +MockNetDevice::SendFrom (Ptr packet, const Address &source, const Address &dest, uint16_t protocolNumber) @@ -615,60 +615,60 @@ IslNetDevice::SendFrom (Ptr packet, } Ptr -IslNetDevice::GetNode (void) const +MockNetDevice::GetNode (void) const { return m_node; } void -IslNetDevice::SetNode (Ptr node) +MockNetDevice::SetNode (Ptr node) { NS_LOG_FUNCTION (this); m_node = node; } bool -IslNetDevice::NeedsArp (void) const +MockNetDevice::NeedsArp (void) const { NS_LOG_FUNCTION (this); return true; } void -IslNetDevice::SetReceiveCallback (NetDevice::ReceiveCallback cb) +MockNetDevice::SetReceiveCallback (NetDevice::ReceiveCallback cb) { m_rxCallback = cb; } void -IslNetDevice::SetPromiscReceiveCallback (NetDevice::PromiscReceiveCallback cb) +MockNetDevice::SetPromiscReceiveCallback (NetDevice::PromiscReceiveCallback cb) { m_promiscCallback = cb; } bool -IslNetDevice::SupportsSendFrom (void) const +MockNetDevice::SupportsSendFrom (void) const { NS_LOG_FUNCTION (this); return false; } void -IslNetDevice::DoMpiReceive (Ptr p, Ptr senderDevice) +MockNetDevice::DoMpiReceive (Ptr p, Ptr senderDevice) { NS_LOG_FUNCTION (this << p); Receive (p, senderDevice); } Address -IslNetDevice::GetRemote (Ptr senderDevice) const +MockNetDevice::GetRemote (Ptr senderDevice) const { NS_LOG_FUNCTION (this); return senderDevice->GetAddress (); } bool -IslNetDevice::SetMtu (uint16_t mtu) +MockNetDevice::SetMtu (uint16_t mtu) { NS_LOG_FUNCTION (this << mtu); m_mtu = mtu; @@ -676,14 +676,14 @@ IslNetDevice::SetMtu (uint16_t mtu) } uint16_t -IslNetDevice::GetMtu (void) const +MockNetDevice::GetMtu (void) const { NS_LOG_FUNCTION (this); return m_mtu; } uint16_t -IslNetDevice::PppToEther (uint16_t proto) +MockNetDevice::PppToEther (uint16_t proto) { NS_LOG_FUNCTION_NOARGS(); switch(proto) @@ -697,7 +697,7 @@ IslNetDevice::PppToEther (uint16_t proto) } uint16_t -IslNetDevice::EtherToPpp (uint16_t proto) +MockNetDevice::EtherToPpp (uint16_t proto) { NS_LOG_FUNCTION_NOARGS(); switch(proto) @@ -711,20 +711,20 @@ IslNetDevice::EtherToPpp (uint16_t proto) } Ptr -IslNetDevice::GetMobilityModel (void) const +MockNetDevice::GetMobilityModel (void) const { return m_mobilityModel; } void -IslNetDevice::SetMobilityModel (Ptr model) +MockNetDevice::SetMobilityModel (Ptr model) { NS_LOG_FUNCTION (this); m_mobilityModel = model; } bool -IslNetDevice::IsPointToPoint() const +MockNetDevice::IsPointToPoint() const { return true; } diff --git a/model/isl-net-device.h b/model/mock-net-device.h similarity index 90% rename from model/isl-net-device.h rename to model/mock-net-device.h index 01289f1..c6a070f 100644 --- a/model/isl-net-device.h +++ b/model/mock-net-device.h @@ -37,7 +37,7 @@ namespace ns3 { template class Queue; class NetDeviceQueueInterface; -class IslChannel; +class MockChannel; class ErrorModel; /** @@ -51,18 +51,18 @@ class ErrorModel; /** * \ingroup point-to-point - * \class IslNetDevice + * \class MockNetDevice * \brief A Device for a Point to Point Network Link. * - * This IslNetDevice class specializes the NetDevice abstract - * base class. Together with a IslChannel (and a peer - * IslNetDevice), the class models, with some level of + * This MockNetDevice class specializes the NetDevice abstract + * base class. Together with a MockChannel (and a peer + * MockNetDevice), the class models, with some level of * abstraction, a generic point-to-point or serial link. * Key parameters or objects that can be specified for this device * include a queue, data rate, and interframe transmission gap (the - * propagation delay is set in the IslChannel). + * propagation delay is set in the MockChannel). */ -class IslNetDevice : public NetDevice +class MockNetDevice : public NetDevice { public: /** @@ -73,20 +73,20 @@ public: static TypeId GetTypeId (void); /** - * Construct a IslNetDevice + * Construct a MockNetDevice * - * This is the constructor for the IslNetDevice. It takes as a + * This is the constructor for the MockNetDevice. It takes as a * parameter a pointer to the Node to which this device is connected, * as well as an optional DataRate object. */ - IslNetDevice (); + MockNetDevice (); /** - * Destroy a IslNetDevice + * Destroy a MockNetDevice * - * This is the destructor for the IslNetDevice. + * This is the destructor for the MockNetDevice. */ - virtual ~IslNetDevice (); + virtual ~MockNetDevice (); /** * Set the Data Rate used for transmission of packets. The data rate is @@ -111,12 +111,12 @@ public: * \param ch Ptr to the channel to which this object is being attached. * \return true if the operation was successful (always true actually) */ - bool Attach (Ptr ch); + bool Attach (Ptr ch); /** - * Attach a queue to the IslNetDevice. + * Attach a queue to the MockNetDevice. * - * The IslNetDevice "owns" a queue that implements a queueing + * The MockNetDevice "owns" a queue that implements a queueing * method such as DropTailQueue or RedQueue * * \param queue Ptr to the new queue. @@ -131,9 +131,9 @@ public: Ptr > GetQueue (void) const; /** - * Attach a receive ErrorModel to the IslNetDevice. + * Attach a receive ErrorModel to the MockNetDevice. * - * The IslNetDevice may optionally include an ErrorModel in + * The MockNetDevice may optionally include an ErrorModel in * the packet receive chain. * * \param em Ptr to the ErrorModel. @@ -141,16 +141,16 @@ public: void SetReceiveErrorModel (Ptr em); /** - * Receive a packet from a connected IslChannel. + * Receive a packet from a connected MockChannel. * - * The IslNetDevice receives packets from its connected channel + * The MockNetDevice receives packets from its connected channel * and forwards them up the protocol stack. This is the public method * used by the channel to indicate that the last bit of a packet has * arrived at the device. * * \param p Ptr to the received packet. */ - void Receive (Ptr p, Ptr senderDevice); + void Receive (Ptr p, Ptr senderDevice); // The remaining methods are documented in ns3::NetDevice* @@ -175,7 +175,7 @@ public: virtual bool IsMulticast (void) const; virtual Address GetMulticast (Ipv4Address multicastGroup) const; - virtual bool IsIsl (void) const; + virtual bool IsMock (void) const; virtual bool IsBridge (void) const; virtual bool IsPointToPoint() const; @@ -205,7 +205,7 @@ protected: * * \param p Packet received */ - void DoMpiReceive (Ptr p, Ptr sender); + void DoMpiReceive (Ptr p, Ptr sender); virtual void DoInitialize (void); virtual void NotifyNewAggregate (void); @@ -220,7 +220,7 @@ private: * \param o Other NetDevice * \return New instance of the NetDevice */ - IslNetDevice& operator = (const IslNetDevice &o); + MockNetDevice& operator = (const MockNetDevice &o); /** * \brief Copy constructor @@ -229,7 +229,7 @@ private: * \param o Other NetDevice */ - IslNetDevice (const IslNetDevice &o); + MockNetDevice (const MockNetDevice &o); /** * \brief Dispose of the object @@ -242,7 +242,7 @@ private: * \returns the address of the remote device connected to this device * through the point to point channel. */ - Address GetRemote (Ptr senderDevice) const; + Address GetRemote (Ptr senderDevice) const; /** * Adds the necessary headers and trailers to a packet of data in order to @@ -266,13 +266,13 @@ private: * Start Sending a Packet Down the Wire. * * The TransmitStart method is the method that is used internally in the - * IslNetDevice to begin the process of sending a packet out on + * MockNetDevice to begin the process of sending a packet out on * the channel. The corresponding method is called on the channel to let * it know that the physical device this class represents has virtually * started sending signals. An event is scheduled for the time at which * the bits have been completely transmitted. * - * \see IslChannel::TransmitStart () + * \see MockChannel::TransmitStart () * \see TransmitComplete() * \param p a reference to the packet to send * \returns true if success, false on failure @@ -320,14 +320,14 @@ private: Time m_tInterframeGap; /** - * The IslChannel to which this IslNetDevice has been + * The MockChannel to which this MockNetDevice has been * attached. */ - Ptr m_channel; + Ptr m_channel; /** - * The Queue which this IslNetDevice uses as a packet source. - * Management of this Queue has been delegated to the IslNetDevice + * The Queue which this MockNetDevice uses as a packet source. + * Management of this Queue has been delegated to the MockNetDevice * and it has the responsibility for deletion. * \see class DropTailQueue */ diff --git a/wscript b/wscript index 11f9c7e..236a7d7 100644 --- a/wscript +++ b/wscript @@ -10,8 +10,8 @@ def build(bld): module = bld.create_ns3_module('leo', ['core','internet', 'propagation', 'stats', 'traffic', 'flow-monitor', 'applications']) module.source = [ 'model/leo.cc', - 'model/isl-net-device.cc', - 'model/isl-channel.cc', + 'model/mock-net-device.cc', + 'model/mock-channel.cc', 'model/isl-propagation-loss-model.cc', 'model/leo-mobility-model.cc', 'helper/leo-helper.cc', @@ -27,8 +27,8 @@ def build(bld): headers.module = 'leo' headers.source = [ 'model/leo.h', - 'model/isl-net-device.h', - 'model/isl-channel.h', + 'model/mock-net-device.h', + 'model/mock-channel.h', 'model/isl-propagation-loss-model.h', 'model/leo-mobility-model.h', 'helper/leo-helper.h',