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