|
INET Framework for OMNeT++/OMNEST
|
#include <Ieee80211Radio.h>
|
| static simsignal_t | radioChannelChangedSignal = cComponent::registerSignal("radioChannelChanged") |
| | This signal is emitted every time the radio channel changes. More...
|
| |
| static simsignal_t | radioModeChangedSignal = cComponent::registerSignal("radioModeChanged") |
| | This signal is emitted when the radio mode of the radio is changed. More...
|
| |
| static simsignal_t | listeningChangedSignal = cComponent::registerSignal("listeningChanged") |
| | This signal is emitted when the radio listening of the radio is changed. More...
|
| |
| static simsignal_t | receptionStateChangedSignal = cComponent::registerSignal("receptionStateChanged") |
| | This signal is emitted when the radio reception state of the radio is changed. More...
|
| |
| static simsignal_t | transmissionStateChangedSignal = cComponent::registerSignal("transmissionStateChanged") |
| | This signal is emitted when the radio transmission state of the radio is changed. More...
|
| |
| static simsignal_t | receivedSignalPartChangedSignal = cComponent::registerSignal("receivedSignalPartChanged") |
| | This signal is emitted when the received part is changed by the radio. More...
|
| |
| static simsignal_t | transmittedSignalPartChangedSignal = cComponent::registerSignal("transmittedSignalPartChanged") |
| | This signal is emitted when the transmitted part is changed by the radio. More...
|
| |
|
| enum | RadioMode {
RADIO_MODE_OFF,
RADIO_MODE_SLEEP,
RADIO_MODE_RECEIVER,
RADIO_MODE_TRANSMITTER,
RADIO_MODE_TRANSCEIVER,
RADIO_MODE_SWITCHING
} |
| | This enumeration specifies the requested operational mode of the radio. More...
|
| |
| enum | ReceptionState { RECEPTION_STATE_UNDEFINED,
RECEPTION_STATE_IDLE,
RECEPTION_STATE_BUSY,
RECEPTION_STATE_RECEIVING
} |
| | This enumeration specifies the reception state of the radio. More...
|
| |
| enum | TransmissionState { TRANSMISSION_STATE_UNDEFINED,
TRANSMISSION_STATE_IDLE,
TRANSMISSION_STATE_TRANSMITTING
} |
| | This enumeration specifies the transmission state of the radio. More...
|
| |
| enum | PrintLevel {
PRINT_LEVEL_TRACE,
PRINT_LEVEL_DEBUG,
PRINT_LEVEL_DETAIL,
PRINT_LEVEL_INFO,
PRINT_LEVEL_COMPLETE = INT_MIN
} |
| |
| enum | PrintFlag { PRINT_FLAG_FORMATTED = (1 << 0),
PRINT_FLAG_MULTILINE = (1 << 1)
} |
| |
| enum | State |
| |
| static int | nextId = 0 |
| |
| static cEnum * | radioModeEnum = nullptr |
| | The enumeration registered for radio mode. More...
|
| |
| static cEnum * | receptionStateEnum = nullptr |
| | The enumeration registered for radio reception state. More...
|
| |
| static cEnum * | transmissionStateEnum = nullptr |
| | The enumeration registered for radio transmission state. More...
|
| |
◆ Ieee80211Radio()
| inet::physicallayer::Ieee80211Radio::Ieee80211Radio |
( |
| ) |
|
◆ decapsulate()
| void inet::physicallayer::Ieee80211Radio::decapsulate |
( |
Packet * |
packet | ) |
const |
|
overrideprotectedvirtual |
Reimplemented from inet::physicallayer::Radio.
272 auto mode = packet->getTag<Ieee80211ModeInd>()->getMode();
274 if (phyHeader->isIncorrect() || phyHeader->isIncomplete() || phyHeader->isImproperlyRepresented() || !
verifyCrc(phyHeader))
275 packet->setBitError(
true);
276 auto tailLength =
dynamic_cast<const Ieee80211OfdmMode *
>(mode) ?
b(6) :
b(0);
277 auto paddingLength = mode->getDataMode()->getPaddingLength(
B(phyHeader->getLengthField()));
278 if (tailLength + paddingLength !=
b(0))
◆ encapsulate()
| void inet::physicallayer::Ieee80211Radio::encapsulate |
( |
Packet * |
packet | ) |
const |
|
overrideprotectedvirtual |
Reimplemented from inet::physicallayer::Radio.
234 auto ieee80211Transmitter = check_and_cast<const Ieee80211TransmitterBase *>(
transmitter);
235 auto mode = ieee80211Transmitter->computeTransmissionMode(packet);
236 auto phyHeader = mode->getHeaderMode()->createHeader();
237 phyHeader->setChunkLength(
b(mode->getHeaderMode()->getLength()));
238 phyHeader->setLengthField(
B(packet->getTotalLength()));
240 packet->insertAtFront(phyHeader);
242 auto tailLength =
dynamic_cast<const Ieee80211OfdmMode *
>(mode) ?
b(6) :
b(0);
243 auto paddingLength = mode->getDataMode()->getPaddingLength(
B(phyHeader->getLengthField()));
244 if (tailLength + paddingLength !=
b(0)) {
245 const auto& phyTrailer = makeShared<BitCountChunk>(tailLength + paddingLength);
246 packet->insertAtBack(phyTrailer);
249 if (
dynamic_cast<Ieee80211FhssPhyHeader *
>(phyHeader.get()))
251 else if (
dynamic_cast<Ieee80211IrPhyHeader *
>(phyHeader.get()))
253 else if (
dynamic_cast<Ieee80211DsssPhyHeader *
>(phyHeader.get()))
255 else if (
dynamic_cast<Ieee80211HrDsssPhyHeader *
>(phyHeader.get()))
257 else if (
dynamic_cast<Ieee80211OfdmPhyHeader *
>(phyHeader.get()))
259 else if (
dynamic_cast<Ieee80211ErpOfdmPhyHeader *
>(phyHeader.get()))
261 else if (
dynamic_cast<Ieee80211HtPhyHeader *
>(phyHeader.get()))
263 else if (
dynamic_cast<Ieee80211VhtPhyHeader *
>(phyHeader.get()))
266 throw cRuntimeError(
"Invalid IEEE 802.11 PHY header type.");
◆ handleUpperCommand()
| void inet::physicallayer::Ieee80211Radio::handleUpperCommand |
( |
cMessage * |
message | ) |
|
|
overrideprotectedvirtual |
Reimplemented from inet::physicallayer::FlatRadioBase.
58 Ieee80211ConfigureRadioCommand *configureCommand =
dynamic_cast<Ieee80211ConfigureRadioCommand *
>(message->getControlInfo());
59 if (configureCommand !=
nullptr) {
60 const char *opMode = configureCommand->getOpMode();
63 const Ieee80211ModeSet *modeSet = configureCommand->getModeSet();
64 if (modeSet !=
nullptr)
66 const IIeee80211Mode *mode = configureCommand->getMode();
69 const IIeee80211Band *band = configureCommand->getBand();
72 const Ieee80211Channel *channel = configureCommand->getChannel();
73 if (channel !=
nullptr)
75 int newChannelNumber = configureCommand->getChannelNumber();
76 if (newChannelNumber != -1)
◆ initialize()
| void inet::physicallayer::Ieee80211Radio::initialize |
( |
int |
stage | ) |
|
|
overrideprotectedvirtual |
Reimplemented from inet::physicallayer::Radio.
45 const char *crcModeString = par(
"crcMode");
49 int channelNumber = par(
"channelNumber");
50 if (channelNumber != -1)
◆ insertCrc()
| void inet::physicallayer::Ieee80211Radio::insertCrc |
( |
const Ptr< Ieee80211PhyHeader > & |
phyHeader | ) |
const |
|
protectedvirtual |
140 if (
auto header =
dynamic_cast<Ieee80211FhssPhyHeader *
>(phyHeader.get())) {
147 header->setCrc(0xC00D);
150 header->setCrc(0xBAAD);
153 throw cRuntimeError(
"Invalid CRC mode: %i", (
int)
crcMode);
156 else if (
auto header =
dynamic_cast<Ieee80211IrPhyHeader *
>(phyHeader.get())) {
163 header->setCrc(0xC00D);
166 header->setCrc(0xBAAD);
169 throw cRuntimeError(
"Invalid CRC mode: %i", (
int)
crcMode);
172 else if (
auto header =
dynamic_cast<Ieee80211DsssPhyHeader *
>(phyHeader.get())) {
179 header->setCrc(0xC00D);
182 header->setCrc(0xBAAD);
185 throw cRuntimeError(
"Invalid CRC mode: %i", (
int)
crcMode);
Referenced by encapsulate().
◆ peekIeee80211PhyHeaderAtFront()
| const Ptr< const Ieee80211PhyHeader > inet::physicallayer::Ieee80211Radio::peekIeee80211PhyHeaderAtFront |
( |
const Packet * |
packet, |
|
|
b |
length = b(-1), |
|
|
int |
flags = 0 |
|
) |
| |
|
static |
310 return packet->peekAtFront<Ieee80211FhssPhyHeader>(length, flags);
312 return packet->peekAtFront<Ieee80211IrPhyHeader>(length, flags);
314 return packet->peekAtFront<Ieee80211DsssPhyHeader>(length, flags);
316 return packet->peekAtFront<Ieee80211HrDsssPhyHeader>(length, flags);
318 return packet->peekAtFront<Ieee80211OfdmPhyHeader>(length, flags);
320 return packet->peekAtFront<Ieee80211ErpOfdmPhyHeader>(length, flags);
322 return packet->peekAtFront<Ieee80211HtPhyHeader>(length, flags);
324 return packet->peekAtFront<Ieee80211VhtPhyHeader>(length, flags);
326 throw cRuntimeError(
"Invalid IEEE 802.11 PHY protocol.");
Referenced by inet::physicallayer::Ieee80211ScalarTransmitter::createTransmission(), and inet::physicallayer::Ieee80211DimensionalTransmitter::createTransmission().
◆ popIeee80211PhyHeaderAtFront()
| const Ptr< const Ieee80211PhyHeader > inet::physicallayer::Ieee80211Radio::popIeee80211PhyHeaderAtFront |
( |
Packet * |
packet, |
|
|
b |
length = b(-1), |
|
|
int |
flags = 0 |
|
) |
| |
|
static |
287 return packet->popAtFront<Ieee80211FhssPhyHeader>(length, flags);
289 return packet->popAtFront<Ieee80211IrPhyHeader>(length, flags);
291 return packet->popAtFront<Ieee80211DsssPhyHeader>(length, flags);
293 return packet->popAtFront<Ieee80211HrDsssPhyHeader>(length, flags);
295 return packet->popAtFront<Ieee80211OfdmPhyHeader>(length, flags);
297 return packet->popAtFront<Ieee80211ErpOfdmPhyHeader>(length, flags);
299 return packet->popAtFront<Ieee80211HtPhyHeader>(length, flags);
301 return packet->popAtFront<Ieee80211VhtPhyHeader>(length, flags);
303 throw cRuntimeError(
"Invalid IEEE 802.11 PHY protocol.");
Referenced by decapsulate(), and inet::Ieee80211PhyProtocolDissector::dissect().
◆ setBand()
| void inet::physicallayer::Ieee80211Radio::setBand |
( |
const IIeee80211Band * |
band | ) |
|
|
virtual |
105 Ieee80211TransmitterBase *ieee80211Transmitter =
const_cast<Ieee80211TransmitterBase *
>(check_and_cast<const Ieee80211TransmitterBase *>(
transmitter));
106 Ieee80211ReceiverBase *ieee80211Receiver =
const_cast<Ieee80211ReceiverBase *
>(check_and_cast<const Ieee80211ReceiverBase *>(
receiver));
107 ieee80211Transmitter->setBand(band);
108 ieee80211Receiver->setBand(band);
109 EV <<
"Changing radio band to " << band << endl;
Referenced by handleUpperCommand().
◆ setChannel()
| void inet::physicallayer::Ieee80211Radio::setChannel |
( |
const Ieee80211Channel * |
channel | ) |
|
|
virtual |
116 Ieee80211TransmitterBase *ieee80211Transmitter =
const_cast<Ieee80211TransmitterBase *
>(check_and_cast<const Ieee80211TransmitterBase *>(
transmitter));
117 Ieee80211ReceiverBase *ieee80211Receiver =
const_cast<Ieee80211ReceiverBase *
>(check_and_cast<const Ieee80211ReceiverBase *>(
receiver));
118 ieee80211Transmitter->setChannel(channel);
119 ieee80211Receiver->setChannel(channel);
120 EV <<
"Changing radio channel to " << channel->getChannelNumber() << endl;
Referenced by handleUpperCommand().
◆ setChannelNumber()
| void inet::physicallayer::Ieee80211Radio::setChannelNumber |
( |
int |
newChannelNumber | ) |
|
|
virtual |
128 Ieee80211TransmitterBase *ieee80211Transmitter =
const_cast<Ieee80211TransmitterBase *
>(check_and_cast<const Ieee80211TransmitterBase *>(
transmitter));
129 Ieee80211ReceiverBase *ieee80211Receiver =
const_cast<Ieee80211ReceiverBase *
>(check_and_cast<const Ieee80211ReceiverBase *>(
receiver));
130 ieee80211Transmitter->setChannelNumber(newChannelNumber);
131 ieee80211Receiver->setChannelNumber(newChannelNumber);
132 EV <<
"Changing radio channel to " << newChannelNumber <<
".\n";
Referenced by handleUpperCommand(), and initialize().
◆ setMode()
| void inet::physicallayer::Ieee80211Radio::setMode |
( |
const IIeee80211Mode * |
mode | ) |
|
|
virtual |
96 Ieee80211TransmitterBase *ieee80211Transmitter =
const_cast<Ieee80211TransmitterBase *
>(check_and_cast<const Ieee80211TransmitterBase *>(
transmitter));
97 ieee80211Transmitter->setMode(mode);
98 EV <<
"Changing radio mode to " << mode << endl;
Referenced by handleUpperCommand().
◆ setModeSet()
| void inet::physicallayer::Ieee80211Radio::setModeSet |
( |
const Ieee80211ModeSet * |
modeSet | ) |
|
|
virtual |
85 Ieee80211TransmitterBase *ieee80211Transmitter =
const_cast<Ieee80211TransmitterBase *
>(check_and_cast<const Ieee80211TransmitterBase *>(
transmitter));
86 Ieee80211ReceiverBase *ieee80211Receiver =
const_cast<Ieee80211ReceiverBase *
>(check_and_cast<const Ieee80211ReceiverBase *>(
receiver));
87 ieee80211Transmitter->setModeSet(modeSet);
88 ieee80211Receiver->setModeSet(modeSet);
89 EV <<
"Changing radio mode set to " << modeSet << endl;
Referenced by handleUpperCommand().
◆ verifyCrc()
| bool inet::physicallayer::Ieee80211Radio::verifyCrc |
( |
const Ptr< const Ieee80211PhyHeader > & |
phyHeader | ) |
const |
|
protectedvirtual |
192 if (
auto header = dynamicPtrCast<const Ieee80211FhssPhyHeader>(phyHeader)) {
193 switch (header->getCrcMode()) {
201 throw cRuntimeError(
"Invalid CRC mode: %i", (
int)
crcMode);
204 else if (
auto header = dynamicPtrCast<const Ieee80211IrPhyHeader>(phyHeader)) {
205 switch (header->getCrcMode()) {
213 throw cRuntimeError(
"Invalid CRC mode: %i", (
int)
crcMode);
216 else if (
auto header = dynamicPtrCast<const Ieee80211DsssPhyHeader>(phyHeader)) {
217 switch (header->getCrcMode()) {
225 throw cRuntimeError(
"Invalid CRC mode: %i", (
int)
crcMode);
Referenced by decapsulate().
◆ crcMode
◆ radioChannelChangedSignal
| simsignal_t inet::physicallayer::Ieee80211Radio::radioChannelChangedSignal = cComponent::registerSignal("radioChannelChanged") |
|
static |
The documentation for this class was generated from the following files:
virtual void setChannel(const Ieee80211Channel *channel)
Definition: Ieee80211Radio.cc:114
static const Protocol ieee80211ErpOfdmPhy
Definition: Protocol.h:74
FlatRadioBase()
Definition: FlatRadioBase.cc:20
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down protocol
Definition: IUdp-gates.txt:25
static const Protocol ieee80211HtPhy
Definition: Protocol.h:77
virtual bool verifyCrc(const Ptr< const Ieee80211PhyHeader > &phyHeader) const
Definition: Ieee80211Radio.cc:190
static const Ptr< const Ieee80211PhyHeader > popIeee80211PhyHeaderAtFront(Packet *packet, b length=b(-1), int flags=0)
Definition: Ieee80211Radio.cc:283
@ CRC_COMPUTED
Definition: CrcMode_m.h:59
@ PF_ALLOW_IMPROPERLY_REPRESENTED
Definition: Chunk.h:282
CrcMode parseCrcMode(const char *crcModeString, bool allowDisable)
Definition: CrcMode.cc:14
virtual void setModeSet(const Ieee80211ModeSet *modeSet)
Definition: Ieee80211Radio.cc:83
CrcMode crcMode
Definition: Ieee80211Radio.h:34
static const Protocol ieee80211IrPhy
Definition: Protocol.h:78
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down PacketProtocolTag
Definition: IUdp-gates.txt:25
static const Protocol ieee80211DsssPhy
Definition: Protocol.h:73
intscale< b, 1, 8 > B
Definition: Units.h:1168
@ PF_ALLOW_INCOMPLETE
Definition: Chunk.h:280
const IReceiver * receiver
The receiver model is never nullptr.
Definition: Radio.h:70
cMessage * receptionTimer
The timer that is scheduled to the end of the current reception.
Definition: Radio.h:152
static const Protocol ieee80211OfdmPhy
Definition: Protocol.h:81
static simsignal_t listeningChangedSignal
This signal is emitted when the radio listening of the radio is changed.
Definition: IRadio.h:48
virtual void insertCrc(const Ptr< Ieee80211PhyHeader > &phyHeader) const
Definition: Ieee80211Radio.cc:138
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
const ITransmitter * transmitter
The transmitter model is never nullptr.
Definition: Radio.h:66
INET_API InitStage INITSTAGE_PHYSICAL_LAYER
Initialization of physical layer protocols includes:
value< int64_t, units::b > b
Definition: Units.h:1241
@ PF_ALLOW_INCORRECT
Definition: Chunk.h:281
static simsignal_t radioChannelChangedSignal
This signal is emitted every time the radio channel changes.
Definition: Ieee80211Radio.h:29
@ CRC_DECLARED_CORRECT
Definition: CrcMode_m.h:57
virtual void initialize(int stage) override
Definition: Radio.cc:36
@ RADIO_C_CONFIGURE
Definition: RadioControlInfo_m.h:62
@ CRC_DECLARED_INCORRECT
Definition: CrcMode_m.h:58
virtual void setMode(const IIeee80211Mode *mode)
Definition: Ieee80211Radio.cc:94
static const Protocol ieee80211HrDsssPhy
Definition: Protocol.h:76
virtual void setBand(const IIeee80211Band *band)
Definition: Ieee80211Radio.cc:103
void handleUpperCommand(cMessage *message) override
Definition: FlatRadioBase.cc:25
static const Protocol ieee80211Mac
Definition: Protocol.h:79
static const Ieee80211ModeSet * getModeSet(const char *mode)
Definition: Ieee80211ModeSet.cc:611
virtual int getId() const override
Returns an identifier for this radio which is globally unique for the whole lifetime of the simulatio...
Definition: Radio.h:209
static const Protocol ieee80211VhtPhy
Definition: Protocol.h:82
virtual void setChannelNumber(int newChannelNumber)
Definition: Ieee80211Radio.cc:126
static const Protocol ieee80211FhssPhy
Definition: Protocol.h:75