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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
7 */
8
9#ifndef RADVD_INTERFACE_H
10#define RADVD_INTERFACE_H
11
12#include "radvd-prefix.h"
13
14#include "ns3/nstime.h"
15#include "ns3/simple-ref-count.h"
16
17#include <list>
18
19namespace ns3
20{
21
22/**
23 * \ingroup radvd
24 * \brief Radvd interface configuration.
25 */
26class RadvdInterface : public SimpleRefCount<RadvdInterface>
27{
28 public:
29 /// Container: Ptr to RadvdPrefix
30 typedef std::list<Ptr<RadvdPrefix>> RadvdPrefixList;
31 /// Container Iterator: Ptr to RadvdPrefix
32 typedef std::list<Ptr<RadvdPrefix>>::iterator RadvdPrefixListI;
33 /// Container Const Iterator: Ptr to RadvdPrefix
34 typedef std::list<Ptr<RadvdPrefix>>::const_iterator RadvdPrefixListCI;
35
36 /**
37 * \brief Constructor.
38 * \param interface interface index
39 */
40 RadvdInterface(uint32_t interface);
41
42 /**
43 * \brief Constructor.
44 * \param interface interface index
45 * \param maxRtrAdvInterval maximum RA interval (ms)
46 * \param minRtrAdvInterval minimum RA interval (ms)
47 */
48 RadvdInterface(uint32_t interface, uint32_t maxRtrAdvInterval, uint32_t minRtrAdvInterval);
49
50 /**
51 * \brief Destructor.
52 */
54
55 /**
56 * \brief Get interface index for this configuration.
57 * \return interface index
58 */
59 uint32_t GetInterface() const;
60
61 /**
62 * \brief Get list of prefixes advertised for this interface.
63 * \return list of IPv6 prefixes
64 */
66
67 /**
68 * \brief Add a prefix to advertise on interface.
69 * \param routerPrefix prefix to advertise
70 */
71 void AddPrefix(Ptr<RadvdPrefix> routerPrefix);
72
73 /**
74 * \brief Is send advert enabled (periodic RA and reply to RS) ?
75 * \return send advert flag
76 */
77 bool IsSendAdvert() const;
78
79 /**
80 * \brief Set send advert flag.
81 * \param sendAdvert value
82 */
83 void SetSendAdvert(bool sendAdvert);
84
85 /**
86 * \brief Get maximum RA interval.
87 * \return RA interval (ms)
88 */
90
91 /**
92 * \brief Get maximum RA interval.
93 * \param maxRtrAdvInterval RA interval (ms)
94 */
95 void SetMaxRtrAdvInterval(uint32_t maxRtrAdvInterval);
96
97 /**
98 * \brief Get minimum RA interval
99 * \return RA interval (ms)
100 */
102
103 /**
104 * \brief Get minimum RA interval
105 * \param minRtrAdvInterval RA interval (ms).
106 */
107 void SetMinRtrAdvInterval(uint32_t minRtrAdvInterval);
108
109 /**
110 * \brief Get minimum delay between RAs.
111 * \return minimum delay (ms)
112 */
114
115 /**
116 * \brief Set minimum delay between RAs.
117 * \param minDelayBetweenRAs minimum delay (ms)
118 */
119 void SetMinDelayBetweenRAs(uint32_t minDelayBetweenRAs);
120
121 /**
122 * \brief Is managed flag enabled ?
123 * \return managed flag
124 */
125 bool IsManagedFlag() const;
126
127 /**
128 * \brief Set managed flag
129 * \param managedFlag value
130 */
131 void SetManagedFlag(bool managedFlag);
132
133 /**
134 * \brief Is "other config" flag enabled ?
135 * \return other config flag
136 */
137 bool IsOtherConfigFlag() const;
138
139 /**
140 * \brief Set "other config" flag
141 * \param otherConfigFlag value
142 */
143 void SetOtherConfigFlag(bool otherConfigFlag);
144
145 /**
146 * \brief Get link MTU.
147 * \return link MTU
148 */
149 uint32_t GetLinkMtu() const;
150
151 /**
152 * \brief Set link MTU.
153 * \param linkMtu link MTU
154 */
155 void SetLinkMtu(uint32_t linkMtu);
156
157 /**
158 * \brief Get reachable time.
159 * \return reachable time
160 */
162
163 /**
164 * \brief Set reachable time.
165 * \param reachableTime reachable time
166 */
167 void SetReachableTime(uint32_t reachableTime);
168
169 /**
170 * \brief Get default lifetime.
171 * \return default lifetime
172 */
174
175 /**
176 * \brief Set default lifetime.
177 * \param defaultLifeTime default lifetime
178 */
179 void SetDefaultLifeTime(uint32_t defaultLifeTime);
180
181 /**
182 * \brief Get retransmission timer.
183 * \return retransmission timer
184 */
186
187 /**
188 * \brief Set retransmission timer.
189 * \param retransTimer retransmission timer
190 */
191 void SetRetransTimer(uint32_t retransTimer);
192
193 /**
194 * \brief Get current hop limit.
195 * \return current hop limit for the link
196 */
197 uint8_t GetCurHopLimit() const;
198
199 /**
200 * \brief Set current hop limit.
201 * \param curHopLimit current hop limit for the link
202 */
203 void SetCurHopLimit(uint8_t curHopLimit);
204
205 /**
206 * \brief Get default preference.
207 * \return default preference
208 */
209 uint8_t GetDefaultPreference() const;
210
211 /**
212 * \brief Set default preference.
213 * \param defaultPreference default preference
214 */
215 void SetDefaultPreference(uint8_t defaultPreference);
216
217 /**
218 * \brief Is source LLA option should be included in RA ?
219 * \return true if source address is added in RA, false otherwise
220 */
221 bool IsSourceLLAddress() const;
222
223 /**
224 * \brief Set flag to add or not LLA to RA.
225 * \param sourceLLAddress value
226 */
227 void SetSourceLLAddress(bool sourceLLAddress);
228
229 /**
230 * \brief Is "home agent" flag enabled ?
231 * \return "home agent" flag
232 */
233 bool IsHomeAgentFlag() const;
234
235 /**
236 * \brief Set "home agent" flag.
237 * \param homeAgentFlag value
238 */
239 void SetHomeAgentFlag(bool homeAgentFlag);
240
241 /**
242 * \brief Is Home Agent Information option should be included in RA ?
243 * \return true if HA information option is added in RA, false otherwise
244 */
245 bool IsHomeAgentInfo() const;
246
247 /**
248 * \brief Set flag to add or not HA information option to RA.
249 * \param homeAgentFlag value
250 */
251 void SetHomeAgentInfo(bool homeAgentFlag);
252
253 /**
254 * \brief Get home agent lifetime.
255 * \return home agent lifetime
256 */
258
259 /**
260 * \brief Set home agent lifetime.
261 * \param homeAgentLifeTime home agent lifetime
262 */
263 void SetHomeAgentLifeTime(uint32_t homeAgentLifeTime);
264
265 /**
266 * \brief Get home agent preference.
267 * \return home agent preference
268 */
270
271 /**
272 * \brief Set home agent preference.
273 * \param homeAgentPreference home agent preference
274 */
275 void SetHomeAgentPreference(uint32_t homeAgentPreference);
276
277 /**
278 * \brief Is "mobile router support" flag enabled ?
279 * \return "mobile router support" flag
280 */
281 bool IsMobRtrSupportFlag() const;
282
283 /**
284 * \brief Set "mobile router support" flag.
285 * \param mobRtrSupportFlag value
286 */
287 void SetMobRtrSupportFlag(bool mobRtrSupportFlag);
288
289 /**
290 * \brief Is advertisement interval option should be included in RA ?
291 * \return true if advertisement interval option is added in RA, false otherwise
292 */
293 bool IsIntervalOpt() const;
294
295 /**
296 * \brief Set flag to add or not advertisement interval to RA.
297 * \param intervalOpt value
298 */
299 void SetIntervalOpt(bool intervalOpt);
300
301 /**
302 * \brief Get the last time a RA has been sent.
303 * \returns the last RA send time
304 */
306
307 /**
308 * \brief Set the last RA send time. It also decrements the initial Rtr Advertisements counter.
309 * \param now the last RA send time
310 */
311 void SetLastRaTxTime(Time now);
312
313 /**
314 * \brief Checks if the interface is subject to the initial Rtr Advertisements rule.
315 * \returns true if the initial Rtr Advertisements counter is greater than zero.
316 */
317 bool IsInitialRtrAdv() const;
318
319 private:
320 /**
321 * \brief Interface to advertise RA.
322 */
324
325 /**
326 * \brief List of prefixes to advertise.
327 */
329
330 /**
331 * \brief Flag whether or not router sends periodic RA and respond to RS.
332 */
334
335 /**
336 * \brief Maximum RA interval in milliseconds.
337 */
339
340 /**
341 * \brief Minimum RA interval in milliseconds.
342 */
344
345 /**
346 * \brief Minimum delay between RA in milliseconds.
347 */
349
350 /**
351 * \brief Managed flag. If true host use the stateful protocol for address autoconfiguration.
352 */
354
355 /**
356 * \brief Other configuration flag. If true host use stateful protocol for other (non-address)
357 * information.
358 */
360
361 /**
362 * \brief Link MTU to use.
363 */
365
366 /**
367 * \brief Reachable time in milliseconds.
368 */
370
371 /**
372 * \brief Retransmission timer in milliseconds.
373 */
375
376 /**
377 * \brief Current hop limit (TTL).
378 */
380
381 /**
382 * \brief Default life time in seconds.
383 */
385
386 /**
387 * \brief Preference associated with default router.
388 * 0 = low
389 * 1 = medium
390 * 2 = high
391 */
393
394 /**
395 * \brief Flag to add link-layer address in RA.
396 */
398
399 /**
400 * \brief Flag to add HA (home agent) flag in RA.
401 */
403
404 /**
405 * \brief Flag to add Home Agent Information option (Mobile IPv6).
406 * Currently not implemented.
407 */
409
410 /**
411 * \brief Home agent lifetime in seconds. Ignored if home agent info is not set.
412 */
414
415 /**
416 * \brief Home agent preference. Ignored if home agent info is not set.
417 */
419
420 /**
421 * \brief Flag for HA to signals it supports Mobile Router registrations (NEMO Basic).
422 */
424
425 /**
426 * \brief Flag to add Advertisement Interval option in RA.
427 */
429
430 /**
431 * \brief Last RA send time.
432 */
434
435 /**
436 * \brief Number of fast announcement to do
437 */
439};
440
441} /* namespace ns3 */
442
443#endif /* RADVD_INTERFACE_H */
Smart pointer class similar to boost::intrusive_ptr.
Radvd interface configuration.
RadvdInterface(uint32_t interface)
Constructor.
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:94
Every class exported by the ns3 library is enclosed in the ns3 namespace.