rename isl to mock

This commit is contained in:
Tim Schubert 2020-06-21 16:11:04 +02:00
parent 07cff2c920
commit d898890fa6
6 changed files with 179 additions and 179 deletions

View file

@ -30,8 +30,8 @@
#include "ns3/names.h" #include "ns3/names.h"
#include "ns3/trace-helper.h" #include "ns3/trace-helper.h"
#include "../model/isl-net-device.h" #include "../model/mock-net-device.h"
#include "../model/isl-channel.h" #include "../model/mock-channel.h"
#include "isl-helper.h" #include "isl-helper.h"
namespace ns3 { namespace ns3 {
@ -41,8 +41,8 @@ NS_LOG_COMPONENT_DEFINE ("IslHelper");
IslHelper::IslHelper () IslHelper::IslHelper ()
{ {
m_queueFactory.SetTypeId ("ns3::DropTailQueue<Packet>"); m_queueFactory.SetTypeId ("ns3::DropTailQueue<Packet>");
m_deviceFactory.SetTypeId ("ns3::IslNetDevice"); m_deviceFactory.SetTypeId ("ns3::MockNetDevice");
m_channelFactory.SetTypeId ("ns3::IslChannel"); m_channelFactory.SetTypeId ("ns3::MockChannel");
} }
void void
@ -79,12 +79,12 @@ IslHelper::EnablePcapInternal (std::string prefix, Ptr<NetDevice> nd, bool promi
// //
// All of the Pcap enable functions vector through here including the ones // 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 // 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<IslNetDevice> device = nd->GetObject<IslNetDevice> (); Ptr<MockNetDevice> device = nd->GetObject<MockNetDevice> ();
if (device == 0) 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; return;
} }
@ -102,7 +102,7 @@ IslHelper::EnablePcapInternal (std::string prefix, Ptr<NetDevice> nd, bool promi
Ptr<PcapFileWrapper> file = pcapHelper.CreateFile (filename, std::ios::out, Ptr<PcapFileWrapper> file = pcapHelper.CreateFile (filename, std::ios::out,
PcapHelper::DLT_PPP); PcapHelper::DLT_PPP);
pcapHelper.HookDefaultSink<IslNetDevice> (device, "PromiscSniffer", file); pcapHelper.HookDefaultSink<MockNetDevice> (device, "PromiscSniffer", file);
} }
void void
@ -115,13 +115,13 @@ IslHelper::EnableAsciiInternal (
// //
// All of the ascii enable functions vector through here including the ones // 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 // 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<IslNetDevice> device = nd->GetObject<IslNetDevice> (); Ptr<MockNetDevice> device = nd->GetObject<MockNetDevice> ();
if (device == 0) if (device == 0)
{ {
NS_LOG_INFO ("IslHelper::EnableAsciiInternal(): Device " << device << NS_LOG_INFO ("IslHelper::EnableAsciiInternal(): Device " << device <<
" not of type ns3::IslNetDevice"); " not of type ns3::MockNetDevice");
return; return;
} }
@ -161,7 +161,7 @@ IslHelper::EnableAsciiInternal (
// //
// The MacRx trace source provides our "r" event. // The MacRx trace source provides our "r" event.
// //
asciiTraceHelper.HookDefaultReceiveSinkWithoutContext<IslNetDevice> (device, "MacRx", theStream); asciiTraceHelper.HookDefaultReceiveSinkWithoutContext<MockNetDevice> (device, "MacRx", theStream);
// //
// The "+", '-', and 'd' events are driven by trace sources actually in the // The "+", '-', and 'd' events are driven by trace sources actually in the
@ -173,7 +173,7 @@ IslHelper::EnableAsciiInternal (
asciiTraceHelper.HookDefaultDequeueSinkWithoutContext<Queue<Packet> > (queue, "Dequeue", theStream); asciiTraceHelper.HookDefaultDequeueSinkWithoutContext<Queue<Packet> > (queue, "Dequeue", theStream);
// PhyRxDrop trace source for "d" event // PhyRxDrop trace source for "d" event
asciiTraceHelper.HookDefaultDropSinkWithoutContext<IslNetDevice> (device, "PhyRxDrop", theStream); asciiTraceHelper.HookDefaultDropSinkWithoutContext<MockNetDevice> (device, "PhyRxDrop", theStream);
return; return;
} }
@ -194,23 +194,23 @@ IslHelper::EnableAsciiInternal (
uint32_t deviceid = nd->GetIfIndex (); uint32_t deviceid = nd->GetIfIndex ();
std::ostringstream oss; 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)); Config::Connect (oss.str (), MakeBoundCallback (&AsciiTraceHelper::DefaultReceiveSinkWithContext, stream));
oss.str (""); 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)); Config::Connect (oss.str (), MakeBoundCallback (&AsciiTraceHelper::DefaultEnqueueSinkWithContext, stream));
oss.str (""); 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)); Config::Connect (oss.str (), MakeBoundCallback (&AsciiTraceHelper::DefaultDequeueSinkWithContext, stream));
oss.str (""); 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)); Config::Connect (oss.str (), MakeBoundCallback (&AsciiTraceHelper::DefaultDropSinkWithContext, stream));
oss.str (""); 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)); Config::Connect (oss.str (), MakeBoundCallback (&AsciiTraceHelper::DefaultDropSinkWithContext, stream));
} }
@ -224,13 +224,13 @@ IslHelper::Install (NodeContainer c)
NetDeviceContainer NetDeviceContainer
IslHelper::Install (std::vector<Ptr<Node> > &nodes) IslHelper::Install (std::vector<Ptr<Node> > &nodes)
{ {
Ptr<IslChannel> channel = m_channelFactory.Create<IslChannel> (); Ptr<MockChannel> channel = m_channelFactory.Create<MockChannel> ();
NetDeviceContainer container; NetDeviceContainer container;
for (Ptr<Node> node: nodes) for (Ptr<Node> node: nodes)
{ {
Ptr<IslNetDevice> dev = m_deviceFactory.Create<IslNetDevice> (); Ptr<MockNetDevice> dev = m_deviceFactory.Create<MockNetDevice> ();
dev->SetAddress (Mac48Address::Allocate ()); dev->SetAddress (Mac48Address::Allocate ());
node->AddDevice (dev); node->AddDevice (dev);
Ptr<Queue<Packet> > queue = m_queueFactory.Create<Queue<Packet> > (); Ptr<Queue<Packet> > queue = m_queueFactory.Create<Queue<Packet> > ();

View file

@ -21,37 +21,37 @@
#include <ns3/simulator.h> #include <ns3/simulator.h>
#include <ns3/log.h> #include <ns3/log.h>
#include <ns3/pointer.h> #include <ns3/pointer.h>
#include "isl-channel.h" #include "mock-channel.h"
namespace ns3 { namespace ns3 {
NS_LOG_COMPONENT_DEFINE ("IslChannel"); NS_LOG_COMPONENT_DEFINE ("MockChannel");
NS_OBJECT_ENSURE_REGISTERED (IslChannel); NS_OBJECT_ENSURE_REGISTERED (MockChannel);
TypeId TypeId
IslChannel::GetTypeId (void) MockChannel::GetTypeId (void)
{ {
static TypeId tid = TypeId ("ns3::IslChannel") static TypeId tid = TypeId ("ns3::MockChannel")
.SetParent<Channel> () .SetParent<Channel> ()
.SetGroupName ("Leo") .SetGroupName ("Leo")
.AddConstructor<IslChannel> () .AddConstructor<MockChannel> ()
.AddAttribute ("PropagationDelay", .AddAttribute ("PropagationDelay",
"A propagation delay model for the channel.", "A propagation delay model for the channel.",
PointerValue (), PointerValue (),
MakePointerAccessor (&IslChannel::m_propagationDelay), MakePointerAccessor (&MockChannel::m_propagationDelay),
MakePointerChecker<PropagationDelayModel> ()) MakePointerChecker<PropagationDelayModel> ())
.AddAttribute ("PropagationLoss", .AddAttribute ("PropagationLoss",
"A propagation loss model for the channel.", "A propagation loss model for the channel.",
PointerValue (), PointerValue (),
MakePointerAccessor (&IslChannel::m_propagationLoss), MakePointerAccessor (&MockChannel::m_propagationLoss),
MakePointerChecker<PropagationLossModel> ()) MakePointerChecker<PropagationLossModel> ())
.AddTraceSource ("TxRxIslChannel", .AddTraceSource ("TxRxMockChannel",
"Trace source indicating transmission of packet " "Trace source indicating transmission of packet "
"from the IslChannel, used by the Animation " "from the MockChannel, used by the Animation "
"interface.", "interface.",
MakeTraceSourceAccessor (&IslChannel::m_txrxIsl), MakeTraceSourceAccessor (&MockChannel::m_txrxMock),
"ns3::IslChannel::TxRxAnimationCallback") "ns3::MockChannel::TxRxAnimationCallback")
; ;
return tid; return tid;
} }
@ -59,24 +59,24 @@ IslChannel::GetTypeId (void)
// //
// By default, you get a channel that // By default, you get a channel that
// has an "infitely" fast transmission speed and zero processing delay. // 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 (); NS_LOG_FUNCTION_NOARGS ();
} }
IslChannel::~IslChannel() MockChannel::~MockChannel()
{ {
} }
bool bool
IslChannel::Detach (uint32_t deviceId) MockChannel::Detach (uint32_t deviceId)
{ {
NS_LOG_FUNCTION (this << deviceId); NS_LOG_FUNCTION (this << deviceId);
if (deviceId < m_link.size ()) if (deviceId < m_link.size ())
{ {
if (!m_link[deviceId]->IsLinkUp ()) 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; return false;
} }
@ -90,7 +90,7 @@ IslChannel::Detach (uint32_t deviceId)
} }
int32_t int32_t
IslChannel::Attach (Ptr<IslNetDevice> device) MockChannel::Attach (Ptr<MockNetDevice> device)
{ {
NS_LOG_FUNCTION (this << device); NS_LOG_FUNCTION (this << device);
NS_ASSERT (device != 0); NS_ASSERT (device != 0);
@ -99,23 +99,23 @@ IslChannel::Attach (Ptr<IslNetDevice> device)
} }
std::size_t std::size_t
IslChannel::GetNDevices (void) const MockChannel::GetNDevices (void) const
{ {
NS_LOG_FUNCTION_NOARGS (); NS_LOG_FUNCTION_NOARGS ();
return m_link.size (); return m_link.size ();
} }
Ptr<NetDevice> Ptr<NetDevice>
IslChannel::GetDevice (std::size_t i) const MockChannel::GetDevice (std::size_t i) const
{ {
NS_LOG_FUNCTION_NOARGS (); NS_LOG_FUNCTION_NOARGS ();
return m_link[i]; return m_link[i];
} }
bool IslChannel::Deliver ( bool MockChannel::Deliver (
Ptr<const Packet> p, Ptr<const Packet> p,
Ptr<IslNetDevice> src, Ptr<MockNetDevice> src,
Ptr<IslNetDevice> dst, Ptr<MockNetDevice> dst,
Time txTime) Time txTime)
{ {
Time delay = GetDelay (src, dst, txTime); Time delay = GetDelay (src, dst, txTime);
@ -125,13 +125,13 @@ bool IslChannel::Deliver (
{ {
Simulator::ScheduleWithContext (dst->GetNode ()->GetId (), Simulator::ScheduleWithContext (dst->GetNode ()->GetId (),
delay, delay,
&IslNetDevice::Receive, &MockNetDevice::Receive,
dst, dst,
p->Copy (), p->Copy (),
src); src);
// Call the tx anim callback on the net device // 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; return true;
} }
else else
@ -143,7 +143,7 @@ bool IslChannel::Deliver (
} }
bool bool
IslChannel::TransmitStart ( MockChannel::TransmitStart (
Ptr<const Packet> p, Ptr<const Packet> p,
uint32_t srcId, uint32_t srcId,
Address destAddr, Address destAddr,
@ -152,8 +152,8 @@ IslChannel::TransmitStart (
NS_LOG_FUNCTION (destAddr << this << p << srcId); NS_LOG_FUNCTION (destAddr << this << p << srcId);
NS_LOG_LOGIC ("UID is " << p->GetUid () << ")"); NS_LOG_LOGIC ("UID is " << p->GetUid () << ")");
Ptr<IslNetDevice> src = m_link[srcId]; Ptr<MockNetDevice> src = m_link[srcId];
Ptr<IslNetDevice> dst = GetDevice (destAddr); Ptr<MockNetDevice> dst = GetDevice (destAddr);
if (dst == nullptr) if (dst == nullptr)
{ {
@ -171,7 +171,7 @@ IslChannel::TransmitStart (
} }
Time Time
IslChannel::GetDelay (Ptr<const IslNetDevice> src, Ptr<const IslNetDevice> dst, Time txTime) const MockChannel::GetDelay (Ptr<const MockNetDevice> src, Ptr<const MockNetDevice> dst, Time txTime) const
{ {
NS_LOG_DEBUG ("Get delay from " << src << " to " << dst); NS_LOG_DEBUG ("Get delay from " << src << " to " << dst);
@ -184,10 +184,10 @@ IslChannel::GetDelay (Ptr<const IslNetDevice> src, Ptr<const IslNetDevice> dst,
} }
// TODO optimize // TODO optimize
Ptr<IslNetDevice> Ptr<MockNetDevice>
IslChannel::GetDevice (Address &addr) const MockChannel::GetDevice (Address &addr) const
{ {
for (Ptr<IslNetDevice> dev : m_link) for (Ptr<MockNetDevice> dev : m_link)
{ {
if (dev->GetAddress () == addr) if (dev->GetAddress () == addr)
{ {

View file

@ -30,11 +30,11 @@
#include "ns3/mobility-module.h" #include "ns3/mobility-module.h"
#include "ns3/propagation-delay-model.h" #include "ns3/propagation-delay-model.h"
#include "ns3/propagation-loss-model.h" #include "ns3/propagation-loss-model.h"
#include "isl-net-device.h" #include "mock-net-device.h"
namespace ns3 { namespace ns3 {
class IslNetDevice; class MockNetDevice;
/** /**
* \ingroup network * \ingroup network
@ -47,20 +47,20 @@ class IslNetDevice;
* A perfect channel with varariable delay (time-of-flight). * A perfect channel with varariable delay (time-of-flight).
* *
*/ */
class IslChannel : public Channel class MockChannel : public Channel
{ {
public: public:
static TypeId GetTypeId (void); static TypeId GetTypeId (void);
IslChannel (); MockChannel ();
virtual ~IslChannel (); virtual ~MockChannel ();
/** /**
* \brief Attach a device to the channel. * \brief Attach a device to the channel.
* \param device Device to attach to the channel * \param device Device to attach to the channel
* \return Index of the device inside the devices list * \return Index of the device inside the devices list
*/ */
int32_t Attach (Ptr<IslNetDevice> device); int32_t Attach (Ptr<MockNetDevice> device);
/** /**
* \brief Detach a given netdevice from this channel * \brief Detach a given netdevice from this channel
@ -77,18 +77,18 @@ protected:
* \brief Get the delay associated with this channel * \brief Get the delay associated with this channel
* \returns Time delay * \returns Time delay
*/ */
Time GetDelay (Ptr<const IslNetDevice> first, Ptr<const IslNetDevice> second, Time txTime) const; Time GetDelay (Ptr<const MockNetDevice> first, Ptr<const MockNetDevice> second, Time txTime) const;
private: private:
Ptr<IslNetDevice> GetDevice (Address &addr) const; Ptr<MockNetDevice> GetDevice (Address &addr) const;
TracedCallback<Ptr<const Packet>, // Packet being transmitted TracedCallback<Ptr<const Packet>, // Packet being transmitted
Ptr<NetDevice>, // Transmitting NetDevice Ptr<NetDevice>, // Transmitting NetDevice
Ptr<NetDevice>, // Receiving NetDevice Ptr<NetDevice>, // Receiving NetDevice
Time, // Amount of time to transmit the pkt Time, // Amount of time to transmit the pkt
Time // Last bit receive time (relative to now) Time // Last bit receive time (relative to now)
> m_txrxIsl; > m_txrxMock;
/** /**
* \brief Propagation delay model to be used with this channel * \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 * \brief Propagation loss model to be used with this channel
*/ */
Ptr<PropagationLossModel> m_propagationLoss; Ptr<PropagationLossModel> m_propagationLoss;
std::vector<Ptr<IslNetDevice> > m_link; std::vector<Ptr<MockNetDevice> > m_link;
bool Deliver (Ptr<const Packet> p, Ptr<IslNetDevice> src, Ptr<IslNetDevice> dst, Time txTime); bool Deliver (Ptr<const Packet> p, Ptr<MockNetDevice> src, Ptr<MockNetDevice> dst, Time txTime);
}; // class IslChannel }; // class MockChannel
} // namespace ns3 } // namespace ns3

View file

@ -27,46 +27,46 @@
#include "ns3/pointer.h" #include "ns3/pointer.h"
#include "ns3/net-device-queue-interface.h" #include "ns3/net-device-queue-interface.h"
#include "ns3/ppp-header.h" #include "ns3/ppp-header.h"
#include "isl-channel.h" #include "mock-channel.h"
#include "isl-net-device.h" #include "mock-net-device.h"
namespace ns3 { namespace ns3 {
NS_LOG_COMPONENT_DEFINE ("IslNetDevice"); NS_LOG_COMPONENT_DEFINE ("MockNetDevice");
NS_OBJECT_ENSURE_REGISTERED (IslNetDevice); NS_OBJECT_ENSURE_REGISTERED (MockNetDevice);
TypeId TypeId
IslNetDevice::GetTypeId (void) MockNetDevice::GetTypeId (void)
{ {
static TypeId tid = TypeId ("ns3::IslNetDevice") static TypeId tid = TypeId ("ns3::MockNetDevice")
.SetParent<NetDevice> () .SetParent<NetDevice> ()
.SetGroupName ("Leo") .SetGroupName ("Leo")
.AddConstructor<IslNetDevice> () .AddConstructor<MockNetDevice> ()
.AddAttribute ("Mtu", "The MAC-level Maximum Transmission Unit", .AddAttribute ("Mtu", "The MAC-level Maximum Transmission Unit",
UintegerValue (DEFAULT_MTU), UintegerValue (DEFAULT_MTU),
MakeUintegerAccessor (&IslNetDevice::SetMtu, MakeUintegerAccessor (&MockNetDevice::SetMtu,
&IslNetDevice::GetMtu), &MockNetDevice::GetMtu),
MakeUintegerChecker<uint16_t> ()) MakeUintegerChecker<uint16_t> ())
.AddAttribute ("Address", .AddAttribute ("Address",
"The MAC address of this device.", "The MAC address of this device.",
Mac48AddressValue (Mac48Address ("ff:ff:ff:ff:ff:ff")), Mac48AddressValue (Mac48Address ("ff:ff:ff:ff:ff:ff")),
MakeMac48AddressAccessor (&IslNetDevice::m_address), MakeMac48AddressAccessor (&MockNetDevice::m_address),
MakeMac48AddressChecker ()) MakeMac48AddressChecker ())
.AddAttribute ("DataRate", .AddAttribute ("DataRate",
"The default data rate for point to point links", "The default data rate for point to point links",
DataRateValue (DataRate ("32768b/s")), DataRateValue (DataRate ("32768b/s")),
MakeDataRateAccessor (&IslNetDevice::m_bps), MakeDataRateAccessor (&MockNetDevice::m_bps),
MakeDataRateChecker ()) MakeDataRateChecker ())
.AddAttribute ("ReceiveErrorModel", .AddAttribute ("ReceiveErrorModel",
"The receiver error model used to simulate packet loss", "The receiver error model used to simulate packet loss",
PointerValue (), PointerValue (),
MakePointerAccessor (&IslNetDevice::m_receiveErrorModel), MakePointerAccessor (&MockNetDevice::m_receiveErrorModel),
MakePointerChecker<ErrorModel> ()) MakePointerChecker<ErrorModel> ())
.AddAttribute ("InterframeGap", .AddAttribute ("InterframeGap",
"The time to wait between packet (frame) transmissions", "The time to wait between packet (frame) transmissions",
TimeValue (Seconds (0.0)), TimeValue (Seconds (0.0)),
MakeTimeAccessor (&IslNetDevice::m_tInterframeGap), MakeTimeAccessor (&MockNetDevice::m_tInterframeGap),
MakeTimeChecker ()) MakeTimeChecker ())
// //
@ -76,12 +76,12 @@ IslNetDevice::GetTypeId (void)
.AddAttribute ("TxQueue", .AddAttribute ("TxQueue",
"A queue to use as the transmit queue in the device.", "A queue to use as the transmit queue in the device.",
PointerValue (), PointerValue (),
MakePointerAccessor (&IslNetDevice::m_queue), MakePointerAccessor (&MockNetDevice::m_queue),
MakePointerChecker<Queue<Packet> > ()) MakePointerChecker<Queue<Packet> > ())
.AddAttribute ("MobilityModel", "The mobility model of the device", .AddAttribute ("MobilityModel", "The mobility model of the device",
PointerValue (), PointerValue (),
MakePointerAccessor (&IslNetDevice::SetMobilityModel, MakePointerAccessor (&MockNetDevice::SetMobilityModel,
&IslNetDevice::GetMobilityModel), &MockNetDevice::GetMobilityModel),
MakePointerChecker<MobilityModel> ()) MakePointerChecker<MobilityModel> ())
// //
// Trace sources at the "top" of the net device, where packets transition // Trace sources at the "top" of the net device, where packets transition
@ -90,33 +90,33 @@ IslNetDevice::GetTypeId (void)
.AddTraceSource ("MacTx", .AddTraceSource ("MacTx",
"Trace source indicating a packet has arrived " "Trace source indicating a packet has arrived "
"for transmission by this device", "for transmission by this device",
MakeTraceSourceAccessor (&IslNetDevice::m_macTxTrace), MakeTraceSourceAccessor (&MockNetDevice::m_macTxTrace),
"ns3::Packet::TracedCallback") "ns3::Packet::TracedCallback")
.AddTraceSource ("MacTxDrop", .AddTraceSource ("MacTxDrop",
"Trace source indicating a packet has been dropped " "Trace source indicating a packet has been dropped "
"by the device before transmission", "by the device before transmission",
MakeTraceSourceAccessor (&IslNetDevice::m_macTxDropTrace), MakeTraceSourceAccessor (&MockNetDevice::m_macTxDropTrace),
"ns3::Packet::TracedCallback") "ns3::Packet::TracedCallback")
.AddTraceSource ("MacPromiscRx", .AddTraceSource ("MacPromiscRx",
"A packet has been received by this device, " "A packet has been received by this device, "
"has been passed up from the physical layer " "has been passed up from the physical layer "
"and is being forwarded up the local protocol stack. " "and is being forwarded up the local protocol stack. "
"This is a promiscuous trace,", "This is a promiscuous trace,",
MakeTraceSourceAccessor (&IslNetDevice::m_macPromiscRxTrace), MakeTraceSourceAccessor (&MockNetDevice::m_macPromiscRxTrace),
"ns3::Packet::TracedCallback") "ns3::Packet::TracedCallback")
.AddTraceSource ("MacRx", .AddTraceSource ("MacRx",
"A packet has been received by this device, " "A packet has been received by this device, "
"has been passed up from the physical layer " "has been passed up from the physical layer "
"and is being forwarded up the local protocol stack. " "and is being forwarded up the local protocol stack. "
"This is a non-promiscuous trace,", "This is a non-promiscuous trace,",
MakeTraceSourceAccessor (&IslNetDevice::m_macRxTrace), MakeTraceSourceAccessor (&MockNetDevice::m_macRxTrace),
"ns3::Packet::TracedCallback") "ns3::Packet::TracedCallback")
#if 0 #if 0
// Not currently implemented for this device // Not currently implemented for this device
.AddTraceSource ("MacRxDrop", .AddTraceSource ("MacRxDrop",
"Trace source indicating a packet was dropped " "Trace source indicating a packet was dropped "
"before being forwarded up the stack", "before being forwarded up the stack",
MakeTraceSourceAccessor (&IslNetDevice::m_macRxDropTrace), MakeTraceSourceAccessor (&MockNetDevice::m_macRxDropTrace),
"ns3::Packet::TracedCallback") "ns3::Packet::TracedCallback")
#endif #endif
// //
@ -126,35 +126,35 @@ IslNetDevice::GetTypeId (void)
.AddTraceSource ("PhyTxBegin", .AddTraceSource ("PhyTxBegin",
"Trace source indicating a packet has begun " "Trace source indicating a packet has begun "
"transmitting over the channel", "transmitting over the channel",
MakeTraceSourceAccessor (&IslNetDevice::m_phyTxBeginTrace), MakeTraceSourceAccessor (&MockNetDevice::m_phyTxBeginTrace),
"ns3::Packet::TracedCallback") "ns3::Packet::TracedCallback")
.AddTraceSource ("PhyTxEnd", .AddTraceSource ("PhyTxEnd",
"Trace source indicating a packet has been " "Trace source indicating a packet has been "
"completely transmitted over the channel", "completely transmitted over the channel",
MakeTraceSourceAccessor (&IslNetDevice::m_phyTxEndTrace), MakeTraceSourceAccessor (&MockNetDevice::m_phyTxEndTrace),
"ns3::Packet::TracedCallback") "ns3::Packet::TracedCallback")
.AddTraceSource ("PhyTxDrop", .AddTraceSource ("PhyTxDrop",
"Trace source indicating a packet has been " "Trace source indicating a packet has been "
"dropped by the device during transmission", "dropped by the device during transmission",
MakeTraceSourceAccessor (&IslNetDevice::m_phyTxDropTrace), MakeTraceSourceAccessor (&MockNetDevice::m_phyTxDropTrace),
"ns3::Packet::TracedCallback") "ns3::Packet::TracedCallback")
#if 0 #if 0
// Not currently implemented for this device // Not currently implemented for this device
.AddTraceSource ("PhyRxBegin", .AddTraceSource ("PhyRxBegin",
"Trace source indicating a packet has begun " "Trace source indicating a packet has begun "
"being received by the device", "being received by the device",
MakeTraceSourceAccessor (&IslNetDevice::m_phyRxBeginTrace), MakeTraceSourceAccessor (&MockNetDevice::m_phyRxBeginTrace),
"ns3::Packet::TracedCallback") "ns3::Packet::TracedCallback")
#endif #endif
.AddTraceSource ("PhyRxEnd", .AddTraceSource ("PhyRxEnd",
"Trace source indicating a packet has been " "Trace source indicating a packet has been "
"completely received by the device", "completely received by the device",
MakeTraceSourceAccessor (&IslNetDevice::m_phyRxEndTrace), MakeTraceSourceAccessor (&MockNetDevice::m_phyRxEndTrace),
"ns3::Packet::TracedCallback") "ns3::Packet::TracedCallback")
.AddTraceSource ("PhyRxDrop", .AddTraceSource ("PhyRxDrop",
"Trace source indicating a packet has been " "Trace source indicating a packet has been "
"dropped by the device during reception", "dropped by the device during reception",
MakeTraceSourceAccessor (&IslNetDevice::m_phyRxDropTrace), MakeTraceSourceAccessor (&MockNetDevice::m_phyRxDropTrace),
"ns3::Packet::TracedCallback") "ns3::Packet::TracedCallback")
// //
@ -165,18 +165,18 @@ IslNetDevice::GetTypeId (void)
.AddTraceSource ("Sniffer", .AddTraceSource ("Sniffer",
"Trace source simulating a non-promiscuous packet sniffer " "Trace source simulating a non-promiscuous packet sniffer "
"attached to the device", "attached to the device",
MakeTraceSourceAccessor (&IslNetDevice::m_snifferTrace), MakeTraceSourceAccessor (&MockNetDevice::m_snifferTrace),
"ns3::Packet::TracedCallback") "ns3::Packet::TracedCallback")
.AddTraceSource ("PromiscSniffer", .AddTraceSource ("PromiscSniffer",
"Trace source simulating a promiscuous packet sniffer " "Trace source simulating a promiscuous packet sniffer "
"attached to the device", "attached to the device",
MakeTraceSourceAccessor (&IslNetDevice::m_promiscSnifferTrace), MakeTraceSourceAccessor (&MockNetDevice::m_promiscSnifferTrace),
"ns3::Packet::TracedCallback") "ns3::Packet::TracedCallback")
; ;
return tid; return tid;
} }
IslNetDevice::IslNetDevice () MockNetDevice::MockNetDevice ()
: :
m_txMachineState (READY), m_txMachineState (READY),
m_channel (0), m_channel (0),
@ -186,13 +186,13 @@ IslNetDevice::IslNetDevice ()
NS_LOG_FUNCTION (this); NS_LOG_FUNCTION (this);
} }
IslNetDevice::~IslNetDevice () MockNetDevice::~MockNetDevice ()
{ {
NS_LOG_FUNCTION (this); NS_LOG_FUNCTION (this);
} }
void void
IslNetDevice::AddHeader (Ptr<Packet> p, uint16_t protocolNumber) MockNetDevice::AddHeader (Ptr<Packet> p, uint16_t protocolNumber)
{ {
NS_LOG_FUNCTION (this << p << protocolNumber); NS_LOG_FUNCTION (this << p << protocolNumber);
PppHeader ppp; PppHeader ppp;
@ -201,7 +201,7 @@ IslNetDevice::AddHeader (Ptr<Packet> p, uint16_t protocolNumber)
} }
bool bool
IslNetDevice::ProcessHeader (Ptr<Packet> p, uint16_t& param) MockNetDevice::ProcessHeader (Ptr<Packet> p, uint16_t& param)
{ {
NS_LOG_FUNCTION (this << p << param); NS_LOG_FUNCTION (this << p << param);
PppHeader ppp; PppHeader ppp;
@ -211,7 +211,7 @@ IslNetDevice::ProcessHeader (Ptr<Packet> p, uint16_t& param)
} }
void void
IslNetDevice::DoInitialize (void) MockNetDevice::DoInitialize (void)
{ {
if (m_queueInterface) if (m_queueInterface)
{ {
@ -228,7 +228,7 @@ IslNetDevice::DoInitialize (void)
} }
void void
IslNetDevice::NotifyNewAggregate (void) MockNetDevice::NotifyNewAggregate (void)
{ {
NS_LOG_FUNCTION (this); NS_LOG_FUNCTION (this);
if (m_queueInterface == 0) if (m_queueInterface == 0)
@ -245,7 +245,7 @@ IslNetDevice::NotifyNewAggregate (void)
} }
void void
IslNetDevice::DoDispose () MockNetDevice::DoDispose ()
{ {
NS_LOG_FUNCTION (this); NS_LOG_FUNCTION (this);
m_node = 0; m_node = 0;
@ -258,21 +258,21 @@ IslNetDevice::DoDispose ()
} }
void void
IslNetDevice::SetDataRate (DataRate bps) MockNetDevice::SetDataRate (DataRate bps)
{ {
NS_LOG_FUNCTION (this); NS_LOG_FUNCTION (this);
m_bps = bps; m_bps = bps;
} }
void void
IslNetDevice::SetInterframeGap (Time t) MockNetDevice::SetInterframeGap (Time t)
{ {
NS_LOG_FUNCTION (this << t.GetSeconds ()); NS_LOG_FUNCTION (this << t.GetSeconds ());
m_tInterframeGap = t; m_tInterframeGap = t;
} }
bool bool
IslNetDevice::TransmitStart (Ptr<Packet> p, const Address &dest) MockNetDevice::TransmitStart (Ptr<Packet> p, const Address &dest)
{ {
NS_LOG_FUNCTION (this << p); NS_LOG_FUNCTION (this << p);
NS_LOG_LOGIC ("UID is " << p->GetUid () << ")"); NS_LOG_LOGIC ("UID is " << p->GetUid () << ")");
@ -291,7 +291,7 @@ IslNetDevice::TransmitStart (Ptr<Packet> p, const Address &dest)
Time txCompleteTime = txTime + m_tInterframeGap; Time txCompleteTime = txTime + m_tInterframeGap;
NS_LOG_LOGIC ("Schedule TransmitCompleteEvent in " << txCompleteTime.GetSeconds () << "sec"); 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); bool result = m_channel->TransmitStart (p, m_channelDevId, dest, txTime);
if (result == false) if (result == false)
@ -302,7 +302,7 @@ IslNetDevice::TransmitStart (Ptr<Packet> p, const Address &dest)
} }
void void
IslNetDevice::TransmitComplete (const Address &dest) MockNetDevice::TransmitComplete (const Address &dest)
{ {
NS_LOG_FUNCTION (this); NS_LOG_FUNCTION (this);
@ -315,7 +315,7 @@ IslNetDevice::TransmitComplete (const Address &dest)
NS_ASSERT_MSG (m_txMachineState == BUSY, "Must be BUSY if transmitting"); NS_ASSERT_MSG (m_txMachineState == BUSY, "Must be BUSY if transmitting");
m_txMachineState = READY; 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_phyTxEndTrace (m_currentPkt);
m_currentPkt = 0; m_currentPkt = 0;
@ -336,7 +336,7 @@ IslNetDevice::TransmitComplete (const Address &dest)
} }
bool bool
IslNetDevice::Attach (Ptr<IslChannel> ch) MockNetDevice::Attach (Ptr<MockChannel> ch)
{ {
NS_LOG_FUNCTION (this << &ch); NS_LOG_FUNCTION (this << &ch);
@ -354,21 +354,21 @@ IslNetDevice::Attach (Ptr<IslChannel> ch)
} }
void void
IslNetDevice::SetQueue (Ptr<Queue<Packet> > q) MockNetDevice::SetQueue (Ptr<Queue<Packet> > q)
{ {
NS_LOG_FUNCTION (this << q); NS_LOG_FUNCTION (this << q);
m_queue = q; m_queue = q;
} }
void void
IslNetDevice::SetReceiveErrorModel (Ptr<ErrorModel> em) MockNetDevice::SetReceiveErrorModel (Ptr<ErrorModel> em)
{ {
NS_LOG_FUNCTION (this << em); NS_LOG_FUNCTION (this << em);
m_receiveErrorModel = em; m_receiveErrorModel = em;
} }
void void
IslNetDevice::Receive (Ptr<Packet> packet, Ptr<IslNetDevice> senderDevice) MockNetDevice::Receive (Ptr<Packet> packet, Ptr<MockNetDevice> senderDevice)
{ {
NS_LOG_FUNCTION (this << packet); NS_LOG_FUNCTION (this << packet);
uint16_t protocol = 0; uint16_t protocol = 0;
@ -419,14 +419,14 @@ IslNetDevice::Receive (Ptr<Packet> packet, Ptr<IslNetDevice> senderDevice)
} }
Ptr<Queue<Packet> > Ptr<Queue<Packet> >
IslNetDevice::GetQueue (void) const MockNetDevice::GetQueue (void) const
{ {
NS_LOG_FUNCTION (this); NS_LOG_FUNCTION (this);
return m_queue; return m_queue;
} }
void void
IslNetDevice::NotifyLinkUp (void) MockNetDevice::NotifyLinkUp (void)
{ {
NS_LOG_FUNCTION (this); NS_LOG_FUNCTION (this);
m_linkUp = true; m_linkUp = true;
@ -434,7 +434,7 @@ IslNetDevice::NotifyLinkUp (void)
} }
void void
IslNetDevice::NotifyLinkDown (void) MockNetDevice::NotifyLinkDown (void)
{ {
NS_LOG_FUNCTION (this); NS_LOG_FUNCTION (this);
m_linkUp = false; m_linkUp = false;
@ -442,20 +442,20 @@ IslNetDevice::NotifyLinkDown (void)
} }
void void
IslNetDevice::SetIfIndex (const uint32_t index) MockNetDevice::SetIfIndex (const uint32_t index)
{ {
NS_LOG_FUNCTION (this); NS_LOG_FUNCTION (this);
m_ifIndex = index; m_ifIndex = index;
} }
uint32_t uint32_t
IslNetDevice::GetIfIndex (void) const MockNetDevice::GetIfIndex (void) const
{ {
return m_ifIndex; return m_ifIndex;
} }
Ptr<Channel> Ptr<Channel>
IslNetDevice::GetChannel (void) const MockNetDevice::GetChannel (void) const
{ {
return m_channel; return m_channel;
} }
@ -467,27 +467,27 @@ IslNetDevice::GetChannel (void) const
// clients get and set the address, but simply ignore them. // clients get and set the address, but simply ignore them.
void void
IslNetDevice::SetAddress (Address address) MockNetDevice::SetAddress (Address address)
{ {
NS_LOG_FUNCTION (this << address); NS_LOG_FUNCTION (this << address);
m_address = Mac48Address::ConvertFrom (address); m_address = Mac48Address::ConvertFrom (address);
} }
Address Address
IslNetDevice::GetAddress (void) const MockNetDevice::GetAddress (void) const
{ {
return m_address; return m_address;
} }
bool bool
IslNetDevice::IsLinkUp (void) const MockNetDevice::IsLinkUp (void) const
{ {
NS_LOG_FUNCTION (this); NS_LOG_FUNCTION (this);
return m_linkUp; return m_linkUp;
} }
void void
IslNetDevice::AddLinkChangeCallback (Callback<void> callback) MockNetDevice::AddLinkChangeCallback (Callback<void> callback)
{ {
NS_LOG_FUNCTION (this); NS_LOG_FUNCTION (this);
m_linkChangeCallbacks.ConnectWithoutContext (callback); m_linkChangeCallbacks.ConnectWithoutContext (callback);
@ -498,7 +498,7 @@ IslNetDevice::AddLinkChangeCallback (Callback<void> callback)
// all of the devices on the network. // all of the devices on the network.
// //
bool bool
IslNetDevice::IsBroadcast (void) const MockNetDevice::IsBroadcast (void) const
{ {
NS_LOG_FUNCTION (this); NS_LOG_FUNCTION (this);
return true; return true;
@ -510,49 +510,49 @@ IslNetDevice::IsBroadcast (void) const
// broadcast address, so we make up something reasonable. // broadcast address, so we make up something reasonable.
// //
Address Address
IslNetDevice::GetBroadcast (void) const MockNetDevice::GetBroadcast (void) const
{ {
NS_LOG_FUNCTION (this); NS_LOG_FUNCTION (this);
return Mac48Address ("ff:ff:ff:ff:ff:ff"); return Mac48Address ("ff:ff:ff:ff:ff:ff");
} }
bool bool
IslNetDevice::IsMulticast (void) const MockNetDevice::IsMulticast (void) const
{ {
NS_LOG_FUNCTION (this); NS_LOG_FUNCTION (this);
return true; return true;
} }
Address Address
IslNetDevice::GetMulticast (Ipv4Address multicastGroup) const MockNetDevice::GetMulticast (Ipv4Address multicastGroup) const
{ {
NS_LOG_FUNCTION (this); NS_LOG_FUNCTION (this);
return Mac48Address ("01:00:5e:00:00:00"); return Mac48Address ("01:00:5e:00:00:00");
} }
Address Address
IslNetDevice::GetMulticast (Ipv6Address addr) const MockNetDevice::GetMulticast (Ipv6Address addr) const
{ {
NS_LOG_FUNCTION (this << addr); NS_LOG_FUNCTION (this << addr);
return Mac48Address ("33:33:00:00:00:00"); return Mac48Address ("33:33:00:00:00:00");
} }
bool bool
IslNetDevice::IsIsl (void) const MockNetDevice::IsMock (void) const
{ {
NS_LOG_FUNCTION (this); NS_LOG_FUNCTION (this);
return true; return true;
} }
bool bool
IslNetDevice::IsBridge (void) const MockNetDevice::IsBridge (void) const
{ {
NS_LOG_FUNCTION (this); NS_LOG_FUNCTION (this);
return false; return false;
} }
bool bool
IslNetDevice::Send ( MockNetDevice::Send (
Ptr<Packet> packet, Ptr<Packet> packet,
const Address &dest, const Address &dest,
uint16_t protocolNumber) uint16_t protocolNumber)
@ -605,7 +605,7 @@ IslNetDevice::Send (
} }
bool bool
IslNetDevice::SendFrom (Ptr<Packet> packet, MockNetDevice::SendFrom (Ptr<Packet> packet,
const Address &source, const Address &source,
const Address &dest, const Address &dest,
uint16_t protocolNumber) uint16_t protocolNumber)
@ -615,60 +615,60 @@ IslNetDevice::SendFrom (Ptr<Packet> packet,
} }
Ptr<Node> Ptr<Node>
IslNetDevice::GetNode (void) const MockNetDevice::GetNode (void) const
{ {
return m_node; return m_node;
} }
void void
IslNetDevice::SetNode (Ptr<Node> node) MockNetDevice::SetNode (Ptr<Node> node)
{ {
NS_LOG_FUNCTION (this); NS_LOG_FUNCTION (this);
m_node = node; m_node = node;
} }
bool bool
IslNetDevice::NeedsArp (void) const MockNetDevice::NeedsArp (void) const
{ {
NS_LOG_FUNCTION (this); NS_LOG_FUNCTION (this);
return true; return true;
} }
void void
IslNetDevice::SetReceiveCallback (NetDevice::ReceiveCallback cb) MockNetDevice::SetReceiveCallback (NetDevice::ReceiveCallback cb)
{ {
m_rxCallback = cb; m_rxCallback = cb;
} }
void void
IslNetDevice::SetPromiscReceiveCallback (NetDevice::PromiscReceiveCallback cb) MockNetDevice::SetPromiscReceiveCallback (NetDevice::PromiscReceiveCallback cb)
{ {
m_promiscCallback = cb; m_promiscCallback = cb;
} }
bool bool
IslNetDevice::SupportsSendFrom (void) const MockNetDevice::SupportsSendFrom (void) const
{ {
NS_LOG_FUNCTION (this); NS_LOG_FUNCTION (this);
return false; return false;
} }
void void
IslNetDevice::DoMpiReceive (Ptr<Packet> p, Ptr<IslNetDevice> senderDevice) MockNetDevice::DoMpiReceive (Ptr<Packet> p, Ptr<MockNetDevice> senderDevice)
{ {
NS_LOG_FUNCTION (this << p); NS_LOG_FUNCTION (this << p);
Receive (p, senderDevice); Receive (p, senderDevice);
} }
Address Address
IslNetDevice::GetRemote (Ptr<IslNetDevice> senderDevice) const MockNetDevice::GetRemote (Ptr<MockNetDevice> senderDevice) const
{ {
NS_LOG_FUNCTION (this); NS_LOG_FUNCTION (this);
return senderDevice->GetAddress (); return senderDevice->GetAddress ();
} }
bool bool
IslNetDevice::SetMtu (uint16_t mtu) MockNetDevice::SetMtu (uint16_t mtu)
{ {
NS_LOG_FUNCTION (this << mtu); NS_LOG_FUNCTION (this << mtu);
m_mtu = mtu; m_mtu = mtu;
@ -676,14 +676,14 @@ IslNetDevice::SetMtu (uint16_t mtu)
} }
uint16_t uint16_t
IslNetDevice::GetMtu (void) const MockNetDevice::GetMtu (void) const
{ {
NS_LOG_FUNCTION (this); NS_LOG_FUNCTION (this);
return m_mtu; return m_mtu;
} }
uint16_t uint16_t
IslNetDevice::PppToEther (uint16_t proto) MockNetDevice::PppToEther (uint16_t proto)
{ {
NS_LOG_FUNCTION_NOARGS(); NS_LOG_FUNCTION_NOARGS();
switch(proto) switch(proto)
@ -697,7 +697,7 @@ IslNetDevice::PppToEther (uint16_t proto)
} }
uint16_t uint16_t
IslNetDevice::EtherToPpp (uint16_t proto) MockNetDevice::EtherToPpp (uint16_t proto)
{ {
NS_LOG_FUNCTION_NOARGS(); NS_LOG_FUNCTION_NOARGS();
switch(proto) switch(proto)
@ -711,20 +711,20 @@ IslNetDevice::EtherToPpp (uint16_t proto)
} }
Ptr<MobilityModel> Ptr<MobilityModel>
IslNetDevice::GetMobilityModel (void) const MockNetDevice::GetMobilityModel (void) const
{ {
return m_mobilityModel; return m_mobilityModel;
} }
void void
IslNetDevice::SetMobilityModel (Ptr<MobilityModel> model) MockNetDevice::SetMobilityModel (Ptr<MobilityModel> model)
{ {
NS_LOG_FUNCTION (this); NS_LOG_FUNCTION (this);
m_mobilityModel = model; m_mobilityModel = model;
} }
bool bool
IslNetDevice::IsPointToPoint() const MockNetDevice::IsPointToPoint() const
{ {
return true; return true;
} }

View file

@ -37,7 +37,7 @@ namespace ns3 {
template <typename Item> class Queue; template <typename Item> class Queue;
class NetDeviceQueueInterface; class NetDeviceQueueInterface;
class IslChannel; class MockChannel;
class ErrorModel; class ErrorModel;
/** /**
@ -51,18 +51,18 @@ class ErrorModel;
/** /**
* \ingroup point-to-point * \ingroup point-to-point
* \class IslNetDevice * \class MockNetDevice
* \brief A Device for a Point to Point Network Link. * \brief A Device for a Point to Point Network Link.
* *
* This IslNetDevice class specializes the NetDevice abstract * This MockNetDevice class specializes the NetDevice abstract
* base class. Together with a IslChannel (and a peer * base class. Together with a MockChannel (and a peer
* IslNetDevice), the class models, with some level of * MockNetDevice), the class models, with some level of
* abstraction, a generic point-to-point or serial link. * abstraction, a generic point-to-point or serial link.
* Key parameters or objects that can be specified for this device * Key parameters or objects that can be specified for this device
* include a queue, data rate, and interframe transmission gap (the * 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: public:
/** /**
@ -73,20 +73,20 @@ public:
static TypeId GetTypeId (void); 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, * parameter a pointer to the Node to which this device is connected,
* as well as an optional DataRate object. * 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 * 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. * \param ch Ptr to the channel to which this object is being attached.
* \return true if the operation was successful (always true actually) * \return true if the operation was successful (always true actually)
*/ */
bool Attach (Ptr<IslChannel> ch); bool Attach (Ptr<MockChannel> 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 * method such as DropTailQueue or RedQueue
* *
* \param queue Ptr to the new queue. * \param queue Ptr to the new queue.
@ -131,9 +131,9 @@ public:
Ptr<Queue<Packet> > GetQueue (void) const; Ptr<Queue<Packet> > 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. * the packet receive chain.
* *
* \param em Ptr to the ErrorModel. * \param em Ptr to the ErrorModel.
@ -141,16 +141,16 @@ public:
void SetReceiveErrorModel (Ptr<ErrorModel> em); void SetReceiveErrorModel (Ptr<ErrorModel> 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 * 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 * used by the channel to indicate that the last bit of a packet has
* arrived at the device. * arrived at the device.
* *
* \param p Ptr to the received packet. * \param p Ptr to the received packet.
*/ */
void Receive (Ptr<Packet> p, Ptr<IslNetDevice> senderDevice); void Receive (Ptr<Packet> p, Ptr<MockNetDevice> senderDevice);
// The remaining methods are documented in ns3::NetDevice* // The remaining methods are documented in ns3::NetDevice*
@ -175,7 +175,7 @@ public:
virtual bool IsMulticast (void) const; virtual bool IsMulticast (void) const;
virtual Address GetMulticast (Ipv4Address multicastGroup) const; virtual Address GetMulticast (Ipv4Address multicastGroup) const;
virtual bool IsIsl (void) const; virtual bool IsMock (void) const;
virtual bool IsBridge (void) const; virtual bool IsBridge (void) const;
virtual bool IsPointToPoint() const; virtual bool IsPointToPoint() const;
@ -205,7 +205,7 @@ protected:
* *
* \param p Packet received * \param p Packet received
*/ */
void DoMpiReceive (Ptr<Packet> p, Ptr<IslNetDevice> sender); void DoMpiReceive (Ptr<Packet> p, Ptr<MockNetDevice> sender);
virtual void DoInitialize (void); virtual void DoInitialize (void);
virtual void NotifyNewAggregate (void); virtual void NotifyNewAggregate (void);
@ -220,7 +220,7 @@ private:
* \param o Other NetDevice * \param o Other NetDevice
* \return New instance of the NetDevice * \return New instance of the NetDevice
*/ */
IslNetDevice& operator = (const IslNetDevice &o); MockNetDevice& operator = (const MockNetDevice &o);
/** /**
* \brief Copy constructor * \brief Copy constructor
@ -229,7 +229,7 @@ private:
* \param o Other NetDevice * \param o Other NetDevice
*/ */
IslNetDevice (const IslNetDevice &o); MockNetDevice (const MockNetDevice &o);
/** /**
* \brief Dispose of the object * \brief Dispose of the object
@ -242,7 +242,7 @@ private:
* \returns the address of the remote device connected to this device * \returns the address of the remote device connected to this device
* through the point to point channel. * through the point to point channel.
*/ */
Address GetRemote (Ptr<IslNetDevice> senderDevice) const; Address GetRemote (Ptr<MockNetDevice> senderDevice) const;
/** /**
* Adds the necessary headers and trailers to a packet of data in order to * 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. * Start Sending a Packet Down the Wire.
* *
* The TransmitStart method is the method that is used internally in the * 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 * the channel. The corresponding method is called on the channel to let
* it know that the physical device this class represents has virtually * it know that the physical device this class represents has virtually
* started sending signals. An event is scheduled for the time at which * started sending signals. An event is scheduled for the time at which
* the bits have been completely transmitted. * the bits have been completely transmitted.
* *
* \see IslChannel::TransmitStart () * \see MockChannel::TransmitStart ()
* \see TransmitComplete() * \see TransmitComplete()
* \param p a reference to the packet to send * \param p a reference to the packet to send
* \returns true if success, false on failure * \returns true if success, false on failure
@ -320,14 +320,14 @@ private:
Time m_tInterframeGap; Time m_tInterframeGap;
/** /**
* The IslChannel to which this IslNetDevice has been * The MockChannel to which this MockNetDevice has been
* attached. * attached.
*/ */
Ptr<IslChannel> m_channel; Ptr<MockChannel> m_channel;
/** /**
* The Queue which this IslNetDevice uses as a packet source. * The Queue which this MockNetDevice uses as a packet source.
* Management of this Queue has been delegated to the IslNetDevice * Management of this Queue has been delegated to the MockNetDevice
* and it has the responsibility for deletion. * and it has the responsibility for deletion.
* \see class DropTailQueue * \see class DropTailQueue
*/ */

View file

@ -10,8 +10,8 @@ def build(bld):
module = bld.create_ns3_module('leo', ['core','internet', 'propagation', 'stats', 'traffic', 'flow-monitor', 'applications']) module = bld.create_ns3_module('leo', ['core','internet', 'propagation', 'stats', 'traffic', 'flow-monitor', 'applications'])
module.source = [ module.source = [
'model/leo.cc', 'model/leo.cc',
'model/isl-net-device.cc', 'model/mock-net-device.cc',
'model/isl-channel.cc', 'model/mock-channel.cc',
'model/isl-propagation-loss-model.cc', 'model/isl-propagation-loss-model.cc',
'model/leo-mobility-model.cc', 'model/leo-mobility-model.cc',
'helper/leo-helper.cc', 'helper/leo-helper.cc',
@ -27,8 +27,8 @@ def build(bld):
headers.module = 'leo' headers.module = 'leo'
headers.source = [ headers.source = [
'model/leo.h', 'model/leo.h',
'model/isl-net-device.h', 'model/mock-net-device.h',
'model/isl-channel.h', 'model/mock-channel.h',
'model/isl-propagation-loss-model.h', 'model/isl-propagation-loss-model.h',
'model/leo-mobility-model.h', 'model/leo-mobility-model.h',
'helper/leo-helper.h', 'helper/leo-helper.h',