/usr/include/ns3.27/ns3/edca-txop-n.h is in libns3-dev 3.27+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006, 2009 INRIA
* Copyright (c) 2009 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
* Mirko Banchi <mk.banchi@gmail.com>
*/
#ifndef EDCA_TXOP_N_H
#define EDCA_TXOP_N_H
#include "ns3/traced-value.h"
#include "block-ack-manager.h"
#include "dca-txop.h"
class AmpduAggregationTest;
namespace ns3 {
class QosBlockedDestinations;
class MsduAggregator;
class MpduAggregator;
class MgtAddBaResponseHeader;
class MgtDelBaHeader;
class AggregationCapableTransmissionListener;
/**
* Enumeration for type of station
*/
enum TypeOfStation
{
STA,
AP,
ADHOC_STA,
MESH,
HT_STA,
HT_AP,
HT_ADHOC_STA,
OCB
};
/**
* \ingroup wifi
* This queue contains packets for a particular access class.
* possibles access classes are:
*
* -AC_VO : voice, tid = 6,7 ^
* -AC_VI : video, tid = 4,5 |
* -AC_BE : best-effort, tid = 0,3 | priority
* -AC_BK : background, tid = 1,2 |
*
* For more details see section 9.1.3.1 in 802.11 standard.
*/
class EdcaTxopN : public DcaTxop
{
public:
/// Allow test cases to access private members
friend class ::AmpduAggregationTest;
std::map<Mac48Address, bool> m_aMpduEnabled; //!< list containing flags whether A-MPDU is enabled for a given destination address
/**
* \brief Get the type ID.
* \return the object TypeId
*/
static TypeId GetTypeId (void);
EdcaTxopN ();
virtual ~EdcaTxopN ();
/**
* Check for EDCA.
*
* \returns true if EDCA.
*/
bool IsEdca ();
/**
* Set WifiRemoteStationsManager this EdcaTxopN is associated to.
*
* \param remoteManager WifiRemoteStationManager.
*/
void SetWifiRemoteStationManager (const Ptr<WifiRemoteStationManager> remoteManager);
/**
* Set type of station with the given type.
*
* \param type the type of station.
*/
void SetTypeOfStation (TypeOfStation type);
/**
* Return type of station.
*
* \return type of station.
*/
TypeOfStation GetTypeOfStation (void) const;
/**
* Returns the aggregator used to construct A-MSDU subframes.
*
* \return the aggregator used to construct A-MSDU subframes.
*/
Ptr<MsduAggregator> GetMsduAggregator (void) const;
/**
* Returns the aggregator used to construct A-MPDU subframes.
*
* \return the aggregator used to construct A-MPDU subframes.
*/
Ptr<MpduAggregator> GetMpduAggregator (void) const;
/**
* \param address recipient address of the peer station
* \param tid traffic ID.
*
* \return true if a block ack agreement exists, false otherwise.
*
* Checks if a block ack agreement exists with station addressed by
* <i>recipient</i> for tid <i>tid</i>.
*/
bool GetBaAgreementExists (Mac48Address address, uint8_t tid) const;
/**
* \param address recipient address of peer station involved in block ack mechanism.
* \param tid traffic ID.
*
* \return the number of packets buffered for a specified agreement.
*
* Returns number of packets buffered for a specified agreement.
*/
uint32_t GetNOutstandingPacketsInBa (Mac48Address address, uint8_t tid) const;
/**
* \param recipient address of peer station involved in block ack mechanism.
* \param tid traffic ID.
*
* \return the number of packets for a specific agreement that need retransmission.
*
* Returns number of packets for a specific agreement that need retransmission.
*/
uint32_t GetNRetryNeededPackets (Mac48Address recipient, uint8_t tid) const;
/**
* \param recipient address of peer station involved in block ack mechanism.
* \param tid Ttraffic ID of transmitted packet.
*
* This function resets the status of OriginatorBlockAckAgreement after the transfer
* of an A-MPDU with ImmediateBlockAck policy (i.e. no BAR is scheduled).
*/
void CompleteAmpduTransfer (Mac48Address recipient, uint8_t tid);
/* dcf notifications forwarded here */
/**
* Check if the EDCAF requires access.
*
* \return true if the EDCAF requires access,
* false otherwise.
*/
bool NeedsAccess (void) const;
/**
* Notify the EDCAF that access has been granted.
*/
void NotifyAccessGranted (void);
/**
* Notify the EDCAF that internal collision has occurred.
*/
void NotifyInternalCollision (void);
/**
* Notify the EDCAF that collision has occurred.
*/
void NotifyCollision (void);
/* Event handlers */
/**
* Event handler when a CTS timeout has occurred.
*/
void MissedCts (void);
/**
* Event handler when an ACK is received.
*/
void GotAck (void);
/**
* Event handler when a Block ACK is received.
*
* \param blockAck block ack.
* \param recipient address of the recipient.
* \param rxSnr SNR of the block ack itself.
* \param txMode wifi mode.
* \param dataSnr reported data SNR from the peer.
*/
void GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address recipient, double rxSnr, WifiMode txMode, double dataSnr);
/**
* Event handler when a Block ACK timeout has occurred.
* \param nMpdus number of MPDUs sent in the A-MPDU transmission that results in a Block ACK timeout.
*/
void MissedBlockAck (uint8_t nMpdus);
/**
* Event handler when an ADDBA response is received.
*
* \param respHdr ADDBA response header.
* \param recipient address of the recipient.
*/
void GotAddBaResponse (const MgtAddBaResponseHeader *respHdr, Mac48Address recipient);
/**
* Event handler when a DELBA frame is received.
*
* \param delBaHdr DELBA header.
* \param recipient address of the recipient.
*/
void GotDelBaFrame (const MgtDelBaHeader *delBaHdr, Mac48Address recipient);
/**
* Event handler when an ACK is missed.
*/
void MissedAck (void);
/**
* Start transmission for the next packet if allowed by the TxopLimit.
*/
void StartNextPacket (void);
/**
* Event handler when a transmission that does not require an ACK has completed.
*/
void EndTxNoAck (void);
/**
* Restart access request if needed.
*/
void RestartAccessIfNeeded (void);
/**
* Request access from DCF manager if needed.
*/
void StartAccessIfNeeded (void);
/**
* Check if Block ACK Request should be re-transmitted.
*
* \return true if BAR should be re-transmitted,
* false otherwise.
*/
bool NeedBarRetransmission (void);
/**
* Check if the current packet should be fragmented.
*
* \return true if the current packet should be fragmented,
* false otherwise.
*/
bool NeedFragmentation (void) const;
/**
* Get the next fragment from the packet with
* appropriate Wifi header for the fragment.
*
* \param hdr Wi-Fi header.
*
* \return the fragment with the current fragment number.
*/
Ptr<Packet> GetFragmentPacket (WifiMacHeader *hdr);
/**
* Set the access category of this EDCAF.
*
* \param ac access category.
*/
void SetAccessCategory (AcIndex ac);
/**
* Set the aggregator used to construct A-MSDU subframes.
*
* \param aggr pointer to the MSDU aggregator.
*/
void SetMsduAggregator (const Ptr<MsduAggregator> aggr);
/**
* Set the aggregator used to construct A-MPDU subframes.
*
* \param aggr pointer to the MPDU aggregator.
*/
void SetMpduAggregator (const Ptr<MpduAggregator> aggr);
/**
* \param packet packet to send.
* \param hdr header of packet to send.
*
* Store the packet in the front of the internal queue until it
* can be sent safely.
*/
void PushFront (Ptr<const Packet> packet, const WifiMacHeader &hdr);
/**
* Complete block ACK configuration.
*/
void CompleteConfig (void);
/**
* Set threshold for block ACK mechanism. If number of packets in the
* queue reaches the threshold, block ACK mechanism is used.
*
* \param threshold block ack threshold value.
*/
void SetBlockAckThreshold (uint8_t threshold);
/**
* Return the current threshold for block ACK mechanism.
*
* \return the current threshold for block ACK mechanism.
*/
uint8_t GetBlockAckThreshold (void) const;
/**
* Set the Block Ack inactivity timeout.
*
* \param timeout the Block Ack inactivity timeout.
*/
void SetBlockAckInactivityTimeout (uint16_t timeout);
/**
* Sends DELBA frame to cancel a block ack agreement with sta
* addressed by <i>addr</i> for tid <i>tid</i>.
*
* \param addr address of the recipient.
* \param tid traffic ID.
* \param byOriginator flag to indicate whether this is set by the originator.
*/
void SendDelbaFrame (Mac48Address addr, uint8_t tid, bool byOriginator);
/**
* Stores an MPDU (part of an A-MPDU) in blockackagreement (i.e. the sender is waiting
* for a blockack containing the sequence number of this MPDU).
* It also calls NotifyMpdu transmission that updates the status of OriginatorBlockAckAgreement.
*
* \param packet received packet.
* \param hdr received Wi-Fi header.
* \param tstamp timestamp.
*/
void CompleteMpduTx (Ptr<const Packet> packet, WifiMacHeader hdr, Time tstamp);
/**
* Return whether A-MPDU is used to transmit data to a peer station.
*
* \param dest address of peer station
* \returns true if A-MPDU is used by the peer station
*/
bool GetAmpduExist (Mac48Address dest) const;
/**
* Set indication whether A-MPDU is used to transmit data to a peer station.
*
* \param dest address of peer station.
* \param enableAmpdu flag whether A-MPDU is used or not.
*/
void SetAmpduExist (Mac48Address dest, bool enableAmpdu);
/**
* Return the next sequence number for the given header.
*
* \param hdr Wi-Fi header.
*
* \return the next sequence number.
*/
uint16_t GetNextSequenceNumberFor (WifiMacHeader *hdr);
/**
* Return the next sequence number for the Traffic ID and destination, but do not pick it (i.e. the current sequence number remains unchanged).
*
* \param hdr Wi-Fi header.
*
* \return the next sequence number.
*/
uint16_t PeekNextSequenceNumberFor (WifiMacHeader *hdr);
/**
* Remove a packet after you peek in the retransmit queue and get it.
*
* \param tid traffic ID of the packet to be removed.
* \param recipient address of the recipient the packet was intended for.
* \param seqnumber sequence number of the packet to be removed.
*/
void RemoveRetransmitPacket (uint8_t tid, Mac48Address recipient, uint16_t seqnumber);
/**
* Peek in retransmit queue and get the next packet without removing it from the queue.
*
* \param header Wi-Fi header.
* \param recipient address of the recipient.
* \param tid traffic ID.
* \param timestamp the timestamp.
* \returns the packet.
*/
Ptr<const Packet> PeekNextRetransmitPacket (WifiMacHeader &header, Mac48Address recipient, uint8_t tid, Time *timestamp);
/**
* The packet we sent was successfully received by the receiver.
*
* \param hdr the header of the packet that we successfully sent.
*/
void BaTxOk (const WifiMacHeader &hdr);
/**
* The packet we sent was successfully received by the receiver.
*
* \param hdr the header of the packet that we failed to sent.
*/
void BaTxFailed (const WifiMacHeader &hdr);
/**
* This functions are used only to correctly set source address in A-MSDU subframes.
* If aggregating sta is a STA (in an infrastructured network):
* SA = Address2
* If aggregating sta is an AP
* SA = Address3
*
* \param hdr Wi-Fi header
* \return Mac48Address
*/
Mac48Address MapSrcAddressForAggregation (const WifiMacHeader &hdr);
/**
* This functions are used only to correctly set destination address in A-MSDU subframes.
* If aggregating sta is a STA (in an infrastructured network):
* DA = Address3
* If aggregating sta is an AP
* DA = Address1
*
* \param hdr Wi-Fi header
* \return Mac48Address
*/
Mac48Address MapDestAddressForAggregation (const WifiMacHeader &hdr);
private:
/// allow AggregationCapableTransmissionListener class access
friend class AggregationCapableTransmissionListener;
/**
* If number of packets in the queue reaches m_blockAckThreshold value, an ADDBA Request frame
* is sent to destination in order to setup a block ack.
*
* \return true if we tried to set up block ACK, false otherwise.
*/
bool SetupBlockAckIfNeeded ();
/**
* Sends an ADDBA Request to establish a block ack agreement with sta
* addressed by <i>recipient</i> for tid <i>tid</i>.
*
* \param recipient address of the recipient.
* \param tid traffic ID.
* \param startSeq starting sequence.
* \param timeout timeout value.
* \param immediateBAck flag to indicate whether immediate block ack is used.
*/
void SendAddBaRequest (Mac48Address recipient, uint8_t tid, uint16_t startSeq,
uint16_t timeout, bool immediateBAck);
/**
* After that all packets, for which a block ack agreement was established, have been
* transmitted, we have to send a block ack request.
*
* \param bar the block ack request.
*/
void SendBlockAckRequest (const Bar &bar);
/**
* For now is typically invoked to complete transmission of a packets sent with ack policy
* Block Ack: the packet is buffered and dcf is reset.
*/
void CompleteTx (void);
/**
* Verifies if dequeued packet has to be transmitted with ack policy Block Ack. This happens
* if an established block ack agreement exists with the receiver.
*/
void VerifyBlockAck (void);
/**
* Return the remaining duration in the current TXOP.
*
* \return the remaining duration in the current TXOP.
*/
Time GetTxopRemaining (void) const;
/**
* Check if the station has TXOP granted for the next MPDU.
*
* \return true if the station has TXOP granted for the next MPDU,
* false otherwise.
*/
bool HasTxop (void) const;
/**
* Calculate the size of the next fragment.
*
* \return the size of the next fragment.
*/
uint32_t GetNextFragmentSize (void) const;
/**
* Calculate the size of the current fragment.
*
* \return the size of the current fragment.
*/
uint32_t GetFragmentSize (void) const;
/**
* Calculate the offset for the current fragment.
*
* \return the offset for the current fragment.
*/
uint32_t GetFragmentOffset (void) const;
/**
* Check if the current fragment is the last fragment.
*
* \return true if the current fragment is the last fragment,
* false otherwise.
*/
bool IsLastFragment (void) const;
/**
* Check if the current packet is fragmented because of an exceeded TXOP duration.
*
* \return true if the current packet is fragmented because of an exceeded TXOP duration,
* false otherwise
*/
bool IsTxopFragmentation () const;
/**
* Calculate the size of the current TXOP fragment.
*
* \return the size of the current TXOP fragment
*/
uint32_t GetTxopFragmentSize () const;
/**
* Calculate the number of TXOP fragments needed for the transmission of the current packet.
*
* \return the number of TXOP fragments needed for the transmission of the current packet
*/
uint32_t GetNTxopFragment () const;
/**
* Calculate the size of the next TXOP fragment.
*
* \param fragmentNumber number of the next fragment
* \returns the next TXOP fragment size
*/
uint32_t GetNextTxopFragmentSize (uint32_t fragmentNumber) const;
/**
* Calculate the offset for the fragment.
*
* \param fragmentNumber number of the fragment
* \returns the TXOP fragment offset
*/
uint32_t GetTxopFragmentOffset (uint32_t fragmentNumber) const;
void DoDispose (void);
void DoInitialize (void);
AcIndex m_ac; //!< the access category
Ptr<MsduAggregator> m_msduAggregator; //!< A-MSDU aggregator
Ptr<MpduAggregator> m_mpduAggregator; //!< A-MPDU aggregator
TypeOfStation m_typeOfStation; //!< the type of station
Ptr<QosBlockedDestinations> m_qosBlockedDestinations; //!< QOS blocked destinations
Ptr<BlockAckManager> m_baManager; //!< the Block ACK manager
uint8_t m_blockAckThreshold; //!< the Block ACK threshold
BlockAckType m_blockAckType; //!< the Block ACK type
Time m_currentPacketTimestamp; //!< the current packet timestamp
uint16_t m_blockAckInactivityTimeout; //!< the Block ACK inactivity timeout
Bar m_currentBar; //!< the current BAR
Time m_startTxop; //!< the start TXOP time
bool m_isAccessRequestedForRts; //!< flag whether access is requested to transmit a RTS frame
bool m_currentIsFragmented; //!< flag whether current packet is fragmented
TracedValue<uint32_t> m_backoffTrace; //!< backoff trace value
TracedValue<uint32_t> m_cwTrace; //!< CW trace value
TracedCallback<Time, Time> m_txopTrace; //!< TXOP trace callback
};
} //namespace ns3
#endif /* EDCA_TXOP_N_H */
|