A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
global-routing.h
Go to the documentation of this file.
1/*
2 * Copyright 2008 University of Washington
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 */
7
8/**
9 * @ingroup ipv4Routing
10 * @defgroup globalrouting Global Routing.
11 *
12 * Performs pre-simulation static route computation
13 * on a layer-3 IPv4 topology.
14 *
15 * @section model Model
16 *
17 * ns-3 global routing performs pre-simulation static route computation
18 * on a layer-3 IPv4 topology. The user API from the script level is
19 * fairly minimal; once a topology has been constructed and addresses
20 * assigned, the user may call ns3::GlobalRouteManager::PopulateRoutingTables()
21 * and the simulator will initialize the routing database and set up
22 * static unicast forwarding tables for each node.
23 *
24 * The model assumes that all nodes on an ns-3 channel are reachable to
25 * one another, regardless of whether the nodes can use the channel
26 * successfully (in the case of wireless). Therefore, this model
27 * should typically be used only on wired topologies. Layer-2 bridge
28 * devices are supported. API does not yet exist to control the subset
29 * of a topology to which this global static routing is applied.
30 *
31 * If the topology changes during the simulation, by default, routing
32 * will not adjust. There are two ways to make it adjust.
33 * - Set the attribute Ipv4GlobalRouting::RespondToInterfaceEvents to true
34 * - Manually call the sequence of GlobalRouteManager methods to delete global
35 * routes, build global routing database, and initialize routes.
36 * There is a helper method that encapsulates this
37 * (Ipv4GlobalRoutingHelper::RecomputeRoutingTables())
38 *
39 * @section api API and Usage
40 *
41 * Users must include ns3/global-route-manager.h header file. After the
42 * IPv4 topology has been built and addresses assigned, users call
43 * ns3::GlobalRouteManager::PopulateRoutingTables (), prior to the
44 * ns3::Simulator::Run() call.
45 *
46 * There are two attributes of Ipv4GlobalRouting that govern behavior.
47 * - Ipv4GlobalRouting::RandomEcmpRouting
48 * - Ipv4GlobalRouting::RespondToInterfaceEvents
49 *
50 * @section impl Implementation
51 *
52 * A singleton object, ns3::GlobalRouteManager, builds a global routing
53 * database of information about the topology, and executes a Dijkstra
54 * Shortest Path First (SPF) algorithm on the topology for each node, and
55 * stores the computed routes in each node's IPv4 forwarding table by
56 * making use of the routing API in class ns3::Ipv4.
57 *
58 * The nodes that export data are those that have had an ns3::GlobalRouter
59 * object aggregated to them. The ns3::GlobalRouter can be thought of
60 * as a per-node agent that exports topology information to the
61 * ns3::GlobalRouteManager. When it comes time to build the global
62 * routing database, the list of nodes is iterated and each node with
63 * an ns3::GlobalRouter object is asked to export routing information
64 * concerning the links to which it is attached.
65 *
66 * The format of the data exported conforms to the OSPFv2 standard
67 * \RFC{2328}. In particular, the
68 * information is exported in the form of ns3::GlobalLSA objects that
69 * semantically match the Link State Advertisements of OSPF.
70 *
71 * By using a standard data format for reporting topology, existing
72 * OSPF route computation code can be reused, and that is what is done
73 * by the ns3::GlobalRouteManager. The main computation functions are
74 * ported from the quagga routing suite (https://www.nongnu.org/quagga/).
75 *
76 */
77
78#ifndef GLOBAL_ROUTING_H
79#define GLOBAL_ROUTING_H
80
82#include "ipv4-header.h"
84#include "ipv4.h"
88
89#include "ns3/ipv4-address.h"
90#include "ns3/ipv6-address.h"
91#include "ns3/ptr.h"
92#include "ns3/random-variable-stream.h"
93
94#include <list>
95#include <stdint.h>
96
97namespace ns3
98{
99
100class Packet;
101class NetDevice;
102class Ipv4Interface;
103class Ipv4Address;
104class Ipv4Header;
107class Node;
108template <typename>
110
111/**
112 * @ingroup ipv4
113 *
114 * @brief Global routing protocol for IPv4 stacks.
115 *
116 * In ns-3 we have the concept of a pluggable routing protocol. Routing
117 * protocols are added to a list maintained by the Ipv4L3Protocol. Every
118 * stack gets one routing protocol for free -- the Ipv4StaticRouting routing
119 * protocol is added in the constructor of the Ipv4L3Protocol (this is the
120 * piece of code that implements the functionality of the IP layer).
121 *
122 * As an option to running a dynamic routing protocol, a GlobalRouteManager
123 * object has been created to allow users to build routes for all participating
124 * nodes. One can think of this object as a "routing oracle"; it has
125 * an omniscient view of the topology, and can construct shortest path
126 * routes between all pairs of nodes. These routes must be stored
127 * somewhere in the node, so therefore this class Ipv4GlobalRouting
128 * is used as one of the pluggable routing protocols. It is kept distinct
129 * from Ipv4StaticRouting because these routes may be dynamically cleared
130 * and rebuilt in the middle of the simulation, while manually entered
131 * routes into the Ipv4StaticRouting may need to be kept distinct.
132 *
133 * This class deals with Ipv4 unicast routes only.
134 *
135 * @see Ipv4RoutingProtocol
136 * @see GlobalRouteManager
137 */
138template <typename T>
139class GlobalRouting : public std::enable_if_t<std::is_same_v<Ipv4RoutingProtocol, T> ||
140 std::is_same_v<Ipv6RoutingProtocol, T>,
141 T>
142{
143 template <typename>
145
146 /// Alias for determining whether the parent is Ipv4RoutingHelper or Ipv6RoutingHelper
147 static constexpr bool IsIpv4 = std::is_same_v<Ipv4RoutingProtocol, T>;
148 /// Alias for Ipv4 and Ipv6 classes
149 using Ip = typename std::conditional_t<IsIpv4, Ipv4, Ipv6>;
150 /// Alias for Ipv4Address and Ipv6Address classes
151 using IpAddress = typename std::conditional_t<IsIpv4, Ipv4Address, Ipv6Address>;
152 /// Alias for Ipv4RoutingProtocol and Ipv6RoutingProtocol classes
154 typename std::conditional_t<IsIpv4, Ipv4RoutingProtocol, Ipv6RoutingProtocol>;
155
156 /// Alias for Ipv4Header and Ipv6Header classes
157 using IpHeader = typename std::conditional_t<IsIpv4, Ipv4Header, Ipv6Header>;
158
159 /// Alias for Ipv4Route and Ipv6Route classes
160 using IpRoute = typename std::conditional_t<IsIpv4, Ipv4Route, Ipv6Route>;
161
162 /// Alias for Ipv4Mask And Ipv6Prefix
163 using IpMaskOrPrefix = typename std::conditional_t<IsIpv4, Ipv4Mask, Ipv6Prefix>;
164
165 /// Alias for Ipv4RoutingTableEntry and Ipv6RoutingTableEntry classes
167 typename std::conditional_t<IsIpv4, Ipv4RoutingTableEntry, Ipv6RoutingTableEntry>;
168
169 /// Alias for Ipv4Manager and Ipv6Manager classes
170 using IpManager = typename std::conditional_t<IsIpv4, Ipv4Manager, Ipv6Manager>;
171
172 /// Alias for Ipv4InterfaceAddress and Ipv6InterfaceAddress classes
174 typename std::conditional_t<IsIpv4, Ipv4InterfaceAddress, Ipv6InterfaceAddress>;
175
176 public:
177 /**
178 * @brief Get the type ID.
179 * @return the object TypeId
180 */
182 /**
183 * @brief Construct an empty Ipv4GlobalRouting routing protocol,
184 *
185 * The Ipv4GlobalRouting class supports host and network unicast routes.
186 * This method initializes the lists containing these routes to empty.
187 *
188 * @see Ipv4GlobalRouting
189 */
191 ~GlobalRouting() override;
192
193 // These methods inherited from base class
194
195 /* From Ipv4RoutingProtocol and Ipv6RoutingProtocol */
196
197 /**
198 * @brief Query routing cache for an existing route, for an outbound packet
199 * @param p packet to be routed. Note that this method may modify the packet.
200 * Callers may also pass in a null pointer.
201 * @param header input parameter (used to form key to search for the route)
202 * @param oif Output interface Netdevice. May be zero, or may be bound via
203 * socket options to a particular output interface.
204 * @param sockerr Output parameter; socket errno
205 *
206 * @returns a code that indicates what happened in the lookup
207 *
208 * @sa Ipv4RoutingProtocol::RouteOutput
209 * @sa Ipv6RoutingProtocol::RouteOutput
210 */
212 const IpHeader& header,
213 Ptr<NetDevice> oif,
214 Socket::SocketErrno& sockerr) override;
215
216 /// Callback for IPv4 unicast packets to be forwarded
219
220 /// Callback for IPv6 unicast packets to be forwarded
223
224 /// Callback for unicast packets to be forwarded
225 typedef typename std::conditional_t<IsIpv4, UnicastForwardCallbackv4, UnicastForwardCallbackv6>
227
228 /// Callback for IPv4 multicast packets to be forwarded
231
232 /// Callback for IPv6 multicast packets to be forwarded
233 typedef Callback<void,
237 const IpHeader&>
239
240 /// Callback for multicast packets to be forwarded
241 typedef
242 typename std::conditional_t<IsIpv4, MulticastForwardCallbackv4, MulticastForwardCallbackv6>
244
245 /// Callback for packets to be locally delivered
247
248 /// Callback for routing errors (e.g., no route found)
250
251 /**
252 * @brief Route an input packet (to be forwarded or locally delivered)
253 * @param p received packet
254 * @param header input parameter used to form a search key for a route
255 * @param idev Pointer to ingress network device
256 * @param ucb Callback for the case in which the packet is to be forwarded
257 * as unicast
258 * @param mcb Callback for the case in which the packet is to be forwarded
259 * as multicast
260 * @param lcb Callback for the case in which the packet is to be locally
261 * delivered
262 * @param ecb Callback to call if there is an error in forwarding
263 *
264 * @returns true if GlobalRouting class takes responsibility for
265 * forwarding or delivering the packet, false otherwise
266 *
267 * @sa Ipv4RoutingProtocol::RouteInput
268 * @sa Ipv6RoutingProtocol::RouteInput
269 */
271 const IpHeader& header,
273 const UnicastForwardCallback& ucb,
274 const MulticastForwardCallback& mcb,
275 const LocalDeliverCallback& lcb,
276 const ErrorCallback& ecb) override;
277
278 /**
279 * @param interface the index of the interface we are being notified about
280 *
281 * @sa Ipv4RoutingProtocol::NotifyInterfaceUp
282 * @sa Ipv6RoutingProtocol::NotifyInterfaceUp
283 */
284 void NotifyInterfaceUp(uint32_t interface) override;
285 /**
286 * @param interface the index of the interface we are being notified about
287 *
288 * @sa Ipv4RoutingProtocol::NotifyInterfaceDown
289 * @sa Ipv6RoutingProtocol::NotifyInterfaceDown
290 */
291 void NotifyInterfaceDown(uint32_t interface) override;
292 /**
293 * @param interface the index of the interface we are being notified about
294 * @param address a new address being added to an interface
295 *
296 * @sa Ipv4RoutingProtocol::NotifyAddAddress
297 * @sa Ipv6RoutingProtocol::NotifyAddAddress
298 */
299 void NotifyAddAddress(uint32_t interface, IpInterfaceAddress address) override;
300 /**
301 * @param interface the index of the interface we are being notified about
302 * @param address a new address being added to an interface
303 *
304 * @sa Ipv4RoutingProtocol::NotifyRemoveAddress
305 * @sa Ipv6RoutingProtocol::NotifyRemoveAddress
306 */
307 void NotifyRemoveAddress(uint32_t interface, IpInterfaceAddress address) override;
308
309 /**
310 * @brief Notify a new route.
311 *
312 * Typically this is used to add another route from IPv6 stack (i.e. ICMPv6
313 * redirect case, ...).
314 * @param dst destination address
315 * @param mask destination mask
316 * @param nextHop nextHop for this destination
317 * @param interface output interface
318 * @param prefixToUse prefix to use as source with this route
319 */
320 // These four methods each override a virtual in only one of the two possible
321 // base classes (Ipv4RoutingProtocol or Ipv6RoutingProtocol), so they cannot
322 // be marked 'override' without causing a hard error in the other
323 // specialization. Suppress the resulting Clang diagnostic; GCC does not
324 // emit an equivalent warning, so no guard is needed there.
325#ifdef __clang__
326#pragma clang diagnostic push
327#pragma clang diagnostic ignored "-Winconsistent-missing-override"
328#endif
329 // NOLINTBEGIN(modernize-use-override)
331 Ipv6Prefix mask,
332 Ipv6Address nextHop,
333 uint32_t interface,
334 Ipv6Address prefixToUse = Ipv6Address::GetZero());
335 /**
336 * @brief Notify route removing.
337 * @param dst destination address
338 * @param mask destination mask
339 * @param nextHop nextHop for this destination
340 * @param interface output interface
341 * @param prefixToUse prefix to use as source with this route
342 */
344 Ipv6Prefix mask,
345 Ipv6Address nextHop,
346 uint32_t interface,
347 Ipv6Address prefixToUse = Ipv6Address::GetZero());
348
349 /* From IPv4RoutingProtocol */
350 /**
351 * @brief Typically, invoked directly or indirectly from ns3::Ipv4::SetRoutingProtocol
352 *
353 * @param ipv4 the ipv4 object this routing protocol is being associated with
354 *
355 * @sa Ipv4RoutingProtocol::SetIpv4
356 */
357 void SetIpv4(Ptr<Ip> ipv4);
358
359 /* From IPv6RoutingProtocol */
360 /**
361 * @brief Typically, invoked directly or indirectly from ns3::Ipv6::SetRoutingProtocol
362 *
363 * @param ipv6 the ipv6 object this routing protocol is being associated with
364 *
365 * @sa Ipv6RoutingProtocol::SetIpv6
366 */
367 void SetIpv6(Ptr<Ip> ipv6);
368 // NOLINTEND(modernize-use-override)
369
370#ifdef __clang__
371#pragma clang diagnostic pop
372#endif
373
374 /**
375 * @brief Print the Routing Table entries
376 *
377 * @param stream The ostream the Routing table is printed to
378 * @param unit The time unit to be used in the report
379 *
380 * @sa Ipv4RoutingProtocol::PrintRoutingTable
381 * @sa Ipv6RoutingProtocol::PrintRoutingTable
382 */
384 Time::Unit unit = Time::S) const override;
385
386 /**
387 * @brief Add a host route to the global routing table.
388 *
389 * @param dest The Ipv4Address destination for this route.
390 * @param nextHop The Ipv4Address of the next hop in the route.
391 * @param interface The network interface index used to send packets to the
392 * destination.
393 *
394 * @see Ipv4Address
395 */
396 void AddHostRouteTo(IpAddress dest, IpAddress nextHop, uint32_t interface);
397 /**
398 * @brief Add a host route to the global routing table.
399 *
400 * @param dest The Ipv4Address destination for this route.
401 * @param interface The network interface index used to send packets to the
402 * destination.
403 *
404 * @see Ipv4Address
405 */
406 void AddHostRouteTo(IpAddress dest, uint32_t interface);
407
408 /**
409 * @brief Add a network route to the global routing table.
410 *
411 * @param network The Ipv4Address network for this route.
412 * @param networkMask The Ipv4Mask to extract the network.
413 * @param nextHop The next hop in the route to the destination network.
414 * @param interface The network interface index used to send packets to the
415 * destination.
416 *
417 * @see Ipv4Address
418 */
420 IpMaskOrPrefix networkMask,
421 IpAddress nextHop,
422 uint32_t interface);
423
424 /**
425 * @brief Add a network route to the global routing table.
426 *
427 * @param network The Ipv4Address network for this route.
428 * @param networkMask The Ipv4Mask to extract the network.
429 * @param interface The network interface index used to send packets to the
430 * destination.
431 *
432 * @see Ipv4Address
433 */
434 void AddNetworkRouteTo(IpAddress network, IpMaskOrPrefix networkMask, uint32_t interface);
435
436 /**
437 * @brief Add an external route to the global routing table.
438 *
439 * @param network The Ipv4Address network for this route.
440 * @param networkMask The Ipv4Mask to extract the network.
441 * @param nextHop The next hop Ipv4Address
442 * @param interface The network interface index used to send packets to the
443 * destination.
444 */
446 IpMaskOrPrefix networkMask,
447 IpAddress nextHop,
448 uint32_t interface);
449
450 /**
451 * @brief Get the number of individual unicast routes that have been added
452 * to the routing table.
453 *
454 * @warning The default route counts as one of the routes.
455 * @returns the number of routes
456 */
458
459 /**
460 * @brief Get a route from the global unicast routing table.
461 *
462 * Externally, the unicast global routing table appears simply as a table with
463 * n entries. The one subtlety of note is that if a default route has been set
464 * it will appear as the zeroth entry in the table. This means that if you
465 * add only a default route, the table will have one entry that can be accessed
466 * either by explicitly calling GetDefaultRoute () or by calling GetRoute (0).
467 *
468 * Similarly, if the default route has been set, calling RemoveRoute (0) will
469 * remove the default route.
470 *
471 * @param i The index (into the routing table) of the route to retrieve. If
472 * the default route has been set, it will occupy index zero.
473 * @return If route is set, a pointer to that Ipv4RoutingTableEntry is returned, otherwise
474 * a zero pointer is returned.
475 *
476 * @see Ipv4RoutingTableEntry
477 * @see Ipv4GlobalRouting::RemoveRoute
478 */
480
481 /**
482 * @brief Remove a route from the global unicast routing table.
483 *
484 * Externally, the unicast global routing table appears simply as a table with
485 * n entries. The one subtlety of note is that if a default route has been set
486 * it will appear as the zeroth entry in the table. This means that if the
487 * default route has been set, calling RemoveRoute (0) will remove the
488 * default route.
489 *
490 * @param i The index (into the routing table) of the route to remove. If
491 * the default route has been set, it will occupy index zero.
492 *
493 * @see Ipv4RoutingTableEntry
494 * @see Ipv4GlobalRouting::GetRoute
495 * @see Ipv4GlobalRouting::AddRoute
496 */
498
499 /**
500 * Assign a fixed random variable stream number to the random variables
501 * used by this model. Return the number of streams (possibly zero) that
502 * have been assigned.
503 *
504 * @param stream first stream index to use
505 * @return the number of stream indices assigned by this model
506 */
507 int64_t AssignStreams(int64_t stream);
508
509 protected:
510 /**
511 * @sa Ipv4RoutingProtocol::DoDispose
512 * @sa Ipv6RoutingProtocol::DoDispose
513 */
514 void DoDispose() override;
515
516 private:
517 /// Set to true if packets are randomly routed among ECMP; set to false for using only one route
518 /// consistently
520 /// Set to true if this interface should respond to interface events by globally recomputing
521 /// routes
523 /// A uniform random number generator for randomly routing packets among ECMP
525
526 /// container of Ipv4RoutingTableEntry (routes to hosts)
527 typedef typename std::list<IpRoutingTableEntry*> HostRoutes;
528 /// const iterator of container of Ipv4RoutingTableEntry (routes to hosts)
529 typedef typename std::list<IpRoutingTableEntry*>::const_iterator HostRoutesCI;
530 /// iterator of container of Ipv4RoutingTableEntry (routes to hosts)
531 typedef typename std::list<IpRoutingTableEntry*>::iterator HostRoutesI;
532
533 /// container of Ipv4RoutingTableEntry (routes to networks)
534 typedef typename std::list<IpRoutingTableEntry*> NetworkRoutes;
535 /// const iterator of container of Ipv4RoutingTableEntry (routes to networks)
536 typedef typename std::list<IpRoutingTableEntry*>::const_iterator NetworkRoutesCI;
537 /// iterator of container of Ipv4RoutingTableEntry (routes to networks)
538 typedef typename std::list<IpRoutingTableEntry*>::iterator NetworkRoutesI;
539
540 /// container of Ipv4RoutingTableEntry (routes to external AS)
541 typedef typename std::list<IpRoutingTableEntry*> ASExternalRoutes;
542 /// const iterator of container of Ipv4RoutingTableEntry (routes to external AS)
543 typedef typename std::list<IpRoutingTableEntry*>::const_iterator ASExternalRoutesCI;
544 /// iterator of container of Ipv4RoutingTableEntry (routes to external AS)
545 typedef typename std::list<IpRoutingTableEntry*>::iterator ASExternalRoutesI;
546
547 /**
548 * @brief Lookup in the forwarding table for destination.
549 * @param dest destination address
550 * @param oif output interface if any (put 0 otherwise)
551 * @return Ipv4Route to route the packet to reach dest address
552 */
554
555 HostRoutes m_hostRoutes; //!< Routes to hosts
556 NetworkRoutes m_networkRoutes; //!< Routes to networks
557 ASExternalRoutes m_ASexternalRoutes; //!< External routes imported
558
559 Ptr<Ip> m_ip; //!< associated IPv4 instance
560};
561
562/**
563 * @ingroup ipv4
564 * Create the typedef Ipv4GlobalRouting with T as Ipv4RoutingProtocol
565 */
567
568/**
569 * @ingroup ipv6
570 * Create the typedef Ipv6GlobalRouting with T as Ipv6RoutingProtocol
571 */
573
574} // Namespace ns3
575
576#endif /* GLOBAL_ROUTING_H */
Callback template class.
Definition callback.h:428
A global router implementation.
Global routing protocol for IPv4 stacks.
bool RouteInput(Ptr< const Packet > p, const IpHeader &header, Ptr< const NetDevice > idev, const UnicastForwardCallback &ucb, const MulticastForwardCallback &mcb, const LocalDeliverCallback &lcb, const ErrorCallback &ecb) override
Route an input packet (to be forwarded or locally delivered).
Ptr< IpRoute > LookupGlobal(IpAddress dest, Ptr< NetDevice > oif=nullptr)
Lookup in the forwarding table for destination.
typename std::conditional_t< IsIpv4, Ipv4, Ipv6 > Ip
static TypeId GetTypeId()
Get the type ID.
void AddHostRouteTo(IpAddress dest, IpAddress nextHop, uint32_t interface)
Add a host route to the global routing table.
typename std::conditional_t< IsIpv4, Ipv4Manager, Ipv6Manager > IpManager
void NotifyRemoveAddress(uint32_t interface, IpInterfaceAddress address) override
void SetIpv6(Ptr< Ip > ipv6)
Typically, invoked directly or indirectly from ns3::Ipv6::SetRoutingProtocol.
typename std::conditional_t< IsIpv4, Ipv4Address, Ipv6Address > IpAddress
uint32_t GetNRoutes() const
Get the number of individual unicast routes that have been added to the routing table.
void PrintRoutingTable(Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S) const override
Print the Routing Table entries.
std::conditional_t< IsIpv4, MulticastForwardCallbackv4, MulticastForwardCallbackv6 > MulticastForwardCallback
void NotifyAddRoute(Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse=Ipv6Address::GetZero())
Notify a new route.
std::list< IpRoutingTableEntry * > NetworkRoutes
Ptr< IpRoute > RouteOutput(Ptr< Packet > p, const IpHeader &header, Ptr< NetDevice > oif, Socket::SocketErrno &sockerr) override
Query routing cache for an existing route, for an outbound packet.
Callback< void, Ptr< const NetDevice >, Ptr< IpRoute >, Ptr< const Packet >, const IpHeader & > UnicastForwardCallbackv6
void NotifyInterfaceUp(uint32_t interface) override
std::list< IpRoutingTableEntry * >::const_iterator HostRoutesCI
Callback< void, Ptr< const Packet >, const IpHeader &, uint32_t > LocalDeliverCallback
void NotifyInterfaceDown(uint32_t interface) override
typename std::conditional_t< IsIpv4, Ipv4Header, Ipv6Header > IpHeader
void AddHostRouteTo(IpAddress dest, uint32_t interface)
Add a host route to the global routing table.
void AddNetworkRouteTo(IpAddress network, IpMaskOrPrefix networkMask, uint32_t interface)
Add a network route to the global routing table.
std::list< IpRoutingTableEntry * >::iterator NetworkRoutesI
typename std::conditional_t< IsIpv4, Ipv4RoutingProtocol, Ipv6RoutingProtocol > IpRoutingProtocol
std::list< IpRoutingTableEntry * >::iterator HostRoutesI
Ptr< UniformRandomVariable > m_rand
std::list< IpRoutingTableEntry * >::const_iterator ASExternalRoutesCI
typename std::conditional_t< IsIpv4, Ipv4Mask, Ipv6Prefix > IpMaskOrPrefix
void NotifyRemoveRoute(Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse=Ipv6Address::GetZero())
Notify route removing.
void DoDispose() override
Callback< void, Ptr< IpRoute >, Ptr< const Packet >, const IpHeader & > UnicastForwardCallbackv4
std::list< IpRoutingTableEntry * > ASExternalRoutes
std::conditional_t< IsIpv4, UnicastForwardCallbackv4, UnicastForwardCallbackv6 > UnicastForwardCallback
typename std::conditional_t< IsIpv4, Ipv4RoutingTableEntry, Ipv6RoutingTableEntry > IpRoutingTableEntry
Callback< void, Ptr< Ipv4MulticastRoute >, Ptr< const Packet >, const IpHeader & > MulticastForwardCallbackv4
std::list< IpRoutingTableEntry * > HostRoutes
Callback< void, Ptr< const NetDevice >, Ptr< Ipv6MulticastRoute >, Ptr< const Packet >, const IpHeader & > MulticastForwardCallbackv6
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
void RemoveRoute(uint32_t i)
Remove a route from the global unicast routing table.
typename std::conditional_t< IsIpv4, Ipv4InterfaceAddress, Ipv6InterfaceAddress > IpInterfaceAddress
GlobalRouting()
Construct an empty Ipv4GlobalRouting routing protocol,.
Callback< void, Ptr< const Packet >, const IpHeader &, Socket::SocketErrno > ErrorCallback
~GlobalRouting() override
void AddNetworkRouteTo(IpAddress network, IpMaskOrPrefix networkMask, IpAddress nextHop, uint32_t interface)
Add a network route to the global routing table.
void SetIpv4(Ptr< Ip > ipv4)
Typically, invoked directly or indirectly from ns3::Ipv4::SetRoutingProtocol.
std::list< IpRoutingTableEntry * >::iterator ASExternalRoutesI
typename std::conditional_t< IsIpv4, Ipv4Route, Ipv6Route > IpRoute
void AddASExternalRouteTo(IpAddress network, IpMaskOrPrefix networkMask, IpAddress nextHop, uint32_t interface)
Add an external route to the global routing table.
void NotifyAddAddress(uint32_t interface, IpInterfaceAddress address) override
std::list< IpRoutingTableEntry * >::const_iterator NetworkRoutesCI
IpRoutingTableEntry * GetRoute(uint32_t i) const
Get a route from the global unicast routing table.
Ipv4 addresses are stored in host order in this class.
Packet header for IPv4.
Definition ipv4-header.h:23
The IPv4 representation of a network interface.
A record of an IPv4 multicast route for Ipv4GlobalRouting and Ipv4StaticRouting.
A record of an IPv4 routing table entry for Ipv4GlobalRouting and Ipv4StaticRouting.
Describes an IPv6 address.
static Ipv6Address GetZero()
Get the 0 (::) Ipv6Address.
Describes an IPv6 prefix.
Network layer to device interface.
Definition net-device.h:87
A network Node.
Definition node.h:46
network packets
Definition packet.h:228
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
SocketErrno
Enumeration of the possible errors returned by a socket.
Definition socket.h:73
Unit
The unit to use to interpret a number representing time.
Definition nstime.h:101
@ S
second
Definition nstime.h:106
a unique identifier for an interface.
Definition type-id.h:50
GlobalRouting< Ipv4RoutingProtocol > Ipv4GlobalRouting
Create the typedef Ipv4GlobalRouting with T as Ipv4RoutingProtocol.
GlobalRouting< Ipv6RoutingProtocol > Ipv6GlobalRouting
Create the typedef Ipv6GlobalRouting with T as Ipv6RoutingProtocol.
Every class exported by the ns3 library is enclosed in the ns3 namespace.