--- a/src/devices/p2p/p2p-net-device.cc Thu Mar 29 16:55:42 2007 +0200
+++ b/src/devices/p2p/p2p-net-device.cc Thu Mar 29 17:07:04 2007 +0200
@@ -350,8 +350,8 @@
return m_queue;
}
-PointToPointChannel*
-PointToPointNetDevice::GetChannel(void) const
+Channel*
+PointToPointNetDevice::DoGetChannel(void) const
{
return m_channel;
}
--- a/src/devices/p2p/p2p-net-device.h Thu Mar 29 16:55:42 2007 +0200
+++ b/src/devices/p2p/p2p-net-device.h Thu Mar 29 17:07:04 2007 +0200
@@ -33,8 +33,8 @@
namespace ns3 {
+class Queue;
class PointToPointChannel;
-class Queue;
class PointToPointNetDevice : public NetDevice {
public:
@@ -60,7 +60,6 @@
protected:
Queue* GetQueue(void) const;
- PointToPointChannel* GetChannel(void) const;
private:
virtual bool SendTo (Packet& p, const MacAddress& dest);
@@ -70,6 +69,8 @@
void TransmitReadyEvent (void);
virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context);
+ virtual Channel *DoGetChannel(void) const;
+
enum TxMachineState
{
--- a/src/node/ipv4-loopback-interface.cc Thu Mar 29 16:55:42 2007 +0200
+++ b/src/node/ipv4-loopback-interface.cc Thu Mar 29 17:07:04 2007 +0200
@@ -27,40 +27,8 @@
namespace ns3 {
-class Ipv4DummyNetDevice : public NetDevice
-{
-public:
- Ipv4DummyNetDevice (Node *node);
- Node *PeekNode (void) const;
-private:
- virtual bool SendTo (Packet& p, const MacAddress& dest);
- virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context);
-};
-
-Ipv4DummyNetDevice::Ipv4DummyNetDevice (Node *node)
- : NetDevice (node, MacAddress ())
-{
- SetMtu (10000);
-}
-Node *
-Ipv4DummyNetDevice::PeekNode (void) const
-{
- return GetNode ();
-}
-bool
-Ipv4DummyNetDevice::SendTo (Packet& p, const MacAddress& dest)
-{
- return false;
-}
-TraceResolver *
-Ipv4DummyNetDevice::DoCreateTraceResolver (TraceContext const &context)
-{
- return new EmptyTraceResolver (context);
-}
-
-
Ipv4LoopbackInterface::Ipv4LoopbackInterface (Node *node)
- : Ipv4Interface (new Ipv4DummyNetDevice (node)),
+ : Ipv4Interface (0),
m_node (node)
{
}
--- a/src/node/net-device.cc Thu Mar 29 16:55:42 2007 +0200
+++ b/src/node/net-device.cc Thu Mar 29 17:07:04 2007 +0200
@@ -169,6 +169,12 @@
return DoCreateTraceResolver (context);
}
+Channel *
+NetDevice::GetChannel (void) const
+{
+ return DoGetChannel ();
+}
+
// Receive packet from below
bool
NetDevice::ForwardUp (Packet& packet)
--- a/src/node/net-device.h Thu Mar 29 16:55:42 2007 +0200
+++ b/src/node/net-device.h Thu Mar 29 17:07:04 2007 +0200
@@ -29,10 +29,10 @@
namespace ns3 {
-class Ipv4L4Demux;
class Node;
class TraceResolver;
class TraceContext;
+class Channel;
/**
* \brief Network layer to device interface
@@ -72,6 +72,13 @@
TraceResolver *CreateTraceResolver (TraceContext const &context);
/**
+ * \return the channel this NetDevice is connected to. The value
+ * returned can be zero if the NetDevice is not yet connected
+ * to any channel.
+ */
+ Channel *GetChannel (void) const;
+
+ /**
* \return the current MacAddress of this interface.
*/
MacAddress GetAddress (void) const;
@@ -218,6 +225,7 @@
virtual bool SendTo (Packet& p, const MacAddress& dest) = 0;
virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context) = 0;
+ virtual Channel *DoGetChannel (void) const = 0;
Node* m_node;
std::string m_name;
uint16_t m_ifIndex;