A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 "ipv4-global-routing.h"
31 #include "global-route-manager.h"
32 
33 NS_LOG_COMPONENT_DEFINE ("Ipv4GlobalRouting");
34 
35 namespace ns3 {
36 
37 NS_OBJECT_ENSURE_REGISTERED (Ipv4GlobalRouting)
38  ;
39 
40 TypeId
42 {
43  static TypeId tid = TypeId ("ns3::Ipv4GlobalRouting")
44  .SetParent<Object> ()
45  .AddAttribute ("RandomEcmpRouting",
46  "Set to true if packets are randomly routed among ECMP; set to false for using only one route consistently",
47  BooleanValue (false),
48  MakeBooleanAccessor (&Ipv4GlobalRouting::m_randomEcmpRouting),
49  MakeBooleanChecker ())
50  .AddAttribute ("RespondToInterfaceEvents",
51  "Set to true if you want to dynamically recompute the global routes upon Interface notification events (up/down, or add/remove address)",
52  BooleanValue (false),
53  MakeBooleanAccessor (&Ipv4GlobalRouting::m_respondToInterfaceEvents),
54  MakeBooleanChecker ())
55  ;
56  return tid;
57 }
58 
60  : m_randomEcmpRouting (false),
61  m_respondToInterfaceEvents (false)
62 {
63  NS_LOG_FUNCTION (this);
64 
65  m_rand = CreateObject<UniformRandomVariable> ();
66 }
67 
69 {
70  NS_LOG_FUNCTION (this);
71 }
72 
73 void
75  Ipv4Address nextHop,
76  uint32_t interface)
77 {
78  NS_LOG_FUNCTION (this << dest << nextHop << interface);
80  *route = Ipv4RoutingTableEntry::CreateHostRouteTo (dest, nextHop, interface);
81  m_hostRoutes.push_back (route);
82 }
83 
84 void
86  uint32_t interface)
87 {
88  NS_LOG_FUNCTION (this << dest << interface);
90  *route = Ipv4RoutingTableEntry::CreateHostRouteTo (dest, interface);
91  m_hostRoutes.push_back (route);
92 }
93 
94 void
96  Ipv4Mask networkMask,
97  Ipv4Address nextHop,
98  uint32_t interface)
99 {
100  NS_LOG_FUNCTION (this << network << networkMask << nextHop << interface);
103  networkMask,
104  nextHop,
105  interface);
106  m_networkRoutes.push_back (route);
107 }
108 
109 void
111  Ipv4Mask networkMask,
112  uint32_t interface)
113 {
114  NS_LOG_FUNCTION (this << network << networkMask << interface);
117  networkMask,
118  interface);
119  m_networkRoutes.push_back (route);
120 }
121 
122 void
124  Ipv4Mask networkMask,
125  Ipv4Address nextHop,
126  uint32_t interface)
127 {
128  NS_LOG_FUNCTION (this << network << networkMask << nextHop << interface);
131  networkMask,
132  nextHop,
133  interface);
134  m_ASexternalRoutes.push_back (route);
135 }
136 
137 
140 {
141  NS_LOG_FUNCTION (this << dest << oif);
142  NS_LOG_LOGIC ("Looking for route for destination " << dest);
143  Ptr<Ipv4Route> rtentry = 0;
144  // store all available routes that bring packets to their destination
145  typedef std::vector<Ipv4RoutingTableEntry*> RouteVec_t;
146  RouteVec_t allRoutes;
147 
148  NS_LOG_LOGIC ("Number of m_hostRoutes = " << m_hostRoutes.size ());
149  for (HostRoutesCI i = m_hostRoutes.begin ();
150  i != m_hostRoutes.end ();
151  i++)
152  {
153  NS_ASSERT ((*i)->IsHost ());
154  if ((*i)->GetDest ().IsEqual (dest))
155  {
156  if (oif != 0)
157  {
158  if (oif != m_ipv4->GetNetDevice ((*i)->GetInterface ()))
159  {
160  NS_LOG_LOGIC ("Not on requested interface, skipping");
161  continue;
162  }
163  }
164  allRoutes.push_back (*i);
165  NS_LOG_LOGIC (allRoutes.size () << "Found global host route" << *i);
166  }
167  }
168  if (allRoutes.size () == 0) // if no host route is found
169  {
170  NS_LOG_LOGIC ("Number of m_networkRoutes" << m_networkRoutes.size ());
171  for (NetworkRoutesI j = m_networkRoutes.begin ();
172  j != m_networkRoutes.end ();
173  j++)
174  {
175  Ipv4Mask mask = (*j)->GetDestNetworkMask ();
176  Ipv4Address entry = (*j)->GetDestNetwork ();
177  if (mask.IsMatch (dest, entry))
178  {
179  if (oif != 0)
180  {
181  if (oif != m_ipv4->GetNetDevice ((*j)->GetInterface ()))
182  {
183  NS_LOG_LOGIC ("Not on requested interface, skipping");
184  continue;
185  }
186  }
187  allRoutes.push_back (*j);
188  NS_LOG_LOGIC (allRoutes.size () << "Found global network route" << *j);
189  }
190  }
191  }
192  if (allRoutes.size () == 0) // consider external if no host/network found
193  {
194  for (ASExternalRoutesI k = m_ASexternalRoutes.begin ();
195  k != m_ASexternalRoutes.end ();
196  k++)
197  {
198  Ipv4Mask mask = (*k)->GetDestNetworkMask ();
199  Ipv4Address entry = (*k)->GetDestNetwork ();
200  if (mask.IsMatch (dest, entry))
201  {
202  NS_LOG_LOGIC ("Found external route" << *k);
203  if (oif != 0)
204  {
205  if (oif != m_ipv4->GetNetDevice ((*k)->GetInterface ()))
206  {
207  NS_LOG_LOGIC ("Not on requested interface, skipping");
208  continue;
209  }
210  }
211  allRoutes.push_back (*k);
212  break;
213  }
214  }
215  }
216  if (allRoutes.size () > 0 ) // if route(s) is found
217  {
218  // pick up one of the routes uniformly at random if random
219  // ECMP routing is enabled, or always select the first route
220  // consistently if random ECMP routing is disabled
221  uint32_t selectIndex;
223  {
224  selectIndex = m_rand->GetInteger (0, allRoutes.size ()-1);
225  }
226  else
227  {
228  selectIndex = 0;
229  }
230  Ipv4RoutingTableEntry* route = allRoutes.at (selectIndex);
231  // create a Ipv4Route object from the selected routing table entry
232  rtentry = Create<Ipv4Route> ();
233  rtentry->SetDestination (route->GetDest ());
235  rtentry->SetSource (m_ipv4->GetAddress (route->GetInterface (), 0).GetLocal ());
236  rtentry->SetGateway (route->GetGateway ());
237  uint32_t interfaceIdx = route->GetInterface ();
238  rtentry->SetOutputDevice (m_ipv4->GetNetDevice (interfaceIdx));
239  return rtentry;
240  }
241  else
242  {
243  return 0;
244  }
245 }
246 
247 uint32_t
249 {
250  NS_LOG_FUNCTION (this);
251  uint32_t n = 0;
252  n += m_hostRoutes.size ();
253  n += m_networkRoutes.size ();
254  n += m_ASexternalRoutes.size ();
255  return n;
256 }
257 
259 Ipv4GlobalRouting::GetRoute (uint32_t index) const
260 {
261  NS_LOG_FUNCTION (this << index);
262  if (index < m_hostRoutes.size ())
263  {
264  uint32_t tmp = 0;
265  for (HostRoutesCI i = m_hostRoutes.begin ();
266  i != m_hostRoutes.end ();
267  i++)
268  {
269  if (tmp == index)
270  {
271  return *i;
272  }
273  tmp++;
274  }
275  }
276  index -= m_hostRoutes.size ();
277  uint32_t tmp = 0;
278  if (index < m_networkRoutes.size ())
279  {
280  for (NetworkRoutesCI j = m_networkRoutes.begin ();
281  j != m_networkRoutes.end ();
282  j++)
283  {
284  if (tmp == index)
285  {
286  return *j;
287  }
288  tmp++;
289  }
290  }
291  index -= m_networkRoutes.size ();
292  tmp = 0;
293  for (ASExternalRoutesCI k = m_ASexternalRoutes.begin ();
294  k != m_ASexternalRoutes.end ();
295  k++)
296  {
297  if (tmp == index)
298  {
299  return *k;
300  }
301  tmp++;
302  }
303  NS_ASSERT (false);
304  // quiet compiler.
305  return 0;
306 }
307 void
309 {
310  NS_LOG_FUNCTION (this << index);
311  if (index < m_hostRoutes.size ())
312  {
313  uint32_t tmp = 0;
314  for (HostRoutesI i = m_hostRoutes.begin ();
315  i != m_hostRoutes.end ();
316  i++)
317  {
318  if (tmp == index)
319  {
320  NS_LOG_LOGIC ("Removing route " << index << "; size = " << m_hostRoutes.size ());
321  delete *i;
322  m_hostRoutes.erase (i);
323  NS_LOG_LOGIC ("Done removing host route " << index << "; host route remaining size = " << m_hostRoutes.size ());
324  return;
325  }
326  tmp++;
327  }
328  }
329  index -= m_hostRoutes.size ();
330  uint32_t tmp = 0;
331  for (NetworkRoutesI j = m_networkRoutes.begin ();
332  j != m_networkRoutes.end ();
333  j++)
334  {
335  if (tmp == index)
336  {
337  NS_LOG_LOGIC ("Removing route " << index << "; size = " << m_networkRoutes.size ());
338  delete *j;
339  m_networkRoutes.erase (j);
340  NS_LOG_LOGIC ("Done removing network route " << index << "; network route remaining size = " << m_networkRoutes.size ());
341  return;
342  }
343  tmp++;
344  }
345  index -= m_networkRoutes.size ();
346  tmp = 0;
347  for (ASExternalRoutesI k = m_ASexternalRoutes.begin ();
348  k != m_ASexternalRoutes.end ();
349  k++)
350  {
351  if (tmp == index)
352  {
353  NS_LOG_LOGIC ("Removing route " << index << "; size = " << m_ASexternalRoutes.size ());
354  delete *k;
355  m_ASexternalRoutes.erase (k);
356  NS_LOG_LOGIC ("Done removing network route " << index << "; network route remaining size = " << m_networkRoutes.size ());
357  return;
358  }
359  tmp++;
360  }
361  NS_ASSERT (false);
362 }
363 
364 int64_t
366 {
367  NS_LOG_FUNCTION (this << stream);
368  m_rand->SetStream (stream);
369  return 1;
370 }
371 
372 void
374 {
375  NS_LOG_FUNCTION (this);
376  for (HostRoutesI i = m_hostRoutes.begin ();
377  i != m_hostRoutes.end ();
378  i = m_hostRoutes.erase (i))
379  {
380  delete (*i);
381  }
382  for (NetworkRoutesI j = m_networkRoutes.begin ();
383  j != m_networkRoutes.end ();
384  j = m_networkRoutes.erase (j))
385  {
386  delete (*j);
387  }
388  for (ASExternalRoutesI l = m_ASexternalRoutes.begin ();
389  l != m_ASexternalRoutes.end ();
390  l = m_ASexternalRoutes.erase (l))
391  {
392  delete (*l);
393  }
394 
396 }
397 
398 // Formatted like output of "route -n" command
399 void
401 {
402  NS_LOG_FUNCTION (this << stream);
403  std::ostream* os = stream->GetStream ();
404  if (GetNRoutes () > 0)
405  {
406  *os << "Destination Gateway Genmask Flags Metric Ref Use Iface" << std::endl;
407  for (uint32_t j = 0; j < GetNRoutes (); j++)
408  {
409  std::ostringstream dest, gw, mask, flags;
410  Ipv4RoutingTableEntry route = GetRoute (j);
411  dest << route.GetDest ();
412  *os << std::setiosflags (std::ios::left) << std::setw (16) << dest.str ();
413  gw << route.GetGateway ();
414  *os << std::setiosflags (std::ios::left) << std::setw (16) << gw.str ();
415  mask << route.GetDestNetworkMask ();
416  *os << std::setiosflags (std::ios::left) << std::setw (16) << mask.str ();
417  flags << "U";
418  if (route.IsHost ())
419  {
420  flags << "H";
421  }
422  else if (route.IsGateway ())
423  {
424  flags << "G";
425  }
426  *os << std::setiosflags (std::ios::left) << std::setw (6) << flags.str ();
427  // Metric not implemented
428  *os << "-" << " ";
429  // Ref ct not implemented
430  *os << "-" << " ";
431  // Use not implemented
432  *os << "-" << " ";
433  if (Names::FindName (m_ipv4->GetNetDevice (route.GetInterface ())) != "")
434  {
435  *os << Names::FindName (m_ipv4->GetNetDevice (route.GetInterface ()));
436  }
437  else
438  {
439  *os << route.GetInterface ();
440  }
441  *os << std::endl;
442  }
443  }
444 }
445 
448 {
449  NS_LOG_FUNCTION (this << p << &header << oif << &sockerr);
450 //
451 // First, see if this is a multicast packet we have a route for. If we
452 // have a route, then send the packet down each of the specified interfaces.
453 //
454  if (header.GetDestination ().IsMulticast ())
455  {
456  NS_LOG_LOGIC ("Multicast destination-- returning false");
457  return 0; // Let other routing protocols try to handle this
458  }
459 //
460 // See if this is a unicast packet we have a route for.
461 //
462  NS_LOG_LOGIC ("Unicast destination- looking up");
463  Ptr<Ipv4Route> rtentry = LookupGlobal (header.GetDestination (), oif);
464  if (rtentry)
465  {
466  sockerr = Socket::ERROR_NOTERROR;
467  }
468  else
469  {
470  sockerr = Socket::ERROR_NOROUTETOHOST;
471  }
472  return rtentry;
473 }
474 
475 bool
478 {
479  NS_LOG_FUNCTION (this << p << header << header.GetSource () << header.GetDestination () << idev << &lcb << &ecb);
480  // Check if input device supports IP
481  NS_ASSERT (m_ipv4->GetInterfaceForDevice (idev) >= 0);
482  uint32_t iif = m_ipv4->GetInterfaceForDevice (idev);
483 
484  if (header.GetDestination ().IsMulticast ())
485  {
486  NS_LOG_LOGIC ("Multicast destination-- returning false");
487  return false; // Let other routing protocols try to handle this
488  }
489 
490  if (header.GetDestination ().IsBroadcast ())
491  {
492  NS_LOG_LOGIC ("For me (Ipv4Addr broadcast address)");
495  }
496 
498  // Right now, we will be permissive and allow a source to send us
499  // a packet to one of our other interface addresses; that is, the
500  // destination unicast address does not match one of the iif addresses,
501  // but we check our other interfaces. This could be an option
502  // (to remove the outer loop immediately below and just check iif).
503  for (uint32_t j = 0; j < m_ipv4->GetNInterfaces (); j++)
504  {
505  for (uint32_t i = 0; i < m_ipv4->GetNAddresses (j); i++)
506  {
507  Ipv4InterfaceAddress iaddr = m_ipv4->GetAddress (j, i);
508  Ipv4Address addr = iaddr.GetLocal ();
509  if (addr.IsEqual (header.GetDestination ()))
510  {
511  if (j == iif)
512  {
513  NS_LOG_LOGIC ("For me (destination " << addr << " match)");
514  }
515  else
516  {
517  NS_LOG_LOGIC ("For me (destination " << addr << " match) on another interface " << header.GetDestination ());
518  }
519  lcb (p, header, iif);
520  return true;
521  }
522  if (header.GetDestination ().IsEqual (iaddr.GetBroadcast ()))
523  {
524  NS_LOG_LOGIC ("For me (interface broadcast address)");
525  lcb (p, header, iif);
526  return true;
527  }
528  NS_LOG_LOGIC ("Address "<< addr << " not a match");
529  }
530  }
531  // Check if input device supports IP forwarding
532  if (m_ipv4->IsForwarding (iif) == false)
533  {
534  NS_LOG_LOGIC ("Forwarding disabled for this interface");
535  ecb (p, header, Socket::ERROR_NOROUTETOHOST);
536  return false;
537  }
538  // Next, try to find a route
539  NS_LOG_LOGIC ("Unicast destination- looking up global route");
540  Ptr<Ipv4Route> rtentry = LookupGlobal (header.GetDestination ());
541  if (rtentry != 0)
542  {
543  NS_LOG_LOGIC ("Found unicast destination- calling unicast callback");
544  ucb (rtentry, p, header);
545  return true;
546  }
547  else
548  {
549  NS_LOG_LOGIC ("Did not find unicast destination- returning false");
550  return false; // Let other routing protocols try to handle this
551  // route request.
552  }
553 }
554 void
556 {
557  NS_LOG_FUNCTION (this << i);
558  if (m_respondToInterfaceEvents && Simulator::Now ().GetSeconds () > 0) // avoid startup events
559  {
563  }
564 }
565 
566 void
568 {
569  NS_LOG_FUNCTION (this << i);
570  if (m_respondToInterfaceEvents && Simulator::Now ().GetSeconds () > 0) // avoid startup events
571  {
575  }
576 }
577 
578 void
580 {
581  NS_LOG_FUNCTION (this << interface << address);
582  if (m_respondToInterfaceEvents && Simulator::Now ().GetSeconds () > 0) // avoid startup events
583  {
587  }
588 }
589 
590 void
592 {
593  NS_LOG_FUNCTION (this << interface << address);
594  if (m_respondToInterfaceEvents && Simulator::Now ().GetSeconds () > 0) // avoid startup events
595  {
599  }
600 }
601 
602 void
604 {
605  NS_LOG_FUNCTION (this << ipv4);
606  NS_ASSERT (m_ipv4 == 0 && ipv4 != 0);
607  m_ipv4 = ipv4;
608 }
609 
610 
611 } // 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)
Definition: log.h:345
void SetStream(int64_t stream)
Specifies the stream number for this RNG stream.
static void InitializeRoutes()
Compute routes using a Dijkstra SPF computation and populate per-node forwarding tables.
Hold a bool native type.
Definition: boolean.h:38
void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
Callback template class.
Definition: callback.h:920
Ipv4GlobalRouting()
Construct an empty Ipv4GlobalRouting routing protocol,.
uint32_t GetInteger(uint32_t min, uint32_t max)
Returns a random unsigned integer from a uniform distribution over the interval [min,max] including both ends.
bool IsMatch(Ipv4Address a, Ipv4Address b) const
Ipv4Address GetLocal(void) const
Get the local address.
a class to represent an Ipv4 address mask
Definition: ipv4-address.h:210
Ipv4Address GetDestination(void) const
Definition: ipv4-header.cc:304
#define NS_ASSERT(condition)
Definition: assert.h:64
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
virtual void PrintRoutingTable(Ptr< OutputStreamWrapper > stream) const
Print the Routing Table entries.
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)
bool IsMulticast(void) const
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
Definition: object.cc:336
virtual void NotifyInterfaceDown(uint32_t interface)
Ipv4Address GetSource(void) const
Definition: ipv4-header.cc:291
void RemoveRoute(uint32_t i)
Remove a route from the global unicast routing table.
Ipv4RoutingTableEntry * GetRoute(uint32_t i) const
Get a route from the global unicast routing table.
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
ASExternalRoutes m_ASexternalRoutes
External routes imported.
void SetSource(Ipv4Address src)
Definition: ipv4-route.cc:49
uint32_t GetInterface(void) const
Packet header for IPv4.
Definition: ipv4-header.h:31
HostRoutes m_hostRoutes
Routes to hosts.
Ptr< UniformRandomVariable > m_rand
A uniform random number generator for randomly routing packets among ECMP.
A record of an IPv4 routing table entry for Ipv4GlobalRouting and Ipv4StaticRouting.
bool IsGateway(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...
bool IsBroadcast(void) const
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)
#define NS_LOG_LOGIC(msg)
Definition: log.h:368
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)
bool IsEqual(const Ipv4Address &other) const
Comparison operation between two Ipv4Addresses.
Definition: ipv4-address.h:81
static void BuildGlobalRoutingDatabase()
Build the routing database by gathering Link State Advertisements from each node exporting a GlobalRo...
Ipv4Address GetDest(void) const
NS_LOG_COMPONENT_DEFINE("Ipv4GlobalRouting")
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 time".
Definition: simulator.cc:180
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)
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:38
std::list< Ipv4RoutingTableEntry * >::iterator NetworkRoutesI
iterator of container of Ipv4RoutingTableEntry (routes to networks)
Ipv4Address GetBroadcast(void) const
Get the broadcast address.
a class to store IPv4 address information on an interface
Ipv4Address GetGateway(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:665
NetworkRoutes m_networkRoutes
Routes to networks.
a base class which provides memory management and object aggregation
Definition: object.h:63
tuple address
Definition: first.py:37
bool IsHost(void) const
static TypeId GetTypeId(void)
Get the type ID.
Ipv4Mask GetDestNetworkMask(void) const
a unique identifier for an interface.
Definition: type-id.h:49
TypeId SetParent(TypeId tid)
Definition: type-id.cc:611
virtual void NotifyAddAddress(uint32_t interface, Ipv4InterfaceAddress address)
std::ostream * GetStream(void)
Return a pointer to an ostream previously set in the wrapper.
uint32_t GetNRoutes(void) const
Get the number of individual unicast routes that have been added to the routing table.
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.