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 (void) const |
Get an iterator which refers to the first pair in the container. More... | |
Iterator | End (void) 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 (void) 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 54 of file ipv4-interface-container.h.
|
private |
Container for pairs of Ipv4 smart pointer / Interface Index.
Definition at line 213 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 60 of file ipv4-interface-container.h.
ns3::Ipv4InterfaceContainer::Ipv4InterfaceContainer | ( | ) |
Create an empty Ipv4InterfaceContainer.
Definition at line 27 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 32 of file ipv4-interface-container.cc.
References m_interfaces.
Referenced by Add(), ns3::Ipv4AddressHelper::Assign(), ns3::PointToPointStarHelper::AssignIpv4Addresses(), ns3::PointToPointGridHelper::AssignIpv4Addresses(), ns3::CsmaStarHelper::AssignIpv4Addresses(), ns3::PointToPointDumbbellHelper::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 74 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 78 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 83 of file ipv4-interface-container.cc.
References m_interfaces.
Ipv4InterfaceContainer::Iterator ns3::Ipv4InterfaceContainer::Begin | ( | void | ) | 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 41 of file ipv4-interface-container.cc.
References m_interfaces.
Referenced by ns3::AsciiTraceHelperForIpv4::EnableAsciiIpv4Impl(), ns3::PcapHelperForIpv4::EnablePcapIpv4(), and ns3::WaveBsmHelper::Install().
Ipv4InterfaceContainer::Iterator ns3::Ipv4InterfaceContainer::End | ( | void | ) | 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 47 of file ipv4-interface-container.cc.
References m_interfaces.
Referenced by ns3::AsciiTraceHelperForIpv4::EnableAsciiIpv4Impl(), ns3::PcapHelperForIpv4::EnablePcapIpv4(), and ns3::WaveBsmHelper::Install().
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 90 of file ipv4-interface-container.cc.
References m_interfaces.
Referenced by ns3::PointToPointDumbbellHelper::AssignIpv4Addresses().
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 59 of file ipv4-interface-container.cc.
References m_interfaces.
Referenced by ns3::PointToPointEpcHelper::AddEnb(), ns3::EmuEpcHelper::AddEnb(), ns3::PointToPointEpcHelper::AddX2Interface(), BuildAppsTest(), ns3::olsr::Bug780Test::CreateNodes(), ThreeGppHttpObjectTestCase::CreateSimpleInternetNode(), WifiMsduAggregatorThroughputTest::DoRun(), WifiAcMappingTest::DoRun(), ns3::LenaDeactivateBearerTestCase::DoRun(), Ns3TcpNoDelayTestCase::DoRun(), Ns3TcpSocketTestCase1::DoRun(), NscTcpLossTestCase1::DoRun(), UdpClientServerTestCase::DoRun(), LenaCqaFfMacSchedulerTestCase1::DoRun(), LenaPssFfMacSchedulerTestCase1::DoRun(), LenaTdTbfqFfMacSchedulerTestCase1::DoRun(), LenaFdTbfqFfMacSchedulerTestCase1::DoRun(), Ns3TcpLossTestCase::DoRun(), Ns3TcpStateTestCase::DoRun(), LteX2HandoverTestCase::DoRun(), BriteTopologyFunctionTestCase::DoRun(), LenaTdTbfqFfMacSchedulerTestCase2::DoRun(), EpcS1uDlTestCase::DoRun(), LenaCqaFfMacSchedulerTestCase2::DoRun(), LenaPssFfMacSchedulerTestCase2::DoRun(), LenaFdTbfqFfMacSchedulerTestCase2::DoRun(), LteX2HandoverMeasuresTestCase::DoRun(), LteEpcE2eDataTestCase::DoRun(), UdpTraceClientServerTestCase::DoRun(), Ns3TcpSocketTestCase2::DoRun(), NscTcpLossTestCase2::DoRun(), EpcS1uUlTestCase::DoRun(), ns3::TcpGeneralTest::DoRun(), LteDistributedFfrAreaTestCase::DoRun(), Ns3TcpCwndTestCase2::DoRun(), CsmaPingTestCase::DoRun(), CsmaRawIpSocketTestCase::DoRun(), Ipv4DynamicGlobalRoutingTestCase::DoRun(), Ns3WimaxSchedulingTestCase::DoRunOnce(), Ns3WimaxSFTypeTestCase::DoRunOnce(), ns3::PointToPointStarHelper::GetHubIpv4Address(), ns3::CsmaStarHelper::GetHubIpv4Address(), ns3::PointToPointDumbbellHelper::GetLeftIpv4Address(), ns3::PointToPointDumbbellHelper::GetRightIpv4Address(), ns3::PointToPointStarHelper::GetSpokeIpv4Address(), ns3::CsmaStarHelper::GetSpokeIpv4Address(), MeshTest::InstallApplication(), HwmpProactiveRegressionTest::InstallApplications(), FlameRegressionTest::InstallApplications(), HwmpDoRfRegressionTest::InstallApplications(), HwmpSimplestRegressionTest::InstallApplications(), HwmpReactiveRegressionTest::InstallApplications(), AodvExample::InstallApplications(), DsdvManetExample::InstallApplications(), ns3::BsmApplication::ReceiveWavePacket(), RoutingExperiment::Run(), Experiment::Run(), and RoutingHelper::SetupRoutingMessages().
uint32_t ns3::Ipv4InterfaceContainer::GetN | ( | void | ) | 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 53 of file ipv4-interface-container.cc.
References m_interfaces.
Referenced by ThreeGppHttpObjectTestCase::CreateSimpleInternetNode(), ns3::BsmApplication::GenerateWaveTraffic(), and ns3::BsmApplication::ReceiveWavePacket().
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 67 of file ipv4-interface-container.cc.
References m_interfaces.
|
private |
List of IPv4 stack and interfaces index.
Definition at line 218 of file ipv4-interface-container.h.
Referenced by Add(), Begin(), End(), Get(), GetAddress(), GetN(), and SetMetric().