A Discrete-Event Network Simulator
API
ipv6-autoconfigured-prefix.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2009 Telecom Bretagne
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: Mehdi Benamor <benamor.mehdi@ensi.rnu.tn>
18  */
19 
20 #ifndef IPV6_AUTOCONFIGURED_PREFIX_H
21 #define IPV6_AUTOCONFIGURED_PREFIX_H
22 
23 #include "ns3/ipv6-address.h"
24 #include "ns3/timer.h"
25 
26 #include <list>
27 #include <ostream>
28 #include <stdint.h>
29 #include <vector>
30 
31 namespace ns3
32 {
33 class Node;
34 
41 {
42  public:
54  uint32_t interface,
55  Ipv6Address prefix,
56  Ipv6Prefix mask,
57  uint32_t preferredLifeTime,
58  uint32_t validLifeTime,
59  Ipv6Address router = Ipv6Address("::"));
60 
64  ~Ipv6AutoconfiguredPrefix() override;
65 
71 
77 
82  uint32_t GetInterface() const;
83 
88  void SetInterface(uint32_t interface);
89 
94  uint32_t GetPreferredLifeTime() const;
95 
100  void SetPreferredLifeTime(uint32_t p);
101 
106  uint32_t GetValidLifeTime() const;
107 
112  void SetValidLifeTime(uint32_t v);
113 
118  bool IsPreferred() const;
119 
124  bool IsValid() const;
125 
129  void SetPreferred();
130 
134  void SetValid();
135 
139  void StartPreferredTimer();
140 
144  void StartValidTimer();
145 
149  void StopPreferredTimer();
150 
154  void StopValidTimer();
155 
159  void MarkPreferredTime();
160 
164  void MarkValidTime();
165 
170 
174  void FunctionValidTimeout();
175 
179  void RemoveMe();
180 
185  uint32_t GetId() const;
186 
191  Ipv6Address GetPrefix() const;
192 
197  void SetPrefix(Ipv6Address prefix);
198 
203  Ipv6Prefix GetMask() const;
204 
209  void SetMask(Ipv6Prefix mask);
210 
211  private:
215  static uint32_t m_prefixId;
216 
220  uint32_t m_id;
221 
226 
231 
236 
245 
250  uint32_t m_interface;
251 
255  uint32_t m_validLifeTime;
256 
261 
266 
270  bool m_valid;
271 
276 
281 };
282 
283 } /* namespace ns3 */
284 
285 #endif /* IPV6_AUTOCONFIGURED_PREFIX_H */
Describes an IPv6 address.
Definition: ipv6-address.h:49
void SetPreferred()
Set the prefix as preferred.
void FunctionValidTimeout()
Signal that the valid time expired.
Ipv6Address m_prefix
The prefix IPv6 address.
void StopValidTimer()
Stop the valid timer.
void SetInterface(uint32_t interface)
Set the interface.
uint32_t GetValidLifeTime() const
Get the prefix valid life time.
Ipv6Prefix m_mask
The prefix bitmask (length).
uint32_t GetPreferredLifeTime() const
Get the prefix preferred life time.
void RemoveMe()
Remove this prefix from the prefix list.
uint32_t m_preferredLifeTime
the preferred life time.
void SetMask(Ipv6Prefix mask)
Set the bitmask prefix.
void SetValid()
Set the prefix as valid.
static uint32_t m_prefixId
a static identifier.
bool m_preferred
true if the prefix is preferred.
void FunctionPreferredTimeout()
Signal that the preferred time expired and start the valid timer.
Ipv6Address GetPrefix() const
Get the prefix address.
void SetPrefix(Ipv6Address prefix)
Set the prefix address.
void StartPreferredTimer()
Start the preferred timer.
Ipv6Prefix GetMask() const
Get the bitmask prefix.
~Ipv6AutoconfiguredPrefix() override
Destructor.
void SetPreferredLifeTime(uint32_t p)
Set the prefix preferred life time.
uint32_t GetInterface() const
Get the interface index.
Timer m_validTimer
the timer for valid life time.
uint32_t m_validLifeTime
the valid life time.
Timer m_preferredTimer
the timer for preferred life time.
bool m_valid
true if the prefix is valid.
bool IsValid() const
Test if the prefix is valid.
void SetValidLifeTime(uint32_t v)
Set the prefix valid life time.
uint32_t m_id
the identifier of this prefix.
void StopPreferredTimer()
Stop the preferred timer.
uint32_t m_interface
The interface index (which is stored the address corresponding of the prefix).
void SetDefaultGatewayRouter(Ipv6Address router)
Set the default gateway router.
Ipv6Address GetDefaultGatewayRouter() const
Get the default gateway address.
void StartValidTimer()
Start the valid timer.
void MarkPreferredTime()
Set the prefix as preferred.
Ipv6Address m_defaultGatewayRouter
Default gateway router.
bool IsPreferred() const
Test if the prefix is preferred.
Ipv6AutoconfiguredPrefix(Ptr< Node > node, uint32_t interface, Ipv6Address prefix, Ipv6Prefix mask, uint32_t preferredLifeTime, uint32_t validLifeTime, Ipv6Address router=Ipv6Address("::"))
Constructor.
uint32_t GetId() const
Get the prefix identifier.
void MarkValidTime()
Set the prefix as valid.
Describes an IPv6 prefix.
Definition: ipv6-address.h:455
A base class which provides memory management and object aggregation.
Definition: object.h:89
A simple virtual Timer class.
Definition: timer.h:74
Every class exported by the ns3 library is enclosed in the ns3 namespace.