A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
frame-exchange-manager.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Universita' degli Studi di Napoli Federico II
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 * Author: Stefano Avallone <stavallo@unina.it>
18 */
19
20#ifndef FRAME_EXCHANGE_MANAGER_H
21#define FRAME_EXCHANGE_MANAGER_H
22
23#include "mac-rx-middle.h"
24#include "mac-tx-middle.h"
25#include "qos-txop.h"
26#include "wifi-mac.h"
27#include "wifi-phy.h"
28#include "wifi-psdu.h"
29#include "wifi-tx-parameters.h"
30#include "wifi-tx-timer.h"
31#include "wifi-tx-vector.h"
32
33// Needed to compile wave bindings
35#include "wifi-ack-manager.h"
37
38#include "ns3/object.h"
39
40#define WIFI_FEM_NS_LOG_APPEND_CONTEXT \
41 std::clog << "[link=" << +m_linkId << "][mac=" << m_self << "] "
42
43namespace ns3
44{
45
46struct RxSignalInfo;
47struct WifiProtection;
48struct WifiAcknowledgment;
49
50/**
51 * \ingroup wifi
52 *
53 * FrameExchangeManager is a base class handling the basic frame exchange
54 * sequences for non-QoS stations.
55 */
57{
58 public:
59 /**
60 * \brief Get the type ID.
61 * \return the object TypeId
62 */
63 static TypeId GetTypeId();
65 ~FrameExchangeManager() override;
66
67 /**
68 * typedef for a callback to invoke when an MPDU is dropped.
69 */
71 /**
72 * typedef for a callback to invoke when an MPDU is successfully acknowledged.
73 */
75
76 /**
77 * Request the FrameExchangeManager to start a frame exchange sequence.
78 *
79 * \param dcf the channel access function that gained channel access. It is
80 * the DCF on non-QoS stations and an EDCA on QoS stations.
81 * \param allowedWidth the allowed width in MHz for the frame exchange sequence
82 * \return true if a frame exchange sequence was started, false otherwise
83 */
84 virtual bool StartTransmission(Ptr<Txop> dcf, uint16_t allowedWidth);
85
86 /**
87 * This method is intended to be called by the PHY layer every time an MPDU
88 * is received and also when the reception of an A-MPDU is completed. In case
89 * the PSDU contains multiple MPDUs, the <i>perMpduStatus</i> vector is empty
90 * when receiving the individual MPDUs.
91 *
92 * \param psdu the received PSDU
93 * \param rxSignalInfo the info on the received signal (\see RxSignalInfo)
94 * \param txVector TxVector of the received PSDU
95 * \param perMpduStatus per MPDU reception status
96 */
98 RxSignalInfo rxSignalInfo,
99 WifiTxVector txVector,
100 std::vector<bool> perMpduStatus);
101
102 /**
103 * Set the ID of the link this Frame Exchange Manager is associated with.
104 *
105 * \param linkId the ID of the link this Frame Exchange Manager is associated with
106 */
107 virtual void SetLinkId(uint8_t linkId);
108 /**
109 * Set the MAC layer to use.
110 *
111 * \param mac the MAC layer to use
112 */
113 virtual void SetWifiMac(const Ptr<WifiMac> mac);
114 /**
115 * Set the MAC TX Middle to use.
116 *
117 * \param txMiddle the MAC TX Middle to use
118 */
119 virtual void SetMacTxMiddle(const Ptr<MacTxMiddle> txMiddle);
120 /**
121 * Set the MAC RX Middle to use.
122 *
123 * \param rxMiddle the MAC RX Middle to use
124 */
125 virtual void SetMacRxMiddle(const Ptr<MacRxMiddle> rxMiddle);
126 /**
127 * Set the channel access manager to use
128 *
129 * \param channelAccessManager the channel access manager to use
130 */
131 virtual void SetChannelAccessManager(const Ptr<ChannelAccessManager> channelAccessManager);
132 /**
133 * Set the PHY layer to use.
134 *
135 * \param phy the PHY layer to use
136 */
137 virtual void SetWifiPhy(const Ptr<WifiPhy> phy);
138 /**
139 * Remove WifiPhy associated with this FrameExchangeManager.
140 */
141 virtual void ResetPhy();
142 /**
143 * Set the Protection Manager to use
144 *
145 * \param protectionManager the Protection Manager to use
146 */
147 virtual void SetProtectionManager(Ptr<WifiProtectionManager> protectionManager);
148 /**
149 * Set the Acknowledgment Manager to use
150 *
151 * \param ackManager the Acknowledgment Manager to use
152 */
153 virtual void SetAckManager(Ptr<WifiAckManager> ackManager);
154 /**
155 * Set the MAC address.
156 *
157 * \param address the MAC address
158 */
159 virtual void SetAddress(Mac48Address address);
160 /**
161 * Get the MAC address.
162 *
163 * \return the MAC address
164 */
165 Mac48Address GetAddress() const;
166 /**
167 * Set the Basic Service Set Identification.
168 *
169 * \param bssid the BSSID
170 */
171 virtual void SetBssid(Mac48Address bssid);
172 /**
173 * Get the Basic Service Set Identification.
174 *
175 * \return the BSSID
176 */
177 Mac48Address GetBssid() const;
178 /**
179 * Set the callback to invoke when an MPDU is dropped.
180 *
181 * \param callback the callback to invoke when an MPDU is dropped
182 */
183 virtual void SetDroppedMpduCallback(DroppedMpdu callback);
184 /**
185 * Set the callback to invoke when an MPDU is successfully acked.
186 *
187 * \param callback the callback to invoke when an MPDU is successfully acked
188 */
189 void SetAckedMpduCallback(AckedMpdu callback);
190 /**
191 * Enable promiscuous mode.
192 */
193 void SetPromisc();
194 /**
195 * Check if the device is operating in promiscuous mode.
196 *
197 * \return true if the device is operating in promiscuous mode,
198 * false otherwise
199 */
200 bool IsPromisc() const;
201
202 /**
203 * Get a const reference to the WifiTxTimer object.
204 *
205 * \return a const reference to the WifiTxTimer object
206 */
207 const WifiTxTimer& GetWifiTxTimer() const;
208
209 /**
210 * Get the Protection Manager used by this node.
211 *
212 * \return the Protection Manager used by this node
213 */
215
216 /**
217 * Calculate the time required to protect a frame according to the given
218 * protection method. The protection time is stored in the protection
219 * object itself.
220 *
221 * \param protection the protection method
222 */
223 virtual void CalculateProtectionTime(WifiProtection* protection) const;
224
225 /**
226 * Get the Acknowledgment Manager used by this node.
227 *
228 * \return the Acknowledgment Manager used by this node
229 */
231
232 /**
233 * Calculate the time required to acknowledge a frame according to the given
234 * acknowledgment method. The acknowledgment time is stored in the acknowledgment
235 * object itself.
236 *
237 * \param acknowledgment the acknowledgment method
238 */
239 virtual void CalculateAcknowledgmentTime(WifiAcknowledgment* acknowledgment) const;
240
241 /**
242 * \return true if the virtual CS indication is that the medium is idle
243 */
244 virtual bool VirtualCsMediumIdle() const;
245
246 /**
247 * \return the set of stations that have successfully received an RTS in this TXOP.
248 */
249 const std::set<Mac48Address>& GetProtectedStas() const;
250
251 /**
252 * Notify that an internal collision has occurred for the given Txop
253 *
254 * \param txop the Txop for which an internal collision has occurred
255 */
256 virtual void NotifyInternalCollision(Ptr<Txop> txop);
257
258 /**
259 * \param duration switching delay duration.
260 *
261 * This method is typically invoked by the PhyListener to notify
262 * the MAC layer that a channel switching occurred. When a channel switching
263 * occurs, pending MAC transmissions (RTS, CTS, Data and Ack) are cancelled.
264 */
265 virtual void NotifySwitchingStartNow(Time duration);
266
267 /**
268 * This method is typically invoked by the PhyListener to notify
269 * the MAC layer that the device has been put into sleep mode. When the device is put
270 * into sleep mode, pending MAC transmissions (RTS, CTS, Data and Ack) are cancelled.
271 */
272 void NotifySleepNow();
273
274 /**
275 * This method is typically invoked by the PhyListener to notify
276 * the MAC layer that the device has been put into off mode. When the device is put
277 * into off mode, pending MAC transmissions (RTS, CTS, Data and Ack) are cancelled.
278 */
279 void NotifyOffNow();
280
281 protected:
282 void DoDispose() override;
283
284 /**
285 * \return the remote station manager operating on our link
286 */
288
289 /**
290 * Fragment the given MPDU if needed. If fragmentation is needed, return the
291 * first fragment; otherwise, return the given MPDU. Note that, if fragmentation
292 * is applied, the given MPDU is dequeued from the MAC queue and the first
293 * fragment is enqueued in its place.
294 *
295 * \param mpdu the given MPDU
296 * \return the first fragment if fragmentation is needed, the given MPDU otherwise
297 */
299
300 /**
301 * Send an MPDU with the given TX parameters (with the specified protection).
302 * Note that <i>txParams</i> is moved to m_txParams and hence is left in an
303 * undefined state.
304 *
305 * \param mpdu the MPDU to send
306 * \param txParams the TX parameters to use to transmit the MPDU
307 */
309
310 /**
311 * Start the protection mechanism indicated by the given TX parameters
312 *
313 * \param txParams the TX parameters
314 */
315 virtual void StartProtection(const WifiTxParameters& txParams);
316
317 /**
318 * Transmit prepared frame upon successful protection mechanism.
319 */
320 virtual void ProtectionCompleted();
321
322 /**
323 * Update the NAV, if needed, based on the Duration/ID of the given <i>psdu</i>.
324 *
325 * \param psdu the received PSDU
326 * \param txVector TxVector of the received PSDU
327 */
328 virtual void UpdateNav(Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector);
329
330 /**
331 * Reset the NAV upon expiration of the NAV reset timer.
332 */
333 virtual void NavResetTimeout();
334
335 /**
336 * This method handles the reception of an MPDU (possibly included in an A-MPDU)
337 *
338 * \param mpdu the received MPDU
339 * \param rxSignalInfo the info on the received signal (\see RxSignalInfo)
340 * \param txVector TxVector of the received PSDU
341 * \param inAmpdu true if the MPDU is part of an A-MPDU
342 */
343 virtual void ReceiveMpdu(Ptr<const WifiMpdu> mpdu,
344 RxSignalInfo rxSignalInfo,
345 const WifiTxVector& txVector,
346 bool inAmpdu);
347
348 /**
349 * This method is called when the reception of an A-MPDU including multiple
350 * MPDUs is completed.
351 *
352 * \param psdu the received PSDU
353 * \param rxSignalInfo the info on the received signal (\see RxSignalInfo)
354 * \param txVector TxVector of the received PSDU
355 * \param perMpduStatus per MPDU reception status
356 */
357 virtual void EndReceiveAmpdu(Ptr<const WifiPsdu> psdu,
358 const RxSignalInfo& rxSignalInfo,
359 const WifiTxVector& txVector,
360 const std::vector<bool>& perMpduStatus);
361
362 /**
363 * Perform the actions needed when a Normal Ack is received.
364 *
365 * \param mpdu the MPDU that was acknowledged
366 * \param txVector the TXVECTOR used to transmit the MPDU that was acknowledged
367 * \param ackTxVector the TXVECTOR used to transmit the Normal Ack frame
368 * \param rxInfo the info on the received signal (\see RxSignalInfo)
369 * \param snr the SNR at the receiver for the MPDU that was acknowledged
370 */
371 virtual void ReceivedNormalAck(Ptr<WifiMpdu> mpdu,
372 const WifiTxVector& txVector,
373 const WifiTxVector& ackTxVector,
374 const RxSignalInfo& rxInfo,
375 double snr);
376
377 /**
378 * Notify other components that an MPDU was acknowledged.
379 *
380 * \param mpdu the MPDU that was acknowledged
381 */
382 virtual void NotifyReceivedNormalAck(Ptr<WifiMpdu> mpdu);
383
384 /**
385 * Retransmit an MPDU that was not acknowledged.
386 *
387 * \param mpdu the MPDU to retransmit
388 */
389 virtual void RetransmitMpduAfterMissedAck(Ptr<WifiMpdu> mpdu) const;
390
391 /**
392 * Make the sequence numbers of MPDUs included in the given PSDU available again
393 * if the MPDUs have never been transmitted.
394 *
395 * \param psdu the given PSDU
396 */
397 virtual void ReleaseSequenceNumbers(Ptr<const WifiPsdu> psdu) const;
398
399 /**
400 * Pass the given MPDU, discarded because of the max retry limit was reached,
401 * to the MPDU dropped callback.
402 *
403 * \param mpdu the discarded MPDU
404 */
406
407 /**
408 * Perform actions that are possibly needed when receiving any frame,
409 * independently of whether the frame is addressed to this station
410 * (e.g., storing buffer status reports).
411 *
412 * \param psdu the received PSDU
413 * \param txVector TX vector of the received PSDU
414 */
415 virtual void PreProcessFrame(Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector);
416
417 /**
418 * Perform actions that are possibly needed after receiving any frame,
419 * independently of whether the frame is addressed to this station
420 * (e.g., setting the NAV or the TXOP holder).
421 *
422 * \param psdu the received PSDU
423 * \param txVector TX vector of the received PSDU
424 */
425 virtual void PostProcessFrame(Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector);
426
427 /**
428 * Get the updated TX duration of the frame associated with the given TX
429 * parameters if the size of the PSDU addressed to the given receiver
430 * becomes <i>ppduPayloadSize</i>.
431 *
432 * \param ppduPayloadSize the new PSDU size
433 * \param receiver the MAC address of the receiver of the PSDU
434 * \param txParams the TX parameters
435 * \return the updated TX duration
436 */
437 virtual Time GetTxDuration(uint32_t ppduPayloadSize,
438 Mac48Address receiver,
439 const WifiTxParameters& txParams) const;
440
441 /**
442 * Update the TX duration field of the given TX parameters after that the PSDU
443 * addressed to the given receiver has changed.
444 *
445 * \param receiver the MAC address of the receiver of the PSDU
446 * \param txParams the TX parameters
447 */
448 void UpdateTxDuration(Mac48Address receiver, WifiTxParameters& txParams) const;
449
450 /**
451 * Get the size in bytes of the given MPDU, which is to be transmitted with the
452 * given TXVECTOR. The purpose of this method is that it can be overridden to
453 * compute the size of an S-MPDU.
454 *
455 * \param mpdu the given MPDU
456 * \param txVector the given TXVECTOR
457 * \return the size of the MPDU
458 */
459 virtual uint32_t GetPsduSize(Ptr<const WifiMpdu> mpdu, const WifiTxVector& txVector) const;
460
461 /**
462 * Notify the given Txop that channel has been released.
463 *
464 * \param txop the given Txop
465 */
466 virtual void NotifyChannelReleased(Ptr<Txop> txop);
467
468 Ptr<Txop> m_dcf; //!< the DCF/EDCAF that gained channel access
469 WifiTxTimer m_txTimer; //!< the timer set upon frame transmission
470 EventId m_navResetEvent; //!< the event to reset the NAV after an RTS
471 Ptr<WifiMac> m_mac; //!< the MAC layer on this station
472 Ptr<MacTxMiddle> m_txMiddle; //!< the MAC TX Middle on this station
473 Ptr<MacRxMiddle> m_rxMiddle; //!< the MAC RX Middle on this station
474 Ptr<ChannelAccessManager> m_channelAccessManager; //!< the channel access manager
475 Ptr<WifiPhy> m_phy; //!< the PHY layer on this station
476 Mac48Address m_self; //!< the MAC address of this device
477 Mac48Address m_bssid; //!< BSSID address (Mac48Address)
478 Time m_navEnd; //!< NAV expiration time
479 std::set<Mac48Address> m_sentRtsTo; //!< the STA(s) which we sent an RTS to (waiting for CTS)
480 std::set<Mac48Address> m_protectedStas; //!< STAs that have replied to an RTS in this TXOP
481 uint8_t m_linkId; //!< the ID of the link this object is associated with
482 uint16_t m_allowedWidth; //!< the allowed width in MHz for the current transmission
483 bool m_promisc; //!< Flag if the device is operating in promiscuous mode
484 DroppedMpdu m_droppedMpduCallback; //!< the dropped MPDU callback
485 AckedMpdu m_ackedMpduCallback; //!< the acknowledged MPDU callback
486
487 /**
488 * Finalize the MAC header of the MPDUs in the given PSDU before transmission. Tasks
489 * performed by this method include setting the Power Management flag in the MAC header.
490 *
491 * \param psdu the given PSDU
492 */
493 virtual void FinalizeMacHeader(Ptr<const WifiPsdu> psdu);
494
495 /**
496 * Forward an MPDU down to the PHY layer.
497 *
498 * \param mpdu the MPDU to forward down
499 * \param txVector the TXVECTOR used to transmit the MPDU
500 */
501 virtual void ForwardMpduDown(Ptr<WifiMpdu> mpdu, WifiTxVector& txVector);
502
503 /**
504 * Dequeue the given MPDU from the queue in which it is stored.
505 *
506 * \param mpdu the given MPDU
507 */
508 virtual void DequeueMpdu(Ptr<const WifiMpdu> mpdu);
509
510 /**
511 * Compute how to set the Duration/ID field of a frame being transmitted with
512 * the given TX parameters
513 *
514 * \param header the MAC header of the frame
515 * \param size the size of the frame in bytes
516 * \param txParams the TX parameters used to send the frame
517 * \param fragmentedPacket the packet that originated the frame to transmit, in case
518 * the latter is a fragment
519 * \return the computed Duration/ID value
520 */
521 virtual Time GetFrameDurationId(const WifiMacHeader& header,
522 uint32_t size,
523 const WifiTxParameters& txParams,
524 Ptr<Packet> fragmentedPacket) const;
525
526 /**
527 * Compute how to set the Duration/ID field of an RTS frame to send to protect
528 * a frame transmitted with the given TX vector.
529 *
530 * \param rtsTxVector the TX vector used to send the RTS frame
531 * \param txDuration the TX duration of the data frame
532 * \param response the time taken by the response (acknowledgment) to the data frame
533 * \return the computed Duration/ID value for the RTS frame
534 */
535 virtual Time GetRtsDurationId(const WifiTxVector& rtsTxVector,
536 Time txDuration,
537 Time response) const;
538
539 /**
540 * Send RTS to begin RTS-CTS-Data-Ack transaction.
541 *
542 * \param txParams the TX parameters for the data frame
543 */
544 void SendRts(const WifiTxParameters& txParams);
545
546 /**
547 * Send CTS after receiving RTS.
548 *
549 * \param rtsHdr the header of the received RTS
550 * \param rtsTxMode the TX mode used to transmit the RTS
551 * \param rtsSnr the SNR of the RTS in linear scale
552 */
553 void SendCtsAfterRts(const WifiMacHeader& rtsHdr, WifiMode rtsTxMode, double rtsSnr);
554
555 /**
556 * Send CTS after receiving RTS.
557 *
558 * \param rtsHdr the header of the received RTS
559 * \param ctsTxVector the TXVECTOR to use to transmit the CTS
560 * \param rtsSnr the SNR of the RTS in linear scale
561 */
562 void DoSendCtsAfterRts(const WifiMacHeader& rtsHdr, WifiTxVector& ctsTxVector, double rtsSnr);
563
564 /**
565 * Compute how to set the Duration/ID field of a CTS-to-self frame to send to
566 * protect a frame transmitted with the given TX vector.
567 *
568 * \param ctsTxVector the TX vector used to send the CTS-to-self frame
569 * \param txDuration the TX duration of the data frame
570 * \param response the time taken by the response (acknowledgment) to the data frame
571 * \return the computed Duration/ID value for the CTS-to-self frame
572 */
573 virtual Time GetCtsToSelfDurationId(const WifiTxVector& ctsTxVector,
574 Time txDuration,
575 Time response) const;
576
577 /**
578 * Send CTS for a CTS-to-self mechanism.
579 *
580 * \param txParams the TX parameters for the data frame
581 */
582 void SendCtsToSelf(const WifiTxParameters& txParams);
583
584 /**
585 * Send Normal Ack.
586 *
587 * \param hdr the header of the frame soliciting the Normal Ack
588 * \param dataTxVector the TXVECTOR used to transmit the frame soliciting the Normal Ack
589 * \param dataSnr the SNR of the frame soliciting the Normal Ack in linear scale
590 */
591 void SendNormalAck(const WifiMacHeader& hdr, const WifiTxVector& dataTxVector, double dataSnr);
592
593 /**
594 * Get the next fragment of the current MSDU.
595 * Only called for fragmented MSDUs.
596 *
597 * \return the next fragment of the current MSDU.
598 */
600
601 /**
602 * Take necessary actions upon a transmission success. A non-QoS station
603 * transmits the next fragment, if any, or releases the channel, otherwise.
604 */
605 virtual void TransmissionSucceeded();
606
607 /**
608 * Take necessary actions upon a transmission failure. A non-QoS station
609 * releases the channel when this method is called.
610 */
611 virtual void TransmissionFailed();
612
613 /**
614 * Called when the Ack timeout expires.
615 *
616 * \param mpdu the MPDU that solicited a Normal Ack response
617 * \param txVector the TXVECTOR used to transmit the frame soliciting the Normal Ack
618 */
619 virtual void NormalAckTimeout(Ptr<WifiMpdu> mpdu, const WifiTxVector& txVector);
620
621 /**
622 * Called when the CTS timeout expires.
623 *
624 * \param rts the RTS that solicited a CTS response
625 * \param txVector the TXVECTOR used to transmit the RTS frame
626 */
627 virtual void CtsTimeout(Ptr<WifiMpdu> rts, const WifiTxVector& txVector);
628 /**
629 * Take required actions when the CTS timer fired after sending an RTS to
630 * protect the given PSDU expires.
631 *
632 * \param psdu the PSDU protected by the failed RTS
633 */
634 void DoCtsTimeout(Ptr<WifiPsdu> psdu);
635
636 /**
637 * Reset this frame exchange manager.
638 */
639 virtual void Reset();
640
641 /**
642 * \param txVector the TXVECTOR decoded from PHY header.
643 * \param psduDuration the duration of the PSDU that is about to be received.
644 *
645 * This method is typically invoked by the lower PHY layer to notify
646 * the MAC layer that the reception of a PSDU is starting.
647 * This is equivalent to the PHY-RXSTART primitive.
648 * If the reception is correct for at least one MPDU of the PSDU
649 * the Receive method will be called after \p psduDuration.
650 */
651 virtual void RxStartIndication(WifiTxVector txVector, Time psduDuration);
652
653 private:
654 /**
655 * Send the current MPDU, which can be acknowledged by a Normal Ack.
656 */
657 void SendMpdu();
658
659 Ptr<WifiMpdu> m_mpdu; //!< the MPDU being transmitted
660 WifiTxParameters m_txParams; //!< the TX parameters for the current frame
661 Ptr<Packet> m_fragmentedPacket; //!< the MSDU being fragmented
662 bool m_moreFragments; //!< true if a fragment has to be sent after a SIFS
664 Ptr<WifiAckManager> m_ackManager; //!< Acknowledgment manager
665};
666
667} // namespace ns3
668
669#endif /* FRAME_EXCHANGE_MANAGER_H */
Callback template class.
Definition: callback.h:438
An identifier for simulation events.
Definition: event-id.h:55
FrameExchangeManager is a base class handling the basic frame exchange sequences for non-QoS stations...
std::set< Mac48Address > m_sentRtsTo
the STA(s) which we sent an RTS to (waiting for CTS)
void DoCtsTimeout(Ptr< WifiPsdu > psdu)
Take required actions when the CTS timer fired after sending an RTS to protect the given PSDU expires...
Ptr< WifiMpdu > m_mpdu
the MPDU being transmitted
virtual void SetAckManager(Ptr< WifiAckManager > ackManager)
Set the Acknowledgment Manager to use.
void NotifyOffNow()
This method is typically invoked by the PhyListener to notify the MAC layer that the device has been ...
virtual void NotifyInternalCollision(Ptr< Txop > txop)
Notify that an internal collision has occurred for the given Txop.
static TypeId GetTypeId()
Get the type ID.
uint8_t m_linkId
the ID of the link this object is associated with
Ptr< WifiMac > m_mac
the MAC layer on this station
Callback< void, WifiMacDropReason, Ptr< const WifiMpdu > > DroppedMpdu
typedef for a callback to invoke when an MPDU is dropped.
DroppedMpdu m_droppedMpduCallback
the dropped MPDU callback
virtual void SetWifiMac(const Ptr< WifiMac > mac)
Set the MAC layer to use.
virtual void ResetPhy()
Remove WifiPhy associated with this FrameExchangeManager.
virtual void UpdateNav(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector)
Update the NAV, if needed, based on the Duration/ID of the given psdu.
void SendMpduWithProtection(Ptr< WifiMpdu > mpdu, WifiTxParameters &txParams)
Send an MPDU with the given TX parameters (with the specified protection).
Ptr< WifiAckManager > m_ackManager
Acknowledgment manager.
Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager() const
void UpdateTxDuration(Mac48Address receiver, WifiTxParameters &txParams) const
Update the TX duration field of the given TX parameters after that the PSDU addressed to the given re...
virtual void CalculateAcknowledgmentTime(WifiAcknowledgment *acknowledgment) const
Calculate the time required to acknowledge a frame according to the given acknowledgment method.
Ptr< MacTxMiddle > m_txMiddle
the MAC TX Middle on this station
void SendNormalAck(const WifiMacHeader &hdr, const WifiTxVector &dataTxVector, double dataSnr)
Send Normal Ack.
Ptr< Packet > m_fragmentedPacket
the MSDU being fragmented
virtual void SetDroppedMpduCallback(DroppedMpdu callback)
Set the callback to invoke when an MPDU is dropped.
virtual void Reset()
Reset this frame exchange manager.
Callback< void, Ptr< const WifiMpdu > > AckedMpdu
typedef for a callback to invoke when an MPDU is successfully acknowledged.
Mac48Address m_self
the MAC address of this device
virtual void StartProtection(const WifiTxParameters &txParams)
Start the protection mechanism indicated by the given TX parameters.
virtual void TransmissionFailed()
Take necessary actions upon a transmission failure.
uint16_t m_allowedWidth
the allowed width in MHz for the current transmission
virtual void NotifyPacketDiscarded(Ptr< const WifiMpdu > mpdu)
Pass the given MPDU, discarded because of the max retry limit was reached, to the MPDU dropped callba...
WifiTxTimer m_txTimer
the timer set upon frame transmission
void SendCtsAfterRts(const WifiMacHeader &rtsHdr, WifiMode rtsTxMode, double rtsSnr)
Send CTS after receiving RTS.
std::set< Mac48Address > m_protectedStas
STAs that have replied to an RTS in this TXOP.
virtual Time GetRtsDurationId(const WifiTxVector &rtsTxVector, Time txDuration, Time response) const
Compute how to set the Duration/ID field of an RTS frame to send to protect a frame transmitted with ...
virtual void RetransmitMpduAfterMissedAck(Ptr< WifiMpdu > mpdu) const
Retransmit an MPDU that was not acknowledged.
Mac48Address GetAddress() const
Get the MAC address.
Ptr< WifiProtectionManager > m_protectionManager
Protection manager.
virtual void ProtectionCompleted()
Transmit prepared frame upon successful protection mechanism.
virtual void ForwardMpduDown(Ptr< WifiMpdu > mpdu, WifiTxVector &txVector)
Forward an MPDU down to the PHY layer.
virtual void SetLinkId(uint8_t linkId)
Set the ID of the link this Frame Exchange Manager is associated with.
virtual bool VirtualCsMediumIdle() const
void SendRts(const WifiTxParameters &txParams)
Send RTS to begin RTS-CTS-Data-Ack transaction.
virtual void NotifyReceivedNormalAck(Ptr< WifiMpdu > mpdu)
Notify other components that an MPDU was acknowledged.
virtual void NotifyChannelReleased(Ptr< Txop > txop)
Notify the given Txop that channel has been released.
virtual void NormalAckTimeout(Ptr< WifiMpdu > mpdu, const WifiTxVector &txVector)
Called when the Ack timeout expires.
virtual void NotifySwitchingStartNow(Time duration)
virtual void SetBssid(Mac48Address bssid)
Set the Basic Service Set Identification.
void SendCtsToSelf(const WifiTxParameters &txParams)
Send CTS for a CTS-to-self mechanism.
virtual void CtsTimeout(Ptr< WifiMpdu > rts, const WifiTxVector &txVector)
Called when the CTS timeout expires.
virtual void CalculateProtectionTime(WifiProtection *protection) const
Calculate the time required to protect a frame according to the given protection method.
virtual void SetAddress(Mac48Address address)
Set the MAC address.
Ptr< WifiAckManager > GetAckManager() const
Get the Acknowledgment Manager used by this node.
virtual void DequeueMpdu(Ptr< const WifiMpdu > mpdu)
Dequeue the given MPDU from the queue in which it is stored.
virtual void NavResetTimeout()
Reset the NAV upon expiration of the NAV reset timer.
const std::set< Mac48Address > & GetProtectedStas() const
Ptr< WifiProtectionManager > GetProtectionManager() const
Get the Protection Manager used by this node.
bool IsPromisc() const
Check if the device is operating in promiscuous mode.
void SendMpdu()
Send the current MPDU, which can be acknowledged by a Normal Ack.
virtual void EndReceiveAmpdu(Ptr< const WifiPsdu > psdu, const RxSignalInfo &rxSignalInfo, const WifiTxVector &txVector, const std::vector< bool > &perMpduStatus)
This method is called when the reception of an A-MPDU including multiple MPDUs is completed.
Ptr< MacRxMiddle > m_rxMiddle
the MAC RX Middle on this station
virtual void TransmissionSucceeded()
Take necessary actions upon a transmission success.
Ptr< Txop > m_dcf
the DCF/EDCAF that gained channel access
Ptr< WifiPhy > m_phy
the PHY layer on this station
Ptr< WifiMpdu > GetFirstFragmentIfNeeded(Ptr< WifiMpdu > mpdu)
Fragment the given MPDU if needed.
Ptr< WifiMpdu > GetNextFragment()
Get the next fragment of the current MSDU.
virtual void ReleaseSequenceNumbers(Ptr< const WifiPsdu > psdu) const
Make the sequence numbers of MPDUs included in the given PSDU available again if the MPDUs have never...
void SetAckedMpduCallback(AckedMpdu callback)
Set the callback to invoke when an MPDU is successfully acked.
virtual void PreProcessFrame(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector)
Perform actions that are possibly needed when receiving any frame, independently of whether the frame...
virtual Time GetFrameDurationId(const WifiMacHeader &header, uint32_t size, const WifiTxParameters &txParams, Ptr< Packet > fragmentedPacket) const
Compute how to set the Duration/ID field of a frame being transmitted with the given TX parameters.
virtual Time GetCtsToSelfDurationId(const WifiTxVector &ctsTxVector, Time txDuration, Time response) const
Compute how to set the Duration/ID field of a CTS-to-self frame to send to protect a frame transmitte...
void DoSendCtsAfterRts(const WifiMacHeader &rtsHdr, WifiTxVector &ctsTxVector, double rtsSnr)
Send CTS after receiving RTS.
void Receive(Ptr< const WifiPsdu > psdu, RxSignalInfo rxSignalInfo, WifiTxVector txVector, std::vector< bool > perMpduStatus)
This method is intended to be called by the PHY layer every time an MPDU is received and also when th...
Mac48Address m_bssid
BSSID address (Mac48Address)
virtual void SetWifiPhy(const Ptr< WifiPhy > phy)
Set the PHY layer to use.
AckedMpdu m_ackedMpduCallback
the acknowledged MPDU callback
virtual void FinalizeMacHeader(Ptr< const WifiPsdu > psdu)
Finalize the MAC header of the MPDUs in the given PSDU before transmission.
virtual void PostProcessFrame(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector)
Perform actions that are possibly needed after receiving any frame, independently of whether the fram...
virtual uint32_t GetPsduSize(Ptr< const WifiMpdu > mpdu, const WifiTxVector &txVector) const
Get the size in bytes of the given MPDU, which is to be transmitted with the given TXVECTOR.
Ptr< ChannelAccessManager > m_channelAccessManager
the channel access manager
virtual void ReceivedNormalAck(Ptr< WifiMpdu > mpdu, const WifiTxVector &txVector, const WifiTxVector &ackTxVector, const RxSignalInfo &rxInfo, double snr)
Perform the actions needed when a Normal Ack is received.
bool m_promisc
Flag if the device is operating in promiscuous mode.
void NotifySleepNow()
This method is typically invoked by the PhyListener to notify the MAC layer that the device has been ...
virtual void ReceiveMpdu(Ptr< const WifiMpdu > mpdu, RxSignalInfo rxSignalInfo, const WifiTxVector &txVector, bool inAmpdu)
This method handles the reception of an MPDU (possibly included in an A-MPDU)
virtual void SetChannelAccessManager(const Ptr< ChannelAccessManager > channelAccessManager)
Set the channel access manager to use.
bool m_moreFragments
true if a fragment has to be sent after a SIFS
void SetPromisc()
Enable promiscuous mode.
Time m_navEnd
NAV expiration time.
virtual void SetMacTxMiddle(const Ptr< MacTxMiddle > txMiddle)
Set the MAC TX Middle to use.
virtual void SetMacRxMiddle(const Ptr< MacRxMiddle > rxMiddle)
Set the MAC RX Middle to use.
virtual void SetProtectionManager(Ptr< WifiProtectionManager > protectionManager)
Set the Protection Manager to use.
Mac48Address GetBssid() const
Get the Basic Service Set Identification.
void DoDispose() override
Destructor implementation.
WifiTxParameters m_txParams
the TX parameters for the current frame
virtual bool StartTransmission(Ptr< Txop > dcf, uint16_t allowedWidth)
Request the FrameExchangeManager to start a frame exchange sequence.
virtual void RxStartIndication(WifiTxVector txVector, Time psduDuration)
EventId m_navResetEvent
the event to reset the NAV after an RTS
const WifiTxTimer & GetWifiTxTimer() const
Get a const reference to the WifiTxTimer object.
virtual Time GetTxDuration(uint32_t ppduPayloadSize, Mac48Address receiver, const WifiTxParameters &txParams) const
Get the updated TX duration of the frame associated with the given TX parameters if the size of the P...
an EUI-48 address
Definition: mac48-address.h:46
A base class which provides memory management and object aggregation.
Definition: object.h:89
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
Implements the IEEE 802.11 MAC header.
represent a single transmission mode
Definition: wifi-mode.h:51
This class stores the TX parameters (TX vector, protection mechanism, acknowledgment mechanism,...
This class is used to handle the timer that a station starts when transmitting a frame that solicits ...
Definition: wifi-tx-timer.h:49
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
RxSignalInfo structure containing info on the received signal.
Definition: phy-entity.h:69
WifiAcknowledgment is an abstract base struct.
WifiProtection is an abstract base struct.