A Discrete-Event Network Simulator
API
dsr-rcache.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011 Yufei Cheng
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Yufei Cheng <yfcheng@ittc.ku.edu>
18  * Song Luan <lsuper@mail.ustc.edu.cn> (Implemented Link Cache using dijsktra algorithm
19  * to get the best route)
20  *
21  * James P.G. Sterbenz <jpgs@ittc.ku.edu>, director
22  * ResiliNets Research Group https://resilinets.org/
23  * Information and Telecommunication Technology Center (ITTC)
24  * and Department of Electrical Engineering and Computer Science
25  * The University of Kansas Lawrence, KS USA.
26  *
27  * Work supported in part by NSF FIND (Future Internet Design) Program
28  * under grant CNS-0626918 (Postmodern Internet Architecture),
29  * NSF grant CNS-1050226 (Multilayer Network Resilience Analysis and Experimentation on GENI),
30  * US Department of Defense (DoD), and ITTC at The University of Kansas.
31  */
32 
33 #ifndef DSR_RCACHE_H
34 #define DSR_RCACHE_H
35 
36 #include "dsr-option-header.h"
37 
38 #include "ns3/arp-cache.h"
39 #include "ns3/callback.h"
40 #include "ns3/enum.h"
41 #include "ns3/header.h"
42 #include "ns3/ipv4-address.h"
43 #include "ns3/ipv4-l3-protocol.h"
44 #include "ns3/ipv4-route.h"
45 #include "ns3/ipv4.h"
46 #include "ns3/net-device.h"
47 #include "ns3/nstime.h"
48 #include "ns3/simple-ref-count.h"
49 #include "ns3/simulator.h"
50 #include "ns3/timer.h"
51 
52 #include <cassert>
53 #include <iostream>
54 #include <map>
55 #include <stdint.h>
56 #include <sys/types.h>
57 #include <vector>
58 
59 namespace ns3
60 {
61 
62 class Time;
63 class WifiMacHeader;
64 
65 namespace dsr
66 {
67 
91 struct Link
92 {
95 
103  {
104  if (ip1 < ip2)
105  {
106  m_low = ip1;
107  m_high = ip2;
108  }
109  else
110  {
111  m_low = ip2;
112  m_high = ip1;
113  }
114  }
115 
121  bool operator<(const Link& L) const
122  {
123  if (m_low < L.m_low)
124  {
125  return true;
126  }
127  else if (m_low == L.m_low)
128  {
129  return (m_high < L.m_high);
130  }
131  else
132  {
133  return false;
134  }
135  }
136 
138  void Print() const;
139 };
140 
146 {
147  public:
152  DsrLinkStab(Time linkStab = Simulator::Now());
156  virtual ~DsrLinkStab();
157 
162  void SetLinkStability(Time linkStab)
163  {
164  m_linkStability = linkStab + Simulator::Now();
165  }
166 
172  {
173  return m_linkStability - Simulator::Now();
174  }
175 
177  void Print() const;
178 
179  private:
185 };
186 
192 {
193  public:
199  DsrNodeStab(Time nodeStab = Simulator::Now());
200  virtual ~DsrNodeStab();
201 
206  void SetNodeStability(Time nodeStab)
207  {
208  m_nodeStability = nodeStab + Simulator::Now();
209  }
210 
216  {
217  return m_nodeStability - Simulator::Now();
218  }
219 
220  private:
222 };
223 
229 {
230  public:
231  typedef std::vector<Ipv4Address> IP_VECTOR;
232  typedef std::vector<Ipv4Address>::iterator Iterator;
233 
241  DsrRouteCacheEntry(IP_VECTOR const& ip = IP_VECTOR(),
242  Ipv4Address dst = Ipv4Address(),
243  Time exp = Simulator::Now());
244  virtual ~DsrRouteCacheEntry();
245 
248  void Invalidate(Time badLinkLifetime);
249 
250  // Fields
255  void SetUnidirectional(bool u)
256  {
257  m_blackListState = u;
258  }
259 
264  bool IsUnidirectional() const
265  {
266  return m_blackListState;
267  }
268 
274  {
275  m_blackListTimeout = t;
276  }
277 
283  {
284  return m_blackListTimeout;
285  }
286 
292  {
293  return m_dst;
294  }
295 
301  {
302  m_dst = d;
303  }
304 
310  {
311  return m_path;
312  }
313 
319  {
320  m_path = v;
321  }
322 
327  void SetExpireTime(Time exp)
328  {
329  m_expire = exp + Simulator::Now();
330  }
331 
337  {
338  return m_expire - Simulator::Now();
339  }
340 
345  void Print(std::ostream& os) const;
346 
352  bool operator==(const DsrRouteCacheEntry& o) const
353  {
354  if (m_path.size() != o.m_path.size())
355  {
356  NS_ASSERT(false);
357  return false;
358  }
359  IP_VECTOR::const_iterator j = o.m_path.begin();
360  for (IP_VECTOR::const_iterator i = m_path.begin(); i != m_path.end(); i++, j++)
361  {
362  /*
363  * Verify if neither the entry are not 0 and they equal to each other
364  */
365  if (((*i) == nullptr) || ((*j) == nullptr))
366  {
367  return false;
368  }
369  else if (!((*i) == (*j)))
370  {
371  return false;
372  }
373  else
374  {
375  return true;
376  }
377  }
378  return false;
379  }
380 
381  // \}
382 
383  private:
389  uint8_t m_reqCount;
394 };
395 
401 class DsrRouteCache : public Object
402 {
403  public:
408  static TypeId GetTypeId();
409 
410  DsrRouteCache();
411  ~DsrRouteCache() override;
412 
413  // Delete assignment operator to avoid misuse
415 
420  void RemoveLastEntry(std::list<DsrRouteCacheEntry>& rtVector);
424  typedef std::list<DsrRouteCacheEntry::IP_VECTOR> routeVector;
425 
426  // Fields
431  bool GetSubRoute() const
432  {
433  return m_subRoute;
434  }
435 
440  void SetSubRoute(bool subRoute)
441  {
442  m_subRoute = subRoute;
443  }
444 
449  uint32_t GetMaxCacheLen() const
450  {
451  return m_maxCacheLen;
452  }
453 
458  void SetMaxCacheLen(uint32_t len)
459  {
460  m_maxCacheLen = len;
461  }
462 
468  {
469  return RouteCacheTimeout;
470  }
471 
477  {
478  RouteCacheTimeout = t;
479  }
480 
485  uint32_t GetMaxEntriesEachDst() const
486  {
487  return m_maxEntriesEachDst;
488  }
489 
494  void SetMaxEntriesEachDst(uint32_t entries)
495  {
496  m_maxEntriesEachDst = entries;
497  }
498 
504  {
505  return m_badLinkLifetime;
506  }
507 
513  {
514  m_badLinkLifetime = t;
515  }
516 
521  uint64_t GetStabilityDecrFactor() const
522  {
523  return m_stabilityDecrFactor;
524  }
525 
530  void SetStabilityDecrFactor(uint64_t decrFactor)
531  {
532  m_stabilityDecrFactor = decrFactor;
533  }
534 
539  uint64_t GetStabilityIncrFactor() const
540  {
541  return m_stabilityIncrFactor;
542  }
543 
548  void SetStabilityIncrFactor(uint64_t incrFactor)
549  {
550  m_stabilityIncrFactor = incrFactor;
551  }
552 
558  {
559  return m_initStability;
560  }
561 
566  void SetInitStability(Time initStability)
567  {
568  m_initStability = initStability;
569  }
570 
576  {
577  return m_minLifeTime;
578  }
579 
584  void SetMinLifeTime(Time minLifeTime)
585  {
586  m_minLifeTime = minLifeTime;
587  }
588 
594  {
595  return m_useExtends;
596  }
597 
602  void SetUseExtends(Time useExtends)
603  {
604  m_useExtends = useExtends;
605  }
606 
613  bool UpdateRouteEntry(Ipv4Address dst);
619  bool AddRoute(DsrRouteCacheEntry& rt);
631  void PrintVector(std::vector<Ipv4Address>& vec);
636  void PrintRouteVector(std::list<DsrRouteCacheEntry> route);
643  bool FindSameRoute(DsrRouteCacheEntry& rt, std::list<DsrRouteCacheEntry>& rtVector);
649  bool DeleteRoute(Ipv4Address dst);
659  Ipv4Address unreachNode,
660  Ipv4Address node);
661 
663  void Clear()
664  {
666  }
667 
669  void Purge();
672  void Print(std::ostream& os);
673 
674  //------------------------------------------------------------------------------------------
680  uint16_t CheckUniqueAckId(Ipv4Address nextHop);
685  uint16_t GetAckSize();
686 
687  // --------------------------------------------------------------------------------------------
689  struct Neighbor
690  {
694  bool close;
695 
704  : m_neighborAddress(ip),
706  m_expireTime(t),
707  close(false)
708  {
709  }
710 
712  {
713  } // For Python bindings
714  };
715 
727  bool IsNeighbor(Ipv4Address addr);
733  void UpdateNeighbor(std::vector<Ipv4Address> nodeList, Time expire);
740  void AddNeighbor(std::vector<Ipv4Address> nodeList, Ipv4Address ownAddress, Time expire);
744  void PurgeMac();
748  void ScheduleTimer();
749 
753  void ClearMac()
754  {
755  m_nb.clear();
756  }
757 
762  void AddArpCache(Ptr<ArpCache> a);
768 
775  {
776  return m_txErrorCallback;
777  }
778 
784  {
785  m_handleLinkFailure = cb;
786  }
787 
793  {
794  return m_handleLinkFailure;
795  }
796 
797  private:
800  uint32_t m_maxCacheLen;
805  /*
806  * Define the parameters for link cache type
807  */
816  typedef std::list<DsrRouteCacheEntry> routeEntryVector;
817 
818  std::map<Ipv4Address, routeEntryVector>
820 
822 
824 
825  std::map<Ipv4Address, uint16_t> m_ackIdCache;
826 
828 
829  bool m_subRoute;
834 #define MAXWEIGHT 0xFFFF;
840  std::map<Ipv4Address, std::map<Ipv4Address, uint32_t>> m_netGraph;
841 
842  std::map<Ipv4Address, DsrRouteCacheEntry::IP_VECTOR>
844  std::map<Link, DsrLinkStab> m_linkCache;
845  std::map<Ipv4Address, DsrNodeStab> m_nodeCache;
858  bool IncStability(Ipv4Address node);
864  bool DecStability(Ipv4Address node);
865 
866  public:
872  void SetCacheType(std::string type);
877  bool IsLinkCache();
891  void RebuildBestRouteTable(Ipv4Address source);
895  void PurgeLinkNode();
908  void UpdateNetGraph();
909  //---------------------------------------------------------------------------------------
914 
916 
918 
919  std::vector<Neighbor> m_nb;
920 
921  std::vector<Ptr<ArpCache>>
923 
925 
930 
933  void ProcessTxError(const WifiMacHeader& hdr);
934 };
935 } // namespace dsr
936 } // namespace ns3
937 #endif /* DSR_RCACHE_H */
Callback template class.
Definition: callback.h:443
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:43
a class to store IPv4 address information on an interface
an EUI-48 address
Definition: mac48-address.h:46
A base class which provides memory management and object aggregation.
Definition: object.h:89
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:199
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
A simple virtual Timer class.
Definition: timer.h:74
a unique identifier for an interface.
Definition: type-id.h:60
Implements the IEEE 802.11 MAC header.
DsrNodeStab class (DSR node stability)
Definition: dsr-rcache.h:192
Time GetNodeStability() const
Get node stability.
Definition: dsr-rcache.h:215
Time m_nodeStability
the node stability
Definition: dsr-rcache.h:221
void SetNodeStability(Time nodeStab)
Set node stability.
Definition: dsr-rcache.h:206
virtual ~DsrNodeStab()
Definition: dsr-rcache.cc:94
DsrNodeStab(Time nodeStab=Simulator::Now())
Constructor.
Definition: dsr-rcache.cc:89
DsrRouteCacheEntry class for entries in the route cache.
Definition: dsr-rcache.h:229
IP_VECTOR GetVector() const
Get the IP vector.
Definition: dsr-rcache.h:309
void SetDestination(Ipv4Address d)
Set destination address.
Definition: dsr-rcache.h:300
Time m_expire
Expire time for queue entry.
Definition: dsr-rcache.h:387
DsrRouteCacheEntry(IP_VECTOR const &ip=IP_VECTOR(), Ipv4Address dst=Ipv4Address(), Time exp=Simulator::Now())
Constructor.
Definition: dsr-rcache.cc:115
IP_VECTOR m_path
brief The IP address constructed route
Definition: dsr-rcache.h:386
Ipv4Address m_dst
The destination Ip address.
Definition: dsr-rcache.h:385
Ptr< Ipv4Route > m_ipv4Route
The Ipv4 route.
Definition: dsr-rcache.h:392
Time GetBlacklistTimeout() const
Get blacklist timeout.
Definition: dsr-rcache.h:282
std::vector< Ipv4Address >::iterator Iterator
Define the iterator.
Definition: dsr-rcache.h:232
uint8_t m_reqCount
Number of route requests.
Definition: dsr-rcache.h:389
Timer m_ackTimer
RREP_ACK timer.
Definition: dsr-rcache.h:384
Ptr< Ipv4 > m_ipv4
The Ipv4 layer 3.
Definition: dsr-rcache.h:393
Ipv4Address GetDestination() const
Get destination address.
Definition: dsr-rcache.h:291
void SetBlacklistTimeout(Time t)
Set blacklist timeout.
Definition: dsr-rcache.h:273
Ipv4InterfaceAddress m_iface
Output interface address.
Definition: dsr-rcache.h:388
virtual ~DsrRouteCacheEntry()
Definition: dsr-rcache.cc:126
Time m_blackListTimeout
Time for which the node is put into the blacklist.
Definition: dsr-rcache.h:391
bool IsUnidirectional() const
Get unidirectional flag.
Definition: dsr-rcache.h:264
void Invalidate(Time badLinkLifetime)
Mark entry as "down" (i.e.
Definition: dsr-rcache.cc:131
void Print(std::ostream &os) const
Print necessary fields.
Definition: dsr-rcache.cc:138
void SetUnidirectional(bool u)
Set unidirectional flag.
Definition: dsr-rcache.h:255
std::vector< Ipv4Address > IP_VECTOR
Define the vector to hold Ip address.
Definition: dsr-rcache.h:231
bool m_blackListState
Indicate if this entry is in "blacklist".
Definition: dsr-rcache.h:390
Time GetExpireTime() const
Get expire time.
Definition: dsr-rcache.h:336
void SetExpireTime(Time exp)
Set expire time.
Definition: dsr-rcache.h:327
void SetVector(IP_VECTOR v)
Sets the IP vector.
Definition: dsr-rcache.h:318
bool operator==(const DsrRouteCacheEntry &o) const
Compare the route cache entry.
Definition: dsr-rcache.h:352
DSR route request queue Since DSR is an on demand routing we queue requests while looking for route.
Definition: dsr-rcache.h:402
std::map< Ipv4Address, std::map< Ipv4Address, uint32_t > > m_netGraph
Current network graph state for this node, double is weight, which is calculated by the node informat...
Definition: dsr-rcache.h:840
uint32_t m_stabilityDecrFactor
stability decrease factor
Definition: dsr-rcache.h:808
std::list< DsrRouteCacheEntry::IP_VECTOR > routeVector
Define the vector of route entries.
Definition: dsr-rcache.h:424
static TypeId GetTypeId()
Get the type ID.
Definition: dsr-rcache.cc:146
void SetBadLinkLifetime(Time t)
Set bad link lifetime function.
Definition: dsr-rcache.h:512
void PurgeLinkNode()
Purge from the cache if the stability time expired.
Definition: dsr-rcache.cc:493
Callback< void, Ipv4Address, uint8_t > m_handleLinkFailure
The following code handles link-layer acks.
Definition: dsr-rcache.h:913
std::map< Link, DsrLinkStab > m_linkCache
The data structure to store link info.
Definition: dsr-rcache.h:844
void ScheduleTimer()
Schedule m_ntimer.
Definition: dsr-rcache.cc:1253
void SetInitStability(Time initStability)
Set initial stability.
Definition: dsr-rcache.h:566
void RebuildBestRouteTable(Ipv4Address source)
Rebuild the best route table.
Definition: dsr-rcache.cc:335
void SetCacheType(std::string type)
Dijsktra algorithm to get the best route from m_netGraph and update the m_bestRoutesTable_link when c...
Definition: dsr-rcache.cc:309
std::list< DsrRouteCacheEntry > routeEntryVector
Define the route cache data structure.
Definition: dsr-rcache.h:816
void SetStabilityDecrFactor(uint64_t decrFactor)
Set stability decrease factor.
Definition: dsr-rcache.h:530
uint64_t GetStabilityDecrFactor() const
Get stability decrease factor.
Definition: dsr-rcache.h:521
routeEntryVector m_routeEntryVector
Define the route vector.
Definition: dsr-rcache.h:821
void AddArpCache(Ptr< ArpCache > a)
Add ARP cache to be used to allow layer 2 notifications processing.
Definition: dsr-rcache.cc:1260
std::map< Ipv4Address, DsrNodeStab > m_nodeCache
The data structure to store node info.
Definition: dsr-rcache.h:845
void Purge()
Delete all outdated entries and invalidate valid entry if Lifetime is expired.
Definition: dsr-rcache.cc:1013
Time m_initStability
initial stability
Definition: dsr-rcache.h:810
uint16_t CheckUniqueAckId(Ipv4Address nextHop)
Check for duplicate ids and save new entries if the id is not present in the table.
Definition: dsr-rcache.cc:1101
bool IsLinkCache()
is link cached
Definition: dsr-rcache.cc:328
Time GetBadLinkLifetime() const
Get bad link lifetime function.
Definition: dsr-rcache.h:503
void SetMinLifeTime(Time minLifeTime)
Set minimum lifetime.
Definition: dsr-rcache.h:584
uint32_t GetMaxEntriesEachDst() const
Get max entries for each destination.
Definition: dsr-rcache.h:485
uint32_t m_stabilityIncrFactor
stability increase factor
Definition: dsr-rcache.h:809
Time GetInitStability() const
Get initial stability.
Definition: dsr-rcache.h:557
Callback< void, const WifiMacHeader & > m_txErrorCallback
TX error callback.
Definition: dsr-rcache.h:915
Time GetCacheTimeout() const
Get cache timeout value.
Definition: dsr-rcache.h:467
uint64_t GetStabilityIncrFactor() const
Get stability increase factor.
Definition: dsr-rcache.h:539
void SetMaxCacheLen(uint32_t len)
Set the max queue length.
Definition: dsr-rcache.h:458
bool LookupRoute(Ipv4Address id, DsrRouteCacheEntry &rt)
Lookup route cache entry with destination address dst.
Definition: dsr-rcache.cc:216
bool GetSubRoute() const
Get subroute indicator.
Definition: dsr-rcache.h:431
uint16_t GetAckSize()
Get the ack table size.
Definition: dsr-rcache.cc:1123
std::map< Ipv4Address, uint16_t > m_ackIdCache
The id cache to ensure all the ids are unique.
Definition: dsr-rcache.h:825
void ProcessTxError(const WifiMacHeader &hdr)
Process layer 2 TX error notification.
Definition: dsr-rcache.cc:1288
Time RouteCacheTimeout
The maximum period of time that dsr is allowed to for an unused route.
Definition: dsr-rcache.h:802
Callback< void, Ipv4Address, uint8_t > GetCallback() const
Handle link failure callback.
Definition: dsr-rcache.h:792
void SetMaxEntriesEachDst(uint32_t entries)
Set max entries for each destination.
Definition: dsr-rcache.h:494
bool AddRoute_Link(DsrRouteCacheEntry::IP_VECTOR nodelist, Ipv4Address node)
dd route link to cache
Definition: dsr-rcache.cc:593
Time m_badLinkLifetime
The time for which the neighboring node is put into the blacklist.
Definition: dsr-rcache.h:804
uint32_t m_maxCacheLen
The maximum number of packets that we allow a routing protocol to buffer.
Definition: dsr-rcache.h:800
std::vector< Ptr< ArpCache > > m_arp
list of ARP cached to be used for layer 2 notifications processing
Definition: dsr-rcache.h:922
Mac48Address LookupMacAddress(Ipv4Address addr)
Find MAC address by IP using list of ARP caches.
Definition: dsr-rcache.cc:1272
void UseExtends(DsrRouteCacheEntry::IP_VECTOR rt)
When a link from the Route Cache is used in routing a packet originated or salvaged by that node,...
Definition: dsr-rcache.cc:643
void PurgeMac()
Remove all expired mac entries.
Definition: dsr-rcache.cc:1227
bool FindSameRoute(DsrRouteCacheEntry &rt, std::list< DsrRouteCacheEntry > &rtVector)
Find the same route in the route cache.
Definition: dsr-rcache.cc:766
void Clear()
Delete all entries from routing table.
Definition: dsr-rcache.h:663
std::map< Ipv4Address, routeEntryVector > m_sortedRoutes
Map the ipv4Address to route entry vector.
Definition: dsr-rcache.h:819
Time GetMinLifeTime() const
Get minimum lifetime.
Definition: dsr-rcache.h:575
DsrRouteCacheEntry::IP_VECTOR m_vector
The route vector to save the ip addresses for intermediate nodes.
Definition: dsr-rcache.h:799
void ClearMac()
Remove all entries.
Definition: dsr-rcache.h:753
void SetUseExtends(Time useExtends)
Set use extends.
Definition: dsr-rcache.h:602
Callback< void, const WifiMacHeader & > GetTxErrorCallback() const
Get callback to ProcessTxError, this callback is trying to use the wifi mac tx error header to notify...
Definition: dsr-rcache.h:774
Time GetUseExtends() const
Get use extends.
Definition: dsr-rcache.h:593
void PrintVector(std::vector< Ipv4Address > &vec)
Print the route vector elements.
Definition: dsr-rcache.cc:980
bool m_isLinkCache
Check if the route is using path cache or link cache.
Definition: dsr-rcache.h:827
Time m_delay
This timeout deals with the passive ack.
Definition: dsr-rcache.h:924
bool DeleteRoute(Ipv4Address dst)
Delete the route with certain destination address.
Definition: dsr-rcache.cc:800
bool IncStability(Ipv4Address node)
increase the stability of the node
Definition: dsr-rcache.cc:544
void PrintRouteVector(std::list< DsrRouteCacheEntry > route)
Print all the route vector elements from the route list.
Definition: dsr-rcache.cc:1001
uint32_t m_maxEntriesEachDst
number of entries for each destination
Definition: dsr-rcache.h:823
Time GetExpireTime(Ipv4Address addr)
Return expire time for neighbor node with address addr, if exists, else return 0.
Definition: dsr-rcache.cc:1148
Time m_useExtends
use extend
Definition: dsr-rcache.h:812
std::vector< Neighbor > m_nb
vector of entries
Definition: dsr-rcache.h:919
uint32_t GetMaxCacheLen() const
Get the max queue length.
Definition: dsr-rcache.h:449
Time m_minLifeTime
minimum lifetime
Definition: dsr-rcache.h:811
void DelArpCache(Ptr< ArpCache >)
Don't use the provided ARP cache any more (interface is down)
Definition: dsr-rcache.cc:1266
void SetSubRoute(bool subRoute)
Set subroute indicator.
Definition: dsr-rcache.h:440
void Print(std::ostream &os)
Print route cache.
Definition: dsr-rcache.cc:1081
void SetCacheTimeout(Time t)
Set cache timeout value.
Definition: dsr-rcache.h:476
bool LookupRoute_Link(Ipv4Address id, DsrRouteCacheEntry &rt)
used by LookupRoute when LinkCache
Definition: dsr-rcache.cc:460
void SetStabilityIncrFactor(uint64_t incrFactor)
Set stability increase factor.
Definition: dsr-rcache.h:548
bool UpdateRouteEntry(Ipv4Address dst)
Update route cache entry if it has been recently used and successfully delivered the data packet.
Definition: dsr-rcache.cc:186
DsrRouteCache & operator=(const DsrRouteCache &)=delete
void UpdateNeighbor(std::vector< Ipv4Address > nodeList, Time expire)
Update expire time for entry with address addr, if it exists, else add new entry.
Definition: dsr-rcache.cc:1163
void RemoveLastEntry(std::list< DsrRouteCacheEntry > &rtVector)
Remove the aged route cache entries when the route cache is full.
Definition: dsr-rcache.cc:178
void SetCallback(Callback< void, Ipv4Address, uint8_t > cb)
Handle link failure callback.
Definition: dsr-rcache.h:783
Timer m_ntimer
Timer for neighbor's list. Schedule Purge().
Definition: dsr-rcache.h:917
bool m_subRoute
Check if save the sub route entries or not.
Definition: dsr-rcache.h:829
void DeleteAllRoutesIncludeLink(Ipv4Address errorSrc, Ipv4Address unreachNode, Ipv4Address node)
Delete all the routes which includes the link from next hop address that has just been notified as un...
Definition: dsr-rcache.cc:814
bool IsNeighbor(Ipv4Address addr)
Check that node with address addr is neighbor.
Definition: dsr-rcache.cc:1133
std::map< Ipv4Address, DsrRouteCacheEntry::IP_VECTOR > m_bestRoutesTable_link
for link route cache
Definition: dsr-rcache.h:843
bool DecStability(Ipv4Address node)
decrease the stability of the node
Definition: dsr-rcache.cc:569
void UpdateNetGraph()
Update the Net Graph for the link and node cache has changed.
Definition: dsr-rcache.cc:529
bool AddRoute(DsrRouteCacheEntry &rt)
Add route cache entry if it doesn't yet exist in route cache.
Definition: dsr-rcache.cc:690
void AddNeighbor(std::vector< Ipv4Address > nodeList, Ipv4Address ownAddress, Time expire)
Add to the neighbor list.
Definition: dsr-rcache.cc:1190
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:66
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
Definition: nstime.h:848
Every class exported by the ns3 library is enclosed in the ns3 namespace.
mac
Definition: third.py:85
Structure to manage neighbor state.
Definition: dsr-rcache.h:690
Mac48Address m_hardwareAddress
neighbor MAC address
Definition: dsr-rcache.h:692
Neighbor(Ipv4Address ip, Mac48Address mac, Time t)
Constructor.
Definition: dsr-rcache.h:703
Ipv4Address m_neighborAddress
neighbor address
Definition: dsr-rcache.h:691
Time m_expireTime
route expire time
Definition: dsr-rcache.h:693