A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
hwmp-rtable.h
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2008,2009 IITP RAS
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: Kirill Andreev <andreev@iitp.ru>
19  */
20 
21 #ifndef HWMP_RTABLE_H
22 #define HWMP_RTABLE_H
23 
24 #include <map>
25 #include "ns3/nstime.h"
26 #include "ns3/mac48-address.h"
27 #include "ns3/hwmp-protocol.h"
28 namespace ns3 {
29 namespace dot11s {
35 class HwmpRtable : public Object
36 {
37 public:
39  const static uint32_t INTERFACE_ANY = 0xffffffff;
41  const static uint32_t MAX_METRIC = 0xffffffff;
42 
44  struct LookupResult
45  {
46  Mac48Address retransmitter;
47  uint32_t ifIndex;
48  uint32_t metric;
49  uint32_t seqnum;
50  Time lifetime;
52  uint32_t i = INTERFACE_ANY,
53  uint32_t m = MAX_METRIC,
54  uint32_t s = 0,
55  Time l = Seconds (0.0));
57  bool IsValid () const;
59  bool operator== (const LookupResult & o) const;
60  };
62  typedef std::vector<std::pair<uint32_t, Mac48Address> > PrecursorList;
63 
64 public:
65  static TypeId GetTypeId ();
66  HwmpRtable ();
67  ~HwmpRtable ();
68  void DoDispose ();
69 
71  //\{
72  void AddReactivePath (
73  Mac48Address destination,
74  Mac48Address retransmitter,
75  uint32_t interface,
76  uint32_t metric,
77  Time lifetime,
78  uint32_t seqnum
79  );
80  void AddProactivePath (
81  uint32_t metric,
82  Mac48Address root,
83  Mac48Address retransmitter,
84  uint32_t interface,
85  Time lifetime,
86  uint32_t seqnum
87  );
88  void AddPrecursor (Mac48Address destination, uint32_t precursorInterface, Mac48Address precursorAddress, Time lifetime);
89  PrecursorList GetPrecursors (Mac48Address destination);
90  void DeleteProactivePath ();
91  void DeleteProactivePath (Mac48Address root);
92  void DeleteReactivePath (Mac48Address destination);
93  //\}
94 
96  //\{
105  //\}
106 
108  std::vector<HwmpProtocol::FailedDestination> GetUnreachableDestinations (Mac48Address peerAddress);
109 
110 private:
112  struct Precursor
113  {
114  Mac48Address address;
115  uint32_t interface;
116  Time whenExpire;
117  };
119  {
120  Mac48Address retransmitter;
121  uint32_t interface;
122  uint32_t metric;
123  Time whenExpire;
124  uint32_t seqnum;
125  std::vector<Precursor> precursors;
126  };
129  {
130  Mac48Address root;
131  Mac48Address retransmitter;
132  uint32_t interface;
133  uint32_t metric;
134  Time whenExpire;
135  uint32_t seqnum;
136  std::vector<Precursor> precursors;
137  };
138 
140  std::map<Mac48Address, ReactiveRoute> m_routes;
143 };
144 } // namespace dot11s
145 } // namespace ns3
146 #endif
keep track of time unit.
Definition: nstime.h:149
ProactiveRoute m_root
Path to proactive tree root MP.
Definition: hwmp-rtable.h:142
static const uint32_t MAX_METRIC
Maximum (the best?) path metric.
Definition: hwmp-rtable.h:41
Route lookup result, return type of LookupXXX methods.
Definition: hwmp-rtable.h:44
LookupResult LookupReactiveExpired(Mac48Address destination)
Return all reactive paths, including expired.
Definition: hwmp-rtable.cc:157
bool IsValid() const
True for valid route.
Definition: hwmp-rtable.cc:237
LookupResult LookupReactive(Mac48Address destination)
Lookup path to destination.
Definition: hwmp-rtable.cc:142
std::vector< std::pair< uint32_t, Mac48Address > > PrecursorList
Path precursor = {MAC, interface ID}.
Definition: hwmp-rtable.h:62
Routing table for HWMP – 802.11s routing protocol.
Definition: hwmp-rtable.h:35
Route fond in proactive mode.
Definition: hwmp-rtable.h:128
std::vector< HwmpProtocol::FailedDestination > GetUnreachableDestinations(Mac48Address peerAddress)
When peer link with a given MAC-address fails - it returns list of unreachable destination addresses...
Definition: hwmp-rtable.cc:184
Route found in reactive mode.
Definition: hwmp-rtable.h:112
static Mac48Address GetBroadcast(void)
LookupResult LookupProactiveExpired()
Return all proactive paths, including expired.
Definition: hwmp-rtable.cc:178
static const uint32_t INTERFACE_ANY
Means all interfaces.
Definition: hwmp-rtable.h:39
bool operator==(const LookupResult &o) const
Compare route lookup results, used by tests.
Definition: hwmp-rtable.cc:227
std::map< Mac48Address, ReactiveRoute > m_routes
List of routes.
Definition: hwmp-rtable.h:140
an EUI-48 address
Definition: mac48-address.h:41
Time Seconds(double seconds)
create ns3::Time instances in units of seconds.
Definition: nstime.h:586
a base class which provides memory management and object aggregation
Definition: object.h:63
a unique identifier for an interface.
Definition: type-id.h:44
LookupResult LookupProactive()
Find proactive path to tree root. Note that calling this method has side effect of deleting expired p...
Definition: hwmp-rtable.cc:168