author | Pavel Boyko <boyko@iitp.ru> |
Mon, 04 May 2009 18:08:49 +0400 | |
changeset 5004 | 29928e8d1a1c |
parent 4965 | e6e44c9415e7 |
child 5018 | aecd3eedd65f |
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:
4811
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 |
* |
|
4811
080b8f23fa4a
Added license information to some files.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
18 |
* Author: Kirill Andreev <andreev@iitp.ru> |
4793 | 19 |
*/ |
20 |
||
21 |
||
4877
f08902c42733
Added a method to find peer link, code cleanup
Kirill Andreev <andreev@iitp.ru>
parents:
4876
diff
changeset
|
22 |
#include "ie-dot11s-preq.h" |
4793 | 23 |
#include "ns3/address-utils.h" |
4841 | 24 |
#include "ns3/node.h" |
4793 | 25 |
#include "ns3/assert.h" |
4904 | 26 |
#include "ns3/test.h" |
27 |
#include "ns3/packet.h" |
|
4813
e4e2c44d27cd
All mesh related filed moved to devices/mesh. Let the refactoring begins!
Pavel Boyko <boyko@iitp.ru>
parents:
4812
diff
changeset
|
28 |
|
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
29 |
namespace ns3 { |
4872 | 30 |
namespace dot11s { |
4793 | 31 |
/************************* |
32 |
* DestinationAddressUnit |
|
33 |
************************/ |
|
4955
b83a62acbcf2
Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents:
4945
diff
changeset
|
34 |
DestinationAddressUnit::DestinationAddressUnit (): |
b83a62acbcf2
Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents:
4945
diff
changeset
|
35 |
m_do (false), |
b83a62acbcf2
Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents:
4945
diff
changeset
|
36 |
m_rf (false), |
b83a62acbcf2
Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents:
4945
diff
changeset
|
37 |
m_usn (false), |
b83a62acbcf2
Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents:
4945
diff
changeset
|
38 |
m_destinationAddress (Mac48Address ()), |
b83a62acbcf2
Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents:
4945
diff
changeset
|
39 |
m_destSeqNumber (0) |
4793 | 40 |
{ |
41 |
} |
|
42 |
void |
|
4955
b83a62acbcf2
Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents:
4945
diff
changeset
|
43 |
DestinationAddressUnit::SetFlags (bool doFlag, bool rfFlag, bool usnFlag) |
4793 | 44 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
45 |
m_do = doFlag; |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
46 |
m_rf = rfFlag; |
4955
b83a62acbcf2
Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents:
4945
diff
changeset
|
47 |
m_usn = usnFlag; |
4793 | 48 |
} |
49 |
||
50 |
void |
|
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
51 |
DestinationAddressUnit::SetDestSeqNumber (uint32_t dest_seq_number) |
4793 | 52 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
53 |
m_destSeqNumber = dest_seq_number; |
4955
b83a62acbcf2
Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents:
4945
diff
changeset
|
54 |
if(m_destSeqNumber != 0) |
b83a62acbcf2
Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents:
4945
diff
changeset
|
55 |
m_usn = true; |
4793 | 56 |
} |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
57 |
void |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
58 |
DestinationAddressUnit::SetDestinationAddress (Mac48Address dest_address) |
4793 | 59 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
60 |
m_destinationAddress = dest_address; |
4793 | 61 |
} |
62 |
bool |
|
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
63 |
DestinationAddressUnit::IsDo () |
4793 | 64 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
65 |
return m_do; |
4793 | 66 |
} |
67 |
||
68 |
bool |
|
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
69 |
DestinationAddressUnit::IsRf () |
4793 | 70 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
71 |
return m_rf; |
4793 | 72 |
} |
4955
b83a62acbcf2
Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents:
4945
diff
changeset
|
73 |
bool |
b83a62acbcf2
Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents:
4945
diff
changeset
|
74 |
DestinationAddressUnit::IsUsn () |
b83a62acbcf2
Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents:
4945
diff
changeset
|
75 |
{ |
b83a62acbcf2
Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents:
4945
diff
changeset
|
76 |
return m_usn; |
b83a62acbcf2
Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents:
4945
diff
changeset
|
77 |
} |
4793 | 78 |
uint32_t |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
79 |
DestinationAddressUnit::GetDestSeqNumber () const |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
80 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
81 |
return m_destSeqNumber; |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
82 |
} |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
83 |
Mac48Address |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
84 |
DestinationAddressUnit::GetDestinationAddress () const |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
85 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
86 |
return m_destinationAddress; |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
87 |
} |
4793 | 88 |
/******************************** |
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
89 |
* IePreq |
4793 | 90 |
*******************************/ |
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
91 |
IePreq::~IePreq () |
4793 | 92 |
{ |
93 |
} |
|
94 |
||
95 |
TypeId |
|
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
96 |
IePreq::GetTypeId () |
4793 | 97 |
{ |
4904 | 98 |
static TypeId tid = TypeId ("ns3::dot11s::IePreq") |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
99 |
.SetParent<Object> (); |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
100 |
return tid; |
4793 | 101 |
} |
102 |
TypeId |
|
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
103 |
IePreq::GetInstanceTypeId () const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
104 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
105 |
return GetTypeId (); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
106 |
} |
4793 | 107 |
|
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
108 |
IePreq::IePreq (): |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
109 |
m_maxSize (32), |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
110 |
m_flags (0), |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
111 |
m_hopCount (0), |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
112 |
m_ttl (0), |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
113 |
m_preqId (0), |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
114 |
m_originatorAddress (Mac48Address::GetBroadcast()), |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
115 |
m_originatorSeqNumber (0), |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
116 |
m_lifetime (0), |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
117 |
m_metric (0), |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
118 |
m_destCount (0) |
4793 | 119 |
{ |
120 |
} |
|
121 |
void |
|
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
122 |
IePreq::SetUnicastPreq () |
4793 | 123 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
124 |
m_flags |= 1<<1; |
4793 | 125 |
} |
126 |
||
127 |
void |
|
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
128 |
IePreq::SetNeedNotPrep () |
4793 | 129 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
130 |
m_flags |= 1<<2; |
4793 | 131 |
} |
132 |
//void |
|
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
133 |
//IePreq::SetFlags (uint8_t flags) |
4793 | 134 |
//{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
135 |
// m_flags = flags; |
4793 | 136 |
//} |
137 |
void |
|
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
138 |
IePreq::SetHopcount (uint8_t hopcount) |
4793 | 139 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
140 |
m_hopCount = hopcount; |
4793 | 141 |
} |
142 |
void |
|
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
143 |
IePreq::SetTTL (uint8_t ttl) |
4793 | 144 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
145 |
m_ttl = ttl; |
4793 | 146 |
} |
147 |
void |
|
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
148 |
IePreq::SetPreqID (uint32_t preq_id) |
4793 | 149 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
150 |
m_preqId = preq_id; |
4793 | 151 |
} |
152 |
void |
|
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
153 |
IePreq::SetMetric (uint32_t metric) |
4793 | 154 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
155 |
m_metric = metric; |
4793 | 156 |
} |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
157 |
void |
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
158 |
IePreq::SetOriginatorAddress (Mac48Address originator_address) |
4793 | 159 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
160 |
m_originatorAddress = originator_address; |
4793 | 161 |
} |
162 |
void |
|
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
163 |
IePreq::SetOriginatorSeqNumber (uint32_t originator_seq_number) |
4793 | 164 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
165 |
m_originatorSeqNumber = originator_seq_number; |
4793 | 166 |
} |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
167 |
void |
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
168 |
IePreq::SetLifetime (uint32_t lifetime) |
4793 | 169 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
170 |
m_lifetime = lifetime; |
4793 | 171 |
} |
172 |
void |
|
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
173 |
IePreq::SetDestCount (uint8_t dest_count) |
4793 | 174 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
175 |
m_destCount = dest_count; |
4793 | 176 |
} |
177 |
bool |
|
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
178 |
IePreq::IsUnicastPreq () const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
179 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
180 |
return (m_flags & (1<<1)); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
181 |
} |
4793 | 182 |
bool |
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
183 |
IePreq::IsNeedNotPrep () const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
184 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
185 |
return (m_flags & (1<<2)); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
186 |
} |
4793 | 187 |
uint8_t |
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
188 |
IePreq::GetHopCount () const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
189 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
190 |
return m_hopCount; |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
191 |
} |
4793 | 192 |
uint8_t |
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
193 |
IePreq::GetTtl () const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
194 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
195 |
return m_ttl; |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
196 |
} |
4793 | 197 |
uint32_t |
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
198 |
IePreq::GetPreqID () const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
199 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
200 |
return m_preqId; |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
201 |
} |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
202 |
uint32_t |
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
203 |
IePreq::GetMetric () const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
204 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
205 |
return m_metric; |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
206 |
} |
4793 | 207 |
Mac48Address |
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
208 |
IePreq::GetOriginatorAddress () const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
209 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
210 |
return m_originatorAddress; |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
211 |
} |
4793 | 212 |
uint32_t |
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
213 |
IePreq::GetOriginatorSeqNumber () const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
214 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
215 |
return m_originatorSeqNumber; |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
216 |
} |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
217 |
uint32_t |
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
218 |
IePreq::GetLifetime () const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
219 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
220 |
return m_lifetime; |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
221 |
} |
4793 | 222 |
|
223 |
uint8_t |
|
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
224 |
IePreq::GetDestCount () const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
225 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
226 |
return m_destCount; |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
227 |
} |
4793 | 228 |
void |
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
229 |
IePreq::DecrementTtl () |
4793 | 230 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
231 |
m_ttl --; |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
232 |
m_hopCount ++; |
4793 | 233 |
} |
234 |
void |
|
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
235 |
IePreq::IncrementMetric (uint32_t metric) |
4793 | 236 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
237 |
m_metric +=metric; |
4793 | 238 |
} |
239 |
void |
|
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
240 |
IePreq::SerializeInformation (Buffer::Iterator i) const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
241 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
242 |
i.WriteU8 (m_flags); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
243 |
i.WriteU8 (m_hopCount); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
244 |
i.WriteU8 (m_ttl); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
245 |
i.WriteHtonU32 (m_preqId); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
246 |
WriteTo (i, m_originatorAddress); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
247 |
i.WriteHtonU32 (m_originatorSeqNumber); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
248 |
i.WriteHtonU32 (m_lifetime); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
249 |
i.WriteHtonU32 (m_metric); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
250 |
i.WriteU8 (m_destCount); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
251 |
int written = 0; |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
252 |
for (std::vector<Ptr<DestinationAddressUnit> >::const_iterator j = m_destinations.begin (); j != m_destinations.end(); j++) |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
253 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
254 |
uint8_t flags = 0; |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
255 |
if ((*j)->IsDo ()) |
4955
b83a62acbcf2
Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents:
4945
diff
changeset
|
256 |
flags += 128; |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
257 |
if ((*j)->IsRf ()) |
4955
b83a62acbcf2
Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents:
4945
diff
changeset
|
258 |
flags += 64; |
b83a62acbcf2
Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents:
4945
diff
changeset
|
259 |
if((*j)->IsUsn ()) |
b83a62acbcf2
Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents:
4945
diff
changeset
|
260 |
flags += 32; |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
261 |
i.WriteU8 (flags); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
262 |
WriteTo (i, (*j)->GetDestinationAddress()); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
263 |
i.WriteHtonU32 ((*j)->GetDestSeqNumber ()); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
264 |
written++; |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
265 |
if (written > m_maxSize) |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
266 |
break; |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
267 |
} |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
268 |
} |
4838
ce31277d72ad
Finished restructuring information elements
Kirill Andreev <andreev@iitp.ru>
parents:
4835
diff
changeset
|
269 |
uint8_t |
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
270 |
IePreq::DeserializeInformation (Buffer::Iterator start, uint8_t length) |
4793 | 271 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
272 |
Buffer::Iterator i = start; |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
273 |
m_flags = i.ReadU8 (); |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
274 |
m_hopCount = i.ReadU8 (); |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
275 |
m_ttl = i.ReadU8 (); |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
276 |
m_preqId = i.ReadNtohU32 (); |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
277 |
ReadFrom (i, m_originatorAddress); |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
278 |
m_originatorSeqNumber = i.ReadNtohU32 (); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
279 |
m_lifetime = i.ReadNtohU32 (); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
280 |
m_metric = i.ReadNtohU32 (); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
281 |
m_destCount = i.ReadU8 (); |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
282 |
for (int j = 0; j < m_destCount; j++ ) |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
283 |
{ |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
284 |
Ptr<DestinationAddressUnit> new_element = Create<DestinationAddressUnit> (); |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
285 |
bool doFlag = false; |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
286 |
bool rfFlag = false; |
4955
b83a62acbcf2
Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents:
4945
diff
changeset
|
287 |
bool usnFlag = false; |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
288 |
uint8_t flags = i.ReadU8 (); |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
289 |
if (flags >= 128) |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
290 |
{ |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
291 |
doFlag = true; |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
292 |
flags -=128; |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
293 |
} |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
294 |
if (flags >=64) |
4955
b83a62acbcf2
Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents:
4945
diff
changeset
|
295 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
296 |
rfFlag = true; |
4955
b83a62acbcf2
Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents:
4945
diff
changeset
|
297 |
flags -= 64; |
b83a62acbcf2
Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents:
4945
diff
changeset
|
298 |
} |
b83a62acbcf2
Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents:
4945
diff
changeset
|
299 |
if (flags >= 32) |
b83a62acbcf2
Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents:
4945
diff
changeset
|
300 |
usnFlag = true; |
b83a62acbcf2
Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents:
4945
diff
changeset
|
301 |
new_element->SetFlags (doFlag, rfFlag, usnFlag); |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
302 |
Mac48Address addr; |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
303 |
ReadFrom (i,addr); |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
304 |
new_element->SetDestinationAddress (addr); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
305 |
new_element->SetDestSeqNumber (i.ReadNtohU32()); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
306 |
m_destinations.push_back (new_element); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
307 |
NS_ASSERT (28+j*11 < length); |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
308 |
} |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
309 |
return i.GetDistanceFrom (start); |
4793 | 310 |
} |
4838
ce31277d72ad
Finished restructuring information elements
Kirill Andreev <andreev@iitp.ru>
parents:
4835
diff
changeset
|
311 |
uint8_t |
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
312 |
IePreq::GetInformationSize () const |
4829
51b7bcb3fab3
Restructured PREQ and PREP
Kirill Andreev <andreev@iitp.ru>
parents:
4824
diff
changeset
|
313 |
{ |
4838
ce31277d72ad
Finished restructuring information elements
Kirill Andreev <andreev@iitp.ru>
parents:
4835
diff
changeset
|
314 |
uint8_t retval = |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
315 |
1 //Flags |
4829
51b7bcb3fab3
Restructured PREQ and PREP
Kirill Andreev <andreev@iitp.ru>
parents:
4824
diff
changeset
|
316 |
+1 //Hopcount |
51b7bcb3fab3
Restructured PREQ and PREP
Kirill Andreev <andreev@iitp.ru>
parents:
4824
diff
changeset
|
317 |
+1 //TTL |
51b7bcb3fab3
Restructured PREQ and PREP
Kirill Andreev <andreev@iitp.ru>
parents:
4824
diff
changeset
|
318 |
+4 //PREQ ID |
51b7bcb3fab3
Restructured PREQ and PREP
Kirill Andreev <andreev@iitp.ru>
parents:
4824
diff
changeset
|
319 |
+6 //Source address (originator) |
51b7bcb3fab3
Restructured PREQ and PREP
Kirill Andreev <andreev@iitp.ru>
parents:
4824
diff
changeset
|
320 |
+4 //Originator seqno |
51b7bcb3fab3
Restructured PREQ and PREP
Kirill Andreev <andreev@iitp.ru>
parents:
4824
diff
changeset
|
321 |
+4 //Lifetime |
51b7bcb3fab3
Restructured PREQ and PREP
Kirill Andreev <andreev@iitp.ru>
parents:
4824
diff
changeset
|
322 |
+4 //metric |
51b7bcb3fab3
Restructured PREQ and PREP
Kirill Andreev <andreev@iitp.ru>
parents:
4824
diff
changeset
|
323 |
+1; //destination count |
51b7bcb3fab3
Restructured PREQ and PREP
Kirill Andreev <andreev@iitp.ru>
parents:
4824
diff
changeset
|
324 |
if (m_destCount > m_maxSize) |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
325 |
retval += (m_maxSize*11); |
4829
51b7bcb3fab3
Restructured PREQ and PREP
Kirill Andreev <andreev@iitp.ru>
parents:
4824
diff
changeset
|
326 |
else |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
327 |
retval += (m_destCount*11); |
4829
51b7bcb3fab3
Restructured PREQ and PREP
Kirill Andreev <andreev@iitp.ru>
parents:
4824
diff
changeset
|
328 |
return retval; |
51b7bcb3fab3
Restructured PREQ and PREP
Kirill Andreev <andreev@iitp.ru>
parents:
4824
diff
changeset
|
329 |
} |
51b7bcb3fab3
Restructured PREQ and PREP
Kirill Andreev <andreev@iitp.ru>
parents:
4824
diff
changeset
|
330 |
void |
4896
e579c19f0dee
Preq propagation ported:)
Kirill Andreev <andreev@iitp.ru>
parents:
4877
diff
changeset
|
331 |
IePreq::PrintInformation (std::ostream &os) const |
4829
51b7bcb3fab3
Restructured PREQ and PREP
Kirill Andreev <andreev@iitp.ru>
parents:
4824
diff
changeset
|
332 |
{ |
4904 | 333 |
os << " originator address = " << m_originatorAddress << "\n"; |
334 |
os << " TTL = " << (uint16_t)m_ttl << "\n"; |
|
335 |
os << " hop count = " << (uint16_t)m_hopCount << "\n"; |
|
336 |
os << " metric = " << m_metric << "\n"; |
|
337 |
os << " seqno = " << m_originatorSeqNumber << "\n"; |
|
338 |
os << " lifetime = " << m_lifetime << "\n"; |
|
4944
779b641cff5a
Unicast chain instead of broadcast data frame added. Metric
Kirill Andreev <andreev@iitp.ru>
parents:
4904
diff
changeset
|
339 |
os << " preq ID = " <<m_preqId << "\n"; |
4904 | 340 |
os << " Destinations are:\n"; |
4896
e579c19f0dee
Preq propagation ported:)
Kirill Andreev <andreev@iitp.ru>
parents:
4877
diff
changeset
|
341 |
for (int j = 0; j < m_destCount; j++ ) |
4904 | 342 |
os << " " << m_destinations[j]->GetDestinationAddress () << "\n"; |
4829
51b7bcb3fab3
Restructured PREQ and PREP
Kirill Andreev <andreev@iitp.ru>
parents:
4824
diff
changeset
|
343 |
} |
4793 | 344 |
std::vector<Ptr<DestinationAddressUnit> > |
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
345 |
IePreq::GetDestinationList () |
4793 | 346 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
347 |
return m_destinations; |
4793 | 348 |
} |
349 |
void |
|
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
350 |
IePreq::AddDestinationAddressElement ( |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
351 |
bool doFlag, bool rfFlag, |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
352 |
Mac48Address dest_address, |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
353 |
uint32_t dest_seq_number |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
354 |
) |
4793 | 355 |
{ |
4945 | 356 |
for (std::vector<Ptr<DestinationAddressUnit> >::const_iterator i = m_destinations.begin (); i != m_destinations.end(); i++ ) |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
357 |
if ((*i)->GetDestinationAddress () == dest_address) |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
358 |
return; |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
359 |
Ptr<DestinationAddressUnit>new_element = Create<DestinationAddressUnit> (); |
4955
b83a62acbcf2
Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents:
4945
diff
changeset
|
360 |
new_element->SetFlags (doFlag, rfFlag, false); |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
361 |
new_element->SetDestinationAddress (dest_address); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
362 |
new_element->SetDestSeqNumber (dest_seq_number); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
363 |
m_destinations.push_back (new_element); |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
364 |
m_destCount++; |
4793 | 365 |
} |
366 |
void |
|
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
367 |
IePreq::DelDestinationAddressElement (Mac48Address dest_address) |
4793 | 368 |
{ |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
369 |
for (std::vector<Ptr<DestinationAddressUnit> >::iterator i = m_destinations.begin (); i != m_destinations.end(); i++) |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
370 |
if ((*i)->GetDestinationAddress () == dest_address) |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
371 |
{ |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
372 |
m_destinations.erase (i); |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
373 |
m_destCount--; |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
374 |
break; |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
375 |
} |
4793 | 376 |
} |
377 |
void |
|
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
378 |
IePreq::ClearDestinationAddressElement () |
4793 | 379 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
380 |
int i; |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
381 |
for (std::vector<Ptr<DestinationAddressUnit> >::iterator j = m_destinations.begin (); j != m_destinations.end(); j++) |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
382 |
(*j) = 0; |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
383 |
for (i = 0; i < m_destCount; i ++) |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
384 |
m_destinations.pop_back (); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
385 |
m_destinations.clear (); |
4965
e6e44c9415e7
Preq queue bugfix. deleted m_myPreq
Kirill Andreev <andreev@iitp.ru>
parents:
4955
diff
changeset
|
386 |
} |
4904 | 387 |
bool operator== (const DestinationAddressUnit & a, const DestinationAddressUnit & b) |
388 |
{ |
|
389 |
return (a.m_do == b.m_do |
|
390 |
&& a.m_rf == b.m_rf |
|
4955
b83a62acbcf2
Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents:
4945
diff
changeset
|
391 |
&& a.m_usn == b.m_usn |
4904 | 392 |
&& a.m_destinationAddress == b.m_destinationAddress |
393 |
&& a.m_destSeqNumber == b.m_destSeqNumber |
|
394 |
); |
|
395 |
} |
|
396 |
bool operator== (const IePreq & a, const IePreq & b) |
|
397 |
{ |
|
398 |
bool ok = ( a.m_flags == b.m_flags |
|
399 |
&& a.m_hopCount == b.m_hopCount |
|
400 |
&& a.m_ttl == b.m_ttl |
|
401 |
&& a.m_preqId == b.m_preqId |
|
402 |
&& a.m_originatorAddress == b.m_originatorAddress |
|
403 |
&& a.m_originatorSeqNumber == b.m_originatorSeqNumber |
|
404 |
&& a.m_lifetime == b.m_lifetime |
|
405 |
&& a.m_metric == b.m_metric |
|
406 |
&& a.m_destCount == b.m_destCount |
|
407 |
); |
|
408 |
||
409 |
if (! ok) |
|
410 |
return false; |
|
411 |
||
412 |
if (a.m_destinations.size() != b.m_destinations.size()) |
|
413 |
return false; |
|
414 |
||
415 |
for (size_t i = 0; i < a.m_destinations.size(); ++i) |
|
416 |
if (!( *(PeekPointer (a.m_destinations[i])) == |
|
417 |
*(PeekPointer (b.m_destinations[i])) |
|
418 |
) |
|
419 |
) |
|
420 |
return false; |
|
421 |
||
422 |
return true; |
|
423 |
} |
|
4965
e6e44c9415e7
Preq queue bugfix. deleted m_myPreq
Kirill Andreev <andreev@iitp.ru>
parents:
4955
diff
changeset
|
424 |
bool |
e6e44c9415e7
Preq queue bugfix. deleted m_myPreq
Kirill Andreev <andreev@iitp.ru>
parents:
4955
diff
changeset
|
425 |
IePreq::MayAddAddress (Mac48Address originator) |
e6e44c9415e7
Preq queue bugfix. deleted m_myPreq
Kirill Andreev <andreev@iitp.ru>
parents:
4955
diff
changeset
|
426 |
{ |
e6e44c9415e7
Preq queue bugfix. deleted m_myPreq
Kirill Andreev <andreev@iitp.ru>
parents:
4955
diff
changeset
|
427 |
if (m_originatorAddress != originator) |
e6e44c9415e7
Preq queue bugfix. deleted m_myPreq
Kirill Andreev <andreev@iitp.ru>
parents:
4955
diff
changeset
|
428 |
return false; |
e6e44c9415e7
Preq queue bugfix. deleted m_myPreq
Kirill Andreev <andreev@iitp.ru>
parents:
4955
diff
changeset
|
429 |
if(m_destinations[0]->GetDestinationAddress () == Mac48Address::GetBroadcast ()) |
e6e44c9415e7
Preq queue bugfix. deleted m_myPreq
Kirill Andreev <andreev@iitp.ru>
parents:
4955
diff
changeset
|
430 |
return false; |
e6e44c9415e7
Preq queue bugfix. deleted m_myPreq
Kirill Andreev <andreev@iitp.ru>
parents:
4955
diff
changeset
|
431 |
return true; |
e6e44c9415e7
Preq queue bugfix. deleted m_myPreq
Kirill Andreev <andreev@iitp.ru>
parents:
4955
diff
changeset
|
432 |
} |
4904 | 433 |
#ifdef RUN_SELF_TESTS |
434 |
||
435 |
/// Built-in self test for IePreq |
|
5004 | 436 |
struct IePreqBist : public IeTest |
4904 | 437 |
{ |
5004 | 438 |
IePreqBist () : IeTest ("Mesh/802.11s/IE/PREQ") {} |
4904 | 439 |
virtual bool RunTests(); |
440 |
}; |
|
441 |
||
442 |
/// Test instance |
|
443 |
static IePreqBist g_IePreqBist; |
|
444 |
||
445 |
bool IePreqBist::RunTests () |
|
446 |
{ |
|
447 |
bool result(true); |
|
448 |
||
449 |
// create test information element |
|
450 |
IePreq a; |
|
451 |
a.SetHopcount (0); |
|
452 |
a.SetTTL (1); |
|
453 |
a.SetPreqID (2); |
|
454 |
a.SetOriginatorAddress ( Mac48Address("11:22:33:44:55:66") ); |
|
455 |
a.SetOriginatorSeqNumber (3); |
|
456 |
a.SetLifetime (4); |
|
457 |
a.AddDestinationAddressElement (false, false, Mac48Address("11:11:11:11:11:11"), 5); |
|
458 |
a.AddDestinationAddressElement (false, false, Mac48Address("22:22:22:22:22:22"), 6); |
|
5004 | 459 |
|
460 |
result = result && TestRoundtripSerialization (a); |
|
4904 | 461 |
return result; |
462 |
} |
|
463 |
||
464 |
#endif // RUN_SELF_TESTS |
|
4872 | 465 |
|
466 |
} // namespace dot11s |
|
467 |
} //namespace ns3 |
|
4793 | 468 |