A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ipv4-interface-container.h
Go to the documentation of this file.
1 #ifndef IPV4_INTERFACE_CONTAINER_H
2 #define IPV4_INTERFACE_CONTAINER_H
3 
4 #include <stdint.h>
5 #include <vector>
6 #include "ns3/ipv4.h"
7 #include "ns3/ipv4-address.h"
8 
9 namespace ns3 {
10 
33 {
34 public:
38  typedef std::vector<std::pair<Ptr<Ipv4>, uint32_t> >::const_iterator Iterator;
39 
44 
49  void Add (Ipv4InterfaceContainer other);
50 
71  Iterator Begin (void) const;
72 
93  Iterator End (void) const;
94 
116  uint32_t GetN (void) const;
117 
128  Ipv4Address GetAddress (uint32_t i, uint32_t j = 0) const;
129 
135  void SetMetric (uint32_t i, uint16_t metric);
136 
146  void Add (Ptr<Ipv4> ipv4, uint32_t interface);
147 
156  void Add (std::pair<Ptr<Ipv4>, uint32_t> ipInterfacePair);
157 
168  void Add (std::string ipv4Name, uint32_t interface);
169 
179  std::pair<Ptr<Ipv4>, uint32_t> Get (uint32_t i) const;
180 
181 private:
186  typedef std::vector<std::pair<Ptr<Ipv4>,uint32_t> > InterfaceVector;
187 
193 };
194 
195 } // namespace ns3
196 
197 #endif /* IPV4_INTERFACE_CONTAINER_H */
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:60
std::pair< Ptr< Ipv4 >, uint32_t > Get(uint32_t i) const
Get the std::pair of an Ptr and interface stored at the location specified by the index...
Ipv4InterfaceContainer()
Create an empty Ipv4InterfaceContainer.
holds a vector of std::pair of Ptr and interface index.
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
std::vector< std::pair< Ptr< Ipv4 >, uint32_t > > InterfaceVector
Container for pairs of Ipv4 smart pointer / Interface Index.
std::vector< std::pair< Ptr< Ipv4 >, uint32_t > >::const_iterator Iterator
Container Const Iterator for pairs of Ipv4 smart pointer / Interface Index.
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:38
void SetMetric(uint32_t i, uint16_t metric)
Set a metric for the given interface.
Iterator Begin(void) const
Get an iterator which refers to the first pair in the container.
InterfaceVector m_interfaces
List of IPv4 stack and interfaces index.
void Add(Ipv4InterfaceContainer other)
Concatenate the entries in the other container with ours.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const