A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
ipv4-interface-container.cc
Go to the documentation of this file.
1
#include "
ipv4-interface-container.h
"
2
#include "ns3/node-list.h"
3
#include "ns3/names.h"
4
5
namespace
ns3 {
6
7
Ipv4InterfaceContainer::Ipv4InterfaceContainer
()
8
{
9
}
10
11
void
12
Ipv4InterfaceContainer::Add
(
Ipv4InterfaceContainer
other)
13
{
14
for
(InterfaceVector::const_iterator i = other.
m_interfaces
.begin (); i != other.
m_interfaces
.end (); i++)
15
{
16
m_interfaces
.push_back (*i);
17
}
18
}
19
20
Ipv4InterfaceContainer::Iterator
21
Ipv4InterfaceContainer::Begin
(
void
)
const
22
{
23
return
m_interfaces
.begin ();
24
}
25
26
Ipv4InterfaceContainer::Iterator
27
Ipv4InterfaceContainer::End
(
void
)
const
28
{
29
return
m_interfaces
.end ();
30
}
31
32
uint32_t
33
Ipv4InterfaceContainer::GetN
(
void
)
const
34
{
35
return
m_interfaces
.size ();
36
}
37
38
Ipv4Address
39
Ipv4InterfaceContainer::GetAddress
(uint32_t i, uint32_t j)
const
40
{
41
Ptr<Ipv4>
ipv4 =
m_interfaces
[i].first;
42
uint32_t
interface
=
m_interfaces
[i].second;
43
return
ipv4->
GetAddress
(interface, j).
GetLocal
();
44
}
45
46
void
47
Ipv4InterfaceContainer::SetMetric
(uint32_t i, uint16_t metric)
48
{
49
Ptr<Ipv4>
ipv4 =
m_interfaces
[i].first;
50
uint32_t
interface
=
m_interfaces
[i].second;
51
ipv4->
SetMetric
(interface, metric);
52
}
53
void
54
Ipv4InterfaceContainer::Add
(
Ptr<Ipv4>
ipv4, uint32_t interface)
55
{
56
m_interfaces
.push_back (std::make_pair (ipv4, interface));
57
}
58
void
Ipv4InterfaceContainer::Add
(std::pair<
Ptr<Ipv4>
, uint32_t> a)
59
{
60
Add
(a.first, a.second);
61
}
62
void
63
Ipv4InterfaceContainer::Add
(std::string ipv4Name, uint32_t interface)
64
{
65
Ptr<Ipv4>
ipv4 = Names::Find<Ipv4> (ipv4Name);
66
m_interfaces
.push_back (std::make_pair (ipv4, interface));
67
}
68
69
std::pair<Ptr<Ipv4>, uint32_t>
70
Ipv4InterfaceContainer::Get
(uint32_t i)
const
71
{
72
return
m_interfaces
[i];
73
}
74
75
76
}
// namespace ns3
src
internet
helper
ipv4-interface-container.cc
Generated on Tue Oct 9 2012 16:45:37 for ns-3 by
1.8.1.2