[Ns-developers] NetDevice and ArpIpv4Interface

Gustavo Carneiro gjcarneiro at gmail.com
Thu May 15 03:20:35 PDT 2008


NetDevice and ArpIpv4Interface look perfect candidates for merging into a
single virtual object via AddObject (aka AddInterface).  Right now:

  1- ArpIpv4Interface "decorates" (or "wraps") NetDevice;
  2- The ArpIpv4Interface has one "interface index" at IP level, NetDevice
has another "interface index" at Node level, and they can be different (I
was surprised to find out recently);
  3- There are two interface lists, one at IP level, one at Node level;
  4- Checking if a NetDevice supports IP or not is not trivial, as my
GlobalRoutingManager patch demonstrates:

+      // Check if it is an IP interface (could be a pure L2 NetDevice)
+      bool isIp = false;
+      for (uint32_t i = 0; i < ipv4Local->GetNInterfaces (); ++i )
+        {
+          if (ipv4Local->GetNetDevice (i) == ndLocal)
+            {
+              isIp = true;
+              break;
+            }
+        }
+      if (!isIp)
+        {
+          continue;
+        }
+

I think this design predates the introduction of object interfaces in NS-3.
If we were designing it now, I think most of us would agree in a better
design:

  1- ArpIpv4Interface becomes an optional interface of NetDevice
(AddObject);
  2- Thus there would be only one interface index for both, and only one
interface list at Node level (IP can filter out non-IP interfaces).

Maybe it's not worth changing at this point; just some thoughts... maybe to
keep in mind for long term refactoring...

-- 
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert


More information about the Ns-developers mailing list