Bugzilla – Bug 10
Mismatch of virtual method name between Node and InternetNode
Last modified: 2008-07-01 13:32:12 UTC
Node::GetDeviceList vs InternetNode::GetDevices. Possible patch below, although my preferred name would be 'GetNetDevices'. diff -r c390aba1a000 src/node/node.cc --- a/src/node/node.cc Wed Mar 14 19:07:12 2007 +0000 +++ b/src/node/node.cc Thu Mar 15 12:00:38 2007 +0000 @@ -67,7 +67,7 @@ Node::GetIpv4L4Demux() const } NetDeviceList* -Node::GetNetDeviceList() const +Node::GetNetDevices () const { return 0; } diff -r c390aba1a000 src/node/node.h --- a/src/node/node.h Wed Mar 14 19:07:12 2007 +0000 +++ b/src/node/node.h Thu Mar 15 12:00:38 2007 +0000 @@ -120,7 +120,7 @@ public: // null capability exists. virtual L3Demux* GetL3Demux() const; virtual Ipv4L4Demux* GetIpv4L4Demux() const; - virtual NetDeviceList* GetNetDeviceList() const; + virtual NetDeviceList* GetNetDevices () const; virtual Ipv4 * GetIpv4 (void) const; virtual Udp * GetUdp (void) const; virtual Arp * GetArp (void) const;
While you're at it, please fix NetDevice registration: diff -r 6d5b95249a01 src/node/net-device.cc --- a/src/node/net-device.cc Thu Mar 15 12:04:50 2007 +0000 +++ b/src/node/net-device.cc Thu Mar 15 12:20:16 2007 +0000 @@ -24,6 +24,7 @@ #include "ns3/debug.h" #include "net-device.h" +#include "net-device-list.h" #include "l3-demux.h" #include "l3-protocol.h" #include "llc-snap-header.h" @@ -43,7 +44,11 @@ NetDevice::NetDevice(Node *node, const M m_isBroadcast (false), m_isMulticast (false), m_isPointToPoint (false) -{} +{ + NetDeviceList *netDevList = node->GetNetDevices (); + if (netDevList) + netDevList->Add (this); +} MacAddress NetDevice::GetAddress (void) const
Please, submit attached patches instead. I applied something based on the first patch.
Ah, I see a new patch. I think that the spirit of the code was that the user was supposed to register the NetDevice objects himself into the NetDeviceList rather than let each NetDevice register itself into the NetDeviceList. Now, I personally would much prefer do what you describe here but I don't want to go down that path until someone else oks it.
Created attachment 6 [details] register NetDevices
(In reply to comment #3) > Ah, I see a new patch. I think that the spirit of the code was that the user > was supposed to register the NetDevice objects himself into the NetDeviceList > rather than let each NetDevice register itself into the NetDeviceList. Now, I > personally would much prefer do what you describe here but I don't want to go > down that path until someone else oks it. OK. In case people decide each NetDevice subclass has to register itself then please update the sample SerialNetDevice to do that; thanks.
This will get cleaned up when we revise ns-3-dev node structure this month. I agree with your suggestion.
This bug is obsolete with the current ns-3-dev code; no NetDeviceList object anymore NetDevices are registered with Add