A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ns3::Ipv6InterfaceContainer Class Reference

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
 

Public Member Functions

 Ipv6InterfaceContainer ()
 Constructor.
 
void Add (Ptr< Ipv6 > ipv6, uint32_t interface)
 Add a couple IPv6/interface. More...
 
void Add (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...
 
uint32_t GetN (void) const
 
void SetDefaultRoute (uint32_t i, uint32_t router)
 Set the default route for the specified index. More...
 
void SetRouter (uint32_t i, bool router)
 Set the state of the stack (act as a router or not) for the specified index. More...
 

Private Types

typedef std::vector< std::pair
< Ptr< Ipv6 >, uint32_t > > 
InterfaceVector
 

Private Attributes

InterfaceVector m_interfaces
 List of IPv6 stack and interfaces index. More...
 

Detailed Description

Keep track of a set of IPv6 interfaces.

Definition at line 38 of file ipv6-interface-container.h.

Member Function Documentation

void ns3::Ipv6InterfaceContainer::Add ( Ptr< Ipv6 ipv6,
uint32_t  interface 
)
void ns3::Ipv6InterfaceContainer::Add ( Ipv6InterfaceContainer c)

Fusion with another Ipv6InterfaceContainer.

Parameters
ccontainer

Definition at line 74 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.

Parameters
ipv6Namename of a node
interfaceinterface index to add

Definition at line 68 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

Ipv4InterfaceContainer::Iterator i;
for (i = container.Begin (); i != container.End (); ++i)
{
std::pair<Ptr<Ipv6>, uint32_t> pair = *i;
method (pair.first, pair.second); // use the pair
}
Returns
an iterator which refers to the first pair in the container.

Definition at line 35 of file ipv6-interface-container.cc.

References m_interfaces.

Referenced by ns3::PointToPointDumbbellHelper::AssignIpv6Addresses(), ns3::AsciiTraceHelperForIpv6::EnableAsciiIpv6Impl(), and ns3::PcapHelperForIpv6::EnablePcapIpv6().

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

NodeContainer::Iterator i;
for (i = container.Begin (); i != container.End (); ++i)
{
std::pair<Ptr<Ipv6>, uint32_t> pair = *i;
method (pair.first, pair.second); // use the pair
}
Returns
an iterator which indicates an ending condition for a loop.

Definition at line 41 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
uint32_t ns3::Ipv6InterfaceContainer::GetInterfaceIndex ( uint32_t  i) const

Get the interface index for the specified node index.

Parameters
iindex of the node
Returns
interface index

Definition at line 51 of file ipv6-interface-container.cc.

References m_interfaces.

uint32_t ns3::Ipv6InterfaceContainer::GetN ( void  ) const
Returns
the number of Ptr<Ipv6> and interface pairs stored in this Ipv4InterfaceContainer.

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

uint32_t nNodes = container.GetN ();
for (uint32_t i = 0 i < nNodes; ++i)
{
std::pair<Ptr<Ipv6>, uint32_t> pair = container.Get (i);
method (pair.first, pair.second); // use the pair
}

Definition at line 46 of file ipv6-interface-container.cc.

References m_interfaces.

void ns3::Ipv6InterfaceContainer::SetDefaultRoute ( uint32_t  i,
uint32_t  router 
)

Set the default route for the specified index.

Parameters
iindex
routerthe default router

Definition at line 108 of file ipv6-interface-container.cc.

References ns3::Ipv6StaticRoutingHelper::GetStaticRouting(), and m_interfaces.

void ns3::Ipv6InterfaceContainer::SetRouter ( uint32_t  i,
bool  router 
)

Set the state of the stack (act as a router or not) for the specified index.

Parameters
iindex
routertrue : is a router, false : is an host

Definition at line 82 of file ipv6-interface-container.cc.

References ns3::Ipv6StaticRoutingHelper::GetStaticRouting(), and m_interfaces.

Member Data Documentation

InterfaceVector ns3::Ipv6InterfaceContainer::m_interfaces
private

List of IPv6 stack and interfaces index.

Definition at line 168 of file ipv6-interface-container.h.

Referenced by Add(), Begin(), End(), GetAddress(), GetInterfaceIndex(), GetN(), SetDefaultRoute(), and SetRouter().


The documentation for this class was generated from the following files: