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 case GCR:
27 m_bitmapLen.push_back(8);
28 break;
29 case MULTI_TID:
30 case MULTI_STA:
31 // m_bitmapLen is left empty.
32 break;
33 default:
34 NS_FATAL_ERROR("Unknown block ack type");
35 }
36}
37
42
43BlockAckType::BlockAckType(Variant v, std::vector<uint8_t> l)
44 : m_variant(v),
45 m_bitmapLen(l)
46{
47}
48
50 : m_variant(v)
51{
52 switch (m_variant)
53 {
54 case BASIC:
55 case COMPRESSED:
57 case GCR:
59 break;
60 case MULTI_TID:
62 break;
63 default:
64 NS_FATAL_ERROR("Unknown block ack request type");
65 }
66}
67
72
74 : m_variant(v),
75 m_nSeqControls(nSeqControls)
76{
77}
78
79std::ostream&
80operator<<(std::ostream& os, const BlockAckType& type)
81{
82 switch (type.m_variant)
83 {
85 os << "basic-block-ack";
86 break;
88 os << "compressed-block-ack";
89 break;
91 os << "extended-compressed-block-ack";
92 break;
94 os << "multi-tid-block-ack[" << type.m_bitmapLen.size() << "]";
95 break;
97 os << "gcr-block-ack";
98 break;
100 os << "multi-sta-block-ack[" << type.m_bitmapLen.size() << "]";
101 break;
102 default:
103 NS_FATAL_ERROR("Unknown block ack type");
104 }
105 return os;
106}
107
108std::ostream&
109operator<<(std::ostream& os, const BlockAckReqType& type)
110{
111 switch (type.m_variant)
112 {
114 os << "basic-block-ack-req";
115 break;
117 os << "compressed-block-ack-req";
118 break;
120 os << "extended-compressed-block-ack-req";
121 break;
123 os << "multi-tid-block-ack-req[" << type.m_nSeqControls << "]";
124 break;
126 os << "gcr-block-ack-req";
127 break;
128 default:
129 NS_FATAL_ERROR("Unknown block ack request type");
130 }
131 return os;
132}
133
134} // 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 m_variant
Block Ack variant.
Variant
The BlockAck variants.
std::vector< uint8_t > m_bitmapLen
Length (bytes) of included bitmaps.