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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7 * Sébastien Deronne <sebastien.deronne@gmail.com>
8 */
9
10#ifndef WIFI_PHY_STATE_H
11#define WIFI_PHY_STATE_H
12
13#include "ns3/fatal-error.h"
14
15namespace ns3
16{
17
18/**
19 * The state of the PHY layer.
20 */
21/// State enumeration
22enum class WifiPhyState
23{
24 /**
25 * The PHY layer is IDLE.
26 */
27 IDLE = 0,
28 /**
29 * The PHY layer has sense the medium busy through the CCA mechanism
30 */
32 /**
33 * The PHY layer is sending a packet.
34 */
36 /**
37 * The PHY layer is receiving a packet.
38 */
40 /**
41 * The PHY layer is switching to other channel.
42 */
44 /**
45 * The PHY layer is sleeping.
46 */
48 /**
49 * The PHY layer is switched off.
50 */
52};
53
54/**
55 * @brief Stream insertion operator.
56 *
57 * @param os the stream
58 * @param state the state
59 * @returns a reference to the stream
60 */
61inline std::ostream&
62operator<<(std::ostream& os, WifiPhyState state)
63{
64 switch (state)
65 {
67 return (os << "IDLE");
69 return (os << "CCA_BUSY");
71 return (os << "TX");
73 return (os << "RX");
75 return (os << "SWITCHING");
77 return (os << "SLEEP");
79 return (os << "OFF");
80 default:
81 NS_FATAL_ERROR("Invalid state");
82 return (os << "INVALID");
83 }
84}
85
86} // namespace ns3
87
88#endif /* WIFI_PHY_STATE_H */
#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.
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:148
@ IDLE
Channel is IDLE, no packet is being transmitted.