A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ipv6-routing-table-entry.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007-2009 Strasbourg University
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
7 */
8
9#ifndef IPV6_ROUTING_TABLE_ENTRY_H
10#define IPV6_ROUTING_TABLE_ENTRY_H
11
12#include "ns3/ipv6-address.h"
13
14#include <list>
15#include <ostream>
16#include <vector>
17
18namespace ns3
19{
20
21/**
22 * @ingroup ipv6Routing
23 *
24 * @brief A record of an IPv6 route.
25 */
27{
28 public:
29 /**
30 * @brief Constructor.
31 */
33
34 /**
35 * @brief Copy constructor.
36 * @param route the route to copy
37 */
39
40 /**
41 * @brief Copy constructor.
42 * @param route the route to copy
43 */
45
46 /**
47 * @brief Destructor
48 */
49 virtual ~Ipv6RoutingTableEntry();
50
51 /**
52 * @brief Is the route entry correspond to a host ?
53 * @return true if the route is a host, false otherwise
54 */
55 bool IsHost() const;
56
57 /**
58 * @brief Get the destination.
59 * @return the IPv6 address of the destination of this route
60 */
61 Ipv6Address GetDest() const;
62
63 /**
64 * @brief Get the prefix to use (for multihomed link).
65 * @return prefix address to use
66 */
68
69 /**
70 * @brief Set the prefix to use.
71 * @param prefix prefix to use
72 */
73 void SetPrefixToUse(Ipv6Address prefix);
74
75 /**
76 * @brief Is the route entry correspond to a network ?
77 * @return true if the route is a network, false otherwise
78 */
79 bool IsNetwork() const;
80
81 /**
82 * @brief Get the destination network.
83 * @return the destination network
84 */
86
87 /**
88 * @brief Get the destination prefix.
89 * @return the destination prefix
90 */
92
93 /**
94 * @brief Is it the default route ?
95 * @return true if this route is a default route, false otherwise
96 */
97 bool IsDefault() const;
98
99 /**
100 * @brief Is it the gateway ?
101 * @return true if this route is a gateway, false otherwise
102 */
103 bool IsGateway() const;
104
105 /**
106 * @brief Get the gateway.
107 * @return the IPv6 address of the gateway
108 */
109 Ipv6Address GetGateway() const;
110
111 /**
112 * @brief Get the interface index.
113 * @return the index of the interface
114 */
115 uint32_t GetInterface() const;
116
117 /**
118 * @brief Create a route to a host.
119 * @param dest destination address
120 * @param nextHop next hop address to route the packet
121 * @param interface interface index
122 * @param prefixToUse prefix that should be used for source address for this destination
123 * @return IPv6Route object
124 */
126 Ipv6Address nextHop,
127 uint32_t interface,
128 Ipv6Address prefixToUse = Ipv6Address());
129
130 /**
131 * @brief Create a route to a host.
132 * @param dest destination address
133 * @param interface interface index
134 * @return IPv6Route object
135 */
137
138 /**
139 * @brief Create a route to a network.
140 * @param network network address
141 * @param networkPrefix network prefix
142 * @param nextHop next hop address to route the packet
143 * @param interface interface index
144 * @return IPv6Route object
145 */
147 Ipv6Prefix networkPrefix,
148 Ipv6Address nextHop,
149 uint32_t interface);
150
151 /**
152 * @brief Create a route to a network.
153 * @param network network address
154 * @param networkPrefix network prefix
155 * @param nextHop next hop address to route the packet
156 * @param interface interface index
157 * @param prefixToUse prefix that should be used for source address for this destination
158 * @return IPv6Route object
159 */
161 Ipv6Prefix networkPrefix,
162 Ipv6Address nextHop,
163 uint32_t interface,
164 Ipv6Address prefixToUse);
165
166 /**
167 * @brief Create a route to a network.
168 * @param network network address
169 * @param networkPrefix network prefix
170 * @param interface interface index
171 * @return IPv6Route object
172 */
174 Ipv6Prefix networkPrefix,
175 uint32_t interface);
176
177 /**
178 * @brief Create a default route.
179 * @param nextHop next hop address to route the packet
180 * @param interface interface index
181 * @return IPv6Route object
182 */
184
185 private:
186 /**
187 * @brief Constructor.
188 * @param network network address
189 * @param prefix network prefix
190 * @param gateway the gateway
191 * @param interface the interface index
192 */
194 Ipv6Prefix prefix,
195 Ipv6Address gateway,
196 uint32_t interface);
197
198 /**
199 * @brief Constructor.
200 * @param network network address
201 * @param prefix network prefix
202 * @param interface the interface index
203 * @param prefixToUse prefix to use
204 */
206 Ipv6Prefix prefix,
207 uint32_t interface,
208 Ipv6Address prefixToUse);
209
210 /**
211 * @brief Constructor.
212 * @param network network address
213 * @param prefix network prefix
214 * @param gateway the gateway
215 * @param interface the interface index
216 * @param prefixToUse prefix to use
217 */
219 Ipv6Prefix prefix,
220 Ipv6Address gateway,
221 uint32_t interface,
222 Ipv6Address prefixToUse);
223
224 /**
225 * @brief Constructor.
226 * @param dest destination address
227 * @param prefix destination prefix
228 * @param interface interface index
229 */
230 Ipv6RoutingTableEntry(Ipv6Address dest, Ipv6Prefix prefix, uint32_t interface);
231
232 /**
233 * @brief Constructor.
234 * @param dest destination address
235 * @param gateway the gateway
236 * @param interface interface index
237 */
238 Ipv6RoutingTableEntry(Ipv6Address dest, Ipv6Address gateway, uint32_t interface);
239
240 /**
241 * @brief Constructor.
242 * @param dest destination address
243 * @param interface interface index
244 */
246
247 /**
248 * @brief IPv6 address of the destination.
249 */
251
252 /**
253 * @brief IPv6 prefix of the destination
254 */
256
257 /**
258 * @brief IPv6 address of the gateway.
259 */
261
262 /**
263 * @brief The interface index.
264 */
266
267 /**
268 * @brief Prefix to use.
269 */
271};
272
273/**
274 * @brief Stream insertion operator.
275 *
276 * @param os the reference to the output stream
277 * @param route the Ipv6 routing table entry
278 * @returns the reference to the output stream
279 */
280std::ostream& operator<<(std::ostream& os, const Ipv6RoutingTableEntry& route);
281
282/**
283 * @ingroup ipv6Routing
284 *
285 * @brief A record of an IPv6 multicast route.
286 */
288{
289 public:
290 /**
291 * @brief Constructor.
292 */
294
295 /**
296 * @brief Copy constructor.
297 * @param route the route to copy
298 */
300
301 /**
302 * @brief Copy constructor.
303 * @param route the route to copy
304 */
306
307 /**
308 * @brief Get the source of this route
309 * @return IPv6 address of the source of this route
310 */
311 Ipv6Address GetOrigin() const;
312
313 /**
314 * @brief Get the group.
315 * @return IPv6 address of the multicast group of this route
316 */
317 Ipv6Address GetGroup() const;
318
319 /**
320 * @brief Get the input interface address.
321 * @return input interface index
322 */
324
325 /**
326 * @brief Get the number of output interfaces of this route.
327 * @return number of output interfaces of this route.
328 */
330
331 /**
332 * @brief Get a specified output interface.
333 * @param n index
334 * @return a specified output interface
335 */
337
338 /**
339 * @brief Get all of the output interfaces of this route.
340 * @return a vector of all output interfaces of this route
341 */
342 std::vector<uint32_t> GetOutputInterfaces() const;
343
344 /**
345 * @brief Create a multicast route.
346 * @param origin IPv6 address of the origin source
347 * @param group Ipv6Address of the group
348 * @param inputInterface interface number
349 * @param outputInterfaces list of output interface number
350 * @return a multicast route
351 */
353 Ipv6Address origin,
354 Ipv6Address group,
355 uint32_t inputInterface,
356 std::vector<uint32_t> outputInterfaces);
357
358 private:
359 /**
360 * @brief Constructor.
361 * @param origin IPv6 address of the source
362 * @param group IPv6 address of the group
363 * @param inputInterface interface number
364 * @param outputInterfaces list of output interface number
365 */
367 Ipv6Address group,
368 uint32_t inputInterface,
369 std::vector<uint32_t> outputInterfaces);
370
371 /**
372 * @brief The IPv6 address of the source.
373 */
375
376 /**
377 * @brief The IPv6 address of the group.
378 */
380
381 /**
382 * @brief The input interface.
383 */
385
386 /**
387 * @brief The output interfaces.
388 */
389 std::vector<uint32_t> m_outputInterfaces;
390};
391
392/**
393 * @brief Stream insertion operator.
394 *
395 * @param os the reference to the output stream
396 * @param route the Ipv6 multicast routing table entry
397 * @returns the reference to the output stream
398 */
399std::ostream& operator<<(std::ostream& os, const Ipv6MulticastRoutingTableEntry& route);
400
401} /* namespace ns3 */
402
403#endif /* IPV6_ROUTING_TABLE_ENTRY_H */
Describes an IPv6 address.
A record of an IPv6 multicast route.
uint32_t GetInputInterface() const
Get the input interface address.
uint32_t GetOutputInterface(uint32_t n) const
Get a specified output interface.
Ipv6Address GetGroup() const
Get the group.
uint32_t m_inputInterface
The input interface.
Ipv6MulticastRoutingTableEntry()
Constructor.
std::vector< uint32_t > GetOutputInterfaces() const
Get all of the output interfaces of this route.
static Ipv6MulticastRoutingTableEntry CreateMulticastRoute(Ipv6Address origin, Ipv6Address group, uint32_t inputInterface, std::vector< uint32_t > outputInterfaces)
Create a multicast route.
std::vector< uint32_t > m_outputInterfaces
The output interfaces.
uint32_t GetNOutputInterfaces() const
Get the number of output interfaces of this route.
Ipv6Address GetOrigin() const
Get the source of this route.
Ipv6Address m_group
The IPv6 address of the group.
Ipv6Address m_origin
The IPv6 address of the source.
Describes an IPv6 prefix.
A record of an IPv6 route.
bool IsNetwork() const
Is the route entry correspond to a network ?
static Ipv6RoutingTableEntry CreateDefaultRoute(Ipv6Address nextHop, uint32_t interface)
Create a default route.
Ipv6Address m_gateway
IPv6 address of the gateway.
bool IsDefault() const
Is it the default route ?
Ipv6RoutingTableEntry()
Constructor.
Ipv6Address GetDest() const
Get the destination.
Ipv6Address GetDestNetwork() const
Get the destination network.
Ipv6Address GetPrefixToUse() const
Get the prefix to use (for multihomed link).
Ipv6Address m_dest
IPv6 address of the destination.
static Ipv6RoutingTableEntry CreateHostRouteTo(Ipv6Address dest, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse=Ipv6Address())
Create a route to a host.
bool IsHost() const
Is the route entry correspond to a host ?
void SetPrefixToUse(Ipv6Address prefix)
Set the prefix to use.
uint32_t GetInterface() const
Get the interface index.
Ipv6Address m_prefixToUse
Prefix to use.
Ipv6Prefix m_destNetworkPrefix
IPv6 prefix of the destination.
virtual ~Ipv6RoutingTableEntry()
Destructor.
uint32_t m_interface
The interface index.
Ipv6Prefix GetDestNetworkPrefix() const
Get the destination prefix.
static Ipv6RoutingTableEntry CreateNetworkRouteTo(Ipv6Address network, Ipv6Prefix networkPrefix, Ipv6Address nextHop, uint32_t interface)
Create a route to a network.
Ipv6Address GetGateway() const
Get the gateway.
bool IsGateway() const
Is it the gateway ?
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition angles.cc:148