A Discrete-Event Network Simulator
API
edca-parameter-set.cc
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2016 S├ębastien Deronne
4 *
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;
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: S├ębastien Deronne <sebastien.deronne@gmail.com>
19 */
20
21#include "edca-parameter-set.h"
22#include <cmath>
23
24namespace ns3 {
25
27 : m_qosInfo (0),
28 m_reserved (0),
29 m_acBE (0),
30 m_acBK (0),
31 m_acVI (0),
32 m_acVO (0)
33{
34}
35
38{
40}
41
42void
44{
45 m_qosInfo = qosInfo;
46}
47
48void
50{
51 m_acBE |= (aifsn & 0x0f);
52}
53
54void
56{
57 m_acBE |= (aci & 0x03) << 5;
58}
59
60void
62{
63 uint8_t ECWmin = static_cast<uint8_t> (log2 (cwMin + 1));
64 m_acBE |= (ECWmin & 0x0f) << 8;
65}
66
67void
69{
70 uint8_t ECWmax = static_cast<uint8_t> (log2 (cwMax + 1));
71 m_acBE |= (ECWmax & 0x0f) << 12;
72}
73
74void
76{
77 m_acBE |= txop << 16;
78}
79
80void
82{
83 m_acBK |= (aifsn & 0x0f);
84}
85
86void
88{
89 m_acBK |= (aci & 0x03) << 5;
90}
91
92void
94{
95 uint8_t ECWmin = static_cast<uint8_t> (log2 (cwMin + 1));
96 m_acBK |= (ECWmin & 0x0f) << 8;
97}
98
99void
101{
102 uint8_t ECWmax = static_cast<uint8_t> (log2 (cwMax + 1));
103 m_acBK |= (ECWmax & 0x0f) << 12;
104}
105
106void
108{
109 m_acBK |= txop << 16;
110}
111
112void
114{
115 m_acVI |= (aifsn & 0x0f);
116}
117
118void
120{
121 m_acVI |= (aci & 0x03) << 5;
122}
123
124void
126{
127 uint8_t ECWmin = static_cast<uint8_t> (log2 (cwMin + 1));
128 m_acVI |= (ECWmin & 0x0f) << 8;
129}
130
131void
133{
134 uint8_t ECWmax = static_cast<uint8_t> (log2 (cwMax + 1));
135 m_acVI |= (ECWmax & 0x0f) << 12;
136}
137
138void
140{
141 m_acVI |= txop << 16;
142}
143
144void
146{
147 m_acVO |= (aifsn & 0x0f);
148}
149
150void
152{
153 m_acVO |= (aci & 0x03) << 5;
154}
155
156void
158{
159 uint8_t ECWmin = static_cast<uint8_t> (log2 (cwMin + 1));
160 m_acVO |= (ECWmin & 0x0f) << 8;
161}
162
163void
165{
166 uint8_t ECWmax = static_cast<uint8_t> (log2 (cwMax + 1));
167 m_acVO |= (ECWmax & 0x0f) << 12;
168}
169
170void
172{
173 m_acVO |= txop << 16;
174}
175
176uint8_t
178{
179 return m_qosInfo;
180}
181
182uint8_t
184{
185 return (m_acBE & 0x0f);
186}
187
190{
191 uint8_t ECWmin = ((m_acBE >> 8) & 0x0f);
192 return static_cast<uint32_t> (exp2 (ECWmin) - 1);
193}
194
197{
198 uint8_t ECWmax = ((m_acBE >> 12) & 0x0f);
199 return static_cast<uint32_t> (exp2 (ECWmax) - 1);
200}
201
202uint16_t
204{
205 return (m_acBE >> 16);
206}
207
208uint8_t
210{
211 return (m_acBK & 0x0f);
212}
213
216{
217 uint8_t ECWmin = ((m_acBK >> 8) & 0x0f);
218 return static_cast<uint32_t> (exp2 (ECWmin) - 1);
219}
220
223{
224 uint8_t ECWmax = ((m_acBK >> 12) & 0x0f);
225 return static_cast<uint32_t> (exp2 (ECWmax) - 1);
226}
227
228uint16_t
230{
231 return (m_acBK >> 16);
232}
233
234uint8_t
236{
237 return (m_acVI & 0x0f);
238}
239
242{
243 uint8_t ECWmin = ((m_acVI >> 8) & 0x0f);
244 return static_cast<uint32_t> (exp2 (ECWmin) - 1);
245}
246
249{
250 uint8_t ECWmax = ((m_acVI >> 12) & 0x0f);
251 return static_cast<uint32_t> (exp2 (ECWmax) - 1);
252}
253
254uint16_t
256{
257 return (m_acVI >> 16);
258}
259
260uint8_t
262{
263 return (m_acVO & 0x0f);
264}
265
268{
269 uint8_t ECWmin = ((m_acVO >> 8) & 0x0f);
270 return static_cast<uint32_t> (exp2 (ECWmin) - 1);
271}
272
275{
276 uint8_t ECWmax = ((m_acVO >> 12) & 0x0f);
277 return static_cast<uint32_t> (exp2 (ECWmax) - 1);
278}
279
280uint16_t
282{
283 return (m_acVO >> 16);
284}
285
286uint16_t
288{
289 return 18;
290}
291
292void
294{
295 start.WriteU8 (GetQosInfo ());
296 start.WriteU8 (m_reserved);
297 start.WriteU32 (m_acBE);
298 start.WriteU32 (m_acBK);
299 start.WriteU32 (m_acVI);
300 start.WriteU32 (m_acVO);
301}
302
303uint16_t
305{
307 m_qosInfo = i.ReadU8 ();
308 m_reserved = i.ReadU8 ();
309 m_acBE = i.ReadU32 ();
310 m_acBK = i.ReadU32 ();
311 m_acVI = i.ReadU32 ();
312 m_acVO = i.ReadU32 ();
313 return length;
314}
315
316} //namespace ns3
iterator in a Buffer instance
Definition: buffer.h:99
uint8_t ReadU8(void)
Definition: buffer.h:1021
uint32_t ReadU32(void)
Definition: buffer.cc:973
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.
uint16_t GetBeTxopLimit(void) const
Return the AC_BE 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)
uint32_t GetBeCWmin(void) const
Return the AC_BE CWmin field in the EdcaParameterSet information element.
void SetVoAci(uint8_t aci)
Set the AC_VO ACI field in the EdcaParameterSet information element.
uint8_t GetVoAifsn(void) const
Return the AC_VO AIFSN field in the EdcaParameterSet information element.
uint8_t m_reserved
reserved
uint8_t GetQosInfo(void) const
Return the QoS Info 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 GetBeAifsn(void) const
Return the AC_BE AIFSN field in the EdcaParameterSet information element.
uint16_t GetVoTxopLimit(void) const
Return the AC_VO TXOP Limit field in the EdcaParameterSet information element.
uint32_t GetVoCWmax(void) const
Return the AC_VO CWmax field in the EdcaParameterSet information element.
void SetQosInfo(uint8_t qosInfo)
Set the QoS Info field in the EdcaParameterSet information element.
uint32_t GetViCWmin(void) const
Return the AC_VI CWmin field in the EdcaParameterSet information element.
uint8_t GetBkAifsn(void) const
Return the AC_BK AIFSN field in the EdcaParameterSet information element.
void SetBkCWmin(uint32_t cwMin)
Set the AC_BK 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.
uint32_t GetViCWmax(void) const
Return the AC_VI CWmax 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.
uint8_t GetViAifsn(void) const
Return the AC_VI AIFSN field in the EdcaParameterSet information element.
void SetBkAifsn(uint8_t aifsn)
Set the AC_BK AIFSN field in the EdcaParameterSet information element.
uint32_t GetBeCWmax(void) const
Return the AC_BE CWmax field in the EdcaParameterSet information element.
uint32_t GetBkCWmax(void) const
Return the AC_BK CWmax field in the EdcaParameterSet information element.
uint8_t m_qosInfo
QOS info.
uint16_t GetViTxopLimit(void) const
Return the AC_VI TXOP Limit field in the EdcaParameterSet information element.
void SetBeCWmin(uint32_t cwMin)
Set the AC_BE CWmin field in the EdcaParameterSet information element.
uint32_t GetBkCWmin(void) const
Return the AC_BK 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 GetVoCWmin(void) const
Return the AC_VO 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)
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.
uint16_t GetBkTxopLimit(void) const
Return the AC_BK TXOP Limit 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.
def start()
Definition: core.py:1852
#define IE_EDCA_PARAMETER_SET