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 * 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: Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
18 */
19
20#ifndef IPV6_ROUTING_TABLE_ENTRY_H
21#define IPV6_ROUTING_TABLE_ENTRY_H
22
23#include "ns3/ipv6-address.h"
24
25#include <list>
26#include <ostream>
27#include <vector>
28
29namespace ns3
30{
31
32/**
33 * \ingroup ipv6Routing
34 *
35 * \brief A record of an IPv6 route.
36 */
38{
39 public:
40 /**
41 * \brief Constructor.
42 */
44
45 /**
46 * \brief Copy constructor.
47 * \param route the route to copy
48 */
50
51 /**
52 * \brief Copy constructor.
53 * \param route the route to copy
54 */
56
57 /**
58 * \brief Destructor
59 */
60 virtual ~Ipv6RoutingTableEntry();
61
62 /**
63 * \brief Is the route entry correspond to a host ?
64 * \return true if the route is a host, false otherwise
65 */
66 bool IsHost() const;
67
68 /**
69 * \brief Get the destination.
70 * \return the IPv6 address of the destination of this route
71 */
72 Ipv6Address GetDest() const;
73
74 /**
75 * \brief Get the prefix to use (for multihomed link).
76 * \return prefix address to use
77 */
79
80 /**
81 * \brief Set the prefix to use.
82 * \param prefix prefix to use
83 */
84 void SetPrefixToUse(Ipv6Address prefix);
85
86 /**
87 * \brief Is the route entry correspond to a network ?
88 * \return true if the route is a network, false otherwise
89 */
90 bool IsNetwork() const;
91
92 /**
93 * \brief Get the destination network.
94 * \return the destination network
95 */
97
98 /**
99 * \brief Get the destination prefix.
100 * \return the destination prefix
101 */
103
104 /**
105 * \brief Is it the default route ?
106 * \return true if this route is a default route, false otherwise
107 */
108 bool IsDefault() const;
109
110 /**
111 * \brief Is it the gateway ?
112 * \return true if this route is a gateway, false otherwise
113 */
114 bool IsGateway() const;
115
116 /**
117 * \brief Get the gateway.
118 * \return the IPv6 address of the gateway
119 */
120 Ipv6Address GetGateway() const;
121
122 /**
123 * \brief Get the interface index.
124 * \return the index of the interface
125 */
126 uint32_t GetInterface() const;
127
128 /**
129 * \brief Create a route to a host.
130 * \param dest destination address
131 * \param nextHop next hop address to route the packet
132 * \param interface interface index
133 * \param prefixToUse prefix that should be used for source address for this destination
134 * \return IPv6Route object
135 */
137 Ipv6Address nextHop,
138 uint32_t interface,
139 Ipv6Address prefixToUse = Ipv6Address());
140
141 /**
142 * \brief Create a route to a host.
143 * \param dest destination address
144 * \param interface interface index
145 * \return IPv6Route object
146 */
148
149 /**
150 * \brief Create a route to a network.
151 * \param network network address
152 * \param networkPrefix network prefix
153 * \param nextHop next hop address to route the packet
154 * \param interface interface index
155 * \return IPv6Route object
156 */
158 Ipv6Prefix networkPrefix,
159 Ipv6Address nextHop,
160 uint32_t interface);
161
162 /**
163 * \brief Create a route to a network.
164 * \param network network address
165 * \param networkPrefix network prefix
166 * \param nextHop next hop address to route the packet
167 * \param interface interface index
168 * \param prefixToUse prefix that should be used for source address for this destination
169 * \return IPv6Route object
170 */
172 Ipv6Prefix networkPrefix,
173 Ipv6Address nextHop,
174 uint32_t interface,
175 Ipv6Address prefixToUse);
176
177 /**
178 * \brief Create a route to a network.
179 * \param network network address
180 * \param networkPrefix network prefix
181 * \param interface interface index
182 * \return IPv6Route object
183 */
185 Ipv6Prefix networkPrefix,
186 uint32_t interface);
187
188 /**
189 * \brief Create a default route.
190 * \param nextHop next hop address to route the packet
191 * \param interface interface index
192 * \return IPv6Route object
193 */
195
196 private:
197 /**
198 * \brief Constructor.
199 * \param network network address
200 * \param prefix network prefix
201 * \param gateway the gateway
202 * \param interface the interface index
203 */
205 Ipv6Prefix prefix,
206 Ipv6Address gateway,
207 uint32_t interface);
208
209 /**
210 * \brief Constructor.
211 * \param network network address
212 * \param prefix network prefix
213 * \param interface the interface index
214 * \param prefixToUse prefix to use
215 */
217 Ipv6Prefix prefix,
218 uint32_t interface,
219 Ipv6Address prefixToUse);
220
221 /**
222 * \brief Constructor.
223 * \param network network address
224 * \param prefix network prefix
225 * \param gateway the gateway
226 * \param interface the interface index
227 * \param prefixToUse prefix to use
228 */
230 Ipv6Prefix prefix,
231 Ipv6Address gateway,
232 uint32_t interface,
233 Ipv6Address prefixToUse);
234
235 /**
236 * \brief Constructor.
237 * \param dest destination address
238 * \param prefix destination prefix
239 * \param interface interface index
240 */
241 Ipv6RoutingTableEntry(Ipv6Address dest, Ipv6Prefix prefix, uint32_t interface);
242
243 /**
244 * \brief Constructor.
245 * \param dest destination address
246 * \param gateway the gateway
247 * \param interface interface index
248 */
249 Ipv6RoutingTableEntry(Ipv6Address dest, Ipv6Address gateway, uint32_t interface);
250
251 /**
252 * \brief Constructor.
253 * \param dest destination address
254 * \param interface interface index
255 */
257
258 /**
259 * \brief IPv6 address of the destination.
260 */
262
263 /**
264 * \brief IPv6 prefix of the destination
265 */
267
268 /**
269 * \brief IPv6 address of the gateway.
270 */
272
273 /**
274 * \brief The interface index.
275 */
277
278 /**
279 * \brief Prefix to use.
280 */
282};
283
284/**
285 * \brief Stream insertion operator.
286 *
287 * \param os the reference to the output stream
288 * \param route the Ipv6 routing table entry
289 * \returns the reference to the output stream
290 */
291std::ostream& operator<<(std::ostream& os, const Ipv6RoutingTableEntry& route);
292
293/**
294 * \ingroup ipv6Routing
295 *
296 * \brief A record of an IPv6 multicast route.
297 */
299{
300 public:
301 /**
302 * \brief Constructor.
303 */
305
306 /**
307 * \brief Copy constructor.
308 * \param route the route to copy
309 */
311
312 /**
313 * \brief Copy constructor.
314 * \param route the route to copy
315 */
317
318 /**
319 * \brief Get the source of this route
320 * \return IPv6 address of the source of this route
321 */
322 Ipv6Address GetOrigin() const;
323
324 /**
325 * \brief Get the group.
326 * \return IPv6 address of the multicast group of this route
327 */
328 Ipv6Address GetGroup() const;
329
330 /**
331 * \brief Get the input interface address.
332 * \return input interface index
333 */
335
336 /**
337 * \brief Get the number of output interfaces of this route.
338 * \return number of output interfaces of this route.
339 */
341
342 /**
343 * \brief Get a specified output interface.
344 * \param n index
345 * \return a specified output interface
346 */
348
349 /**
350 * \brief Get all of the output interfaces of this route.
351 * \return a vector of all output interfaces of this route
352 */
353 std::vector<uint32_t> GetOutputInterfaces() const;
354
355 /**
356 * \brief Create a multicast route.
357 * \param origin IPv6 address of the origin source
358 * \param group Ipv6Address of the group
359 * \param inputInterface interface number
360 * \param outputInterfaces list of output interface number
361 * \return a multicast route
362 */
364 Ipv6Address origin,
365 Ipv6Address group,
366 uint32_t inputInterface,
367 std::vector<uint32_t> outputInterfaces);
368
369 private:
370 /**
371 * \brief Constructor.
372 * \param origin IPv6 address of the source
373 * \param group IPv6 address of the group
374 * \param inputInterface interface number
375 * \param outputInterfaces list of output interface number
376 */
378 Ipv6Address group,
379 uint32_t inputInterface,
380 std::vector<uint32_t> outputInterfaces);
381
382 /**
383 * \brief The IPv6 address of the source.
384 */
386
387 /**
388 * \brief The IPv6 address of the group.
389 */
391
392 /**
393 * \brief The input interface.
394 */
396
397 /**
398 * \brief The output interfaces.
399 */
400 std::vector<uint32_t> m_outputInterfaces;
401};
402
403/**
404 * \brief Stream insertion operator.
405 *
406 * \param os the reference to the output stream
407 * \param route the Ipv6 multicast routing table entry
408 * \returns the reference to the output stream
409 */
410std::ostream& operator<<(std::ostream& os, const Ipv6MulticastRoutingTableEntry& route);
411
412} /* namespace ns3 */
413
414#endif /* IPV6_ROUTING_TABLE_ENTRY_H */
Describes an IPv6 address.
Definition: ipv6-address.h:49
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.
Definition: ipv6-address.h:455
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:159