1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
3
* Copyright (c) 2008,2009 IITP RAS
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;
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.
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
18
* Author: Kirill Andreev <andreev@iitp.ru>
25
#include "ns3/nstime.h"
26
#include "ns3/mac48-address.h"
27
#include "ns3/hwmp-protocol.h"
33
* \brief Routing table for HWMP -- 802.11s routing protocol
35
class HwmpRtable : public Object
38
/// Means all interfaces
39
const static uint32_t INTERFACE_ANY = 0xffffffff;
40
/// Maximum (the best?) path metric
41
const static uint32_t MAX_METRIC = 0xffffffff;
43
/// Route lookup result, return type of LookupXXX methods
46
Mac48Address retransmitter;
51
LookupResult (Mac48Address r = Mac48Address::GetBroadcast (),
52
uint32_t i = INTERFACE_ANY,
53
uint32_t m = MAX_METRIC,
55
Time l = Seconds (0.0));
56
/// True for valid route
57
bool IsValid () const;
58
/// Compare route lookup results, used by tests
59
bool operator== (const LookupResult & o) const;
61
/// Path precursor = {MAC, interface ID}
62
typedef std::vector<std::pair<uint32_t, Mac48Address> > PrecursorList;
65
static TypeId GetTypeId ();
70
///\name Add/delete paths
72
void AddReactivePath (
73
Mac48Address destination,
74
Mac48Address retransmitter,
80
void AddProactivePath (
83
Mac48Address retransmitter,
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);
97
/// Lookup path to destination
98
LookupResult LookupReactive (Mac48Address destination);
99
/// Return all reactive paths, including expired
100
LookupResult LookupReactiveExpired (Mac48Address destination);
101
/// Find proactive path to tree root. Note that calling this method has side effect of deleting expired proactive path
102
LookupResult LookupProactive ();
103
/// Return all proactive paths, including expired
104
LookupResult LookupProactiveExpired ();
107
/// When peer link with a given MAC-address fails - it returns list of unreachable destination addresses
108
std::vector<HwmpProtocol::FailedDestination> GetUnreachableDestinations (Mac48Address peerAddress);
111
/// Route found in reactive mode
114
Mac48Address address;
120
Mac48Address retransmitter;
125
std::vector<Precursor> precursors;
127
/// Route fond in proactive mode
128
struct ProactiveRoute
131
Mac48Address retransmitter;
136
std::vector<Precursor> precursors;
140
std::map<Mac48Address, ReactiveRoute> m_routes;
141
/// Path to proactive tree root MP
142
ProactiveRoute m_root;
144
} // namespace dot11s