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 */
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);
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);
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 */
285 /**
286 * @param interface the index of the interface we are being notified about
287 *
288 * @sa Ipv4RoutingProtocol::NotifyInterfaceDown
289 * @sa Ipv6RoutingProtocol::NotifyInterfaceDown
290 */
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 */
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 */
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 virtual void NotifyAddRoute(Ipv6Address dst,
321 Ipv6Prefix mask,
322 Ipv6Address nextHop,
323 uint32_t interface,
324 Ipv6Address prefixToUse = Ipv6Address::GetZero());
325 /**
326 * @brief Notify route removing.
327 * @param dst destination address
328 * @param mask destination mask
329 * @param nextHop nextHop for this destination
330 * @param interface output interface
331 * @param prefixToUse prefix to use as source with this route
332 */
334 Ipv6Prefix mask,
335 Ipv6Address nextHop,
336 uint32_t interface,
337 Ipv6Address prefixToUse = Ipv6Address::GetZero());
338
339 /* From IPv4RoutingProtocol */
340 /**
341 * @brief Typically, invoked directly or indirectly from ns3::Ipv4::SetRoutingProtocol
342 *
343 * @param ipv4 the ipv4 object this routing protocol is being associated with
344 *
345 * @sa Ipv4RoutingProtocol::SetIpv4
346 */
347 virtual void SetIpv4(Ptr<Ip> ipv4);
348
349 /* From IPv6RoutingProtocol */
350 /**
351 * @brief Typically, invoked directly or indirectly from ns3::Ipv6::SetRoutingProtocol
352 *
353 * @param ipv6 the ipv6 object this routing protocol is being associated with
354 *
355 * @sa Ipv6RoutingProtocol::SetIpv6
356 */
357 virtual void SetIpv6(Ptr<Ip> ipv6);
358
359 /**
360 * @brief Print the Routing Table entries
361 *
362 * @param stream The ostream the Routing table is printed to
363 * @param unit The time unit to be used in the report
364 *
365 * @sa Ipv4RoutingProtocol::PrintRoutingTable
366 * @sa Ipv6RoutingProtocol::PrintRoutingTable
367 */
369
370 /**
371 * @brief Add a host route to the global routing table.
372 *
373 * @param dest The Ipv4Address destination for this route.
374 * @param nextHop The Ipv4Address of the next hop in the route.
375 * @param interface The network interface index used to send packets to the
376 * destination.
377 *
378 * @see Ipv4Address
379 */
380 void AddHostRouteTo(IpAddress dest, IpAddress nextHop, uint32_t interface);
381 /**
382 * @brief Add a host route to the global routing table.
383 *
384 * @param dest The Ipv4Address destination for this route.
385 * @param interface The network interface index used to send packets to the
386 * destination.
387 *
388 * @see Ipv4Address
389 */
390 void AddHostRouteTo(IpAddress dest, uint32_t interface);
391
392 /**
393 * @brief Add a network route to the global routing table.
394 *
395 * @param network The Ipv4Address network for this route.
396 * @param networkMask The Ipv4Mask to extract the network.
397 * @param nextHop The next hop in the route to the destination network.
398 * @param interface The network interface index used to send packets to the
399 * destination.
400 *
401 * @see Ipv4Address
402 */
404 IpMaskOrPrefix networkMask,
405 IpAddress nextHop,
406 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 interface The network interface index used to send packets to the
414 * destination.
415 *
416 * @see Ipv4Address
417 */
418 void AddNetworkRouteTo(IpAddress network, IpMaskOrPrefix networkMask, uint32_t interface);
419
420 /**
421 * @brief Add an external route to the global routing table.
422 *
423 * @param network The Ipv4Address network for this route.
424 * @param networkMask The Ipv4Mask to extract the network.
425 * @param nextHop The next hop Ipv4Address
426 * @param interface The network interface index used to send packets to the
427 * destination.
428 */
430 IpMaskOrPrefix networkMask,
431 IpAddress nextHop,
432 uint32_t interface);
433
434 /**
435 * @brief Get the number of individual unicast routes that have been added
436 * to the routing table.
437 *
438 * @warning The default route counts as one of the routes.
439 * @returns the number of routes
440 */
442
443 /**
444 * @brief Get a route from the global unicast routing table.
445 *
446 * Externally, the unicast global routing table appears simply as a table with
447 * n entries. The one subtlety of note is that if a default route has been set
448 * it will appear as the zeroth entry in the table. This means that if you
449 * add only a default route, the table will have one entry that can be accessed
450 * either by explicitly calling GetDefaultRoute () or by calling GetRoute (0).
451 *
452 * Similarly, if the default route has been set, calling RemoveRoute (0) will
453 * remove the default route.
454 *
455 * @param i The index (into the routing table) of the route to retrieve. If
456 * the default route has been set, it will occupy index zero.
457 * @return If route is set, a pointer to that Ipv4RoutingTableEntry is returned, otherwise
458 * a zero pointer is returned.
459 *
460 * @see Ipv4RoutingTableEntry
461 * @see Ipv4GlobalRouting::RemoveRoute
462 */
464
465 /**
466 * @brief Remove a route from the global unicast routing table.
467 *
468 * Externally, the unicast global routing table appears simply as a table with
469 * n entries. The one subtlety of note is that if a default route has been set
470 * it will appear as the zeroth entry in the table. This means that if the
471 * default route has been set, calling RemoveRoute (0) will remove the
472 * default route.
473 *
474 * @param i The index (into the routing table) of the route to remove. If
475 * the default route has been set, it will occupy index zero.
476 *
477 * @see Ipv4RoutingTableEntry
478 * @see Ipv4GlobalRouting::GetRoute
479 * @see Ipv4GlobalRouting::AddRoute
480 */
482
483 /**
484 * Assign a fixed random variable stream number to the random variables
485 * used by this model. Return the number of streams (possibly zero) that
486 * have been assigned.
487 *
488 * @param stream first stream index to use
489 * @return the number of stream indices assigned by this model
490 */
491 int64_t AssignStreams(int64_t stream);
492
493 protected:
494 /**
495 * @sa Ipv4RoutingProtocol::DoDispose
496 * @sa Ipv6RoutingProtocol::DoDispose
497 */
498 void DoDispose();
499
500 private:
501 /// Set to true if packets are randomly routed among ECMP; set to false for using only one route
502 /// consistently
504 /// Set to true if this interface should respond to interface events by globally recomputing
505 /// routes
507 /// A uniform random number generator for randomly routing packets among ECMP
509
510 /// container of Ipv4RoutingTableEntry (routes to hosts)
511 typedef std::list<IpRoutingTableEntry*> HostRoutes;
512 /// const iterator of container of Ipv4RoutingTableEntry (routes to hosts)
513 typedef std::list<IpRoutingTableEntry*>::const_iterator HostRoutesCI;
514 /// iterator of container of Ipv4RoutingTableEntry (routes to hosts)
515 typedef std::list<IpRoutingTableEntry*>::iterator HostRoutesI;
516
517 /// container of Ipv4RoutingTableEntry (routes to networks)
518 typedef std::list<IpRoutingTableEntry*> NetworkRoutes;
519 /// const iterator of container of Ipv4RoutingTableEntry (routes to networks)
520 typedef std::list<IpRoutingTableEntry*>::const_iterator NetworkRoutesCI;
521 /// iterator of container of Ipv4RoutingTableEntry (routes to networks)
522 typedef std::list<IpRoutingTableEntry*>::iterator NetworkRoutesI;
523
524 /// container of Ipv4RoutingTableEntry (routes to external AS)
525 typedef std::list<IpRoutingTableEntry*> ASExternalRoutes;
526 /// const iterator of container of Ipv4RoutingTableEntry (routes to external AS)
527 typedef std::list<IpRoutingTableEntry*>::const_iterator ASExternalRoutesCI;
528 /// iterator of container of Ipv4RoutingTableEntry (routes to external AS)
529 typedef std::list<IpRoutingTableEntry*>::iterator ASExternalRoutesI;
530
531 /**
532 * @brief Lookup in the forwarding table for destination.
533 * @param dest destination address
534 * @param oif output interface if any (put 0 otherwise)
535 * @return Ipv4Route to route the packet to reach dest address
536 */
538
539 HostRoutes m_hostRoutes; //!< Routes to hosts
540 NetworkRoutes m_networkRoutes; //!< Routes to networks
541 ASExternalRoutes m_ASexternalRoutes; //!< External routes imported
542
543 Ptr<Ip> m_ip; //!< associated IPv4 instance
544};
545
546/**
547 * @ingroup ipv4
548 * Create the typedef Ipv4GlobalRouting with T as Ipv4RoutingProtocol
549 */
551
552/**
553 * @ingroup ipv6
554 * Create the typedef Ipv6GlobalRouting with T as Ipv6RoutingProtocol
555 */
557
558} // Namespace ns3
559
560#endif /* GLOBAL_ROUTING_H */
Callback template class.
Definition callback.h:428
A global router implementation.
Global routing protocol for IPv4 stacks.
Ptr< IpRoute > LookupGlobal(IpAddress dest, Ptr< NetDevice > oif=nullptr)
Lookup in the forwarding table for destination.
void PrintRoutingTable(Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S) const
Print the Routing Table entries.
typename std::conditional_t< IsIpv4, Ipv4, Ipv6 > Ip
void NotifyRemoveAddress(uint32_t interface, IpInterfaceAddress address)
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
virtual 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.
std::conditional_t< IsIpv4, MulticastForwardCallbackv4, MulticastForwardCallbackv6 > MulticastForwardCallback
void NotifyInterfaceDown(uint32_t interface)
virtual void NotifyAddRoute(Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse=Ipv6Address::GetZero())
Notify a new route.
std::list< IpRoutingTableEntry * > NetworkRoutes
Callback< void, Ptr< const NetDevice >, Ptr< IpRoute >, Ptr< const Packet >, const IpHeader & > UnicastForwardCallbackv6
std::list< IpRoutingTableEntry * >::const_iterator HostRoutesCI
Callback< void, Ptr< const Packet >, const IpHeader &, uint32_t > LocalDeliverCallback
void NotifyAddAddress(uint32_t interface, IpInterfaceAddress address)
typename std::conditional_t< IsIpv4, Ipv4Header, Ipv6Header > IpHeader
void NotifyInterfaceUp(uint32_t interface)
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
virtual void NotifyRemoveRoute(Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse=Ipv6Address::GetZero())
Notify route removing.
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)
Route an input packet (to be forwarded or locally delivered).
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
Ptr< IpRoute > RouteOutput(Ptr< Packet > p, const IpHeader &header, Ptr< NetDevice > oif, Socket::SocketErrno &sockerr)
Query routing cache for an existing route, for an outbound packet.
void AddNetworkRouteTo(IpAddress network, IpMaskOrPrefix networkMask, IpAddress nextHop, uint32_t interface)
Add a network route to the global routing table.
virtual 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.
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.