A Discrete-Event Network Simulator
API
ipv6-autoconfigured-prefix.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2008-2009 Telecom Bretagne
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: Mehdi Benamor <benamor.mehdi@ensi.rnu.tn>
19  */
20 
21 #ifndef IPV6_AUTOCONFIGURED_PREFIX_H
22 #define IPV6_AUTOCONFIGURED_PREFIX_H
23 
24 #include <stdint.h>
25 
26 #include <list>
27 #include <vector>
28 #include <ostream>
29 
30 #include "ns3/timer.h"
31 #include "ns3/ipv6-address.h"
32 
33 namespace ns3
34 {
35 
42 {
43 public:
54  Ipv6AutoconfiguredPrefix (Ptr<Node> node, uint32_t interface, Ipv6Address prefix, Ipv6Prefix mask, uint32_t preferredLifeTime, uint32_t validLifeTime, Ipv6Address router = Ipv6Address ("::"));
55 
60 
66 
72 
77  uint32_t GetInterface () const;
78 
83  void SetInterface (uint32_t interface);
84 
89  uint32_t GetPreferredLifeTime () const;
90 
95  void SetPreferredLifeTime (uint32_t p);
96 
101  uint32_t GetValidLifeTime (void) const;
102 
107  void SetValidLifeTime (uint32_t v);
108 
113  bool IsPreferred () const;
114 
119  bool IsValid () const;
120 
124  void SetPreferred ();
125 
129  void SetValid ();
130 
134  void StartPreferredTimer ();
135 
139  void StartValidTimer ();
140 
144  void StopPreferredTimer ();
145 
149  void StopValidTimer ();
150 
154  void MarkPreferredTime ();
155 
159  void MarkValidTime ();
160 
164  void FunctionPreferredTimeout ();
165 
169  void FunctionValidTimeout ();
170 
174  void RemoveMe ();
175 
180  uint32_t GetId () const;
181 
186  Ipv6Address GetPrefix () const;
187 
192  void SetPrefix (Ipv6Address prefix);
193 
198  Ipv6Prefix GetMask () const;
199 
204  void SetMask (Ipv6Prefix mask);
205 
206 private:
210  static uint32_t m_prefixId;
211 
215  uint32_t m_id;
216 
221 
226 
231 
240 
245  uint32_t m_interface;
246 
250  uint32_t m_validLifeTime;
251 
256 
261 
265  bool m_valid;
266 
271 
276 };
277 
278 } /* namespace ns3 */
279 
280 #endif /* IPV6_AUTOCONFIGURED_PREFIX_H */
281 
Describes an IPv6 address.
Definition: ipv6-address.h:50
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.
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.
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 GetValidLifeTime(void) const
Get the prefix valid life time.
uint32_t GetId() const
Get the prefix identifier.
void MarkValidTime()
Set the prefix as valid.
Describes an IPv6 prefix.
Definition: ipv6-address.h:456
A base class which provides memory management and object aggregation.
Definition: object.h:88
A simple virtual Timer class.
Definition: timer.h:74
Every class exported by the ns3 library is enclosed in the ns3 namespace.