holds a vector of std::pair of Ptr<Ipv4> and interface index. More...
#include <ipv4-interface-container.h>
Public Member Functions | |
Ipv4InterfaceContainer () | |
void | Add (Ipv4InterfaceContainer other) |
uint32_t | GetN (void) const |
Ipv4Address | GetAddress (uint32_t i, uint32_t j=0) const |
void | SetMetric (uint32_t i, uint16_t metric) |
void | Add (Ptr< Ipv4 > ipv4, uint32_t interface) |
void | Add (std::pair< Ptr< Ipv4 >, uint32_t > ipInterfacePair) |
void | Add (std::string ipv4Name, uint32_t interface) |
std::pair< Ptr< Ipv4 >, uint32_t > | Get (uint32_t i) const |
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.
ns3::Ipv4InterfaceContainer::Ipv4InterfaceContainer | ( | ) |
Create an empty Ipv4InterfaceContainer.
void ns3::Ipv4InterfaceContainer::Add | ( | Ipv4InterfaceContainer | other | ) |
Concatenate the entries in the other container with ours.
other | container |
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 |
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 |
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 |
Get the std::pair of an Ptr<Ipv4> and interface stored at the location specified by the index.
i | the index of the entery to retrieve. |
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 aliaising is being used on the interface, the second parameter may typically be omitted.
uint32_t ns3::Ipv4InterfaceContainer::GetN | ( | void | ) | const |