Rename classes from Serial to PointToPoint
This commit is contained in:
@@ -204,9 +204,9 @@ int main (int argc, char *argv[])
|
||||
DebugComponentEnable("Queue");
|
||||
DebugComponentEnable("DropTailQueue");
|
||||
DebugComponentEnable("Channel");
|
||||
DebugComponentEnable("SerialChannel");
|
||||
DebugComponentEnable("SerialNetDevice");
|
||||
DebugComponentEnable("SerialPhy");
|
||||
DebugComponentEnable("PointToPointChannel");
|
||||
DebugComponentEnable("PointToPointNetDevice");
|
||||
DebugComponentEnable("PointToPointPhy");
|
||||
#endif
|
||||
|
||||
ObjectContainer container;
|
||||
@@ -226,20 +226,20 @@ int main (int argc, char *argv[])
|
||||
Node* n2 = Node::Create();
|
||||
Node* n3 = Node::Create();
|
||||
|
||||
SerialChannel* ch1;
|
||||
ch1 = SerialTopology::AddSerialLink (
|
||||
PointToPointChannel* ch1;
|
||||
ch1 = PointToPointTopology::AddPointToPointLink (
|
||||
n0, Ipv4Address("10.1.1.1"),
|
||||
n2, Ipv4Address("10.1.1.2"),
|
||||
5000000, MilliSeconds(2));
|
||||
|
||||
SerialChannel* ch2;
|
||||
ch2 = SerialTopology::AddSerialLink (
|
||||
PointToPointChannel* ch2;
|
||||
ch2 = PointToPointTopology::AddPointToPointLink (
|
||||
n1, Ipv4Address("10.1.2.1"),
|
||||
n2, Ipv4Address("10.1.2.2"),
|
||||
5000000, MilliSeconds(2));
|
||||
|
||||
SerialChannel* ch3;
|
||||
ch3 = SerialTopology::AddSerialLink (
|
||||
PointToPointChannel* ch3;
|
||||
ch3 = PointToPointTopology::AddPointToPointLink (
|
||||
n2, Ipv4Address("10.1.3.1"),
|
||||
n3, Ipv4Address("10.1.3.2"),
|
||||
1500000, MilliSeconds(10));
|
||||
|
||||
@@ -122,12 +122,13 @@ PrintTraffic (DatagramSocket *socket)
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
NS_DEBUG_UNCOND("Serial Net Device Test");
|
||||
NS_DEBUG_UNCOND("PointToPoint Net Device Test");
|
||||
|
||||
// create two nodes and a simple SerialChannel
|
||||
// create two nodes and a simple PointToPointChannel
|
||||
InternetNode a;
|
||||
InternetNode b;
|
||||
SerialChannel ch = SerialChannel ("Test Channel", 1000, Seconds (0.1));
|
||||
PointToPointChannel ch = PointToPointChannel ("Test Channel", 1000,
|
||||
Seconds (0.1));
|
||||
|
||||
NodeList::Add (&a);
|
||||
NodeList::Add (&b);
|
||||
@@ -136,14 +137,14 @@ int main (int argc, char *argv[])
|
||||
// Note: this would normally be done also in conjunction with
|
||||
// creating a Channel
|
||||
|
||||
SerialNetDevice neta(&a);
|
||||
PointToPointNetDevice neta(&a);
|
||||
|
||||
DropTailQueue dtqa;
|
||||
|
||||
neta.AddQueue(&dtqa);
|
||||
neta.SetName("a.eth0");
|
||||
|
||||
SerialNetDevice netb(&b);
|
||||
PointToPointNetDevice netb(&b);
|
||||
|
||||
DropTailQueue dtqb;
|
||||
|
||||
|
||||
@@ -26,39 +26,37 @@
|
||||
#include "ns3/simulator.h"
|
||||
#include "ns3/debug.h"
|
||||
|
||||
NS_DEBUG_COMPONENT_DEFINE ("SerialChannel");
|
||||
NS_DEBUG_COMPONENT_DEFINE ("PointToPointChannel");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
//
|
||||
// By default, you get a channel with the name "Serial Channel" that has an
|
||||
// "infitely" fast transmission speed and zero delay.
|
||||
// XXX: this does not work because m_bps = 0 results in infinitely slow transmission
|
||||
// speed.
|
||||
SerialChannel::SerialChannel()
|
||||
// By default, you get a channel with the name "PointToPoint Channel" that
|
||||
// has an "infitely" fast transmission speed and zero delay.
|
||||
PointToPointChannel::PointToPointChannel()
|
||||
:
|
||||
Channel ("Serial Channel"),
|
||||
m_bps (0),
|
||||
Channel ("PointToPoint Channel"),
|
||||
m_bps (0xffffffff),
|
||||
m_delay (Seconds(0)),
|
||||
m_nDevices(0)
|
||||
{
|
||||
NS_DEBUG("SerialChannel::SerialChannel ()");
|
||||
NS_DEBUG("PointToPointChannel::PointToPointChannel ()");
|
||||
}
|
||||
|
||||
SerialChannel::SerialChannel(
|
||||
PointToPointChannel::PointToPointChannel(
|
||||
const DataRate& bps,
|
||||
const Time& delay)
|
||||
:
|
||||
Channel ("Serial Channel"),
|
||||
Channel ("PointToPoint Channel"),
|
||||
m_bps (bps),
|
||||
m_delay (delay),
|
||||
m_nDevices(0)
|
||||
{
|
||||
NS_DEBUG("SerialChannel::SerialChannel (" << Channel::GetName() << ", " << bps << ", " <<
|
||||
delay << ")");
|
||||
NS_DEBUG("PointToPointChannel::PointToPointChannel (" << Channel::GetName()
|
||||
<< ", " << bps << ", " << delay << ")");
|
||||
}
|
||||
|
||||
SerialChannel::SerialChannel(
|
||||
PointToPointChannel::PointToPointChannel(
|
||||
const std::string& name,
|
||||
const DataRate& bps,
|
||||
const Time& delay)
|
||||
@@ -68,14 +66,14 @@ SerialChannel::SerialChannel(
|
||||
m_delay (delay),
|
||||
m_nDevices(0)
|
||||
{
|
||||
NS_DEBUG("SerialChannel::SerialChannel (" << name << ", " << bps << ", " <<
|
||||
delay << ")");
|
||||
NS_DEBUG("PointToPointChannel::PointToPointChannel (" << name << ", " <<
|
||||
bps << ", " << delay << ")");
|
||||
}
|
||||
|
||||
void
|
||||
SerialChannel::Attach(SerialPhy *phy)
|
||||
PointToPointChannel::Attach(PointToPointPhy *phy)
|
||||
{
|
||||
NS_DEBUG("SerialChannel::Attach (" << phy << ")");
|
||||
NS_DEBUG("PointToPointChannel::Attach (" << phy << ")");
|
||||
NS_ASSERT(m_nDevices < N_DEVICES && "Only two devices permitted");
|
||||
NS_ASSERT(phy);
|
||||
|
||||
@@ -95,9 +93,9 @@ SerialChannel::Attach(SerialPhy *phy)
|
||||
}
|
||||
|
||||
void
|
||||
SerialChannel::TransmitCompleteEvent(Packet p, SerialPhy *src)
|
||||
PointToPointChannel::TransmitCompleteEvent(Packet p, PointToPointPhy *src)
|
||||
{
|
||||
NS_DEBUG("SerialChannel::TransmitCompleteEvent (" << &p << ", " <<
|
||||
NS_DEBUG("PointToPointChannel::TransmitCompleteEvent (" << &p << ", " <<
|
||||
src << ")");
|
||||
|
||||
NS_ASSERT(m_link[0].m_state != INITIALIZING);
|
||||
@@ -107,15 +105,15 @@ SerialChannel::TransmitCompleteEvent(Packet p, SerialPhy *src)
|
||||
|
||||
m_link[wire].m_state = IDLE;
|
||||
|
||||
NS_DEBUG("SerialChannel::TransmitCompleteEvent (): Receive()");
|
||||
NS_DEBUG("PointToPointChannel::TransmitCompleteEvent (): Receive()");
|
||||
|
||||
m_link[wire].m_dst->Receive (p);
|
||||
}
|
||||
|
||||
bool
|
||||
SerialChannel::Propagate(Packet& p, SerialPhy* src)
|
||||
PointToPointChannel::Propagate(Packet& p, PointToPointPhy* src)
|
||||
{
|
||||
NS_DEBUG("SerialChannel::DoPropagate (" << &p << ", " << src << ")");
|
||||
NS_DEBUG("PointToPointChannel::DoPropagate (" << &p << ", " << src << ")");
|
||||
|
||||
NS_ASSERT(m_link[0].m_state != INITIALIZING);
|
||||
NS_ASSERT(m_link[1].m_state != INITIALIZING);
|
||||
@@ -124,7 +122,7 @@ SerialChannel::Propagate(Packet& p, SerialPhy* src)
|
||||
|
||||
if (m_link[wire].m_state == TRANSMITTING)
|
||||
{
|
||||
NS_DEBUG("SerialChannel::DoPropagate (): TRANSMITTING, return");
|
||||
NS_DEBUG("PointToPointChannel::DoPropagate (): TRANSMITTING, return");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -137,21 +135,20 @@ SerialChannel::Propagate(Packet& p, SerialPhy* src)
|
||||
Time tEvent = Seconds (static_cast<double> (p.GetSize() * 8) /
|
||||
static_cast<double> (m_bps)) + m_delay;
|
||||
|
||||
NS_DEBUG("SerialChannel::DoSend (): Schedule Receive delay " << tEvent);
|
||||
NS_DEBUG("PointToPointChannel::DoSend (): Schedule Receive delay " << tEvent);
|
||||
|
||||
Packet packet = p;
|
||||
Simulator::Schedule (tEvent, &SerialChannel::TransmitCompleteEvent, this,
|
||||
p, src);
|
||||
Simulator::Schedule (tEvent, &PointToPointChannel::TransmitCompleteEvent,
|
||||
this, p, src);
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
SerialChannel::GetNDevices (void) const
|
||||
PointToPointChannel::GetNDevices (void) const
|
||||
{
|
||||
return m_nDevices;
|
||||
}
|
||||
NetDevice *
|
||||
SerialChannel::GetDevice (uint32_t i) const
|
||||
PointToPointChannel::GetDevice (uint32_t i) const
|
||||
{
|
||||
return m_link[i].m_src->GetDevice ();
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef SERIAL_CHANNEL_H
|
||||
#define SERIAL_CHANNEL_H
|
||||
#ifndef POINT_TO_POINT_CHANNEL_H
|
||||
#define POINT_TO_POINT_CHANNEL_H
|
||||
|
||||
#include <list>
|
||||
#include "ns3/channel.h"
|
||||
@@ -28,7 +28,7 @@ namespace ns3 {
|
||||
|
||||
// temporary until Raj's code makes it into the dev tree
|
||||
typedef uint64_t DataRate;
|
||||
class SerialPhy;
|
||||
class PointToPointPhy;
|
||||
class NetDevice;
|
||||
|
||||
/**
|
||||
@@ -49,7 +49,7 @@ class NetDevice;
|
||||
* [0] wire to transmit on. The second device gets the [1] wire. There is a
|
||||
* state (IDLE, TRANSMITTING) associated with each wire.
|
||||
*/
|
||||
class SerialChannel : public Channel {
|
||||
class PointToPointChannel : public Channel {
|
||||
public:
|
||||
//
|
||||
// This is really kidding myself, since just setting N_DEVICES to 3 isn't
|
||||
@@ -58,20 +58,20 @@ public:
|
||||
//
|
||||
static const int N_DEVICES = 2;
|
||||
|
||||
SerialChannel ();
|
||||
SerialChannel (const DataRate& bps, const Time& delay);
|
||||
SerialChannel (const std::string& name,
|
||||
PointToPointChannel ();
|
||||
PointToPointChannel (const DataRate& bps, const Time& delay);
|
||||
PointToPointChannel (const std::string& name,
|
||||
const DataRate& bps, const Time& delay);
|
||||
|
||||
void Attach (SerialPhy* phy);
|
||||
bool Propagate (Packet& p, SerialPhy *src);
|
||||
void Attach (PointToPointPhy* phy);
|
||||
bool Propagate (Packet& p, PointToPointPhy *src);
|
||||
|
||||
virtual uint32_t GetNDevices (void) const;
|
||||
virtual NetDevice *GetDevice (uint32_t i) const;
|
||||
|
||||
|
||||
private:
|
||||
void TransmitCompleteEvent (Packet p, SerialPhy *src);
|
||||
void TransmitCompleteEvent (Packet p, PointToPointPhy *src);
|
||||
|
||||
DataRate m_bps;
|
||||
Time m_delay;
|
||||
@@ -90,8 +90,8 @@ private:
|
||||
public:
|
||||
Link() : m_state (INITIALIZING), m_src (0), m_dst (0) {}
|
||||
WireState m_state;
|
||||
SerialPhy *m_src;
|
||||
SerialPhy *m_dst;
|
||||
PointToPointPhy *m_src;
|
||||
PointToPointPhy *m_dst;
|
||||
};
|
||||
|
||||
Link m_link[N_DEVICES];
|
||||
@@ -99,4 +99,4 @@ private:
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
#endif /* SERIAL_CHANNEL_H */
|
||||
#endif /* POINT_TO_POINT_CHANNEL_H */
|
||||
|
||||
@@ -28,15 +28,15 @@
|
||||
#include "p2p-channel.h"
|
||||
#include "p2p-phy.h"
|
||||
|
||||
NS_DEBUG_COMPONENT_DEFINE ("SerialNetDevice");
|
||||
NS_DEBUG_COMPONENT_DEFINE ("PointToPointNetDevice");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
|
||||
SerialNetDevice::SerialNetDevice(Node* node) :
|
||||
PointToPointNetDevice::PointToPointNetDevice(Node* node) :
|
||||
NetDevice(node, MacAddress("00:00:00:00:00:00"))
|
||||
{
|
||||
NS_DEBUG ("SerialNetDevice::SerialNetDevice (" << node << ")");
|
||||
NS_DEBUG ("PointToPointNetDevice::PointToPointNetDevice (" << node << ")");
|
||||
|
||||
// BUGBUG FIXME
|
||||
//
|
||||
@@ -46,20 +46,20 @@ SerialNetDevice::SerialNetDevice(Node* node) :
|
||||
EnablePointToPoint();
|
||||
SetMtu(512); // bytes
|
||||
|
||||
m_phy = new SerialPhy(node, this);
|
||||
m_phy = new PointToPointPhy(node, this);
|
||||
}
|
||||
|
||||
SerialNetDevice::~SerialNetDevice()
|
||||
PointToPointNetDevice::~PointToPointNetDevice()
|
||||
{
|
||||
NS_DEBUG ("SerialNetDevice::~SerialNetDevice ()");
|
||||
NS_DEBUG ("PointToPointNetDevice::~PointToPointNetDevice ()");
|
||||
delete m_phy;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SerialNetDevice::SendTo (Packet& p, const MacAddress& dest)
|
||||
PointToPointNetDevice::SendTo (Packet& p, const MacAddress& dest)
|
||||
{
|
||||
NS_DEBUG ("SerialNetDevice::SendTo (" << &p << ", " << &dest << ")");
|
||||
NS_DEBUG ("PointToPointNetDevice::SendTo (" << &p << ", " << &dest << ")");
|
||||
|
||||
assert (IsLinkUp ());
|
||||
|
||||
@@ -77,22 +77,22 @@ SerialNetDevice::SendTo (Packet& p, const MacAddress& dest)
|
||||
}
|
||||
|
||||
TraceResolver *
|
||||
SerialNetDevice::DoCreateTraceResolver (TraceContext const &context)
|
||||
PointToPointNetDevice::DoCreateTraceResolver (TraceContext const &context)
|
||||
{
|
||||
CompositeTraceResolver *resolver = new CompositeTraceResolver (context);
|
||||
resolver->Add ("queue",
|
||||
MakeCallback (&Queue::CreateTraceResolver, m_queue),
|
||||
SerialNetDevice::QUEUE);
|
||||
PointToPointNetDevice::QUEUE);
|
||||
resolver->Add ("rx",
|
||||
m_rxTrace,
|
||||
SerialNetDevice::RX);
|
||||
PointToPointNetDevice::RX);
|
||||
return resolver;
|
||||
}
|
||||
|
||||
bool
|
||||
SerialNetDevice::Attach (SerialChannel* ch)
|
||||
PointToPointNetDevice::Attach (PointToPointChannel* ch)
|
||||
{
|
||||
NS_DEBUG ("SerialNetDevice::Attach (" << &ch << ")");
|
||||
NS_DEBUG ("PointToPointNetDevice::Attach (" << &ch << ")");
|
||||
|
||||
m_channel = ch;
|
||||
m_phy->Attach (m_channel);
|
||||
@@ -100,7 +100,7 @@ SerialNetDevice::Attach (SerialChannel* ch)
|
||||
* For now, this device is up whenever a channel is attached to it.
|
||||
* In fact, it should become up only when the second device
|
||||
* is attached to the channel. So, there should be a way for
|
||||
* a SerialChannel to notify both of its attached devices
|
||||
* a PointToPointChannel to notify both of its attached devices
|
||||
* that the channel is 'complete', hence that the devices are
|
||||
* up, hence that they can call NotifyLinkUp.
|
||||
*/
|
||||
@@ -109,27 +109,27 @@ SerialNetDevice::Attach (SerialChannel* ch)
|
||||
}
|
||||
|
||||
void
|
||||
SerialNetDevice::AddQueue (Queue* q)
|
||||
PointToPointNetDevice::AddQueue (Queue* q)
|
||||
{
|
||||
NS_DEBUG ("SerialNetDevice::AddQueue (" << q << ")");
|
||||
NS_DEBUG ("PointToPointNetDevice::AddQueue (" << q << ")");
|
||||
|
||||
m_queue = q;
|
||||
}
|
||||
|
||||
void
|
||||
SerialNetDevice::Receive (Packet& p)
|
||||
PointToPointNetDevice::Receive (Packet& p)
|
||||
{
|
||||
// ignore return value for now.
|
||||
NS_DEBUG ("SerialNetDevice::Receive (" << &p << ")");
|
||||
NS_DEBUG ("PointToPointNetDevice::Receive (" << &p << ")");
|
||||
|
||||
m_rxTrace (p);
|
||||
ForwardUp (p);
|
||||
}
|
||||
|
||||
void
|
||||
SerialNetDevice::NotifyDataAvailable(void)
|
||||
PointToPointNetDevice::NotifyDataAvailable(void)
|
||||
{
|
||||
NS_DEBUG ("SerialNetDevice::NotifyDataAvailable ()");
|
||||
NS_DEBUG ("PointToPointNetDevice::NotifyDataAvailable ()");
|
||||
|
||||
Packet p;
|
||||
bool found = GetQueue ()->Dequeue (p);
|
||||
@@ -140,19 +140,19 @@ SerialNetDevice::NotifyDataAvailable(void)
|
||||
p.PeekTag (tag);
|
||||
// send packet to address tag.address
|
||||
#endif
|
||||
NS_DEBUG ("SerialNetDevice::NotifyDataAvailable (): Dequeued");
|
||||
NS_DEBUG ("PointToPointNetDevice::NotifyDataAvailable (): Dequeued");
|
||||
m_phy->Send(p);
|
||||
}
|
||||
}
|
||||
|
||||
Queue*
|
||||
SerialNetDevice::GetQueue(void) const
|
||||
PointToPointNetDevice::GetQueue(void) const
|
||||
{
|
||||
return m_queue;
|
||||
}
|
||||
|
||||
SerialChannel*
|
||||
SerialNetDevice::GetChannel(void) const
|
||||
PointToPointChannel*
|
||||
PointToPointNetDevice::GetChannel(void) const
|
||||
{
|
||||
return m_channel;
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
* Author: Craig Dowell <craigdo@ee.washington.edu>
|
||||
*/
|
||||
|
||||
#ifndef SERIAL_NET_DEVICE_H
|
||||
#define SERIAL_NET_DEVICE_H
|
||||
#ifndef POINT_TO_POINT_NET_DEVICE_H
|
||||
#define POINT_TO_POINT_NET_DEVICE_H
|
||||
|
||||
#include <string.h>
|
||||
#include "ns3/mac-address.h"
|
||||
@@ -31,46 +31,46 @@
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class SerialChannel;
|
||||
class SerialPhy;
|
||||
class PointToPointChannel;
|
||||
class PointToPointPhy;
|
||||
class Queue;
|
||||
|
||||
class SerialNetDevice : public NetDevice {
|
||||
class PointToPointNetDevice : public NetDevice {
|
||||
public:
|
||||
enum TraceType {
|
||||
QUEUE,
|
||||
RX,
|
||||
};
|
||||
SerialNetDevice(Node* node);
|
||||
virtual ~SerialNetDevice();
|
||||
PointToPointNetDevice(Node* node);
|
||||
virtual ~PointToPointNetDevice();
|
||||
|
||||
private:
|
||||
// Don't let the compiler slip in copy and assignment construction
|
||||
SerialNetDevice(const SerialNetDevice&);
|
||||
SerialNetDevice&operator=(const SerialNetDevice&);
|
||||
PointToPointNetDevice(const PointToPointNetDevice&);
|
||||
PointToPointNetDevice&operator=(const PointToPointNetDevice&);
|
||||
|
||||
public:
|
||||
bool Attach(SerialChannel* ch);
|
||||
bool Attach(PointToPointChannel* ch);
|
||||
void AddQueue(Queue*);
|
||||
// called by SerialPhy
|
||||
// called by PointToPointPhy
|
||||
void Receive (Packet& p);
|
||||
|
||||
protected:
|
||||
Queue* GetQueue(void) const;
|
||||
SerialChannel* GetChannel(void) const;
|
||||
PointToPointChannel* GetChannel(void) const;
|
||||
|
||||
private:
|
||||
virtual void NotifyDataAvailable (void);
|
||||
virtual bool SendTo (Packet& p, const MacAddress& dest);
|
||||
virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context);
|
||||
|
||||
SerialPhy* m_phy;
|
||||
SerialChannel* m_channel;
|
||||
PointToPointPhy* m_phy;
|
||||
PointToPointChannel* m_channel;
|
||||
Queue* m_queue;
|
||||
CallbackTraceSource<Packet &> m_rxTrace;
|
||||
};
|
||||
|
||||
}; // namespace ns3
|
||||
|
||||
#endif // SERIAL_NET_DEVICE_H
|
||||
#endif // POINT_TO_POINT_NET_DEVICE_H
|
||||
|
||||
|
||||
@@ -25,35 +25,36 @@
|
||||
#include "p2p-net-device.h"
|
||||
#include "p2p-channel.h"
|
||||
|
||||
NS_DEBUG_COMPONENT_DEFINE ("SerialPhy");
|
||||
NS_DEBUG_COMPONENT_DEFINE ("PointToPointPhy");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
SerialPhy::SerialPhy(Node* node, SerialNetDevice* netdevice) :
|
||||
PointToPointPhy::PointToPointPhy(Node* node, PointToPointNetDevice* netdevice) :
|
||||
m_node(node), m_netdevice(netdevice)
|
||||
{
|
||||
NS_DEBUG ("SerialPhy::SerialPhy (" << node << ", " << netdevice << ")");
|
||||
NS_DEBUG ("PointToPointPhy::PointToPointPhy (" << node << ", " <<
|
||||
netdevice << ")");
|
||||
}
|
||||
|
||||
SerialPhy::~SerialPhy()
|
||||
PointToPointPhy::~PointToPointPhy()
|
||||
{
|
||||
NS_DEBUG ("SerialPhy::~SerialPhy ()");
|
||||
NS_DEBUG ("PointToPointPhy::~PointToPointPhy ()");
|
||||
}
|
||||
|
||||
void
|
||||
SerialPhy::Send (Packet &p)
|
||||
PointToPointPhy::Send (Packet &p)
|
||||
{
|
||||
m_channel->Propagate (p, this);
|
||||
}
|
||||
void
|
||||
SerialPhy::Attach (SerialChannel *channel)
|
||||
PointToPointPhy::Attach (PointToPointChannel *channel)
|
||||
{
|
||||
m_channel = channel;
|
||||
m_channel->Attach (this);
|
||||
}
|
||||
|
||||
SerialNetDevice *
|
||||
SerialPhy::GetDevice (void)
|
||||
PointToPointNetDevice *
|
||||
PointToPointPhy::GetDevice (void)
|
||||
{
|
||||
return m_netdevice;
|
||||
}
|
||||
@@ -61,9 +62,9 @@ SerialPhy::GetDevice (void)
|
||||
|
||||
|
||||
void
|
||||
SerialPhy::Receive (Packet& p)
|
||||
PointToPointPhy::Receive (Packet& p)
|
||||
{
|
||||
NS_DEBUG ("SerialPhy::Receive (" << &p << ")");
|
||||
NS_DEBUG ("PointToPointPhy::Receive (" << &p << ")");
|
||||
m_netdevice->Receive (p);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,33 +18,33 @@
|
||||
* Author: Craig Dowell <craigdo@ee.washington.edu>
|
||||
*/
|
||||
|
||||
#ifndef SERIAL_PHY_H
|
||||
#define SERIAL_PHY_H
|
||||
#ifndef POINT_TO_POINT_PHY_H
|
||||
#define POINT_TO_POINT_PHY_H
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class SerialNetDevice;
|
||||
class SerialChannel;
|
||||
class PointToPointNetDevice;
|
||||
class PointToPointChannel;
|
||||
class Node;
|
||||
class Packet;
|
||||
|
||||
class SerialPhy {
|
||||
class PointToPointPhy {
|
||||
public:
|
||||
SerialPhy(Node* node, SerialNetDevice* netdevice);
|
||||
virtual ~SerialPhy();
|
||||
PointToPointPhy(Node* node, PointToPointNetDevice* netdevice);
|
||||
virtual ~PointToPointPhy();
|
||||
|
||||
void Send (Packet &p);
|
||||
void Receive (Packet& p);
|
||||
void Attach (SerialChannel *channel);
|
||||
void Attach (PointToPointChannel *channel);
|
||||
|
||||
SerialNetDevice *GetDevice (void);
|
||||
PointToPointNetDevice *GetDevice (void);
|
||||
|
||||
private:
|
||||
Node* m_node;
|
||||
SerialChannel *m_channel;
|
||||
SerialNetDevice* m_netdevice;
|
||||
PointToPointChannel *m_channel;
|
||||
PointToPointNetDevice* m_netdevice;
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
#endif // SERIAL_PHY_H
|
||||
#endif // POINT_TO_POINT_PHY_H
|
||||
|
||||
@@ -41,8 +41,8 @@
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
SerialChannel *
|
||||
SerialTopology::AddSerialLink(
|
||||
PointToPointChannel *
|
||||
PointToPointTopology::AddPointToPointLink(
|
||||
Node* a,
|
||||
const Ipv4Address& addra,
|
||||
Node* b,
|
||||
@@ -50,7 +50,7 @@ SerialTopology::AddSerialLink(
|
||||
uint64_t bps,
|
||||
const Time& delay)
|
||||
{
|
||||
SerialChannel* channel = new SerialChannel(bps, delay);
|
||||
PointToPointChannel* channel = new PointToPointChannel(bps, delay);
|
||||
|
||||
// Duplex link is assumed to be subnetted as a /30
|
||||
// May run this unnumbered in the future?
|
||||
@@ -59,7 +59,7 @@ SerialTopology::AddSerialLink(
|
||||
|
||||
DropTailQueue* dtqa = new DropTailQueue();
|
||||
|
||||
SerialNetDevice* neta = new SerialNetDevice(a);
|
||||
PointToPointNetDevice* neta = new PointToPointNetDevice(a);
|
||||
neta->AddQueue(dtqa);
|
||||
Ipv4Interface *interfA = new ArpIpv4Interface (a, neta);
|
||||
uint32_t indexA = a->GetIpv4 ()->AddInterface (interfA);
|
||||
@@ -71,7 +71,7 @@ SerialTopology::AddSerialLink(
|
||||
|
||||
DropTailQueue* dtqb = new DropTailQueue();
|
||||
|
||||
SerialNetDevice* netb = new SerialNetDevice(b);
|
||||
PointToPointNetDevice* netb = new PointToPointNetDevice(b);
|
||||
netb->AddQueue(dtqb);
|
||||
Ipv4Interface *interfB = new ArpIpv4Interface (b, netb);
|
||||
uint32_t indexB = b->GetIpv4 ()->AddInterface (interfB);
|
||||
|
||||
@@ -20,30 +20,30 @@
|
||||
// Topology helper for ns3.
|
||||
// George F. Riley, Georgia Tech, Spring 2007
|
||||
|
||||
#ifndef __TOPOLOGY_H__
|
||||
#define __TOPOLOGY_H__
|
||||
#ifndef __POINT_TO_POINT_TOPOLOGY_H__
|
||||
#define __POINT_TO_POINT_TOPOLOGY_H__
|
||||
|
||||
// The topology class consists of only static methods thar are used to
|
||||
// create the topology and data flows for an ns3 simulation
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class SerialChannel;
|
||||
class PointToPointChannel;
|
||||
class Node;
|
||||
class IPAddr;
|
||||
//class SerialNetDevice;
|
||||
//class PointToPointNetDevice;
|
||||
//class Queue;
|
||||
//class Rate;
|
||||
//class Time;
|
||||
|
||||
class SerialTopology {
|
||||
class PointToPointTopology {
|
||||
public:
|
||||
// Manage point to point links
|
||||
|
||||
// Add a full-duplex point-to-point link between two nodes
|
||||
// with the specified IP addresses, with specified maximum transmission rate
|
||||
// and propagation delay.
|
||||
static SerialChannel* AddSerialLink(
|
||||
static PointToPointChannel* AddPointToPointLink(
|
||||
Node*, const Ipv4Address&,
|
||||
Node*, const Ipv4Address&,
|
||||
// const Rate&,
|
||||
|
||||
Reference in New Issue
Block a user