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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Mehdi Benamor <benamor.mehdi@ensi.rnu.tn>
7 */
8
9#ifndef IPV6_AUTOCONFIGURED_PREFIX_H
10#define IPV6_AUTOCONFIGURED_PREFIX_H
11
12#include "ns3/ipv6-address.h"
13#include "ns3/timer.h"
14
15#include <list>
16#include <ostream>
17#include <stdint.h>
18#include <vector>
19
20namespace ns3
21{
22class Node;
23
24/**
25 * \ingroup ipv6
26 *
27 * \brief Router prefix information.
28 */
30{
31 public:
32 /**
33 * \brief Constructor.
34 * \param node node
35 * \param interface interface index
36 * \param prefix IPv6 address
37 * \param mask bitmask prefix
38 * \param preferredLifeTime the preferred life time
39 * \param validLifeTime the valid life time
40 * \param router if it the prefix that configure the default gateway
41 */
43 uint32_t interface,
44 Ipv6Address prefix,
45 Ipv6Prefix mask,
46 uint32_t preferredLifeTime,
47 uint32_t validLifeTime,
48 Ipv6Address router = Ipv6Address("::"));
49
50 /**
51 * \brief Destructor.
52 */
54
55 /**
56 * \brief Set the default gateway router.
57 * \param router IPv6 link-local address of the default router
58 */
60
61 /**
62 * \brief Get the default gateway address.
63 * \return IPv6 link-local address of the default router
64 */
66
67 /**
68 * \brief Get the interface index.
69 * \return interface index
70 */
71 uint32_t GetInterface() const;
72
73 /**
74 * \brief Set the interface.
75 * \param interface interface index to set
76 */
77 void SetInterface(uint32_t interface);
78
79 /**
80 * \brief Get the prefix preferred life time.
81 * \return preferred life time
82 */
84
85 /**
86 * \brief Set the prefix preferred life time.
87 * \param p the prefix preferred life time
88 */
90
91 /**
92 * \brief Get the prefix valid life time.
93 * \return valid life time
94 */
96
97 /**
98 * \brief Set the prefix valid life time.
99 * \param v the prefix valid life time
100 */
102
103 /**
104 * \brief Test if the prefix is preferred.
105 * \return true if prefix is in preferred state, false otherwise
106 */
107 bool IsPreferred() const;
108
109 /**
110 * \brief Test if the prefix is valid.
111 * \return true if prefix is in valid state, false otherwise
112 */
113 bool IsValid() const;
114
115 /**
116 * \brief Set the prefix as preferred.
117 */
118 void SetPreferred();
119
120 /**
121 * \brief Set the prefix as valid.
122 */
123 void SetValid();
124
125 /**
126 * \brief Start the preferred timer.
127 */
128 void StartPreferredTimer();
129
130 /**
131 * \brief Start the valid timer.
132 */
133 void StartValidTimer();
134
135 /**
136 * \brief Stop the preferred timer.
137 */
138 void StopPreferredTimer();
139
140 /**
141 * \brief Stop the valid timer.
142 */
143 void StopValidTimer();
144
145 /**
146 * \brief Set the prefix as preferred.
147 */
148 void MarkPreferredTime();
149
150 /**
151 * \brief Set the prefix as valid.
152 */
153 void MarkValidTime();
154
155 /**
156 * \brief Signal that the preferred time expired and start the valid timer.
157 */
159
160 /**
161 * \brief Signal that the valid time expired.
162 */
164
165 /**
166 * \brief Remove this prefix from the prefix list.
167 */
168 void RemoveMe();
169
170 /**
171 * \brief Get the prefix identifier.
172 * \return id of the prefix.
173 */
174 uint32_t GetId() const;
175
176 /**
177 * \brief Get the prefix address.
178 * \return prefix address
179 */
180 Ipv6Address GetPrefix() const;
181
182 /**
183 * \brief Set the prefix address.
184 * \param prefix prefix address to set
185 */
186 void SetPrefix(Ipv6Address prefix);
187
188 /**
189 * \brief Get the bitmask prefix.
190 * \return bitmask prefix
191 */
192 Ipv6Prefix GetMask() const;
193
194 /**
195 * \brief Set the bitmask prefix.
196 * \param mask prefix
197 */
198 void SetMask(Ipv6Prefix mask);
199
200 private:
201 /**
202 * \brief a static identifier.
203 */
205
206 /**
207 * \brief the identifier of this prefix.
208 */
210
211 /**
212 * \brief The node.
213 */
215
216 /**
217 * \brief The prefix IPv6 address.
218 */
220
221 /**
222 * \brief The prefix bitmask (length).
223 */
225
226 /**
227 * \brief Default gateway router.
228 *
229 * If the RA received also configured the default gateway,
230 * this variable has the link-local address. Otherwise this
231 * is "::"
232 */
234
235 /**
236 * \brief The interface index (which is stored the address
237 * corresponding of the prefix).
238 */
240
241 /**
242 * \brief the valid life time.
243 */
245
246 /**
247 * \brief the preferred life time.
248 */
250
251 /**
252 * \brief true if the prefix is preferred.
253 */
255
256 /**
257 * \brief true if the prefix is valid.
258 */
260
261 /**
262 * \brief the timer for preferred life time.
263 */
265
266 /**
267 * \brief the timer for valid life time.
268 */
270};
271
272} /* namespace ns3 */
273
274#endif /* IPV6_AUTOCONFIGURED_PREFIX_H */
Describes an IPv6 address.
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.
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.
A base class which provides memory management and object aggregation.
Definition object.h:78
Smart pointer class similar to boost::intrusive_ptr.
A simple virtual Timer class.
Definition timer.h:67
Every class exported by the ns3 library is enclosed in the ns3 namespace.