00001 #include "ipv4-interface-container.h" 00002 #include "ns3/node-list.h" 00003 00004 namespace ns3 { 00005 00006 Ipv4InterfaceContainer::Ipv4InterfaceContainer () 00007 {} 00008 00009 void 00010 Ipv4InterfaceContainer::Add (Ipv4InterfaceContainer other) 00011 { 00012 for (InterfaceVector::const_iterator i = other.m_interfaces.begin (); i != other.m_interfaces.end (); i++) 00013 { 00014 m_interfaces.push_back (*i); 00015 } 00016 } 00017 00018 uint32_t 00019 Ipv4InterfaceContainer::GetN (void) const 00020 { 00021 return m_interfaces.size (); 00022 } 00023 00024 Ipv4Address 00025 Ipv4InterfaceContainer::GetAddress (uint32_t i) const 00026 { 00027 Ptr<Ipv4> ipv4 = m_interfaces[i].first; 00028 uint32_t interface = m_interfaces[i].second; 00029 return ipv4->GetAddress (interface); 00030 } 00031 void 00032 Ipv4InterfaceContainer::SetMetric (uint32_t i, uint16_t metric) 00033 { 00034 Ptr<Ipv4> ipv4 = m_interfaces[i].first; 00035 uint32_t interface = m_interfaces[i].second; 00036 ipv4->SetMetric (interface, metric); 00037 } 00038 void 00039 Ipv4InterfaceContainer::Add (Ptr<Ipv4> ipv4, uint32_t interface) 00040 { 00041 m_interfaces.push_back (std::make_pair (ipv4, interface)); 00042 } 00043 00044 } // namespace ns3