Bug 10 - Mismatch of virtual method name between Node and InternetNode
Mismatch of virtual method name between Node and InternetNode
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: core
pre-release
PC Linux
: P1 blocker
Assigned To: ns-bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-03-15 08:04 UTC by Gustavo J. A. M. Carneiro
Modified: 2008-07-01 13:32 UTC (History)
0 users

See Also:


Attachments
register NetDevices (1.54 KB, patch)
2007-03-15 08:38 UTC, Gustavo J. A. M. Carneiro
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gustavo J. A. M. Carneiro 2007-03-15 08:04:17 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;
Comment 1 Gustavo J. A. M. Carneiro 2007-03-15 08:22:05 UTC
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
Comment 2 Mathieu Lacage 2007-03-15 08:27:45 UTC
Please, submit attached patches instead. I applied something based on the first patch. 
Comment 3 Mathieu Lacage 2007-03-15 08:30:21 UTC
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.
Comment 4 Gustavo J. A. M. Carneiro 2007-03-15 08:38:53 UTC
Created attachment 6 [details]
register NetDevices
Comment 5 Gustavo J. A. M. Carneiro 2007-03-15 08:51:32 UTC
(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.
Comment 6 Tom Henderson 2007-04-18 00:45:27 UTC
This will get cleaned up when we revise ns-3-dev node structure this month.  I agree with your suggestion.
Comment 7 Tom Henderson 2007-06-19 19:35:18 UTC
This bug is obsolete with the current ns-3-dev code;
no NetDeviceList object anymore
NetDevices are registered with Add