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,
39 MAX,
40};
41
42/**
43 * @ingroup wifi
44 * The type of an MPDU.
45 */
47{
48 /** The MPDU is not part of an A-MPDU */
50 /** The MPDU is a single MPDU */
52 /** The MPDU is the first aggregate in an A-MPDU with multiple MPDUs, but is not the last
53 * aggregate */
55 /** The MPDU is part of an A-MPDU with multiple MPDUs, but is neither the first nor the last
56 * aggregate */
58 /** The MPDU is the last aggregate in an A-MPDU with multiple MPDUs */
60};
61
62/// SignalNoiseDbm structure
64{
65 dBm_u signal; ///< signal strength
66 dBm_u noise; ///< noise power
67};
68
69/// MpduInfo structure
71{
72 MpduType type; ///< type of MPDU
73 uint32_t mpduRefNumber; ///< MPDU ref number
74};
75
76/// RxSignalInfo structure containing info on the received signal
78{
79 double snr; ///< SNR in linear scale
80 dBm_u rssi; ///< RSSI
81};
82
83/**
84 * @ingroup wifi
85 * @brief Enumeration of frequency channel types
86 */
87enum class FrequencyChannelType : uint8_t
88{
89 DSSS = 0,
90 OFDM,
92};
93
94/**
95 * The different Resource Unit (RU) types.
96 */
97enum class RuType : uint8_t
98{
99 RU_26_TONE = 0,
108};
109
110/**
111 * @brief Stream insertion operator.
112 *
113 * @param os the stream
114 * @param ruType the RU type
115 * @returns a reference to the stream
116 */
117inline std::ostream&
118operator<<(std::ostream& os, const RuType& ruType)
119{
120 switch (ruType)
121 {
123 os << "26-tones";
124 break;
126 os << "52-tones";
127 break;
129 os << "106-tones";
130 break;
132 os << "242-tones";
133 break;
135 os << "484-tones";
136 break;
138 os << "996-tones";
139 break;
141 os << "2x996-tones";
142 break;
144 os << "4x996-tones";
145 break;
146 default:
147 NS_FATAL_ERROR("Unknown RU type");
148 }
149 return os;
150}
151
152/// (lowest index, highest index) pair defining a subcarrier range
153using SubcarrierRange = std::pair<int16_t, int16_t>;
154
155/// a vector of subcarrier ranges defining a subcarrier group
156using SubcarrierGroup = std::vector<SubcarrierRange>;
157
158/// (bandwidth, number of tones) pair
159using BwTonesPair = std::pair<MHz_u, RuType>;
160
161/// map (bandwidth, number of tones) pairs to the group of subcarrier ranges
162using SubcarrierGroups = std::map<BwTonesPair, std::vector<SubcarrierGroup>>;
163
164} // namespace ns3
165
166#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:88
WifiChannelWidthType
Enumeration of the possible channel widths.
Definition wifi-types.h:28
MpduType
The type of an MPDU.
Definition wifi-types.h:47
@ LAST_MPDU_IN_AGGREGATE
The MPDU is the last aggregate in an A-MPDU with multiple MPDUs.
Definition wifi-types.h:59
@ NORMAL_MPDU
The MPDU is not part of an A-MPDU.
Definition wifi-types.h:49
@ 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:54
@ SINGLE_MPDU
The MPDU is a single MPDU.
Definition wifi-types.h:51
@ 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:57
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:153
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition angles.cc:148
RuType
The different Resource Unit (RU) types.
Definition wifi-types.h:98
std::vector< SubcarrierRange > SubcarrierGroup
a vector of subcarrier ranges defining a subcarrier group
Definition wifi-types.h:156
std::map< BwTonesPair, std::vector< SubcarrierGroup > > SubcarrierGroups
map (bandwidth, number of tones) pairs to the group of subcarrier ranges
Definition wifi-types.h:162
std::pair< MHz_u, RuType > BwTonesPair
(bandwidth, number of tones) pair
Definition wifi-types.h:159
MpduInfo structure.
Definition wifi-types.h:71
MpduType type
type of MPDU
Definition wifi-types.h:72
uint32_t mpduRefNumber
MPDU ref number.
Definition wifi-types.h:73
RxSignalInfo structure containing info on the received signal.
Definition wifi-types.h:78
double snr
SNR in linear scale.
Definition wifi-types.h:79
dBm_u rssi
RSSI.
Definition wifi-types.h:80
SignalNoiseDbm structure.
Definition wifi-types.h:64
dBm_u noise
noise power
Definition wifi-types.h:66
dBm_u signal
signal strength
Definition wifi-types.h:65
Declaration of the SI units (as weak types aliases) used across wifi module.