1.1 --- a/src/internet-stack/ipv4-l3-protocol.cc Fri Nov 06 17:47:44 2009 +0100
1.2 +++ b/src/internet-stack/ipv4-l3-protocol.cc Fri Nov 06 15:16:18 2009 -0800
1.3 @@ -82,8 +82,7 @@
1.4 }
1.5
1.6 Ipv4L3Protocol::Ipv4L3Protocol()
1.7 - : m_nInterfaces (0),
1.8 - m_identification (0)
1.9 + : m_identification (0)
1.10 {
1.11 NS_LOG_FUNCTION_NOARGS ();
1.12 }
1.13 @@ -266,9 +265,8 @@
1.14 Ipv4L3Protocol::AddIpv4Interface (Ptr<Ipv4Interface>interface)
1.15 {
1.16 NS_LOG_FUNCTION (this << interface);
1.17 - uint32_t index = m_nInterfaces;
1.18 + uint32_t index = m_interfaces.size ();
1.19 m_interfaces.push_back (interface);
1.20 - m_nInterfaces++;
1.21 return index;
1.22 }
1.23
1.24 @@ -276,14 +274,9 @@
1.25 Ipv4L3Protocol::GetInterface (uint32_t index) const
1.26 {
1.27 NS_LOG_FUNCTION (this << index);
1.28 - uint32_t tmp = 0;
1.29 - for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++)
1.30 + if (index < m_interfaces.size ())
1.31 {
1.32 - if (index == tmp)
1.33 - {
1.34 - return *i;
1.35 - }
1.36 - tmp++;
1.37 + return m_interfaces[index];
1.38 }
1.39 return 0;
1.40 }
1.41 @@ -292,7 +285,7 @@
1.42 Ipv4L3Protocol::GetNInterfaces (void) const
1.43 {
1.44 NS_LOG_FUNCTION_NOARGS ();
1.45 - return m_nInterfaces;
1.46 + return m_interfaces.size ();
1.47 }
1.48
1.49 int32_t
2.1 --- a/src/internet-stack/ipv4-l3-protocol.h Fri Nov 06 17:47:44 2009 +0100
2.2 +++ b/src/internet-stack/ipv4-l3-protocol.h Fri Nov 06 15:16:18 2009 -0800
2.3 @@ -22,6 +22,7 @@
2.4 #define IPV4_L3_PROTOCOL_H
2.5
2.6 #include <list>
2.7 +#include <vector>
2.8 #include <stdint.h>
2.9 #include "ns3/ipv4-address.h"
2.10 #include "ns3/ptr.h"
2.11 @@ -233,7 +234,7 @@
2.12 Ptr<Icmpv4L4Protocol> GetIcmp (void) const;
2.13 bool IsUnicast (Ipv4Address ad, Ipv4Mask interfaceMask) const;
2.14
2.15 - typedef std::list<Ptr<Ipv4Interface> > Ipv4InterfaceList;
2.16 + typedef std::vector<Ptr<Ipv4Interface> > Ipv4InterfaceList;
2.17 typedef std::list<Ptr<Ipv4RawSocketImpl> > SocketList;
2.18 typedef std::list<Ptr<Ipv4L4Protocol> > L4List_t;
2.19