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 "hwmp-protocol.h"
24 
25 #include "ns3/mac48-address.h"
26 #include "ns3/nstime.h"
27 
28 #include <map>
29 
30 namespace ns3
31 {
32 namespace dot11s
33 {
39 class HwmpRtable : public Object
40 {
41  public:
43  const static uint32_t INTERFACE_ANY = 0xffffffff;
45  const static uint32_t MAX_METRIC = 0xffffffff;
46 
48  struct LookupResult
49  {
51  uint32_t ifIndex;
52  uint32_t metric;
53  uint32_t seqnum;
65  uint32_t i = INTERFACE_ANY,
66  uint32_t m = MAX_METRIC,
67  uint32_t s = 0,
68  Time l = Seconds(0.0));
72  bool IsValid() const;
78  bool operator==(const LookupResult& o) const;
79  };
80 
82  typedef std::vector<std::pair<uint32_t, Mac48Address>> PrecursorList;
83 
84  public:
89  static TypeId GetTypeId();
90  HwmpRtable();
91  ~HwmpRtable() override;
92  void DoDispose() override;
93 
96 
106  void AddReactivePath(Mac48Address destination,
107  Mac48Address retransmitter,
108  uint32_t interface,
109  uint32_t metric,
110  Time lifetime,
111  uint32_t seqnum);
121  void AddProactivePath(uint32_t metric,
122  Mac48Address root,
123  Mac48Address retransmitter,
124  uint32_t interface,
125  Time lifetime,
126  uint32_t seqnum);
134  void AddPrecursor(Mac48Address destination,
135  uint32_t precursorInterface,
136  Mac48Address precursorAddress,
137  Time lifetime);
138 
145 
149  void DeleteProactivePath();
159  void DeleteReactivePath(Mac48Address destination);
161 
164 
188 
195  std::vector<HwmpProtocol::FailedDestination> GetUnreachableDestinations(
196  Mac48Address peerAddress);
197 
198  private:
200  struct Precursor
201  {
203  uint32_t interface;
205  };
206 
209  {
211  uint32_t interface;
212  uint32_t metric;
214  uint32_t seqnum;
215  std::vector<Precursor> precursors;
216  };
217 
220  {
223  uint32_t interface;
224  uint32_t metric;
226  uint32_t seqnum;
227  std::vector<Precursor> precursors;
228  };
229 
231  std::map<Mac48Address, ReactiveRoute> m_routes;
234 };
235 } // namespace dot11s
236 } // namespace ns3
237 #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:59
Routing table for HWMP – 802.11s routing protocol.
Definition: hwmp-rtable.h:40
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:43
static const uint32_t MAX_METRIC
Maximum (the best?) path metric.
Definition: hwmp-rtable.h:45
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:231
PrecursorList GetPrecursors(Mac48Address destination)
Get the precursors list.
Definition: hwmp-rtable.cc:256
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:82
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:233
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:1326
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:49
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:282
bool operator==(const LookupResult &o) const
Compare route lookup results, used by tests.
Definition: hwmp-rtable.cc:276
uint32_t seqnum
sequence number
Definition: hwmp-rtable.h:53
Mac48Address retransmitter
retransmitter
Definition: hwmp-rtable.h:50
Route found in reactive mode.
Definition: hwmp-rtable.h:201
Route found in proactive mode.
Definition: hwmp-rtable.h:220
std::vector< Precursor > precursors
precursors
Definition: hwmp-rtable.h:227
Mac48Address retransmitter
retransmitter
Definition: hwmp-rtable.h:222
Route found in reactive mode.
Definition: hwmp-rtable.h:209
Mac48Address retransmitter
transmitter
Definition: hwmp-rtable.h:210
std::vector< Precursor > precursors
precursors
Definition: hwmp-rtable.h:215
uint32_t seqnum
sequence number
Definition: hwmp-rtable.h:214