A Discrete-Event Network Simulator
API
rip.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2016 Universita' di Firenze, Italy
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  * Author: Tommaso Pecorella <tommaso.pecorella@unifi.it>
19  */
20 
21 #include <iomanip>
22 #include "rip.h"
23 #include "ns3/log.h"
24 #include "ns3/abort.h"
25 #include "ns3/assert.h"
26 #include "ns3/unused.h"
27 #include "ns3/random-variable-stream.h"
28 #include "ns3/ipv4-route.h"
29 #include "ns3/node.h"
30 #include "ns3/names.h"
31 #include "ns3/rip-header.h"
32 #include "ns3/udp-header.h"
33 #include "ns3/enum.h"
34 #include "ns3/uinteger.h"
35 #include "ns3/ipv4-packet-info-tag.h"
36 #include "ns3/loopback-net-device.h"
37 
38 #define RIP_ALL_NODE "224.0.0.9"
39 #define RIP_PORT 520
40 
41 namespace ns3 {
42 
44 
46 
48  : m_ipv4 (0), m_splitHorizonStrategy (Rip::POISON_REVERSE), m_initialized (false)
49 {
50  m_rng = CreateObject<UniformRandomVariable> ();
51 }
52 
54 {
55 }
56 
57 TypeId
59 {
60  static TypeId tid = TypeId ("ns3::Rip")
62  .SetGroupName ("Internet")
63  .AddConstructor<Rip> ()
64  .AddAttribute ("UnsolicitedRoutingUpdate", "The time between two Unsolicited Routing Updates.",
65  TimeValue (Seconds(30)),
67  MakeTimeChecker ())
68  .AddAttribute ("StartupDelay", "Maximum random delay for protocol startup (send route requests).",
69  TimeValue (Seconds(1)),
71  MakeTimeChecker ())
72  .AddAttribute ("TimeoutDelay", "The delay to invalidate a route.",
73  TimeValue (Seconds(180)),
75  MakeTimeChecker ())
76  .AddAttribute ("GarbageCollectionDelay", "The delay to delete an expired route.",
77  TimeValue (Seconds(120)),
79  MakeTimeChecker ())
80  .AddAttribute ("MinTriggeredCooldown", "Min cooldown delay after a Triggered Update.",
81  TimeValue (Seconds(1)),
83  MakeTimeChecker ())
84  .AddAttribute ("MaxTriggeredCooldown", "Max cooldown delay after a Triggered Update.",
85  TimeValue (Seconds(5)),
87  MakeTimeChecker ())
88  .AddAttribute ("SplitHorizon", "Split Horizon strategy.",
91  MakeEnumChecker (Rip::NO_SPLIT_HORIZON, "NoSplitHorizon",
92  Rip::SPLIT_HORIZON, "SplitHorizon",
93  Rip::POISON_REVERSE, "PoisonReverse"))
94  .AddAttribute ("LinkDownValue", "Value for link down in count to infinity.",
95  UintegerValue (16),
97  MakeUintegerChecker<uint32_t> ())
98  ;
99  return tid;
100 }
101 
102 int64_t Rip::AssignStreams (int64_t stream)
103 {
104  NS_LOG_FUNCTION (this << stream);
105 
106  m_rng->SetStream (stream);
107  return 1;
108 }
109 
111 {
112  NS_LOG_FUNCTION (this);
113 
114  bool addedGlobal = false;
115 
116  m_initialized = true;
117 
120 
121 
122  for (uint32_t i = 0 ; i < m_ipv4->GetNInterfaces (); i++)
123  {
124  Ptr<LoopbackNetDevice> check = DynamicCast<LoopbackNetDevice> (m_ipv4->GetNetDevice (i));
125  if (check)
126  {
127  continue;
128  }
129 
130  bool activeInterface = false;
131  if (m_interfaceExclusions.find (i) == m_interfaceExclusions.end ())
132  {
133  activeInterface = true;
134  m_ipv4->SetForwarding (i, true);
135  }
136 
137  for (uint32_t j = 0; j < m_ipv4->GetNAddresses (i); j++)
138  {
139  Ipv4InterfaceAddress address = m_ipv4->GetAddress (i, j);
140  if (address.GetScope() != Ipv4InterfaceAddress::HOST && activeInterface == true)
141  {
142  NS_LOG_LOGIC ("RIP: adding socket to " << address.GetLocal ());
143  TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory");
144  Ptr<Node> theNode = GetObject<Node> ();
145  Ptr<Socket> socket = Socket::CreateSocket (theNode, tid);
146  InetSocketAddress local = InetSocketAddress (address.GetLocal (), RIP_PORT);
147  socket->BindToNetDevice (m_ipv4->GetNetDevice (i));
148  int ret = socket->Bind (local);
149  NS_ASSERT_MSG (ret == 0, "Bind unsuccessful");
150 
151  socket->SetRecvCallback (MakeCallback (&Rip::Receive, this));
152  socket->SetIpRecvTtl (true);
153  socket->SetRecvPktInfo (true);
154 
155  m_unicastSocketList[socket] = i;
156  }
157  else if (m_ipv4->GetAddress (i, j).GetScope() == Ipv4InterfaceAddress::GLOBAL)
158  {
159  addedGlobal = true;
160  }
161  }
162  }
163 
165  {
166  NS_LOG_LOGIC ("RIP: adding receiving socket");
167  TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory");
168  Ptr<Node> theNode = GetObject<Node> ();
171  m_multicastRecvSocket->Bind (local);
175  }
176 
177 
178  if (addedGlobal)
179  {
182  }
183 
184  delay = Seconds (m_rng->GetValue (0.01, m_startupDelay.GetSeconds ()));
186 
188 }
189 
191 {
192  NS_LOG_FUNCTION (this << header << oif);
193 
194  Ipv4Address destination = header.GetDestination ();
195  Ptr<Ipv4Route> rtentry = 0;
196 
197  if (destination.IsMulticast ())
198  {
199  // Note: Multicast routes for outbound packets are stored in the
200  // normal unicast table. An implication of this is that it is not
201  // possible to source multicast datagrams on multiple interfaces.
202  // This is a well-known property of sockets implementation on
203  // many Unix variants.
204  // So, we just log it and fall through to LookupStatic ()
205  NS_LOG_LOGIC ("RouteOutput (): Multicast destination");
206  }
207 
208  rtentry = Lookup (destination, true, oif);
209  if (rtentry)
210  {
211  sockerr = Socket::ERROR_NOTERROR;
212  }
213  else
214  {
215  sockerr = Socket::ERROR_NOROUTETOHOST;
216  }
217  return rtentry;
218 }
219 
223 {
224  NS_LOG_FUNCTION (this << p << header << header.GetSource () << header.GetDestination () << idev);
225 
226  NS_ASSERT (m_ipv4 != 0);
227  // Check if input device supports IP
228  NS_ASSERT (m_ipv4->GetInterfaceForDevice (idev) >= 0);
229  uint32_t iif = m_ipv4->GetInterfaceForDevice (idev);
230  Ipv4Address dst = header.GetDestination ();
231 
232  if (m_ipv4->IsDestinationAddress (header.GetDestination (), iif))
233  {
234  if (!lcb.IsNull ())
235  {
236  NS_LOG_LOGIC ("Local delivery to " << header.GetDestination ());
237  lcb (p, header, iif);
238  return true;
239  }
240  else
241  {
242  // The local delivery callback is null. This may be a multicast
243  // or broadcast packet, so return false so that another
244  // multicast routing protocol can handle it. It should be possible
245  // to extend this to explicitly check whether it is a unicast
246  // packet, and invoke the error callback if so
247  return false;
248  }
249  }
250 
251  if (dst.IsMulticast ())
252  {
253  NS_LOG_LOGIC ("Multicast route not supported by RIP");
254  return false; // Let other routing protocols try to handle this
255  }
256 
257  if (header.GetDestination ().IsBroadcast ())
258  {
259  NS_LOG_LOGIC ("Dropping packet not for me and with dst Broadcast");
260  if (!ecb.IsNull ())
261  {
262  ecb (p, header, Socket::ERROR_NOROUTETOHOST);
263  }
264  return false;
265  }
266 
267  // Check if input device supports IP forwarding
268  if (m_ipv4->IsForwarding (iif) == false)
269  {
270  NS_LOG_LOGIC ("Forwarding disabled for this interface");
271  if (!ecb.IsNull ())
272  {
273  ecb (p, header, Socket::ERROR_NOROUTETOHOST);
274  }
275  return true;
276  }
277  // Next, try to find a route
278  NS_LOG_LOGIC ("Unicast destination");
279  Ptr<Ipv4Route> rtentry = Lookup (header.GetDestination (), false);
280 
281  if (rtentry != 0)
282  {
283  NS_LOG_LOGIC ("Found unicast destination - calling unicast callback");
284  ucb (rtentry, p, header); // unicast forwarding callback
285  return true;
286  }
287  else
288  {
289  NS_LOG_LOGIC ("Did not find unicast destination - returning false");
290  return false; // Let other routing protocols try to handle this
291  }
292 }
293 
294 void Rip::NotifyInterfaceUp (uint32_t i)
295 {
296  NS_LOG_FUNCTION (this << i);
297 
298  Ptr<LoopbackNetDevice> check = DynamicCast<LoopbackNetDevice> (m_ipv4->GetNetDevice (i));
299  if (check)
300  {
301  return;
302  }
303 
304  for (uint32_t j = 0; j < m_ipv4->GetNAddresses (i); j++)
305  {
306  Ipv4InterfaceAddress address = m_ipv4->GetAddress (i, j);
307  Ipv4Mask networkMask = address.GetMask ();
308  Ipv4Address networkAddress = address.GetLocal ().CombineMask (networkMask);
309 
310  if (address.GetScope () == Ipv4InterfaceAddress::GLOBAL)
311  {
312  AddNetworkRouteTo (networkAddress, networkMask, i);
313  }
314  }
315 
316  if (!m_initialized)
317  {
318  return;
319  }
320 
321 
322  bool sendSocketFound = false;
323  for (SocketListI iter = m_unicastSocketList.begin (); iter != m_unicastSocketList.end (); iter++ )
324  {
325  if (iter->second == i)
326  {
327  sendSocketFound = true;
328  break;
329  }
330  }
331 
332  bool activeInterface = false;
333  if (m_interfaceExclusions.find (i) == m_interfaceExclusions.end ())
334  {
335  activeInterface = true;
336  m_ipv4->SetForwarding (i, true);
337  }
338 
339  for (uint32_t j = 0; j < m_ipv4->GetNAddresses (i); j++)
340  {
341  Ipv4InterfaceAddress address = m_ipv4->GetAddress (i, j);
342 
343  if (address.GetScope() != Ipv4InterfaceAddress::HOST && sendSocketFound == false && activeInterface == true)
344  {
345  NS_LOG_LOGIC ("RIP: adding sending socket to " << address.GetLocal ());
346  TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory");
347  Ptr<Node> theNode = GetObject<Node> ();
348  Ptr<Socket> socket = Socket::CreateSocket (theNode, tid);
349  InetSocketAddress local = InetSocketAddress (address.GetLocal (), RIP_PORT);
350  socket->BindToNetDevice (m_ipv4->GetNetDevice (i));
351  socket->Bind (local);
352  socket->SetRecvCallback (MakeCallback (&Rip::Receive, this));
353  socket->SetIpRecvTtl (true);
354  socket->SetRecvPktInfo (true);
355  m_unicastSocketList[socket] = i;
356  }
357  if (address.GetScope () == Ipv4InterfaceAddress::GLOBAL)
358  {
360  }
361  }
362 
364  {
365  NS_LOG_LOGIC ("RIP: adding receiving socket");
366  TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory");
367  Ptr<Node> theNode = GetObject<Node> ();
370  m_multicastRecvSocket->Bind (local);
374  }
375 }
376 
377 void Rip::NotifyInterfaceDown (uint32_t interface)
378 {
379  NS_LOG_FUNCTION (this << interface);
380 
381  /* remove all routes that are going through this interface */
382  for (RoutesI it = m_routes.begin (); it != m_routes.end (); it++)
383  {
384  if (it->first->GetInterface () == interface)
385  {
386  InvalidateRoute (it->first);
387  }
388  }
389 
390  for (SocketListI iter = m_unicastSocketList.begin (); iter != m_unicastSocketList.end (); iter++ )
391  {
392  NS_LOG_INFO ("Checking socket for interface " << interface);
393  if (iter->second == interface)
394  {
395  NS_LOG_INFO ("Removed socket for interface " << interface);
396  iter->first->Close ();
397  m_unicastSocketList.erase (iter);
398  break;
399  }
400  }
401 
402  if (m_interfaceExclusions.find (interface) == m_interfaceExclusions.end ())
403  {
405  }
406 }
407 
409 {
410  NS_LOG_FUNCTION (this << interface << address);
411 
412  if (!m_ipv4->IsUp (interface))
413  {
414  return;
415  }
416 
417  if (m_interfaceExclusions.find (interface) != m_interfaceExclusions.end ())
418  {
419  return;
420  }
421 
422  Ipv4Address networkAddress = address.GetLocal ().CombineMask (address.GetMask ());
423  Ipv4Mask networkMask = address.GetMask ();
424 
425  if (address.GetScope () == Ipv4InterfaceAddress::GLOBAL)
426  {
427  AddNetworkRouteTo (networkAddress, networkMask, interface);
428  }
429 
431 }
432 
434 {
435  NS_LOG_FUNCTION (this << interface << address);
436 
437  if (!m_ipv4->IsUp (interface))
438  {
439  return;
440  }
441 
442  if (address.GetScope() != Ipv4InterfaceAddress::GLOBAL)
443  {
444  return;
445  }
446 
447  Ipv4Address networkAddress = address.GetLocal ().CombineMask (address.GetMask ());
448  Ipv4Mask networkMask = address.GetMask ();
449 
450  // Remove all routes that are going through this interface
451  // which reference this network
452  for (RoutesI it = m_routes.begin (); it != m_routes.end (); it++)
453  {
454  if (it->first->GetInterface () == interface
455  && it->first->IsNetwork ()
456  && it->first->GetDestNetwork () == networkAddress
457  && it->first->GetDestNetworkMask () == networkMask)
458  {
459  InvalidateRoute (it->first);
460  }
461  }
462 
463  if (m_interfaceExclusions.find (interface) == m_interfaceExclusions.end ())
464  {
466  }
467 
468 }
469 
471 {
472  NS_LOG_FUNCTION (this << ipv4);
473 
474  NS_ASSERT (m_ipv4 == 0 && ipv4 != 0);
475  uint32_t i = 0;
476  m_ipv4 = ipv4;
477 
478  for (i = 0; i < m_ipv4->GetNInterfaces (); i++)
479  {
480  if (m_ipv4->IsUp (i))
481  {
482  NotifyInterfaceUp (i);
483  }
484  else
485  {
487  }
488  }
489 }
490 
492 {
493  NS_LOG_FUNCTION (this << stream);
494 
495  std::ostream* os = stream->GetStream ();
496  // Copy the current ostream state
497  std::ios oldState (nullptr);
498  oldState.copyfmt (*os);
499 
500  *os << std::resetiosflags (std::ios::adjustfield) << std::setiosflags (std::ios::left);
501 
502  *os << "Node: " << m_ipv4->GetObject<Node> ()->GetId ()
503  << ", Time: " << Now().As (unit)
504  << ", Local time: " << m_ipv4->GetObject<Node> ()->GetLocalTime ().As (unit)
505  << ", IPv4 RIP table" << std::endl;
506 
507  if (!m_routes.empty ())
508  {
509  *os << "Destination Gateway Genmask Flags Metric Ref Use Iface" << std::endl;
510  for (RoutesCI it = m_routes.begin (); it != m_routes.end (); it++)
511  {
512  RipRoutingTableEntry* route = it->first;
514 
515  if (status == RipRoutingTableEntry::RIP_VALID)
516  {
517  std::ostringstream dest, gw, mask, flags;
518  dest << route->GetDest ();
519  *os << std::setw (16) << dest.str ();
520  gw << route->GetGateway ();
521  *os << std::setw (16) << gw.str ();
522  mask << route->GetDestNetworkMask ();
523  *os << std::setw (16) << mask.str ();
524  flags << "U";
525  if (route->IsHost ())
526  {
527  flags << "HS";
528  }
529  else if (route->IsGateway ())
530  {
531  flags << "GS";
532  }
533  *os << std::setw (6) << flags.str ();
534  *os << std::setw (7) << int(route->GetRouteMetric ());
535  // Ref ct not implemented
536  *os << "-" << " ";
537  // Use not implemented
538  *os << "-" << " ";
539  if (Names::FindName (m_ipv4->GetNetDevice (route->GetInterface ())) != "")
540  {
541  *os << Names::FindName (m_ipv4->GetNetDevice (route->GetInterface ()));
542  }
543  else
544  {
545  *os << route->GetInterface ();
546  }
547  *os << std::endl;
548  }
549  }
550  }
551  *os << std::endl;
552  // Restore the previous ostream state
553  (*os).copyfmt (oldState);
554 }
555 
557 {
558  NS_LOG_FUNCTION (this);
559 
560  for (RoutesI j = m_routes.begin (); j != m_routes.end (); j = m_routes.erase (j))
561  {
562  delete j->first;
563  }
564  m_routes.clear ();
565 
570 
571  for (SocketListI iter = m_unicastSocketList.begin (); iter != m_unicastSocketList.end (); iter++ )
572  {
573  iter->first->Close ();
574  }
575  m_unicastSocketList.clear ();
576 
579 
580  m_ipv4 = 0;
581 
583 }
584 
585 Ptr<Ipv4Route> Rip::Lookup (Ipv4Address dst, bool setSource, Ptr<NetDevice> interface)
586 {
587  NS_LOG_FUNCTION (this << dst << interface);
588 
589  Ptr<Ipv4Route> rtentry = 0;
590  uint16_t longestMask = 0;
591 
592  /* when sending on local multicast, there have to be interface specified */
593  if (dst.IsLocalMulticast ())
594  {
595  NS_ASSERT_MSG (interface, "Try to send on local multicast address, and no interface index is given!");
596  rtentry = Create<Ipv4Route> ();
597  rtentry->SetSource (m_ipv4->SourceAddressSelection (m_ipv4->GetInterfaceForDevice (interface), dst));
598  rtentry->SetDestination (dst);
599  rtentry->SetGateway (Ipv4Address::GetZero ());
600  rtentry->SetOutputDevice (interface);
601  return rtentry;
602  }
603 
604  for (RoutesI it = m_routes.begin (); it != m_routes.end (); it++)
605  {
606  RipRoutingTableEntry* j = it->first;
607 
609  {
610  Ipv4Mask mask = j->GetDestNetworkMask ();
611  uint16_t maskLen = mask.GetPrefixLength ();
612  Ipv4Address entry = j->GetDestNetwork ();
613 
614  NS_LOG_LOGIC ("Searching for route to " << dst << ", mask length " << maskLen);
615 
616  if (mask.IsMatch (dst, entry))
617  {
618  NS_LOG_LOGIC ("Found global network route " << j << ", mask length " << maskLen);
619 
620  /* if interface is given, check the route will output on this interface */
621  if (!interface || interface == m_ipv4->GetNetDevice (j->GetInterface ()))
622  {
623  if (maskLen < longestMask)
624  {
625  NS_LOG_LOGIC ("Previous match longer, skipping");
626  continue;
627  }
628 
629  longestMask = maskLen;
630 
631  Ipv4RoutingTableEntry* route = j;
632  uint32_t interfaceIdx = route->GetInterface ();
633  rtentry = Create<Ipv4Route> ();
634 
635  if (setSource)
636  {
637  if (route->GetDest ().IsAny ()) /* default route */
638  {
639  rtentry->SetSource (m_ipv4->SourceAddressSelection (interfaceIdx, route->GetGateway ()));
640  }
641  else
642  {
643  rtentry->SetSource (m_ipv4->SourceAddressSelection (interfaceIdx, route->GetDest ()));
644  }
645  }
646 
647  rtentry->SetDestination (route->GetDest ());
648  rtentry->SetGateway (route->GetGateway ());
649  rtentry->SetOutputDevice (m_ipv4->GetNetDevice (interfaceIdx));
650  }
651  }
652  }
653  }
654 
655  if (rtentry)
656  {
657  NS_LOG_LOGIC ("Matching route via " << rtentry->GetDestination () << " (through " << rtentry->GetGateway () << ") at the end");
658  }
659  return rtentry;
660 }
661 
662 void Rip::AddNetworkRouteTo (Ipv4Address network, Ipv4Mask networkPrefix, Ipv4Address nextHop, uint32_t interface)
663 {
664  NS_LOG_FUNCTION (this << network << networkPrefix << nextHop << interface);
665 
666  RipRoutingTableEntry* route = new RipRoutingTableEntry (network, networkPrefix, nextHop, interface);
667  route->SetRouteMetric (1);
669  route->SetRouteChanged (true);
670 
671  m_routes.push_back (std::make_pair (route, EventId ()));
672 }
673 
674 void Rip::AddNetworkRouteTo (Ipv4Address network, Ipv4Mask networkPrefix, uint32_t interface)
675 {
676  NS_LOG_FUNCTION (this << network << networkPrefix << interface);
677 
678  RipRoutingTableEntry* route = new RipRoutingTableEntry (network, networkPrefix, interface);
679  route->SetRouteMetric (1);
681  route->SetRouteChanged (true);
682 
683  m_routes.push_back (std::make_pair (route, EventId ()));
684 }
685 
687 {
688  NS_LOG_FUNCTION (this << *route);
689 
690  for (RoutesI it = m_routes.begin (); it != m_routes.end (); it++)
691  {
692  if (it->first == route)
693  {
695  route->SetRouteMetric (m_linkDown);
696  route->SetRouteChanged (true);
697  if (it->second.IsRunning ())
698  {
699  it->second.Cancel ();
700  }
701  it->second = Simulator::Schedule (m_garbageCollectionDelay, &Rip::DeleteRoute, this, route);
702  return;
703  }
704  }
705  NS_ABORT_MSG ("RIP::InvalidateRoute - cannot find the route to update");
706 }
707 
709 {
710  NS_LOG_FUNCTION (this << *route);
711 
712  for (RoutesI it = m_routes.begin (); it != m_routes.end (); it++)
713  {
714  if (it->first == route)
715  {
716  delete route;
717  m_routes.erase (it);
718  return;
719  }
720  }
721  NS_ABORT_MSG ("RIP::DeleteRoute - cannot find the route to delete");
722 }
723 
724 
726 {
727  NS_LOG_FUNCTION (this << socket);
728 
729  Address sender;
730  Ptr<Packet> packet = socket->RecvFrom (sender);
732  NS_LOG_INFO ("Received " << *packet << " from " << senderAddr.GetIpv4 () << ":" << senderAddr.GetPort ());
733 
734  Ipv4Address senderAddress = senderAddr.GetIpv4 ();
735  uint16_t senderPort = senderAddr.GetPort ();
736 
737  if (socket == m_multicastRecvSocket)
738  {
739  NS_LOG_LOGIC ("Received a packet from the multicast socket");
740  }
741  else
742  {
743  NS_LOG_LOGIC ("Received a packet from one of the unicast sockets");
744  }
745 
746  Ipv4PacketInfoTag interfaceInfo;
747  if (!packet->RemovePacketTag (interfaceInfo))
748  {
749  NS_ABORT_MSG ("No incoming interface on RIP message, aborting.");
750  }
751  uint32_t incomingIf = interfaceInfo.GetRecvIf ();
752  Ptr<Node> node = this->GetObject<Node> ();
753  Ptr<NetDevice> dev = node->GetDevice (incomingIf);
754  uint32_t ipInterfaceIndex = m_ipv4->GetInterfaceForDevice (dev);
755 
756  SocketIpTtlTag hoplimitTag;
757  if (!packet->RemovePacketTag (hoplimitTag))
758  {
759  NS_ABORT_MSG ("No incoming Hop Count on RIP message, aborting.");
760  }
761  uint8_t hopLimit = hoplimitTag.GetTtl ();
762 
763  int32_t interfaceForAddress = m_ipv4->GetInterfaceForAddress (senderAddress);
764  if (interfaceForAddress != -1)
765  {
766  NS_LOG_LOGIC ("Ignoring a packet sent by myself.");
767  return;
768  }
769 
770  RipHeader hdr;
771  packet->RemoveHeader (hdr);
772 
773  if (hdr.GetCommand () == RipHeader::RESPONSE)
774  {
775  NS_LOG_LOGIC ("The message is a Response from " << senderAddr.GetIpv4 () << ":" << senderAddr.GetPort ());
776  HandleResponses (hdr, senderAddress, ipInterfaceIndex, hopLimit);
777  }
778  else if (hdr.GetCommand () == RipHeader::REQUEST)
779  {
780  NS_LOG_LOGIC ("The message is a Request from " << senderAddr.GetIpv4 () << ":" << senderAddr.GetPort ());
781  HandleRequests (hdr, senderAddress, senderPort, ipInterfaceIndex, hopLimit);
782  }
783  else
784  {
785  NS_LOG_LOGIC ("Ignoring message with unknown command: " << int (hdr.GetCommand ()));
786  }
787  return;
788 }
789 
790 void Rip::HandleRequests (RipHeader requestHdr, Ipv4Address senderAddress, uint16_t senderPort, uint32_t incomingInterface, uint8_t hopLimit)
791 {
792  NS_LOG_FUNCTION (this << senderAddress << int (senderPort) << incomingInterface << int (hopLimit) << requestHdr);
793 
794  std::list<RipRte> rtes = requestHdr.GetRteList ();
795 
796  if (rtes.empty ())
797  {
798  return;
799  }
800 
801  // check if it's a request for the full table from a neighbor
802  if (rtes.size () == 1)
803  {
804  if (rtes.begin ()->GetPrefix () == Ipv4Address::GetAny () &&
805  rtes.begin ()->GetSubnetMask ().GetPrefixLength () == 0 &&
806  rtes.begin ()->GetRouteMetric () == m_linkDown)
807  {
808  // Output whole thing. Use Split Horizon
809  if (m_interfaceExclusions.find (incomingInterface) == m_interfaceExclusions.end ())
810  {
811  // we use one of the sending sockets, as they're bound to the right interface
812  // and the local address might be used on different interfaces.
813  Ptr<Socket> sendingSocket;
814  for (SocketListI iter = m_unicastSocketList.begin (); iter != m_unicastSocketList.end (); iter++ )
815  {
816  if (iter->second == incomingInterface)
817  {
818  sendingSocket = iter->first;
819  }
820  }
821  NS_ASSERT_MSG (sendingSocket, "HandleRequest - Impossible to find a socket to send the reply");
822 
823  uint16_t mtu = m_ipv4->GetMtu (incomingInterface);
824  uint16_t maxRte = (mtu - Ipv4Header ().GetSerializedSize () - UdpHeader ().GetSerializedSize () - RipHeader ().GetSerializedSize ()) / RipRte ().GetSerializedSize ();
825 
826  Ptr<Packet> p = Create<Packet> ();
827  SocketIpTtlTag tag;
828  p->RemovePacketTag (tag);
829  if (senderAddress == Ipv4Address(RIP_ALL_NODE))
830  {
831  tag.SetTtl (1);
832  }
833  else
834  {
835  tag.SetTtl (255);
836  }
837  p->AddPacketTag (tag);
838 
839  RipHeader hdr;
841 
842  for (RoutesI rtIter = m_routes.begin (); rtIter != m_routes.end (); rtIter++)
843  {
844  bool splitHorizoning = (rtIter->first->GetInterface () == incomingInterface);
845 
846  Ipv4InterfaceAddress rtDestAddr = Ipv4InterfaceAddress(rtIter->first->GetDestNetwork (), rtIter->first->GetDestNetworkMask ());
847 
848  bool isGlobal = (rtDestAddr.GetScope () == Ipv4InterfaceAddress::GLOBAL);
849  bool isDefaultRoute = ((rtIter->first->GetDestNetwork () == Ipv4Address::GetAny ()) &&
850  (rtIter->first->GetDestNetworkMask () == Ipv4Mask::GetZero ()) &&
851  (rtIter->first->GetInterface () != incomingInterface));
852 
853  if ((isGlobal || isDefaultRoute) &&
854  (rtIter->first->GetRouteStatus () == RipRoutingTableEntry::RIP_VALID) )
855  {
856  RipRte rte;
857  rte.SetPrefix (rtIter->first->GetDestNetwork ());
858  rte.SetSubnetMask (rtIter->first->GetDestNetworkMask ());
859  if (m_splitHorizonStrategy == POISON_REVERSE && splitHorizoning)
860  {
862  }
863  else
864  {
865  rte.SetRouteMetric (rtIter->first->GetRouteMetric ());
866  }
867  rte.SetRouteTag (rtIter->first->GetRouteTag ());
869  (m_splitHorizonStrategy == SPLIT_HORIZON && !splitHorizoning))
870  {
871  hdr.AddRte (rte);
872  }
873  }
874  if (hdr.GetRteNumber () == maxRte)
875  {
876  p->AddHeader (hdr);
877  NS_LOG_DEBUG ("SendTo: " << *p);
878  sendingSocket->SendTo (p, 0, InetSocketAddress (senderAddress, RIP_PORT));
879  p->RemoveHeader (hdr);
880  hdr.ClearRtes ();
881  }
882  }
883  if (hdr.GetRteNumber () > 0)
884  {
885  p->AddHeader (hdr);
886  NS_LOG_DEBUG ("SendTo: " << *p);
887  sendingSocket->SendTo (p, 0, InetSocketAddress (senderAddress, RIP_PORT));
888  }
889  }
890  }
891  }
892  else
893  {
894  // note: we got the request as a single packet, so no check is necessary for MTU limit
895 
896  Ptr<Packet> p = Create<Packet> ();
897  SocketIpTtlTag tag;
898  p->RemovePacketTag (tag);
899  if (senderAddress == Ipv4Address(RIP_ALL_NODE))
900  {
901  tag.SetTtl (1);
902  }
903  else
904  {
905  tag.SetTtl (255);
906  }
907  p->AddPacketTag (tag);
908 
909  RipHeader hdr;
911 
912  for (std::list<RipRte>::iterator iter = rtes.begin ();
913  iter != rtes.end (); iter++)
914  {
915  bool found = false;
916  for (RoutesI rtIter = m_routes.begin (); rtIter != m_routes.end (); rtIter++)
917  {
918 
919  Ipv4InterfaceAddress rtDestAddr = Ipv4InterfaceAddress (rtIter->first->GetDestNetwork (), rtIter->first->GetDestNetworkMask ());
920  if ((rtDestAddr.GetScope () == Ipv4InterfaceAddress::GLOBAL) &&
921  (rtIter->first->GetRouteStatus () == RipRoutingTableEntry::RIP_VALID))
922  {
923  Ipv4Address requestedAddress = iter->GetPrefix ();
924  requestedAddress.CombineMask (iter->GetSubnetMask ());
925  Ipv4Address rtAddress = rtIter->first->GetDestNetwork ();
926  rtAddress.CombineMask (rtIter->first->GetDestNetworkMask ());
927 
928  if (requestedAddress == rtAddress)
929  {
930  iter->SetRouteMetric (rtIter->first->GetRouteMetric ());
931  iter->SetRouteTag (rtIter->first->GetRouteTag ());
932  hdr.AddRte (*iter);
933  found = true;
934  break;
935  }
936  }
937  }
938  if (!found)
939  {
940  iter->SetRouteMetric (m_linkDown);
941  iter->SetRouteTag (0);
942  hdr.AddRte (*iter);
943  }
944  }
945  p->AddHeader (hdr);
946  NS_LOG_DEBUG ("SendTo: " << *p);
947  m_multicastRecvSocket->SendTo (p, 0, InetSocketAddress (senderAddress, senderPort));
948  }
949 
950 }
951 
952 void Rip::HandleResponses (RipHeader hdr, Ipv4Address senderAddress, uint32_t incomingInterface, uint8_t hopLimit)
953 {
954  NS_LOG_FUNCTION (this << senderAddress << incomingInterface << int (hopLimit) << hdr);
955 
956  if (m_interfaceExclusions.find (incomingInterface) != m_interfaceExclusions.end ())
957  {
958  NS_LOG_LOGIC ("Ignoring an update message from an excluded interface: " << incomingInterface);
959  return;
960  }
961 
962  std::list<RipRte> rtes = hdr.GetRteList ();
963 
964  // validate the RTEs before processing
965  for (std::list<RipRte>::iterator iter = rtes.begin ();
966  iter != rtes.end (); iter++)
967  {
968  if (iter->GetRouteMetric () == 0 || iter->GetRouteMetric () > m_linkDown)
969  {
970  NS_LOG_LOGIC ("Ignoring an update message with malformed metric: " << int (iter->GetRouteMetric ()));
971  return;
972  }
973  if (iter->GetPrefix ().IsLocalhost () ||
974  iter->GetPrefix ().IsBroadcast () ||
975  iter->GetPrefix ().IsMulticast ())
976  {
977  NS_LOG_LOGIC ("Ignoring an update message with wrong prefixes: " << iter->GetPrefix ());
978  return;
979  }
980  }
981 
982  bool changed = false;
983 
984  for (std::list<RipRte>::iterator iter = rtes.begin ();
985  iter != rtes.end (); iter++)
986  {
987  Ipv4Mask rtePrefixMask = iter->GetSubnetMask ();
988  Ipv4Address rteAddr = iter->GetPrefix ().CombineMask (rtePrefixMask);
989 
990  NS_LOG_LOGIC ("Processing RTE " << *iter);
991 
992  uint32_t interfaceMetric = 1;
993  if (m_interfaceMetrics.find (incomingInterface) != m_interfaceMetrics.end ())
994  {
995  interfaceMetric = m_interfaceMetrics[incomingInterface];
996  }
997  uint64_t rteMetric = iter->GetRouteMetric () + interfaceMetric;
998  if (rteMetric > m_linkDown)
999  {
1000  rteMetric = m_linkDown;
1001  }
1002 
1003  RoutesI it;
1004  bool found = false;
1005  for (it = m_routes.begin (); it != m_routes.end (); it++)
1006  {
1007  if (it->first->GetDestNetwork () == rteAddr &&
1008  it->first->GetDestNetworkMask () == rtePrefixMask)
1009  {
1010  found = true;
1011  if (rteMetric < it->first->GetRouteMetric ())
1012  {
1013  if (senderAddress != it->first->GetGateway ())
1014  {
1015  RipRoutingTableEntry* route = new RipRoutingTableEntry (rteAddr, rtePrefixMask, senderAddress, incomingInterface);
1016  delete it->first;
1017  it->first = route;
1018  }
1019  it->first->SetRouteMetric (rteMetric);
1020  it->first->SetRouteStatus (RipRoutingTableEntry::RIP_VALID);
1021  it->first->SetRouteTag (iter->GetRouteTag ());
1022  it->first->SetRouteChanged (true);
1023  it->second.Cancel ();
1024  it->second = Simulator::Schedule (m_timeoutDelay, &Rip::InvalidateRoute, this, it->first);
1025  changed = true;
1026  }
1027  else if (rteMetric == it->first->GetRouteMetric ())
1028  {
1029  if (senderAddress == it->first->GetGateway ())
1030  {
1031  it->second.Cancel ();
1032  it->second = Simulator::Schedule (m_timeoutDelay, &Rip::InvalidateRoute, this, it->first);
1033  }
1034  else
1035  {
1036  if (Simulator::GetDelayLeft (it->second) < m_timeoutDelay/2)
1037  {
1038  RipRoutingTableEntry* route = new RipRoutingTableEntry (rteAddr, rtePrefixMask, senderAddress, incomingInterface);
1039  route->SetRouteMetric (rteMetric);
1041  route->SetRouteTag (iter->GetRouteTag ());
1042  route->SetRouteChanged (true);
1043  delete it->first;
1044  it->first = route;
1045  it->second.Cancel ();
1046  it->second = Simulator::Schedule (m_timeoutDelay, &Rip::InvalidateRoute, this, route);
1047  changed = true;
1048  }
1049  }
1050  }
1051  else if (rteMetric > it->first->GetRouteMetric () && senderAddress == it->first->GetGateway ())
1052  {
1053  it->second.Cancel ();
1054  if (rteMetric < m_linkDown)
1055  {
1056  it->first->SetRouteMetric (rteMetric);
1057  it->first->SetRouteStatus (RipRoutingTableEntry::RIP_VALID);
1058  it->first->SetRouteTag (iter->GetRouteTag ());
1059  it->first->SetRouteChanged (true);
1060  it->second.Cancel ();
1061  it->second = Simulator::Schedule (m_timeoutDelay, &Rip::InvalidateRoute, this, it->first);
1062  }
1063  else
1064  {
1065  InvalidateRoute (it->first);
1066  }
1067  changed = true;
1068  }
1069  }
1070  }
1071  if (!found && rteMetric != m_linkDown)
1072  {
1073  NS_LOG_LOGIC ("Received a RTE with new route, adding.");
1074 
1075  RipRoutingTableEntry* route = new RipRoutingTableEntry (rteAddr, rtePrefixMask, senderAddress, incomingInterface);
1076  route->SetRouteMetric (rteMetric);
1078  route->SetRouteChanged (true);
1079  m_routes.push_front (std::make_pair (route, EventId ()));
1080  EventId invalidateEvent = Simulator::Schedule (m_timeoutDelay, &Rip::InvalidateRoute, this, route);
1081  (m_routes.begin ())->second = invalidateEvent;
1082  changed = true;
1083  }
1084  }
1085 
1086  if (changed)
1087  {
1089  }
1090 }
1091 
1092 void Rip::DoSendRouteUpdate (bool periodic)
1093 {
1094  NS_LOG_FUNCTION (this << (periodic ? " periodic" : " triggered"));
1095 
1096  for (SocketListI iter = m_unicastSocketList.begin (); iter != m_unicastSocketList.end (); iter++ )
1097  {
1098  uint32_t interface = iter->second;
1099 
1100  if (m_interfaceExclusions.find (interface) == m_interfaceExclusions.end ())
1101  {
1102  uint16_t mtu = m_ipv4->GetMtu (interface);
1103  uint16_t maxRte = (mtu - Ipv4Header ().GetSerializedSize () - UdpHeader ().GetSerializedSize () - RipHeader ().GetSerializedSize ()) / RipRte ().GetSerializedSize ();
1104 
1105  Ptr<Packet> p = Create<Packet> ();
1106  SocketIpTtlTag tag;
1107  tag.SetTtl (1);
1108  p->AddPacketTag (tag);
1109 
1110  RipHeader hdr;
1112 
1113  for (RoutesI rtIter = m_routes.begin (); rtIter != m_routes.end (); rtIter++)
1114  {
1115  bool splitHorizoning = (rtIter->first->GetInterface () == interface);
1116  Ipv4InterfaceAddress rtDestAddr = Ipv4InterfaceAddress(rtIter->first->GetDestNetwork (), rtIter->first->GetDestNetworkMask ());
1117 
1118  NS_LOG_DEBUG ("Processing RT " << rtDestAddr << " " << int(rtIter->first->IsRouteChanged ()));
1119 
1120  bool isGlobal = (rtDestAddr.GetScope () == Ipv4InterfaceAddress::GLOBAL);
1121  bool isDefaultRoute = ((rtIter->first->GetDestNetwork () == Ipv4Address::GetAny ()) &&
1122  (rtIter->first->GetDestNetworkMask () == Ipv4Mask::GetZero ()) &&
1123  (rtIter->first->GetInterface () != interface));
1124 
1125  bool sameNetwork = false;
1126  for (uint32_t index = 0; index < m_ipv4->GetNAddresses (interface); index++)
1127  {
1128  Ipv4InterfaceAddress addr = m_ipv4->GetAddress (interface, index);
1129  if (addr.GetLocal ().CombineMask (addr.GetMask ()) == rtIter->first->GetDestNetwork ())
1130  {
1131  sameNetwork = true;
1132  }
1133  }
1134 
1135  if ((isGlobal || isDefaultRoute) &&
1136  (periodic || rtIter->first->IsRouteChanged ()) &&
1137  !sameNetwork)
1138  {
1139  RipRte rte;
1140  rte.SetPrefix (rtIter->first->GetDestNetwork ());
1141  rte.SetSubnetMask (rtIter->first->GetDestNetworkMask ());
1142  if (m_splitHorizonStrategy == POISON_REVERSE && splitHorizoning)
1143  {
1144  rte.SetRouteMetric (m_linkDown);
1145  }
1146  else
1147  {
1148  rte.SetRouteMetric (rtIter->first->GetRouteMetric ());
1149  }
1150  rte.SetRouteTag (rtIter->first->GetRouteTag ());
1151  if (m_splitHorizonStrategy == SPLIT_HORIZON && !splitHorizoning)
1152  {
1153  hdr.AddRte (rte);
1154  }
1156  {
1157  hdr.AddRte (rte);
1158  }
1159  }
1160  if (hdr.GetRteNumber () == maxRte)
1161  {
1162  p->AddHeader (hdr);
1163  NS_LOG_DEBUG ("SendTo: " << *p);
1164  iter->first->SendTo (p, 0, InetSocketAddress (RIP_ALL_NODE, RIP_PORT));
1165  p->RemoveHeader (hdr);
1166  hdr.ClearRtes ();
1167  }
1168  }
1169  if (hdr.GetRteNumber () > 0)
1170  {
1171  p->AddHeader (hdr);
1172  NS_LOG_DEBUG ("SendTo: " << *p);
1173  iter->first->SendTo (p, 0, InetSocketAddress (RIP_ALL_NODE, RIP_PORT));
1174  }
1175  }
1176  }
1177  for (RoutesI rtIter = m_routes.begin (); rtIter != m_routes.end (); rtIter++)
1178  {
1179  rtIter->first->SetRouteChanged (false);
1180  }
1181 }
1182 
1184 {
1185  NS_LOG_FUNCTION (this);
1186 
1188  {
1189  NS_LOG_LOGIC ("Skipping Triggered Update due to cooldown");
1190  return;
1191  }
1192 
1193  // DoSendRouteUpdate (false);
1194 
1195  // note: The RFC states:
1196  // After a triggered
1197  // update is sent, a timer should be set for a random interval between 1
1198  // and 5 seconds. If other changes that would trigger updates occur
1199  // before the timer expires, a single update is triggered when the timer
1200  // expires. The timer is then reset to another random value between 1
1201  // and 5 seconds. Triggered updates may be suppressed if a regular
1202  // update is due by the time the triggered update would be sent.
1203  // Here we rely on this:
1204  // When an update occurs (either Triggered or Periodic) the "IsChanged ()"
1205  // route field will be cleared.
1206  // Hence, the following Triggered Update will be fired, but will not send
1207  // any route update.
1208 
1211 }
1212 
1214 {
1215  NS_LOG_FUNCTION (this);
1216 
1218  {
1220  }
1221 
1222  DoSendRouteUpdate (true);
1223 
1226 }
1227 
1228 std::set<uint32_t> Rip::GetInterfaceExclusions () const
1229 {
1230  return m_interfaceExclusions;
1231 }
1232 
1233 void Rip::SetInterfaceExclusions (std::set<uint32_t> exceptions)
1234 {
1235  NS_LOG_FUNCTION (this);
1236 
1237  m_interfaceExclusions = exceptions;
1238 }
1239 
1240 uint8_t Rip::GetInterfaceMetric (uint32_t interface) const
1241 {
1242  NS_LOG_FUNCTION (this << interface);
1243 
1244  std::map<uint32_t, uint8_t>::const_iterator iter = m_interfaceMetrics.find (interface);
1245  if (iter != m_interfaceMetrics.end ())
1246  {
1247  return iter->second;
1248  }
1249  return 1;
1250 }
1251 
1252 void Rip::SetInterfaceMetric (uint32_t interface, uint8_t metric)
1253 {
1254  NS_LOG_FUNCTION (this << interface << int (metric));
1255 
1256  if (metric < m_linkDown)
1257  {
1258  m_interfaceMetrics[interface] = metric;
1259  }
1260 }
1261 
1263 {
1264  NS_LOG_FUNCTION (this);
1265 
1266  Ptr<Packet> p = Create<Packet> ();
1267  SocketIpTtlTag tag;
1268  p->RemovePacketTag (tag);
1269  tag.SetTtl (1);
1270  p->AddPacketTag (tag);
1271 
1272  RipHeader hdr;
1274 
1275  RipRte rte;
1276  rte.SetPrefix (Ipv4Address::GetAny ());
1278  rte.SetRouteMetric (m_linkDown);
1279 
1280  hdr.AddRte (rte);
1281  p->AddHeader (hdr);
1282 
1283  for (SocketListI iter = m_unicastSocketList.begin (); iter != m_unicastSocketList.end (); iter++ )
1284  {
1285  uint32_t interface = iter->second;
1286 
1287  if (m_interfaceExclusions.find (interface) == m_interfaceExclusions.end ())
1288  {
1289  NS_LOG_DEBUG ("SendTo: " << *p);
1290  iter->first->SendTo (p, 0, InetSocketAddress (RIP_ALL_NODE, RIP_PORT));
1291  }
1292  }
1293 }
1294 
1295 void Rip::AddDefaultRouteTo (Ipv4Address nextHop, uint32_t interface)
1296 {
1297  NS_LOG_FUNCTION (this << interface);
1298 
1299  AddNetworkRouteTo (Ipv4Address ("0.0.0.0"), Ipv4Mask::GetZero (), nextHop, interface);
1300 }
1301 
1302 
1303 /*
1304  * RipRoutingTableEntry
1305  */
1306 
1308  : m_tag (0), m_metric (0), m_status (RIP_INVALID), m_changed (false)
1309 {
1310 }
1311 
1312 RipRoutingTableEntry::RipRoutingTableEntry (Ipv4Address network, Ipv4Mask networkPrefix, Ipv4Address nextHop, uint32_t interface)
1313  : Ipv4RoutingTableEntry ( Ipv4RoutingTableEntry::CreateNetworkRouteTo (network, networkPrefix, nextHop, interface) ),
1314  m_tag (0), m_metric (0), m_status (RIP_INVALID), m_changed (false)
1315 {
1316 }
1317 
1318 RipRoutingTableEntry::RipRoutingTableEntry (Ipv4Address network, Ipv4Mask networkPrefix, uint32_t interface)
1319  : Ipv4RoutingTableEntry ( Ipv4RoutingTableEntry::CreateNetworkRouteTo (network, networkPrefix, interface) ),
1320  m_tag (0), m_metric (0), m_status (RIP_INVALID), m_changed (false)
1321 {
1322 }
1323 
1325 {
1326 }
1327 
1328 
1329 void RipRoutingTableEntry::SetRouteTag (uint16_t routeTag)
1330 {
1331  if (m_tag != routeTag)
1332  {
1333  m_tag = routeTag;
1334  m_changed = true;
1335  }
1336 }
1337 
1339 {
1340  return m_tag;
1341 }
1342 
1343 void RipRoutingTableEntry::SetRouteMetric (uint8_t routeMetric)
1344 {
1345  if (m_metric != routeMetric)
1346  {
1347  m_metric = routeMetric;
1348  m_changed = true;
1349  }
1350 }
1351 
1353 {
1354  return m_metric;
1355 }
1356 
1358 {
1359  if (m_status != status)
1360  {
1361  m_status = status;
1362  m_changed = true;
1363  }
1364 }
1365 
1367 {
1368  return m_status;
1369 }
1370 
1372 {
1373  m_changed = changed;
1374 }
1375 
1377 {
1378  return m_changed;
1379 }
1380 
1381 
1382 std::ostream & operator << (std::ostream& os, const RipRoutingTableEntry& rte)
1383 {
1384  os << static_cast<const Ipv4RoutingTableEntry &>(rte);
1385  os << ", metric: " << int (rte.GetRouteMetric ()) << ", tag: " << int (rte.GetRouteTag ());
1386 
1387  return os;
1388 }
1389 
1390 
1391 }
1392 
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
ns3::Ipv4Header
Packet header for IPv4.
Definition: ipv4-header.h:34
ns3::InetSocketAddress
an Inet address class
Definition: inet-socket-address.h:41
ns3::Ipv4Mask::GetZero
static Ipv4Mask GetZero(void)
Definition: ipv4-address.cc:161
ns3::Rip::m_startupDelay
Time m_startupDelay
Random delay before protocol startup.
Definition: rip.h:377
ns3::Rip::DoInitialize
void DoInitialize()
Start protocol operation.
Definition: rip.cc:110
ns3::Ipv4RoutingTableEntry::IsGateway
bool IsGateway(void) const
Definition: ipv4-routing-table-entry.cc:146
ns3::Rip::m_linkDown
uint32_t m_linkDown
Link down value.
Definition: rip.h:407
ns3::Rip::m_routes
Routes m_routes
the forwarding table for network.
Definition: rip.h:375
first
Definition: first.py:1
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
NS_ASSERT
#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
ns3::RipHeader::GetRteNumber
uint16_t GetRteNumber(void) const
Get the number of RTE included in the message.
Definition: rip-header.cc:267
ns3::RipRoutingTableEntry::IsRouteChanged
bool IsRouteChanged(void) const
Get the route changed status.
Definition: rip.cc:1376
ns3::MakeTimeChecker
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:533
ns3::Rip::GetInterfaceMetric
uint8_t GetInterfaceMetric(uint32_t interface) const
Get the metric for an interface.
Definition: rip.cc:1240
ns3::RipRoutingTableEntry::~RipRoutingTableEntry
virtual ~RipRoutingTableEntry()
Definition: rip.cc:1324
ns3::Socket::Bind
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
ns3::RipRoutingTableEntry::Status_e
Status_e
Route status.
Definition: rip.h:70
ns3::EventId
An identifier for simulation events.
Definition: event-id.h:54
ns3::Ipv4RoutingTableEntry::GetInterface
uint32_t GetInterface(void) const
Definition: ipv4-routing-table-entry.cc:165
ns3::Packet::AddHeader
void AddHeader(const Header &header)
Add header to this packet.
Definition: packet.cc:256
ns3::Socket::SocketErrno
SocketErrno
Enumeration of the possible errors returned by a socket.
Definition: socket.h:82
ns3::Callback
Callback template class.
Definition: callback.h:1279
ns3::InetSocketAddress::GetPort
uint16_t GetPort(void) const
Definition: inet-socket-address.cc:65
ns3::Rip::SendTriggeredRouteUpdate
void SendTriggeredRouteUpdate()
Send Triggered Routing Updates on all interfaces.
Definition: rip.cc:1183
ns3::Rip::RouteOutput
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.
Definition: rip.cc:190
ns3::Rip::SetIpv4
virtual void SetIpv4(Ptr< Ipv4 > ipv4)
Definition: rip.cc:470
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::RipRoutingTableEntry::RIP_VALID
@ RIP_VALID
Definition: rip.h:71
ns3::Callback::IsNull
bool IsNull(void) const
Check for null implementation.
Definition: callback.h:1386
ns3::MakeEnumChecker
Ptr< const AttributeChecker > MakeEnumChecker(int v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.
Definition: enum.h:161
ns3::Rip::DeleteRoute
void DeleteRoute(RipRoutingTableEntry *route)
Delete a route.
Definition: rip.cc:708
ns3::RipRte::SetSubnetMask
void SetSubnetMask(Ipv4Mask subnetMask)
Set the subnet mask.
Definition: rip-header.cc:103
rip.h
ns3::Ipv4InterfaceAddress::GetMask
Ipv4Mask GetMask(void) const
Get the network mask.
Definition: ipv4-interface-address.cc:94
ns3::Simulator::GetDelayLeft
static Time GetDelayLeft(const EventId &id)
Get the remaining time until this event will execute.
Definition: simulator.cc:204
ns3::RipRoutingTableEntry::RipRoutingTableEntry
RipRoutingTableEntry(void)
Definition: rip.cc:1307
ns3::Rip::DoDispose
virtual void DoDispose()
Dispose this object.
Definition: rip.cc:556
ns3::Socket::SetRecvPktInfo
void SetRecvPktInfo(bool flag)
Enable/Disable receive packet information to socket.
Definition: socket.cc:358
ns3::Ipv4PacketInfoTag::GetRecvIf
uint32_t GetRecvIf(void) const
Get the tag's receiving interface.
Definition: ipv4-packet-info-tag.cc:61
ns3::Node
A network Node.
Definition: node.h:57
ns3::Rip::m_timeoutDelay
Time m_timeoutDelay
Delay before invalidating a route.
Definition: rip.h:381
ns3::Ipv4InterfaceAddress::GetScope
Ipv4InterfaceAddress::InterfaceAddressScope_e GetScope(void) const
Get address scope.
Definition: ipv4-interface-address.cc:122
ns3::Ipv4Address::IsAny
bool IsAny(void) const
Definition: ipv4-address.cc:273
ns3::Rip::m_rng
Ptr< UniformRandomVariable > m_rng
Rng stream.
Definition: rip.h:399
ns3::Rip::m_initialized
bool m_initialized
flag to allow socket's late-creation.
Definition: rip.h:406
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
ns3::RipRoutingTableEntry::GetRouteStatus
Status_e GetRouteStatus(void) const
Get the route status.
Definition: rip.cc:1366
ns3::Ipv4RoutingTableEntry::GetDestNetworkMask
Ipv4Mask GetDestNetworkMask(void) const
Definition: ipv4-routing-table-entry.cc:140
ns3::Ipv4InterfaceAddress::GLOBAL
@ GLOBAL
Definition: ipv4-interface-address.h:53
ns3::OutputStreamWrapper::GetStream
std::ostream * GetStream(void)
Return a pointer to an ostream previously set in the wrapper.
Definition: output-stream-wrapper.cc:58
ns3::SocketIpTtlTag::SetTtl
void SetTtl(uint8_t ttl)
Set the tag's TTL.
Definition: socket.cc:604
ns3::Ipv4RoutingTableEntry::GetGateway
Ipv4Address GetGateway(void) const
Definition: ipv4-routing-table-entry.cc:159
ns3::RipHeader::RESPONSE
@ RESPONSE
Definition: rip-header.h:201
ns3::Rip::m_interfaceMetrics
std::map< uint32_t, uint8_t > m_interfaceMetrics
Map of interface metrics.
Definition: rip.h:402
ns3::Time::As
TimeWithUnit As(const enum Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition: time.cc:429
ns3::RipRoutingTableEntry::GetRouteMetric
uint8_t GetRouteMetric(void) const
Get the route metric.
Definition: rip.cc:1352
ns3::Rip::NotifyRemoveAddress
virtual void NotifyRemoveAddress(uint32_t interface, Ipv4InterfaceAddress address)
Definition: rip.cc:433
ns3::Simulator::Schedule
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:556
ns3::Ipv4RoutingTableEntry
A record of an IPv4 routing table entry for Ipv4GlobalRouting and Ipv4StaticRouting.
Definition: ipv4-routing-table-entry.h:37
ns3::Socket::SendTo
virtual int SendTo(Ptr< Packet > p, uint32_t flags, const Address &toAddress)=0
Send data to a specified peer.
ns3::Ipv4RoutingTableEntry::GetDestNetwork
Ipv4Address GetDestNetwork(void) const
Definition: ipv4-routing-table-entry.cc:134
ns3::Rip::Receive
void Receive(Ptr< Socket > socket)
Receive RIP packets.
Definition: rip.cc:725
ns3::InetSocketAddress::ConvertFrom
static InetSocketAddress ConvertFrom(const Address &address)
Returns an InetSocketAddress which corresponds to the input Address.
Definition: inet-socket-address.cc:126
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
ns3::Rip::RouteInput
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)
Definition: rip.cc:220
ns3::Rip::NO_SPLIT_HORIZON
@ NO_SPLIT_HORIZON
No Split Horizon.
Definition: rip.h:203
ns3::EnumValue
Hold variables of type enum.
Definition: enum.h:55
ns3::RipHeader::SetCommand
void SetCommand(Command_e command)
Set the command.
Definition: rip-header.cc:247
ns3::Rip::~Rip
virtual ~Rip()
Definition: rip.cc:53
ns3::RipHeader::ClearRtes
void ClearRtes()
Clear all the RTEs from the header.
Definition: rip-header.cc:262
ns3::RipRoutingTableEntry::m_tag
uint16_t m_tag
route tag
Definition: rip.h:151
ns3::UdpHeader::GetSerializedSize
virtual uint32_t GetSerializedSize(void) const
Definition: udp-header.cc:178
ns3::Ipv4Address::IsMulticast
bool IsMulticast(void) const
Definition: ipv4-address.cc:294
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
ns3::Rip::m_interfaceExclusions
std::set< uint32_t > m_interfaceExclusions
Set of excluded interfaces.
Definition: rip.h:401
ns3::Ipv4Address::GetZero
static Ipv4Address GetZero(void)
Definition: ipv4-address.cc:388
ns3::Rip::SendUnsolicitedRouteUpdate
void SendUnsolicitedRouteUpdate(void)
Send Unsolicited Routing Updates on all interfaces.
Definition: rip.cc:1213
ns3::Ipv4RoutingTableEntry::GetDest
Ipv4Address GetDest(void) const
Definition: ipv4-routing-table-entry.cc:109
ns3::EventId::IsRunning
bool IsRunning(void) const
This method is syntactic sugar for !IsExpired().
Definition: event-id.cc:71
ns3::Socket::SetRecvCallback
void SetRecvCallback(Callback< void, Ptr< Socket > > receivedData)
Notify application when new data is available to be read.
Definition: socket.cc:128
ns3::Rip::Lookup
Ptr< Ipv4Route > Lookup(Ipv4Address dest, bool setSource, Ptr< NetDevice >=0)
Lookup in the forwarding table for destination.
Definition: rip.cc:585
ns3::RipRoutingTableEntry::GetRouteTag
uint16_t GetRouteTag(void) const
Get the route tag.
Definition: rip.cc:1338
ns3::Now
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Definition: simulator.cc:287
ns3::RipRoutingTableEntry::RIP_INVALID
@ RIP_INVALID
Definition: rip.h:72
ns3::Address
a polymophic address class
Definition: address.h:91
ns3::Rip::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: rip.cc:58
ns3::Ipv4InterfaceAddress
a class to store IPv4 address information on an interface
Definition: ipv4-interface-address.h:44
ns3::RipHeader
RipHeader - see RFC 2453
Definition: rip-header.h:158
ns3::RipRoutingTableEntry::SetRouteStatus
void SetRouteStatus(Status_e status)
Set the route status.
Definition: rip.cc:1357
NS_LOG_INFO
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
ns3::RipRte::GetSerializedSize
virtual uint32_t GetSerializedSize(void) const
Get the serialized size of the packet.
Definition: rip-header.cc:57
ns3::Socket::RecvFrom
virtual Ptr< Packet > RecvFrom(uint32_t maxSize, uint32_t flags, Address &fromAddress)=0
Read a single packet from the socket and retrieve the sender address.
ns3::InetSocketAddress::GetIpv4
Ipv4Address GetIpv4(void) const
Definition: inet-socket-address.cc:71
ns3::Ipv4Address::IsLocalMulticast
bool IsLocalMulticast(void) const
Definition: ipv4-address.cc:305
ns3::Names::FindName
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
ns3::RipHeader::GetRteList
std::list< RipRte > GetRteList(void) const
Get the list of the RTEs included in the message.
Definition: rip-header.cc:272
ns3::Rip::SPLIT_HORIZON
@ SPLIT_HORIZON
Split Horizon.
Definition: rip.h:204
ns3::Rip::m_minTriggeredUpdateDelay
Time m_minTriggeredUpdateDelay
Min cooldown delay after a Triggered Update.
Definition: rip.h:378
ns3::RipRte::SetPrefix
void SetPrefix(Ipv4Address prefix)
Set the prefix.
Definition: rip-header.cc:93
ns3::Rip::DoSendRouteUpdate
void DoSendRouteUpdate(bool periodic)
Send Routing Updates on all interfaces.
Definition: rip.cc:1092
ns3::Rip::NotifyInterfaceDown
virtual void NotifyInterfaceDown(uint32_t interface)
Definition: rip.cc:377
ns3::Packet::RemoveHeader
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Definition: packet.cc:280
ns3::Rip::m_ipv4
Ptr< Ipv4 > m_ipv4
IPv4 reference.
Definition: rip.h:376
ns3::Node::GetDevice
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
Definition: node.cc:144
ns3::EventId::Cancel
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition: event-id.cc:53
ns3::Rip::AssignStreams
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: rip.cc:102
ns3::Rip::NotifyInterfaceUp
virtual void NotifyInterfaceUp(uint32_t interface)
Definition: rip.cc:294
ns3::RipHeader::GetSerializedSize
virtual uint32_t GetSerializedSize(void) const
Get the serialized size of the packet.
Definition: rip-header.cc:187
ns3::Socket::ERROR_NOTERROR
@ ERROR_NOTERROR
Definition: socket.h:83
ns3::Rip::HandleResponses
void HandleResponses(RipHeader hdr, Ipv4Address senderAddress, uint32_t incomingInterface, uint8_t hopLimit)
Handle RIP responses.
Definition: rip.cc:952
first.address
address
Definition: first.py:44
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::Socket::Close
virtual int Close(void)=0
Close a socket.
ns3::Rip::m_multicastRecvSocket
Ptr< Socket > m_multicastRecvSocket
multicast receive socket
Definition: rip.h:394
ns3::Rip::RoutesCI
std::list< std::pair< RipRoutingTableEntry *, EventId > >::const_iterator RoutesCI
Const Iterator for container for the network routes.
Definition: rip.h:271
ns3::RipRoutingTableEntry::SetRouteTag
void SetRouteTag(uint16_t routeTag)
Set the route tag.
Definition: rip.cc:1329
RIP_ALL_NODE
#define RIP_ALL_NODE
Definition: rip.cc:38
ns3::Ipv4Address::IsBroadcast
bool IsBroadcast(void) const
Definition: ipv4-address.cc:287
ns3::Rip::InvalidateRoute
void InvalidateRoute(RipRoutingTableEntry *route)
Invalidate a route.
Definition: rip.cc:686
NS_ASSERT_MSG
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:88
ns3::UdpHeader
Packet header for UDP packets.
Definition: udp-header.h:40
ns3::Object::DoInitialize
virtual void DoInitialize(void)
Initialize() implementation.
Definition: object.cc:353
ns3::Ipv4Header::GetSerializedSize
virtual uint32_t GetSerializedSize(void) const
Definition: ipv4-header.cc:375
second
Definition: second.py:1
ns3::Rip::m_nextTriggeredUpdate
EventId m_nextTriggeredUpdate
Next Triggered Update event.
Definition: rip.h:397
ns3::Rip::m_nextUnsolicitedUpdate
EventId m_nextUnsolicitedUpdate
Next Unsolicited Update event.
Definition: rip.h:396
ns3::Ipv4PacketInfoTag
This class implements Linux struct pktinfo in order to deliver ancillary information to the socket in...
Definition: ipv4-packet-info-tag.h:50
ns3::Ipv4Mask::GetPrefixLength
uint16_t GetPrefixLength(void) const
Definition: ipv4-address.cc:176
ns3::Rip::m_unsolicitedUpdate
Time m_unsolicitedUpdate
time between two Unsolicited Routing Updates
Definition: rip.h:380
ns3::MakeCallback
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition: callback.h:1642
NS_LOG_LOGIC
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:289
ns3::Rip::PrintRoutingTable
virtual void PrintRoutingTable(Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S) const
Print the Routing Table entries.
Definition: rip.cc:491
ns3::Ipv4RoutingProtocol
Abstract base class for IPv4 routing protocols.
Definition: ipv4-routing-protocol.h:57
ns3::Rip::AddDefaultRouteTo
void AddDefaultRouteTo(Ipv4Address nextHop, uint32_t interface)
Add a default route to the router through the nextHop located on interface.
Definition: rip.cc:1295
ns3::Rip::HandleRequests
void HandleRequests(RipHeader hdr, Ipv4Address senderAddress, uint16_t senderPort, uint32_t incomingInterface, uint8_t hopLimit)
Handle RIP requests.
Definition: rip.cc:790
ns3::RipRte
Rip v2 Routing Table Entry (RTE) - see RFC 2453.
Definition: rip-header.h:38
ns3::RipRoutingTableEntry::m_status
Status_e m_status
route status
Definition: rip.h:153
ns3::SocketIpTtlTag::GetTtl
uint8_t GetTtl(void) const
Get the tag's TTL.
Definition: socket.cc:611
ns3::Packet::AddPacketTag
void AddPacketTag(const Tag &tag) const
Add a packet tag.
Definition: packet.cc:956
ns3::Ipv4InterfaceAddress::HOST
@ HOST
Definition: ipv4-interface-address.h:51
ns3::Ipv4Address::GetAny
static Ipv4Address GetAny(void)
Definition: ipv4-address.cc:395
ns3::Rip::SendRouteRequest
void SendRouteRequest()
Send Routing Request on all interfaces.
Definition: rip.cc:1262
ns3::Rip::GetInterfaceExclusions
std::set< uint32_t > GetInterfaceExclusions() const
Get the set of interface excluded from the protocol.
Definition: rip.cc:1228
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
RIP_PORT
#define RIP_PORT
Definition: rip.cc:39
ns3::Rip::m_splitHorizonStrategy
SplitHorizonType_e m_splitHorizonStrategy
Split Horizon strategy.
Definition: rip.h:404
ns3::Rip::Rip
Rip()
Definition: rip.cc:47
ns3::Rip::SetInterfaceMetric
void SetInterfaceMetric(uint32_t interface, uint8_t metric)
Set the metric for an interface.
Definition: rip.cc:1252
ns3::RipRoutingTableEntry
Rip Routing Table Entry.
Definition: rip.h:64
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1289
ns3::RipRoutingTableEntry::SetRouteChanged
void SetRouteChanged(bool changed)
Set the route as changed.
Definition: rip.cc:1371
ns3::Ipv4Header::GetSource
Ipv4Address GetSource(void) const
Definition: ipv4-header.cc:291
ns3::SocketIpTtlTag
This class implements a tag that carries the socket-specific TTL of a packet to the IP layer.
Definition: socket.h:1117
ns3::MakeEnumAccessor
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: enum.h:203
ns3::RipRte::SetRouteMetric
void SetRouteMetric(uint32_t routeMetric)
Set the route metric.
Definition: rip-header.cc:123
ns3::Rip::SocketListI
std::map< Ptr< Socket >, uint32_t >::iterator SocketListI
Socket list type iterator.
Definition: rip.h:389
ns3::Socket::SetIpRecvTtl
void SetIpRecvTtl(bool ipv4RecvTtl)
Tells a socket to pass information about IP_TTL up the stack.
Definition: socket.cc:526
ns3::Socket::BindToNetDevice
virtual void BindToNetDevice(Ptr< NetDevice > netdevice)
Bind a socket to specific device.
Definition: socket.cc:330
ns3::Packet::RemovePacketTag
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
Definition: packet.cc:963
ns3::TimeValue
AttributeValue implementation for Time.
Definition: nstime.h:1353
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition: log-macros-enabled.h:244
ns3::Ipv4Mask::IsMatch
bool IsMatch(Ipv4Address a, Ipv4Address b) const
Definition: ipv4-address.cc:113
ns3::Ipv4Mask
a class to represent an Ipv4 address mask
Definition: ipv4-address.h:256
ns3::Ipv4RoutingTableEntry::IsHost
bool IsHost(void) const
Definition: ipv4-routing-table-entry.cc:96
ns3::Ipv4InterfaceAddress::GetLocal
Ipv4Address GetLocal(void) const
Get the local address.
Definition: ipv4-interface-address.cc:74
ns3::RipHeader::AddRte
void AddRte(RipRte rte)
Add a RTE to the message.
Definition: rip-header.cc:257
ns3::RandomVariableStream::SetStream
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
Definition: random-variable-stream.cc:100
ns3::UintegerValue
Hold an unsigned integer type.
Definition: uinteger.h:44
ns3::Socket::CreateSocket
static Ptr< Socket > CreateSocket(Ptr< Node > node, TypeId tid)
This method wraps the creation of sockets that is performed on a given node by a SocketFactory specif...
Definition: socket.cc:71
ns3::RipRte::SetRouteTag
void SetRouteTag(uint16_t routeTag)
Set the route tag.
Definition: rip-header.cc:113
ns3::Rip::AddNetworkRouteTo
void AddNetworkRouteTo(Ipv4Address network, Ipv4Mask networkPrefix, Ipv4Address nextHop, uint32_t interface)
Add route to network.
Definition: rip.cc:662
ns3::Rip
RIP Routing Protocol, defined in RFC 2453.
Definition: rip.h:174
ns3::Rip::m_garbageCollectionDelay
Time m_garbageCollectionDelay
Delay before deleting an INVALID route.
Definition: rip.h:382
ns3::Ipv4Address::CombineMask
Ipv4Address CombineMask(Ipv4Mask const &mask) const
Combine this address with a network mask.
Definition: ipv4-address.cc:235
ns3::RipHeader::GetCommand
Command_e GetCommand(void) const
Get the command.
Definition: rip-header.cc:252
ns3::MakeUintegerAccessor
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: uinteger.h:45
ns3::Rip::m_unicastSocketList
SocketList m_unicastSocketList
list of sockets for unicast messages (socket, interface index)
Definition: rip.h:393
ns3::Rip::POISON_REVERSE
@ POISON_REVERSE
Poison Reverse Split Horizon.
Definition: rip.h:205
ns3::operator<<
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:137
ns3::RipRoutingTableEntry::m_changed
bool m_changed
route has been updated
Definition: rip.h:154
ns3::Rip::m_maxTriggeredUpdateDelay
Time m_maxTriggeredUpdateDelay
Max cooldown delay after a Triggered Update.
Definition: rip.h:379
ns3::RipRoutingTableEntry::SetRouteMetric
void SetRouteMetric(uint8_t routeMetric)
Set the route metric.
Definition: rip.cc:1343
ns3::Ipv4Header::GetDestination
Ipv4Address GetDestination(void) const
Definition: ipv4-header.cc:304
ns3::TypeId::LookupByName
static TypeId LookupByName(std::string name)
Get a TypeId by name.
Definition: type-id.cc:830
ns3::RipRoutingTableEntry::m_metric
uint8_t m_metric
route metric
Definition: rip.h:152
ns3::Rip::NotifyAddAddress
virtual void NotifyAddAddress(uint32_t interface, Ipv4InterfaceAddress address)
Definition: rip.cc:408
ns3::Rip::RoutesI
std::list< std::pair< RipRoutingTableEntry *, EventId > >::iterator RoutesI
Iterator for container for the network routes.
Definition: rip.h:274
ns3::UniformRandomVariable::GetValue
double GetValue(double min, double max)
Get the next random value, as a double in the specified range .
Definition: random-variable-stream.cc:182
ns3::Object::DoDispose
virtual void DoDispose(void)
Destructor implementation.
Definition: object.cc:346
ns3::Socket::ERROR_NOROUTETOHOST
@ ERROR_NOROUTETOHOST
Definition: socket.h:93
ns3::Time::GetSeconds
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:380
ns3::Time::Unit
Unit
The unit to use to interpret a number representing time.
Definition: nstime.h:110
ns3::RipHeader::REQUEST
@ REQUEST
Definition: rip-header.h:200
ns3::MakeTimeAccessor
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: nstime.h:1354
ns3::Rip::SetInterfaceExclusions
void SetInterfaceExclusions(std::set< uint32_t > exceptions)
Set the set of interface excluded from the protocol.
Definition: rip.cc:1233
NS_ABORT_MSG
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition: abort.h:50