A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-phy-state.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2005,2006 INRIA
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18 * Sébastien Deronne <sebastien.deronne@gmail.com>
19 */
20
21#ifndef WIFI_PHY_STATE_H
22#define WIFI_PHY_STATE_H
23
24#include "ns3/deprecated.h"
25#include "ns3/fatal-error.h"
26
27namespace ns3
28{
29
30/**
31 * The state of the PHY layer.
32 */
33/// State enumeration
34enum class WifiPhyState
35{
36 /**
37 * The PHY layer is IDLE.
38 */
39 IDLE = 0,
40 /**
41 * The PHY layer has sense the medium busy through the CCA mechanism
42 */
44 /**
45 * The PHY layer is sending a packet.
46 */
47 TX,
48 /**
49 * The PHY layer is receiving a packet.
50 */
51 RX,
52 /**
53 * The PHY layer is switching to other channel.
54 */
56 /**
57 * The PHY layer is sleeping.
58 */
59 SLEEP,
60 /**
61 * The PHY layer is switched off.
62 */
63 OFF
64};
65
66/**
67 * \brief Stream insertion operator.
68 *
69 * \param os the stream
70 * \param state the state
71 * \returns a reference to the stream
72 */
73inline std::ostream&
74operator<<(std::ostream& os, WifiPhyState state)
75{
76 switch (state)
77 {
79 return (os << "IDLE");
81 return (os << "CCA_BUSY");
83 return (os << "TX");
85 return (os << "RX");
87 return (os << "SWITCHING");
89 return (os << "SLEEP");
91 return (os << "OFF");
92 default:
93 NS_FATAL_ERROR("Invalid state");
94 return (os << "INVALID");
95 }
96}
97
98} // namespace ns3
99
100NS_DEPRECATED_3_42("Use WifiPhyState::IDLE instead")
101static constexpr auto IDLE = ns3::WifiPhyState::IDLE; //!< \deprecated See WifiPhyState::IDLE
102NS_DEPRECATED_3_42("Use WifiPhyState::CCA_BUSY instead")
103static constexpr auto CCA_BUSY =
104 ns3::WifiPhyState::CCA_BUSY; //!< \deprecated See WifiPhyState::CCA_BUSY
105NS_DEPRECATED_3_42("Use WifiPhyState::TX instead")
106static constexpr auto TX = ns3::WifiPhyState::TX; //!< \deprecated See WifiPhyState::TX
107NS_DEPRECATED_3_42("Use WifiPhyState::RX instead")
108static constexpr auto RX = ns3::WifiPhyState::RX; //!< \deprecated See WifiPhyState::RX
109NS_DEPRECATED_3_42("Use WifiPhyState::SWITCHING instead")
110static constexpr auto SWITCHING =
111 ns3::WifiPhyState::SWITCHING; //!< \deprecated See WifiPhyState::SWITCHING
112NS_DEPRECATED_3_42("Use WifiPhyState::SLEEP instead")
113static constexpr auto SLEEP = ns3::WifiPhyState::SLEEP; //!< \deprecated See WifiPhyState::SLEEP
114NS_DEPRECATED_3_42("Use WifiPhyState::OFF instead")
115static constexpr auto OFF = ns3::WifiPhyState::OFF; //!< \deprecated See WifiPhyState::OFF
116
117#endif /* WIFI_PHY_STATE_H */
#define NS_DEPRECATED_3_42(msg)
Tag for things deprecated in version ns-3.42.
Definition: deprecated.h:102
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:179
Every class exported by the ns3 library is enclosed in the ns3 namespace.
WifiPhyState
The state of the PHY layer.
@ SWITCHING
The PHY layer is switching to other channel.
@ TX
The PHY layer is sending a packet.
@ OFF
The PHY layer is switched off.
@ IDLE
The PHY layer is IDLE.
@ CCA_BUSY
The PHY layer has sense the medium busy through the CCA mechanism.
@ SLEEP
The PHY layer is sleeping.
@ RX
The PHY layer is receiving a packet.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:159
@ IDLE
Channel is IDLE, no packet is being transmitted.
Definition: csma-channel.h:76
static constexpr auto SWITCHING
static constexpr auto TX
static constexpr auto SLEEP
static constexpr auto CCA_BUSY
static constexpr auto RX
static constexpr auto IDLE
static constexpr auto OFF