A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ipv6-autoconfigured-prefix.h
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 
41 {
42 public:
53  Ipv6AutoconfiguredPrefix (Ptr<Node> node, uint32_t interface, Ipv6Address prefix, Ipv6Prefix mask, uint32_t preferredLifeTime, uint32_t validLifeTime, Ipv6Address router = Ipv6Address ("::"));
54 
59 
65 
71 
76  uint32_t GetInterface () const;
77 
82  void SetInterface (uint32_t interface);
83 
88  uint32_t GetPreferredLifeTime () const;
89 
94  void SetPreferredLifeTime (uint32_t p);
95 
100  uint32_t GetValidLifeTime (void) const;
101 
106  void SetValidLifeTime (uint32_t v);
107 
112  bool IsPreferred () const;
113 
118  bool IsValid () const;
119 
123  void SetPreferred ();
124 
128  void SetValid ();
129 
133  void StartPreferredTimer ();
134 
138  void StartValidTimer ();
139 
143  void StopPreferredTimer ();
144 
148  void StopValidTimer ();
149 
153  void MarkPreferredTime ();
154 
158  void MarkValidTime ();
159 
163  void FunctionPreferredTimeout ();
164 
168  void FunctionValidTimeout ();
169 
173  void RemoveMe ();
174 
179  uint32_t GetId () const;
180 
185  Ipv6Address GetPrefix () const;
186 
191  void SetPrefix (Ipv6Address prefix);
192 
197  Ipv6Prefix GetMask () const;
198 
203  void SetMask (Ipv6Prefix mask);
204 
205 private:
209  static uint32_t m_prefixId;
210 
214  uint32_t m_id;
215 
220 
225 
230 
239 
244  uint32_t m_interface;
245 
249  uint32_t m_validLifeTime;
250 
255 
260 
264  bool m_valid;
265 
270 
275 };
276 
277 } /* namespace ns3 */
278 
279 #endif /* IPV6_AUTOCONFIGURED_PREFIX_H */
280 
void SetDefaultGatewayRouter(Ipv6Address router)
Set the default gateway router.
void SetInterface(uint32_t interface)
Set the interface.
a simple Timer class
Definition: timer.h:45
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.
Ipv6Address m_defaultGatewayRouter
Default gateway router.
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 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.
uint32_t GetId() const
Get the prefix identifier.
Ipv6Address m_prefix
The prefix IP6 address.
Ipv6Address GetPrefix() const
Get the prefix address.
bool IsValid() const
Test if the prefix is valid.
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.
Ipv6Prefix GetMask() const
Get the bitmask prefix.
uint32_t m_validLifeTime
the valid life time.
void MarkValidTime()
Set the prefix as valid.
Describes an IPv6 address.
Definition: ipv6-address.h:44
uint32_t GetInterface() const
Get the interface index.
uint32_t m_preferredLifeTime
the preferred life time.
void SetPreferred()
Set the prefix as preferred.
bool m_preferred
true if the prefix is preferred.
uint32_t GetPreferredLifeTime() const
Get the prefix preferred life time.
uint32_t GetValidLifeTime(void) const
Get the prefix valid life time.
Describes an IPv6 prefix. It is just a bitmask like Ipv4Mask.
Definition: ipv6-address.h:326
Ipv6Prefix m_mask
The prefix bitmask (length).
bool IsPreferred() const
Test if the prefix is preferred.
void StopPreferredTimer()
Stop the preferred timer.
bool m_valid
true if the prefix is valid.
a base class which provides memory management and object aggregation
Definition: object.h:63
Ipv6Address GetDefaultGatewayRouter() const
Get the default gateway address.
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.