author | Kirill Andreev <andreev@iitp.ru> |
Wed, 22 Jul 2009 16:43:43 +0400 | |
changeset 5132 | aee541a30256 |
parent 5130 | b5062e8e0da1 |
child 5135 | 10c2f3ae8c2f |
permissions | -rw-r--r-- |
4793 | 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 |
|
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
4793 | 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" |
|
4885
2761d3e01723
HWMP rtable and tag added back to wscripts without any changes
Kirill Andreev <andreev@iitp.ru>
parents:
4882
diff
changeset
|
27 |
#include "ie-dot11s-perr.h" |
5132
aee541a30256
Restored newline at namespace
Kirill Andreev <andreev@iitp.ru>
parents:
5130
diff
changeset
|
28 |
namespace ns3 { |
aee541a30256
Restored newline at namespace
Kirill Andreev <andreev@iitp.ru>
parents:
5130
diff
changeset
|
29 |
namespace dot11s { |
4807
a1f43e372f9f
1. HIDE_UNDOC_CLASSES is temporary set to NO in doxygen.conf
Pavel Boyko <boyko@iitp.ru>
parents:
4802
diff
changeset
|
30 |
/** |
4901
626a970811a1
HWMP headers cleanup to create correct doxygen docs
Pavel Boyko <boyko@iitp.ru>
parents:
4900
diff
changeset
|
31 |
* \ingroup dot11s |
5129 | 32 |
* |
4901
626a970811a1
HWMP headers cleanup to create correct doxygen docs
Pavel Boyko <boyko@iitp.ru>
parents:
4900
diff
changeset
|
33 |
* \brief Routing table for HWMP -- 802.11s routing protocol |
4807
a1f43e372f9f
1. HIDE_UNDOC_CLASSES is temporary set to NO in doxygen.conf
Pavel Boyko <boyko@iitp.ru>
parents:
4802
diff
changeset
|
34 |
*/ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
35 |
class HwmpRtable : public Object |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
36 |
{ |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
37 |
public: |
4920
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
38 |
/// Means all interfaces |
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
39 |
const static uint32_t INTERFACE_ANY = 0xffffffff; |
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
40 |
/// Maximum (the best?) path metric |
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
41 |
const static uint32_t MAX_METRIC = 0xffffffff; |
5129 | 42 |
|
4920
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
43 |
/// Route lookup result, return type of LookupXXX methods |
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
44 |
struct LookupResult |
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
45 |
{ |
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
46 |
Mac48Address retransmitter; |
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
47 |
uint32_t ifIndex; |
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
48 |
uint32_t metric; |
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
49 |
uint32_t seqnum; |
4983 | 50 |
Time lifetime; |
5129 | 51 |
|
5130 | 52 |
LookupResult (Mac48Address r = Mac48Address::GetBroadcast (), |
5129 | 53 |
uint32_t i = INTERFACE_ANY, |
54 |
uint32_t m = MAX_METRIC, |
|
4983 | 55 |
uint32_t s = 0, |
5130 | 56 |
Time l = Seconds (0.0)) |
4920
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
57 |
: retransmitter (r), |
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
58 |
ifIndex (i), |
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
59 |
metric (m), |
4983 | 60 |
seqnum (s), |
61 |
lifetime (l) |
|
4920
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
62 |
{ |
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
63 |
} |
5129 | 64 |
|
65 |
/// True for valid route |
|
5130 | 66 |
bool IsValid () const; |
4920
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
67 |
/// Compare route lookup results, used by tests |
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
68 |
bool operator==(const LookupResult & o) const; |
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
69 |
}; |
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
70 |
/// Path precursor = {MAC, interface ID} |
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
71 |
typedef std::vector<std::pair<uint32_t, Mac48Address> > PrecursorList; |
5129 | 72 |
|
4920
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
73 |
public: |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
74 |
static TypeId GetTypeId (); |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4837
diff
changeset
|
75 |
HwmpRtable (); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4837
diff
changeset
|
76 |
~HwmpRtable (); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4837
diff
changeset
|
77 |
void DoDispose (); |
5129 | 78 |
|
4920
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
79 |
///\name Add/delete paths |
5129 | 80 |
//\{ |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4837
diff
changeset
|
81 |
void AddReactivePath ( |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
82 |
Mac48Address destination, |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
83 |
Mac48Address retransmitter, |
4893
d390c2dd2f14
Restructured rtable, queue size moved from protocol setter to attribute
Kirill Andreev <andreev@iitp.ru>
parents:
4885
diff
changeset
|
84 |
uint32_t interface, |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
85 |
uint32_t metric, |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
86 |
Time lifetime, |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
87 |
uint32_t seqnum |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
88 |
); |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4837
diff
changeset
|
89 |
void AddProactivePath ( |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
90 |
uint32_t metric, |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
91 |
Mac48Address root, |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
92 |
Mac48Address retransmitter, |
4893
d390c2dd2f14
Restructured rtable, queue size moved from protocol setter to attribute
Kirill Andreev <andreev@iitp.ru>
parents:
4885
diff
changeset
|
93 |
uint32_t interface, |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
94 |
Time lifetime, |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
95 |
uint32_t seqnum |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
96 |
); |
4900
0c34a34208f2
restructured precursors in rtable
Kirill Andreev <andreev@iitp.ru>
parents:
4894
diff
changeset
|
97 |
void AddPrecursor (Mac48Address destination, uint32_t precursorInterface, Mac48Address precursorAddress); |
4920
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
98 |
PrecursorList GetPrecursors (Mac48Address destination); |
4893
d390c2dd2f14
Restructured rtable, queue size moved from protocol setter to attribute
Kirill Andreev <andreev@iitp.ru>
parents:
4885
diff
changeset
|
99 |
void DeleteProactivePath (); |
4894
a6cf8696922a
HwmpProtocol: path error procedure reviewed, RequestRoute reviewed
Kirill Andreev <andreev@iitp.ru>
parents:
4893
diff
changeset
|
100 |
void DeleteProactivePath (Mac48Address root); |
4900
0c34a34208f2
restructured precursors in rtable
Kirill Andreev <andreev@iitp.ru>
parents:
4894
diff
changeset
|
101 |
void DeleteReactivePath (Mac48Address destination); |
4920
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
102 |
//\} |
5129 | 103 |
|
4920
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
104 |
///\name Lookup |
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
105 |
//\{ |
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
106 |
/// Lookup path to destination |
4894
a6cf8696922a
HwmpProtocol: path error procedure reviewed, RequestRoute reviewed
Kirill Andreev <andreev@iitp.ru>
parents:
4893
diff
changeset
|
107 |
LookupResult LookupReactive (Mac48Address destination); |
4920
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
108 |
/// Return all reactive paths, including expired |
4894
a6cf8696922a
HwmpProtocol: path error procedure reviewed, RequestRoute reviewed
Kirill Andreev <andreev@iitp.ru>
parents:
4893
diff
changeset
|
109 |
LookupResult LookupReactiveExpired (Mac48Address destination); |
4920
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
110 |
/// Find proactive path to tree root. Note that calling this method has side effect of deleting expired proactive path |
4894
a6cf8696922a
HwmpProtocol: path error procedure reviewed, RequestRoute reviewed
Kirill Andreev <andreev@iitp.ru>
parents:
4893
diff
changeset
|
111 |
LookupResult LookupProactive (); |
4920
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
112 |
/// Return all proactive paths, including expired |
4894
a6cf8696922a
HwmpProtocol: path error procedure reviewed, RequestRoute reviewed
Kirill Andreev <andreev@iitp.ru>
parents:
4893
diff
changeset
|
113 |
LookupResult LookupProactiveExpired (); |
4920
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
114 |
//\} |
5129 | 115 |
|
4920
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
116 |
/// When peer link with a given MAC-address fails - it returns list of unreachable destination addresses |
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
117 |
std::vector<IePerr::FailedDestination> GetUnreachableDestinations (Mac48Address peerAddress); |
5129 | 118 |
|
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
119 |
private: |
4920
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
120 |
/// Route found in reactive mode |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
121 |
struct ReactiveRoute |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
122 |
{ |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
123 |
Mac48Address retransmitter; |
4893
d390c2dd2f14
Restructured rtable, queue size moved from protocol setter to attribute
Kirill Andreev <andreev@iitp.ru>
parents:
4885
diff
changeset
|
124 |
uint32_t interface; |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
125 |
uint32_t metric; |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
126 |
Time whenExpire; |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
127 |
uint32_t seqnum; |
4900
0c34a34208f2
restructured precursors in rtable
Kirill Andreev <andreev@iitp.ru>
parents:
4894
diff
changeset
|
128 |
std::vector<std::pair<uint32_t, Mac48Address> > precursors; |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
129 |
}; |
4920
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
130 |
/// Route fond in proactive mode |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
131 |
struct ProactiveRoute |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
132 |
{ |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
133 |
Mac48Address root; |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
134 |
Mac48Address retransmitter; |
4893
d390c2dd2f14
Restructured rtable, queue size moved from protocol setter to attribute
Kirill Andreev <andreev@iitp.ru>
parents:
4885
diff
changeset
|
135 |
uint32_t interface; |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
136 |
uint32_t metric; |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
137 |
Time whenExpire; |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
138 |
uint32_t seqnum; |
4900
0c34a34208f2
restructured precursors in rtable
Kirill Andreev <andreev@iitp.ru>
parents:
4894
diff
changeset
|
139 |
std::vector<std::pair<uint32_t, Mac48Address> > precursors; |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
140 |
}; |
5129 | 141 |
|
4920
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
142 |
/// List of routes |
4837 | 143 |
std::map<Mac48Address, ReactiveRoute> m_routes; |
4920
fbd04c749aaa
HwmpRtable unit test + cleanup
Pavel Boyko <boyko@iitp.ru>
parents:
4901
diff
changeset
|
144 |
/// Path to proactive tree root MP |
4893
d390c2dd2f14
Restructured rtable, queue size moved from protocol setter to attribute
Kirill Andreev <andreev@iitp.ru>
parents:
4885
diff
changeset
|
145 |
ProactiveRoute m_root; |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4810
diff
changeset
|
146 |
}; |
4885
2761d3e01723
HWMP rtable and tag added back to wscripts without any changes
Kirill Andreev <andreev@iitp.ru>
parents:
4882
diff
changeset
|
147 |
} //namespace dot11s |
4793 | 148 |
} //namespace ns3 |
149 |
#endif |