Keep track of a set of IPv6 interfaces. More...
#include "ipv6-interface-container.h"
Public Types | |
typedef std::vector< std::pair< Ptr< Ipv6 >, uint32_t > >::const_iterator | Iterator |
Container Const Iterator for pairs of Ipv6 smart pointer / Interface Index. More... | |
Public Member Functions | |
Ipv6InterfaceContainer () | |
Constructor. More... | |
void | Add (Ptr< Ipv6 > ipv6, uint32_t interface) |
Add a couple IPv6/interface. More... | |
void | Add (const Ipv6InterfaceContainer &c) |
Fusion with another Ipv6InterfaceContainer. More... | |
void | Add (std::string ipv6Name, uint32_t interface) |
Add a couple of name/interface. 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... | |
Ipv6Address | GetAddress (uint32_t i, uint32_t j) const |
Get the address for the specified index. More... | |
uint32_t | GetInterfaceIndex (uint32_t i) const |
Get the interface index for the specified node index. More... | |
Ipv6Address | GetLinkLocalAddress (uint32_t i) |
Get the link-local address for the specified index. More... | |
Ipv6Address | GetLinkLocalAddress (Ipv6Address address) |
Get the link-local address for the node with the specified global address. More... | |
uint32_t | GetN (void) const |
void | SetDefaultRoute (uint32_t i, uint32_t router) |
Set the default route for the specified index. More... | |
void | SetDefaultRoute (uint32_t i, Ipv6Address routerAddr) |
Set the default route for the specified index. More... | |
void | SetDefaultRouteInAllNodes (uint32_t router) |
Set the default route for all the devices (except the router itself). More... | |
void | SetDefaultRouteInAllNodes (Ipv6Address routerAddr) |
Set the default route for all the devices (except the router itself). More... | |
void | SetForwarding (uint32_t i, bool state) |
Set the state of the stack (act as a router or as an host) for the specified index. More... | |
Private Types | |
typedef std::vector< std::pair< Ptr< Ipv6 >, uint32_t > > | InterfaceVector |
Container for pairs of Ipv6 smart pointer / Interface Index. More... | |
Private Attributes | |
InterfaceVector | m_interfaces |
List of IPv6 stack and interfaces index. More... | |
Keep track of a set of IPv6 interfaces.
Definition at line 41 of file ipv6-interface-container.h.
|
private |
Container for pairs of Ipv6 smart pointer / Interface Index.
Definition at line 209 of file ipv6-interface-container.h.
typedef std::vector<std::pair<Ptr<Ipv6>, uint32_t> >::const_iterator ns3::Ipv6InterfaceContainer::Iterator |
Container Const Iterator for pairs of Ipv6 smart pointer / Interface Index.
Definition at line 48 of file ipv6-interface-container.h.
ns3::Ipv6InterfaceContainer::Ipv6InterfaceContainer | ( | ) |
Constructor.
Definition at line 31 of file ipv6-interface-container.cc.
Add a couple IPv6/interface.
ipv6 | IPv6 address |
interface | interface index |
Definition at line 64 of file ipv6-interface-container.cc.
References m_interfaces.
Referenced by ns3::Ipv6AddressHelper::Assign(), ns3::PointToPointStarHelper::AssignIpv6Addresses(), ns3::PointToPointGridHelper::AssignIpv6Addresses(), ns3::CsmaStarHelper::AssignIpv6Addresses(), and ns3::PointToPointDumbbellHelper::AssignIpv6Addresses().
void ns3::Ipv6InterfaceContainer::Add | ( | const Ipv6InterfaceContainer & | c | ) |
Fusion with another Ipv6InterfaceContainer.
c | container |
Definition at line 75 of file ipv6-interface-container.cc.
References m_interfaces.
void ns3::Ipv6InterfaceContainer::Add | ( | std::string | ipv6Name, |
uint32_t | interface | ||
) |
Add a couple of name/interface.
ipv6Name | name of a node |
interface | interface index to add |
Definition at line 69 of file ipv6-interface-container.cc.
References m_interfaces.
Ipv6InterfaceContainer::Iterator ns3::Ipv6InterfaceContainer::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 36 of file ipv6-interface-container.cc.
References m_interfaces.
Referenced by ns3::PointToPointDumbbellHelper::AssignIpv6Addresses(), ns3::AsciiTraceHelperForIpv6::EnableAsciiIpv6Impl(), ns3::PcapHelperForIpv6::EnablePcapIpv6(), and UanExperiment::SetupCommunications().
Ipv6InterfaceContainer::Iterator ns3::Ipv6InterfaceContainer::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 42 of file ipv6-interface-container.cc.
References m_interfaces.
Referenced by ns3::AsciiTraceHelperForIpv6::EnableAsciiIpv6Impl(), and ns3::PcapHelperForIpv6::EnablePcapIpv6().
Ipv6Address ns3::Ipv6InterfaceContainer::GetAddress | ( | uint32_t | i, |
uint32_t | j | ||
) | const |
Get the address for the specified index.
i | interface index |
j | address index, generally index 0 is the link-local address |
Definition at line 57 of file ipv6-interface-container.cc.
References m_interfaces.
Referenced by ThreeGppHttpObjectTestCase::CreateSimpleInternetNode(), IpAddressHelperTestCasev6::DoRun(), LteIpv6RoutingTestCase::DoRun(), ns3::PointToPointStarHelper::GetHubIpv6Address(), ns3::CsmaStarHelper::GetHubIpv6Address(), ns3::PointToPointDumbbellHelper::GetLeftIpv6Address(), ns3::PointToPointDumbbellHelper::GetRightIpv6Address(), ns3::PointToPointStarHelper::GetSpokeIpv6Address(), and ns3::CsmaStarHelper::GetSpokeIpv6Address().
uint32_t ns3::Ipv6InterfaceContainer::GetInterfaceIndex | ( | uint32_t | i | ) | const |
Get the interface index for the specified node index.
i | index of the node |
Definition at line 52 of file ipv6-interface-container.cc.
References m_interfaces.
Ipv6Address ns3::Ipv6InterfaceContainer::GetLinkLocalAddress | ( | uint32_t | i | ) |
Get the link-local address for the specified index.
i | index |
Definition at line 207 of file ipv6-interface-container.cc.
References ns3::Ipv6InterfaceAddress::GetAddress(), ns3::Ipv6Address::GetAny(), ns3::Ipv6InterfaceAddress::GetScope(), ns3::Ipv6InterfaceAddress::LINKLOCAL, and m_interfaces.
Referenced by SetDefaultRoute(), and SetDefaultRouteInAllNodes().
Ipv6Address ns3::Ipv6InterfaceContainer::GetLinkLocalAddress | ( | Ipv6Address | address | ) |
Get the link-local address for the node with the specified global address.
address | the address to find. |
Definition at line 222 of file ipv6-interface-container.cc.
References first::address, ns3::Ipv6InterfaceAddress::GetAddress(), ns3::Ipv6Address::GetAny(), ns3::Ipv6InterfaceAddress::GetScope(), ns3::Ipv6InterfaceAddress::LINKLOCAL, m_interfaces, and NS_ASSERT_MSG().
uint32_t ns3::Ipv6InterfaceContainer::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 47 of file ipv6-interface-container.cc.
References m_interfaces.
Referenced by ThreeGppHttpObjectTestCase::CreateSimpleInternetNode().
void ns3::Ipv6InterfaceContainer::SetDefaultRoute | ( | uint32_t | i, |
uint32_t | router | ||
) |
Set the default route for the specified index.
i | index |
router | the default router |
Definition at line 152 of file ipv6-interface-container.cc.
References ns3::Ipv6Address::GetAny(), GetLinkLocalAddress(), ns3::Ipv6StaticRoutingHelper::GetStaticRouting(), m_interfaces, and NS_ASSERT_MSG().
void ns3::Ipv6InterfaceContainer::SetDefaultRoute | ( | uint32_t | i, |
Ipv6Address | routerAddr | ||
) |
Set the default route for the specified index.
Note that the route will be set to the link-local address of the node with the specified address.
i | index |
routerAddr | the default router address |
Definition at line 170 of file ipv6-interface-container.cc.
References GetLinkLocalAddress(), ns3::Ipv6StaticRoutingHelper::GetStaticRouting(), m_interfaces, and NS_ASSERT_MSG().
void ns3::Ipv6InterfaceContainer::SetDefaultRouteInAllNodes | ( | uint32_t | router | ) |
Set the default route for all the devices (except the router itself).
router | the default router index |
Definition at line 89 of file ipv6-interface-container.cc.
References ns3::Ipv6Address::GetAny(), GetLinkLocalAddress(), ns3::Ipv6StaticRoutingHelper::GetStaticRouting(), m_interfaces, and NS_ASSERT_MSG().
Referenced by ns3::EmuEpcHelper::DoInitialize(), Ipv6RipngTest::DoRun(), LteIpv6RoutingTestCase::DoRun(), Ipv6RipngCountToInfinityTest::DoRun(), and ns3::PointToPointEpcHelper::PointToPointEpcHelper().
void ns3::Ipv6InterfaceContainer::SetDefaultRouteInAllNodes | ( | Ipv6Address | routerAddr | ) |
Set the default route for all the devices (except the router itself).
Note that the route will be set to the link-local address of the node with the specified address.
routerAddr | the default router address |
Definition at line 112 of file ipv6-interface-container.cc.
References ns3::Ipv6StaticRoutingHelper::GetStaticRouting(), m_interfaces, and NS_ASSERT_MSG().
void ns3::Ipv6InterfaceContainer::SetForwarding | ( | uint32_t | i, |
bool | state | ||
) |
Set the state of the stack (act as a router or as an host) for the specified index.
This automatically sets all the node's interfaces to the same forwarding state.
i | index |
state | true : is a router, false : is an host |
Definition at line 83 of file ipv6-interface-container.cc.
References m_interfaces.
Referenced by ns3::EmuEpcHelper::DoInitialize(), Ipv6RipngTest::DoRun(), LteIpv6RoutingTestCase::DoRun(), Ipv6RipngCountToInfinityTest::DoRun(), Ipv6RipngSplitHorizonStrategyTest::DoRun(), and ns3::PointToPointEpcHelper::PointToPointEpcHelper().
|
private |
List of IPv6 stack and interfaces index.
Definition at line 214 of file ipv6-interface-container.h.
Referenced by Add(), Begin(), End(), GetAddress(), GetInterfaceIndex(), GetLinkLocalAddress(), GetN(), SetDefaultRoute(), SetDefaultRouteInAllNodes(), and SetForwarding().