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. More... | |
Public Member Functions | |
Ipv4InterfaceContainer () | |
Create an empty Ipv4InterfaceContainer. More... | |
void | Add (const Ipv4InterfaceContainer &other) |
Concatenate the entries in the other container with ours. More... | |
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. More... | |
void | Add (std::pair< Ptr< Ipv4 >, uint32_t > ipInterfacePair) |
Manually add an entry to the container consisting of a previously composed entry std::pair. More... | |
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. More... | |
Iterator | Begin () const |
Get an iterator which refers to the first pair in the container. More... | |
Iterator | End () const |
Get an iterator which indicates past-the-last Node in the container. More... | |
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. More... | |
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. More... | |
Private Types | |
typedef std::vector< std::pair< Ptr< Ipv4 >, uint32_t > > | InterfaceVector |
Container for pairs of Ipv4 smart pointer / Interface Index. More... | |
Private Attributes | |
InterfaceVector | m_interfaces |
List of IPv4 stack and interfaces index. More... | |
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 55 of file ipv4-interface-container.h.
|
private |
Container for pairs of Ipv4 smart pointer / Interface Index.
Definition at line 215 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 61 of file ipv4-interface-container.h.
ns3::Ipv4InterfaceContainer::Ipv4InterfaceContainer | ( | ) |
Create an empty Ipv4InterfaceContainer.
Definition at line 28 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 33 of file ipv4-interface-container.cc.
References m_interfaces.
Referenced by Add(), ns3::Ipv4AddressHelper::Assign(), ns3::CsmaStarHelper::AssignIpv4Addresses(), ns3::PointToPointStarHelper::AssignIpv4Addresses(), ns3::PointToPointDumbbellHelper::AssignIpv4Addresses(), ns3::PointToPointGridHelper::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 76 of file ipv4-interface-container.cc.
References nsclick-simple-lan::ipv4, and 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 82 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 88 of file ipv4-interface-container.cc.
References nsclick-simple-lan::ipv4, 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 42 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 48 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 95 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 60 of file ipv4-interface-container.cc.
References nsclick-simple-lan::ipv4, and m_interfaces.
Referenced by ns3::NoBackhaulEpcHelper::NoBackhaulEpcHelper(), ns3::EmuEpcHelper::AddEnb(), ns3::PointToPointEpcHelper::AddEnb(), ns3::NoBackhaulEpcHelper::AddX2Interface(), BuildAppsTest(), ns3::olsr::Bug780Test::CreateNodes(), ThreeGppHttpObjectTestCase::CreateSimpleInternetNode(), BulkSendBasicTestCase::DoRun(), BulkSendSeqTsSizeTestCase::DoRun(), UdpClientServerTestCase::DoRun(), UdpTraceClientServerTestCase::DoRun(), BriteTopologyFunctionTestCase::DoRun(), PingTestCase::DoRun(), IcmpEchoReplyTestCase::DoRun(), IcmpTimeExceedTestCase::DoRun(), Ipv4DynamicGlobalRoutingTestCase::DoRun(), ns3::TcpGeneralTest::DoRun(), EpcS1uDlTestCase::DoRun(), EpcS1uUlTestCase::DoRun(), LenaCqaFfMacSchedulerTestCase1::DoRun(), LenaCqaFfMacSchedulerTestCase2::DoRun(), ns3::LenaDeactivateBearerTestCase::DoRun(), LenaFdTbfqFfMacSchedulerTestCase1::DoRun(), LenaFdTbfqFfMacSchedulerTestCase2::DoRun(), LteDistributedFfrAreaTestCase::DoRun(), LenaPssFfMacSchedulerTestCase1::DoRun(), LenaPssFfMacSchedulerTestCase2::DoRun(), LteRadioLinkFailureTestCase::DoRun(), LenaTdTbfqFfMacSchedulerTestCase1::DoRun(), LenaTdTbfqFfMacSchedulerTestCase2::DoRun(), LteEpcE2eDataTestCase::DoRun(), LteX2HandoverMeasuresTestCase::DoRun(), LteX2HandoverTestCase::DoRun(), NixVectorRoutingTest::DoRun(), CsmaPingTestCase::DoRun(), CsmaRawIpSocketTestCase::DoRun(), Ns3TcpCubicTestCase::DoRun(), Ns3TcpLossTestCase::DoRun(), Ns3TcpNoDelayTestCase::DoRun(), Ns3TcpSocketTestCaseP2P::DoRun(), Ns3TcpSocketTestCaseCsma::DoRun(), Ns3TcpStateTestCase::DoRun(), WifiAcMappingTest::DoRun(), Issue211Test::DoRun(), WifiMsduAggregatorThroughputTest::DoRun(), Ns3WimaxSFTypeTestCase::DoRunOnce(), Ns3WimaxSchedulingTestCase::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(), HwmpProactiveRegressionTest::InstallApplications(), HwmpReactiveRegressionTest::InstallApplications(), HwmpSimplestRegressionTest::InstallApplications(), HwmpDoRfRegressionTest::InstallApplications(), FlameRegressionTest::InstallApplications(), RoutingExperiment::Run(), NeighborCacheExample::Run(), and Experiment::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 54 of file ipv4-interface-container.cc.
References m_interfaces.
Referenced by ThreeGppHttpObjectTestCase::CreateSimpleInternetNode(), 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 68 of file ipv4-interface-container.cc.
References nsclick-simple-lan::ipv4, and m_interfaces.
|
private |
List of IPv4 stack and interfaces index.
Definition at line 220 of file ipv4-interface-container.h.
Referenced by Add(), Begin(), End(), Get(), GetAddress(), GetN(), and SetMetric().