A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
block-ack-type.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 Universita' di Napoli
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Stefano Avallone <stavallo@unina.it>
7 */
8
9#include "block-ack-type.h"
10
11#include "ns3/fatal-error.h"
12
13namespace ns3
14{
15
17 : m_variant(v)
18{
19 switch (m_variant)
20 {
21 case BASIC:
22 m_bitmapLen.push_back(128);
23 break;
24 case COMPRESSED:
26 m_bitmapLen.push_back(8);
27 break;
28 case MULTI_TID:
29 case MULTI_STA:
30 // m_bitmapLen is left empty.
31 break;
32 default:
33 NS_FATAL_ERROR("Unknown block ack type");
34 }
35}
36
41
42BlockAckType::BlockAckType(Variant v, std::vector<uint8_t> l)
43 : m_variant(v),
44 m_bitmapLen(l)
45{
46}
47
49 : m_variant(v)
50{
51 switch (m_variant)
52 {
53 case BASIC:
54 case COMPRESSED:
57 break;
58 case MULTI_TID:
60 break;
61 default:
62 NS_FATAL_ERROR("Unknown block ack request type");
63 }
64}
65
70
72 : m_variant(v),
73 m_nSeqControls(nSeqControls)
74{
75}
76
77std::ostream&
78operator<<(std::ostream& os, const BlockAckType& type)
79{
80 switch (type.m_variant)
81 {
83 os << "basic-block-ack";
84 break;
86 os << "compressed-block-ack";
87 break;
89 os << "extended-compressed-block-ack";
90 break;
92 os << "multi-tid-block-ack[" << type.m_bitmapLen.size() << "]";
93 break;
95 os << "multi-sta-block-ack[" << type.m_bitmapLen.size() << "]";
96 break;
97 default:
98 NS_FATAL_ERROR("Unknown block ack type");
99 }
100 return os;
101}
102
103std::ostream&
104operator<<(std::ostream& os, const BlockAckReqType& type)
105{
106 switch (type.m_variant)
107 {
109 os << "basic-block-ack-req";
110 break;
112 os << "compressed-block-ack-req";
113 break;
115 os << "extended-compressed-block-ack-req";
116 break;
118 os << "multi-tid-block-ack-req[" << type.m_nSeqControls << "]";
119 break;
120 default:
121 NS_FATAL_ERROR("Unknown block ack request type");
122 }
123 return os;
124}
125
126} // namespace ns3
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition angles.cc:148
The different BlockAckRequest variants.
uint8_t m_nSeqControls
Number of included Starting Sequence Control fields.
BlockAckReqType()
Default constructor for BlockAckReqType.
Variant
The BlockAckReq variants.
Variant m_variant
Block Ack Request variant.
The different BlockAck variants.
BlockAckType()
Default constructor for BlockAckType.
Variant
The BlockAck variants.
Variant m_variant
Block Ack variant.
std::vector< uint8_t > m_bitmapLen
Length (bytes) of included bitmaps.