A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
radvd-interface.cc
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#include "radvd-interface.h"
10
11#include "ns3/log.h"
12
13namespace ns3
14{
15
16NS_LOG_COMPONENT_DEFINE("RadvdInterface");
17
19 : m_interface(interface)
20{
21 NS_LOG_FUNCTION(this << interface);
22 /* initialize default value as specified in radvd.conf manpage */
23 m_sendAdvert = true;
24 m_maxRtrAdvInterval = 600000;
27 m_managedFlag = false;
28 m_otherConfigFlag = false;
29 m_linkMtu = 0; /* 0 means not sending MTU option in RA */
30 m_reachableTime = 0; /* means unspecified for the router */
31 m_retransTimer = 0; /* means unspecified for the router */
32 m_curHopLimit = 64;
35 m_sourceLLAddress = true;
36 m_homeAgentFlag = false;
37 m_homeAgentInfo = false;
40 m_mobRtrSupportFlag = false;
41 m_intervalOpt = false;
43}
44
48 : m_interface(interface)
49{
52 m_sendAdvert = true;
56 m_managedFlag = false;
57 m_otherConfigFlag = false;
58 m_linkMtu = 0; /* 0 means not sending MTU option in RA */
59 m_reachableTime = 0; /* means unspecified for the router */
60 m_retransTimer = 0; /* means unspecified for the router */
61 m_curHopLimit = 64;
64 m_sourceLLAddress = true;
65 m_homeAgentFlag = false;
66 m_homeAgentInfo = false;
69 m_mobRtrSupportFlag = false;
70 m_intervalOpt = false;
72}
73
75{
76 NS_LOG_FUNCTION(this);
77 /* clear prefixes */
78 for (auto it = m_prefixes.begin(); it != m_prefixes.end(); ++it)
79 {
80 (*it) = nullptr;
81 }
82 m_prefixes.clear();
83}
84
85void
91
94{
95 NS_LOG_FUNCTION(this);
96 return m_interface;
97}
98
99std::list<Ptr<RadvdPrefix>>
101{
102 NS_LOG_FUNCTION(this);
103 return m_prefixes;
104}
105
106bool
108{
109 NS_LOG_FUNCTION(this);
110 return m_sendAdvert;
111}
112
113void
119
126
127void
133
140
141void
147
154
155void
161
162bool
164{
165 NS_LOG_FUNCTION(this);
166 return m_managedFlag;
167}
168
169void
175
176bool
182
183void
189
192{
193 NS_LOG_FUNCTION(this);
194 return m_linkMtu;
195}
196
197void
203
206{
207 NS_LOG_FUNCTION(this);
208 return m_reachableTime;
209}
210
211void
217
224
225void
231
234{
235 NS_LOG_FUNCTION(this);
236 return m_retransTimer;
237}
238
239void
245
246uint8_t
248{
249 NS_LOG_FUNCTION(this);
250 return m_curHopLimit;
251}
252
253void
259
260uint8_t
266
267void
273
274bool
280
281void
287
288bool
290{
291 NS_LOG_FUNCTION(this);
292 return m_homeAgentFlag;
293}
294
295void
301
302bool
304{
305 NS_LOG_FUNCTION(this);
306 return m_homeAgentInfo;
307}
308
309void
315
322
323void
329
336
337void
343
344bool
350
351void
357
358bool
360{
361 NS_LOG_FUNCTION(this);
362 return m_intervalOpt;
363}
364
365void
371
372Time
377
378void
387
388bool
393
394} /* namespace ns3 */
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:66
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.
~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.
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.
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.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition assert.h:55
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
Every class exported by the ns3 library is enclosed in the ns3 namespace.