holds a vector of std::pair of Ptr<Ipv4> and interface index. More...
#include "ipv4-interface-container.h"
Public Types | |
typedef std::vector< std::pair< Ptr< Ipv4 >, uint32_t > >::const_iterator | Iterator |
Container Const Iterator for pairs of Ipv4 smart pointer / Interface Index. | |
Public Member Functions | |
Ipv4InterfaceContainer () | |
Create an empty Ipv4InterfaceContainer. | |
void | Add (const Ipv4InterfaceContainer &other) |
Concatenate the entries in the other container with ours. | |
void | Add (Ptr< Ipv4 > ipv4, uint32_t interface) |
Manually add an entry to the container consisting of the individual parts of an entry std::pair. | |
void | Add (std::pair< Ptr< Ipv4 >, uint32_t > ipInterfacePair) |
Manually add an entry to the container consisting of a previously composed entry std::pair. | |
void | Add (std::string ipv4Name, uint32_t interface) |
Manually add an entry to the container consisting of the individual parts of an entry std::pair. | |
Iterator | Begin () const |
Get an iterator which refers to the first pair in the container. | |
Iterator | End () const |
Get an iterator which indicates past-the-last Node in the container. | |
std::pair< Ptr< Ipv4 >, uint32_t > | Get (uint32_t i) const |
Get the std::pair of an Ptr<Ipv4> and interface stored at the location specified by the index. | |
Ipv4Address | GetAddress (uint32_t i, uint32_t j=0) const |
uint32_t | GetN () const |
void | SetMetric (uint32_t i, uint16_t metric) |
Set a metric for the given interface. | |
Private Types | |
typedef std::vector< std::pair< Ptr< Ipv4 >, uint32_t > > | InterfaceVector |
Container for pairs of Ipv4 smart pointer / Interface Index. | |
Private Attributes | |
InterfaceVector | m_interfaces |
List of IPv4 stack and interfaces index. | |
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Typically ns-3 Ipv4Interfaces are installed on devices using an Ipv4 address helper. The helper's Assign() method takes a NetDeviceContainer which holds some number of Ptr<NetDevice>. For each of the NetDevices in the NetDeviceContainer the helper will find the associated Ptr<Node> and Ptr<Ipv4>. It makes sure that an interface exists on the node for the device and then adds an Ipv4Address according to the address helper settings (incrementing the Ipv4Address somehow as it goes). The helper then converts the Ptr<Ipv4> and the interface index to a std::pair and adds them to a container – a container of this type.
The point is then to be able to implicitly associate an index into the original NetDeviceContainer (that identifies a particular net device) with an identical index into the Ipv4InterfaceContainer that has a std::pair with the Ptr<Ipv4> and interface index you need to play with the interface.
Definition at line 44 of file ipv4-interface-container.h.
|
private |
Container for pairs of Ipv4 smart pointer / Interface Index.
Definition at line 204 of file ipv4-interface-container.h.
typedef std::vector<std::pair<Ptr<Ipv4>,uint32_t>>::const_iterator ns3::Ipv4InterfaceContainer::Iterator |
Container Const Iterator for pairs of Ipv4 smart pointer / Interface Index.
Definition at line 50 of file ipv4-interface-container.h.
ns3::Ipv4InterfaceContainer::Ipv4InterfaceContainer | ( | ) |
Create an empty Ipv4InterfaceContainer.
Definition at line 17 of file ipv4-interface-container.cc.
void ns3::Ipv4InterfaceContainer::Add | ( | const Ipv4InterfaceContainer & | other | ) |
Concatenate the entries in the other container with ours.
other | container |
Definition at line 22 of file ipv4-interface-container.cc.
References m_interfaces.
Referenced by Add(), ns3::Ipv4AddressHelper::Assign(), ns3::CsmaStarHelper::AssignIpv4Addresses(), ns3::PointToPointDumbbellHelper::AssignIpv4Addresses(), ns3::PointToPointGridHelper::AssignIpv4Addresses(), ns3::PointToPointStarHelper::AssignIpv4Addresses(), and ns3::DhcpHelper::InstallFixedAddress().
Manually add an entry to the container consisting of the individual parts of an entry std::pair.
ipv4 | pointer to Ipv4 object |
interface | interface index of the Ipv4Interface to add to the container |
Definition at line 65 of file ipv4-interface-container.cc.
References m_interfaces.
Manually add an entry to the container consisting of a previously composed entry std::pair.
ipInterfacePair | the pair of a pointer to Ipv4 object and interface index of the Ipv4Interface to add to the container |
Definition at line 71 of file ipv4-interface-container.cc.
References Add().
void ns3::Ipv4InterfaceContainer::Add | ( | std::string | ipv4Name, |
uint32_t | interface ) |
Manually add an entry to the container consisting of the individual parts of an entry std::pair.
ipv4Name | std:string referring to the saved name of an Ipv4 Object that has been previously named using the Object Name Service. |
interface | interface index of the Ipv4Interface to add to the container |
Definition at line 77 of file ipv4-interface-container.cc.
References ns3::Names::Find(), and m_interfaces.
Ipv4InterfaceContainer::Iterator ns3::Ipv4InterfaceContainer::Begin | ( | ) | const |
Get an iterator which refers to the first pair in the container.
Pairs can be retrieved from the container in two ways. First, directly by an index into the container, and second, using an iterator. This method is used in the iterator method and is typically used in a for-loop to run through the pairs
Definition at line 31 of file ipv4-interface-container.cc.
References m_interfaces.
Referenced by ns3::AsciiTraceHelperForIpv4::EnableAsciiIpv4Impl(), and ns3::PcapHelperForIpv4::EnablePcapIpv4().
Ipv4InterfaceContainer::Iterator ns3::Ipv4InterfaceContainer::End | ( | ) | const |
Get an iterator which indicates past-the-last Node in the container.
Nodes can be retrieved from the container in two ways. First, directly by an index into the container, and second, using an iterator. This method is used in the iterator method and is typically used in a for-loop to run through the Nodes
Definition at line 37 of file ipv4-interface-container.cc.
References m_interfaces.
Referenced by ns3::AsciiTraceHelperForIpv4::EnableAsciiIpv4Impl(), and ns3::PcapHelperForIpv4::EnablePcapIpv4().
Get the std::pair of an Ptr<Ipv4> and interface stored at the location specified by the index.
i | the index of the container entry to retrieve. |
Definition at line 84 of file ipv4-interface-container.cc.
References m_interfaces.
Referenced by ns3::PointToPointDumbbellHelper::AssignIpv4Addresses(), FlushTest::DoRun(), ns3::NeighborCacheHelper::PopulateNeighborCache(), and NeighborCacheExample::Run().
Ipv4Address ns3::Ipv4InterfaceContainer::GetAddress | ( | uint32_t | i, |
uint32_t | j = 0 ) const |
i | index of ipInterfacePair in container |
j | interface address index (if interface has multiple addresses) |
If the second parameter is omitted, the zeroth indexed address of the interface is returned. Unless IP aliasing is being used on the interface, the second parameter may typically be omitted.
Definition at line 49 of file ipv4-interface-container.cc.
References m_interfaces.
Referenced by ns3::NoBackhaulEpcHelper::NoBackhaulEpcHelper(), ns3::EmuEpcHelper::AddEnb(), ns3::PointToPointEpcHelper::AddEnb(), ns3::NoBackhaulEpcHelper::AddX2Interface(), ThreeGppHttpObjectTestCase::AssignIpv4Address(), BuildAppsTest(), BuildAppsTest(), ns3::olsr::Bug780Test::CreateNodes(), BriteTopologyFunctionTestCase::DoRun(), BulkSendBasicTestCase::DoRun(), BulkSendSeqTsSizeTestCase::DoRun(), CsmaPingTestCase::DoRun(), CsmaRawIpSocketTestCase::DoRun(), EpcS1uDlTestCase::DoRun(), EpcS1uUlTestCase::DoRun(), IcmpEchoReplyTestCase::DoRun(), IcmpTimeExceedTestCase::DoRun(), Ipv4DynamicGlobalRoutingTestCase::DoRun(), Issue211Test::DoRun(), LenaCqaFfMacSchedulerTestCase1::DoRun(), LenaCqaFfMacSchedulerTestCase2::DoRun(), LenaFdTbfqFfMacSchedulerTestCase1::DoRun(), LenaFdTbfqFfMacSchedulerTestCase2::DoRun(), LenaPssFfMacSchedulerTestCase1::DoRun(), LenaPssFfMacSchedulerTestCase2::DoRun(), LenaTdTbfqFfMacSchedulerTestCase1::DoRun(), LenaTdTbfqFfMacSchedulerTestCase2::DoRun(), LteDistributedFfrAreaTestCase::DoRun(), LteEpcE2eDataTestCase::DoRun(), LteRadioLinkFailureTestCase::DoRun(), LteX2HandoverMeasuresTestCase::DoRun(), LteX2HandoverTestCase::DoRun(), NixVectorRoutingTest::DoRun(), ns3::LenaDeactivateBearerTestCase::DoRun(), ns3::TcpGeneralTest::DoRun(), Ns3TcpCubicTestCase::DoRun(), Ns3TcpLossTestCase::DoRun(), Ns3TcpNoDelayTestCase::DoRun(), Ns3TcpSocketTestCaseCsma::DoRun(), Ns3TcpSocketTestCaseP2P::DoRun(), Ns3TcpStateTestCase::DoRun(), PingTestCase::DoRun(), UdpClientServerTestCase::DoRun(), UdpTraceClientServerTestCase::DoRun(), WifiAcMappingTest::DoRun(), WifiMsduAggregatorThroughputTest::DoRun(), Ns3WimaxSchedulingTestCase::DoRunOnce(), Ns3WimaxSFTypeTestCase::DoRunOnce(), experiment(), ns3::CsmaStarHelper::GetHubIpv4Address(), ns3::PointToPointStarHelper::GetHubIpv4Address(), ns3::PointToPointDumbbellHelper::GetLeftIpv4Address(), ns3::PointToPointDumbbellHelper::GetRightIpv4Address(), ns3::CsmaStarHelper::GetSpokeIpv4Address(), ns3::PointToPointStarHelper::GetSpokeIpv4Address(), LteAggregationThroughputScaleTestCase::GetThroughput(), MeshTest::InstallApplication(), AodvExample::InstallApplications(), DsdvManetExample::InstallApplications(), FlameRegressionTest::InstallApplications(), HwmpDoRfRegressionTest::InstallApplications(), HwmpProactiveRegressionTest::InstallApplications(), HwmpReactiveRegressionTest::InstallApplications(), HwmpSimplestRegressionTest::InstallApplications(), Experiment::Run(), NeighborCacheExample::Run(), and RoutingExperiment::Run().
uint32_t ns3::Ipv4InterfaceContainer::GetN | ( | ) | const |
Pairs can be retrieved from the container in two ways. First, directly by an index into the container, and second, using an iterator. This method is used in the direct method and is typically used to define an ending condition in a for-loop that runs through the stored Nodes
Definition at line 43 of file ipv4-interface-container.cc.
References m_interfaces.
Referenced by ThreeGppHttpObjectTestCase::AssignIpv4Address(), and ns3::NeighborCacheHelper::PopulateNeighborCache().
void ns3::Ipv4InterfaceContainer::SetMetric | ( | uint32_t | i, |
uint16_t | metric ) |
Set a metric for the given interface.
i | Interface index |
metric | the interface metric |
Definition at line 57 of file ipv4-interface-container.cc.
References m_interfaces.
|
private |
List of IPv4 stack and interfaces index.
Definition at line 209 of file ipv4-interface-container.h.
Referenced by Add(), Add(), Add(), Begin(), End(), Get(), GetAddress(), GetN(), and SetMetric().