LEFT | RIGHT |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2006 INRIA | 3 * Copyright (c) 2006 INRIA |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 SupportedRates::operator= (const SupportedRates& rates) | 49 SupportedRates::operator= (const SupportedRates& rates) |
50 { | 50 { |
51 this->m_nRates = rates.m_nRates; | 51 this->m_nRates = rates.m_nRates; |
52 memcpy (this->m_rates, rates.m_rates, MAX_SUPPORTED_RATES); | 52 memcpy (this->m_rates, rates.m_rates, MAX_SUPPORTED_RATES); |
53 //reset the back pointer to this object | 53 //reset the back pointer to this object |
54 this->extended.SetSupportedRates (this); | 54 this->extended.SetSupportedRates (this); |
55 return (*this); | 55 return (*this); |
56 } | 56 } |
57 | 57 |
58 void | 58 void |
59 SupportedRates::AddSupportedRate (uint32_t bs) | 59 SupportedRates::AddSupportedRate (uint64_t bs) |
60 { | 60 { |
61 NS_LOG_FUNCTION (this << bs); | 61 NS_LOG_FUNCTION (this << bs); |
62 NS_ASSERT_MSG (IsBssMembershipSelectorRate (bs) == false, "Invalid rate"); | 62 NS_ASSERT_MSG (IsBssMembershipSelectorRate (bs) == false, "Invalid rate"); |
63 NS_ASSERT (m_nRates < MAX_SUPPORTED_RATES); | 63 NS_ASSERT (m_nRates < MAX_SUPPORTED_RATES); |
64 if (bs == BSS_MEMBERSHIP_SELECTOR_HT_PHY) | 64 if (bs == BSS_MEMBERSHIP_SELECTOR_HT_PHY) |
65 { | 65 { |
66 // Encoding defined in Sec. 8.4.2.3, IEEE 802.11-2012 | 66 // Encoding defined in Sec. 8.4.2.3, IEEE 802.11-2012 |
67 m_rates[m_nRates] = (BSS_MEMBERSHIP_SELECTOR_HT_PHY | 0x80); | 67 m_rates[m_nRates] = (BSS_MEMBERSHIP_SELECTOR_HT_PHY | 0x80); |
68 m_nRates++; | 68 m_nRates++; |
69 NS_LOG_DEBUG ("add HT_PHY membership selector"); | 69 NS_LOG_DEBUG ("add HT_PHY membership selector"); |
(...skipping 13 matching lines...) Expand all Loading... |
83 NS_LOG_DEBUG ("add HE_PHY membership selector"); | 83 NS_LOG_DEBUG ("add HE_PHY membership selector"); |
84 } | 84 } |
85 else | 85 else |
86 { | 86 { |
87 if (IsSupportedRate (bs)) | 87 if (IsSupportedRate (bs)) |
88 { | 88 { |
89 return; | 89 return; |
90 } | 90 } |
91 m_rates[m_nRates] = static_cast<uint8_t>(bs / 500000); | 91 m_rates[m_nRates] = static_cast<uint8_t>(bs / 500000); |
92 m_nRates++; | 92 m_nRates++; |
93 NS_LOG_DEBUG ("add rate=" << bs << ", n rates=" << (uint32_t)m_nRates); | 93 NS_LOG_DEBUG ("add rate=" << bs << ", n rates=" << static_cast<uint16_t> (
m_nRates)); |
94 } | 94 } |
95 } | 95 } |
96 | 96 |
97 void | 97 void |
98 SupportedRates::SetBasicRate (uint32_t bs) | 98 SupportedRates::SetBasicRate (uint32_t bs) |
99 { | 99 { |
100 NS_LOG_FUNCTION (this << bs); | 100 NS_LOG_FUNCTION (this << bs); |
101 NS_ASSERT_MSG (IsBssMembershipSelectorRate (bs) == false, "Invalid rate"); | 101 NS_ASSERT_MSG (IsBssMembershipSelectorRate (bs) == false, "Invalid rate"); |
102 uint8_t rate = static_cast<uint8_t>(bs / 500000); | 102 uint8_t rate = static_cast<uint8_t>(bs / 500000); |
103 for (uint8_t i = 0; i < m_nRates; i++) | 103 for (uint8_t i = 0; i < m_nRates; i++) |
104 { | 104 { |
105 if ((rate | 0x80) == m_rates[i]) | 105 if ((rate | 0x80) == m_rates[i]) |
106 { | 106 { |
107 return; | 107 return; |
108 } | 108 } |
109 if (rate == m_rates[i]) | 109 if (rate == m_rates[i]) |
110 { | 110 { |
111 NS_LOG_DEBUG ("set basic rate=" << bs << ", n rates=" << (uint32_t)m_n
Rates); | 111 NS_LOG_DEBUG ("set basic rate=" << bs << ", n rates=" << static_cast<u
int16_t> (m_nRates)); |
112 m_rates[i] |= 0x80; | 112 m_rates[i] |= 0x80; |
113 return; | 113 return; |
114 } | 114 } |
115 } | 115 } |
116 AddSupportedRate (bs); | 116 AddSupportedRate (bs); |
117 SetBasicRate (bs); | 117 SetBasicRate (bs); |
118 } | 118 } |
119 | 119 |
120 void | 120 void |
121 SupportedRates::AddBssMembershipSelectorRate (uint32_t bs) | 121 SupportedRates::AddBssMembershipSelectorRate (uint32_t bs) |
(...skipping 25 matching lines...) Expand all Loading... |
147 { | 147 { |
148 if (rate == m_rates[i]) | 148 if (rate == m_rates[i]) |
149 { | 149 { |
150 return true; | 150 return true; |
151 } | 151 } |
152 } | 152 } |
153 return false; | 153 return false; |
154 } | 154 } |
155 | 155 |
156 bool | 156 bool |
157 SupportedRates::IsSupportedRate (uint32_t bs) const | 157 SupportedRates::IsSupportedRate (uint64_t bs) const |
158 { | 158 { |
159 NS_LOG_FUNCTION (this << bs); | 159 NS_LOG_FUNCTION (this << bs); |
160 uint8_t rate = static_cast<uint8_t>(bs / 500000); | 160 uint8_t rate = static_cast<uint8_t>(bs / 500000); |
161 for (uint8_t i = 0; i < m_nRates; i++) | 161 for (uint8_t i = 0; i < m_nRates; i++) |
162 { | 162 { |
163 if (rate == m_rates[i] | 163 if (rate == m_rates[i] |
164 || (rate | 0x80) == m_rates[i]) | 164 || (rate | 0x80) == m_rates[i]) |
165 { | 165 { |
166 return true; | 166 return true; |
167 } | 167 } |
168 } | 168 } |
169 return false; | 169 return false; |
170 } | 170 } |
171 | 171 |
172 bool | 172 bool |
173 SupportedRates::IsBssMembershipSelectorRate (uint32_t bs) const | 173 SupportedRates::IsBssMembershipSelectorRate (uint64_t bs) const |
174 { | 174 { |
175 NS_LOG_FUNCTION (this << bs); | 175 NS_LOG_FUNCTION (this << bs); |
176 if ((bs & 0x7f) == BSS_MEMBERSHIP_SELECTOR_HT_PHY | 176 if ((bs & 0x7f) == BSS_MEMBERSHIP_SELECTOR_HT_PHY |
177 || (bs & 0x7f) == BSS_MEMBERSHIP_SELECTOR_VHT_PHY | 177 || (bs & 0x7f) == BSS_MEMBERSHIP_SELECTOR_VHT_PHY |
178 || (bs & 0x7f) == BSS_MEMBERSHIP_SELECTOR_HE_PHY) | 178 || (bs & 0x7f) == BSS_MEMBERSHIP_SELECTOR_HE_PHY) |
179 { | 179 { |
180 return true; | 180 return true; |
181 } | 181 } |
182 return false; | 182 return false; |
183 } | 183 } |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 if (i < rates.GetNRates () - 1) | 340 if (i < rates.GetNRates () - 1) |
341 { | 341 { |
342 os << " "; | 342 os << " "; |
343 } | 343 } |
344 } | 344 } |
345 os << "]"; | 345 os << "]"; |
346 return os; | 346 return os; |
347 } | 347 } |
348 | 348 |
349 } //namespace ns3 | 349 } //namespace ns3 |
LEFT | RIGHT |