A Discrete-Event Network Simulator
API
hwmp-rtable.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008,2009 IITP RAS
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: Kirill Andreev <andreev@iitp.ru>
18  */
19 
20 #ifndef HWMP_RTABLE_H
21 #define HWMP_RTABLE_H
22 
23 #include "ns3/hwmp-protocol.h"
24 #include "ns3/mac48-address.h"
25 #include "ns3/nstime.h"
26 
27 #include <map>
28 
29 namespace ns3
30 {
31 namespace dot11s
32 {
38 class HwmpRtable : public Object
39 {
40  public:
42  const static uint32_t INTERFACE_ANY = 0xffffffff;
44  const static uint32_t MAX_METRIC = 0xffffffff;
45 
47  struct LookupResult
48  {
50  uint32_t ifIndex;
51  uint32_t metric;
52  uint32_t seqnum;
64  uint32_t i = INTERFACE_ANY,
65  uint32_t m = MAX_METRIC,
66  uint32_t s = 0,
67  Time l = Seconds(0.0));
71  bool IsValid() const;
77  bool operator==(const LookupResult& o) const;
78  };
79 
81  typedef std::vector<std::pair<uint32_t, Mac48Address>> PrecursorList;
82 
83  public:
88  static TypeId GetTypeId();
89  HwmpRtable();
90  ~HwmpRtable() override;
91  void DoDispose() override;
92 
95 
105  void AddReactivePath(Mac48Address destination,
106  Mac48Address retransmitter,
107  uint32_t interface,
108  uint32_t metric,
109  Time lifetime,
110  uint32_t seqnum);
120  void AddProactivePath(uint32_t metric,
121  Mac48Address root,
122  Mac48Address retransmitter,
123  uint32_t interface,
124  Time lifetime,
125  uint32_t seqnum);
133  void AddPrecursor(Mac48Address destination,
134  uint32_t precursorInterface,
135  Mac48Address precursorAddress,
136  Time lifetime);
137 
144 
148  void DeleteProactivePath();
158  void DeleteReactivePath(Mac48Address destination);
160 
163 
187 
194  std::vector<HwmpProtocol::FailedDestination> GetUnreachableDestinations(
195  Mac48Address peerAddress);
196 
197  private:
199  struct Precursor
200  {
202  uint32_t interface;
204  };
205 
208  {
210  uint32_t interface;
211  uint32_t metric;
213  uint32_t seqnum;
214  std::vector<Precursor> precursors;
215  };
216 
219  {
222  uint32_t interface;
223  uint32_t metric;
225  uint32_t seqnum;
226  std::vector<Precursor> precursors;
227  };
228 
230  std::map<Mac48Address, ReactiveRoute> m_routes;
233 };
234 } // namespace dot11s
235 } // namespace ns3
236 #endif
an EUI-48 address
Definition: mac48-address.h:46
static Mac48Address GetBroadcast()
A base class which provides memory management and object aggregation.
Definition: object.h:89
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:60
Routing table for HWMP – 802.11s routing protocol.
Definition: hwmp-rtable.h:39
void DeleteReactivePath(Mac48Address destination)
Delete the reactive paths toward a destination.
Definition: hwmp-rtable.cc:161
void DoDispose() override
Destructor implementation.
Definition: hwmp-rtable.cc:58
static const uint32_t INTERFACE_ANY
Means all interfaces.
Definition: hwmp-rtable.h:42
static const uint32_t MAX_METRIC
Maximum (the best?) path metric.
Definition: hwmp-rtable.h:44
LookupResult LookupReactive(Mac48Address destination)
Lookup path to destination.
Definition: hwmp-rtable.cc:172
LookupResult LookupReactiveExpired(Mac48Address destination)
Return all reactive paths, including expired.
Definition: hwmp-rtable.cc:189
static TypeId GetTypeId()
Get the type ID.
Definition: hwmp-rtable.cc:39
std::map< Mac48Address, ReactiveRoute > m_routes
List of routes.
Definition: hwmp-rtable.h:230
PrecursorList GetPrecursors(Mac48Address destination)
Get the precursors list.
Definition: hwmp-rtable.cc:257
void DeleteProactivePath()
Delete all the proactive paths.
Definition: hwmp-rtable.cc:139
LookupResult LookupProactiveExpired()
Return all proactive paths, including expired.
Definition: hwmp-rtable.cc:218
std::vector< std::pair< uint32_t, Mac48Address > > PrecursorList
Path precursor = {MAC, interface ID}.
Definition: hwmp-rtable.h:81
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:230
ProactiveRoute m_root
Path to proactive tree root MP.
Definition: hwmp-rtable.h:232
LookupResult LookupProactive()
Find proactive path to tree root.
Definition: hwmp-rtable.cc:206
void AddPrecursor(Mac48Address destination, uint32_t precursorInterface, Mac48Address precursorAddress, Time lifetime)
Add a precursor.
Definition: hwmp-rtable.cc:106
void AddProactivePath(uint32_t metric, Mac48Address root, Mac48Address retransmitter, uint32_t interface, Time lifetime, uint32_t seqnum)
Add a proactive path.
Definition: hwmp-rtable.cc:89
void AddReactivePath(Mac48Address destination, Mac48Address retransmitter, uint32_t interface, uint32_t metric, Time lifetime, uint32_t seqnum)
Add a reactive path.
Definition: hwmp-rtable.cc:64
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1336
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Route lookup result, return type of LookupXXX methods.
Definition: hwmp-rtable.h:48
LookupResult(Mac48Address r=Mac48Address::GetBroadcast(), uint32_t i=INTERFACE_ANY, uint32_t m=MAX_METRIC, uint32_t s=0, Time l=Seconds(0.0))
Lookup result function.
Definition: hwmp-rtable.cc:285
bool operator==(const LookupResult &o) const
Compare route lookup results, used by tests.
Definition: hwmp-rtable.cc:279
uint32_t seqnum
sequence number
Definition: hwmp-rtable.h:52
Mac48Address retransmitter
retransmitter
Definition: hwmp-rtable.h:49
Route found in reactive mode.
Definition: hwmp-rtable.h:200
Route found in proactive mode.
Definition: hwmp-rtable.h:219
std::vector< Precursor > precursors
precursors
Definition: hwmp-rtable.h:226
Mac48Address retransmitter
retransmitter
Definition: hwmp-rtable.h:221
Route found in reactive mode.
Definition: hwmp-rtable.h:208
Mac48Address retransmitter
transmitter
Definition: hwmp-rtable.h:209
std::vector< Precursor > precursors
precursors
Definition: hwmp-rtable.h:214
uint32_t seqnum
sequence number
Definition: hwmp-rtable.h:213