A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
radvd-interface.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009 Strasbourg University
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
18 */
19
20#ifndef RADVD_INTERFACE_H
21#define RADVD_INTERFACE_H
22
23#include "radvd-prefix.h"
24
25#include "ns3/nstime.h"
26#include "ns3/simple-ref-count.h"
27
28#include <list>
29
30namespace ns3
31{
32
33/**
34 * \ingroup radvd
35 * \brief Radvd interface configuration.
36 */
37class RadvdInterface : public SimpleRefCount<RadvdInterface>
38{
39 public:
40 /// Container: Ptr to RadvdPrefix
41 typedef std::list<Ptr<RadvdPrefix>> RadvdPrefixList;
42 /// Container Iterator: Ptr to RadvdPrefix
43 typedef std::list<Ptr<RadvdPrefix>>::iterator RadvdPrefixListI;
44 /// Container Const Iterator: Ptr to RadvdPrefix
45 typedef std::list<Ptr<RadvdPrefix>>::const_iterator RadvdPrefixListCI;
46
47 /**
48 * \brief Constructor.
49 * \param interface interface index
50 */
51 RadvdInterface(uint32_t interface);
52
53 /**
54 * \brief Constructor.
55 * \param interface interface index
56 * \param maxRtrAdvInterval maximum RA interval (ms)
57 * \param minRtrAdvInterval minimum RA interval (ms)
58 */
59 RadvdInterface(uint32_t interface, uint32_t maxRtrAdvInterval, uint32_t minRtrAdvInterval);
60
61 /**
62 * \brief Destructor.
63 */
65
66 /**
67 * \brief Get interface index for this configuration.
68 * \return interface index
69 */
70 uint32_t GetInterface() const;
71
72 /**
73 * \brief Get list of prefixes advertised for this interface.
74 * \return list of IPv6 prefixes
75 */
77
78 /**
79 * \brief Add a prefix to advertise on interface.
80 * \param routerPrefix prefix to advertise
81 */
82 void AddPrefix(Ptr<RadvdPrefix> routerPrefix);
83
84 /**
85 * \brief Is send advert enabled (periodic RA and reply to RS) ?
86 * \return send advert flag
87 */
88 bool IsSendAdvert() const;
89
90 /**
91 * \brief Set send advert flag.
92 * \param sendAdvert value
93 */
94 void SetSendAdvert(bool sendAdvert);
95
96 /**
97 * \brief Get maximum RA interval.
98 * \return RA interval (ms)
99 */
101
102 /**
103 * \brief Get maximum RA interval.
104 * \param maxRtrAdvInterval RA interval (ms)
105 */
106 void SetMaxRtrAdvInterval(uint32_t maxRtrAdvInterval);
107
108 /**
109 * \brief Get minimum RA interval
110 * \return RA interval (ms)
111 */
113
114 /**
115 * \brief Get minimum RA interval
116 * \param minRtrAdvInterval RA interval (ms).
117 */
118 void SetMinRtrAdvInterval(uint32_t minRtrAdvInterval);
119
120 /**
121 * \brief Get minimum delay between RAs.
122 * \return minimum delay (ms)
123 */
125
126 /**
127 * \brief Set minimum delay between RAs.
128 * \param minDelayBetweenRAs minimum delay (ms)
129 */
130 void SetMinDelayBetweenRAs(uint32_t minDelayBetweenRAs);
131
132 /**
133 * \brief Is managed flag enabled ?
134 * \return managed flag
135 */
136 bool IsManagedFlag() const;
137
138 /**
139 * \brief Set managed flag
140 * \param managedFlag value
141 */
142 void SetManagedFlag(bool managedFlag);
143
144 /**
145 * \brief Is "other config" flag enabled ?
146 * \return other config flag
147 */
148 bool IsOtherConfigFlag() const;
149
150 /**
151 * \brief Set "other config" flag
152 * \param otherConfigFlag value
153 */
154 void SetOtherConfigFlag(bool otherConfigFlag);
155
156 /**
157 * \brief Get link MTU.
158 * \return link MTU
159 */
160 uint32_t GetLinkMtu() const;
161
162 /**
163 * \brief Set link MTU.
164 * \param linkMtu link MTU
165 */
166 void SetLinkMtu(uint32_t linkMtu);
167
168 /**
169 * \brief Get reachable time.
170 * \return reachable time
171 */
173
174 /**
175 * \brief Set reachable time.
176 * \param reachableTime reachable time
177 */
178 void SetReachableTime(uint32_t reachableTime);
179
180 /**
181 * \brief Get default lifetime.
182 * \return default lifetime
183 */
185
186 /**
187 * \brief Set default lifetime.
188 * \param defaultLifeTime default lifetime
189 */
190 void SetDefaultLifeTime(uint32_t defaultLifeTime);
191
192 /**
193 * \brief Get retransmission timer.
194 * \return retransmission timer
195 */
197
198 /**
199 * \brief Set retransmission timer.
200 * \param retransTimer retransmission timer
201 */
202 void SetRetransTimer(uint32_t retransTimer);
203
204 /**
205 * \brief Get current hop limit.
206 * \return current hop limit for the link
207 */
208 uint8_t GetCurHopLimit() const;
209
210 /**
211 * \brief Set current hop limit.
212 * \param curHopLimit current hop limit for the link
213 */
214 void SetCurHopLimit(uint8_t curHopLimit);
215
216 /**
217 * \brief Get default preference.
218 * \return default preference
219 */
220 uint8_t GetDefaultPreference() const;
221
222 /**
223 * \brief Set default preference.
224 * \param defaultPreference default preference
225 */
226 void SetDefaultPreference(uint8_t defaultPreference);
227
228 /**
229 * \brief Is source LLA option should be included in RA ?
230 * \return true if source address is added in RA, false otherwise
231 */
232 bool IsSourceLLAddress() const;
233
234 /**
235 * \brief Set flag to add or not LLA to RA.
236 * \param sourceLLAddress value
237 */
238 void SetSourceLLAddress(bool sourceLLAddress);
239
240 /**
241 * \brief Is "home agent" flag enabled ?
242 * \return "home agent" flag
243 */
244 bool IsHomeAgentFlag() const;
245
246 /**
247 * \brief Set "home agent" flag.
248 * \param homeAgentFlag value
249 */
250 void SetHomeAgentFlag(bool homeAgentFlag);
251
252 /**
253 * \brief Is Home Agent Information option should be included in RA ?
254 * \return true if HA information option is added in RA, false otherwise
255 */
256 bool IsHomeAgentInfo() const;
257
258 /**
259 * \brief Set flag to add or not HA information option to RA.
260 * \param homeAgentFlag value
261 */
262 void SetHomeAgentInfo(bool homeAgentFlag);
263
264 /**
265 * \brief Get home agent lifetime.
266 * \return home agent lifetime
267 */
269
270 /**
271 * \brief Set home agent lifetime.
272 * \param homeAgentLifeTime home agent lifetime
273 */
274 void SetHomeAgentLifeTime(uint32_t homeAgentLifeTime);
275
276 /**
277 * \brief Get home agent preference.
278 * \return home agent preference
279 */
281
282 /**
283 * \brief Set home agent preference.
284 * \param homeAgentPreference home agent preference
285 */
286 void SetHomeAgentPreference(uint32_t homeAgentPreference);
287
288 /**
289 * \brief Is "mobile router support" flag enabled ?
290 * \return "mobile router support" flag
291 */
292 bool IsMobRtrSupportFlag() const;
293
294 /**
295 * \brief Set "mobile router support" flag.
296 * \param mobRtrSupportFlag value
297 */
298 void SetMobRtrSupportFlag(bool mobRtrSupportFlag);
299
300 /**
301 * \brief Is advertisement interval option should be included in RA ?
302 * \return true if advertisement interval option is added in RA, false otherwise
303 */
304 bool IsIntervalOpt() const;
305
306 /**
307 * \brief Set flag to add or not advertisement interval to RA.
308 * \param intervalOpt value
309 */
310 void SetIntervalOpt(bool intervalOpt);
311
312 /**
313 * \brief Get the last time a RA has been sent.
314 * \returns the last RA send time
315 */
317
318 /**
319 * \brief Set the last RA send time. It also decrements the initial Rtr Advertisements counter.
320 * \param now the last RA send time
321 */
322 void SetLastRaTxTime(Time now);
323
324 /**
325 * \brief Checks if the interface is subject to the initial Rtr Advertisements rule.
326 * \returns true if the initial Rtr Advertisements counter is greater than zero.
327 */
328 bool IsInitialRtrAdv() const;
329
330 private:
331 /**
332 * \brief Interface to advertise RA.
333 */
335
336 /**
337 * \brief List of prefixes to advertise.
338 */
340
341 /**
342 * \brief Flag whether or not router sends periodic RA and respond to RS.
343 */
345
346 /**
347 * \brief Maximum RA interval in milliseconds.
348 */
350
351 /**
352 * \brief Minimum RA interval in milliseconds.
353 */
355
356 /**
357 * \brief Minimum delay between RA in milliseconds.
358 */
360
361 /**
362 * \brief Managed flag. If true host use the stateful protocol for address autoconfiguration.
363 */
365
366 /**
367 * \brief Other configuration flag. If true host use stateful protocol for other (non-address)
368 * information.
369 */
371
372 /**
373 * \brief Link MTU to use.
374 */
376
377 /**
378 * \brief Reachable time in milliseconds.
379 */
381
382 /**
383 * \brief Retransmission timer in milliseconds.
384 */
386
387 /**
388 * \brief Current hop limit (TTL).
389 */
391
392 /**
393 * \brief Default life time in seconds.
394 */
396
397 /**
398 * \brief Preference associated with default router.
399 * 0 = low
400 * 1 = medium
401 * 2 = high
402 */
404
405 /**
406 * \brief Flag to add link-layer address in RA.
407 */
409
410 /**
411 * \brief Flag to add HA (home agent) flag in RA.
412 */
414
415 /**
416 * \brief Flag to add Home Agent Information option (Mobile IPv6).
417 * Currently not implemented.
418 */
420
421 /**
422 * \brief Home agent lifetime in seconds. Ignored if home agent info is not set.
423 */
425
426 /**
427 * \brief Home agent preference. Ignored if home agent info is not set.
428 */
430
431 /**
432 * \brief Flag for HA to signals it supports Mobile Router registrations (NEMO Basic).
433 */
435
436 /**
437 * \brief Flag to add Advertisement Interval option in RA.
438 */
440
441 /**
442 * \brief Last RA send time.
443 */
445
446 /**
447 * \brief Number of fast announcement to do
448 */
450};
451
452} /* namespace ns3 */
453
454#endif /* RADVD_INTERFACE_H */
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Radvd interface configuration.
bool IsMobRtrSupportFlag() const
Is "mobile router support" flag enabled ?
void SetMinDelayBetweenRAs(uint32_t minDelayBetweenRAs)
Set minimum delay between RAs.
uint8_t m_initialRtrAdvertisementsLeft
Number of fast announcement to do.
void SetSourceLLAddress(bool sourceLLAddress)
Set flag to add or not LLA to RA.
bool IsIntervalOpt() const
Is advertisement interval option should be included in RA ?
uint32_t m_reachableTime
Reachable time in milliseconds.
uint32_t GetMinDelayBetweenRAs() const
Get minimum delay between RAs.
std::list< Ptr< RadvdPrefix > > RadvdPrefixList
Container: Ptr to RadvdPrefix.
~RadvdInterface()
Destructor.
uint32_t m_defaultLifeTime
Default life time in seconds.
void SetSendAdvert(bool sendAdvert)
Set send advert flag.
void SetLinkMtu(uint32_t linkMtu)
Set link MTU.
void SetDefaultLifeTime(uint32_t defaultLifeTime)
Set default lifetime.
uint32_t m_maxRtrAdvInterval
Maximum RA interval in milliseconds.
void SetHomeAgentFlag(bool homeAgentFlag)
Set "home agent" flag.
bool m_sourceLLAddress
Flag to add link-layer address in RA.
uint32_t GetDefaultLifeTime() const
Get default lifetime.
bool m_sendAdvert
Flag whether or not router sends periodic RA and respond to RS.
void AddPrefix(Ptr< RadvdPrefix > routerPrefix)
Add a prefix to advertise on interface.
bool IsHomeAgentInfo() const
Is Home Agent Information option should be included in RA ?
uint8_t m_defaultPreference
Preference associated with default router.
void SetMobRtrSupportFlag(bool mobRtrSupportFlag)
Set "mobile router support" flag.
Time GetLastRaTxTime()
Get the last time a RA has been sent.
bool m_homeAgentInfo
Flag to add Home Agent Information option (Mobile IPv6).
void SetLastRaTxTime(Time now)
Set the last RA send time.
uint32_t m_homeAgentLifeTime
Home agent lifetime in seconds.
bool m_intervalOpt
Flag to add Advertisement Interval option in RA.
uint32_t GetMaxRtrAdvInterval() const
Get maximum RA interval.
uint32_t GetInterface() const
Get interface index for this configuration.
bool m_otherConfigFlag
Other configuration flag.
uint32_t GetMinRtrAdvInterval() const
Get minimum RA interval.
Time m_lastSendTime
Last RA send time.
uint32_t m_retransTimer
Retransmission timer in milliseconds.
RadvdPrefixList GetPrefixes() const
Get list of prefixes advertised for this interface.
void SetHomeAgentPreference(uint32_t homeAgentPreference)
Set home agent preference.
uint32_t GetRetransTimer() const
Get retransmission timer.
RadvdPrefixList m_prefixes
List of prefixes to advertise.
std::list< Ptr< RadvdPrefix > >::iterator RadvdPrefixListI
Container Iterator: Ptr to RadvdPrefix.
bool IsHomeAgentFlag() const
Is "home agent" flag enabled ?
uint32_t GetReachableTime() const
Get reachable time.
bool m_managedFlag
Managed flag.
void SetIntervalOpt(bool intervalOpt)
Set flag to add or not advertisement interval to RA.
void SetRetransTimer(uint32_t retransTimer)
Set retransmission timer.
bool IsInitialRtrAdv() const
Checks if the interface is subject to the initial Rtr Advertisements rule.
void SetCurHopLimit(uint8_t curHopLimit)
Set current hop limit.
void SetDefaultPreference(uint8_t defaultPreference)
Set default preference.
void SetMaxRtrAdvInterval(uint32_t maxRtrAdvInterval)
Get maximum RA interval.
uint32_t m_interface
Interface to advertise RA.
bool m_homeAgentFlag
Flag to add HA (home agent) flag in RA.
void SetOtherConfigFlag(bool otherConfigFlag)
Set "other config" flag.
bool IsSendAdvert() const
Is send advert enabled (periodic RA and reply to RS) ?
uint8_t GetDefaultPreference() const
Get default preference.
void SetMinRtrAdvInterval(uint32_t minRtrAdvInterval)
Get minimum RA interval.
bool IsOtherConfigFlag() const
Is "other config" flag enabled ?
uint32_t GetHomeAgentLifeTime() const
Get home agent lifetime.
bool m_mobRtrSupportFlag
Flag for HA to signals it supports Mobile Router registrations (NEMO Basic).
uint32_t m_minDelayBetweenRAs
Minimum delay between RA in milliseconds.
uint8_t GetCurHopLimit() const
Get current hop limit.
uint32_t m_curHopLimit
Current hop limit (TTL).
uint32_t GetLinkMtu() const
Get link MTU.
uint32_t m_minRtrAdvInterval
Minimum RA interval in milliseconds.
uint32_t m_homeAgentPreference
Home agent preference.
uint32_t GetHomeAgentPreference() const
Get home agent preference.
std::list< Ptr< RadvdPrefix > >::const_iterator RadvdPrefixListCI
Container Const Iterator: Ptr to RadvdPrefix.
void SetManagedFlag(bool managedFlag)
Set managed flag.
void SetHomeAgentInfo(bool homeAgentFlag)
Set flag to add or not HA information option to RA.
bool IsSourceLLAddress() const
Is source LLA option should be included in RA ?
uint32_t m_linkMtu
Link MTU to use.
bool IsManagedFlag() const
Is managed flag enabled ?
void SetHomeAgentLifeTime(uint32_t homeAgentLifeTime)
Set home agent lifetime.
void SetReachableTime(uint32_t reachableTime)
Set reachable time.
A template-based reference counting class.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Every class exported by the ns3 library is enclosed in the ns3 namespace.