A Discrete-Event Network Simulator
API
hwmp-rtable.h
Go to the documentation of this file.
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  {
47  uint32_t ifIndex;
48  uint32_t metric;
49  uint32_t seqnum;
51 
61  uint32_t i = INTERFACE_ANY,
62  uint32_t m = MAX_METRIC,
63  uint32_t s = 0,
64  Time l = Seconds (0.0));
68  bool IsValid () const;
74  bool operator== (const LookupResult & o) const;
75  };
77  typedef std::vector<std::pair<uint32_t, Mac48Address> > PrecursorList;
78 
79 public:
84  static TypeId GetTypeId ();
85  HwmpRtable ();
86  ~HwmpRtable ();
87  void DoDispose ();
88 
91 
101  void AddReactivePath (
102  Mac48Address destination,
103  Mac48Address retransmitter,
104  uint32_t interface,
105  uint32_t metric,
106  Time lifetime,
107  uint32_t seqnum
108  );
118  void AddProactivePath (
119  uint32_t metric,
120  Mac48Address root,
121  Mac48Address retransmitter,
122  uint32_t interface,
123  Time lifetime,
124  uint32_t seqnum
125  );
133  void AddPrecursor (Mac48Address destination, uint32_t precursorInterface, Mac48Address precursorAddress, Time lifetime);
134 
141 
145  void DeleteProactivePath ();
150  void DeleteProactivePath (Mac48Address root);
155  void DeleteReactivePath (Mac48Address destination);
157 
160 
183 
189  std::vector<HwmpProtocol::FailedDestination> GetUnreachableDestinations (Mac48Address peerAddress);
190 
191 private:
193  struct Precursor
194  {
196  uint32_t interface;
198  };
201  {
203  uint32_t interface;
204  uint32_t metric;
206  uint32_t seqnum;
207  std::vector<Precursor> precursors;
208  };
211  {
214  uint32_t interface;
215  uint32_t metric;
217  uint32_t seqnum;
218  std::vector<Precursor> precursors;
219  };
220 
222  std::map<Mac48Address, ReactiveRoute> m_routes;
225 };
226 } // namespace dot11s
227 } // namespace ns3
228 #endif
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
ns3::dot11s::HwmpRtable::DeleteReactivePath
void DeleteReactivePath(Mac48Address destination)
Delete the reactive paths toward a destination.
Definition: hwmp-rtable.cc:140
ns3::dot11s::HwmpRtable::LookupResult::retransmitter
Mac48Address retransmitter
retransmitter
Definition: hwmp-rtable.h:46
ns3::dot11s::HwmpRtable::INTERFACE_ANY
static const uint32_t INTERFACE_ANY
Means all interfaces.
Definition: hwmp-rtable.h:39
ns3::dot11s::HwmpRtable::ReactiveRoute::retransmitter
Mac48Address retransmitter
transmitter
Definition: hwmp-rtable.h:202
ns3::dot11s::HwmpRtable::ProactiveRoute
Route found in proactive mode.
Definition: hwmp-rtable.h:211
ns3::dot11s::HwmpRtable::AddReactivePath
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:59
ns3::dot11s::HwmpRtable::ReactiveRoute::interface
uint32_t interface
interface
Definition: hwmp-rtable.h:203
ns3::dot11s::HwmpRtable::ProactiveRoute::retransmitter
Mac48Address retransmitter
retransmitter
Definition: hwmp-rtable.h:213
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::dot11s::HwmpRtable::LookupResult::LookupResult
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:248
ns3::dot11s::HwmpRtable::Precursor
Route found in reactive mode.
Definition: hwmp-rtable.h:194
ns3::dot11s::HwmpRtable::m_root
ProactiveRoute m_root
Path to proactive tree root MP.
Definition: hwmp-rtable.h:224
ns3::dot11s::HwmpRtable::LookupResult::metric
uint32_t metric
metric
Definition: hwmp-rtable.h:48
ns3::dot11s::HwmpRtable::ProactiveRoute::metric
uint32_t metric
metric
Definition: hwmp-rtable.h:215
ns3::dot11s::HwmpRtable::LookupResult
Route lookup result, return type of LookupXXX methods.
Definition: hwmp-rtable.h:45
ns3::Mac48Address
an EUI-48 address
Definition: mac48-address.h:44
ns3::dot11s::HwmpRtable::ReactiveRoute::metric
uint32_t metric
metric
Definition: hwmp-rtable.h:204
ns3::dot11s::HwmpRtable::Precursor::interface
uint32_t interface
interface
Definition: hwmp-rtable.h:196
ns3::dot11s::HwmpRtable::AddProactivePath
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:78
ns3::dot11s::HwmpRtable::DeleteProactivePath
void DeleteProactivePath()
Delete all the proactive paths.
Definition: hwmp-rtable.cc:120
ns3::dot11s::HwmpRtable::ProactiveRoute::interface
uint32_t interface
interface
Definition: hwmp-rtable.h:214
ns3::dot11s::HwmpRtable::DoDispose
void DoDispose()
Destructor implementation.
Definition: hwmp-rtable.cc:54
ns3::dot11s::HwmpRtable::ReactiveRoute::precursors
std::vector< Precursor > precursors
precursors
Definition: hwmp-rtable.h:207
ns3::dot11s::HwmpRtable::ReactiveRoute::whenExpire
Time whenExpire
expire time
Definition: hwmp-rtable.h:205
ns3::dot11s::HwmpRtable::m_routes
std::map< Mac48Address, ReactiveRoute > m_routes
List of routes.
Definition: hwmp-rtable.h:222
ns3::dot11s::HwmpRtable::LookupResult::operator==
bool operator==(const LookupResult &o) const
Compare route lookup results, used by tests.
Definition: hwmp-rtable.cc:243
ns3::Mac48Address::GetBroadcast
static Mac48Address GetBroadcast(void)
Definition: mac48-address.cc:170
ns3::dot11s::HwmpRtable::ReactiveRoute::seqnum
uint32_t seqnum
sequence number
Definition: hwmp-rtable.h:206
ns3::dot11s::HwmpRtable::LookupResult::seqnum
uint32_t seqnum
sequence number
Definition: hwmp-rtable.h:49
ns3::dot11s::HwmpRtable::ProactiveRoute::whenExpire
Time whenExpire
expire time
Definition: hwmp-rtable.h:216
ns3::dot11s::HwmpRtable::LookupReactiveExpired
LookupResult LookupReactiveExpired(Mac48Address destination)
Return all reactive paths, including expired.
Definition: hwmp-rtable.cc:166
ns3::Object
A base class which provides memory management and object aggregation.
Definition: object.h:88
ns3::dot11s::HwmpRtable::Precursor::whenExpire
Time whenExpire
expire time
Definition: hwmp-rtable.h:197
ns3::dot11s::HwmpRtable::GetUnreachableDestinations
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:198
ns3::dot11s::HwmpRtable::LookupResult::IsValid
bool IsValid() const
Definition: hwmp-rtable.cc:253
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::dot11s::HwmpRtable::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition: hwmp-rtable.cc:38
ns3::dot11s::HwmpRtable::GetPrecursors
PrecursorList GetPrecursors(Mac48Address destination)
Get the precursors list.
Definition: hwmp-rtable.cc:223
ns3::dot11s::HwmpRtable::LookupResult::ifIndex
uint32_t ifIndex
IF index.
Definition: hwmp-rtable.h:47
ns3::dot11s::HwmpRtable::LookupReactive
LookupResult LookupReactive(Mac48Address destination)
Lookup path to destination.
Definition: hwmp-rtable.cc:150
ns3::dot11s::HwmpRtable::ProactiveRoute::root
Mac48Address root
root
Definition: hwmp-rtable.h:212
ns3::dot11s::HwmpRtable::~HwmpRtable
~HwmpRtable()
Definition: hwmp-rtable.cc:50
ns3::dot11s::HwmpRtable::HwmpRtable
HwmpRtable()
Definition: hwmp-rtable.cc:46
ns3::dot11s::HwmpRtable::LookupResult::lifetime
Time lifetime
lifetime
Definition: hwmp-rtable.h:50
ns3::dot11s::HwmpRtable::AddPrecursor
void AddPrecursor(Mac48Address destination, uint32_t precursorInterface, Mac48Address precursorAddress, Time lifetime)
Add a precursor.
Definition: hwmp-rtable.cc:90
ns3::dot11s::HwmpRtable::MAX_METRIC
static const uint32_t MAX_METRIC
Maximum (the best?) path metric.
Definition: hwmp-rtable.h:41
ns3::dot11s::HwmpRtable::LookupProactiveExpired
LookupResult LookupProactiveExpired()
Return all proactive paths, including expired.
Definition: hwmp-rtable.cc:190
ns3::dot11s::HwmpRtable::ProactiveRoute::precursors
std::vector< Precursor > precursors
precursors
Definition: hwmp-rtable.h:218
ns3::dot11s::HwmpRtable::ProactiveRoute::seqnum
uint32_t seqnum
sequence number
Definition: hwmp-rtable.h:217
ns3::dot11s::HwmpRtable::ReactiveRoute
Route found in reactive mode.
Definition: hwmp-rtable.h:201
ns3::dot11s::HwmpRtable::LookupProactive
LookupResult LookupProactive()
Find proactive path to tree root.
Definition: hwmp-rtable.cc:179
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1289
ns3::dot11s::HwmpRtable::PrecursorList
std::vector< std::pair< uint32_t, Mac48Address > > PrecursorList
Path precursor = {MAC, interface ID}.
Definition: hwmp-rtable.h:77
ns3::dot11s::HwmpRtable::Precursor::address
Mac48Address address
address
Definition: hwmp-rtable.h:195
ns3::dot11s::HwmpRtable
Routing table for HWMP – 802.11s routing protocol.
Definition: hwmp-rtable.h:36