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
radvd-interface.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 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 "
radvd-interface.h
"
22
23
namespace
ns3
24
{
25
26
RadvdInterface::RadvdInterface
(uint32_t interface)
27
: m_interface (interface)
28
{
29
/* initialize default value as specified in radvd.conf manpage */
30
m_sendAdvert
=
true
;
31
m_maxRtrAdvInterval
= 600000;
32
m_minRtrAdvInterval
= (uint32_t)(
double
) (0.33 *
m_maxRtrAdvInterval
);
33
m_minDelayBetweenRAs
= 3000;
34
m_managedFlag
=
false
;
35
m_otherConfigFlag
=
false
;
36
m_linkMtu
= 0;
/* 0 means not sending MTU option in RA */
37
m_reachableTime
= 0;
/* means unspecified for the router */
38
m_retransTimer
= 0;
/* means unspecified for the router */
39
m_curHopLimit
= 64;
40
m_defaultLifeTime
= 3 *
m_maxRtrAdvInterval
;
41
m_defaultPreference
= 1;
42
m_sourceLLAddress
=
true
;
43
m_homeAgentFlag
=
false
;
44
m_homeAgentInfo
=
false
;
45
m_homeAgentLifeTime
= 0;
46
m_homeAgentPreference
= 0;
47
m_mobRtrSupportFlag
=
false
;
48
m_intervalOpt
=
false
;
49
}
50
51
RadvdInterface::RadvdInterface
(uint32_t interface, uint32_t maxRtrAdvInterval, uint32_t minRtrAdvInterval)
52
: m_interface (interface)
53
{
54
NS_ASSERT
(maxRtrAdvInterval > minRtrAdvInterval);
55
m_sendAdvert
=
true
;
56
m_maxRtrAdvInterval
= maxRtrAdvInterval;
57
m_minRtrAdvInterval
= minRtrAdvInterval;
58
m_minDelayBetweenRAs
= 3000;
59
m_managedFlag
=
false
;
60
m_otherConfigFlag
=
false
;
61
m_linkMtu
= 0;
/* 0 means not sending MTU option in RA */
62
m_reachableTime
= 0;
/* means unspecified for the router */
63
m_retransTimer
= 0;
/* means unspecified for the router */
64
m_curHopLimit
= 64;
65
m_defaultLifeTime
= 3 *
m_maxRtrAdvInterval
;
66
m_defaultPreference
= 1;
67
m_sourceLLAddress
=
true
;
68
m_homeAgentFlag
=
false
;
69
m_homeAgentInfo
=
false
;
70
m_homeAgentLifeTime
= 0;
71
m_homeAgentPreference
= 0;
72
m_mobRtrSupportFlag
=
false
;
73
m_intervalOpt
=
false
;
74
}
75
76
RadvdInterface::~RadvdInterface
()
77
{
78
/* clear prefixes */
79
for
(
RadvdPrefixListI
it =
m_prefixes
.begin (); it !=
m_prefixes
.end (); ++it)
80
{
81
(*it) = 0;
82
}
83
m_prefixes
.clear ();
84
}
85
86
void
RadvdInterface::AddPrefix
(
Ptr<RadvdPrefix>
routerPrefix)
87
{
88
m_prefixes
.push_back (routerPrefix);
89
}
90
91
92
uint32_t
RadvdInterface::GetInterface
()
const
93
{
94
return
m_interface
;
95
}
96
97
std::list<Ptr<RadvdPrefix> >
RadvdInterface::GetPrefixes
()
const
98
{
99
return
m_prefixes
;
100
}
101
102
bool
RadvdInterface::IsSendAdvert
()
const
103
{
104
return
m_sendAdvert
;
105
}
106
107
void
RadvdInterface::SetSendAdvert
(
bool
sendAdvert)
108
{
109
m_sendAdvert
= sendAdvert;
110
}
111
112
uint32_t
RadvdInterface::GetMaxRtrAdvInterval
()
const
113
{
114
return
m_maxRtrAdvInterval
;
115
}
116
117
void
RadvdInterface::SetMaxRtrAdvInterval
(uint32_t maxRtrAdvInterval)
118
{
119
m_maxRtrAdvInterval
= maxRtrAdvInterval;
120
}
121
122
uint32_t
RadvdInterface::GetMinRtrAdvInterval
()
const
123
{
124
return
m_minRtrAdvInterval
;
125
}
126
127
void
RadvdInterface::SetMinRtrAdvInterval
(uint32_t minRtrAdvInterval)
128
{
129
m_minRtrAdvInterval
= minRtrAdvInterval;
130
}
131
132
uint32_t
RadvdInterface::GetMinDelayBetweenRAs
()
const
133
{
134
return
m_minDelayBetweenRAs
;
135
}
136
137
void
RadvdInterface::SetMinDelayBetweenRAs
(uint32_t minDelayBetweenRAs)
138
{
139
m_minDelayBetweenRAs
= minDelayBetweenRAs;
140
}
141
142
bool
RadvdInterface::IsManagedFlag
()
const
143
{
144
return
m_managedFlag
;
145
}
146
147
void
RadvdInterface::SetManagedFlag
(
bool
managedFlag)
148
{
149
m_managedFlag
= managedFlag;
150
}
151
152
bool
RadvdInterface::IsOtherConfigFlag
()
const
153
{
154
return
m_otherConfigFlag
;
155
}
156
157
void
RadvdInterface::SetOtherConfigFlag
(
bool
otherConfigFlag)
158
{
159
m_otherConfigFlag
= otherConfigFlag;
160
}
161
162
uint32_t
RadvdInterface::GetLinkMtu
()
const
163
{
164
return
m_linkMtu
;
165
}
166
167
void
RadvdInterface::SetLinkMtu
(uint32_t linkMtu)
168
{
169
m_linkMtu
= linkMtu;
170
}
171
172
uint32_t
RadvdInterface::GetReachableTime
()
const
173
{
174
return
m_reachableTime
;
175
}
176
177
void
RadvdInterface::SetReachableTime
(uint32_t reachableTime)
178
{
179
m_reachableTime
= reachableTime;
180
}
181
182
uint32_t
RadvdInterface::GetDefaultLifeTime
()
const
183
{
184
return
m_defaultLifeTime
;
185
}
186
187
void
RadvdInterface::SetDefaultLifeTime
(uint32_t defaultLifeTime)
188
{
189
m_defaultLifeTime
= defaultLifeTime;
190
}
191
192
uint32_t
RadvdInterface::GetRetransTimer
()
const
193
{
194
return
m_retransTimer
;
195
}
196
197
void
RadvdInterface::SetRetransTimer
(uint32_t retransTimer)
198
{
199
m_retransTimer
= retransTimer;
200
}
201
202
uint8_t
RadvdInterface::GetCurHopLimit
()
const
203
{
204
return
m_curHopLimit
;
205
}
206
207
void
RadvdInterface::SetCurHopLimit
(uint8_t curHopLimit)
208
{
209
m_curHopLimit
= curHopLimit;
210
}
211
212
uint8_t
RadvdInterface::GetDefaultPreference
()
const
213
{
214
return
m_defaultPreference
;
215
}
216
217
void
RadvdInterface::SetDefaultPreference
(uint8_t defaultPreference)
218
{
219
m_defaultPreference
= defaultPreference;
220
}
221
222
bool
RadvdInterface::IsSourceLLAddress
()
const
223
{
224
return
m_sourceLLAddress
;
225
}
226
227
void
RadvdInterface::SetSourceLLAddress
(
bool
sourceLLAddress)
228
{
229
m_sourceLLAddress
= sourceLLAddress;
230
}
231
232
bool
RadvdInterface::IsHomeAgentFlag
()
const
233
{
234
return
m_homeAgentFlag
;
235
}
236
237
void
RadvdInterface::SetHomeAgentFlag
(
bool
homeAgentFlag)
238
{
239
m_homeAgentFlag
= homeAgentFlag;
240
}
241
242
bool
RadvdInterface::IsHomeAgentInfo
()
const
243
{
244
return
m_homeAgentInfo
;
245
}
246
247
void
RadvdInterface::SetHomeAgentInfo
(
bool
homeAgentInfo)
248
{
249
m_homeAgentInfo
= homeAgentInfo;
250
}
251
252
uint32_t
RadvdInterface::GetHomeAgentLifeTime
()
const
253
{
254
return
m_homeAgentLifeTime
;
255
}
256
257
void
RadvdInterface::SetHomeAgentLifeTime
(uint32_t homeAgentLifeTime)
258
{
259
m_homeAgentLifeTime
= homeAgentLifeTime;
260
}
261
262
uint32_t
RadvdInterface::GetHomeAgentPreference
()
const
263
{
264
return
m_homeAgentPreference
;
265
}
266
267
void
RadvdInterface::SetHomeAgentPreference
(uint32_t homeAgentPreference)
268
{
269
m_homeAgentPreference
= homeAgentPreference;
270
}
271
272
bool
RadvdInterface::IsMobRtrSupportFlag
()
const
273
{
274
return
m_mobRtrSupportFlag
;
275
}
276
277
void
RadvdInterface::SetMobRtrSupportFlag
(
bool
mobRtrSupportFlag)
278
{
279
m_mobRtrSupportFlag
= mobRtrSupportFlag;
280
}
281
282
bool
RadvdInterface::IsIntervalOpt
()
const
283
{
284
return
m_intervalOpt
;
285
}
286
287
void
RadvdInterface::SetIntervalOpt
(
bool
intervalOpt)
288
{
289
m_intervalOpt
= intervalOpt;
290
}
291
}
/* namespace ns3 */
292
src
applications
model
radvd-interface.cc
Generated on Tue Oct 9 2012 16:45:33 for ns-3 by
1.8.1.2