A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
edca-parameter-set.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 Sébastien Deronne
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Sébastien Deronne <sebastien.deronne@gmail.com>
7 */
8
10
11#include <cmath>
12
13namespace ns3
14{
15
17 : m_qosInfo(0),
18 m_reserved(0),
19 m_acBE(0),
20 m_acBK(0),
21 m_acVI(0),
22 m_acVO(0)
23{
24}
25
31
32void
34{
35 m_qosInfo = qosInfo;
36}
37
38void
40{
41 m_acBE |= (aifsn & 0x0f);
42}
43
44void
46{
47 m_acBE |= (aci & 0x03) << 5;
48}
49
50void
52{
53 auto ECWmin = static_cast<uint8_t>(log2(cwMin + 1));
54 m_acBE |= (ECWmin & 0x0f) << 8;
55}
56
57void
59{
60 auto ECWmax = static_cast<uint8_t>(log2(cwMax + 1));
61 m_acBE |= (ECWmax & 0x0f) << 12;
62}
63
64void
66{
67 m_acBE |= txop << 16;
68}
69
70void
72{
73 m_acBK |= (aifsn & 0x0f);
74}
75
76void
78{
79 m_acBK |= (aci & 0x03) << 5;
80}
81
82void
84{
85 auto ECWmin = static_cast<uint8_t>(log2(cwMin + 1));
86 m_acBK |= (ECWmin & 0x0f) << 8;
87}
88
89void
91{
92 auto ECWmax = static_cast<uint8_t>(log2(cwMax + 1));
93 m_acBK |= (ECWmax & 0x0f) << 12;
94}
95
96void
98{
99 m_acBK |= txop << 16;
100}
101
102void
104{
105 m_acVI |= (aifsn & 0x0f);
106}
107
108void
110{
111 m_acVI |= (aci & 0x03) << 5;
112}
113
114void
116{
117 auto ECWmin = static_cast<uint8_t>(log2(cwMin + 1));
118 m_acVI |= (ECWmin & 0x0f) << 8;
119}
120
121void
123{
124 auto ECWmax = static_cast<uint8_t>(log2(cwMax + 1));
125 m_acVI |= (ECWmax & 0x0f) << 12;
126}
127
128void
130{
131 m_acVI |= txop << 16;
132}
133
134void
136{
137 m_acVO |= (aifsn & 0x0f);
138}
139
140void
142{
143 m_acVO |= (aci & 0x03) << 5;
144}
145
146void
148{
149 auto ECWmin = static_cast<uint8_t>(log2(cwMin + 1));
150 m_acVO |= (ECWmin & 0x0f) << 8;
151}
152
153void
155{
156 auto ECWmax = static_cast<uint8_t>(log2(cwMax + 1));
157 m_acVO |= (ECWmax & 0x0f) << 12;
158}
159
160void
162{
163 m_acVO |= txop << 16;
164}
165
166uint8_t
168{
169 return m_qosInfo;
170}
171
172uint8_t
174{
175 return (m_acBE & 0x0f);
176}
177
180{
181 uint8_t ECWmin = ((m_acBE >> 8) & 0x0f);
182 return static_cast<uint32_t>(exp2(ECWmin) - 1);
183}
184
187{
188 uint8_t ECWmax = ((m_acBE >> 12) & 0x0f);
189 return static_cast<uint32_t>(exp2(ECWmax) - 1);
190}
191
192uint16_t
194{
195 return (m_acBE >> 16);
196}
197
198uint8_t
200{
201 return (m_acBK & 0x0f);
202}
203
206{
207 uint8_t ECWmin = ((m_acBK >> 8) & 0x0f);
208 return static_cast<uint32_t>(exp2(ECWmin) - 1);
209}
210
213{
214 uint8_t ECWmax = ((m_acBK >> 12) & 0x0f);
215 return static_cast<uint32_t>(exp2(ECWmax) - 1);
216}
217
218uint16_t
220{
221 return (m_acBK >> 16);
222}
223
224uint8_t
226{
227 return (m_acVI & 0x0f);
228}
229
232{
233 uint8_t ECWmin = ((m_acVI >> 8) & 0x0f);
234 return static_cast<uint32_t>(exp2(ECWmin) - 1);
235}
236
239{
240 uint8_t ECWmax = ((m_acVI >> 12) & 0x0f);
241 return static_cast<uint32_t>(exp2(ECWmax) - 1);
242}
243
244uint16_t
246{
247 return (m_acVI >> 16);
248}
249
250uint8_t
252{
253 return (m_acVO & 0x0f);
254}
255
258{
259 uint8_t ECWmin = ((m_acVO >> 8) & 0x0f);
260 return static_cast<uint32_t>(exp2(ECWmin) - 1);
261}
262
265{
266 uint8_t ECWmax = ((m_acVO >> 12) & 0x0f);
267 return static_cast<uint32_t>(exp2(ECWmax) - 1);
268}
269
270uint16_t
272{
273 return (m_acVO >> 16);
274}
275
276uint16_t
278{
279 return 18;
280}
281
282void
284{
285 start.WriteU8(GetQosInfo());
286 start.WriteU8(m_reserved);
287 start.WriteU32(m_acBE);
288 start.WriteU32(m_acBK);
289 start.WriteU32(m_acVI);
290 start.WriteU32(m_acVO);
291}
292
293uint16_t
295{
296 Buffer::Iterator i = start;
297 m_qosInfo = i.ReadU8();
298 m_reserved = i.ReadU8();
299 m_acBE = i.ReadU32();
300 m_acBK = i.ReadU32();
301 m_acVI = i.ReadU32();
302 m_acVO = i.ReadU32();
303 return length;
304}
305
306} // namespace ns3
iterator in a Buffer instance
Definition buffer.h:89
uint32_t ReadU32()
Definition buffer.cc:955
void SetViTxopLimit(uint16_t txop)
Set the AC_VI TXOP Limit field in the EdcaParameterSet information element.
void SetViAifsn(uint8_t aifsn)
Set the AC_VI AIFSN field in the EdcaParameterSet information element.
uint8_t GetBeAifsn() const
Return the AC_BE AIFSN field in the EdcaParameterSet information element.
uint16_t GetViTxopLimit() const
Return the AC_VI TXOP Limit field in the EdcaParameterSet information element.
void SerializeInformationField(Buffer::Iterator start) const override
Serialize information (i.e., the body of the IE, not including the Element ID and length octets)
uint16_t GetBkTxopLimit() const
Return the AC_BK TXOP Limit field in the EdcaParameterSet information element.
uint16_t GetVoTxopLimit() const
Return the AC_VO TXOP Limit field in the EdcaParameterSet information element.
void SetVoAci(uint8_t aci)
Set the AC_VO ACI field in the EdcaParameterSet information element.
uint8_t GetViAifsn() const
Return the AC_VI AIFSN field in the EdcaParameterSet information element.
uint16_t GetBeTxopLimit() const
Return the AC_BE TXOP Limit field in the EdcaParameterSet information element.
uint32_t GetBeCWmax() const
Return the AC_BE CWmax field in the EdcaParameterSet information element.
uint32_t GetBeCWmin() const
Return the AC_BE CWmin field in the EdcaParameterSet information element.
uint32_t GetVoCWmax() const
Return the AC_VO CWmax field in the EdcaParameterSet information element.
void SetVoCWmax(uint32_t cwMax)
Set the AC_VO CWmax field in the EdcaParameterSet information element.
void SetViCWmin(uint32_t cwMin)
Set the AC_VI CWmin field in the EdcaParameterSet information element.
void SetVoTxopLimit(uint16_t txop)
Set the AC_VO TXOP Limit field in the EdcaParameterSet information element.
void SetVoAifsn(uint8_t aifsn)
Set the AC_VO AIFSN field in the EdcaParameterSet information element.
uint8_t GetQosInfo() const
Return the QoS Info field in the EdcaParameterSet information element.
uint8_t GetVoAifsn() const
Return the AC_VO AIFSN field in the EdcaParameterSet information element.
void SetQosInfo(uint8_t qosInfo)
Set the QoS Info field in the EdcaParameterSet information element.
void SetBkCWmin(uint32_t cwMin)
Set the AC_BK CWmin field in the EdcaParameterSet information element.
uint32_t GetVoCWmin() const
Return the AC_VO CWmin field in the EdcaParameterSet information element.
void SetViAci(uint8_t aci)
Set the AC_VI ACI field in the EdcaParameterSet information element.
void SetViCWmax(uint32_t cwMax)
Set the AC_VI CWmax field in the EdcaParameterSet information element.
void SetVoCWmin(uint32_t cwMin)
Set the AC_VO CWmin field in the EdcaParameterSet information element.
void SetBeTxopLimit(uint16_t txop)
Set the AC_BE TXOP Limit field in the EdcaParameterSet information element.
void SetBeCWmax(uint32_t cwMax)
Set the AC_BE CWmax field in the EdcaParameterSet information element.
void SetBeAci(uint8_t aci)
Set the AC_BE ACI field in the EdcaParameterSet information element.
void SetBkCWmax(uint32_t cwMax)
Set the AC_BK CWmax field in the EdcaParameterSet information element.
void SetBkTxopLimit(uint16_t txop)
Set the AC_BK TXOP Limit field in the EdcaParameterSet information element.
void SetBkAifsn(uint8_t aifsn)
Set the AC_BK AIFSN field in the EdcaParameterSet information element.
uint8_t GetBkAifsn() const
Return the AC_BK AIFSN field in the EdcaParameterSet information element.
void SetBeCWmin(uint32_t cwMin)
Set the AC_BE CWmin field in the EdcaParameterSet information element.
void SetBkAci(uint8_t aci)
Set the AC_BK ACI field in the EdcaParameterSet information element.
uint32_t GetBkCWmin() const
Return the AC_BK CWmin field in the EdcaParameterSet information element.
uint32_t GetViCWmin() const
Return the AC_VI CWmin field in the EdcaParameterSet information element.
uint16_t DeserializeInformationField(Buffer::Iterator start, uint16_t length) override
Deserialize information (i.e., the body of the IE, not including the Element ID and length octets)
uint32_t GetViCWmax() const
Return the AC_VI CWmax field in the EdcaParameterSet information element.
uint16_t GetInformationFieldSize() const override
Length of serialized information (i.e., the length of the body of the IE, not including the Element I...
WifiInformationElementId ElementId() const override
Get the wifi information element ID.
uint32_t GetBkCWmax() const
Return the AC_BK CWmax field in the EdcaParameterSet information element.
void SetBeAifsn(uint8_t aifsn)
Set the AC_BE AIFSN field in the EdcaParameterSet information element.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint8_t WifiInformationElementId
This type is used to represent an Information Element ID.
#define IE_EDCA_PARAMETER_SET