A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
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
31namespace ns3
32{
33class Node;
34
35/**
36 * \ingroup ipv6
37 *
38 * \brief Router prefix information.
39 */
41{
42 public:
43 /**
44 * \brief Constructor.
45 * \param node node
46 * \param interface interface index
47 * \param prefix IPv6 address
48 * \param mask bitmask prefix
49 * \param preferredLifeTime the preferred life time
50 * \param validLifeTime the valid life time
51 * \param router if it the prefix that configure the default gateway
52 */
54 uint32_t interface,
55 Ipv6Address prefix,
56 Ipv6Prefix mask,
57 uint32_t preferredLifeTime,
58 uint32_t validLifeTime,
59 Ipv6Address router = Ipv6Address("::"));
60
61 /**
62 * \brief Destructor.
63 */
65
66 /**
67 * \brief Set the default gateway router.
68 * \param router IPv6 link-local address of the default router
69 */
71
72 /**
73 * \brief Get the default gateway address.
74 * \return IPv6 link-local address of the default router
75 */
77
78 /**
79 * \brief Get the interface index.
80 * \return interface index
81 */
82 uint32_t GetInterface() const;
83
84 /**
85 * \brief Set the interface.
86 * \param interface interface index to set
87 */
88 void SetInterface(uint32_t interface);
89
90 /**
91 * \brief Get the prefix preferred life time.
92 * \return preferred life time
93 */
95
96 /**
97 * \brief Set the prefix preferred life time.
98 * \param p the prefix preferred life time
99 */
101
102 /**
103 * \brief Get the prefix valid life time.
104 * \return valid life time
105 */
107
108 /**
109 * \brief Set the prefix valid life time.
110 * \param v the prefix valid life time
111 */
113
114 /**
115 * \brief Test if the prefix is preferred.
116 * \return true if prefix is in preferred state, false otherwise
117 */
118 bool IsPreferred() const;
119
120 /**
121 * \brief Test if the prefix is valid.
122 * \return true if prefix is in valid state, false otherwise
123 */
124 bool IsValid() const;
125
126 /**
127 * \brief Set the prefix as preferred.
128 */
129 void SetPreferred();
130
131 /**
132 * \brief Set the prefix as valid.
133 */
134 void SetValid();
135
136 /**
137 * \brief Start the preferred timer.
138 */
139 void StartPreferredTimer();
140
141 /**
142 * \brief Start the valid timer.
143 */
144 void StartValidTimer();
145
146 /**
147 * \brief Stop the preferred timer.
148 */
149 void StopPreferredTimer();
150
151 /**
152 * \brief Stop the valid timer.
153 */
154 void StopValidTimer();
155
156 /**
157 * \brief Set the prefix as preferred.
158 */
159 void MarkPreferredTime();
160
161 /**
162 * \brief Set the prefix as valid.
163 */
164 void MarkValidTime();
165
166 /**
167 * \brief Signal that the preferred time expired and start the valid timer.
168 */
170
171 /**
172 * \brief Signal that the valid time expired.
173 */
175
176 /**
177 * \brief Remove this prefix from the prefix list.
178 */
179 void RemoveMe();
180
181 /**
182 * \brief Get the prefix identifier.
183 * \return id of the prefix.
184 */
185 uint32_t GetId() const;
186
187 /**
188 * \brief Get the prefix address.
189 * \return prefix address
190 */
191 Ipv6Address GetPrefix() const;
192
193 /**
194 * \brief Set the prefix address.
195 * \param prefix prefix address to set
196 */
197 void SetPrefix(Ipv6Address prefix);
198
199 /**
200 * \brief Get the bitmask prefix.
201 * \return bitmask prefix
202 */
203 Ipv6Prefix GetMask() const;
204
205 /**
206 * \brief Set the bitmask prefix.
207 * \param mask prefix
208 */
209 void SetMask(Ipv6Prefix mask);
210
211 private:
212 /**
213 * \brief a static identifier.
214 */
216
217 /**
218 * \brief the identifier of this prefix.
219 */
221
222 /**
223 * \brief The node.
224 */
226
227 /**
228 * \brief The prefix IPv6 address.
229 */
231
232 /**
233 * \brief The prefix bitmask (length).
234 */
236
237 /**
238 * \brief Default gateway router.
239 *
240 * If the RA received also configured the default gateway,
241 * this variable has the link-local address. Otherwise this
242 * is "::"
243 */
245
246 /**
247 * \brief The interface index (which is stored the address
248 * corresponding of the prefix).
249 */
251
252 /**
253 * \brief the valid life time.
254 */
256
257 /**
258 * \brief the preferred life time.
259 */
261
262 /**
263 * \brief true if the prefix is preferred.
264 */
266
267 /**
268 * \brief true if the prefix is valid.
269 */
271
272 /**
273 * \brief the timer for preferred life time.
274 */
276
277 /**
278 * \brief the timer for valid life time.
279 */
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.
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
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
A simple virtual Timer class.
Definition: timer.h:78
Every class exported by the ns3 library is enclosed in the ns3 namespace.