return ifIndex when adding netdevice to node (topology)
authorTom Henderson <tomh@tomh.org>
Fri, 27 Jul 2007 14:40:50 -0700
changeset 989baeb6102ea71
parent 988 89a9125a39c9
child 990 44a604ad18cc
return ifIndex when adding netdevice to node (topology)
src/devices/csma-cd/csma-cd-ipv4-topology.cc
src/devices/csma-cd/csma-cd-ipv4-topology.h
     1.1 --- a/src/devices/csma-cd/csma-cd-ipv4-topology.cc	Fri Jul 27 13:07:36 2007 -0700
     1.2 +++ b/src/devices/csma-cd/csma-cd-ipv4-topology.cc	Fri Jul 27 14:40:50 2007 -0700
     1.3 @@ -35,26 +35,20 @@
     1.4  namespace ns3 {
     1.5  
     1.6  
     1.7 -void
     1.8 +uint32_t
     1.9  CsmaCdIpv4Topology::AddIpv4CsmaCdNode(Ptr<Node> n1,
    1.10                                        Ptr<CsmaCdChannel> ch,
    1.11                                        MacAddress addr)
    1.12  {
    1.13    Ptr<Queue> q = Queue::CreateDefault ();
    1.14  
    1.15 -  // Use the first net device in the node to transmit
    1.16 +  // assume full-duplex
    1.17    Ptr<CsmaCdNetDevice> nd0 = Create<CsmaCdNetDevice> (n1, addr, 
    1.18                                                        ns3::CsmaCdNetDevice::IP_ARP,
    1.19 -                                                      true, false);
    1.20 +                                                      true, true);
    1.21    nd0->AddQueue(q);
    1.22    nd0->Attach (ch);
    1.23 -
    1.24 -  // Use the second net device in the node to transmit
    1.25 -  Ptr<CsmaCdNetDevice> nd1 = Create<CsmaCdNetDevice> (n1, addr, 
    1.26 -                                                      ns3::CsmaCdNetDevice::IP_ARP,
    1.27 -                                                      false, true);
    1.28 -  nd1->AddQueue(q);
    1.29 -  nd1->Attach (ch);
    1.30 +  return nd0->GetIfIndex ();
    1.31  }
    1.32  
    1.33  
     2.1 --- a/src/devices/csma-cd/csma-cd-ipv4-topology.h	Fri Jul 27 13:07:36 2007 -0700
     2.2 +++ b/src/devices/csma-cd/csma-cd-ipv4-topology.h	Fri Jul 27 14:40:50 2007 -0700
     2.3 @@ -58,8 +58,10 @@
     2.4     * connect to a CsmaCdChannel. This means that Ethernet headers
     2.5     * and trailers will be added to the packet before sending out on
     2.6     * the net device.
     2.7 +   * 
     2.8 +   * \return ifIndex of the device
     2.9     */
    2.10 -  static void AddIpv4CsmaCdNode( Ptr<Node> n1,
    2.11 +  static uint32_t AddIpv4CsmaCdNode( Ptr<Node> n1,
    2.12                                   Ptr<CsmaCdChannel> ch,
    2.13                                   MacAddress addr);
    2.14