A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
src
internet
model
ipv6-route.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2007-2009 Strasbourg University
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: Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
19
*/
20
21
#include <iostream>
22
23
#include "ns3/net-device.h"
24
#include "
ipv6-route.h
"
25
26
namespace
ns3
27
{
28
29
Ipv6Route::Ipv6Route
()
30
{
31
}
32
33
Ipv6Route::~Ipv6Route
()
34
{
35
}
36
37
void
Ipv6Route::SetDestination
(
Ipv6Address
dest)
38
{
39
m_dest
= dest;
40
}
41
42
Ipv6Address
Ipv6Route::GetDestination
()
const
43
{
44
return
m_dest
;
45
}
46
47
void
Ipv6Route::SetSource
(
Ipv6Address
src)
48
{
49
m_source
= src;
50
}
51
52
Ipv6Address
Ipv6Route::GetSource
()
const
53
{
54
return
m_source
;
55
}
56
57
void
Ipv6Route::SetGateway
(
Ipv6Address
gw)
58
{
59
m_gateway
= gw;
60
}
61
62
Ipv6Address
Ipv6Route::GetGateway
()
const
63
{
64
return
m_gateway
;
65
}
66
67
void
Ipv6Route::SetOutputDevice
(
Ptr<NetDevice>
outputDevice)
68
{
69
m_outputDevice
= outputDevice;
70
}
71
72
Ptr<NetDevice>
Ipv6Route::GetOutputDevice
()
const
73
{
74
return
m_outputDevice
;
75
}
76
77
std::ostream&
operator<<
(std::ostream& os,
Ipv6Route
const
& route)
78
{
79
os <<
"source="
<< route.
GetSource
() <<
" dest="
<< route.
GetDestination
() <<
" gw="
<< route.
GetGateway
();
80
return
os;
81
}
82
83
Ipv6MulticastRoute::Ipv6MulticastRoute
()
84
{
85
m_ttls
.clear ();
86
}
87
88
Ipv6MulticastRoute::~Ipv6MulticastRoute
()
89
{
90
}
91
92
void
Ipv6MulticastRoute::SetGroup
(
const
Ipv6Address
group)
93
{
94
m_group
= group;
95
}
96
97
Ipv6Address
Ipv6MulticastRoute::GetGroup
()
const
98
{
99
return
m_group
;
100
}
101
102
void
Ipv6MulticastRoute::SetOrigin
(
const
Ipv6Address
origin)
103
{
104
m_origin
= origin;
105
}
106
107
Ipv6Address
Ipv6MulticastRoute::GetOrigin
()
const
108
{
109
return
m_origin
;
110
}
111
112
void
Ipv6MulticastRoute::SetParent
(uint32_t parent)
113
{
114
m_parent
= parent;
115
}
116
117
uint32_t
Ipv6MulticastRoute::GetParent
()
const
118
{
119
return
m_parent
;
120
}
121
122
void
Ipv6MulticastRoute::SetOutputTtl
(uint32_t oif, uint32_t ttl)
123
{
124
if
(ttl >=
MAX_TTL
)
125
{
126
// This TTL value effectively disables the interface
127
std::map<uint32_t, uint32_t>::iterator iter;
128
iter =
m_ttls
.find (oif);
129
if
(iter !=
m_ttls
.end ())
130
{
131
m_ttls
.erase (iter);
132
}
133
}
134
else
135
{
136
m_ttls
[oif] = ttl;
137
}
138
}
139
140
std::map<uint32_t, uint32_t>
Ipv6MulticastRoute::GetOutputTtlMap
()
const
141
{
142
return
(
m_ttls
);
143
}
144
145
std::ostream&
operator<<
(std::ostream& os,
Ipv6MulticastRoute
const
& route)
146
{
147
os <<
"origin="
<< route.
GetOrigin
() <<
" group="
<< route.
GetGroup
() <<
" parent="
<< route.
GetParent
();
148
return
os;
149
}
150
151
}
/* namespace ns3 */
152
ns3::Ipv6MulticastRoute::MAX_TTL
static const uint32_t MAX_TTL
Maximum Time-To-Live (TTL).
Definition:
ipv6-route.h:150
ns3::Ipv6MulticastRoute::SetGroup
void SetGroup(const Ipv6Address group)
Set IPv6 group.
Definition:
ipv6-route.cc:92
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:73
ns3::Ipv6MulticastRoute::SetOrigin
void SetOrigin(const Ipv6Address origin)
Set origin address.
Definition:
ipv6-route.cc:102
ipv6-route.h
ns3::Ipv6Route::m_gateway
Ipv6Address m_gateway
Gateway address.
Definition:
ipv6-route.h:117
ns3::Ipv6Route::GetDestination
Ipv6Address GetDestination() const
Get destination address.
Definition:
ipv6-route.cc:42
ns3::Ipv6MulticastRoute::m_origin
Ipv6Address m_origin
IPv6 origin (source).
Definition:
ipv6-route.h:219
ns3::Ipv6Route::m_source
Ipv6Address m_source
source address.
Definition:
ipv6-route.h:112
ns3::Ipv6MulticastRoute::GetOutputTtlMap
std::map< uint32_t, uint32_t > GetOutputTtlMap() const
Definition:
ipv6-route.cc:140
ns3::Ipv6MulticastRoute::SetOutputTtl
void SetOutputTtl(uint32_t oif, uint32_t ttl)
set output TTL for this route.
Definition:
ipv6-route.cc:122
ns3::Ipv6Route::m_dest
Ipv6Address m_dest
Destination address.
Definition:
ipv6-route.h:107
ns3::Ipv6MulticastRoute::m_group
Ipv6Address m_group
IPv6 group.
Definition:
ipv6-route.h:214
ns3::Ipv6Route
IPv6 route cache entry.
Definition:
ipv6-route.h:42
ns3::Ipv6Route::SetOutputDevice
void SetOutputDevice(Ptr< NetDevice > outputDevice)
Set output device for outgoing packets.
Definition:
ipv6-route.cc:67
ns3::Ipv6MulticastRoute::m_ttls
std::map< uint32_t, uint32_t > m_ttls
TTLs.
Definition:
ipv6-route.h:229
ns3::Ipv6Route::~Ipv6Route
virtual ~Ipv6Route()
Destructor.
Definition:
ipv6-route.cc:33
ns3::Ipv6MulticastRoute::Ipv6MulticastRoute
Ipv6MulticastRoute()
Constructor.
Definition:
ipv6-route.cc:83
ns3::operator<<
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Definition:
angles.cc:42
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::Ipv6MulticastRoute::~Ipv6MulticastRoute
virtual ~Ipv6MulticastRoute()
Destructor.
Definition:
ipv6-route.cc:88
ns3::Ipv6Route::Ipv6Route
Ipv6Route()
Constructor.
Definition:
ipv6-route.cc:29
ns3::Ipv6MulticastRoute
IPv6 multicast route entry.
Definition:
ipv6-route.h:139
ns3::Ipv6Route::SetDestination
void SetDestination(Ipv6Address dest)
Set destination address.
Definition:
ipv6-route.cc:37
ns3::Ipv6Route::m_outputDevice
Ptr< NetDevice > m_outputDevice
Output device.
Definition:
ipv6-route.h:122
ns3::Ipv6Route::SetGateway
void SetGateway(Ipv6Address gw)
Set gateway address.
Definition:
ipv6-route.cc:57
ns3::Ipv6Route::GetOutputDevice
Ptr< NetDevice > GetOutputDevice() const
Get output device.
Definition:
ipv6-route.cc:72
ns3::Ipv6MulticastRoute::GetOrigin
Ipv6Address GetOrigin(void) const
Get source address.
Definition:
ipv6-route.cc:107
ns3::Ipv6Address
Describes an IPv6 address.
Definition:
ipv6-address.h:49
ns3::Ipv6MulticastRoute::GetGroup
Ipv6Address GetGroup(void) const
Get IPv6 group.
Definition:
ipv6-route.cc:97
ns3::Ipv6MulticastRoute::SetParent
void SetParent(uint32_t iif)
Set parent for this route.
Definition:
ipv6-route.cc:112
ns3::Ipv6MulticastRoute::GetParent
uint32_t GetParent(void) const
Get parent for this route.
Definition:
ipv6-route.cc:117
ns3::Ipv6MulticastRoute::m_parent
uint32_t m_parent
Source interface.
Definition:
ipv6-route.h:224
ns3::Ipv6Route::GetSource
Ipv6Address GetSource() const
Get source address.
Definition:
ipv6-route.cc:52
ns3::Ipv6Route::GetGateway
Ipv6Address GetGateway() const
Get gateway address.
Definition:
ipv6-route.cc:62
ns3::Ipv6Route::SetSource
void SetSource(Ipv6Address src)
Set source address.
Definition:
ipv6-route.cc:47
Generated on Wed Nov 7 2018 10:01:55 for ns-3 by
1.8.14