A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-types.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 DERONNE SOFTWARE ENGINEERING
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Sébastien Deronne <sebastien.deronne@gmail.com>
7 */
8
9#ifndef WIFI_TYPES_H
10#define WIFI_TYPES_H
11
12#include "wifi-units.h"
13
14#include "ns3/fatal-error.h"
15
16#include <compare>
17#include <map>
18#include <ostream>
19
20namespace ns3
21{
22
23/**
24 * @ingroup wifi
25 * Enumeration of the possible channel widths
26 */
27enum class WifiChannelWidthType : uint8_t
28{
29 UNKNOWN = 0,
32 CW_5MHZ,
40 MAX,
41};
42
43/**
44 * @ingroup wifi
45 * The type of an MPDU.
46 */
48{
49 /** The MPDU is not part of an A-MPDU */
51 /** The MPDU is a single MPDU */
53 /** The MPDU is the first aggregate in an A-MPDU with multiple MPDUs, but is not the last
54 * aggregate */
56 /** The MPDU is part of an A-MPDU with multiple MPDUs, but is neither the first nor the last
57 * aggregate */
59 /** The MPDU is the last aggregate in an A-MPDU with multiple MPDUs */
61};
62
63/// SignalNoiseDbm structure
65{
66 dBm_u signal; ///< signal strength
67 dBm_u noise; ///< noise power
68};
69
70/// MpduInfo structure
72{
73 MpduType type; ///< type of MPDU
74 uint32_t mpduRefNumber; ///< MPDU ref number
75};
76
77/// RxSignalInfo structure containing info on the received signal
79{
80 double snr; ///< SNR in linear scale
81 dBm_u rssi; ///< RSSI
82};
83
84/**
85 * @ingroup wifi
86 * @brief Enumeration of frequency channel types
87 */
88enum class FrequencyChannelType : uint8_t
89{
90 DSSS = 0,
91 OFDM,
93};
94
95/**
96 * The different Resource Unit (RU) types.
97 */
98enum class RuType : uint8_t
99{
100 RU_26_TONE = 0,
109};
110
111/**
112 * @brief Stream insertion operator.
113 *
114 * @param os the stream
115 * @param ruType the RU type
116 * @returns a reference to the stream
117 */
118inline std::ostream&
119operator<<(std::ostream& os, const RuType& ruType)
120{
121 switch (ruType)
122 {
124 os << "26-tones";
125 break;
127 os << "52-tones";
128 break;
130 os << "106-tones";
131 break;
133 os << "242-tones";
134 break;
136 os << "484-tones";
137 break;
139 os << "996-tones";
140 break;
142 os << "2x996-tones";
143 break;
145 os << "4x996-tones";
146 break;
147 default:
148 NS_FATAL_ERROR("Unknown RU type");
149 }
150 return os;
151}
152
153/// (lowest index, highest index) pair defining a subcarrier range
154using SubcarrierRange = std::pair<int16_t, int16_t>;
155
156/// a vector of subcarrier ranges defining a subcarrier group
157using SubcarrierGroup = std::vector<SubcarrierRange>;
158
159/// (bandwidth, number of tones) pair
160using BwTonesPair = std::pair<MHz_u, RuType>;
161
162/// map (bandwidth, number of tones) pairs to the group of subcarrier ranges
163using SubcarrierGroups = std::map<BwTonesPair, std::vector<SubcarrierGroup>>;
164
165} // namespace ns3
166
167#endif /* WIFI_TYPES_H */
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
FrequencyChannelType
Enumeration of frequency channel types.
Definition wifi-types.h:89
WifiChannelWidthType
Enumeration of the possible channel widths.
Definition wifi-types.h:28
MpduType
The type of an MPDU.
Definition wifi-types.h:48
@ LAST_MPDU_IN_AGGREGATE
The MPDU is the last aggregate in an A-MPDU with multiple MPDUs.
Definition wifi-types.h:60
@ NORMAL_MPDU
The MPDU is not part of an A-MPDU.
Definition wifi-types.h:50
@ FIRST_MPDU_IN_AGGREGATE
The MPDU is the first aggregate in an A-MPDU with multiple MPDUs, but is not the last aggregate.
Definition wifi-types.h:55
@ SINGLE_MPDU
The MPDU is a single MPDU.
Definition wifi-types.h:52
@ MIDDLE_MPDU_IN_AGGREGATE
The MPDU is part of an A-MPDU with multiple MPDUs, but is neither the first nor the last aggregate.
Definition wifi-types.h:58
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::pair< int16_t, int16_t > SubcarrierRange
(lowest index, highest index) pair defining a subcarrier range
Definition wifi-types.h:154
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition angles.cc:148
RuType
The different Resource Unit (RU) types.
Definition wifi-types.h:99
std::vector< SubcarrierRange > SubcarrierGroup
a vector of subcarrier ranges defining a subcarrier group
Definition wifi-types.h:157
std::map< BwTonesPair, std::vector< SubcarrierGroup > > SubcarrierGroups
map (bandwidth, number of tones) pairs to the group of subcarrier ranges
Definition wifi-types.h:163
std::pair< MHz_u, RuType > BwTonesPair
(bandwidth, number of tones) pair
Definition wifi-types.h:160
MpduInfo structure.
Definition wifi-types.h:72
MpduType type
type of MPDU
Definition wifi-types.h:73
uint32_t mpduRefNumber
MPDU ref number.
Definition wifi-types.h:74
RxSignalInfo structure containing info on the received signal.
Definition wifi-types.h:79
double snr
SNR in linear scale.
Definition wifi-types.h:80
dBm_u rssi
RSSI.
Definition wifi-types.h:81
SignalNoiseDbm structure.
Definition wifi-types.h:65
dBm_u noise
noise power
Definition wifi-types.h:67
dBm_u signal
signal strength
Definition wifi-types.h:66
Declaration of the SI units (as weak types aliases) used across wifi module.