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 
void SetDefaultGatewayRouter(Ipv6Address router)
Set the default gateway router.
void SetInterface(uint32_t interface)
Set the interface.
A simple virtual Timer class.
Definition: timer.h:73
void RemoveMe()
Remove this prefix from the prefix list.
Ipv6AutoconfiguredPrefix(Ptr< Node > node, uint32_t interface, Ipv6Address prefix, Ipv6Prefix mask, uint32_t preferredLifeTime, uint32_t validLifeTime, Ipv6Address router=Ipv6Address("::"))
Constructor.
void SetValidLifeTime(uint32_t v)
Set the prefix valid life time.
bool IsPreferred() const
Test if the prefix is preferred.
Ipv6Address m_defaultGatewayRouter
Default gateway router.
Ipv6Address GetPrefix() const
Get the prefix address.
uint32_t GetInterface() const
Get the interface index.
uint32_t GetId() const
Get the prefix identifier.
void SetMask(Ipv6Prefix mask)
Set the bitmask prefix.
void StopValidTimer()
Stop the valid timer.
void StartValidTimer()
Start the valid timer.
void FunctionValidTimeout()
Signal that the valid time expired.
void SetValid()
Set the prefix as valid.
uint32_t m_id
the identifier of this prefix.
uint32_t GetValidLifeTime(void) const
Get the prefix valid life time.
uint32_t m_interface
The interface index (which is stored the address corresponding of the prefix).
void SetPreferredLifeTime(uint32_t p)
Set the prefix preferred life time.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ipv6Address m_prefix
The prefix IPv6 address.
static uint32_t m_prefixId
a static identifier.
void FunctionPreferredTimeout()
Signal that the preferred time expired and start the valid timer.
Timer m_validTimer
the timer for valid life time.
uint32_t m_validLifeTime
the valid life time.
void MarkValidTime()
Set the prefix as valid.
Describes an IPv6 address.
Definition: ipv6-address.h:49
uint32_t m_preferredLifeTime
the preferred life time.
void SetPreferred()
Set the prefix as preferred.
bool IsValid() const
Test if the prefix is valid.
bool m_preferred
true if the prefix is preferred.
Describes an IPv6 prefix.
Definition: ipv6-address.h:455
Ipv6Prefix m_mask
The prefix bitmask (length).
void StopPreferredTimer()
Stop the preferred timer.
bool m_valid
true if the prefix is valid.
Ipv6Address GetDefaultGatewayRouter() const
Get the default gateway address.
Ipv6Prefix GetMask() const
Get the bitmask prefix.
A base class which provides memory management and object aggregation.
Definition: object.h:87
uint32_t GetPreferredLifeTime() const
Get the prefix preferred life time.
void StartPreferredTimer()
Start the preferred timer.
void SetPrefix(Ipv6Address prefix)
Set the prefix address.
Timer m_preferredTimer
the timer for preferred life time.
void MarkPreferredTime()
Set the prefix as preferred.