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