A Discrete-Event Network Simulator
API
ipv4-global-routing.cc
Go to the documentation of this file.
1 // -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*-
2 //
3 // Copyright (c) 2008 University of Washington
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License version 2 as
7 // published by the Free Software Foundation;
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 //
18 
19 #include <vector>
20 #include <iomanip>
21 #include "ns3/names.h"
22 #include "ns3/log.h"
23 #include "ns3/simulator.h"
24 #include "ns3/object.h"
25 #include "ns3/packet.h"
26 #include "ns3/net-device.h"
27 #include "ns3/ipv4-route.h"
28 #include "ns3/ipv4-routing-table-entry.h"
29 #include "ns3/boolean.h"
30 #include "ns3/node.h"
31 #include "ipv4-global-routing.h"
32 #include "global-route-manager.h"
33 
34 namespace ns3 {
35 
36 NS_LOG_COMPONENT_DEFINE ("Ipv4GlobalRouting");
37 
38 NS_OBJECT_ENSURE_REGISTERED (Ipv4GlobalRouting);
39 
40 TypeId
42 {
43  static TypeId tid = TypeId ("ns3::Ipv4GlobalRouting")
44  .SetParent<Object> ()
45  .SetGroupName ("Internet")
46  .AddAttribute ("RandomEcmpRouting",
47  "Set to true if packets are randomly routed among ECMP; set to false for using only one route consistently",
48  BooleanValue (false),
51  .AddAttribute ("RespondToInterfaceEvents",
52  "Set to true if you want to dynamically recompute the global routes upon Interface notification events (up/down, or add/remove address)",
53  BooleanValue (false),
56  ;
57  return tid;
58 }
59 
61  : m_randomEcmpRouting (false),
62  m_respondToInterfaceEvents (false)
63 {
64  NS_LOG_FUNCTION (this);
65 
66  m_rand = CreateObject<UniformRandomVariable> ();
67 }
68 
70 {
71  NS_LOG_FUNCTION (this);
72 }
73 
74 void
76  Ipv4Address nextHop,
77  uint32_t interface)
78 {
79  NS_LOG_FUNCTION (this << dest << nextHop << interface);
81  *route = Ipv4RoutingTableEntry::CreateHostRouteTo (dest, nextHop, interface);
82  m_hostRoutes.push_back (route);
83 }
84 
85 void
87  uint32_t interface)
88 {
89  NS_LOG_FUNCTION (this << dest << interface);
91  *route = Ipv4RoutingTableEntry::CreateHostRouteTo (dest, interface);
92  m_hostRoutes.push_back (route);
93 }
94 
95 void
97  Ipv4Mask networkMask,
98  Ipv4Address nextHop,
99  uint32_t interface)
100 {
101  NS_LOG_FUNCTION (this << network << networkMask << nextHop << interface);
104  networkMask,
105  nextHop,
106  interface);
107  m_networkRoutes.push_back (route);
108 }
109 
110 void
112  Ipv4Mask networkMask,
113  uint32_t interface)
114 {
115  NS_LOG_FUNCTION (this << network << networkMask << interface);
118  networkMask,
119  interface);
120  m_networkRoutes.push_back (route);
121 }
122 
123 void
125  Ipv4Mask networkMask,
126  Ipv4Address nextHop,
127  uint32_t interface)
128 {
129  NS_LOG_FUNCTION (this << network << networkMask << nextHop << interface);
132  networkMask,
133  nextHop,
134  interface);
135  m_ASexternalRoutes.push_back (route);
136 }
137 
138 
141 {
142  NS_LOG_FUNCTION (this << dest << oif);
143  NS_LOG_LOGIC ("Looking for route for destination " << dest);
144  Ptr<Ipv4Route> rtentry = 0;
145  // store all available routes that bring packets to their destination
146  typedef std::vector<Ipv4RoutingTableEntry*> RouteVec_t;
147  RouteVec_t allRoutes;
148 
149  NS_LOG_LOGIC ("Number of m_hostRoutes = " << m_hostRoutes.size ());
150  for (HostRoutesCI i = m_hostRoutes.begin ();
151  i != m_hostRoutes.end ();
152  i++)
153  {
154  NS_ASSERT ((*i)->IsHost ());
155  if ((*i)->GetDest () == dest)
156  {
157  if (oif != 0)
158  {
159  if (oif != m_ipv4->GetNetDevice ((*i)->GetInterface ()))
160  {
161  NS_LOG_LOGIC ("Not on requested interface, skipping");
162  continue;
163  }
164  }
165  allRoutes.push_back (*i);
166  NS_LOG_LOGIC (allRoutes.size () << "Found global host route" << *i);
167  }
168  }
169  if (allRoutes.size () == 0) // if no host route is found
170  {
171  NS_LOG_LOGIC ("Number of m_networkRoutes" << m_networkRoutes.size ());
172  for (NetworkRoutesI j = m_networkRoutes.begin ();
173  j != m_networkRoutes.end ();
174  j++)
175  {
176  Ipv4Mask mask = (*j)->GetDestNetworkMask ();
177  Ipv4Address entry = (*j)->GetDestNetwork ();
178  if (mask.IsMatch (dest, entry))
179  {
180  if (oif != 0)
181  {
182  if (oif != m_ipv4->GetNetDevice ((*j)->GetInterface ()))
183  {
184  NS_LOG_LOGIC ("Not on requested interface, skipping");
185  continue;
186  }
187  }
188  allRoutes.push_back (*j);
189  NS_LOG_LOGIC (allRoutes.size () << "Found global network route" << *j);
190  }
191  }
192  }
193  if (allRoutes.size () == 0) // consider external if no host/network found
194  {
195  for (ASExternalRoutesI k = m_ASexternalRoutes.begin ();
196  k != m_ASexternalRoutes.end ();
197  k++)
198  {
199  Ipv4Mask mask = (*k)->GetDestNetworkMask ();
200  Ipv4Address entry = (*k)->GetDestNetwork ();
201  if (mask.IsMatch (dest, entry))
202  {
203  NS_LOG_LOGIC ("Found external route" << *k);
204  if (oif != 0)
205  {
206  if (oif != m_ipv4->GetNetDevice ((*k)->GetInterface ()))
207  {
208  NS_LOG_LOGIC ("Not on requested interface, skipping");
209  continue;
210  }
211  }
212  allRoutes.push_back (*k);
213  break;
214  }
215  }
216  }
217  if (allRoutes.size () > 0 ) // if route(s) is found
218  {
219  // pick up one of the routes uniformly at random if random
220  // ECMP routing is enabled, or always select the first route
221  // consistently if random ECMP routing is disabled
222  uint32_t selectIndex;
224  {
225  selectIndex = m_rand->GetInteger (0, allRoutes.size ()-1);
226  }
227  else
228  {
229  selectIndex = 0;
230  }
231  Ipv4RoutingTableEntry* route = allRoutes.at (selectIndex);
232  // create a Ipv4Route object from the selected routing table entry
233  rtentry = Create<Ipv4Route> ();
234  rtentry->SetDestination (route->GetDest ());
236  rtentry->SetSource (m_ipv4->GetAddress (route->GetInterface (), 0).GetLocal ());
237  rtentry->SetGateway (route->GetGateway ());
238  uint32_t interfaceIdx = route->GetInterface ();
239  rtentry->SetOutputDevice (m_ipv4->GetNetDevice (interfaceIdx));
240  return rtentry;
241  }
242  else
243  {
244  return 0;
245  }
246 }
247 
248 uint32_t
250 {
251  NS_LOG_FUNCTION (this);
252  uint32_t n = 0;
253  n += m_hostRoutes.size ();
254  n += m_networkRoutes.size ();
255  n += m_ASexternalRoutes.size ();
256  return n;
257 }
258 
260 Ipv4GlobalRouting::GetRoute (uint32_t index) const
261 {
262  NS_LOG_FUNCTION (this << index);
263  if (index < m_hostRoutes.size ())
264  {
265  uint32_t tmp = 0;
266  for (HostRoutesCI i = m_hostRoutes.begin ();
267  i != m_hostRoutes.end ();
268  i++)
269  {
270  if (tmp == index)
271  {
272  return *i;
273  }
274  tmp++;
275  }
276  }
277  index -= m_hostRoutes.size ();
278  uint32_t tmp = 0;
279  if (index < m_networkRoutes.size ())
280  {
281  for (NetworkRoutesCI j = m_networkRoutes.begin ();
282  j != m_networkRoutes.end ();
283  j++)
284  {
285  if (tmp == index)
286  {
287  return *j;
288  }
289  tmp++;
290  }
291  }
292  index -= m_networkRoutes.size ();
293  tmp = 0;
294  for (ASExternalRoutesCI k = m_ASexternalRoutes.begin ();
295  k != m_ASexternalRoutes.end ();
296  k++)
297  {
298  if (tmp == index)
299  {
300  return *k;
301  }
302  tmp++;
303  }
304  NS_ASSERT (false);
305  // quiet compiler.
306  return 0;
307 }
308 void
310 {
311  NS_LOG_FUNCTION (this << index);
312  if (index < m_hostRoutes.size ())
313  {
314  uint32_t tmp = 0;
315  for (HostRoutesI i = m_hostRoutes.begin ();
316  i != m_hostRoutes.end ();
317  i++)
318  {
319  if (tmp == index)
320  {
321  NS_LOG_LOGIC ("Removing route " << index << "; size = " << m_hostRoutes.size ());
322  delete *i;
323  m_hostRoutes.erase (i);
324  NS_LOG_LOGIC ("Done removing host route " << index << "; host route remaining size = " << m_hostRoutes.size ());
325  return;
326  }
327  tmp++;
328  }
329  }
330  index -= m_hostRoutes.size ();
331  uint32_t tmp = 0;
332  for (NetworkRoutesI j = m_networkRoutes.begin ();
333  j != m_networkRoutes.end ();
334  j++)
335  {
336  if (tmp == index)
337  {
338  NS_LOG_LOGIC ("Removing route " << index << "; size = " << m_networkRoutes.size ());
339  delete *j;
340  m_networkRoutes.erase (j);
341  NS_LOG_LOGIC ("Done removing network route " << index << "; network route remaining size = " << m_networkRoutes.size ());
342  return;
343  }
344  tmp++;
345  }
346  index -= m_networkRoutes.size ();
347  tmp = 0;
348  for (ASExternalRoutesI k = m_ASexternalRoutes.begin ();
349  k != m_ASexternalRoutes.end ();
350  k++)
351  {
352  if (tmp == index)
353  {
354  NS_LOG_LOGIC ("Removing route " << index << "; size = " << m_ASexternalRoutes.size ());
355  delete *k;
356  m_ASexternalRoutes.erase (k);
357  NS_LOG_LOGIC ("Done removing network route " << index << "; network route remaining size = " << m_networkRoutes.size ());
358  return;
359  }
360  tmp++;
361  }
362  NS_ASSERT (false);
363 }
364 
365 int64_t
367 {
368  NS_LOG_FUNCTION (this << stream);
369  m_rand->SetStream (stream);
370  return 1;
371 }
372 
373 void
375 {
376  NS_LOG_FUNCTION (this);
377  for (HostRoutesI i = m_hostRoutes.begin ();
378  i != m_hostRoutes.end ();
379  i = m_hostRoutes.erase (i))
380  {
381  delete (*i);
382  }
383  for (NetworkRoutesI j = m_networkRoutes.begin ();
384  j != m_networkRoutes.end ();
385  j = m_networkRoutes.erase (j))
386  {
387  delete (*j);
388  }
389  for (ASExternalRoutesI l = m_ASexternalRoutes.begin ();
390  l != m_ASexternalRoutes.end ();
391  l = m_ASexternalRoutes.erase (l))
392  {
393  delete (*l);
394  }
395 
397 }
398 
399 // Formatted like output of "route -n" command
400 void
402 {
403  NS_LOG_FUNCTION (this << stream);
404  std::ostream* os = stream->GetStream ();
405 
406  *os << "Node: " << m_ipv4->GetObject<Node> ()->GetId ()
407  << ", Time: " << Now().As (unit)
408  << ", Local time: " << m_ipv4->GetObject<Node> ()->GetLocalTime ().As (unit)
409  << ", Ipv4GlobalRouting table" << std::endl;
410 
411  if (GetNRoutes () > 0)
412  {
413  *os << "Destination Gateway Genmask Flags Metric Ref Use Iface" << std::endl;
414  for (uint32_t j = 0; j < GetNRoutes (); j++)
415  {
416  std::ostringstream dest, gw, mask, flags;
417  Ipv4RoutingTableEntry route = GetRoute (j);
418  dest << route.GetDest ();
419  *os << std::setiosflags (std::ios::left) << std::setw (16) << dest.str ();
420  gw << route.GetGateway ();
421  *os << std::setiosflags (std::ios::left) << std::setw (16) << gw.str ();
422  mask << route.GetDestNetworkMask ();
423  *os << std::setiosflags (std::ios::left) << std::setw (16) << mask.str ();
424  flags << "U";
425  if (route.IsHost ())
426  {
427  flags << "H";
428  }
429  else if (route.IsGateway ())
430  {
431  flags << "G";
432  }
433  *os << std::setiosflags (std::ios::left) << std::setw (6) << flags.str ();
434  // Metric not implemented
435  *os << "-" << " ";
436  // Ref ct not implemented
437  *os << "-" << " ";
438  // Use not implemented
439  *os << "-" << " ";
440  if (Names::FindName (m_ipv4->GetNetDevice (route.GetInterface ())) != "")
441  {
442  *os << Names::FindName (m_ipv4->GetNetDevice (route.GetInterface ()));
443  }
444  else
445  {
446  *os << route.GetInterface ();
447  }
448  *os << std::endl;
449  }
450  }
451  *os << std::endl;
452 }
453 
456 {
457  NS_LOG_FUNCTION (this << p << &header << oif << &sockerr);
458 //
459 // First, see if this is a multicast packet we have a route for. If we
460 // have a route, then send the packet down each of the specified interfaces.
461 //
462  if (header.GetDestination ().IsMulticast ())
463  {
464  NS_LOG_LOGIC ("Multicast destination-- returning false");
465  return 0; // Let other routing protocols try to handle this
466  }
467 //
468 // See if this is a unicast packet we have a route for.
469 //
470  NS_LOG_LOGIC ("Unicast destination- looking up");
471  Ptr<Ipv4Route> rtentry = LookupGlobal (header.GetDestination (), oif);
472  if (rtentry)
473  {
474  sockerr = Socket::ERROR_NOTERROR;
475  }
476  else
477  {
478  sockerr = Socket::ERROR_NOROUTETOHOST;
479  }
480  return rtentry;
481 }
482 
483 bool
486 {
487  NS_LOG_FUNCTION (this << p << header << header.GetSource () << header.GetDestination () << idev << &lcb << &ecb);
488  // Check if input device supports IP
489  NS_ASSERT (m_ipv4->GetInterfaceForDevice (idev) >= 0);
490  uint32_t iif = m_ipv4->GetInterfaceForDevice (idev);
491 
492  if (m_ipv4->IsDestinationAddress (header.GetDestination (), iif))
493  {
494  if (!lcb.IsNull ())
495  {
496  NS_LOG_LOGIC ("Local delivery to " << header.GetDestination ());
497  lcb (p, header, iif);
498  return true;
499  }
500  else
501  {
502  // The local delivery callback is null. This may be a multicast
503  // or broadcast packet, so return false so that another
504  // multicast routing protocol can handle it. It should be possible
505  // to extend this to explicitly check whether it is a unicast
506  // packet, and invoke the error callback if so
507  return false;
508  }
509  }
510 
511  // Check if input device supports IP forwarding
512  if (m_ipv4->IsForwarding (iif) == false)
513  {
514  NS_LOG_LOGIC ("Forwarding disabled for this interface");
515  ecb (p, header, Socket::ERROR_NOROUTETOHOST);
516  return true;
517  }
518  // Next, try to find a route
519  NS_LOG_LOGIC ("Unicast destination- looking up global route");
520  Ptr<Ipv4Route> rtentry = LookupGlobal (header.GetDestination ());
521  if (rtentry != 0)
522  {
523  NS_LOG_LOGIC ("Found unicast destination- calling unicast callback");
524  ucb (rtentry, p, header);
525  return true;
526  }
527  else
528  {
529  NS_LOG_LOGIC ("Did not find unicast destination- returning false");
530  return false; // Let other routing protocols try to handle this
531  // route request.
532  }
533 }
534 void
536 {
537  NS_LOG_FUNCTION (this << i);
538  if (m_respondToInterfaceEvents && Simulator::Now ().GetSeconds () > 0) // avoid startup events
539  {
543  }
544 }
545 
546 void
548 {
549  NS_LOG_FUNCTION (this << i);
550  if (m_respondToInterfaceEvents && Simulator::Now ().GetSeconds () > 0) // avoid startup events
551  {
555  }
556 }
557 
558 void
560 {
561  NS_LOG_FUNCTION (this << interface << address);
562  if (m_respondToInterfaceEvents && Simulator::Now ().GetSeconds () > 0) // avoid startup events
563  {
567  }
568 }
569 
570 void
572 {
573  NS_LOG_FUNCTION (this << interface << address);
574  if (m_respondToInterfaceEvents && Simulator::Now ().GetSeconds () > 0) // avoid startup events
575  {
579  }
580 }
581 
582 void
584 {
585  NS_LOG_FUNCTION (this << ipv4);
586  NS_ASSERT (m_ipv4 == 0 && ipv4 != 0);
587  m_ipv4 = ipv4;
588 }
589 
590 
591 } // namespace ns3
std::list< Ipv4RoutingTableEntry * >::iterator HostRoutesI
iterator of container of Ipv4RoutingTableEntry (routes to hosts)
virtual void NotifyInterfaceUp(uint32_t interface)
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
static void InitializeRoutes()
Compute routes using a Dijkstra SPF computation and populate per-node forwarding tables.
AttributeValue implementation for Boolean.
Definition: boolean.h:36
void DoDispose(void)
Destructor implementation.
Callback template class.
Definition: callback.h:1278
Ipv4GlobalRouting()
Construct an empty Ipv4GlobalRouting routing protocol,.
uint32_t GetInteger(uint32_t min, uint32_t max)
Get the next random value, as an unsigned integer in the specified range .
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
bool IsMatch(Ipv4Address a, Ipv4Address b) const
a class to represent an Ipv4 address mask
Definition: ipv4-address.h:269
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: boolean.h:85
Ipv4Address GetSource(void) const
Definition: ipv4-header.cc:291
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition: assert.h:67
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
virtual bool RouteInput(Ptr< const Packet > p, const Ipv4Header &header, Ptr< const NetDevice > idev, UnicastForwardCallback ucb, MulticastForwardCallback mcb, LocalDeliverCallback lcb, ErrorCallback ecb)
Route an input packet (to be forwarded or locally delivered)
Ipv4Address GetDest(void) const
virtual void NotifyInterfaceDown(uint32_t interface)
virtual void DoDispose(void)
Destructor implementation.
Definition: object.cc:346
void RemoveRoute(uint32_t i)
Remove a route from the global unicast routing table.
TimeWithUnit As(const enum Unit unit) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition: time.cc:389
std::list< Ipv4RoutingTableEntry * >::const_iterator ASExternalRoutesCI
const iterator of container of Ipv4RoutingTableEntry (routes to external AS)
SocketErrno
Enumeration of the possible errors returned by a socket.
Definition: socket.h:82
Ipv4Address GetGateway(void) const
ASExternalRoutes m_ASexternalRoutes
External routes imported.
void SetSource(Ipv4Address src)
Definition: ipv4-route.cc:49
Packet header for IPv4.
Definition: ipv4-header.h:33
HostRoutes m_hostRoutes
Routes to hosts.
bool IsMulticast(void) const
Ptr< UniformRandomVariable > m_rand
A uniform random number generator for randomly routing packets among ECMP.
Ipv4Mask GetDestNetworkMask(void) const
A record of an IPv4 routing table entry for Ipv4GlobalRouting and Ipv4StaticRouting.
bool IsHost(void) const
static Ipv4RoutingTableEntry CreateHostRouteTo(Ipv4Address dest, Ipv4Address nextHop, uint32_t interface)
Ptr< Ipv4 > m_ipv4
associated IPv4 instance
void SetGateway(Ipv4Address gw)
Definition: ipv4-route.cc:63
static Ipv4RoutingTableEntry CreateNetworkRouteTo(Ipv4Address network, Ipv4Mask networkMask, Ipv4Address nextHop, uint32_t interface)
bool m_respondToInterfaceEvents
Set to true if this interface should respond to interface events by globallly recomputing routes...
Unit
The unit to use to interpret a number representing time.
Definition: nstime.h:109
virtual void PrintRoutingTable(Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S) const
Print the Routing Table entries.
static void DeleteGlobalRoutes()
Delete all static routes on all nodes that have a GlobalRouterInterface.
std::list< Ipv4RoutingTableEntry * >::const_iterator NetworkRoutesCI
const iterator of container of Ipv4RoutingTableEntry (routes to networks)
uint32_t GetNRoutes(void) const
Get the number of individual unicast routes that have been added to the routing table.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:289
bool m_randomEcmpRouting
Set to true if packets are randomly routed among ECMP; set to false for using only one route consiste...
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
Ptr< Ipv4Route > LookupGlobal(Ipv4Address dest, Ptr< NetDevice > oif=0)
Lookup in the forwarding table for destination.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint32_t GetInterface(void) const
address
Definition: first.py:44
static void BuildGlobalRoutingDatabase()
Build the routing database by gathering Link State Advertisements from each node exporting a GlobalRo...
Ipv4RoutingTableEntry * GetRoute(uint32_t i) const
Get a route from the global unicast routing table.
std::list< Ipv4RoutingTableEntry * >::const_iterator HostRoutesCI
const iterator of container of Ipv4RoutingTableEntry (routes to hosts)
virtual Ptr< Ipv4Route > RouteOutput(Ptr< Packet > p, const Ipv4Header &header, Ptr< NetDevice > oif, Socket::SocketErrno &sockerr)
Query routing cache for an existing route, for an outbound packet.
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:195
void SetOutputDevice(Ptr< NetDevice > outputDevice)
Equivalent in Linux to dst_entry.dev.
Definition: ipv4-route.cc:77
std::list< Ipv4RoutingTableEntry * >::iterator ASExternalRoutesI
iterator of container of Ipv4RoutingTableEntry (routes to external AS)
Ipv4Address GetDestination(void) const
Definition: ipv4-header.cc:304
void AddNetworkRouteTo(Ipv4Address network, Ipv4Mask networkMask, Ipv4Address nextHop, uint32_t interface)
Add a network route to the global routing table.
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
std::list< Ipv4RoutingTableEntry * >::iterator NetworkRoutesI
iterator of container of Ipv4RoutingTableEntry (routes to networks)
a class to store IPv4 address information on an interface
A network Node.
Definition: node.h:56
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
bool IsGateway(void) const
virtual void SetIpv4(Ptr< Ipv4 > ipv4)
static std::string FindName(Ptr< Object > object)
Given a pointer to an object, look to see if that object has a name associated with it and...
Definition: names.cc:817
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Definition: simulator.cc:287
NetworkRoutes m_networkRoutes
Routes to networks.
A base class which provides memory management and object aggregation.
Definition: object.h:87
static TypeId GetTypeId(void)
Get the type ID.
bool IsNull(void) const
Check for null implementation.
Definition: callback.h:1386
a unique identifier for an interface.
Definition: type-id.h:58
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
virtual void NotifyAddAddress(uint32_t interface, Ipv4InterfaceAddress address)
std::ostream * GetStream(void)
Return a pointer to an ostream previously set in the wrapper.
void SetDestination(Ipv4Address dest)
Definition: ipv4-route.cc:35
void AddASExternalRouteTo(Ipv4Address network, Ipv4Mask networkMask, Ipv4Address nextHop, uint32_t interface)
Add an external route to the global routing table.
virtual void NotifyRemoveAddress(uint32_t interface, Ipv4InterfaceAddress address)
void AddHostRouteTo(Ipv4Address dest, Ipv4Address nextHop, uint32_t interface)
Add a host route to the global routing table.