A Discrete-Event Network Simulator
API
ipv4-interface-container.h
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2008 INRIA
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Mathieu Lacage <mathieu.lacage@cutebugs.net>
19 */
20
21#ifndef IPV4_INTERFACE_CONTAINER_H
22#define IPV4_INTERFACE_CONTAINER_H
23
24#include <stdint.h>
25#include <vector>
26#include "ns3/ipv4.h"
27#include "ns3/ipv4-address.h"
28
29namespace ns3 {
30
55{
56public:
60 typedef std::vector<std::pair<Ptr<Ipv4>, uint32_t> >::const_iterator Iterator;
61
66
71 void Add (const Ipv4InterfaceContainer& other);
72
93 Iterator Begin (void) const;
94
115 Iterator End (void) const;
116
138 uint32_t GetN (void) const;
139
150 Ipv4Address GetAddress (uint32_t i, uint32_t j = 0) const;
151
157 void SetMetric (uint32_t i, uint16_t metric);
158
166 void Add (Ptr<Ipv4> ipv4, uint32_t interface);
167
174 void Add (std::pair<Ptr<Ipv4>, uint32_t> ipInterfacePair);
175
184 void Add (std::string ipv4Name, uint32_t interface);
185
207 std::pair<Ptr<Ipv4>, uint32_t> Get (uint32_t i) const;
208
209private:
213 typedef std::vector<std::pair<Ptr<Ipv4>,uint32_t> > InterfaceVector;
214
219};
220
221} // namespace ns3
222
223#endif /* IPV4_INTERFACE_CONTAINER_H */
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
holds a vector of std::pair of Ptr<Ipv4> and interface index.
std::vector< std::pair< Ptr< Ipv4 >, uint32_t > >::const_iterator Iterator
Container Const Iterator for pairs of Ipv4 smart pointer / Interface Index.
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.
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.
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.
InterfaceVector m_interfaces
List of IPv4 stack and interfaces index.
void Add(const Ipv4InterfaceContainer &other)
Concatenate the entries in the other container with ours.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
Ipv4InterfaceContainer()
Create an empty Ipv4InterfaceContainer.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
Every class exported by the ns3 library is enclosed in the ns3 namespace.